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

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


alias UInt8 = CUChar;

alias SInt8 = CChar;

alias UInt16 = UShort;

alias SInt16 = Short;

alias UInt32 = UInt;

alias SInt32 = Int;

record Struct_wide (
    lo : UInt,
    hi : Int,
);

alias wide = Struct_wide;

record Struct_UnsignedWide (
    lo : UInt,
    hi : UInt,
);

alias UnsignedWide = Struct_UnsignedWide;

alias SInt64 = Int64;

alias UInt64 = UInt64;

alias Fixed = Int;

alias FixedPtr = Pointer[Int];

alias Fract = Int;

alias FractPtr = Pointer[Int];

alias UnsignedFixed = UInt;

alias UnsignedFixedPtr = Pointer[UInt];

alias ShortFixed = Short;

alias ShortFixedPtr = Pointer[Short];

alias Float32 = Float;

alias Float64 = Double;

record Struct_Float80 (
    exp : Short,
    man : Array[UShort,4],
);

alias Float80 = Struct_Float80;

record Struct_Float96 (
    exp : Array[Short,2],
    man : Array[UShort,4],
);

alias Float96 = Struct_Float96;

record Struct_Float32Point (
    x : Float,
    y : Float,
);

alias Float32Point = Struct_Float32Point;

alias Ptr = Pointer[CChar];

alias Handle = Pointer[Ptr];

alias Size = CLong;

alias OSErr = Short;

alias OSStatus = Int;

alias LogicalAddress = RawPointer;

alias ConstLogicalAddress = RawPointer;

alias PhysicalAddress = RawPointer;

alias BytePtr = Pointer[CUChar];

alias ByteCount = CULong;

alias ByteOffset = CULong;

alias Duration = Int;

alias AbsoluteTime = UnsignedWide;

alias OptionBits = UInt;

alias ItemCount = CULong;

alias PBVersion = UInt;

alias ScriptCode = Short;

alias LangCode = Short;

alias RegionCode = Short;

alias FourCharCode = UInt;

alias OSType = UInt;

alias ResType = UInt;

alias OSTypePtr = Pointer[UInt];

alias ResTypePtr = Pointer[UInt];

alias Boolean = CUChar;

alias ProcPtr = CCodePointer[[],[CLong]];

alias Register68kProcPtr = CCodePointer[[],[]];

alias UniversalProcPtr = ProcPtr;

alias ProcHandle = Pointer[ProcPtr];

alias UniversalProcHandle = Pointer[UniversalProcPtr];

alias PRefCon = RawPointer;

alias URefCon = RawPointer;

alias SRefCon = RawPointer;

alias noErr = 0;

alias kNilOptions = 0;

alias kVariableLengthArray = 1;

alias kUnknownType = 1061109567;

alias UnicodeScalarValue = UInt;

alias UTF32Char = UInt;

alias UniChar = UShort;

alias UTF16Char = UShort;

alias UTF8Char = CUChar;

alias UniCharPtr = Pointer[UShort];

alias UniCharCount = CULong;

alias UniCharCountPtr = Pointer[CULong];

alias Str255 = Array[CUChar,256];

alias Str63 = Array[CUChar,64];

alias Str32 = Array[CUChar,33];

alias Str31 = Array[CUChar,32];

alias Str27 = Array[CUChar,28];

alias Str15 = Array[CUChar,16];

alias Str32Field = Array[CUChar,34];

alias StrFileName = Str63;

alias StringPtr = Pointer[CUChar];

alias StringHandle = Pointer[StringPtr];

alias ConstStringPtr = Pointer[CUChar];

alias ConstStr255Param = Pointer[CUChar];

alias ConstStr63Param = Pointer[CUChar];

alias ConstStr32Param = Pointer[CUChar];

alias ConstStr31Param = Pointer[CUChar];

alias ConstStr27Param = Pointer[CUChar];

alias ConstStr15Param = Pointer[CUChar];

alias ConstStrFileNameParam = ConstStr63Param;

record Struct_ProcessSerialNumber (
    highLongOfPSN : UInt,
    lowLongOfPSN : UInt,
);

alias ProcessSerialNumber = Struct_ProcessSerialNumber;

alias ProcessSerialNumberPtr = Pointer[ProcessSerialNumber];

record Struct_Point (
    v : Short,
    h : Short,
);

alias Point = Struct_Point;

alias PointPtr = Pointer[Point];

record Struct_Rect (
    top : Short,
    left : Short,
    bottom : Short,
    right : Short,
);

alias Rect = Struct_Rect;

alias RectPtr = Pointer[Rect];

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

alias FixedPoint = Struct_FixedPoint;

record Struct_FixedRect (
    left : Int,
    top : Int,
    right : Int,
    bottom : Int,
);

alias FixedRect = Struct_FixedRect;

alias CharParameter = Short;

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

alias Style = CUChar;

alias StyleParameter = Short;

alias StyleField = CUChar;

alias TimeValue = Int;

alias TimeScale = Int;

alias CompTimeValue = wide;

alias TimeValue64 = Int64;

alias TimeBase = OpaquePointer;

record Struct_TimeRecord (
    value : CompTimeValue,
    scale : Int,
    base : TimeBase,
);

alias TimeRecord = Struct_TimeRecord;

record Struct_NumVersion (
    nonRelRev : CUChar,
    stage : CUChar,
    minorAndBugRev : CUChar,
    majorRev : CUChar,
);

alias NumVersion = Struct_NumVersion;

alias developStage = 32;
alias alphaStage = 64;
alias betaStage = 96;
alias finalStage = 128;

alias NumVersionVariant = AUnionType;

alias NumVersionVariantPtr = Pointer[NumVersionVariant];

alias NumVersionVariantHandle = Pointer[NumVersionVariantPtr];

record Struct_VersRec (
    numericVersion : NumVersion,
    countryCode : Short,
    shortVersion : Str255,
    reserved : Str255,
);

alias VersRec = Struct_VersRec;

alias VersRecPtr = Pointer[VersRec];

alias VersRecHndl = Pointer[VersRecPtr];

alias Byte = CUChar;

alias SignedByte = CChar;

alias WidePtr = Pointer[wide];

alias UnsignedWidePtr = Pointer[UnsignedWide];

alias extended80 = Float80;

alias extended96 = Float96;

alias VHSelect = CChar;

external Debugger();

external DebugStr(
    debuggerMsg : ConstStr255Param);

external SysBreak();

external SysBreakStr(
    debuggerMsg : ConstStr255Param);

external SysBreakFunc(
    debuggerMsg : ConstStr255Param);

alias kClippingCreator = 1685217639;
alias kClippingPictureType = 1668051056;
alias kClippingTextType = 1668051060;
alias kClippingSoundType = 1668051059;
alias kClippingUnknownType = 1668051061;

alias kInternetLocationCreator = 1685217639;
alias kInternetLocationHTTP = 1768712308;
alias kInternetLocationFTP = 1768711796;
alias kInternetLocationFile = 1768711785;
alias kInternetLocationMail = 1768713569;
alias kInternetLocationNNTP = 1768713847;
alias kInternetLocationAFP = 1768710502;
alias kInternetLocationAppleTalk = 1768710516;
alias kInternetLocationNSL = 1768713843;
alias kInternetLocationGeneric = 1768712037;

alias kCustomIconResource = 4294950841;

alias kCustomBadgeResourceType = 1650549863;
alias kCustomBadgeResourceID = 4294950841;
alias kCustomBadgeResourceVersion = 0;

record Struct_CustomBadgeResource (
    version : Short,
    customBadgeResourceID : Short,
    customBadgeType : UInt,
    customBadgeCreator : UInt,
    windowBadgeType : UInt,
    windowBadgeCreator : UInt,
    overrideType : UInt,
    overrideCreator : UInt,
);

alias CustomBadgeResource = Struct_CustomBadgeResource;

alias CustomBadgeResourcePtr = Pointer[CustomBadgeResource];

alias CustomBadgeResourceHandle = Pointer[CustomBadgeResourcePtr];

alias kRoutingResourceType = 1919907188;
alias kRoutingResourceID = 0;

record Struct_RoutingResourceEntry (
    creator : UInt,
    fileType : UInt,
    targetFolder : UInt,
    destinationFolder : UInt,
    reservedField : UInt,
);

alias RoutingResourceEntry = Struct_RoutingResourceEntry;

alias RoutingResourcePtr = Pointer[RoutingResourceEntry];

alias RoutingResourceHandle = Pointer[RoutingResourcePtr];

alias kContainerFolderAliasType = 1717858928;
alias kContainerTrashAliasType = 1953657704;
alias kContainerHardDiskAliasType = 1751413611;
alias kContainerFloppyAliasType = 1718382713;
alias kContainerServerAliasType = 1936881266;
alias kApplicationAliasType = 1633972848;
alias kContainerAliasType = 1685221232;
alias kDesktopPrinterAliasType = 1685352545;
alias kContainerCDROMAliasType = 1667523698;
alias kApplicationCPAliasType = 1633903728;
alias kApplicationDAAliasType = 1633969264;
alias kPackageAliasType = 1718643553;
alias kAppPackageAliasType = 1717661793;

alias kSystemFolderAliasType = 1717662585;
alias kAppleMenuFolderAliasType = 1717657965;
alias kStartupFolderAliasType = 1717662580;
alias kPrintMonitorDocsFolderAliasType = 1717661806;
alias kPreferencesFolderAliasType = 1717661798;
alias kControlPanelFolderAliasType = 1717658484;
alias kExtensionFolderAliasType = 1717659000;

alias kExportedFolderAliasType = 1717658996;
alias kDropFolderAliasType = 1717658738;
alias kSharedFolderAliasType = 1717662568;
alias kMountedFolderAliasType = 1717661038;

alias kIsOnDesk = 1;
alias kColor = 14;
alias kIsShared = 64;
alias kHasNoINITs = 128;
alias kHasBeenInited = 256;
alias kHasCustomIcon = 1024;
alias kIsStationery = 2048;
alias kNameLocked = 4096;
alias kHasBundle = 8192;
alias kIsInvisible = 16384;
alias kIsAlias = 32768;

alias fOnDesk = 1;
alias fHasBundle = 8192;
alias fInvisible = 16384;

alias fTrash = 4294967293;
alias fDesktop = 4294967294;
alias fDisk = 0;

alias kExtendedFlagsAreInvalid = 32768;
alias kExtendedFlagHasCustomBadge = 256;
alias kExtendedFlagObjectIsBusy = 128;
alias kExtendedFlagHasRoutingInfo = 4;

alias kFirstMagicBusyFiletype = 1652193568;
alias kLastMagicBusyFiletype = 1652193599;

alias kMagicBusyCreationDate = 1329266096;

record Struct_FileInfo (
    fileType : UInt,
    fileCreator : UInt,
    finderFlags : UShort,
    location : Point,
    reservedField : UShort,
);

alias FileInfo = Struct_FileInfo;

record Struct_FolderInfo (
    windowBounds : Rect,
    finderFlags : UShort,
    location : Point,
    reservedField : UShort,
);

alias FolderInfo = Struct_FolderInfo;

record Struct_ExtendedFileInfo (
    reserved1 : Array[Short,4],
    extendedFinderFlags : UShort,
    reserved2 : Short,
    putAwayFolderID : Int,
);

alias ExtendedFileInfo = Struct_ExtendedFileInfo;

record Struct_ExtendedFolderInfo (
    scrollPosition : Point,
    reserved1 : Int,
    extendedFinderFlags : UShort,
    reserved2 : Short,
    putAwayFolderID : Int,
);

alias ExtendedFolderInfo = Struct_ExtendedFolderInfo;

record Struct_FInfo (
    fdType : UInt,
    fdCreator : UInt,
    fdFlags : UShort,
    fdLocation : Point,
    fdFldr : Short,
);

alias FInfo = Struct_FInfo;

record Struct_FXInfo (
    fdIconID : Short,
    fdReserved : Array[Short,3],
    fdScript : CChar,
    fdXFlags : CChar,
    fdComment : Short,
    fdPutAway : Int,
);

alias FXInfo = Struct_FXInfo;

record Struct_DInfo (
    frRect : Rect,
    frFlags : UShort,
    frLocation : Point,
    frView : Short,
);

alias DInfo = Struct_DInfo;

record Struct_DXInfo (
    frScroll : Point,
    frOpenChain : Int,
    frScript : CChar,
    frXFlags : CChar,
    frComment : Short,
    frPutAway : Int,
);

alias DXInfo = Struct_DXInfo;

external FixRatio(
    numer : Short,
    denom : Short) : Int;

external FixMul(
    a : Int,
    b : Int) : Int;

external FixRound(
    x : Int) : Short;

external Fix2Frac(
    x : Int) : Int;

external Fix2Long(
    x : Int) : Int;

external Long2Fix(
    x : Int) : Int;

external Frac2Fix(
    x : Int) : Int;

external FracMul(
    x : Int,
    y : Int) : Int;

external FixDiv(
    x : Int,
    y : Int) : Int;

external FracDiv(
    x : Int,
    y : Int) : Int;

external FracSqrt(
    x : Int) : Int;

external FracSin(
    x : Int) : Int;

external FracCos(
    x : Int) : Int;

external FixATan2(
    x : Int,
    y : Int) : Int;

external Frac2X(
    x : Int) : Double;

external Fix2X(
    x : Int) : Double;

external X2Fix(
    x : Double) : Int;

external X2Frac(
    x : Double) : Int;

external WideCompare(
    target : Pointer[wide],
    source : Pointer[wide]) : Short;

external WideAdd(
    target : Pointer[wide],
    source : Pointer[wide]) : Pointer[wide];

external WideSubtract(
    target : Pointer[wide],
    source : Pointer[wide]) : Pointer[wide];

external WideNegate(
    target : Pointer[wide]) : Pointer[wide];

external WideShift(
    target : Pointer[wide],
    shift : Int) : Pointer[wide];

external WideSquareRoot(
    source : Pointer[wide]) : UInt;

external WideMultiply(
    multiplicand : Int,
    multiplier : Int,
    target : Pointer[wide]) : Pointer[wide];

external WideDivide(
    dividend : Pointer[wide],
    divisor : Int,
    remainder : Pointer[Int]) : Int;

external WideWideDivide(
    dividend : Pointer[wide],
    divisor : Int,
    remainder : Pointer[Int]) : Pointer[wide];

external WideBitShift(
    target : Pointer[wide],
    shift : Int) : Pointer[wide];

external UnsignedFixedMulDiv(
    value : UInt,
    multiplier : UInt,
    divisor : UInt) : UInt;

alias itlcShowIcon = 7;
alias itlcDualCaret = 6;
alias itlcSysDirection = 15;

alias itlcDisableKeyScriptSync = 3;

alias itlcDisableKeyScriptSyncMask = 8;

alias tokLeftQuote = 1;
alias tokRightQuote = 2;
alias tokLeadPlacer = 3;
alias tokLeader = 4;
alias tokNonLeader = 5;
alias tokZeroLead = 6;
alias tokPercent = 7;
alias tokPlusSign = 8;
alias tokMinusSign = 9;
alias tokThousands = 10;
alias tokReserved = 11;
alias tokSeparator = 12;
alias tokEscape = 13;
alias tokDecPoint = 14;
alias tokEPlus = 15;
alias tokEMinus = 16;
alias tokMaxSymbols = 31;
alias curNumberPartsVersion = 1;

alias currSymLead = 16;
alias currNegSym = 32;
alias currTrailingZ = 64;
alias currLeadingZ = 128;

alias mdy = 0;
alias dmy = 1;
alias ymd = 2;
alias myd = 3;
alias dym = 4;
alias ydm = 5;

alias DateOrders = CChar;

alias timeCycle24 = 0;
alias timeCycleZero = 1;
alias timeCycle12 = 255;
alias zeroCycle = 1;
alias longDay = 0;
alias longWeek = 1;
alias longMonth = 2;
alias longYear = 3;
alias supDay = 1;
alias supWeek = 2;
alias supMonth = 4;
alias supYear = 8;
alias dayLdingZ = 32;
alias mntLdingZ = 64;
alias century = 128;
alias secLeadingZ = 32;
alias minLeadingZ = 64;
alias hrLeadingZ = 128;

record Struct_OffPair (
    offFirst : Short,
    offSecond : Short,
);

alias OffPair = Struct_OffPair;

alias OffsetTable = Array[OffPair,3];

record Struct_Intl0Rec (
    decimalPt : CChar,
    thousSep : CChar,
    listSep : CChar,
    currSym1 : CChar,
    currSym2 : CChar,
    currSym3 : CChar,
    currFmt : CUChar,
    dateOrder : CUChar,
    shrtDateFmt : CUChar,
    dateSep : CChar,
    timeCycle : CUChar,
    timeFmt : CUChar,
    mornStr : Array[CChar,4],
    eveStr : Array[CChar,4],
    timeSep : CChar,
    time1Suff : CChar,
    time2Suff : CChar,
    time3Suff : CChar,
    time4Suff : CChar,
    time5Suff : CChar,
    time6Suff : CChar,
    time7Suff : CChar,
    time8Suff : CChar,
    metricSys : CUChar,
    intl0Vers : Short,
);

alias Intl0Rec = Struct_Intl0Rec;

alias Intl0Ptr = Pointer[Intl0Rec];

alias Intl0Hndl = Pointer[Intl0Ptr];

record Struct_Intl1Rec (
    days : Array[Str15,7],
    months : Array[Str15,12],
    suppressDay : CUChar,
    lngDateFmt : CUChar,
    dayLeading0 : CUChar,
    abbrLen : CUChar,
    st0 : Array[CChar,4],
    st1 : Array[CChar,4],
    st2 : Array[CChar,4],
    st3 : Array[CChar,4],
    st4 : Array[CChar,4],
    intl1Vers : Short,
    localRtn : Array[Short,1],
);

alias Intl1Rec = Struct_Intl1Rec;

alias Intl1Ptr = Pointer[Intl1Rec];

alias Intl1Hndl = Pointer[Intl1Ptr];

record Struct_Itl1ExtRec (
    base : Intl1Rec,
    version : Short,
    format : Short,
    calendarCode : Short,
    extraDaysTableOffset : Int,
    extraDaysTableLength : Int,
    extraMonthsTableOffset : Int,
    extraMonthsTableLength : Int,
    abbrevDaysTableOffset : Int,
    abbrevDaysTableLength : Int,
    abbrevMonthsTableOffset : Int,
    abbrevMonthsTableLength : Int,
    extraSepsTableOffset : Int,
    extraSepsTableLength : Int,
    tables : Array[Short,1],
);

alias Itl1ExtRec = Struct_Itl1ExtRec;

record Struct_UntokenTable (
    len : Short,
    lastToken : Short,
    index : Array[Short,256],
);

alias UntokenTable = Struct_UntokenTable;

alias UntokenTablePtr = Pointer[UntokenTable];

alias UntokenTableHandle = Pointer[UntokenTablePtr];

alias WideChar = AUnionType;

record Struct_WideCharArr (
    size : Short,
    data : Array[WideChar,10],
);

alias WideCharArr = Struct_WideCharArr;

record Struct_NumberParts (
    version : Short,
    data : Array[WideChar,31],
    pePlus : WideCharArr,
    peMinus : WideCharArr,
    peMinusPlus : WideCharArr,
    altNumTable : WideCharArr,
    reserved : Array[CChar,20],
);

alias NumberParts = Struct_NumberParts;

alias NumberPartsPtr = Pointer[NumberParts];

record Struct_Itl4Rec (
    flags : Short,
    resourceType : Int,
    resourceNum : Short,
    version : Short,
    resHeader1 : Int,
    resHeader2 : Int,
    numTables : Short,
    mapOffset : Int,
    strOffset : Int,
    fetchOffset : Int,
    unTokenOffset : Int,
    defPartsOffset : Int,
    resOffset6 : Int,
    resOffset7 : Int,
    resOffset8 : Int,
);

alias Itl4Rec = Struct_Itl4Rec;

alias Itl4Ptr = Pointer[Itl4Rec];

alias Itl4Handle = Pointer[Itl4Ptr];

record Struct_NItl4Rec (
    flags : Short,
    resourceType : Int,
    resourceNum : Short,
    version : Short,
    format : Short,
    resHeader : Short,
    resHeader2 : Int,
    numTables : Short,
    mapOffset : Int,
    strOffset : Int,
    fetchOffset : Int,
    unTokenOffset : Int,
    defPartsOffset : Int,
    whtSpListOffset : Int,
    resOffset7 : Int,
    resOffset8 : Int,
    resLength1 : Short,
    resLength2 : Short,
    resLength3 : Short,
    unTokenLength : Short,
    defPartsLength : Short,
    whtSpListLength : Short,
    resLength7 : Short,
    resLength8 : Short,
);

alias NItl4Rec = Struct_NItl4Rec;

alias NItl4Ptr = Pointer[NItl4Rec];

alias NItl4Handle = Pointer[NItl4Ptr];

record Struct_TableDirectoryRecord (
    tableSignature : UInt,
    reserved : UInt,
    tableStartOffset : UInt,
    tableSize : UInt,
);

alias TableDirectoryRecord = Struct_TableDirectoryRecord;

record Struct_Itl5Record (
    versionNumber : Int,
    numberOfTables : UShort,
    reserved : Array[UShort,3],
    tableDirectory : Array[TableDirectoryRecord,1],
);

alias Itl5Record = Struct_Itl5Record;

record Struct_RuleBasedTrslRecord (
    sourceType : Short,
    targetType : Short,
    formatNumber : Short,
    propertyFlag : Short,
    numberOfRules : Short,
);

alias RuleBasedTrslRecord = Struct_RuleBasedTrslRecord;

record Struct_ItlcRecord (
    itlcSystem : Short,
    itlcReserved : Short,
    itlcFontForce : CChar,
    itlcIntlForce : CChar,
    itlcOldKybd : CChar,
    itlcFlags : CChar,
    itlcIconOffset : Short,
    itlcIconSide : CChar,
    itlcIconRsvd : CChar,
    itlcRegionCode : Short,
    itlcSysFlags : Short,
    itlcReserved4 : Array[CChar,32],
);

alias ItlcRecord = Struct_ItlcRecord;

record Struct_ItlbRecord (
    itlbNumber : Short,
    itlbDate : Short,
    itlbSort : Short,
    itlbFlags : Short,
    itlbToken : Short,
    itlbEncoding : Short,
    itlbLang : Short,
    itlbNumRep : CChar,
    itlbDateRep : CChar,
    itlbKeys : Short,
    itlbIcon : Short,
);

alias ItlbRecord = Struct_ItlbRecord;

record Struct_ItlbExtRecord (
    base : ItlbRecord,
    itlbLocalSize : Int,
    itlbMonoFond : Short,
    itlbMonoSize : Short,
    itlbPrefFond : Short,
    itlbPrefSize : Short,
    itlbSmallFond : Short,
    itlbSmallSize : Short,
    itlbSysFond : Short,
    itlbSysSize : Short,
    itlbAppFond : Short,
    itlbAppSize : Short,
    itlbHelpFond : Short,
    itlbHelpSize : Short,
    itlbValidStyles : CUChar,
    itlbAliasStyle : CUChar,
);

alias ItlbExtRecord = Struct_ItlbExtRecord;

alias smSystemScript = 4294967295;
alias smCurrentScript = 4294967294;
alias smAllScripts = 4294967293;

alias smRoman = 0;
alias smJapanese = 1;
alias smTradChinese = 2;
alias smKorean = 3;
alias smArabic = 4;
alias smHebrew = 5;
alias smGreek = 6;
alias smCyrillic = 7;
alias smRSymbol = 8;
alias smDevanagari = 9;
alias smGurmukhi = 10;
alias smGujarati = 11;
alias smOriya = 12;
alias smBengali = 13;
alias smTamil = 14;
alias smTelugu = 15;
alias smKannada = 16;
alias smMalayalam = 17;
alias smSinhalese = 18;
alias smBurmese = 19;
alias smKhmer = 20;
alias smThai = 21;
alias smLao = 22;
alias smGeorgian = 23;
alias smArmenian = 24;
alias smSimpChinese = 25;
alias smTibetan = 26;
alias smMongolian = 27;
alias smEthiopic = 28;
alias smGeez = 28;
alias smCentralEuroRoman = 29;
alias smVietnamese = 30;
alias smExtArabic = 31;
alias smUninterp = 32;

alias smUnicodeScript = 126;

alias smChinese = 2;
alias smRussian = 7;
alias smLaotian = 22;
alias smAmharic = 28;
alias smSlavic = 29;
alias smEastEurRoman = 29;
alias smSindhi = 31;
alias smKlingon = 32;

alias langEnglish = 0;
alias langFrench = 1;
alias langGerman = 2;
alias langItalian = 3;
alias langDutch = 4;
alias langSwedish = 5;
alias langSpanish = 6;
alias langDanish = 7;
alias langPortuguese = 8;
alias langNorwegian = 9;
alias langHebrew = 10;
alias langJapanese = 11;
alias langArabic = 12;
alias langFinnish = 13;
alias langGreek = 14;
alias langIcelandic = 15;
alias langMaltese = 16;
alias langTurkish = 17;
alias langCroatian = 18;
alias langTradChinese = 19;
alias langUrdu = 20;
alias langHindi = 21;
alias langThai = 22;
alias langKorean = 23;

alias langLithuanian = 24;
alias langPolish = 25;
alias langHungarian = 26;
alias langEstonian = 27;
alias langLatvian = 28;
alias langSami = 29;
alias langFaroese = 30;
alias langFarsi = 31;
alias langPersian = 31;
alias langRussian = 32;
alias langSimpChinese = 33;
alias langFlemish = 34;
alias langIrishGaelic = 35;
alias langAlbanian = 36;
alias langRomanian = 37;
alias langCzech = 38;
alias langSlovak = 39;
alias langSlovenian = 40;
alias langYiddish = 41;
alias langSerbian = 42;
alias langMacedonian = 43;
alias langBulgarian = 44;
alias langUkrainian = 45;
alias langByelorussian = 46;
alias langBelorussian = 46;

alias langUzbek = 47;
alias langKazakh = 48;
alias langAzerbaijani = 49;
alias langAzerbaijanAr = 50;
alias langArmenian = 51;
alias langGeorgian = 52;
alias langMoldavian = 53;
alias langKirghiz = 54;
alias langTajiki = 55;
alias langTurkmen = 56;
alias langMongolian = 57;
alias langMongolianCyr = 58;
alias langPashto = 59;
alias langKurdish = 60;
alias langKashmiri = 61;
alias langSindhi = 62;
alias langTibetan = 63;
alias langNepali = 64;
alias langSanskrit = 65;
alias langMarathi = 66;
alias langBengali = 67;
alias langAssamese = 68;
alias langGujarati = 69;
alias langPunjabi = 70;

alias langOriya = 71;
alias langMalayalam = 72;
alias langKannada = 73;
alias langTamil = 74;
alias langTelugu = 75;
alias langSinhalese = 76;
alias langBurmese = 77;
alias langKhmer = 78;
alias langLao = 79;
alias langVietnamese = 80;
alias langIndonesian = 81;
alias langTagalog = 82;
alias langMalayRoman = 83;
alias langMalayArabic = 84;
alias langAmharic = 85;
alias langTigrinya = 86;
alias langOromo = 87;
alias langSomali = 88;
alias langSwahili = 89;
alias langKinyarwanda = 90;
alias langRuanda = 90;
alias langRundi = 91;
alias langNyanja = 92;
alias langChewa = 92;
alias langMalagasy = 93;
alias langEsperanto = 94;

alias langWelsh = 128;
alias langBasque = 129;
alias langCatalan = 130;
alias langLatin = 131;
alias langQuechua = 132;
alias langGuarani = 133;
alias langAymara = 134;
alias langTatar = 135;
alias langUighur = 136;
alias langDzongkha = 137;
alias langJavaneseRom = 138;
alias langSundaneseRom = 139;
alias langGalician = 140;
alias langAfrikaans = 141;

alias langBreton = 142;
alias langInuktitut = 143;
alias langScottishGaelic = 144;
alias langManxGaelic = 145;
alias langIrishGaelicScript = 146;
alias langTongan = 147;
alias langGreekAncient = 148;
alias langGreenlandic = 149;
alias langAzerbaijanRoman = 150;
alias langNynorsk = 151;

alias langUnspecified = 32767;

alias langPortugese = 8;
alias langMalta = 16;
alias langYugoslavian = 18;
alias langChinese = 19;
alias langLettish = 28;
alias langLapponian = 29;
alias langLappish = 29;
alias langSaamisk = 29;
alias langFaeroese = 30;
alias langIrish = 35;
alias langGalla = 87;
alias langAfricaans = 141;
alias langGreekPoly = 148;

alias verUS = 0;
alias verFrance = 1;
alias verBritain = 2;
alias verGermany = 3;
alias verItaly = 4;
alias verNetherlands = 5;
alias verFlemish = 6;
alias verSweden = 7;
alias verSpain = 8;
alias verDenmark = 9;
alias verPortugal = 10;
alias verFrCanada = 11;
alias verNorway = 12;
alias verIsrael = 13;
alias verJapan = 14;
alias verAustralia = 15;
alias verArabic = 16;
alias verFinland = 17;
alias verFrSwiss = 18;
alias verGrSwiss = 19;
alias verGreece = 20;
alias verIceland = 21;
alias verMalta = 22;
alias verCyprus = 23;
alias verTurkey = 24;
alias verYugoCroatian = 25;

alias verNetherlandsComma = 26;
alias verFlemishPoint = 27;
alias verCanadaComma = 28;
alias verCanadaPoint = 29;
alias vervariantPortugal = 30;
alias vervariantNorway = 31;
alias vervariantDenmark = 32;

alias verIndiaHindi = 33;
alias verPakistanUrdu = 34;
alias verTurkishModified = 35;
alias verItalianSwiss = 36;
alias verInternational = 37;
alias verRomania = 39;
alias verGreekAncient = 40;
alias verLithuania = 41;
alias verPoland = 42;
alias verHungary = 43;
alias verEstonia = 44;
alias verLatvia = 45;
alias verSami = 46;
alias verFaroeIsl = 47;
alias verIran = 48;
alias verRussia = 49;
alias verIreland = 50;
alias verKorea = 51;
alias verChina = 52;
alias verTaiwan = 53;
alias verThailand = 54;
alias verScriptGeneric = 55;
alias verCzech = 56;
alias verSlovak = 57;
alias verEastAsiaGeneric = 58;
alias verMagyar = 59;
alias verBengali = 60;
alias verBelarus = 61;

alias verUkraine = 62;
alias verGreeceAlt = 64;
alias verSerbian = 65;
alias verSlovenian = 66;
alias verMacedonian = 67;
alias verCroatia = 68;
alias verGermanReformed = 70;
alias verBrazil = 71;
alias verBulgaria = 72;
alias verCatalonia = 73;
alias verMultilingual = 74;
alias verScottishGaelic = 75;
alias verManxGaelic = 76;
alias verBreton = 77;
alias verNunavut = 78;
alias verWelsh = 79;
alias verIrishGaelicScript = 81;
alias verEngCanada = 82;
alias verBhutan = 83;
alias verArmenian = 84;
alias verGeorgian = 85;
alias verSpLatinAmerica = 86;
alias verTonga = 88;
alias verFrenchUniversal = 91;
alias verAustria = 92;
alias verGujarati = 94;
alias verPunjabi = 95;
alias verIndiaUrdu = 96;
alias verVietnam = 97;

alias verFrBelgium = 98;
alias verUzbek = 99;
alias verSingapore = 100;
alias verNynorsk = 101;
alias verAfrikaans = 102;
alias verEsperanto = 103;
alias verMarathi = 104;
alias verTibetan = 105;
alias verNepal = 106;
alias verGreenland = 107;
alias verIrelandEnglish = 108;

alias verFrBelgiumLux = 6;
alias verBelgiumLux = 6;
alias verArabia = 16;
alias verYugoslavia = 25;
alias verBelgiumLuxPoint = 27;
alias verIndia = 33;
alias verPakistan = 34;
alias verRumania = 39;
alias verGreecePoly = 40;
alias verLapland = 46;
alias verFaeroeIsl = 47;
alias verGenericFE = 58;
alias verFarEastGeneric = 58;
alias verByeloRussian = 61;
alias verUkrania = 62;
alias verAlternateGr = 64;
alias verSerbia = 65;
alias verSlovenia = 66;
alias verMacedonia = 67;
alias verBrittany = 77;
alias verWales = 79;
alias verArmenia = 84;
alias verGeorgia = 85;
alias verAustriaGerman = 92;
alias verTibet = 105;

alias minCountry = 0;
alias maxCountry = 108;

alias calGregorian = 0;
alias calArabicCivil = 1;
alias calArabicLunar = 2;
alias calJapanese = 3;
alias calJewish = 4;
alias calCoptic = 5;
alias calPersian = 6;

alias intWestern = 0;
alias intArabic = 1;
alias intRoman = 2;
alias intJapanese = 3;
alias intEuropean = 4;
alias intOutputMask = 32768;

alias smSingleByte = 0;
alias smFirstByte = 4294967295;
alias smLastByte = 1;
alias smMiddleByte = 2;

alias smcTypeMask = 15;
alias smcReserved = 240;
alias smcClassMask = 3840;
alias smcOrientationMask = 4096;
alias smcRightMask = 8192;
alias smcUpperMask = 16384;
alias smcDoubleMask = 32768;

alias smCharPunct = 0;
alias smCharAscii = 1;
alias smCharEuro = 7;
alias smCharExtAscii = 7;
alias smCharKatakana = 2;
alias smCharHiragana = 3;
alias smCharIdeographic = 4;
alias smCharTwoByteGreek = 5;
alias smCharTwoByteRussian = 6;
alias smCharBidirect = 8;
alias smCharContextualLR = 9;
alias smCharNonContextualLR = 10;
alias smCharHangul = 12;
alias smCharJamo = 13;
alias smCharBopomofo = 14;
alias smCharGanaKana = 15;
alias smCharFISKana = 2;
alias smCharFISGana = 3;
alias smCharFISIdeo = 4;

alias smCharFISGreek = 5;
alias smCharFISRussian = 6;
alias smPunctNormal = 0;
alias smPunctNumber = 256;
alias smPunctSymbol = 512;
alias smPunctBlank = 768;
alias smPunctRepeat = 1024;
alias smPunctGraphic = 1280;
alias smKanaSmall = 256;
alias smKanaHardOK = 512;
alias smKanaSoftOK = 768;
alias smIdeographicLevel1 = 0;
alias smIdeographicLevel2 = 256;
alias smIdeographicUser = 512;
alias smFISClassLvl1 = 0;
alias smFISClassLvl2 = 256;
alias smFISClassUser = 512;
alias smJamoJaeum = 0;
alias smJamoBogJaeum = 256;
alias smJamoMoeum = 512;
alias smJamoBogMoeum = 768;

alias smCharHorizontal = 0;
alias smCharVertical = 4096;
alias smCharLeft = 0;
alias smCharRight = 8192;
alias smCharLower = 0;
alias smCharUpper = 16384;
alias smChar1byte = 0;
alias smChar2byte = 32768;

alias smTransAscii = 0;
alias smTransNative = 1;
alias smTransCase = 254;
alias smTransSystem = 255;
alias smTransAscii1 = 2;
alias smTransAscii2 = 3;
alias smTransKana1 = 4;
alias smTransKana2 = 5;

alias smTransGana2 = 7;
alias smTransHangul2 = 8;
alias smTransJamo2 = 9;
alias smTransBopomofo2 = 10;
alias smTransLower = 16384;
alias smTransUpper = 32768;
alias smTransRuleBaseFormat = 1;
alias smTransHangulFormat = 2;
alias smTransPreDoubleByting = 1;
alias smTransPreLowerCasing = 2;

alias smMaskAll = 4294967295;
alias smMaskAscii = 1;
alias smMaskNative = 2;
alias smMaskAscii1 = 4;
alias smMaskAscii2 = 8;
alias smMaskKana1 = 16;
alias smMaskKana2 = 32;
alias smMaskGana2 = 128;
alias smMaskHangul2 = 256;
alias smMaskJamo2 = 512;
alias smMaskBopomofo2 = 1024;

alias iuSystemScript = 4294967295;
alias iuCurrentScript = 4294967294;

alias smKeyNextScript = 4294967295;
alias smKeySysScript = 4294967294;
alias smKeySwapScript = 4294967293;
alias smKeyNextKybd = 4294967292;
alias smKeySwapKybd = 4294967291;
alias smKeyDisableKybds = 4294967290;
alias smKeyEnableKybds = 4294967289;
alias smKeyToggleInline = 4294967288;
alias smKeyToggleDirection = 4294967287;
alias smKeyNextInputMethod = 4294967286;
alias smKeySwapInputMethod = 4294967285;
alias smKeyDisableKybdSwitch = 4294967284;
alias smKeySetDirLeftRight = 4294967281;
alias smKeySetDirRightLeft = 4294967280;
alias smKeyRoman = 4294967279;

alias smKeyForceKeyScriptBit = 7;
alias smKeyForceKeyScriptMask = 128;

alias romanSysFond = 16383;
alias romanAppFond = 3;
alias romanFlags = 7;
alias smFondStart = 16384;
alias smFondEnd = 49152;
alias smUprHalfCharSet = 128;

alias diaeresisUprY = 217;
alias fraction = 218;
alias intlCurrency = 219;
alias leftSingGuillemet = 220;
alias rightSingGuillemet = 221;
alias fiLigature = 222;
alias flLigature = 223;
alias dblDagger = 224;
alias centeredDot = 225;
alias baseSingQuote = 226;
alias baseDblQuote = 227;
alias perThousand = 228;
alias circumflexUprA = 229;
alias circumflexUprE = 230;
alias acuteUprA = 231;
alias diaeresisUprE = 232;
alias graveUprE = 233;
alias acuteUprI = 234;
alias circumflexUprI = 235;
alias diaeresisUprI = 236;
alias graveUprI = 237;
alias acuteUprO = 238;
alias circumflexUprO = 239;
alias appleLogo = 240;
alias graveUprO = 241;
alias acuteUprU = 242;
alias circumflexUprU = 243;
alias graveUprU = 244;
alias dotlessLwrI = 245;
alias circumflex = 246;
alias tilde = 247;
alias macron = 248;
alias breveMark = 249;
alias overDot = 250;
alias ringMark = 251;
alias cedilla = 252;
alias doubleAcute = 253;
alias ogonek = 254;
alias hachek = 255;

alias tokenIntl = 4;
alias tokenEmpty = 4294967295;

alias tokenUnknown = 0;
alias tokenWhite = 1;
alias tokenLeftLit = 2;
alias tokenRightLit = 3;
alias tokenAlpha = 4;
alias tokenNumeric = 5;
alias tokenNewLine = 6;
alias tokenLeftComment = 7;
alias tokenRightComment = 8;
alias tokenLiteral = 9;
alias tokenEscape = 10;
alias tokenAltNum = 11;
alias tokenRealNum = 12;
alias tokenAltReal = 13;
alias tokenReserve1 = 14;
alias tokenReserve2 = 15;
alias tokenLeftParen = 16;
alias tokenRightParen = 17;
alias tokenLeftBracket = 18;
alias tokenRightBracket = 19;

alias tokenLeftCurly = 20;
alias tokenRightCurly = 21;
alias tokenLeftEnclose = 22;
alias tokenRightEnclose = 23;
alias tokenPlus = 24;
alias tokenMinus = 25;
alias tokenAsterisk = 26;
alias tokenDivide = 27;
alias tokenPlusMinus = 28;
alias tokenSlash = 29;
alias tokenBackSlash = 30;
alias tokenLess = 31;
alias tokenGreat = 32;
alias tokenEqual = 33;
alias tokenLessEqual2 = 34;
alias tokenLessEqual1 = 35;
alias tokenGreatEqual2 = 36;
alias tokenGreatEqual1 = 37;
alias token2Equal = 38;
alias tokenColonEqual = 39;

alias tokenNotEqual = 40;
alias tokenLessGreat = 41;
alias tokenExclamEqual = 42;
alias tokenExclam = 43;
alias tokenTilde = 44;
alias tokenComma = 45;
alias tokenPeriod = 46;
alias tokenLeft2Quote = 47;
alias tokenRight2Quote = 48;
alias tokenLeft1Quote = 49;
alias tokenRight1Quote = 50;
alias token2Quote = 51;
alias token1Quote = 52;
alias tokenSemicolon = 53;
alias tokenPercent = 54;
alias tokenCaret = 55;
alias tokenUnderline = 56;
alias tokenAmpersand = 57;
alias tokenAtSign = 58;
alias tokenBar = 59;

alias tokenQuestion = 60;
alias tokenPi = 61;
alias tokenRoot = 62;
alias tokenSigma = 63;
alias tokenIntegral = 64;
alias tokenMicro = 65;
alias tokenCapPi = 66;
alias tokenInfinity = 67;
alias tokenColon = 68;
alias tokenHash = 69;
alias tokenDollar = 70;
alias tokenNoBreakSpace = 71;
alias tokenFraction = 72;
alias tokenIntlCurrency = 73;
alias tokenLeftSingGuillemet = 74;
alias tokenRightSingGuillemet = 75;
alias tokenPerThousand = 76;
alias tokenEllipsis = 77;
alias tokenCenterDot = 78;
alias tokenNil = 127;

alias delimPad = 4294967294;
alias tokenTilda = 44;
alias tokenCarat = 55;

alias smWordSelectTable = 0;
alias smWordWrapTable = 1;
alias smNumberPartsTable = 2;
alias smUnTokenTable = 3;
alias smWhiteSpaceList = 4;
alias iuWordSelectTable = 0;
alias iuWordWrapTable = 1;
alias iuNumberPartsTable = 2;
alias iuUnTokenTable = 3;
alias iuWhiteSpaceList = 4;

alias tokenOK = 0;
alias tokenOverflow = 1;
alias stringOverflow = 2;
alias badDelim = 3;
alias badEnding = 4;
alias crash = 5;

alias TokenResults = CChar;

alias CharByteTable = Array[CChar,256];

alias ScriptTokenType = Short;

alias DelimType = Array[Short,2];

alias CommentType = Array[Short,4];

record Struct_TokenRec (
    theToken : Short,
    position : Ptr,
    length : CLong,
    stringPosition : StringPtr,
);

alias TokenRec = Struct_TokenRec;

alias TokenRecPtr = Pointer[TokenRec];

record Struct_TokenBlock (
    source : Ptr,
    sourceLength : CLong,
    tokenList : Ptr,
    tokenLength : CLong,
    tokenCount : CLong,
    stringList : Ptr,
    stringLength : CLong,
    stringCount : CLong,
    doString : CUChar,
    doAppend : CUChar,
    doAlphanumeric : CUChar,
    doNest : CUChar,
    leftDelims : Array[Short,2],
    rightDelims : Array[Short,2],
    leftComment : Array[Short,4],
    rightComment : Array[Short,4],
    escapeCode : Short,
    decimalCode : Short,
    itlResource : Handle,
    reserved : Array[CLong,8],
);

alias TokenBlock = Struct_TokenBlock;

alias TokenBlockPtr = Pointer[TokenBlock];

alias smNotInstalled = 0;
alias smBadVerb = 4294967295;
alias smBadScript = 4294967294;

alias smfShowIcon = 31;
alias smfDualCaret = 30;
alias smfNameTagEnab = 29;
alias smfUseAssocFontInfo = 28;
alias smfDisableKeyScriptSync = 27;

alias smfDisableKeyScriptSyncMask = 134217728;

alias smSysScript = 18;
alias smKeyScript = 22;
alias smKCHRCache = 38;
alias smRegionCode = 40;

external GetScriptManagerVariable(
    selector : Short) : CLong;

external SetScriptManagerVariable(
    selector : Short,
    param : CLong) : Short;

alias smsfIntellCP = 0;
alias smsfSingByte = 1;
alias smsfNatCase = 2;
alias smsfContext = 3;
alias smsfNoForceFont = 4;
alias smsfB0Digits = 5;
alias smsfAutoInit = 6;
alias smsfUnivExt = 7;
alias smsfSynchUnstyledTE = 8;
alias smsfForms = 13;
alias smsfLigatures = 14;
alias smsfReverse = 15;

alias paramErr = 4294967246;
alias noHardwareErr = 4294967096;
alias notEnoughHardwareErr = 4294967095;
alias userCanceledErr = 4294967168;
alias qErr = 4294967295;
alias vTypErr = 4294967294;
alias corErr = 4294967293;
alias unimpErr = 4294967292;
alias SlpTypeErr = 4294967291;
alias seNoDB = 4294967288;
alias controlErr = 4294967279;
alias statusErr = 4294967278;
alias readErr = 4294967277;
alias writErr = 4294967276;
alias badUnitErr = 4294967275;
alias unitEmptyErr = 4294967274;
alias openErr = 4294967273;
alias closErr = 4294967272;
alias dRemovErr = 4294967271;
alias dInstErr = 4294967270;

alias abortErr = 4294967269;
alias iIOAbortErr = 4294967269;
alias notOpenErr = 4294967268;
alias unitTblFullErr = 4294967267;
alias dceExtErr = 4294967266;
alias slotNumErr = 4294966936;
alias gcrOnMFMErr = 4294966896;
alias dirFulErr = 4294967263;
alias dskFulErr = 4294967262;
alias nsvErr = 4294967261;
alias ioErr = 4294967260;
alias bdNamErr = 4294967259;
alias fnOpnErr = 4294967258;
alias eofErr = 4294967257;
alias posErr = 4294967256;
alias mFulErr = 4294967255;
alias tmfoErr = 4294967254;
alias fnfErr = 4294967253;
alias wPrErr = 4294967252;
alias fLckdErr = 4294967251;

alias vLckdErr = 4294967250;
alias fBsyErr = 4294967249;
alias dupFNErr = 4294967248;
alias opWrErr = 4294967247;
alias rfNumErr = 4294967245;
alias gfpErr = 4294967244;
alias volOffLinErr = 4294967243;
alias permErr = 4294967242;
alias volOnLinErr = 4294967241;
alias nsDrvErr = 4294967240;
alias noMacDskErr = 4294967239;
alias extFSErr = 4294967238;
alias fsRnErr = 4294967237;
alias badMDBErr = 4294967236;
alias wrPermErr = 4294967235;
alias dirNFErr = 4294967176;
alias tmwdoErr = 4294967175;
alias badMovErr = 4294967174;
alias wrgVolTypErr = 4294967173;
alias volGoneErr = 4294967172;

alias fidNotFound = 4294965996;
alias fidExists = 4294965995;
alias notAFileErr = 4294965994;
alias diffVolErr = 4294965993;
alias catChangedErr = 4294965992;
alias desktopDamagedErr = 4294965991;
alias sameFileErr = 4294965990;
alias badFidErr = 4294965989;
alias notARemountErr = 4294965988;
alias fileBoundsErr = 4294965987;
alias fsDataTooBigErr = 4294965986;
alias volVMBusyErr = 4294965985;
alias badFCBErr = 4294965969;
alias errFSUnknownCall = 4294965896;
alias errFSBadFSRef = 4294965895;
alias errFSBadForkName = 4294965894;
alias errFSBadBuffer = 4294965893;
alias errFSBadForkRef = 4294965892;
alias errFSBadInfoBitmap = 4294965891;
alias errFSMissingCatInfo = 4294965890;
alias errFSNotAFolder = 4294965889;
alias errFSForkNotFound = 4294965887;
alias errFSNameTooLong = 4294965886;
alias errFSMissingName = 4294965885;
alias errFSBadPosMode = 4294965884;
alias errFSBadAllocFlags = 4294965883;
alias errFSNoMoreItems = 4294965879;
alias errFSBadItemCount = 4294965878;
alias errFSBadSearchParams = 4294965877;
alias errFSRefsDifferent = 4294965876;
alias errFSForkExists = 4294965875;
alias errFSBadIteratorFlags = 4294965874;
alias errFSIteratorNotFound = 4294965873;
alias errFSIteratorNotSupported = 4294965872;
alias errFSQuotaExceeded = 4294965871;
alias errFSOperationNotSupported = 4294965870;
alias errFSAttributeNotFound = 4294965869;
alias errFSPropertyNotValid = 4294965868;
alias errFSNotEnoughSpaceForOperation = 4294965867;
alias envNotPresent = 4294961796;
alias envBadVers = 4294961795;
alias envVersTooBig = 4294961794;
alias fontDecError = 4294967232;
alias fontNotDeclared = 4294967231;
alias fontSubErr = 4294967230;
alias fontNotOutlineErr = 4294934681;
alias firstDskErr = 4294967212;
alias lastDskErr = 4294967232;
alias noDriveErr = 4294967232;
alias offLinErr = 4294967231;
alias noNybErr = 4294967230;

alias noAdrMkErr = 4294967229;
alias dataVerErr = 4294967228;
alias badCksmErr = 4294967227;
alias badBtSlpErr = 4294967226;
alias noDtaMkErr = 4294967225;
alias badDCksum = 4294967224;
alias badDBtSlp = 4294967223;
alias wrUnderrun = 4294967222;
alias cantStepErr = 4294967221;
alias tk0BadErr = 4294967220;
alias initIWMErr = 4294967219;
alias twoSideErr = 4294967218;
alias spdAdjErr = 4294967217;
alias seekErr = 4294967216;
alias sectNFErr = 4294967215;
alias fmt1Err = 4294967214;
alias fmt2Err = 4294967213;
alias verErr = 4294967212;
alias clkRdErr = 4294967211;
alias clkWrErr = 4294967210;
alias prWrErr = 4294967209;
alias prInitErr = 4294967208;
alias rcvrErr = 4294967207;
alias breakRecd = 4294967206;

alias noScrapErr = 4294967196;
alias noTypeErr = 4294967194;

alias eLenErr = 4294967204;
alias eMultiErr = 4294967205;

alias ddpSktErr = 4294967205;
alias ddpLenErr = 4294967204;
alias noBridgeErr = 4294967203;
alias lapProtErr = 4294967202;
alias excessCollsns = 4294967201;
alias portNotPwr = 4294967200;
alias portInUse = 4294967199;
alias portNotCf = 4294967198;

alias memROZWarn = 4294967197;
alias memROZError = 4294967197;
alias memROZErr = 4294967197;
alias memFullErr = 4294967188;
alias nilHandleErr = 4294967187;
alias memWZErr = 4294967185;
alias memPurErr = 4294967184;
alias memAdrErr = 4294967186;
alias memAZErr = 4294967183;
alias memPCErr = 4294967182;
alias memBCErr = 4294967181;
alias memSCErr = 4294967180;
alias memLockedErr = 4294967179;

alias iMemFullErr = 4294967188;
alias iIOAbort = 4294967269;

alias resourceInMemory = 4294967108;
alias writingPastEnd = 4294967107;
alias inputOutOfBounds = 4294967106;
alias resNotFound = 4294967104;
alias resFNotFound = 4294967103;
alias addResFailed = 4294967102;
alias addRefFailed = 4294967101;
alias rmvResFailed = 4294967100;
alias rmvRefFailed = 4294967099;
alias resAttrErr = 4294967098;
alias mapReadErr = 4294967097;
alias CantDecompress = 4294967110;
alias badExtResource = 4294967111;
alias noMemForPictPlaybackErr = 4294967151;
alias rgnOverflowErr = 4294967149;
alias rgnTooBigError = 4294967149;
alias pixMapTooDeepErr = 4294967148;
alias insufficientStackErr = 4294967147;
alias nsStackErr = 4294967147;

alias evtNotEnb = 1;

alias cMatchErr = 4294967146;
alias cTempMemErr = 4294967145;
alias cNoMemErr = 4294967144;
alias cRangeErr = 4294967143;
alias cProtectErr = 4294967142;
alias cDevErr = 4294967141;
alias cResErr = 4294967140;
alias cDepthErr = 4294967139;
alias rgnTooBigErr = 4294966796;
alias updPixMemErr = 4294967171;
alias pictInfoVersionErr = 4294956296;
alias pictInfoIDErr = 4294956295;
alias pictInfoVerbErr = 4294956294;
alias cantLoadPickMethodErr = 4294956293;
alias colorsRequestedErr = 4294956292;
alias pictureDataErr = 4294956291;

alias cmProfileError = 4294967126;
alias cmMethodError = 4294967125;
alias cmMethodNotFound = 4294967121;
alias cmProfileNotFound = 4294967120;
alias cmProfilesIdentical = 4294967119;
alias cmCantConcatenateError = 4294967118;
alias cmCantXYZ = 4294967117;
alias cmCantDeleteProfile = 4294967116;
alias cmUnsupportedDataType = 4294967115;
alias cmNoCurrentProfile = 4294967114;

alias noHardware = 4294967096;
alias notEnoughHardware = 4294967095;
alias queueFull = 4294967093;
alias resProblem = 4294967092;
alias badChannel = 4294967091;
alias badFormat = 4294967090;
alias notEnoughBufferSpace = 4294967089;
alias badFileFormat = 4294967088;
alias channelBusy = 4294967087;
alias buffersTooSmall = 4294967086;
alias channelNotBusy = 4294967085;
alias noMoreRealTime = 4294967084;
alias siVBRCompressionNotSupported = 4294967083;
alias siNoSoundInHardware = 4294967076;
alias siBadSoundInDevice = 4294967075;
alias siNoBufferSpecified = 4294967074;
alias siInvalidCompression = 4294967073;
alias siHardDriveTooSlow = 4294967072;
alias siInvalidSampleRate = 4294967071;
alias siInvalidSampleSize = 4294967070;
alias siDeviceBusyErr = 4294967069;
alias siBadDeviceName = 4294967068;
alias siBadRefNum = 4294967067;
alias siInputDeviceErr = 4294967066;
alias siUnknownInfoType = 4294967065;
alias siUnknownQuality = 4294967064;

alias noSynthFound = 4294967056;
alias synthOpenFailed = 4294967055;
alias synthNotReady = 4294967054;
alias bufTooSmall = 4294967053;
alias voiceNotFound = 4294967052;
alias incompatibleVoice = 4294967051;
alias badDictFormat = 4294967050;
alias badInputText = 4294967049;

alias midiNoClientErr = 4294967046;
alias midiNoPortErr = 4294967045;
alias midiTooManyPortsErr = 4294967044;
alias midiTooManyConsErr = 4294967043;
alias midiVConnectErr = 4294967042;
alias midiVConnectMade = 4294967041;
alias midiVConnectRmvd = 4294967040;
alias midiNoConErr = 4294967039;
alias midiWriteErr = 4294967038;
alias midiNameLenErr = 4294967037;
alias midiDupIDErr = 4294967036;
alias midiInvalidCmdErr = 4294967035;

alias nmTypErr = 4294966997;

alias siInitSDTblErr = 1;
alias siInitVBLQsErr = 2;
alias siInitSPTblErr = 3;
alias sdmJTInitErr = 10;
alias sdmInitErr = 11;
alias sdmSRTInitErr = 12;
alias sdmPRAMInitErr = 13;
alias sdmPriInitErr = 14;

alias smSDMInitErr = 4294967006;
alias smSRTInitErr = 4294967005;
alias smPRAMInitErr = 4294967004;
alias smPriInitErr = 4294967003;
alias smEmptySlot = 4294966996;
alias smCRCFail = 4294966995;
alias smFormatErr = 4294966994;
alias smRevisionErr = 4294966993;
alias smNoDir = 4294966992;
alias smDisabledSlot = 4294966991;
alias smNosInfoArray = 4294966990;

alias smResrvErr = 4294966989;
alias smUnExBusErr = 4294966988;
alias smBLFieldBad = 4294966987;
alias smFHBlockRdErr = 4294966986;
alias smFHBlkDispErr = 4294966985;
alias smDisposePErr = 4294966984;
alias smNoBoardSRsrc = 4294966983;
alias smGetPRErr = 4294966982;
alias smNoBoardId = 4294966981;
alias smInitStatVErr = 4294966980;
alias smInitTblVErr = 4294966979;
alias smNoJmpTbl = 4294966978;
alias smReservedSlot = 4294966978;
alias smBadBoardId = 4294966977;
alias smBusErrTO = 4294966976;
alias svTempDisable = 4294934528;
alias svDisabled = 4294934656;
alias smBadRefId = 4294966966;
alias smBadsList = 4294966965;
alias smReservedErr = 4294966964;
alias smCodeRevErr = 4294966963;

alias smCPUErr = 4294966962;
alias smsPointerNil = 4294966961;
alias smNilsBlockErr = 4294966960;
alias smSlotOOBErr = 4294966959;
alias smSelOOBErr = 4294966958;
alias smNewPErr = 4294966957;
alias smBlkMoveErr = 4294966956;
alias smCkStatusErr = 4294966955;
alias smGetDrvrNamErr = 4294966954;
alias smDisDrvrNamErr = 4294966953;
alias smNoMoresRsrcs = 4294966952;
alias smsGetDrvrErr = 4294966951;
alias smBadsPtrErr = 4294966950;
alias smByteLanesErr = 4294966949;
alias smOffsetErr = 4294966948;
alias smNoGoodOpens = 4294966947;
alias smSRTOvrFlErr = 4294966946;
alias smRecNotFnd = 4294966945;

alias notBTree = 4294966886;
alias btNoSpace = 4294966883;
alias btDupRecErr = 4294966882;
alias btRecNotFnd = 4294966881;
alias btKeyLenErr = 4294966880;
alias btKeyAttrErr = 4294966879;
alias unknownInsertModeErr = 4294947296;
alias recordDataTooBigErr = 4294947295;
alias invalidIndexErr = 4294947294;

alias fsmFFSNotFoundErr = 4294966865;
alias fsmBusyFFSErr = 4294966864;
alias fsmBadFFSNameErr = 4294966863;
alias fsmBadFSDLenErr = 4294966862;
alias fsmDuplicateFSIDErr = 4294966861;
alias fsmBadFSDVersionErr = 4294966860;
alias fsmNoAlternateStackErr = 4294966859;
alias fsmUnknownFSMMessageErr = 4294966858;

alias editionMgrInitErr = 4294966846;
alias badSectionErr = 4294966845;
alias notRegisteredSectionErr = 4294966844;
alias badEditionFileErr = 4294966843;
alias badSubPartErr = 4294966842;
alias multiplePublisherWrn = 4294966836;
alias containerNotFoundWrn = 4294966835;
alias containerAlreadyOpenWrn = 4294966834;
alias notThePublisherWrn = 4294966833;

alias teScrapSizeErr = 4294966795;
alias hwParamErr = 4294966794;
alias driverHardwareGoneErr = 4294966793;

alias procNotFound = 4294966696;
alias memFragErr = 4294966695;
alias appModeErr = 4294966694;
alias protocolErr = 4294966693;
alias hardwareConfigErr = 4294966692;
alias appMemFullErr = 4294966691;
alias appIsDaemon = 4294966690;
alias bufferIsSmall = 4294966689;
alias noOutstandingHLE = 4294966688;
alias connectionInvalid = 4294966687;
alias noUserInteractionAllowed = 4294966686;

alias wrongApplicationPlatform = 4294966421;
alias appVersionTooOld = 4294966420;
alias notAppropriateForClassic = 4294966419;

alias threadTooManyReqsErr = 4294966679;
alias threadNotFoundErr = 4294966678;
alias threadProtocolErr = 4294966677;

alias threadBadAppContextErr = 4294966680;

alias notEnoughMemoryErr = 4294966676;
alias notHeldErr = 4294966675;
alias cannotMakeContiguousErr = 4294966674;
alias notLockedErr = 4294966673;
alias interruptsMaskedErr = 4294966672;
alias cannotDeferErr = 4294966671;
alias noMMUErr = 4294966670;

alias vmMorePhysicalThanVirtualErr = 4294966668;
alias vmKernelMMUInitErr = 4294966667;
alias vmOffErr = 4294966666;
alias vmMemLckdErr = 4294966665;
alias vmBadDriver = 4294966664;
alias vmNoVectorErr = 4294966663;

alias vmInvalidBackingFileIDErr = 4294966656;
alias vmMappingPrivilegesErr = 4294966655;
alias vmBusyBackingFileErr = 4294966654;
alias vmNoMoreBackingFilesErr = 4294966653;
alias vmInvalidFileViewIDErr = 4294966652;
alias vmFileViewAccessErr = 4294966651;
alias vmNoMoreFileViewsErr = 4294966650;
alias vmAddressNotInFileViewErr = 4294966649;
alias vmInvalidOwningProcessErr = 4294966648;

alias rcDBNull = 4294966496;
alias rcDBValue = 4294966495;
alias rcDBError = 4294966494;
alias rcDBBadType = 4294966493;
alias rcDBBreak = 4294966492;
alias rcDBExec = 4294966491;
alias rcDBBadSessID = 4294966490;
alias rcDBBadSessNum = 4294966489;
alias rcDBBadDDEV = 4294966488;
alias rcDBAsyncNotSupp = 4294966487;
alias rcDBBadAsyncPB = 4294966486;
alias rcDBNoHandler = 4294966485;
alias rcDBWrongVersion = 4294966484;
alias rcDBPackNotInited = 4294966483;

alias hmHelpDisabled = 4294966446;
alias hmBalloonAborted = 4294966443;
alias hmSameAsLastBalloon = 4294966442;
alias hmHelpManagerNotInited = 4294966441;
alias hmSkippedBalloon = 4294966439;
alias hmWrongVersion = 4294966438;
alias hmUnknownHelpType = 4294966437;
alias hmOperationUnsupported = 4294966435;
alias hmNoBalloonUp = 4294966434;
alias hmCloseViewActive = 4294966433;

alias notInitErr = 4294966396;
alias nameTypeErr = 4294966394;
alias noPortErr = 4294966393;
alias noGlobalsErr = 4294966392;
alias localOnlyErr = 4294966391;
alias destPortErr = 4294966390;
alias sessTableErr = 4294966389;
alias noSessionErr = 4294966388;
alias badReqErr = 4294966387;
alias portNameExistsErr = 4294966386;
alias noUserNameErr = 4294966385;
alias userRejectErr = 4294966384;
alias noMachineNameErr = 4294966383;
alias noToolboxNameErr = 4294966382;
alias noResponseErr = 4294966381;
alias portClosedErr = 4294966380;
alias sessClosedErr = 4294966379;
alias badPortNameErr = 4294966377;
alias noDefaultUserErr = 4294966374;
alias notLoggedInErr = 4294966373;
alias noUserRefErr = 4294966372;
alias networkErr = 4294966371;
alias noInformErr = 4294966370;
alias authFailErr = 4294966369;
alias noUserRecErr = 4294966368;
alias badServiceMethodErr = 4294966366;
alias badLocNameErr = 4294966365;
alias guestNotAllowedErr = 4294966364;

alias kFMIterationCompleted = 4294966316;
alias kFMInvalidFontFamilyErr = 4294966315;
alias kFMInvalidFontErr = 4294966314;
alias kFMIterationScopeModifiedErr = 4294966313;
alias kFMFontTableAccessErr = 4294966312;
alias kFMFontContainerAccessErr = 4294966311;

alias noMaskFoundErr = 4294966296;

alias nbpBuffOvr = 4294966272;
alias nbpNoConfirm = 4294966271;
alias nbpConfDiff = 4294966270;
alias nbpDuplicate = 4294966269;
alias nbpNotFound = 4294966268;
alias nbpNISErr = 4294966267;

alias aspBadVersNum = 4294966230;
alias aspBufTooSmall = 4294966229;
alias aspNoMoreSess = 4294966228;
alias aspNoServers = 4294966227;
alias aspParamErr = 4294966226;
alias aspServerBusy = 4294966225;
alias aspSessClosed = 4294966224;
alias aspSizeErr = 4294966223;
alias aspTooMany = 4294966222;
alias aspNoAck = 4294966221;

alias reqFailed = 4294966200;
alias tooManyReqs = 4294966199;
alias tooManySkts = 4294966198;
alias badATPSkt = 4294966197;
alias badBuffNum = 4294966196;
alias noRelErr = 4294966195;
alias cbNotFound = 4294966194;
alias noSendResp = 4294966193;
alias noDataArea = 4294966192;
alias reqAborted = 4294966191;

alias errRefNum = 4294966016;
alias errAborted = 4294966017;
alias errState = 4294966018;
alias errOpening = 4294966019;
alias errAttention = 4294966020;
alias errFwdReset = 4294966021;
alias errDSPQueueSize = 4294966022;
alias errOpenDenied = 4294966023;

alias errAECoercionFail = 4294965596;
alias errAEDescNotFound = 4294965595;
alias errAECorruptData = 4294965594;
alias errAEWrongDataType = 4294965593;
alias errAENotAEDesc = 4294965592;
alias errAEBadListItem = 4294965591;
alias errAENewerVersion = 4294965590;
alias errAENotAppleEvent = 4294965589;
alias errAEEventNotHandled = 4294965588;
alias errAEReplyNotValid = 4294965587;
alias errAEUnknownSendMode = 4294965586;
alias errAEWaitCanceled = 4294965585;
alias errAETimeout = 4294965584;
alias errAENoUserInteraction = 4294965583;
alias errAENotASpecialFunction = 4294965582;
alias errAEParamMissed = 4294965581;
alias errAEUnknownAddressType = 4294965580;
alias errAEHandlerNotFound = 4294965579;
alias errAEReplyNotArrived = 4294965578;
alias errAEIllegalIndex = 4294965577;
alias errAEImpossibleRange = 4294965576;
alias errAEWrongNumberArgs = 4294965575;
alias errAEAccessorNotFound = 4294965573;
alias errAENoSuchLogical = 4294965571;
alias errAEBadTestKey = 4294965570;
alias errAENotAnObjSpec = 4294965569;
alias errAENoSuchObject = 4294965568;
alias errAENegativeCount = 4294965567;
alias errAEEmptyListContainer = 4294965566;
alias errAEUnknownObjectType = 4294965565;
alias errAERecordingIsAlreadyOn = 4294965564;
alias errAEReceiveTerminate = 4294965563;
alias errAEReceiveEscapeCurrent = 4294965562;
alias errAEEventFiltered = 4294965561;
alias errAEDuplicateHandler = 4294965560;
alias errAEStreamBadNesting = 4294965559;
alias errAEStreamAlreadyConverted = 4294965558;
alias errAEDescIsNull = 4294965557;
alias errAEBuildSyntaxError = 4294965556;
alias errAEBufferTooSmall = 4294965555;

alias errOSASystemError = 4294965546;
alias errOSAInvalidID = 4294965545;
alias errOSABadStorageType = 4294965544;
alias errOSAScriptError = 4294965543;
alias errOSABadSelector = 4294965542;
alias errOSASourceNotAvailable = 4294965540;
alias errOSANoSuchDialect = 4294965539;
alias errOSADataFormatObsolete = 4294965538;
alias errOSADataFormatTooNew = 4294965537;
alias errOSACorruptData = 4294965594;
alias errOSARecordingIsAlreadyOn = 4294965564;
alias errOSAComponentMismatch = 4294965535;
alias errOSACantOpenComponent = 4294965534;

alias errOffsetInvalid = 4294965496;
alias errOffsetIsOutsideOfView = 4294965495;
alias errTopOfDocument = 4294965486;
alias errTopOfBody = 4294965485;
alias errEndOfDocument = 4294965484;
alias errEndOfBody = 4294965483;

alias badDragRefErr = 4294965446;
alias badDragItemErr = 4294965445;
alias badDragFlavorErr = 4294965444;
alias duplicateFlavorErr = 4294965443;
alias cantGetFlavorErr = 4294965442;
alias duplicateHandlerErr = 4294965441;
alias handlerNotFoundErr = 4294965440;
alias dragNotAcceptedErr = 4294965439;
alias unsupportedForPlatformErr = 4294965438;
alias noSuitableDisplaysErr = 4294965437;
alias badImageRgnErr = 4294965436;
alias badImageErr = 4294965435;
alias nonDragOriginatorErr = 4294965434;

alias couldNotResolveDataRef = 4294965296;
alias badImageDescription = 4294965295;
alias badPublicMovieAtom = 4294965294;
alias cantFindHandler = 4294965293;
alias cantOpenHandler = 4294965292;
alias badComponentType = 4294965291;
alias noMediaHandler = 4294965290;
alias noDataHandler = 4294965289;
alias invalidMedia = 4294965288;
alias invalidTrack = 4294965287;
alias invalidMovie = 4294965286;
alias invalidSampleTable = 4294965285;
alias invalidDataRef = 4294965284;
alias invalidHandler = 4294965283;
alias invalidDuration = 4294965282;
alias invalidTime = 4294965281;
alias cantPutPublicMovieAtom = 4294965280;
alias badEditList = 4294965279;
alias mediaTypesDontMatch = 4294965278;
alias progressProcAborted = 4294965277;
alias movieToolboxUninitialized = 4294965276;
alias noRecordOfApp = 4294965276;
alias wfFileNotFound = 4294965275;
alias cantCreateSingleForkFile = 4294965274;
alias invalidEditState = 4294965273;
alias nonMatchingEditState = 4294965272;
alias staleEditState = 4294965271;
alias userDataItemNotFound = 4294965270;
alias maxSizeToGrowTooSmall = 4294965269;
alias badTrackIndex = 4294965268;
alias trackIDNotFound = 4294965267;
alias trackNotInMovie = 4294965266;
alias timeNotInTrack = 4294965265;
alias timeNotInMedia = 4294965264;
alias badEditIndex = 4294965263;
alias internalQuickTimeError = 4294965262;
alias cantEnableTrack = 4294965261;
alias invalidRect = 4294965260;
alias invalidSampleNum = 4294965259;
alias invalidChunkNum = 4294965258;
alias invalidSampleDescIndex = 4294965257;
alias invalidChunkCache = 4294965256;
alias invalidSampleDescription = 4294965255;
alias dataNotOpenForRead = 4294965254;
alias dataNotOpenForWrite = 4294965253;
alias dataAlreadyOpenForWrite = 4294965252;
alias dataAlreadyClosed = 4294965251;
alias endOfDataReached = 4294965250;
alias dataNoDataRef = 4294965249;
alias noMovieFound = 4294965248;
alias invalidDataRefContainer = 4294965247;
alias badDataRefIndex = 4294965246;
alias noDefaultDataRef = 4294965245;
alias couldNotUseAnExistingSample = 4294965244;
alias featureUnsupported = 4294965243;
alias noVideoTrackInMovieErr = 4294965242;
alias noSoundTrackInMovieErr = 4294965241;
alias soundSupportNotAvailableErr = 4294965240;
alias unsupportedAuxiliaryImportData = 4294965239;
alias auxiliaryExportDataUnavailable = 4294965238;
alias samplesAlreadyInMediaErr = 4294965237;
alias noSourceTreeFoundErr = 4294965236;
alias sourceNotFoundErr = 4294965235;
alias movieTextNotFoundErr = 4294965234;
alias missingRequiredParameterErr = 4294965233;
alias invalidSpriteWorldPropertyErr = 4294965232;
alias invalidSpritePropertyErr = 4294965231;
alias gWorldsNotSameDepthAndSizeErr = 4294965230;
alias invalidSpriteIndexErr = 4294965229;
alias invalidImageIndexErr = 4294965228;
alias invalidSpriteIDErr = 4294965227;

alias internalComponentErr = 4294965226;
alias notImplementedMusicOSErr = 4294965225;
alias cantSendToSynthesizerOSErr = 4294965224;
alias cantReceiveFromSynthesizerOSErr = 4294965223;
alias illegalVoiceAllocationOSErr = 4294965222;
alias illegalPartOSErr = 4294965221;
alias illegalChannelOSErr = 4294965220;
alias illegalKnobOSErr = 4294965219;
alias illegalKnobValueOSErr = 4294965218;
alias illegalInstrumentOSErr = 4294965217;
alias illegalControllerOSErr = 4294965216;
alias midiManagerAbsentOSErr = 4294965215;
alias synthesizerNotRespondingOSErr = 4294965214;
alias synthesizerOSErr = 4294965213;
alias illegalNoteChannelOSErr = 4294965212;
alias noteChannelNotAllocatedOSErr = 4294965211;
alias tunePlayerFullOSErr = 4294965210;
alias tuneParseOSErr = 4294965209;
alias noExportProcAvailableErr = 4294965207;
alias videoOutputInUseErr = 4294965206;

alias componentDllLoadErr = 4294965205;
alias componentDllEntryNotFoundErr = 4294965204;
alias qtmlDllLoadErr = 4294965203;
alias qtmlDllEntryNotFoundErr = 4294965202;
alias qtmlUninitialized = 4294965201;
alias unsupportedOSErr = 4294965200;
alias unsupportedProcessorErr = 4294965199;
alias componentNotThreadSafeErr = 4294965198;

alias cannotFindAtomErr = 4294965195;
alias notLeafAtomErr = 4294965194;
alias atomsNotOfSameTypeErr = 4294965193;
alias atomIndexInvalidErr = 4294965192;
alias duplicateAtomTypeAndIDErr = 4294965191;
alias invalidAtomErr = 4294965190;
alias invalidAtomContainerErr = 4294965189;
alias invalidAtomTypeErr = 4294965188;
alias cannotBeLeafAtomErr = 4294965187;
alias pathTooLongErr = 4294965186;
alias emptyPathErr = 4294965185;
alias noPathMappingErr = 4294965184;
alias pathNotVerifiedErr = 4294965183;
alias unknownFormatErr = 4294965182;
alias wackBadFileErr = 4294965181;
alias wackForkNotFoundErr = 4294965180;
alias wackBadMetaDataErr = 4294965179;
alias qfcbNotFoundErr = 4294965178;
alias qfcbNotCreatedErr = 4294965177;
alias AAPNotCreatedErr = 4294965176;
alias AAPNotFoundErr = 4294965175;
alias ASDBadHeaderErr = 4294965174;
alias ASDBadForkErr = 4294965173;
alias ASDEntryNotFoundErr = 4294965172;
alias fileOffsetTooBigErr = 4294965171;
alias notAllowedToSaveMovieErr = 4294965170;
alias qtNetworkAlreadyAllocatedErr = 4294965169;
alias urlDataHHTTPProtocolErr = 4294965167;
alias urlDataHHTTPNoNetDriverErr = 4294965166;
alias urlDataHHTTPURLErr = 4294965165;
alias urlDataHHTTPRedirectErr = 4294965164;
alias urlDataHFTPProtocolErr = 4294965163;
alias urlDataHFTPShutdownErr = 4294965162;
alias urlDataHFTPBadUserErr = 4294965161;
alias urlDataHFTPBadPasswordErr = 4294965160;
alias urlDataHFTPServerErr = 4294965159;
alias urlDataHFTPDataConnectionErr = 4294965158;
alias urlDataHFTPNoDirectoryErr = 4294965157;
alias urlDataHFTPQuotaErr = 4294965156;
alias urlDataHFTPPermissionsErr = 4294965155;
alias urlDataHFTPFilenameErr = 4294965154;
alias urlDataHFTPNoNetDriverErr = 4294965153;
alias urlDataHFTPBadNameListErr = 4294965152;
alias urlDataHFTPNeedPasswordErr = 4294965151;
alias urlDataHFTPNoPasswordErr = 4294965150;
alias urlDataHFTPServerDisconnectedErr = 4294965149;
alias urlDataHFTPURLErr = 4294965148;
alias notEnoughDataErr = 4294965147;
alias qtActionNotHandledErr = 4294965139;
alias qtXMLParseErr = 4294965138;
alias qtXMLApplicationErr = 4294965137;

alias digiUnimpErr = 4294965095;
alias qtParamErr = 4294965094;
alias matrixErr = 4294965093;
alias notExactMatrixErr = 4294965092;
alias noMoreKeyColorsErr = 4294965091;
alias notExactSizeErr = 4294965090;
alias badDepthErr = 4294965089;
alias noDMAErr = 4294965088;
alias badCallOrderErr = 4294965087;

alias kernelIncompleteErr = 4294964895;
alias kernelCanceledErr = 4294964894;
alias kernelOptionsErr = 4294964893;
alias kernelPrivilegeErr = 4294964892;
alias kernelUnsupportedErr = 4294964891;
alias kernelObjectExistsErr = 4294964890;
alias kernelWritePermissionErr = 4294964889;
alias kernelReadPermissionErr = 4294964888;
alias kernelExecutePermissionErr = 4294964887;
alias kernelDeletePermissionErr = 4294964886;
alias kernelExecutionLevelErr = 4294964885;
alias kernelAttributeErr = 4294964884;
alias kernelAsyncSendLimitErr = 4294964883;
alias kernelAsyncReceiveLimitErr = 4294964882;
alias kernelTimeoutErr = 4294964881;
alias kernelInUseErr = 4294964880;
alias kernelTerminatedErr = 4294964879;
alias kernelExceptionErr = 4294964878;
alias kernelIDErr = 4294964877;
alias kernelAlreadyFreeErr = 4294964875;
alias kernelReturnValueErr = 4294964874;
alias kernelUnrecoverableErr = 4294964797;

alias tsmComponentNoErr = 0;
alias tsmUnsupScriptLanguageErr = 4294964796;
alias tsmInputMethodNotFoundErr = 4294964795;
alias tsmNotAnAppErr = 4294964794;
alias tsmAlreadyRegisteredErr = 4294964793;
alias tsmNeverRegisteredErr = 4294964792;
alias tsmInvalidDocIDErr = 4294964791;
alias tsmTSMDocBusyErr = 4294964790;
alias tsmDocNotActiveErr = 4294964789;
alias tsmNoOpenTSErr = 4294964788;
alias tsmCantOpenComponentErr = 4294964787;
alias tsmTextServiceNotFoundErr = 4294964786;
alias tsmDocumentOpenErr = 4294964785;
alias tsmUseInputWindowErr = 4294964784;
alias tsmTSHasNoMenuErr = 4294964783;
alias tsmTSNotOpenErr = 4294964782;
alias tsmComponentAlreadyOpenErr = 4294964781;
alias tsmInputMethodIsOldErr = 4294964780;
alias tsmScriptHasNoIMErr = 4294964779;
alias tsmUnsupportedTypeErr = 4294964778;
alias tsmUnknownErr = 4294964777;
alias tsmInvalidContext = 4294964776;
alias tsmNoHandler = 4294964775;
alias tsmNoMoreTokens = 4294964774;
alias tsmNoStem = 4294964773;
alias tsmDefaultIsNotInputMethodErr = 4294964772;
alias tsmDocPropertyNotFoundErr = 4294964768;
alias tsmDocPropertyBufferTooSmallErr = 4294964767;
alias tsmCantChangeForcedClassStateErr = 4294964766;
alias tsmComponentPropertyUnsupportedErr = 4294964765;
alias tsmComponentPropertyNotFoundErr = 4294964764;
alias tsmInputModeChangeFailedErr = 4294964763;

alias mmInternalError = 4294964770;

alias nrLockedErr = 4294964760;
alias nrNotEnoughMemoryErr = 4294964759;
alias nrInvalidNodeErr = 4294964758;
alias nrNotFoundErr = 4294964757;
alias nrNotCreatedErr = 4294964756;
alias nrNameErr = 4294964755;
alias nrNotSlotDeviceErr = 4294964754;
alias nrDataTruncatedErr = 4294964753;
alias nrPowerErr = 4294964752;
alias nrPowerSwitchAbortErr = 4294964751;
alias nrTypeMismatchErr = 4294964750;
alias nrNotModifiedErr = 4294964749;
alias nrOverrunErr = 4294964748;
alias nrResultCodeBase = 4294964747;
alias nrPathNotFound = 4294964746;
alias nrPathBufferTooSmall = 4294964745;
alias nrInvalidEntryIterationOp = 4294964744;
alias nrPropertyAlreadyExists = 4294964743;
alias nrIterationDone = 4294964742;
alias nrExitedIteratorScope = 4294964741;
alias nrTransactionAborted = 4294964740;
alias nrCallNotSupported = 4294964739;

alias invalidIconRefErr = 4294964716;
alias noSuchIconErr = 4294964715;
alias noIconDataAvailableErr = 4294964714;

alias errOSACantCoerce = 4294965596;
alias errOSACantAccess = 4294965568;
alias errOSACantAssign = 4294957290;
alias errOSAGeneralError = 4294964596;
alias errOSADivideByZero = 4294964595;
alias errOSANumericOverflow = 4294964594;
alias errOSACantLaunch = 4294964593;
alias errOSAAppNotHighLevelEventAware = 4294964592;
alias errOSACorruptTerminology = 4294964591;
alias errOSAStackOverflow = 4294964590;
alias errOSAInternalTableOverflow = 4294964589;
alias errOSADataBlockTooLarge = 4294964588;
alias errOSACantGetTerminology = 4294964587;
alias errOSACantCreate = 4294964586;

alias errOSATypeError = 4294965593;
alias OSAMessageNotUnderstood = 4294965588;
alias OSAUndefinedHandler = 4294965579;
alias OSAIllegalAccess = 4294965573;
alias OSAIllegalIndex = 4294965577;
alias OSAIllegalRange = 4294965576;
alias OSAIllegalAssign = 4294957293;
alias OSASyntaxError = 4294964556;
alias OSASyntaxTypeError = 4294964555;
alias OSATokenTooLong = 4294964554;
alias OSAMissingParameter = 4294965595;
alias OSAParameterMismatch = 4294965575;
alias OSADuplicateParameter = 4294964546;
alias OSADuplicateProperty = 4294964545;
alias OSADuplicateHandler = 4294964544;
alias OSAUndefinedVariable = 4294964543;
alias OSAInconsistentDeclarations = 4294964542;
alias OSAControlFlowError = 4294964541;

alias errASCantConsiderAndIgnore = 4294964576;
alias errASCantCompareMoreThan32k = 4294964575;
alias errASTerminologyNestingTooDeep = 4294964536;
alias errASIllegalFormalParameter = 4294964535;
alias errASParameterNotForEvent = 4294964534;
alias errASNoResultReturned = 4294964533;
alias errASInconsistentNames = 4294964516;

alias cfragFirstErrCode = 4294964496;
alias cfragContextIDErr = 4294964496;
alias cfragConnectionIDErr = 4294964495;
alias cfragNoSymbolErr = 4294964494;
alias cfragNoSectionErr = 4294964493;
alias cfragNoLibraryErr = 4294964492;
alias cfragDupRegistrationErr = 4294964491;
alias cfragFragmentFormatErr = 4294964490;
alias cfragUnresolvedErr = 4294964489;
alias cfragNoPositionErr = 4294964488;
alias cfragNoPrivateMemErr = 4294964487;
alias cfragNoClientMemErr = 4294964486;
alias cfragNoIDsErr = 4294964485;
alias cfragInitOrderErr = 4294964484;
alias cfragImportTooOldErr = 4294964483;
alias cfragImportTooNewErr = 4294964482;
alias cfragInitLoopErr = 4294964481;
alias cfragInitAtBootErr = 4294964480;
alias cfragLibConnErr = 4294964479;
alias cfragCFMStartupErr = 4294964478;
alias cfragCFMInternalErr = 4294964477;
alias cfragFragmentCorruptErr = 4294964476;
alias cfragInitFunctionErr = 4294964475;
alias cfragNoApplicationErr = 4294964474;
alias cfragArchitectureErr = 4294964473;
alias cfragFragmentUsageErr = 4294964472;
alias cfragFileSizeErr = 4294964471;
alias cfragNotClosureErr = 4294964470;
alias cfragNoRegistrationErr = 4294964469;
alias cfragContainerIDErr = 4294964468;
alias cfragClosureIDErr = 4294964467;
alias cfragAbortClosureErr = 4294964466;
alias cfragOutputLengthErr = 4294964465;
alias cfragMapFileErr = 4294964445;
alias cfragExecFileRefErr = 4294964442;
alias cfragStdFolderErr = 4294964441;
alias cfragRsrcForkErr = 4294964440;
alias cfragCFragRsrcErr = 4294964439;
alias cfragLastErrCode = 4294964397;

alias cfragFirstReservedCode = 4294964399;
alias cfragReservedCode_3 = 4294964399;
alias cfragReservedCode_2 = 4294964398;
alias cfragReservedCode_1 = 4294964397;

alias invalidComponentID = 4294964296;
alias validInstancesExist = 4294964295;
alias componentNotCaptured = 4294964294;
alias componentDontRegister = 4294964293;
alias unresolvedComponentDLLErr = 4294964292;
alias retryComponentRegistrationErr = 4294964291;

alias invalidTranslationPathErr = 4294964271;
alias couldNotParseSourceFileErr = 4294964270;
alias noTranslationPathErr = 4294964266;
alias badTranslationSpecErr = 4294964265;
alias noPrefAppErr = 4294964264;

alias buf2SmallErr = 4294964195;
alias noMPPErr = 4294964194;
alias ckSumErr = 4294964193;
alias extractErr = 4294964192;
alias readQErr = 4294964191;
alias atpLenErr = 4294964190;
alias atpBadRsp = 4294964189;
alias recNotFnd = 4294964188;
alias sktClosedErr = 4294964187;

alias kOTNoError = 0;
alias kOTOutOfMemoryErr = 4294964085;
alias kOTNotFoundErr = 4294964095;
alias kOTDuplicateFoundErr = 4294964080;
alias kOTBadAddressErr = 4294964146;
alias kOTBadOptionErr = 4294964145;
alias kOTAccessErr = 4294964144;
alias kOTBadReferenceErr = 4294964143;
alias kOTNoAddressErr = 4294964142;
alias kOTOutStateErr = 4294964141;
alias kOTBadSequenceErr = 4294964140;
alias kOTSysErrorErr = 4294964139;
alias kOTLookErr = 4294964138;
alias kOTBadDataErr = 4294964137;
alias kOTBufferOverflowErr = 4294964136;
alias kOTFlowErr = 4294964135;
alias kOTNoDataErr = 4294964134;
alias kOTNoDisconnectErr = 4294964133;
alias kOTNoUDErrErr = 4294964132;
alias kOTBadFlagErr = 4294964131;
alias kOTNoReleaseErr = 4294964130;
alias kOTNotSupportedErr = 4294964129;
alias kOTStateChangeErr = 4294964128;
alias kOTNoStructureTypeErr = 4294964127;
alias kOTBadNameErr = 4294964126;
alias kOTBadQLenErr = 4294964125;
alias kOTAddressBusyErr = 4294964124;
alias kOTIndOutErr = 4294964123;
alias kOTProviderMismatchErr = 4294964122;
alias kOTResQLenErr = 4294964121;
alias kOTResAddressErr = 4294964120;
alias kOTQFullErr = 4294964119;
alias kOTProtocolErr = 4294964118;
alias kOTBadSyncErr = 4294964117;
alias kOTCanceledErr = 4294964116;
alias kEPERMErr = 4294964096;
alias kENOENTErr = 4294964095;
alias kENORSRCErr = 4294964094;
alias kEINTRErr = 4294964093;
alias kEIOErr = 4294964092;
alias kENXIOErr = 4294964091;
alias kEBADFErr = 4294964088;
alias kEAGAINErr = 4294964086;
alias kENOMEMErr = 4294964085;
alias kEACCESErr = 4294964084;
alias kEFAULTErr = 4294964083;
alias kEBUSYErr = 4294964081;
alias kEEXISTErr = 4294964080;
alias kENODEVErr = 4294964078;
alias kEINVALErr = 4294964075;
alias kENOTTYErr = 4294964072;
alias kEPIPEErr = 4294964065;
alias kERANGEErr = 4294964063;
alias kEWOULDBLOCKErr = 4294964062;
alias kEDEADLKErr = 4294964062;
alias kEALREADYErr = 4294964060;
alias kENOTSOCKErr = 4294964059;
alias kEDESTADDRREQErr = 4294964058;
alias kEMSGSIZEErr = 4294964057;
alias kEPROTOTYPEErr = 4294964056;
alias kENOPROTOOPTErr = 4294964055;
alias kEPROTONOSUPPORTErr = 4294964054;
alias kESOCKTNOSUPPORTErr = 4294964053;
alias kEOPNOTSUPPErr = 4294964052;
alias kEADDRINUSEErr = 4294964049;
alias kEADDRNOTAVAILErr = 4294964048;
alias kENETDOWNErr = 4294964047;
alias kENETUNREACHErr = 4294964046;
alias kENETRESETErr = 4294964045;
alias kECONNABORTEDErr = 4294964044;
alias kECONNRESETErr = 4294964043;
alias kENOBUFSErr = 4294964042;
alias kEISCONNErr = 4294964041;
alias kENOTCONNErr = 4294964040;
alias kESHUTDOWNErr = 4294964039;
alias kETOOMANYREFSErr = 4294964038;
alias kETIMEDOUTErr = 4294964037;
alias kECONNREFUSEDErr = 4294964036;
alias kEHOSTDOWNErr = 4294964033;
alias kEHOSTUNREACHErr = 4294964032;
alias kEPROTOErr = 4294964027;
alias kETIMEErr = 4294964026;
alias kENOSRErr = 4294964025;
alias kEBADMSGErr = 4294964024;
alias kECANCELErr = 4294964023;
alias kENOSTRErr = 4294964022;
alias kENODATAErr = 4294964021;
alias kEINPROGRESSErr = 4294964020;
alias kESRCHErr = 4294964019;
alias kENOMSGErr = 4294964018;
alias kOTClientNotInittedErr = 4294964017;
alias kOTPortHasDiedErr = 4294964016;
alias kOTPortWasEjectedErr = 4294964015;
alias kOTBadConfigurationErr = 4294964014;
alias kOTConfigurationChangedErr = 4294964013;
alias kOTUserRequestedErr = 4294964012;
alias kOTPortLostConnection = 4294964011;

alias kQDNoPalette = 4294963346;
alias kQDNoColorHWCursorSupport = 4294963345;
alias kQDCursorAlreadyRegistered = 4294963344;
alias kQDCursorNotRegistered = 4294963343;
alias kQDCorruptPICTDataErr = 4294963342;

alias firstPickerError = 4294963296;
alias invalidPickerType = 4294963296;
alias requiredFlagsDontMatch = 4294963295;
alias pickerResourceError = 4294963294;
alias cantLoadPicker = 4294963293;
alias cantCreatePickerWindow = 4294963292;
alias cantLoadPackage = 4294963291;
alias pickerCantLive = 4294963290;
alias colorSyncNotInstalled = 4294963289;
alias badProfileError = 4294963288;
alias noHelpForItem = 4294963287;

alias kNSL68kContextNotSupported = 4294963126;
alias kNSLSchedulerError = 4294963125;
alias kNSLBadURLSyntax = 4294963124;
alias kNSLNoCarbonLib = 4294963123;
alias kNSLUILibraryNotAvailable = 4294963122;
alias kNSLNotImplementedYet = 4294963121;
alias kNSLErrNullPtrError = 4294963120;
alias kNSLSomePluginsFailedToLoad = 4294963119;
alias kNSLNullNeighborhoodPtr = 4294963118;
alias kNSLNoPluginsForSearch = 4294963117;
alias kNSLSearchAlreadyInProgress = 4294963116;
alias kNSLNoPluginsFound = 4294963115;
alias kNSLPluginLoadFailed = 4294963114;
alias kNSLBadProtocolTypeErr = 4294963113;
alias kNSLNullListPtr = 4294963112;
alias kNSLBadClientInfoPtr = 4294963111;
alias kNSLCannotContinueLookup = 4294963110;
alias kNSLBufferTooSmallForData = 4294963109;
alias kNSLNoContextAvailable = 4294963108;
alias kNSLRequestBufferAlreadyInList = 4294963107;
alias kNSLInvalidPluginSpec = 4294963106;
alias kNSLNoSupportForService = 4294963105;
alias kNSLBadNetConnection = 4294963104;
alias kNSLBadDataTypeErr = 4294963103;
alias kNSLBadServiceTypeErr = 4294963102;
alias kNSLBadReferenceErr = 4294963101;
alias kNSLNoElementsInList = 4294963100;
alias kNSLInsufficientOTVer = 4294963099;
alias kNSLInsufficientSysVer = 4294963098;
alias kNSLNotInitialized = 4294963097;
alias kNSLInitializationFailed = 4294963096;

alias kDTPHoldJobErr = 4294963096;
alias kDTPStopQueueErr = 4294963095;
alias kDTPTryAgainErr = 4294963094;
alias kDTPAbortJobErr = 128;

alias cmElementTagNotFound = 4294963096;
alias cmIndexRangeErr = 4294963095;
alias cmCantDeleteElement = 4294963094;
alias cmFatalProfileErr = 4294963093;
alias cmInvalidProfile = 4294963092;
alias cmInvalidProfileLocation = 4294963091;
alias cmCantCopyModifiedV1Profile = 4294963081;
alias cmInvalidSearch = 4294963090;
alias cmSearchError = 4294963089;
alias cmErrIncompatibleProfile = 4294963088;
alias cmInvalidColorSpace = 4294963087;
alias cmInvalidSrcMap = 4294963086;
alias cmInvalidDstMap = 4294963085;
alias cmNoGDevicesError = 4294963084;
alias cmInvalidProfileComment = 4294963083;
alias cmRangeOverFlow = 4294963082;
alias cmNamedColorNotFound = 4294963080;
alias cmCantGamutCheckError = 4294963079;

alias badFolderDescErr = 4294963026;
alias duplicateFolderDescErr = 4294963025;
alias noMoreFolderDescErr = 4294963024;
alias invalidFolderTypeErr = 4294963023;
alias duplicateRoutingErr = 4294963022;
alias routingNotFoundErr = 4294963021;
alias badRoutingSizeErr = 4294963020;

alias coreFoundationUnknownErr = 4294962336;

alias errCoreEndianDataTooShortForFormat = 4294962356;
alias errCoreEndianDataTooLongForFormat = 4294962355;
alias errCoreEndianDataDoesNotMatchFormat = 4294962354;

alias internalScrapErr = 4294962308;
alias duplicateScrapFlavorErr = 4294962307;
alias badScrapRefErr = 4294962306;
alias processStateIncorrectErr = 4294962305;
alias scrapPromiseNotKeptErr = 4294962304;
alias noScrapPromiseKeeperErr = 4294962303;
alias nilScrapFlavorDataErr = 4294962302;
alias scrapFlavorFlagsMismatchErr = 4294962301;
alias scrapFlavorSizeMismatchErr = 4294962300;
alias illegalScrapFlavorFlagsErr = 4294962299;
alias illegalScrapFlavorTypeErr = 4294962298;
alias illegalScrapFlavorSizeErr = 4294962297;
alias scrapFlavorNotFoundErr = 4294967194;
alias needClearScrapErr = 4294967196;

alias afpAccessDenied = 4294962296;
alias afpAuthContinue = 4294962295;
alias afpBadUAM = 4294962294;
alias afpBadVersNum = 4294962293;
alias afpBitmapErr = 4294962292;
alias afpCantMove = 4294962291;
alias afpDenyConflict = 4294962290;
alias afpDirNotEmpty = 4294962289;
alias afpDiskFull = 4294962288;
alias afpEofError = 4294962287;
alias afpFileBusy = 4294962286;
alias afpFlatVol = 4294962285;
alias afpItemNotFound = 4294962284;
alias afpLockErr = 4294962283;
alias afpMiscErr = 4294962282;
alias afpNoMoreLocks = 4294962281;
alias afpNoServer = 4294962280;
alias afpObjectExists = 4294962279;
alias afpObjectNotFound = 4294962278;
alias afpParmErr = 4294962277;
alias afpRangeNotLocked = 4294962276;
alias afpRangeOverlap = 4294962275;
alias afpSessClosed = 4294962274;
alias afpUserNotAuth = 4294962273;
alias afpCallNotSupported = 4294962272;
alias afpObjectTypeErr = 4294962271;
alias afpTooManyFilesOpen = 4294962270;
alias afpServerGoingDown = 4294962269;
alias afpCantRename = 4294962268;
alias afpDirNotFound = 4294962267;
alias afpIconTypeError = 4294962266;
alias afpVolLocked = 4294962265;
alias afpObjectLocked = 4294962264;
alias afpContainsSharedErr = 4294962263;
alias afpIDNotFound = 4294962262;
alias afpIDExists = 4294962261;
alias afpDiffVolErr = 4294962260;
alias afpCatalogChanged = 4294962259;
alias afpSameObjectErr = 4294962258;
alias afpBadIDErr = 4294962257;
alias afpPwdSameErr = 4294962256;
alias afpPwdTooShortErr = 4294962255;
alias afpPwdExpiredErr = 4294962254;
alias afpInsideSharedErr = 4294962253;
alias afpInsideTrashErr = 4294962252;
alias afpPwdNeedsChangeErr = 4294962251;
alias afpPwdPolicyErr = 4294962250;
alias afpAlreadyLoggedInErr = 4294962249;
alias afpCallNotAllowed = 4294962248;

alias afpBadDirIDType = 4294962236;
alias afpCantMountMoreSrvre = 4294962235;
alias afpAlreadyMounted = 4294962234;
alias afpSameNodeErr = 4294962233;

alias numberFormattingNotANumberErr = 4294962096;
alias numberFormattingOverflowInDestinationErr = 4294962095;
alias numberFormattingBadNumberFormattingObjectErr = 4294962094;
alias numberFormattingSpuriousCharErr = 4294962093;
alias numberFormattingLiteralMissingErr = 4294962092;
alias numberFormattingDelimiterMissingErr = 4294962091;
alias numberFormattingEmptyFormatErr = 4294962090;
alias numberFormattingBadFormatErr = 4294962089;
alias numberFormattingBadOptionsErr = 4294962088;
alias numberFormattingBadTokenErr = 4294962087;
alias numberFormattingUnOrderedCurrencyRangeErr = 4294962086;
alias numberFormattingBadCurrencyPositionErr = 4294962085;
alias numberFormattingNotADigitErr = 4294962084;
alias numberFormattingUnOrdredCurrencyRangeErr = 4294962086;
alias numberFortmattingNotADigitErr = 4294962084;

alias textParserBadParamErr = 4294962076;
alias textParserObjectNotFoundErr = 4294962075;
alias textParserBadTokenValueErr = 4294962074;
alias textParserBadParserObjectErr = 4294962073;
alias textParserParamErr = 4294962072;
alias textParserNoMoreTextErr = 4294962071;
alias textParserBadTextLanguageErr = 4294962070;
alias textParserBadTextEncodingErr = 4294962069;
alias textParserNoSuchTokenFoundErr = 4294962068;
alias textParserNoMoreTokensErr = 4294962067;

alias errUnknownAttributeTag = 4294962056;
alias errMarginWilllNotFit = 4294962055;
alias errNotInImagingMode = 4294962054;
alias errAlreadyInImagingMode = 4294962053;
alias errEngineNotFound = 4294962052;
alias errIteratorReachedEnd = 4294962051;
alias errInvalidRange = 4294962050;
alias errOffsetNotOnElementBounday = 4294962049;
alias errNoHiliteText = 4294962048;
alias errEmptyScrap = 4294962047;
alias errReadOnlyText = 4294962046;
alias errUnknownElement = 4294962045;
alias errNonContiuousAttribute = 4294962044;
alias errCannotUndo = 4294962043;

alias hrHTMLRenderingLibNotInstalledErr = 4294961936;
alias hrMiscellaneousExceptionErr = 4294961935;
alias hrUnableToResizeHandleErr = 4294961934;
alias hrURLNotHandledErr = 4294961933;

alias errIANoErr = 0;
alias errIAUnknownErr = 4294961916;
alias errIAAllocationErr = 4294961915;
alias errIAParamErr = 4294961914;
alias errIANoMoreItems = 4294961913;
alias errIABufferTooSmall = 4294961912;
alias errIACanceled = 4294961911;
alias errIAInvalidDocument = 4294961910;
alias errIATextExtractionErr = 4294961909;
alias errIAEndOfTextRun = 4294961908;

alias qtsBadSelectorErr = 4294961896;
alias qtsBadStateErr = 4294961895;
alias qtsBadDataErr = 4294961894;
alias qtsUnsupportedDataTypeErr = 4294961893;
alias qtsUnsupportedRateErr = 4294961892;
alias qtsUnsupportedFeatureErr = 4294961891;
alias qtsTooMuchDataErr = 4294961890;
alias qtsUnknownValueErr = 4294961889;
alias qtsTimeoutErr = 4294961888;
alias qtsConnectionFailedErr = 4294961876;
alias qtsAddressBusyErr = 4294961875;

alias gestaltUnknownErr = 4294961746;
alias gestaltUndefSelectorErr = 4294961745;
alias gestaltDupSelectorErr = 4294961744;
alias gestaltLocationErr = 4294961743;

alias menuPropertyInvalidErr = 4294961693;
alias menuPropertyInvalid = 4294961693;
alias menuPropertyNotFoundErr = 4294961692;
alias menuNotFoundErr = 4294961676;
alias menuUsesSystemDefErr = 4294961675;
alias menuItemNotFoundErr = 4294961674;
alias menuInvalidErr = 4294961673;

alias errInvalidWindowPtr = 4294961696;
alias errInvalidWindowRef = 4294961696;
alias errUnsupportedWindowAttributesForClass = 4294961695;
alias errWindowDoesNotHaveProxy = 4294961694;
alias errInvalidWindowProperty = 4294961693;
alias errWindowPropertyNotFound = 4294961692;
alias errUnrecognizedWindowClass = 4294961691;
alias errCorruptWindowDescription = 4294961690;
alias errUserWantsToDragWindow = 4294961689;
alias errWindowsAlreadyInitialized = 4294961688;
alias errFloatingWindowsNotInitialized = 4294961687;
alias errWindowNotFound = 4294961686;
alias errWindowDoesNotFitOnscreen = 4294961685;
alias windowAttributeImmutableErr = 4294961684;
alias windowAttributesConflictErr = 4294961683;
alias windowManagerInternalErr = 4294961682;
alias windowWrongStateErr = 4294961681;
alias windowGroupInvalidErr = 4294961680;
alias windowAppModalStateAlreadyExistsErr = 4294961679;
alias windowNoAppModalStateErr = 4294961678;
alias errWindowDoesntSupportFocus = 4294936713;
alias errWindowRegionCodeInvalid = 4294936703;

alias dialogNoTimeoutErr = 4294961656;

alias kNavWrongDialogStateErr = 4294961602;
alias kNavWrongDialogClassErr = 4294961601;
alias kNavInvalidSystemConfigErr = 4294961600;
alias kNavCustomControlMessageFailedErr = 4294961599;
alias kNavInvalidCustomControlMessageErr = 4294961598;
alias kNavMissingKindStringErr = 4294961597;

alias collectionItemLockedErr = 4294961546;
alias collectionItemNotFoundErr = 4294961545;
alias collectionIndexRangeErr = 4294961544;
alias collectionVersionErr = 4294961543;

alias kQTSSUnknownErr = 4294961146;

alias kDMGenErr = 4294961076;
alias kDMMirroringOnAlready = 4294961075;
alias kDMWrongNumberOfDisplays = 4294961074;
alias kDMMirroringBlocked = 4294961073;
alias kDMCantBlock = 4294961072;
alias kDMMirroringNotOn = 4294961071;
alias kSysSWTooOld = 4294961070;
alias kDMSWNotInitializedErr = 4294961069;
alias kDMDriverNotDisplayMgrAwareErr = 4294961068;
alias kDMDisplayNotFoundErr = 4294961067;
alias kDMNotFoundErr = 4294961067;
alias kDMDisplayAlreadyInstalledErr = 4294961066;
alias kDMMainDisplayCannotMoveErr = 4294961065;
alias kDMNoDeviceTableclothErr = 4294961065;
alias kDMFoundErr = 4294961064;

alias laTooSmallBufferErr = 4294960312;
alias laEnvironmentBusyErr = 4294960311;
alias laEnvironmentNotFoundErr = 4294960310;
alias laEnvironmentExistErr = 4294960309;
alias laInvalidPathErr = 4294960308;
alias laNoMoreMorphemeErr = 4294960307;
alias laFailAnalysisErr = 4294960306;
alias laTextOverFlowErr = 4294960305;
alias laDictionaryNotOpenedErr = 4294960304;
alias laDictionaryUnknownErr = 4294960303;
alias laDictionaryTooManyErr = 4294960302;
alias laPropertyValueErr = 4294960301;
alias laPropertyUnknownErr = 4294960300;
alias laPropertyIsReadOnlyErr = 4294960299;
alias laPropertyNotFoundErr = 4294960298;
alias laPropertyErr = 4294960297;
alias laEngineNotFoundErr = 4294960296;

alias kUSBNoErr = 0;
alias kUSBNoTran = 0;
alias kUSBNoDelay = 0;
alias kUSBPending = 1;

alias kUSBNotSent2Err = 4294960395;
alias kUSBNotSent1Err = 4294960394;
alias kUSBBufUnderRunErr = 4294960393;
alias kUSBBufOvrRunErr = 4294960392;
alias kUSBRes2Err = 4294960391;
alias kUSBRes1Err = 4294960390;
alias kUSBUnderRunErr = 4294960389;
alias kUSBOverRunErr = 4294960388;
alias kUSBWrongPIDErr = 4294960387;
alias kUSBPIDCheckErr = 4294960386;
alias kUSBNotRespondingErr = 4294960385;
alias kUSBEndpointStallErr = 4294960384;
alias kUSBDataToggleErr = 4294960383;
alias kUSBBitstufErr = 4294960382;
alias kUSBCRCErr = 4294960381;
alias kUSBLinkErr = 4294960380;

alias kUSBQueueFull = 4294960348;
alias kUSBNotHandled = 4294960309;
alias kUSBUnknownNotification = 4294960347;
alias kUSBBadDispatchTable = 4294960346;

alias kUSBInternalReserved10 = 4294960345;
alias kUSBInternalReserved9 = 4294960344;
alias kUSBInternalReserved8 = 4294960343;
alias kUSBInternalReserved7 = 4294960342;
alias kUSBInternalReserved6 = 4294960341;
alias kUSBInternalReserved5 = 4294960340;
alias kUSBInternalReserved4 = 4294960339;
alias kUSBInternalReserved3 = 4294960338;
alias kUSBInternalReserved2 = 4294960337;
alias kUSBInternalReserved1 = 4294960336;

alias kUSBPortDisabled = 4294960327;
alias kUSBQueueAborted = 4294960326;
alias kUSBTimedOut = 4294960325;
alias kUSBDeviceDisconnected = 4294960324;
alias kUSBDeviceNotSuspended = 4294960323;
alias kUSBDeviceSuspended = 4294960322;
alias kUSBInvalidBuffer = 4294960321;
alias kUSBDevicePowerProblem = 4294960320;
alias kUSBDeviceBusy = 4294960319;
alias kUSBUnknownInterfaceErr = 4294960318;
alias kUSBPipeStalledError = 4294960317;
alias kUSBPipeIdleError = 4294960316;
alias kUSBNoBandwidthError = 4294960315;
alias kUSBAbortedError = 4294960314;
alias kUSBFlagsError = 4294960313;
alias kUSBCompletionError = 4294960312;
alias kUSBPBLengthError = 4294960311;
alias kUSBPBVersionError = 4294960310;
alias kUSBNotFound = 4294960309;
alias kUSBOutOfMemoryErr = 4294960308;
alias kUSBDeviceErr = 4294960307;
alias kUSBNoDeviceErr = 4294960306;
alias kUSBAlreadyOpenErr = 4294960305;
alias kUSBTooManyTransactionsErr = 4294960304;
alias kUSBUnknownRequestErr = 4294960303;
alias kUSBRqErr = 4294960302;
alias kUSBIncorrectTypeErr = 4294960301;
alias kUSBTooManyPipesErr = 4294960300;
alias kUSBUnknownPipeErr = 4294960299;
alias kUSBUnknownDeviceErr = 4294960298;
alias kUSBInternalErr = 4294960297;

alias dcmParamErr = 4294960196;
alias dcmNotDictionaryErr = 4294960195;
alias dcmBadDictionaryErr = 4294960194;
alias dcmPermissionErr = 4294960193;
alias dcmDictionaryNotOpenErr = 4294960192;
alias dcmDictionaryBusyErr = 4294960191;
alias dcmBlockFullErr = 4294960189;
alias dcmNoRecordErr = 4294960188;
alias dcmDupRecordErr = 4294960187;
alias dcmNecessaryFieldErr = 4294960186;
alias dcmBadFieldInfoErr = 4294960185;
alias dcmBadFieldTypeErr = 4294960184;
alias dcmNoFieldErr = 4294960183;
alias dcmBadKeyErr = 4294960181;
alias dcmTooManyKeyErr = 4294960180;
alias dcmBadDataSizeErr = 4294960179;
alias dcmBadFindMethodErr = 4294960178;
alias dcmBadPropertyErr = 4294960177;
alias dcmProtectedErr = 4294960175;
alias dcmNoAccessMethodErr = 4294960174;
alias dcmBadFeatureErr = 4294960172;
alias dcmIterationCompleteErr = 4294960170;
alias dcmBufferOverflowErr = 4294960169;

alias kRAInvalidParameter = 4294960196;
alias kRAInvalidPort = 4294960195;
alias kRAStartupFailed = 4294960194;
alias kRAPortSetupFailed = 4294960193;
alias kRAOutOfMemory = 4294960192;
alias kRANotSupported = 4294960191;
alias kRAMissingResources = 4294960190;
alias kRAIncompatiblePrefs = 4294960189;
alias kRANotConnected = 4294960188;
alias kRAConnectionCanceled = 4294960187;
alias kRAUnknownUser = 4294960186;
alias kRAInvalidPassword = 4294960185;
alias kRAInternalError = 4294960184;
alias kRAInstallationDamaged = 4294960183;
alias kRAPortBusy = 4294960182;
alias kRAUnknownPortState = 4294960181;
alias kRAInvalidPortState = 4294960180;
alias kRAInvalidSerialProtocol = 4294960179;
alias kRAUserLoginDisabled = 4294960178;
alias kRAUserPwdChangeRequired = 4294960177;
alias kRAUserPwdEntryRequired = 4294960176;
alias kRAUserInteractionRequired = 4294960175;
alias kRAInitOpenTransportFailed = 4294960174;
alias kRARemoteAccessNotReady = 4294960173;
alias kRATCPIPInactive = 4294960172;
alias kRATCPIPNotConfigured = 4294960171;
alias kRANotPrimaryInterface = 4294960170;
alias kRAConfigurationDBInitErr = 4294960169;
alias kRAPPPProtocolRejected = 4294960168;
alias kRAPPPAuthenticationFailed = 4294960167;
alias kRAPPPNegotiationFailed = 4294960166;
alias kRAPPPUserDisconnected = 4294960165;
alias kRAPPPPeerDisconnected = 4294960164;
alias kRAPeerNotResponding = 4294960163;
alias kRAATalkInactive = 4294960162;
alias kRAExtAuthenticationFailed = 4294960161;
alias kRANCPRejectedbyPeer = 4294960160;
alias kRADuplicateIPAddr = 4294960159;
alias kRACallBackFailed = 4294960158;
alias kRANotEnabled = 4294960157;

alias kATSUInvalidTextLayoutErr = 4294958506;
alias kATSUInvalidStyleErr = 4294958505;
alias kATSUInvalidTextRangeErr = 4294958504;
alias kATSUFontsMatched = 4294958503;
alias kATSUFontsNotMatched = 4294958502;
alias kATSUNoCorrespondingFontErr = 4294958501;
alias kATSUInvalidFontErr = 4294958500;
alias kATSUInvalidAttributeValueErr = 4294958499;
alias kATSUInvalidAttributeSizeErr = 4294958498;
alias kATSUInvalidAttributeTagErr = 4294958497;
alias kATSUInvalidCacheErr = 4294958496;
alias kATSUNotSetErr = 4294958495;
alias kATSUNoStyleRunsAssignedErr = 4294958494;
alias kATSUQuickDrawTextErr = 4294958493;
alias kATSULowLevelErr = 4294958492;
alias kATSUNoFontCmapAvailableErr = 4294958491;
alias kATSUNoFontScalerAvailableErr = 4294958490;
alias kATSUCoordinateOverflowErr = 4294958489;
alias kATSULineBreakInWord = 4294958488;
alias kATSUBusyObjectErr = 4294958487;

alias kTextUnsupportedEncodingErr = 4294958558;
alias kTextMalformedInputErr = 4294958557;
alias kTextUndefinedElementErr = 4294958556;
alias kTECMissingTableErr = 4294958551;
alias kTECTableChecksumErr = 4294958550;
alias kTECTableFormatErr = 4294958549;
alias kTECCorruptConverterErr = 4294958548;
alias kTECNoConversionPathErr = 4294958547;
alias kTECBufferBelowMinimumSizeErr = 4294958546;
alias kTECArrayFullErr = 4294958545;
alias kTECBadTextRunErr = 4294958544;
alias kTECPartialCharErr = 4294958543;
alias kTECUnmappableElementErr = 4294958542;
alias kTECIncompleteElementErr = 4294958541;
alias kTECDirectionErr = 4294958540;
alias kTECGlobalsUnavailableErr = 4294958526;
alias kTECItemUnavailableErr = 4294958525;
alias kTECUsedFallbacksStatus = 4294958513;
alias kTECNeedFlushStatus = 4294958512;
alias kTECOutputBufferFullStatus = 4294958511;
alias unicodeChecksumErr = 4294958527;
alias unicodeNoTableErr = 4294958528;
alias unicodeVariantErr = 4294958529;
alias unicodeFallbacksErr = 4294958530;
alias unicodePartConvertErr = 4294958531;
alias unicodeBufErr = 4294958532;
alias unicodeCharErr = 4294958533;
alias unicodeElementErr = 4294958534;
alias unicodeNotFoundErr = 4294958535;
alias unicodeTableFormatErr = 4294958536;
alias unicodeDirectionErr = 4294958537;
alias unicodeContextualErr = 4294958538;
alias unicodeTextEncodingDataErr = 4294958539;

alias kUTCUnderflowErr = 4294958446;
alias kUTCOverflowErr = 4294958445;
alias kIllegalClockValueErr = 4294958444;

alias kATSUInvalidFontFallbacksErr = 4294958396;
alias kATSUUnsupportedStreamFormatErr = 4294958395;
alias kATSUBadStreamErr = 4294958394;
alias kATSUOutputBufferTooSmallErr = 4294958393;
alias kATSUInvalidCallInsideCallbackErr = 4294958392;
alias kATSUNoFontNameErr = 4294958391;
alias kATSULastErr = 4294958337;

alias codecErr = 4294958336;
alias noCodecErr = 4294958335;
alias codecUnimpErr = 4294958334;
alias codecSizeErr = 4294958333;
alias codecScreenBufErr = 4294958332;
alias codecImageBufErr = 4294958331;
alias codecSpoolErr = 4294958330;
alias codecAbortErr = 4294958329;
alias codecWouldOffscreenErr = 4294958328;
alias codecBadDataErr = 4294958327;
alias codecDataVersErr = 4294958326;
alias codecExtensionNotFoundErr = 4294958325;
alias scTypeNotFoundErr = 4294958325;
alias codecConditionErr = 4294958324;
alias codecOpenErr = 4294958323;
alias codecCantWhenErr = 4294958322;
alias codecCantQueueErr = 4294958321;
alias codecNothingToBlitErr = 4294958320;
alias codecNoMemoryPleaseWaitErr = 4294958319;
alias codecDisabledErr = 4294958318;
alias codecNeedToFlushChainErr = 4294958317;
alias lockPortBitsBadSurfaceErr = 4294958316;
alias lockPortBitsWindowMovedErr = 4294958315;
alias lockPortBitsWindowResizedErr = 4294958314;
alias lockPortBitsWindowClippedErr = 4294958313;
alias lockPortBitsBadPortErr = 4294958312;
alias lockPortBitsSurfaceLostErr = 4294958311;
alias codecParameterDialogConfirm = 4294958310;
alias codecNeedAccessKeyErr = 4294958309;
alias codecOffscreenFailedErr = 4294958308;
alias codecDroppedFrameErr = 4294958307;
alias directXObjectAlreadyExists = 4294958306;
alias lockPortBitsWrongGDeviceErr = 4294958305;
alias codecOffscreenFailedPleaseRetryErr = 4294958304;
alias badCodecCharacterizationErr = 4294958303;
alias noThumbnailFoundErr = 4294958302;

alias kBadAdapterErr = 4294958246;
alias kBadAttributeErr = 4294958245;
alias kBadBaseErr = 4294958244;
alias kBadEDCErr = 4294958243;
alias kBadIRQErr = 4294958242;
alias kBadOffsetErr = 4294958241;
alias kBadPageErr = 4294958240;
alias kBadSizeErr = 4294958239;
alias kBadSocketErr = 4294958238;
alias kBadTypeErr = 4294958237;
alias kBadVccErr = 4294958236;
alias kBadVppErr = 4294958235;
alias kBadWindowErr = 4294958234;
alias kBadArgLengthErr = 4294958233;
alias kBadArgsErr = 4294958232;
alias kBadHandleErr = 4294958231;
alias kBadCISErr = 4294958230;
alias kBadSpeedErr = 4294958229;
alias kReadFailureErr = 4294958228;
alias kWriteFailureErr = 4294958227;
alias kGeneralFailureErr = 4294958226;
alias kNoCardErr = 4294958225;
alias kUnsupportedFunctionErr = 4294958224;
alias kUnsupportedModeErr = 4294958223;
alias kBusyErr = 4294958222;
alias kWriteProtectedErr = 4294958221;
alias kConfigurationLockedErr = 4294958220;
alias kInUseErr = 4294958219;
alias kNoMoreItemsErr = 4294958218;
alias kOutOfResourceErr = 4294958217;
alias kNoCardSevicesSocketsErr = 4294958216;
alias kInvalidRegEntryErr = 4294958215;
alias kBadLinkErr = 4294958214;
alias kBadDeviceErr = 4294958213;
alias k16BitCardErr = 4294958212;
alias kCardBusCardErr = 4294958211;
alias kPassCallToChainErr = 4294958210;
alias kCantConfigureCardErr = 4294958209;
alias kPostCardEventErr = 4294958208;
alias kInvalidDeviceNumber = 4294958207;
alias kUnsupportedVsErr = 4294958206;
alias kInvalidCSClientErr = 4294958205;
alias kBadTupleDataErr = 4294958204;
alias kBadCustomIFIDErr = 4294958203;
alias kNoIOWindowRequestedErr = 4294958202;
alias kNoMoreTimerClientsErr = 4294958201;
alias kNoMoreInterruptSlotsErr = 4294958200;
alias kNoClientTableErr = 4294958199;
alias kUnsupportedCardErr = 4294958198;
alias kNoCardEnablersFoundErr = 4294958197;
alias kNoEnablerForCardErr = 4294958196;
alias kNoCompatibleNameErr = 4294958195;
alias kClientRequestDenied = 4294958194;
alias kNotReadyErr = 4294958193;
alias kTooManyIOWindowsErr = 4294958192;
alias kAlreadySavedStateErr = 4294958191;
alias kAttemptDupCardEntryErr = 4294958190;
alias kCardPowerOffErr = 4294958189;
alias kNotZVCapableErr = 4294958188;
alias kNoCardBusCISErr = 4294958187;

alias noDeviceForChannel = 4294957896;
alias grabTimeComplete = 4294957895;
alias cantDoThatInCurrentMode = 4294957894;
alias notEnoughMemoryToGrab = 4294957893;
alias notEnoughDiskSpaceToGrab = 4294957892;
alias couldntGetRequiredComponent = 4294957891;
alias badSGChannel = 4294957890;
alias seqGrabInfoNotAvailable = 4294957889;
alias deviceCantMeetRequest = 4294957888;
alias badControllerHeight = 4294957302;
alias editingNotAllowed = 4294957301;
alias controllerBoundsNotExact = 4294957300;
alias cannotSetWidthOfAttachedController = 4294957299;
alias controllerHasFixedHeight = 4294957298;
alias cannotMoveAttachedController = 4294957297;

alias errAEBadKeyForm = 4294957294;
alias errAECantHandleClass = 4294957286;
alias errAECantSupplyType = 4294957287;
alias errAECantUndo = 4294957281;
alias errAEEventFailed = 4294957296;
alias errAEIndexTooLarge = 4294957289;
alias errAEInTransaction = 4294957285;
alias errAELocalOnly = 4294957280;
alias errAENoSuchTransaction = 4294957284;
alias errAENotAnElement = 4294957288;
alias errAENotASingleObject = 4294957282;
alias errAENotModifiable = 4294957293;
alias errAENoUserSelection = 4294957283;
alias errAEPrivilegeError = 4294957292;
alias errAEReadDenied = 4294957291;
alias errAETypeError = 4294957295;
alias errAEWriteDenied = 4294957290;
alias errAENotAnEnumMember = 4294957273;
alias errAECantPutThatThere = 4294957272;
alias errAEPropertiesClash = 4294957271;

alias telGenericError = 4294967295;
alias telNoErr = 0;
alias telNoTools = 8;
alias telBadTermErr = 4294957295;
alias telBadDNErr = 4294957294;
alias telBadCAErr = 4294957293;
alias telBadHandErr = 4294957292;
alias telBadProcErr = 4294957291;
alias telCAUnavail = 4294957290;
alias telNoMemErr = 4294957289;
alias telNoOpenErr = 4294957288;
alias telBadHTypeErr = 4294957286;
alias telHTypeNotSupp = 4294957285;
alias telBadLevelErr = 4294957284;
alias telBadVTypeErr = 4294957283;
alias telVTypeNotSupp = 4294957282;
alias telBadAPattErr = 4294957281;
alias telAPattNotSupp = 4294957280;
alias telBadIndex = 4294957279;
alias telIndexNotSupp = 4294957278;
alias telBadStateErr = 4294957277;
alias telStateNotSupp = 4294957276;
alias telBadIntExt = 4294957275;
alias telIntExtNotSupp = 4294957274;
alias telBadDNDType = 4294957273;
alias telDNDTypeNotSupp = 4294957272;
alias telFeatNotSub = 4294957266;
alias telFeatNotAvail = 4294957265;
alias telFeatActive = 4294957264;
alias telFeatNotSupp = 4294957263;
alias telConfLimitErr = 4294957256;
alias telConfNoLimit = 4294957255;
alias telConfErr = 4294957254;
alias telConfRej = 4294957253;
alias telTransferErr = 4294957252;
alias telTransferRej = 4294957251;
alias telCBErr = 4294957250;
alias telConfLimitExceeded = 4294957249;
alias telBadDNType = 4294957246;
alias telBadPageID = 4294957245;
alias telBadIntercomID = 4294957244;
alias telBadFeatureID = 4294957243;
alias telBadFwdType = 4294957242;
alias telBadPickupGroupID = 4294957241;
alias telBadParkID = 4294957240;
alias telBadSelect = 4294957239;
alias telBadBearerType = 4294957238;
alias telBadRate = 4294957237;
alias telDNTypeNotSupp = 4294957236;
alias telFwdTypeNotSupp = 4294957235;
alias telBadDisplayMode = 4294957234;
alias telDisplayModeNotSupp = 4294957233;
alias telNoCallbackRef = 4294957232;
alias telAlreadyOpen = 4294957226;
alias telStillNeeded = 4294957225;
alias telTermNotOpen = 4294957224;
alias telCANotAcceptable = 4294957216;
alias telCANotRejectable = 4294957215;
alias telCANotDeflectable = 4294957214;
alias telPBErr = 4294957206;
alias telBadFunction = 4294957205;
alias telNoSuchTool = 4294957194;
alias telUnknownErr = 4294957193;
alias telNoCommFolder = 4294957190;
alias telInitFailed = 4294957189;
alias telBadCodeResource = 4294957188;
alias telDeviceNotFound = 4294957187;
alias telBadProcID = 4294957186;
alias telValidateFailed = 4294957185;
alias telAutoAnsNotOn = 4294957184;
alias telDetAlreadyOn = 4294957183;
alias telBadSWErr = 4294957182;
alias telBadSampleRate = 4294957181;
alias telNotEnoughdspBW = 4294957180;

alias errTaskNotFound = 4294956516;

alias pmBusyErr = 4294954296;
alias pmReplyTOErr = 4294954295;
alias pmSendStartErr = 4294954294;
alias pmSendEndErr = 4294954293;
alias pmRecvStartErr = 4294954292;
alias pmRecvEndErr = 4294954291;

alias kPowerHandlerExistsForDeviceErr = 4294954290;
alias kPowerHandlerNotFoundForDeviceErr = 4294954289;
alias kPowerHandlerNotFoundForProcErr = 4294954288;
alias kPowerMgtMessageNotHandled = 4294954287;
alias kPowerMgtRequestDenied = 4294954286;
alias kCantReportProcessorTemperatureErr = 4294954283;
alias kProcessorTempRoutineRequiresMPLib2 = 4294954282;
alias kNoSuchPowerSource = 4294954276;
alias kBridgeSoftwareRunningCantSleep = 4294954258;

alias debuggingExecutionContextErr = 4294953416;
alias debuggingDuplicateSignatureErr = 4294953415;
alias debuggingDuplicateOptionErr = 4294953414;
alias debuggingInvalidSignatureErr = 4294953413;
alias debuggingInvalidOptionErr = 4294953412;
alias debuggingInvalidNameErr = 4294953411;
alias debuggingNoCallbackErr = 4294953410;
alias debuggingNoMatchErr = 4294953409;

alias kHIDVersionIncompatibleErr = 4294953387;
alias kHIDDeviceNotReady = 4294953386;

alias kHIDSuccess = 0;
alias kHIDInvalidRangePageErr = 4294953373;
alias kHIDReportIDZeroErr = 4294953372;
alias kHIDReportCountZeroErr = 4294953371;
alias kHIDReportSizeZeroErr = 4294953370;
alias kHIDUnmatchedDesignatorRangeErr = 4294953369;
alias kHIDUnmatchedStringRangeErr = 4294953368;
alias kHIDInvertedUsageRangeErr = 4294953367;
alias kHIDUnmatchedUsageRangeErr = 4294953366;
alias kHIDInvertedPhysicalRangeErr = 4294953365;
alias kHIDInvertedLogicalRangeErr = 4294953364;
alias kHIDBadLogicalMaximumErr = 4294953363;
alias kHIDBadLogicalMinimumErr = 4294953362;
alias kHIDUsagePageZeroErr = 4294953361;
alias kHIDEndOfDescriptorErr = 4294953360;
alias kHIDNotEnoughMemoryErr = 4294953359;
alias kHIDBadParameterErr = 4294953358;
alias kHIDNullPointerErr = 4294953357;
alias kHIDInvalidReportLengthErr = 4294953356;
alias kHIDInvalidReportTypeErr = 4294953355;
alias kHIDBadLogPhysValuesErr = 4294953354;
alias kHIDIncompatibleReportErr = 4294953353;
alias kHIDInvalidPreparsedDataErr = 4294953352;
alias kHIDNotValueArrayErr = 4294953351;
alias kHIDUsageNotFoundErr = 4294953350;
alias kHIDValueOutOfRangeErr = 4294953349;
alias kHIDBufferTooSmallErr = 4294953348;
alias kHIDNullStateErr = 4294953347;
alias kHIDBaseError = 4294953346;

alias kModemOutOfMemory = 4294953296;
alias kModemPreferencesMissing = 4294953295;
alias kModemScriptMissing = 4294953294;

alias kTXNEndIterationErr = 4294945296;
alias kTXNCannotAddFrameErr = 4294945295;
alias kTXNInvalidFrameIDErr = 4294945294;
alias kTXNIllegalToCrossDataBoundariesErr = 4294945293;
alias kTXNUserCanceledOperationErr = 4294945292;
alias kTXNBadDefaultFileTypeWarning = 4294945291;
alias kTXNCannotSetAutoIndentErr = 4294945290;
alias kTXNRunIndexOutofBoundsErr = 4294945289;
alias kTXNNoMatchErr = 4294945288;
alias kTXNAttributeTagInvalidForRunErr = 4294945287;
alias kTXNSomeOrAllTagsInvalidForRunErr = 4294945286;
alias kTXNInvalidRunIndex = 4294945285;
alias kTXNAlreadyInitializedErr = 4294945284;
alias kTXNCannotTurnTSMOffWhenUsingUnicodeErr = 4294945283;
alias kTXNCopyNotAllowedInEchoModeErr = 4294945282;
alias kTXNDataTypeNotAllowedErr = 4294945281;
alias kTXNATSUIIsNotInstalledErr = 4294945280;
alias kTXNOutsideOfLineErr = 4294945279;
alias kTXNOutsideOfFrameErr = 4294945278;

alias printerStatusOpCodeNotSupportedErr = 4294942016;

alias errKCNotAvailable = 4294942005;
alias errKCReadOnly = 4294942004;
alias errKCAuthFailed = 4294942003;
alias errKCNoSuchKeychain = 4294942002;
alias errKCInvalidKeychain = 4294942001;
alias errKCDuplicateKeychain = 4294942000;
alias errKCDuplicateCallback = 4294941999;
alias errKCInvalidCallback = 4294941998;
alias errKCDuplicateItem = 4294941997;
alias errKCItemNotFound = 4294941996;
alias errKCBufferTooSmall = 4294941995;
alias errKCDataTooLarge = 4294941994;
alias errKCNoSuchAttr = 4294941993;
alias errKCInvalidItemRef = 4294941992;
alias errKCInvalidSearchRef = 4294941991;
alias errKCNoSuchClass = 4294941990;
alias errKCNoDefaultKeychain = 4294941989;
alias errKCInteractionNotAllowed = 4294941988;
alias errKCReadOnlyAttr = 4294941987;
alias errKCWrongKCVersion = 4294941986;
alias errKCKeySizeNotAllowed = 4294941985;
alias errKCNoStorageModule = 4294941984;
alias errKCNoCertificateModule = 4294941983;
alias errKCNoPolicyModule = 4294941982;
alias errKCInteractionRequired = 4294941981;
alias errKCDataNotAvailable = 4294941980;
alias errKCDataNotModifiable = 4294941979;
alias errKCCreateChainFailed = 4294941978;

alias kUCOutputBufferTooSmall = 4294941956;
alias kUCTextBreakLocatorMissingType = 4294941955;

alias kUCTSNoKeysAddedToObjectErr = 4294941954;
alias kUCTSSearchListErr = 4294941953;

alias kUCTokenizerIterationFinished = 4294941952;
alias kUCTokenizerUnknownLang = 4294941951;
alias kUCTokenNotFound = 4294941950;

alias kMPIterationEndErr = 4294938021;
alias kMPPrivilegedErr = 4294938020;
alias kMPProcessCreatedErr = 4294938008;
alias kMPProcessTerminatedErr = 4294938007;
alias kMPTaskCreatedErr = 4294938006;
alias kMPTaskBlockedErr = 4294938005;
alias kMPTaskStoppedErr = 4294938004;
alias kMPBlueBlockingErr = 4294938003;
alias kMPDeletedErr = 4294938001;
alias kMPTimeoutErr = 4294938000;
alias kMPTaskAbortedErr = 4294937999;
alias kMPInsufficientResourcesErr = 4294937998;
alias kMPInvalidIDErr = 4294937997;

alias kMPNanokernelNeedsMemoryErr = 4294938002;

alias kCollateAttributesNotFoundErr = 4294937796;
alias kCollateInvalidOptions = 4294937795;
alias kCollateMissingUnicodeTableErr = 4294937794;
alias kCollateUnicodeConvertFailedErr = 4294937793;
alias kCollatePatternNotFoundErr = 4294937792;
alias kCollateInvalidChar = 4294937791;
alias kCollateBufferTooSmall = 4294937790;
alias kCollateInvalidCollationRef = 4294937789;

alias kFNSInvalidReferenceErr = 4294937716;
alias kFNSBadReferenceVersionErr = 4294937715;
alias kFNSInvalidProfileErr = 4294937714;
alias kFNSBadProfileVersionErr = 4294937713;
alias kFNSDuplicateReferenceErr = 4294937712;
alias kFNSMismatchErr = 4294937711;
alias kFNSInsufficientDataErr = 4294937710;
alias kFNSBadFlattenedSizeErr = 4294937709;
alias kFNSNameNotFoundErr = 4294937707;

alias kLocalesBufferTooSmallErr = 4294937295;
alias kLocalesTableFormatErr = 4294937294;
alias kLocalesDefaultDisplayStatus = 4294937267;

alias kALMInternalErr = 4294937247;
alias kALMGroupNotFoundErr = 4294937248;
alias kALMNoSuchModuleErr = 4294937249;
alias kALMModuleCommunicationErr = 4294937250;
alias kALMDuplicateModuleErr = 4294937251;
alias kALMInstallationErr = 4294937252;
alias kALMDeferSwitchErr = 4294937253;
alias kALMRebootFlagsLevelErr = 4294937254;

alias kALMLocationNotFoundErr = 4294937248;

alias kSSpInternalErr = 4294936956;
alias kSSpVersionErr = 4294936955;
alias kSSpCantInstallErr = 4294936954;
alias kSSpParallelUpVectorErr = 4294936953;
alias kSSpScaleToZeroErr = 4294936952;

alias kNSpInitializationFailedErr = 4294936936;
alias kNSpAlreadyInitializedErr = 4294936935;
alias kNSpTopologyNotSupportedErr = 4294936934;
alias kNSpPipeFullErr = 4294936932;
alias kNSpHostFailedErr = 4294936931;
alias kNSpProtocolNotAvailableErr = 4294936930;
alias kNSpInvalidGameRefErr = 4294936929;
alias kNSpInvalidParameterErr = 4294936927;
alias kNSpOTNotPresentErr = 4294936926;
alias kNSpOTVersionTooOldErr = 4294936925;
alias kNSpMemAllocationErr = 4294936923;
alias kNSpAlreadyAdvertisingErr = 4294936922;
alias kNSpNotAdvertisingErr = 4294936920;
alias kNSpInvalidAddressErr = 4294936919;
alias kNSpFreeQExhaustedErr = 4294936918;
alias kNSpRemovePlayerFailedErr = 4294936917;
alias kNSpAddressInUseErr = 4294936916;
alias kNSpFeatureNotImplementedErr = 4294936915;
alias kNSpNameRequiredErr = 4294936914;
alias kNSpInvalidPlayerIDErr = 4294936913;
alias kNSpInvalidGroupIDErr = 4294936912;
alias kNSpNoPlayersErr = 4294936911;
alias kNSpNoGroupsErr = 4294936910;
alias kNSpNoHostVolunteersErr = 4294936909;
alias kNSpCreateGroupFailedErr = 4294936908;
alias kNSpAddPlayerFailedErr = 4294936907;
alias kNSpInvalidDefinitionErr = 4294936906;
alias kNSpInvalidProtocolRefErr = 4294936905;
alias kNSpInvalidProtocolListErr = 4294936904;
alias kNSpTimeoutErr = 4294936903;
alias kNSpGameTerminatedErr = 4294936902;
alias kNSpConnectFailedErr = 4294936901;
alias kNSpSendFailedErr = 4294936900;
alias kNSpMessageTooBigErr = 4294936899;
alias kNSpCantBlockErr = 4294936898;
alias kNSpJoinFailedErr = 4294936897;

alias kISpInternalErr = 4294936876;
alias kISpSystemListErr = 4294936875;
alias kISpBufferToSmallErr = 4294936874;
alias kISpElementInListErr = 4294936873;
alias kISpElementNotInListErr = 4294936872;
alias kISpSystemInactiveErr = 4294936871;
alias kISpDeviceInactiveErr = 4294936870;
alias kISpSystemActiveErr = 4294936869;
alias kISpDeviceActiveErr = 4294936868;
alias kISpListBusyErr = 4294936867;

alias kDSpNotInitializedErr = 4294936856;
alias kDSpSystemSWTooOldErr = 4294936855;
alias kDSpInvalidContextErr = 4294936854;
alias kDSpInvalidAttributesErr = 4294936853;
alias kDSpContextAlreadyReservedErr = 4294936852;
alias kDSpContextNotReservedErr = 4294936851;
alias kDSpContextNotFoundErr = 4294936850;
alias kDSpFrameRateNotReadyErr = 4294936849;
alias kDSpConfirmSwitchWarning = 4294936848;
alias kDSpInternalErr = 4294936847;
alias kDSpStereoContextErr = 4294936846;

alias kFBCvTwinExceptionErr = 4294936796;
alias kFBCnoIndexesFound = 4294936795;
alias kFBCallocFailed = 4294936794;
alias kFBCbadParam = 4294936793;
alias kFBCfileNotIndexed = 4294936792;
alias kFBCbadIndexFile = 4294936791;
alias kFBCcompactionFailed = 4294936790;
alias kFBCvalidationFailed = 4294936789;
alias kFBCindexingFailed = 4294936788;
alias kFBCcommitFailed = 4294936787;
alias kFBCdeletionFailed = 4294936786;
alias kFBCmoveFailed = 4294936785;
alias kFBCtokenizationFailed = 4294936784;
alias kFBCmergingFailed = 4294936783;
alias kFBCindexCreationFailed = 4294936782;
alias kFBCaccessorStoreFailed = 4294936781;
alias kFBCaddDocFailed = 4294936780;
alias kFBCflushFailed = 4294936779;
alias kFBCindexNotFound = 4294936778;
alias kFBCnoSearchSession = 4294936777;
alias kFBCindexingCanceled = 4294936776;
alias kFBCaccessCanceled = 4294936775;
alias kFBCindexFileDestroyed = 4294936774;
alias kFBCindexNotAvailable = 4294936773;
alias kFBCsearchFailed = 4294936772;
alias kFBCsomeFilesNotIndexed = 4294936771;
alias kFBCillegalSessionChange = 4294936770;
alias kFBCanalysisNotAvailable = 4294936769;
alias kFBCbadIndexFileVersion = 4294936768;
alias kFBCsummarizationCanceled = 4294936767;
alias kFBCindexDiskIOFailed = 4294936766;
alias kFBCbadSearchSession = 4294936765;
alias kFBCnoSuchHit = 4294936764;

alias notAQTVRMovieErr = 4294936756;
alias constraintReachedErr = 4294936755;
alias callNotSupportedByNodeErr = 4294936754;
alias selectorNotSupportedByNodeErr = 4294936753;
alias invalidNodeIDErr = 4294936752;
alias invalidViewStateErr = 4294936751;
alias timeNotInViewErr = 4294936750;
alias propertyNotSupportedByNodeErr = 4294936749;
alias settingNotSupportedByNodeErr = 4294936748;
alias limitReachedErr = 4294936747;
alias invalidNodeFormatErr = 4294936746;
alias invalidHotSpotIDErr = 4294936745;
alias noMemoryNodeFailedInitialize = 4294936744;
alias streamingNodeNotReadyErr = 4294936743;
alias qtvrLibraryLoadErr = 4294936742;
alias qtvrUninitialized = 4294936741;

alias themeInvalidBrushErr = 4294936736;
alias themeProcessRegisteredErr = 4294936735;
alias themeProcessNotRegisteredErr = 4294936734;
alias themeBadTextColorErr = 4294936733;
alias themeHasNoAccentsErr = 4294936732;
alias themeBadCursorIndexErr = 4294936731;
alias themeScriptFontNotFoundErr = 4294936730;
alias themeMonitorDepthNotSupportedErr = 4294936729;
alias themeNoAppropriateBrushErr = 4294936728;

alias errMessageNotSupported = 4294936716;
alias errDataNotSupported = 4294936715;
alias errControlDoesntSupportFocus = 4294936714;
alias errUnknownControl = 4294936712;
alias errCouldntSetFocus = 4294936711;
alias errNoRootControl = 4294936710;
alias errRootAlreadyExists = 4294936709;
alias errInvalidPartCode = 4294936708;
alias errControlsAlreadyExist = 4294936707;
alias errControlIsNotEmbedder = 4294936706;
alias errDataSizeMismatch = 4294936705;
alias errControlHiddenOrDisabled = 4294936704;
alias errCantEmbedIntoSelf = 4294936702;
alias errCantEmbedRoot = 4294936701;
alias errItemNotControl = 4294936700;
alias controlInvalidDataVersionErr = 4294936699;
alias controlPropertyInvalid = 4294961693;
alias controlPropertyNotFoundErr = 4294961692;
alias controlHandleInvalidErr = 4294936697;

alias kURLInvalidURLReferenceError = 4294936526;
alias kURLProgressAlreadyDisplayedError = 4294936525;
alias kURLDestinationExistsError = 4294936524;
alias kURLInvalidURLError = 4294936523;
alias kURLUnsupportedSchemeError = 4294936522;
alias kURLServerBusyError = 4294936521;
alias kURLAuthenticationError = 4294936520;
alias kURLPropertyNotYetKnownError = 4294936519;
alias kURLUnknownPropertyError = 4294936518;
alias kURLPropertyBufferTooSmallError = 4294936517;
alias kURLUnsettablePropertyError = 4294936516;
alias kURLInvalidCallError = 4294936515;
alias kURLFileEmptyError = 4294936513;
alias kURLExtensionFailureError = 4294936511;
alias kURLInvalidConfigurationError = 4294936510;
alias kURLAccessNotAvailableError = 4294936509;
alias kURL68kNotSupportedError = 4294936508;

alias errCppGeneral = 4294935296;
alias errCppbad_alloc = 4294935295;
alias errCppbad_cast = 4294935294;
alias errCppbad_exception = 4294935293;
alias errCppbad_typeid = 4294935292;
alias errCpplogic_error = 4294935291;
alias errCppdomain_error = 4294935290;
alias errCppinvalid_argument = 4294935289;
alias errCpplength_error = 4294935288;
alias errCppout_of_range = 4294935287;
alias errCppruntime_error = 4294935286;
alias errCppoverflow_error = 4294935285;
alias errCpprange_error = 4294935284;
alias errCppunderflow_error = 4294935283;
alias errCppios_base_failure = 4294935282;
alias errCppLastSystemDefinedError = 4294935276;
alias errCppLastUserDefinedError = 4294935247;

alias badComponentInstance = 2147516417;
alias badComponentSelector = 2147516418;

alias dsBusError = 1;
alias dsAddressErr = 2;
alias dsIllInstErr = 3;
alias dsZeroDivErr = 4;
alias dsChkErr = 5;
alias dsOvflowErr = 6;
alias dsPrivErr = 7;
alias dsTraceErr = 8;
alias dsLineAErr = 9;
alias dsLineFErr = 10;
alias dsMiscErr = 11;
alias dsCoreErr = 12;
alias dsIrqErr = 13;
alias dsIOCoreErr = 14;
alias dsLoadErr = 15;
alias dsFPErr = 16;
alias dsNoPackErr = 17;
alias dsNoPk1 = 18;
alias dsNoPk2 = 19;

alias dsNoPk3 = 20;
alias dsNoPk4 = 21;
alias dsNoPk5 = 22;
alias dsNoPk6 = 23;
alias dsNoPk7 = 24;
alias dsMemFullErr = 25;
alias dsBadLaunch = 26;
alias dsFSErr = 27;
alias dsStknHeap = 28;
alias negZcbFreeErr = 33;
alias dsFinderErr = 41;
alias dsBadSlotInt = 51;
alias dsBadSANEOpcode = 81;
alias dsBadPatchHeader = 83;
alias menuPrgErr = 84;
alias dsMBarNFnd = 85;
alias dsHMenuFindErr = 86;
alias dsWDEFNotFound = 87;
alias dsCDEFNotFound = 88;
alias dsMDEFNotFound = 89;

alias dsNoFPU = 90;
alias dsNoPatch = 98;
alias dsBadPatch = 99;
alias dsParityErr = 101;
alias dsOldSystem = 102;
alias ds32BitMode = 103;
alias dsNeedToWriteBootBlocks = 104;
alias dsNotEnoughRAMToBoot = 105;
alias dsBufPtrTooLow = 106;
alias dsVMDeferredFuncTableFull = 112;
alias dsVMBadBackingStore = 113;
alias dsCantHoldSystemHeap = 114;
alias dsSystemRequiresPowerPC = 116;
alias dsGibblyMovedToDisabledFolder = 117;
alias dsUnBootableSystem = 118;
alias dsMustUseFCBAccessors = 119;
alias dsMacOSROMVersionTooOld = 120;
alias dsLostConnectionToNetworkDisk = 121;
alias dsRAMDiskTooBig = 122;
alias dsWriteToSupervisorStackGuardPage = 128;
alias dsReinsert = 30;
alias shutDownAlert = 42;
alias dsShutDownOrRestart = 20000;
alias dsSwitchOffOrRestart = 20001;
alias dsForcedQuit = 20002;
alias dsRemoveDisk = 20003;
alias dsDirtyDisk = 20004;
alias dsShutDownOrResume = 20109;
alias dsSCSIWarn = 20010;
alias dsMBSysError = 29200;
alias dsMBFlpySysError = 29201;
alias dsMBATASysError = 29202;
alias dsMBATAPISysError = 29203;
alias dsMBExternFlpySysError = 29204;
alias dsPCCardATASysError = 29205;

alias dsNoExtsMacsBug = 4294967295;
alias dsNoExtsDisassembler = 4294967294;
alias dsMacsBugInstalled = 4294967286;
alias dsDisassemblerInstalled = 4294967285;
alias dsExtensionsDisabled = 4294967283;
alias dsGreeting = 40;
alias dsSysErr = 32767;
alias WDEFNFnd = 87;

alias CDEFNFnd = 88;
alias dsNotThe1 = 31;
alias dsBadStartupDisk = 42;
alias dsSystemFileErr = 43;
alias dsHD20Installed = 4294967284;
alias mBarNFnd = 4294967170;
alias fsDSIntErr = 4294967169;
alias hMenuFindErr = 4294967169;
alias userBreak = 4294966806;
alias strUserBreak = 4294966805;
alias exUserBreak = 4294966804;

alias dsBadLibrary = 1010;
alias dsMixedModeFailure = 1011;

alias kPOSIXErrorBase = 100000;
alias kPOSIXErrorEPERM = 100001;
alias kPOSIXErrorENOENT = 100002;
alias kPOSIXErrorESRCH = 100003;
alias kPOSIXErrorEINTR = 100004;
alias kPOSIXErrorEIO = 100005;
alias kPOSIXErrorENXIO = 100006;
alias kPOSIXErrorE2BIG = 100007;
alias kPOSIXErrorENOEXEC = 100008;
alias kPOSIXErrorEBADF = 100009;
alias kPOSIXErrorECHILD = 100010;
alias kPOSIXErrorEDEADLK = 100011;
alias kPOSIXErrorENOMEM = 100012;
alias kPOSIXErrorEACCES = 100013;
alias kPOSIXErrorEFAULT = 100014;
alias kPOSIXErrorENOTBLK = 100015;
alias kPOSIXErrorEBUSY = 100016;
alias kPOSIXErrorEEXIST = 100017;
alias kPOSIXErrorEXDEV = 100018;
alias kPOSIXErrorENODEV = 100019;
alias kPOSIXErrorENOTDIR = 100020;
alias kPOSIXErrorEISDIR = 100021;
alias kPOSIXErrorEINVAL = 100022;
alias kPOSIXErrorENFILE = 100023;
alias kPOSIXErrorEMFILE = 100024;
alias kPOSIXErrorENOTTY = 100025;
alias kPOSIXErrorETXTBSY = 100026;
alias kPOSIXErrorEFBIG = 100027;
alias kPOSIXErrorENOSPC = 100028;
alias kPOSIXErrorESPIPE = 100029;
alias kPOSIXErrorEROFS = 100030;
alias kPOSIXErrorEMLINK = 100031;
alias kPOSIXErrorEPIPE = 100032;
alias kPOSIXErrorEDOM = 100033;
alias kPOSIXErrorERANGE = 100034;
alias kPOSIXErrorEAGAIN = 100035;
alias kPOSIXErrorEINPROGRESS = 100036;
alias kPOSIXErrorEALREADY = 100037;
alias kPOSIXErrorENOTSOCK = 100038;
alias kPOSIXErrorEDESTADDRREQ = 100039;
alias kPOSIXErrorEMSGSIZE = 100040;
alias kPOSIXErrorEPROTOTYPE = 100041;
alias kPOSIXErrorENOPROTOOPT = 100042;
alias kPOSIXErrorEPROTONOSUPPORT = 100043;
alias kPOSIXErrorESOCKTNOSUPPORT = 100044;
alias kPOSIXErrorENOTSUP = 100045;
alias kPOSIXErrorEPFNOSUPPORT = 100046;
alias kPOSIXErrorEAFNOSUPPORT = 100047;
alias kPOSIXErrorEADDRINUSE = 100048;
alias kPOSIXErrorEADDRNOTAVAIL = 100049;
alias kPOSIXErrorENETDOWN = 100050;
alias kPOSIXErrorENETUNREACH = 100051;
alias kPOSIXErrorENETRESET = 100052;
alias kPOSIXErrorECONNABORTED = 100053;
alias kPOSIXErrorECONNRESET = 100054;
alias kPOSIXErrorENOBUFS = 100055;
alias kPOSIXErrorEISCONN = 100056;
alias kPOSIXErrorENOTCONN = 100057;
alias kPOSIXErrorESHUTDOWN = 100058;
alias kPOSIXErrorETOOMANYREFS = 100059;
alias kPOSIXErrorETIMEDOUT = 100060;
alias kPOSIXErrorECONNREFUSED = 100061;
alias kPOSIXErrorELOOP = 100062;
alias kPOSIXErrorENAMETOOLONG = 100063;
alias kPOSIXErrorEHOSTDOWN = 100064;
alias kPOSIXErrorEHOSTUNREACH = 100065;
alias kPOSIXErrorENOTEMPTY = 100066;
alias kPOSIXErrorEPROCLIM = 100067;
alias kPOSIXErrorEUSERS = 100068;
alias kPOSIXErrorEDQUOT = 100069;
alias kPOSIXErrorESTALE = 100070;
alias kPOSIXErrorEREMOTE = 100071;
alias kPOSIXErrorEBADRPC = 100072;
alias kPOSIXErrorERPCMISMATCH = 100073;
alias kPOSIXErrorEPROGUNAVAIL = 100074;
alias kPOSIXErrorEPROGMISMATCH = 100075;
alias kPOSIXErrorEPROCUNAVAIL = 100076;
alias kPOSIXErrorENOLCK = 100077;
alias kPOSIXErrorENOSYS = 100078;
alias kPOSIXErrorEFTYPE = 100079;
alias kPOSIXErrorEAUTH = 100080;
alias kPOSIXErrorENEEDAUTH = 100081;
alias kPOSIXErrorEPWROFF = 100082;
alias kPOSIXErrorEDEVERR = 100083;
alias kPOSIXErrorEOVERFLOW = 100084;
alias kPOSIXErrorEBADEXEC = 100085;
alias kPOSIXErrorEBADARCH = 100086;
alias kPOSIXErrorESHLIBVERS = 100087;
alias kPOSIXErrorEBADMACHO = 100088;
alias kPOSIXErrorECANCELED = 100089;
alias kPOSIXErrorEIDRM = 100090;
alias kPOSIXErrorENOMSG = 100091;
alias kPOSIXErrorEILSEQ = 100092;
alias kPOSIXErrorENOATTR = 100093;
alias kPOSIXErrorEBADMSG = 100094;
alias kPOSIXErrorEMULTIHOP = 100095;
alias kPOSIXErrorENODATA = 100096;
alias kPOSIXErrorENOLINK = 100097;
alias kPOSIXErrorENOSR = 100098;
alias kPOSIXErrorENOSTR = 100099;
alias kPOSIXErrorEPROTO = 100100;
alias kPOSIXErrorETIME = 100101;
alias kPOSIXErrorEOPNOTSUPP = 100102;

external SysError(
    errorCode : Short);

alias kUTCDefaultOptions = 0;

record Struct_UTCDateTime (
    highSeconds : UShort,
    lowSeconds : UInt,
    fraction : UShort,
);

alias UTCDateTime = Struct_UTCDateTime;

alias UTCDateTimePtr = Pointer[UTCDateTime];

alias UTCDateTimeHandle = Pointer[UTCDateTimePtr];

record Struct_LocalDateTime (
    highSeconds : UShort,
    lowSeconds : UInt,
    fraction : UShort,
);

alias LocalDateTime = Struct_LocalDateTime;

alias LocalDateTimePtr = Pointer[LocalDateTime];

alias LocalDateTimeHandle = Pointer[LocalDateTimePtr];

alias kTextFlushDefault = 0;
alias kTextCenter = 1;
alias kTextFlushRight = 4294967295;
alias kTextFlushLeft = 4294967294;

alias TextEncodingBase = UInt;

alias kTextEncodingMacRoman = 0;
alias kTextEncodingMacJapanese = 1;
alias kTextEncodingMacChineseTrad = 2;
alias kTextEncodingMacKorean = 3;
alias kTextEncodingMacArabic = 4;
alias kTextEncodingMacHebrew = 5;
alias kTextEncodingMacGreek = 6;
alias kTextEncodingMacCyrillic = 7;
alias kTextEncodingMacDevanagari = 9;
alias kTextEncodingMacGurmukhi = 10;
alias kTextEncodingMacGujarati = 11;
alias kTextEncodingMacOriya = 12;
alias kTextEncodingMacBengali = 13;
alias kTextEncodingMacTamil = 14;
alias kTextEncodingMacTelugu = 15;
alias kTextEncodingMacKannada = 16;
alias kTextEncodingMacMalayalam = 17;
alias kTextEncodingMacSinhalese = 18;
alias kTextEncodingMacBurmese = 19;
alias kTextEncodingMacKhmer = 20;
alias kTextEncodingMacThai = 21;
alias kTextEncodingMacLaotian = 22;
alias kTextEncodingMacGeorgian = 23;
alias kTextEncodingMacArmenian = 24;
alias kTextEncodingMacChineseSimp = 25;
alias kTextEncodingMacTibetan = 26;
alias kTextEncodingMacMongolian = 27;
alias kTextEncodingMacEthiopic = 28;
alias kTextEncodingMacCentralEurRoman = 29;
alias kTextEncodingMacVietnamese = 30;
alias kTextEncodingMacExtArabic = 31;
alias kTextEncodingMacSymbol = 33;
alias kTextEncodingMacDingbats = 34;
alias kTextEncodingMacTurkish = 35;
alias kTextEncodingMacCroatian = 36;
alias kTextEncodingMacIcelandic = 37;
alias kTextEncodingMacRomanian = 38;
alias kTextEncodingMacCeltic = 39;
alias kTextEncodingMacGaelic = 40;
alias kTextEncodingMacKeyboardGlyphs = 41;

alias kTextEncodingMacTradChinese = 2;
alias kTextEncodingMacRSymbol = 8;
alias kTextEncodingMacSimpChinese = 25;
alias kTextEncodingMacGeez = 28;
alias kTextEncodingMacEastEurRoman = 29;
alias kTextEncodingMacUninterp = 32;

alias kTextEncodingMacUnicode = 126;

alias kTextEncodingMacFarsi = 140;
alias kTextEncodingMacUkrainian = 152;
alias kTextEncodingMacInuit = 236;
alias kTextEncodingMacVT100 = 252;

alias kTextEncodingMacHFS = 255;

alias kTextEncodingUnicodeDefault = 256;
alias kTextEncodingUnicodeV1_1 = 257;
alias kTextEncodingISO10646_1993 = 257;
alias kTextEncodingUnicodeV2_0 = 259;
alias kTextEncodingUnicodeV2_1 = 259;
alias kTextEncodingUnicodeV3_0 = 260;
alias kTextEncodingUnicodeV3_1 = 261;
alias kTextEncodingUnicodeV3_2 = 262;
alias kTextEncodingUnicodeV4_0 = 264;
alias kTextEncodingUnicodeV5_0 = 266;
alias kTextEncodingUnicodeV5_1 = 267;

alias kTextEncodingISOLatin1 = 513;
alias kTextEncodingISOLatin2 = 514;
alias kTextEncodingISOLatin3 = 515;
alias kTextEncodingISOLatin4 = 516;
alias kTextEncodingISOLatinCyrillic = 517;
alias kTextEncodingISOLatinArabic = 518;
alias kTextEncodingISOLatinGreek = 519;
alias kTextEncodingISOLatinHebrew = 520;
alias kTextEncodingISOLatin5 = 521;
alias kTextEncodingISOLatin6 = 522;
alias kTextEncodingISOLatin7 = 525;
alias kTextEncodingISOLatin8 = 526;
alias kTextEncodingISOLatin9 = 527;
alias kTextEncodingISOLatin10 = 528;

alias kTextEncodingDOSLatinUS = 1024;
alias kTextEncodingDOSGreek = 1029;
alias kTextEncodingDOSBalticRim = 1030;
alias kTextEncodingDOSLatin1 = 1040;
alias kTextEncodingDOSGreek1 = 1041;
alias kTextEncodingDOSLatin2 = 1042;
alias kTextEncodingDOSCyrillic = 1043;
alias kTextEncodingDOSTurkish = 1044;
alias kTextEncodingDOSPortuguese = 1045;
alias kTextEncodingDOSIcelandic = 1046;
alias kTextEncodingDOSHebrew = 1047;
alias kTextEncodingDOSCanadianFrench = 1048;
alias kTextEncodingDOSArabic = 1049;
alias kTextEncodingDOSNordic = 1050;
alias kTextEncodingDOSRussian = 1051;
alias kTextEncodingDOSGreek2 = 1052;
alias kTextEncodingDOSThai = 1053;
alias kTextEncodingDOSJapanese = 1056;
alias kTextEncodingDOSChineseSimplif = 1057;
alias kTextEncodingDOSKorean = 1058;
alias kTextEncodingDOSChineseTrad = 1059;
alias kTextEncodingWindowsLatin1 = 1280;
alias kTextEncodingWindowsANSI = 1280;
alias kTextEncodingWindowsLatin2 = 1281;
alias kTextEncodingWindowsCyrillic = 1282;
alias kTextEncodingWindowsGreek = 1283;
alias kTextEncodingWindowsLatin5 = 1284;
alias kTextEncodingWindowsHebrew = 1285;
alias kTextEncodingWindowsArabic = 1286;
alias kTextEncodingWindowsBalticRim = 1287;
alias kTextEncodingWindowsVietnamese = 1288;
alias kTextEncodingWindowsKoreanJohab = 1296;

alias kTextEncodingUS_ASCII = 1536;
alias kTextEncodingANSEL = 1537;
alias kTextEncodingJIS_X0201_76 = 1568;
alias kTextEncodingJIS_X0208_83 = 1569;
alias kTextEncodingJIS_X0208_90 = 1570;
alias kTextEncodingJIS_X0212_90 = 1571;
alias kTextEncodingJIS_C6226_78 = 1572;
alias kTextEncodingShiftJIS_X0213 = 1576;
alias kTextEncodingJIS_X0213_MenKuTen = 1577;
alias kTextEncodingGB_2312_80 = 1584;
alias kTextEncodingGBK_95 = 1585;
alias kTextEncodingGB_18030_2000 = 1586;
alias kTextEncodingKSC_5601_87 = 1600;
alias kTextEncodingKSC_5601_92_Johab = 1601;
alias kTextEncodingCNS_11643_92_P1 = 1617;
alias kTextEncodingCNS_11643_92_P2 = 1618;
alias kTextEncodingCNS_11643_92_P3 = 1619;

alias kTextEncodingISO_2022_JP = 2080;
alias kTextEncodingISO_2022_JP_2 = 2081;
alias kTextEncodingISO_2022_JP_1 = 2082;
alias kTextEncodingISO_2022_JP_3 = 2083;
alias kTextEncodingISO_2022_CN = 2096;
alias kTextEncodingISO_2022_CN_EXT = 2097;
alias kTextEncodingISO_2022_KR = 2112;

alias kTextEncodingEUC_JP = 2336;
alias kTextEncodingEUC_CN = 2352;
alias kTextEncodingEUC_TW = 2353;
alias kTextEncodingEUC_KR = 2368;

alias kTextEncodingShiftJIS = 2561;
alias kTextEncodingKOI8_R = 2562;
alias kTextEncodingBig5 = 2563;
alias kTextEncodingMacRomanLatin1 = 2564;
alias kTextEncodingHZ_GB_2312 = 2565;
alias kTextEncodingBig5_HKSCS_1999 = 2566;
alias kTextEncodingVISCII = 2567;
alias kTextEncodingKOI8_U = 2568;
alias kTextEncodingBig5_E = 2569;

alias kTextEncodingNextStepLatin = 2817;
alias kTextEncodingNextStepJapanese = 2818;

alias kTextEncodingEBCDIC_LatinCore = 3073;
alias kTextEncodingEBCDIC_CP037 = 3074;

alias kTextEncodingMultiRun = 4095;
alias kTextEncodingUnknown = 65535;

alias kTextEncodingEBCDIC_US = 3073;

alias TextEncodingVariant = UInt;

alias kTextEncodingDefaultVariant = 0;

alias kMacRomanDefaultVariant = 0;
alias kMacRomanCurrencySignVariant = 1;
alias kMacRomanEuroSignVariant = 2;

alias kMacCyrillicDefaultVariant = 0;
alias kMacCyrillicCurrSignStdVariant = 1;
alias kMacCyrillicCurrSignUkrVariant = 2;
alias kMacCyrillicEuroSignVariant = 3;

alias kMacIcelandicStdDefaultVariant = 0;
alias kMacIcelandicTTDefaultVariant = 1;
alias kMacIcelandicStdCurrSignVariant = 2;
alias kMacIcelandicTTCurrSignVariant = 3;
alias kMacIcelandicStdEuroSignVariant = 4;
alias kMacIcelandicTTEuroSignVariant = 5;

alias kMacCroatianDefaultVariant = 0;
alias kMacCroatianCurrencySignVariant = 1;
alias kMacCroatianEuroSignVariant = 2;

alias kMacRomanianDefaultVariant = 0;
alias kMacRomanianCurrencySignVariant = 1;
alias kMacRomanianEuroSignVariant = 2;

alias kMacJapaneseStandardVariant = 0;
alias kMacJapaneseStdNoVerticalsVariant = 1;
alias kMacJapaneseBasicVariant = 2;
alias kMacJapanesePostScriptScrnVariant = 3;
alias kMacJapanesePostScriptPrintVariant = 4;
alias kMacJapaneseVertAtKuPlusTenVariant = 5;

alias kMacArabicStandardVariant = 0;
alias kMacArabicTrueTypeVariant = 1;
alias kMacArabicThuluthVariant = 2;
alias kMacArabicAlBayanVariant = 3;

alias kMacFarsiStandardVariant = 0;
alias kMacFarsiTrueTypeVariant = 1;

alias kMacHebrewStandardVariant = 0;
alias kMacHebrewFigureSpaceVariant = 1;

alias kMacGreekDefaultVariant = 0;
alias kMacGreekNoEuroSignVariant = 1;
alias kMacGreekEuroSignVariant = 2;

alias kMacVT100DefaultVariant = 0;
alias kMacVT100CurrencySignVariant = 1;
alias kMacVT100EuroSignVariant = 2;

alias kUnicodeNoSubset = 0;
alias kUnicodeNormalizationFormD = 5;
alias kUnicodeNormalizationFormC = 3;
alias kUnicodeHFSPlusDecompVariant = 8;
alias kUnicodeHFSPlusCompVariant = 9;

alias kISOLatin1StandardVariant = 0;
alias kISOLatin1MusicCDVariant = 1;

alias kISOLatinArabicImplicitOrderVariant = 0;
alias kISOLatinArabicVisualOrderVariant = 1;
alias kISOLatinArabicExplicitOrderVariant = 2;

alias kISOLatinHebrewImplicitOrderVariant = 0;
alias kISOLatinHebrewVisualOrderVariant = 1;
alias kISOLatinHebrewExplicitOrderVariant = 2;

alias kWindowsLatin1StandardVariant = 0;
alias kWindowsLatin1PalmVariant = 1;

alias kDOSJapaneseStandardVariant = 0;
alias kDOSJapanesePalmVariant = 1;

alias kEUC_CN_BasicVariant = 0;
alias kEUC_CN_DOSVariant = 1;

alias kEUC_KR_BasicVariant = 0;
alias kEUC_KR_DOSVariant = 1;

alias kShiftJIS_BasicVariant = 0;
alias kShiftJIS_DOSVariant = 1;
alias kShiftJIS_MusicCDVariant = 2;

alias kBig5_BasicVariant = 0;
alias kBig5_StandardVariant = 1;
alias kBig5_ETenVariant = 2;
alias kBig5_DOSVariant = 3;

alias kMacRomanLatin1DefaultVariant = 0;
alias kMacRomanLatin1StandardVariant = 2;
alias kMacRomanLatin1TurkishVariant = 6;
alias kMacRomanLatin1CroatianVariant = 8;
alias kMacRomanLatin1IcelandicVariant = 11;
alias kMacRomanLatin1RomanianVariant = 14;

alias kUnicodeNoCompatibilityVariant = 1;
alias kUnicodeNoCorporateVariant = 4;

alias kMacRomanStandardVariant = 0;
alias kMacIcelandicStandardVariant = 0;
alias kMacIcelandicTrueTypeVariant = 1;
alias kJapaneseStandardVariant = 0;
alias kJapaneseStdNoVerticalsVariant = 1;
alias kJapaneseBasicVariant = 2;
alias kJapanesePostScriptScrnVariant = 3;
alias kJapanesePostScriptPrintVariant = 4;
alias kJapaneseVertAtKuPlusTenVariant = 5;
alias kTextEncodingShiftJIS_X0213_00 = 1576;
alias kHebrewStandardVariant = 0;
alias kHebrewFigureSpaceVariant = 1;
alias kUnicodeCanonicalDecompVariant = 2;
alias kUnicodeMaxDecomposedVariant = 2;
alias kUnicodeCanonicalCompVariant = 3;
alias kUnicodeNoComposedVariant = 3;

alias TextEncodingFormat = UInt;

alias kTextEncodingDefaultFormat = 0;
alias kUnicodeUTF16Format = 0;
alias kUnicodeUTF7Format = 1;
alias kUnicodeUTF8Format = 2;
alias kUnicodeUTF32Format = 3;
alias kUnicodeUTF16BEFormat = 4;
alias kUnicodeUTF16LEFormat = 5;
alias kUnicodeUTF32BEFormat = 6;
alias kUnicodeUTF32LEFormat = 7;
alias kUnicodeSCSUFormat = 8;
alias kUnicode16BitFormat = 0;
alias kUnicode32BitFormat = 3;

alias TextEncoding = UInt;

alias TextEncodingNameSelector = UInt;

alias kTextEncodingFullName = 0;
alias kTextEncodingBaseName = 1;
alias kTextEncodingVariantName = 2;
alias kTextEncodingFormatName = 3;

record Struct_TextEncodingRun (
    offset : CULong,
    textEncoding : UInt,
);

alias TextEncodingRun = Struct_TextEncodingRun;

alias TextEncodingRunPtr = Pointer[TextEncodingRun];

alias ConstTextEncodingRunPtr = Pointer[TextEncodingRun];

record Struct_ScriptCodeRun (
    offset : CULong,
    script : Short,
);

alias ScriptCodeRun = Struct_ScriptCodeRun;

alias ScriptCodeRunPtr = Pointer[ScriptCodeRun];

alias ConstScriptCodeRunPtr = Pointer[ScriptCodeRun];

alias TextPtr = Pointer[CUChar];

alias ConstTextPtr = Pointer[CUChar];

alias UniCharArrayPtr = Pointer[UShort];

alias ConstUniCharArrayPtr = Pointer[UShort];

alias UniCharArrayHandle = Pointer[UniCharArrayPtr];

alias UniCharArrayOffset = CULong;

alias kTextScriptDontCare = 4294967168;
alias kTextLanguageDontCare = 4294967168;
alias kTextRegionDontCare = 4294967168;

record Struct_TECInfo (
    format : UShort,
    tecVersion : UShort,
    tecTextConverterFeatures : UInt,
    tecUnicodeConverterFeatures : UInt,
    tecTextCommonFeatures : UInt,
    tecTextEncodingsFolderName : Str31,
    tecExtensionFileName : Str31,
    tecLowestTEFileVersion : UShort,
    tecHighestTEFileVersion : UShort,
);

alias TECInfo = Struct_TECInfo;

alias TECInfoPtr = Pointer[TECInfo];

alias TECInfoHandle = Pointer[TECInfoPtr];

alias kTECInfoCurrentFormat = 2;

alias kTECKeepInfoFixBit = 0;
alias kTECFallbackTextLengthFixBit = 1;
alias kTECTextRunBitClearFixBit = 2;
alias kTECTextToUnicodeScanFixBit = 3;
alias kTECAddForceASCIIChangesBit = 4;
alias kTECPreferredEncodingFixBit = 5;
alias kTECAddTextRunHeuristicsBit = 6;
alias kTECAddFallbackInterruptBit = 7;

alias kTECKeepInfoFixMask = 1;
alias kTECFallbackTextLengthFixMask = 2;
alias kTECTextRunBitClearFixMask = 4;
alias kTECTextToUnicodeScanFixMask = 8;
alias kTECAddForceASCIIChangesMask = 16;
alias kTECPreferredEncodingFixMask = 32;
alias kTECAddTextRunHeuristicsMask = 64;
alias kTECAddFallbackInterruptMask = 128;

alias kUnicodeByteOrderMark = 65279;
alias kUnicodeObjectReplacement = 65532;
alias kUnicodeReplacementChar = 65533;
alias kUnicodeSwappedByteOrderMark = 65534;
alias kUnicodeNotAChar = 65535;

alias UCCharPropertyType = Int;

alias kUCCharPropTypeGenlCategory = 1;
alias kUCCharPropTypeCombiningClass = 2;
alias kUCCharPropTypeBidiCategory = 3;
alias kUCCharPropTypeDecimalDigitValue = 4;

alias UCCharPropertyValue = UInt;

alias kUCGenlCatOtherNotAssigned = 0;
alias kUCGenlCatOtherControl = 1;
alias kUCGenlCatOtherFormat = 2;
alias kUCGenlCatOtherSurrogate = 3;
alias kUCGenlCatOtherPrivateUse = 4;
alias kUCGenlCatMarkNonSpacing = 5;
alias kUCGenlCatMarkSpacingCombining = 6;
alias kUCGenlCatMarkEnclosing = 7;
alias kUCGenlCatNumberDecimalDigit = 8;
alias kUCGenlCatNumberLetter = 9;
alias kUCGenlCatNumberOther = 10;
alias kUCGenlCatSeparatorSpace = 11;
alias kUCGenlCatSeparatorLine = 12;
alias kUCGenlCatSeparatorParagraph = 13;
alias kUCGenlCatLetterUppercase = 14;
alias kUCGenlCatLetterLowercase = 15;
alias kUCGenlCatLetterTitlecase = 16;
alias kUCGenlCatLetterModifier = 17;
alias kUCGenlCatLetterOther = 18;
alias kUCGenlCatPunctConnector = 20;
alias kUCGenlCatPunctDash = 21;
alias kUCGenlCatPunctOpen = 22;
alias kUCGenlCatPunctClose = 23;
alias kUCGenlCatPunctInitialQuote = 24;
alias kUCGenlCatPunctFinalQuote = 25;
alias kUCGenlCatPunctOther = 26;
alias kUCGenlCatSymbolMath = 28;
alias kUCGenlCatSymbolCurrency = 29;
alias kUCGenlCatSymbolModifier = 30;
alias kUCGenlCatSymbolOther = 31;

alias kUCBidiCatNotApplicable = 0;
alias kUCBidiCatLeftRight = 1;
alias kUCBidiCatRightLeft = 2;
alias kUCBidiCatEuroNumber = 3;
alias kUCBidiCatEuroNumberSeparator = 4;
alias kUCBidiCatEuroNumberTerminator = 5;
alias kUCBidiCatArabicNumber = 6;
alias kUCBidiCatCommonNumberSeparator = 7;
alias kUCBidiCatBlockSeparator = 8;
alias kUCBidiCatSegmentSeparator = 9;
alias kUCBidiCatWhitespace = 10;
alias kUCBidiCatOtherNeutral = 11;
alias kUCBidiCatRightLeftArabic = 12;
alias kUCBidiCatLeftRightEmbedding = 13;
alias kUCBidiCatRightLeftEmbedding = 14;
alias kUCBidiCatLeftRightOverride = 15;
alias kUCBidiCatRightLeftOverride = 16;
alias kUCBidiCatPopDirectionalFormat = 17;
alias kUCBidiCatNonSpacingMark = 18;
alias kUCBidiCatBoundaryNeutral = 19;

external CreateTextEncoding(
    encodingBase : UInt,
    encodingVariant : UInt,
    encodingFormat : UInt) : UInt;

external GetTextEncodingBase(
    encoding : UInt) : UInt;

external GetTextEncodingVariant(
    encoding : UInt) : UInt;

external GetTextEncodingFormat(
    encoding : UInt) : UInt;

external ResolveDefaultTextEncoding(
    encoding : UInt) : UInt;

external GetTextEncodingName(
    iEncoding : UInt,
    iNamePartSelector : UInt,
    iPreferredRegion : Short,
    iPreferredEncoding : UInt,
    iOutputBufLen : CULong,
    oNameLength : Pointer[CULong],
    oActualRegion : Pointer[Short],
    oActualEncoding : Pointer[UInt],
    oEncodingName : TextPtr) : Int;

external TECGetInfo(
    tecInfo : Pointer[TECInfoHandle]) : Int;

external UpgradeScriptInfoToTextEncoding(
    iTextScriptID : Short,
    iTextLanguageID : Short,
    iRegionID : Short,
    iTextFontname : ConstStr255Param,
    oEncoding : Pointer[UInt]) : Int;

external RevertTextEncodingToScriptInfo(
    iEncoding : UInt,
    oTextScriptID : Pointer[Short],
    oTextLanguageID : Pointer[Short],
    oTextFontname : Pointer[CUChar]) : Int;

external GetTextEncodingFromScriptInfo(
    iTextScriptID : Short,
    iTextLanguageID : Short,
    iTextRegionID : Short,
    oEncoding : Pointer[UInt]) : Int;

external GetScriptInfoFromTextEncoding(
    iEncoding : UInt,
    oTextScriptID : Pointer[Short],
    oTextLanguageID : Pointer[Short]) : Int;

external NearestMacTextEncodings(
    generalEncoding : UInt,
    bestMacEncoding : Pointer[UInt],
    alternateMacEncoding : Pointer[UInt]) : Int;

external UCGetCharProperty(
    charPtr : Pointer[UShort],
    textLength : CULong,
    propType : Int,
    propValue : Pointer[UInt]) : Int;

alias kUCHighSurrogateRangeStart = 55296;
alias kUCHighSurrogateRangeEnd = 56319;
alias kUCLowSurrogateRangeStart = 56320;
alias kUCLowSurrogateRangeEnd = 57343;

alias kRoutineDescriptorVersion = 7;

alias _MixedModeMagic = 43774;

alias kCurrentMixedModeStateRecord = 1;

alias CallingConventionType = UShort;

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

alias ISAType = CChar;

alias kM68kISA = 0;
alias kPowerPCISA = 1;

alias kX86ISA = 2;

alias RTAType = CChar;

alias kOld68kRTA = 0;
alias kPowerPCRTA = 0;
alias kCFM68kRTA = 16;

alias kX86RTA = 32;

alias kRegisterD0 = 0;
alias kRegisterD1 = 1;
alias kRegisterD2 = 2;
alias kRegisterD3 = 3;
alias kRegisterD4 = 8;
alias kRegisterD5 = 9;
alias kRegisterD6 = 10;
alias kRegisterD7 = 11;
alias kRegisterA0 = 4;
alias kRegisterA1 = 5;
alias kRegisterA2 = 6;
alias kRegisterA3 = 7;
alias kRegisterA4 = 12;
alias kRegisterA5 = 13;
alias kRegisterA6 = 14;
alias kCCRegisterCBit = 16;
alias kCCRegisterVBit = 17;
alias kCCRegisterZBit = 18;
alias kCCRegisterNBit = 19;
alias kCCRegisterXBit = 20;

alias registerSelectorType = UShort;

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

alias ProcInfoType = CULong;

alias RoutineFlagsType = UShort;

alias kProcDescriptorIsAbsolute = 0;
alias kProcDescriptorIsRelative = 1;

alias kFragmentIsPrepared = 0;
alias kFragmentNeedsPreparing = 2;

alias kUseCurrentISA = 0;
alias kUseNativeISA = 4;

alias kPassSelector = 0;
alias kDontPassSelector = 8;

alias kRoutineIsNotDispatchedDefaultRoutine = 0;
alias kRoutineIsDispatchedDefaultRoutine = 16;

alias kProcDescriptorIsProcPtr = 0;
alias kProcDescriptorIsIndex = 32;

record Struct_RoutineRecord (
    procInfo : CULong,
    reserved1 : CChar,
    ISA : CChar,
    routineFlags : UShort,
    procDescriptor : ProcPtr,
    reserved2 : UInt,
    selector : UInt,
);

alias RoutineRecord = Struct_RoutineRecord;

alias RoutineRecordPtr = Pointer[RoutineRecord];

alias RoutineRecordHandle = Pointer[RoutineRecordPtr];

alias RDFlagsType = CUChar;

alias kSelectorsAreNotIndexable = 0;
alias kSelectorsAreIndexable = 1;

record Struct_RoutineDescriptor (
    goMixedModeTrap : UShort,
    version : CChar,
    routineDescriptorFlags : CUChar,
    reserved1 : UInt,
    reserved2 : CUChar,
    selectorInfo : CUChar,
    routineCount : UShort,
    routineRecords : Array[RoutineRecord,1],
);

alias RoutineDescriptor = Struct_RoutineDescriptor;

alias RoutineDescriptorPtr = Pointer[RoutineDescriptor];

alias RoutineDescriptorHandle = Pointer[RoutineDescriptorPtr];

record Struct_MixedModeStateRecord (
    state1 : UInt,
    state2 : UInt,
    state3 : UInt,
    state4 : UInt,
);

alias MixedModeStateRecord = Struct_MixedModeStateRecord;

alias kCallingConventionWidth = 4;
alias kCallingConventionPhase = 0;
alias kCallingConventionMask = 15;
alias kResultSizeWidth = 2;
alias kResultSizePhase = 4;
alias kResultSizeMask = 48;
alias kStackParameterWidth = 2;
alias kStackParameterPhase = 6;
alias kStackParameterMask = 4294967232;
alias kRegisterResultLocationWidth = 5;
alias kRegisterResultLocationPhase = 6;
alias kRegisterParameterWidth = 5;
alias kRegisterParameterPhase = 11;
alias kRegisterParameterMask = 2147481600;
alias kRegisterParameterSizePhase = 0;
alias kRegisterParameterSizeWidth = 2;
alias kRegisterParameterWhichPhase = 2;
alias kRegisterParameterWhichWidth = 3;
alias kDispatchedSelectorSizeWidth = 2;
alias kDispatchedSelectorSizePhase = 6;
alias kDispatchedParameterPhase = 8;
alias kSpecialCaseSelectorWidth = 6;
alias kSpecialCaseSelectorPhase = 4;
alias kSpecialCaseSelectorMask = 1008;

alias kSpecialCase = 15;

alias kSpecialCaseHighHook = 0;
alias kSpecialCaseCaretHook = 0;
alias kSpecialCaseEOLHook = 1;
alias kSpecialCaseWidthHook = 2;
alias kSpecialCaseTextWidthHook = 2;
alias kSpecialCaseNWidthHook = 3;
alias kSpecialCaseDrawHook = 4;
alias kSpecialCaseHitTestHook = 5;
alias kSpecialCaseTEFindWord = 6;
alias kSpecialCaseProtocolHandler = 7;
alias kSpecialCaseSocketListener = 8;
alias kSpecialCaseTERecalc = 9;
alias kSpecialCaseTEDoText = 10;
alias kSpecialCaseGNEFilterProc = 11;
alias kSpecialCaseMBarHook = 12;

alias kCollectionDontWantTag = 0;
alias kCollectionDontWantId = 0;
alias kCollectionDontWantSize = 0;
alias kCollectionDontWantAttributes = 0;
alias kCollectionDontWantIndex = 0;
alias kCollectionDontWantData = 0;

alias kCollectionNoAttributes = 0;
alias kCollectionAllAttributes = 4294967295;
alias kCollectionUserAttributes = 65535;
alias kCollectionDefaultAttributes = 1073741824;

alias kCollectionUser0Bit = 0;
alias kCollectionUser1Bit = 1;
alias kCollectionUser2Bit = 2;
alias kCollectionUser3Bit = 3;
alias kCollectionUser4Bit = 4;
alias kCollectionUser5Bit = 5;
alias kCollectionUser6Bit = 6;
alias kCollectionUser7Bit = 7;
alias kCollectionUser8Bit = 8;
alias kCollectionUser9Bit = 9;
alias kCollectionUser10Bit = 10;
alias kCollectionUser11Bit = 11;
alias kCollectionUser12Bit = 12;
alias kCollectionUser13Bit = 13;
alias kCollectionUser14Bit = 14;
alias kCollectionUser15Bit = 15;
alias kCollectionReserved0Bit = 16;
alias kCollectionReserved1Bit = 17;
alias kCollectionReserved2Bit = 18;
alias kCollectionReserved3Bit = 19;
alias kCollectionReserved4Bit = 20;
alias kCollectionReserved5Bit = 21;
alias kCollectionReserved6Bit = 22;
alias kCollectionReserved7Bit = 23;
alias kCollectionReserved8Bit = 24;
alias kCollectionReserved9Bit = 25;
alias kCollectionReserved10Bit = 26;
alias kCollectionReserved11Bit = 27;
alias kCollectionReserved12Bit = 28;
alias kCollectionReserved13Bit = 29;
alias kCollectionPersistenceBit = 30;
alias kCollectionLockBit = 31;

alias kCollectionUser0Mask = 1;
alias kCollectionUser1Mask = 2;
alias kCollectionUser2Mask = 4;
alias kCollectionUser3Mask = 8;
alias kCollectionUser4Mask = 16;
alias kCollectionUser5Mask = 32;
alias kCollectionUser6Mask = 64;
alias kCollectionUser7Mask = 128;
alias kCollectionUser8Mask = 256;
alias kCollectionUser9Mask = 512;
alias kCollectionUser10Mask = 1024;
alias kCollectionUser11Mask = 2048;
alias kCollectionUser12Mask = 4096;
alias kCollectionUser13Mask = 8192;
alias kCollectionUser14Mask = 16384;
alias kCollectionUser15Mask = 32768;
alias kCollectionReserved0Mask = 65536;
alias kCollectionReserved1Mask = 131072;
alias kCollectionReserved2Mask = 262144;
alias kCollectionReserved3Mask = 524288;
alias kCollectionReserved4Mask = 1048576;
alias kCollectionReserved5Mask = 2097152;
alias kCollectionReserved6Mask = 4194304;
alias kCollectionReserved7Mask = 8388608;
alias kCollectionReserved8Mask = 16777216;
alias kCollectionReserved9Mask = 33554432;
alias kCollectionReserved10Mask = 67108864;
alias kCollectionReserved11Mask = 134217728;
alias kCollectionReserved12Mask = 268435456;
alias kCollectionReserved13Mask = 536870912;
alias kCollectionPersistenceMask = 1073741824;
alias kCollectionLockMask = 2147483648;

alias Collection = OpaquePointer;

alias CollectionTag = UInt;

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

alias CollectionExceptionProcPtr = CCodePointer[[OpaquePointer,Short],[Short]];

alias CollectionFlattenUPP = CollectionFlattenProcPtr;

alias CollectionExceptionUPP = CollectionExceptionProcPtr;

external NewCollectionFlattenUPP(
    userRoutine : CollectionFlattenProcPtr) : CollectionFlattenUPP;

external NewCollectionExceptionUPP(
    userRoutine : CollectionExceptionProcPtr) : CollectionExceptionUPP;

external DisposeCollectionFlattenUPP(
    userUPP : CollectionFlattenUPP);

external DisposeCollectionExceptionUPP(
    userUPP : CollectionExceptionUPP);

external InvokeCollectionFlattenUPP(
    size : Int,
    data : RawPointer,
    refCon : RawPointer,
    userUPP : CollectionFlattenUPP) : Short;

external InvokeCollectionExceptionUPP(
    c : Collection,
    status : Short,
    userUPP : CollectionExceptionUPP) : Short;

external NewCollection() : Collection;

external DisposeCollection(
    c : Collection);

external CloneCollection(
    c : Collection) : Collection;

external CountCollectionOwners(
    c : Collection) : Int;

external RetainCollection(
    c : Collection) : Int;

external ReleaseCollection(
    c : Collection) : Int;

external GetCollectionRetainCount(
    c : Collection) : CULong;

external CopyCollection(
    srcCollection : Collection,
    dstCollection : Collection) : Collection;

external GetCollectionDefaultAttributes(
    c : Collection) : Int;

external SetCollectionDefaultAttributes(
    c : Collection,
    whichAttributes : Int,
    newAttributes : Int);

external CountCollectionItems(
    c : Collection) : Int;

external AddCollectionItem(
    c : Collection,
    tag : UInt,
    id : Int,
    itemSize : Int,
    itemData : RawPointer) : Short;

external GetCollectionItem(
    c : Collection,
    tag : UInt,
    id : Int,
    itemSize : Pointer[Int],
    itemData : RawPointer) : Short;

external RemoveCollectionItem(
    c : Collection,
    tag : UInt,
    id : Int) : Short;

external SetCollectionItemInfo(
    c : Collection,
    tag : UInt,
    id : Int,
    whichAttributes : Int,
    newAttributes : Int) : Short;

external GetCollectionItemInfo(
    c : Collection,
    tag : UInt,
    id : Int,
    itemIndex : Pointer[Int],
    itemSize : Pointer[Int],
    attributes : Pointer[Int]) : Short;

external ReplaceIndexedCollectionItem(
    c : Collection,
    itemIndex : Int,
    itemSize : Int,
    itemData : RawPointer) : Short;

external GetIndexedCollectionItem(
    c : Collection,
    itemIndex : Int,
    itemSize : Pointer[Int],
    itemData : RawPointer) : Short;

external RemoveIndexedCollectionItem(
    c : Collection,
    itemIndex : Int) : Short;

external SetIndexedCollectionItemInfo(
    c : Collection,
    itemIndex : Int,
    whichAttributes : Int,
    newAttributes : Int) : Short;

external GetIndexedCollectionItemInfo(
    c : Collection,
    itemIndex : Int,
    tag : Pointer[UInt],
    id : Pointer[Int],
    itemSize : Pointer[Int],
    attributes : Pointer[Int]) : Short;

external CollectionTagExists(
    c : Collection,
    tag : UInt) : CUChar;

external CountCollectionTags(
    c : Collection) : Int;

external GetIndexedCollectionTag(
    c : Collection,
    tagIndex : Int,
    tag : Pointer[UInt]) : Short;

external CountTaggedCollectionItems(
    c : Collection,
    tag : UInt) : Int;

external GetTaggedCollectionItem(
    c : Collection,
    tag : UInt,
    whichItem : Int,
    itemSize : Pointer[Int],
    itemData : RawPointer) : Short;

external GetTaggedCollectionItemInfo(
    c : Collection,
    tag : UInt,
    whichItem : Int,
    id : Pointer[Int],
    itemIndex : Pointer[Int],
    itemSize : Pointer[Int],
    attributes : Pointer[Int]) : Short;

external PurgeCollection(
    c : Collection,
    whichAttributes : Int,
    matchingAttributes : Int);

external PurgeCollectionTag(
    c : Collection,
    tag : UInt);

external EmptyCollection(
    c : Collection);

external FlattenCollection(
    c : Collection,
    flattenProc : CollectionFlattenUPP,
    refCon : RawPointer) : Short;

external FlattenPartialCollection(
    c : Collection,
    flattenProc : CollectionFlattenUPP,
    refCon : RawPointer,
    whichAttributes : Int,
    matchingAttributes : Int) : Short;

external UnflattenCollection(
    c : Collection,
    flattenProc : CollectionFlattenUPP,
    refCon : RawPointer) : Short;

external GetCollectionExceptionProc(
    c : Collection) : CollectionExceptionUPP;

external SetCollectionExceptionProc(
    c : Collection,
    exceptionProc : CollectionExceptionUPP);

external GetNewCollection(
    collectionID : Short) : Collection;

external AddCollectionItemHdl(
    aCollection : Collection,
    tag : UInt,
    id : Int,
    itemData : Handle) : Short;

external GetCollectionItemHdl(
    aCollection : Collection,
    tag : UInt,
    id : Int,
    itemData : Handle) : Short;

external ReplaceIndexedCollectionItemHdl(
    aCollection : Collection,
    itemIndex : Int,
    itemData : Handle) : Short;

external GetIndexedCollectionItemHdl(
    aCollection : Collection,
    itemIndex : Int,
    itemData : Handle) : Short;

external FlattenCollectionToHdl(
    aCollection : Collection,
    flattened : Handle) : Short;

external UnflattenCollectionFromHdl(
    aCollection : Collection,
    flattened : Handle) : Short;

record Struct_BigEndianUInt32 (
    bigEndianValue : UInt,
);

alias BigEndianUInt32 = Struct_BigEndianUInt32;

record Struct_BigEndianLong (
    bigEndianValue : CLong,
);

alias BigEndianLong = Struct_BigEndianLong;

record Struct_BigEndianUnsignedLong (
    bigEndianValue : CULong,
);

alias BigEndianUnsignedLong = Struct_BigEndianUnsignedLong;

record Struct_BigEndianShort (
    bigEndianValue : Short,
);

alias BigEndianShort = Struct_BigEndianShort;

record Struct_BigEndianUnsignedShort (
    bigEndianValue : UShort,
);

alias BigEndianUnsignedShort = Struct_BigEndianUnsignedShort;

record Struct_BigEndianFixed (
    bigEndianValue : Int,
);

alias BigEndianFixed = Struct_BigEndianFixed;

record Struct_BigEndianUnsignedFixed (
    bigEndianValue : UInt,
);

alias BigEndianUnsignedFixed = Struct_BigEndianUnsignedFixed;

record Struct_BigEndianOSType (
    bigEndianValue : UInt,
);

alias BigEndianOSType = Struct_BigEndianOSType;

alias kCoreEndianResourceManagerDomain = 1920168547;
alias kCoreEndianAppleEventManagerDomain = 1634039412;

alias CoreEndianFlipProc = CCodePointer[[UInt,UInt,Short,RawPointer,CULong,CUChar,RawPointer],[Int]];

external CoreEndianInstallFlipper(
    dataDomain : UInt,
    dataType : UInt,
    proc : CoreEndianFlipProc,
    refcon : RawPointer) : Int;

external CoreEndianGetFlipper(
    dataDomain : UInt,
    dataType : UInt,
    proc : Pointer[CoreEndianFlipProc],
    refcon : Pointer[RawPointer]) : Int;

external CoreEndianFlipData(
    dataDomain : UInt,
    dataType : UInt,
    id : Short,
    data : RawPointer,
    dataLen : CULong,
    currentlyNative : CUChar) : Int;

alias SelectorFunctionProcPtr = CCodePointer[[UInt,Pointer[Int]],[Short]];

alias SelectorFunctionUPP = SelectorFunctionProcPtr;

external Gestalt(
    selector : UInt,
    response : Pointer[Int]) : Short;

external NewGestaltValue(
    selector : UInt,
    newValue : Int) : Short;

external ReplaceGestaltValue(
    selector : UInt,
    replacementValue : Int) : Short;

external SetGestaltValue(
    selector : UInt,
    newValue : Int) : Short;

external DeleteGestaltValue(
    selector : UInt) : Short;

external NewSelectorFunctionUPP(
    userRoutine : SelectorFunctionProcPtr) : SelectorFunctionUPP;

external DisposeSelectorFunctionUPP(
    userUPP : SelectorFunctionUPP);

external InvokeSelectorFunctionUPP(
    selector : UInt,
    response : Pointer[Int],
    userUPP : SelectorFunctionUPP) : Short;

alias gestaltAddressingModeAttr = 1633969266;
alias gestalt32BitAddressing = 0;
alias gestalt32BitSysZone = 1;
alias gestalt32BitCapable = 2;

alias gestaltAFPClient = 1634103411;
alias gestaltAFPClientVersionMask = 65535;
alias gestaltAFPClient3_5 = 1;
alias gestaltAFPClient3_6 = 2;
alias gestaltAFPClient3_6_1 = 3;
alias gestaltAFPClient3_6_2 = 4;
alias gestaltAFPClient3_6_3 = 5;
alias gestaltAFPClient3_7 = 6;
alias gestaltAFPClient3_7_2 = 7;
alias gestaltAFPClient3_8 = 8;
alias gestaltAFPClient3_8_1 = 9;
alias gestaltAFPClient3_8_3 = 10;
alias gestaltAFPClient3_8_4 = 11;
alias gestaltAFPClientAttributeMask = 4294901760;
alias gestaltAFPClientCfgRsrc = 16;
alias gestaltAFPClientSupportsIP = 29;
alias gestaltAFPClientVMUI = 30;
alias gestaltAFPClientMultiReq = 31;

alias gestaltAliasMgrAttr = 1634494835;
alias gestaltAliasMgrPresent = 0;
alias gestaltAliasMgrSupportsRemoteAppletalk = 1;
alias gestaltAliasMgrSupportsAOCEKeychain = 2;
alias gestaltAliasMgrResolveAliasFileWithMountOptions = 3;
alias gestaltAliasMgrFollowsAliasesWhenResolving = 4;
alias gestaltAliasMgrSupportsExtendedCalls = 5;
alias gestaltAliasMgrSupportsFSCalls = 6;
alias gestaltAliasMgrPrefersPath = 7;
alias gestaltAliasMgrRequiresAccessors = 8;

alias gestaltAppearanceAttr = 1634758770;
alias gestaltAppearanceExists = 0;
alias gestaltAppearanceCompatMode = 1;

alias gestaltAppearanceVersion = 1634760306;

alias gestaltArbitorAttr = 1634886176;
alias gestaltSerialArbitrationExists = 0;

alias gestaltAppleScriptVersion = 1634952054;

alias gestaltAppleScriptAttr = 1634952050;
alias gestaltAppleScriptPresent = 0;
alias gestaltAppleScriptPowerPCSupport = 1;

alias gestaltATAAttr = 1635016992;
alias gestaltATAPresent = 0;

alias gestaltATalkVersion = 1635019638;

alias gestaltAppleTalkVersion = 1635019883;

alias gestaltAUXVersion = 1630500216;

alias gestaltMacOSCompatibilityBoxAttr = 1650618232;
alias gestaltMacOSCompatibilityBoxPresent = 0;
alias gestaltMacOSCompatibilityBoxHasSerial = 1;
alias gestaltMacOSCompatibilityBoxless = 2;

alias gestaltBusClkSpeed = 1650682987;

alias gestaltBusClkSpeedMHz = 1650682989;

alias gestaltCloseViewAttr = 1112753249;
alias gestaltCloseViewEnabled = 0;
alias gestaltCloseViewDisplayMgrFriendly = 1;

alias gestaltCarbonVersion = 1667395438;

alias gestaltCFMAttr = 1667658343;
alias gestaltCFMPresent = 0;
alias gestaltCFMPresentMask = 1;
alias gestaltCFM99Present = 2;
alias gestaltCFM99PresentMask = 4;

alias gestaltProcessorCacheLineSize = 1668508026;

alias gestaltCollectionMgrVersion = 1668052078;

alias gestaltColorMatchingAttr = 1668117601;
alias gestaltHighLevelMatching = 0;
alias gestaltColorMatchingLibLoaded = 1;

alias gestaltColorMatchingVersion = 1668117603;
alias gestaltColorSync10 = 256;
alias gestaltColorSync11 = 272;
alias gestaltColorSync104 = 260;
alias gestaltColorSync105 = 261;
alias gestaltColorSync20 = 512;
alias gestaltColorSync21 = 528;
alias gestaltColorSync211 = 529;
alias gestaltColorSync212 = 530;
alias gestaltColorSync213 = 531;
alias gestaltColorSync25 = 592;
alias gestaltColorSync26 = 608;
alias gestaltColorSync261 = 609;
alias gestaltColorSync30 = 768;

alias gestaltControlMgrVersion = 1668118130;

alias gestaltControlMgrAttr = 1668183148;
alias gestaltControlMgrPresent = 1;
alias gestaltControlMgrPresentBit = 0;
alias gestaltControlMsgPresentMask = 1;

alias gestaltConnMgrAttr = 1668247150;
alias gestaltConnMgrPresent = 0;
alias gestaltConnMgrCMSearchFix = 1;
alias gestaltConnMgrErrorString = 2;
alias gestaltConnMgrMultiAsyncIO = 3;

alias gestaltColorPickerVersion = 1668311922;
alias gestaltColorPicker = 1668311922;

alias gestaltComponentMgr = 1668312692;
alias gestaltComponentPlatform = 1668247660;

alias gestaltNativeCPUtype = 1668314484;
alias gestaltNativeCPUfamily = 1668314470;
alias gestaltCPU68000 = 0;
alias gestaltCPU68010 = 1;
alias gestaltCPU68020 = 2;
alias gestaltCPU68030 = 3;
alias gestaltCPU68040 = 4;
alias gestaltCPU601 = 257;
alias gestaltCPU603 = 259;
alias gestaltCPU604 = 260;
alias gestaltCPU603e = 262;
alias gestaltCPU603ev = 263;
alias gestaltCPU750 = 264;
alias gestaltCPU604e = 265;
alias gestaltCPU604ev = 266;
alias gestaltCPUG4 = 268;
alias gestaltCPUG47450 = 272;

alias gestaltCPUApollo = 273;
alias gestaltCPUG47447 = 274;
alias gestaltCPU750FX = 288;
alias gestaltCPU970 = 313;
alias gestaltCPU970FX = 316;
alias gestaltCPU970MP = 324;

alias gestaltCPU486 = 1765029942;
alias gestaltCPUPentium = 1765095478;
alias gestaltCPUPentiumPro = 1765109874;
alias gestaltCPUPentiumII = 1765108073;
alias gestaltCPUX86 = 1769502840;
alias gestaltCPUPentium4 = 1765108086;

alias gestaltCRMAttr = 1668443424;
alias gestaltCRMPresent = 0;
alias gestaltCRMPersistentFix = 1;
alias gestaltCRMToolRsrcCalls = 2;

alias gestaltControlStripVersion = 1668511346;

alias gestaltCountOfCPUs = 1668314483;

alias gestaltCTBVersion = 1668571766;

alias gestaltDBAccessMgrAttr = 1684169059;
alias gestaltDBAccessMgrPresent = 0;

alias gestaltDiskCacheSize = 1684239226;

alias gestaltSDPFindVersion = 1684434532;

alias gestaltDictionaryMgrAttr = 1684628340;
alias gestaltDictionaryMgrPresent = 0;

alias gestaltDITLExtAttr = 1684632684;
alias gestaltDITLExtPresent = 0;
alias gestaltDITLExtSupportsIctb = 1;

alias gestaltDialogMgrAttr = 1684828007;
alias gestaltDialogMgrPresent = 1;
alias gestaltDialogMgrPresentBit = 0;
alias gestaltDialogMgrHasAquaAlertBit = 2;
alias gestaltDialogMgrPresentMask = 1;
alias gestaltDialogMgrHasAquaAlertMask = 4;
alias gestaltDialogMsgPresentMask = 1;

alias gestaltDesktopPicturesAttr = 1684762744;
alias gestaltDesktopPicturesInstalled = 0;
alias gestaltDesktopPicturesDisplayed = 1;

alias gestaltDisplayMgrVers = 1685089398;

alias gestaltDisplayMgrAttr = 1685089401;
alias gestaltDisplayMgrPresent = 0;
alias gestaltDisplayMgrCanSwitchMirrored = 2;
alias gestaltDisplayMgrSetDepthNotifies = 3;
alias gestaltDisplayMgrCanConfirm = 4;
alias gestaltDisplayMgrColorSyncAware = 5;
alias gestaltDisplayMgrGeneratesProfiles = 6;
alias gestaltDisplayMgrSleepNotifies = 7;

alias gestaltDragMgrAttr = 1685217639;
alias gestaltDragMgrPresent = 0;
alias gestaltDragMgrFloatingWind = 1;
alias gestaltPPCDragLibPresent = 2;
alias gestaltDragMgrHasImageSupport = 3;
alias gestaltCanStartDragInFloatWindow = 4;
alias gestaltSetDragImageUpdates = 5;

alias gestaltDrawSprocketVersion = 1685287030;

alias gestaltDigitalSignatureVersion = 1685285223;

alias gestaltDTPFeatures = 1685352550;
alias kDTPThirdPartySupported = 4;

alias gestaltDTPInfo = 1685352568;

alias gestaltEasyAccessAttr = 1700885369;
alias gestaltEasyAccessOff = 0;
alias gestaltEasyAccessOn = 1;
alias gestaltEasyAccessSticky = 2;
alias gestaltEasyAccessLocked = 3;

alias gestaltEditionMgrAttr = 1701082222;
alias gestaltEditionMgrPresent = 0;
alias gestaltEditionMgrTranslationAware = 1;

alias gestaltAppleEventsAttr = 1702260340;
alias gestaltAppleEventsPresent = 0;
alias gestaltScriptingSupport = 1;
alias gestaltOSLInSystem = 2;
alias gestaltSupportsApplicationURL = 4;

alias gestaltExtensionTableVersion = 1702126188;

alias gestaltFBCIndexingState = 1717724009;
alias gestaltFBCindexingSafe = 0;
alias gestaltFBCindexingCritical = 1;

alias gestaltFBCVersion = 1717724022;
alias gestaltFBCCurrentVersion = 17;
alias gestaltOSXFBCCurrentVersion = 256;

alias gestaltFileMappingAttr = 1718381936;
alias gestaltFileMappingPresent = 0;
alias gestaltFileMappingMultipleFilesFix = 1;

alias gestaltFloppyAttr = 1718382713;
alias gestaltFloppyIsMFMOnly = 0;
alias gestaltFloppyIsManualEject = 1;
alias gestaltFloppyUsesDiskInPlace = 2;

alias gestaltFinderAttr = 1718510706;
alias gestaltFinderDropEvent = 0;
alias gestaltFinderMagicPlacement = 1;
alias gestaltFinderCallsAEProcess = 2;
alias gestaltOSLCompliantFinder = 3;
alias gestaltFinderSupports4GBVolumes = 4;
alias gestaltFinderHasClippings = 6;
alias gestaltFinderFullDragManagerSupport = 7;
alias gestaltFinderFloppyRootComments = 8;
alias gestaltFinderLargeAndNotSavedFlavorsOK = 9;
alias gestaltFinderUsesExtensibleFolderManager = 10;
alias gestaltFinderUnderstandsRedirectedDesktopFolder = 11;

alias gestaltFindFolderAttr = 1718578276;
alias gestaltFindFolderPresent = 0;
alias gestaltFolderDescSupport = 1;
alias gestaltFolderMgrFollowsAliasesWhenResolving = 2;
alias gestaltFolderMgrSupportsExtendedCalls = 3;
alias gestaltFolderMgrSupportsDomains = 4;
alias gestaltFolderMgrSupportsFSCalls = 5;

alias gestaltFindFolderRedirectionAttr = 1718578277;

alias gestaltFontMgrAttr = 1718578804;
alias gestaltOutlineFonts = 0;

alias gestaltFPUType = 1718646048;
alias gestaltNoFPU = 0;
alias gestalt68881 = 1;
alias gestalt68882 = 2;
alias gestalt68040FPU = 3;

alias gestaltFSAttr = 1718820896;
alias gestaltFullExtFSDispatching = 0;
alias gestaltHasFSSpecCalls = 1;
alias gestaltHasFileSystemManager = 2;
alias gestaltFSMDoesDynamicLoad = 3;
alias gestaltFSSupports4GBVols = 4;
alias gestaltFSSupports2TBVols = 5;
alias gestaltHasExtendedDiskInit = 6;
alias gestaltDTMgrSupportsFSM = 7;
alias gestaltFSNoMFSVols = 8;
alias gestaltFSSupportsHFSPlusVols = 9;
alias gestaltFSIncompatibleDFA82 = 10;

alias gestaltFSSupportsDirectIO = 11;

alias gestaltHasHFSPlusAPIs = 12;
alias gestaltMustUseFCBAccessors = 13;
alias gestaltFSUsesPOSIXPathsForConversion = 14;
alias gestaltFSSupportsExclusiveLocks = 15;
alias gestaltFSSupportsHardLinkDetection = 16;
alias gestaltFSAllowsConcurrentAsyncIO = 17;

alias gestaltAdminFeaturesFlagsAttr = 1718773092;
alias gestaltFinderUsesSpecialOpenFoldersFile = 0;

alias gestaltFSMVersion = 1718840608;

alias gestaltFXfrMgrAttr = 1719166578;
alias gestaltFXfrMgrPresent = 0;
alias gestaltFXfrMgrMultiFile = 1;
alias gestaltFXfrMgrErrorString = 2;
alias gestaltFXfrMgrAsync = 3;

alias gestaltGraphicsAttr = 1734768737;
alias gestaltGraphicsIsDebugging = 1;
alias gestaltGraphicsIsLoaded = 2;
alias gestaltGraphicsIsPowerPC = 4;

alias gestaltGraphicsVersion = 1735550584;
alias gestaltCurrentGraphicsVersion = 66048;

alias gestaltHardwareAttr = 1751414642;
alias gestaltHasVIA1 = 0;
alias gestaltHasVIA2 = 1;
alias gestaltHasASC = 3;
alias gestaltHasSCC = 4;
alias gestaltHasSCSI = 7;
alias gestaltHasSoftPowerOff = 19;
alias gestaltHasSCSI961 = 21;
alias gestaltHasSCSI962 = 22;
alias gestaltHasUniversalROM = 24;
alias gestaltHasEnhancedLtalk = 30;

alias gestaltHelpMgrAttr = 1751477360;
alias gestaltHelpMgrPresent = 0;
alias gestaltHelpMgrExtensions = 1;
alias gestaltAppleGuideIsDebug = 30;
alias gestaltAppleGuidePresent = 31;

alias gestaltHardwareVendorCode = 1752326500;
alias gestaltHardwareVendorApple = 1097887852;

alias gestaltCompressionMgr = 1768123760;

alias gestaltIconUtilitiesAttr = 1768124270;
alias gestaltIconUtilitiesPresent = 0;
alias gestaltIconUtilitiesHas48PixelIcons = 1;
alias gestaltIconUtilitiesHas32BitIcons = 2;
alias gestaltIconUtilitiesHas8BitDeepMasks = 3;
alias gestaltIconUtilitiesHasIconServices = 4;

alias gestaltInternalDisplay = 1768190832;

alias gestaltKeyboardType = 1801610272;
alias gestaltMacKbd = 1;
alias gestaltMacAndPad = 2;
alias gestaltMacPlusKbd = 3;
alias gestaltUnknownThirdPartyKbd = 3;
alias gestaltExtADBKbd = 4;
alias gestaltStdADBKbd = 5;
alias gestaltPrtblADBKbd = 6;
alias gestaltPrtblISOKbd = 7;
alias gestaltStdISOADBKbd = 8;
alias gestaltExtISOADBKbd = 9;
alias gestaltADBKbdII = 10;
alias gestaltADBISOKbdII = 11;
alias gestaltPwrBookADBKbd = 12;
alias gestaltPwrBookISOADBKbd = 13;
alias gestaltAppleAdjustKeypad = 14;
alias gestaltAppleAdjustADBKbd = 15;
alias gestaltAppleAdjustISOKbd = 16;
alias gestaltJapanAdjustADBKbd = 17;
alias gestaltPwrBkExtISOKbd = 20;
alias gestaltPwrBkExtJISKbd = 21;
alias gestaltPwrBkExtADBKbd = 24;
alias gestaltPS2Keyboard = 27;
alias gestaltPwrBkSubDomKbd = 28;
alias gestaltPwrBkSubISOKbd = 29;
alias gestaltPwrBkSubJISKbd = 30;
alias gestaltPortableUSBANSIKbd = 37;
alias gestaltPortableUSBISOKbd = 38;
alias gestaltPortableUSBJISKbd = 39;
alias gestaltThirdPartyANSIKbd = 40;
alias gestaltThirdPartyISOKbd = 41;
alias gestaltThirdPartyJISKbd = 42;
alias gestaltPwrBkEKDomKbd = 195;
alias gestaltPwrBkEKISOKbd = 196;
alias gestaltPwrBkEKJISKbd = 197;
alias gestaltUSBCosmoANSIKbd = 198;
alias gestaltUSBCosmoISOKbd = 199;
alias gestaltUSBCosmoJISKbd = 200;
alias gestaltPwrBk99JISKbd = 201;
alias gestaltUSBAndyANSIKbd = 204;
alias gestaltUSBAndyISOKbd = 205;
alias gestaltUSBAndyJISKbd = 206;

alias gestaltPortable2001ANSIKbd = 202;
alias gestaltPortable2001ISOKbd = 203;
alias gestaltPortable2001JISKbd = 207;

alias gestaltUSBProF16ANSIKbd = 34;
alias gestaltUSBProF16ISOKbd = 35;
alias gestaltUSBProF16JISKbd = 36;
alias gestaltProF16ANSIKbd = 31;
alias gestaltProF16ISOKbd = 32;
alias gestaltProF16JISKbd = 33;

alias gestaltUDFSupport = 1802855526;

alias gestaltLowMemorySize = 1819108717;

alias gestaltLogicalRAMSize = 1819435373;

alias gestaltMachineType = 1835098984;
alias gestaltClassic = 1;
alias gestaltMacXL = 2;
alias gestaltMac512KE = 3;
alias gestaltMacPlus = 4;
alias gestaltMacSE = 5;
alias gestaltMacII = 6;
alias gestaltMacIIx = 7;
alias gestaltMacIIcx = 8;
alias gestaltMacSE030 = 9;
alias gestaltPortable = 10;
alias gestaltMacIIci = 11;
alias gestaltPowerMac8100_120 = 12;
alias gestaltMacIIfx = 13;
alias gestaltMacClassic = 17;
alias gestaltMacIIsi = 18;
alias gestaltMacLC = 19;
alias gestaltMacQuadra900 = 20;
alias gestaltPowerBook170 = 21;
alias gestaltMacQuadra700 = 22;
alias gestaltClassicII = 23;
alias gestaltPowerBook100 = 24;
alias gestaltPowerBook140 = 25;
alias gestaltMacQuadra950 = 26;
alias gestaltMacLCIII = 27;
alias gestaltPerforma450 = 27;
alias gestaltPowerBookDuo210 = 29;
alias gestaltMacCentris650 = 30;
alias gestaltPowerBookDuo230 = 32;
alias gestaltPowerBook180 = 33;
alias gestaltPowerBook160 = 34;
alias gestaltMacQuadra800 = 35;
alias gestaltMacQuadra650 = 36;
alias gestaltMacLCII = 37;
alias gestaltPowerBookDuo250 = 38;
alias gestaltAWS9150_80 = 39;
alias gestaltPowerMac8100_110 = 40;
alias gestaltAWS8150_110 = 40;
alias gestaltPowerMac5200 = 41;
alias gestaltPowerMac5260 = 41;
alias gestaltPerforma5300 = 41;
alias gestaltPowerMac6200 = 42;
alias gestaltPerforma6300 = 42;
alias gestaltMacIIvi = 44;
alias gestaltMacIIvm = 45;
alias gestaltPerforma600 = 45;
alias gestaltPowerMac7100_80 = 47;
alias gestaltMacIIvx = 48;
alias gestaltMacColorClassic = 49;
alias gestaltPerforma250 = 49;
alias gestaltPowerBook165c = 50;
alias gestaltMacCentris610 = 52;
alias gestaltMacQuadra610 = 53;
alias gestaltPowerBook145 = 54;
alias gestaltPowerMac8100_100 = 55;
alias gestaltMacLC520 = 56;
alias gestaltAWS9150_120 = 57;
alias gestaltPowerMac6400 = 58;
alias gestaltPerforma6400 = 58;
alias gestaltPerforma6360 = 58;
alias gestaltMacCentris660AV = 60;
alias gestaltMacQuadra660AV = 60;
alias gestaltPerforma46x = 62;
alias gestaltPowerMac8100_80 = 65;
alias gestaltAWS8150_80 = 65;
alias gestaltPowerMac9500 = 67;
alias gestaltPowerMac9600 = 67;
alias gestaltPowerMac7500 = 68;
alias gestaltPowerMac7600 = 68;
alias gestaltPowerMac8500 = 69;
alias gestaltPowerMac8600 = 69;
alias gestaltAWS8550 = 68;
alias gestaltPowerBook180c = 71;
alias gestaltPowerBook520 = 72;
alias gestaltPowerBook520c = 72;
alias gestaltPowerBook540 = 72;
alias gestaltPowerBook540c = 72;
alias gestaltPowerMac5400 = 74;
alias gestaltPowerMac6100_60 = 75;
alias gestaltAWS6150_60 = 75;
alias gestaltPowerBookDuo270c = 77;
alias gestaltMacQuadra840AV = 78;
alias gestaltPerforma550 = 80;
alias gestaltPowerBook165 = 84;
alias gestaltPowerBook190 = 85;
alias gestaltMacTV = 88;
alias gestaltMacLC475 = 89;
alias gestaltPerforma47x = 89;
alias gestaltMacLC575 = 92;
alias gestaltMacQuadra605 = 94;
alias gestaltMacQuadra630 = 98;
alias gestaltMacLC580 = 99;
alias gestaltPerforma580 = 99;
alias gestaltPowerMac6100_66 = 100;
alias gestaltAWS6150_66 = 100;
alias gestaltPowerBookDuo280 = 102;
alias gestaltPowerBookDuo280c = 103;
alias gestaltPowerMacLC475 = 104;
alias gestaltPowerMacPerforma47x = 104;
alias gestaltPowerMacLC575 = 105;
alias gestaltPowerMacPerforma57x = 105;
alias gestaltPowerMacQuadra630 = 106;
alias gestaltPowerMacLC630 = 106;
alias gestaltPowerMacPerforma63x = 106;
alias gestaltPowerMac7200 = 108;
alias gestaltPowerMac7300 = 109;
alias gestaltPowerMac7100_66 = 112;
alias gestaltPowerBook150 = 115;
alias gestaltPowerMacQuadra700 = 116;
alias gestaltPowerMacQuadra900 = 117;
alias gestaltPowerMacQuadra950 = 118;
alias gestaltPowerMacCentris610 = 119;
alias gestaltPowerMacCentris650 = 120;
alias gestaltPowerMacQuadra610 = 121;
alias gestaltPowerMacQuadra650 = 122;
alias gestaltPowerMacQuadra800 = 123;
alias gestaltPowerBookDuo2300 = 124;
alias gestaltPowerBook500PPCUpgrade = 126;
alias gestaltPowerBook5300 = 128;
alias gestaltPowerBook1400 = 310;
alias gestaltPowerBook3400 = 306;
alias gestaltPowerBook2400 = 307;
alias gestaltPowerBookG3Series = 312;
alias gestaltPowerBookG3 = 313;
alias gestaltPowerBookG3Series2 = 314;
alias gestaltPowerMacNewWorld = 406;
alias gestaltPowerMacG3 = 510;
alias gestaltPowerMac5500 = 512;
alias gestalt20thAnniversary = 512;
alias gestaltPowerMac6500 = 513;
alias gestaltPowerMac4400_160 = 514;
alias gestaltPowerMac4400 = 515;
alias gestaltMacOSCompatibility = 1206;

alias gestaltQuadra605 = 94;
alias gestaltQuadra610 = 53;
alias gestaltQuadra630 = 98;
alias gestaltQuadra650 = 36;
alias gestaltQuadra660AV = 60;
alias gestaltQuadra700 = 22;
alias gestaltQuadra800 = 35;
alias gestaltQuadra840AV = 78;
alias gestaltQuadra900 = 20;
alias gestaltQuadra950 = 26;

alias kMachineNameStrID = 4294950901;

alias gestaltSMPMailerVersion = 1835101298;

alias gestaltMediaBay = 1835165032;
alias gestaltMBLegacy = 0;
alias gestaltMBSingleBay = 1;
alias gestaltMBMultipleBays = 2;

alias gestaltMessageMgrVersion = 1835365235;

alias gestaltMenuMgrAttr = 1835363957;
alias gestaltMenuMgrPresent = 1;
alias gestaltMenuMgrPresentBit = 0;
alias gestaltMenuMgrAquaLayoutBit = 1;
alias gestaltMenuMgrMultipleItemsWithCommandIDBit = 2;
alias gestaltMenuMgrRetainsIconRefBit = 3;
alias gestaltMenuMgrSendsMenuBoundsToDefProcBit = 4;
alias gestaltMenuMgrMoreThanFiveMenusDeepBit = 5;
alias gestaltMenuMgrCGImageMenuTitleBit = 6;
alias gestaltMenuMgrPresentMask = 1;
alias gestaltMenuMgrAquaLayoutMask = 2;
alias gestaltMenuMgrMultipleItemsWithCommandIDMask = 4;
alias gestaltMenuMgrRetainsIconRefMask = 8;
alias gestaltMenuMgrSendsMenuBoundsToDefProcMask = 16;
alias gestaltMenuMgrMoreThanFiveMenusDeepMask = 32;
alias gestaltMenuMgrCGImageMenuTitleMask = 64;

alias gestaltMultipleUsersState = 1835426930;

alias gestaltMachineIcon = 1835623278;

alias gestaltMiscAttr = 1835627363;
alias gestaltScrollingThrottle = 0;
alias gestaltSquareMenuBar = 2;

alias gestaltMixedModeVersion = 1835628644;

alias gestaltMixedModeAttr = 1835628644;
alias gestaltMixedModePowerPC = 0;
alias gestaltPowerPCAware = 0;
alias gestaltMixedModeCFM68K = 1;
alias gestaltMixedModeCFM68KHasTrap = 2;
alias gestaltMixedModeCFM68KHasState = 3;

alias gestaltQuickTimeConferencing = 1836346475;

alias gestaltMemoryMapAttr = 1835884912;
alias gestaltMemoryMapSparse = 0;

alias gestaltMMUType = 1835889952;
alias gestaltNoMMU = 0;
alias gestaltAMU = 1;
alias gestalt68851 = 2;
alias gestalt68030MMU = 3;
alias gestalt68040MMU = 4;
alias gestaltEMMU1 = 5;

alias gestaltUserVisibleMachineName = 1835950445;

alias gestaltMPCallableAPIsAttr = 1836086115;
alias gestaltMPFileManager = 0;
alias gestaltMPDeviceManager = 1;
alias gestaltMPTrapCalls = 2;

alias gestaltStdNBPAttr = 1852601712;
alias gestaltStdNBPPresent = 0;
alias gestaltStdNBPSupportsAutoPosition = 1;

alias gestaltNotificationMgrAttr = 1852663666;
alias gestaltNotificationPresent = 0;

alias gestaltNameRegistryVersion = 1852990823;

alias gestaltNuBusSlotCount = 1853186675;

alias gestaltOCEToolboxVersion = 1868785012;
alias gestaltOCETB = 258;
alias gestaltSFServer = 256;

alias gestaltOCEToolboxAttr = 1868785013;
alias gestaltOCETBPresent = 1;
alias gestaltOCETBAvailable = 2;
alias gestaltOCESFServerAvailable = 4;
alias gestaltOCETBNativeGlueAvailable = 16;

alias gestaltOpenFirmwareInfo = 1869637239;

alias gestaltOSAttr = 1869815840;
alias gestaltSysZoneGrowable = 0;
alias gestaltLaunchCanReturn = 1;
alias gestaltLaunchFullFileSpec = 2;
alias gestaltLaunchControl = 3;
alias gestaltTempMemSupport = 4;
alias gestaltRealTempMemory = 5;
alias gestaltTempMemTracked = 6;
alias gestaltIPCSupport = 7;
alias gestaltSysDebuggerSupport = 8;
alias gestaltNativeProcessMgrBit = 19;
alias gestaltAltivecRegistersSwappedCorrectlyBit = 20;

alias gestaltOSTable = 1869837428;

alias gestaltOpenTptNetworkSetup = 1869898598;
alias gestaltOpenTptNetworkSetupLegacyImport = 0;
alias gestaltOpenTptNetworkSetupLegacyExport = 1;
alias gestaltOpenTptNetworkSetupSupportsMultihoming = 2;

alias gestaltOpenTptNetworkSetupVersion = 1869898614;

alias gestaltOpenTptRemoteAccess = 1869902433;
alias gestaltOpenTptRemoteAccessPresent = 0;
alias gestaltOpenTptRemoteAccessLoaded = 1;
alias gestaltOpenTptRemoteAccessClientOnly = 2;
alias gestaltOpenTptRemoteAccessPServer = 3;
alias gestaltOpenTptRemoteAccessMPServer = 4;
alias gestaltOpenTptPPPPresent = 5;
alias gestaltOpenTptARAPPresent = 6;

alias gestaltOpenTptRemoteAccessVersion = 1869902454;

alias gestaltOpenTptVersions = 1869903474;

alias gestaltOpenTpt = 1869898094;
alias gestaltOpenTptPresentMask = 1;
alias gestaltOpenTptLoadedMask = 2;
alias gestaltOpenTptAppleTalkPresentMask = 4;
alias gestaltOpenTptAppleTalkLoadedMask = 8;
alias gestaltOpenTptTCPPresentMask = 16;
alias gestaltOpenTptTCPLoadedMask = 32;
alias gestaltOpenTptIPXSPXPresentMask = 64;
alias gestaltOpenTptIPXSPXLoadedMask = 128;
alias gestaltOpenTptPresentBit = 0;
alias gestaltOpenTptLoadedBit = 1;
alias gestaltOpenTptAppleTalkPresentBit = 2;
alias gestaltOpenTptAppleTalkLoadedBit = 3;
alias gestaltOpenTptTCPPresentBit = 4;
alias gestaltOpenTptTCPLoadedBit = 5;
alias gestaltOpenTptIPXSPXPresentBit = 6;
alias gestaltOpenTptIPXSPXLoadedBit = 7;

alias gestaltPCCard = 1885561700;
alias gestaltCardServicesPresent = 0;
alias gestaltPCCardFamilyPresent = 1;
alias gestaltPCCardHasPowerControl = 2;
alias gestaltPCCardSupportsCardBus = 3;

alias gestaltProcClkSpeed = 1885564011;

alias gestaltProcClkSpeedMHz = 1835232363;

alias gestaltPCXAttr = 1885567079;
alias gestaltPCXHas8and16BitFAT = 0;
alias gestaltPCXHasProDOS = 1;
alias gestaltPCXNewUI = 2;
alias gestaltPCXUseICMapping = 3;

alias gestaltLogicalPageSize = 1885827962;

alias gestaltScreenCaptureMain = 1885954865;
alias gestaltScreenCaptureDir = 1885954866;

alias gestaltGXPrintingMgrVersion = 1886218098;

alias gestaltPopupAttr = 1886351393;
alias gestaltPopupPresent = 0;

alias gestaltPowerMgrAttr = 1886353266;
alias gestaltPMgrExists = 0;
alias gestaltPMgrCPUIdle = 1;
alias gestaltPMgrSCC = 2;
alias gestaltPMgrSound = 3;
alias gestaltPMgrDispatchExists = 4;
alias gestaltPMgrSupportsAVPowerStateAtSleepWake = 5;

alias gestaltPowerMgrVers = 1886876278;

alias gestaltPPCToolboxAttr = 1886413600;
alias gestaltPPCToolboxPresent = 0;
alias gestaltPPCSupportsRealTime = 4096;
alias gestaltPPCSupportsIncoming = 1;
alias gestaltPPCSupportsOutGoing = 2;
alias gestaltPPCSupportsTCP_IP = 4;
alias gestaltPPCSupportsIncomingAppleTalk = 16;
alias gestaltPPCSupportsIncomingTCP_IP = 32;
alias gestaltPPCSupportsOutgoingAppleTalk = 256;
alias gestaltPPCSupportsOutgoingTCP_IP = 512;

alias gestaltPowerPCProcessorFeatures = 1886413670;
alias gestaltPowerPCHasGraphicsInstructions = 0;
alias gestaltPowerPCHasSTFIWXInstruction = 1;
alias gestaltPowerPCHasSquareRootInstructions = 2;
alias gestaltPowerPCHasDCBAInstruction = 3;
alias gestaltPowerPCHasVectorInstructions = 4;
alias gestaltPowerPCHasDataStreams = 5;
alias gestaltPowerPCHas64BitSupport = 6;
alias gestaltPowerPCHasDCBTStreams = 7;
alias gestaltPowerPCASArchitecture = 8;
alias gestaltPowerPCIgnoresDCBST = 9;

alias gestaltProcessorType = 1886547811;
alias gestalt68000 = 1;
alias gestalt68010 = 2;
alias gestalt68020 = 3;
alias gestalt68030 = 4;
alias gestalt68040 = 5;

alias gestaltSDPPromptVersion = 1886548086;

alias gestaltParityAttr = 1886549113;
alias gestaltHasParityCapability = 0;
alias gestaltParityEnabled = 1;

alias gestaltQD3DVersion = 1899197984;

alias gestaltQD3DViewer = 1899198051;
alias gestaltQD3DViewerPresent = 0;

alias gestaltQuickdrawVersion = 1902387232;
alias gestaltOriginalQD = 0;
alias gestalt8BitQD = 256;
alias gestalt32BitQD = 512;
alias gestalt32BitQD11 = 513;
alias gestalt32BitQD12 = 544;
alias gestalt32BitQD13 = 560;
alias gestaltAllegroQD = 592;
alias gestaltMacOSXQD = 768;

alias gestaltQD3D = 1902392164;
alias gestaltQD3DPresent = 0;

alias gestaltGXVersion = 1902405496;

alias gestaltQuickdrawFeatures = 1902408311;
alias gestaltHasColor = 0;
alias gestaltHasDeepGWorlds = 1;
alias gestaltHasDirectPixMaps = 2;
alias gestaltHasGrayishTextOr = 3;
alias gestaltSupportsMirroring = 4;
alias gestaltQDHasLongRowBytes = 5;

alias gestaltQDTextVersion = 1902408824;
alias gestaltOriginalQDText = 0;
alias gestaltAllegroQDText = 256;
alias gestaltMacOSXQDText = 512;

alias gestaltQDTextFeatures = 1902408806;
alias gestaltWSIISupport = 0;
alias gestaltSbitFontSupport = 1;
alias gestaltAntiAliasedTextAvailable = 2;
alias gestaltOFA2available = 3;
alias gestaltCreatesAliasFontRsrc = 4;
alias gestaltNativeType1FontSupport = 5;
alias gestaltCanUseCGTextRendering = 6;

alias gestaltQuickTimeConferencingInfo = 1903453033;

alias gestaltQuickTimeVersion = 1903454573;
alias gestaltQuickTime = 1903454573;

alias gestaltQuickTimeFeatures = 1903456883;
alias gestaltPPCQuickTimeLibPresent = 0;

alias gestaltQuickTimeStreamingFeatures = 1903457126;

alias gestaltQuickTimeStreamingVersion = 1903457140;

alias gestaltQuickTimeThreadSafeFeaturesAttr = 1903457384;
alias gestaltQuickTimeThreadSafeICM = 0;
alias gestaltQuickTimeThreadSafeMovieToolbox = 1;
alias gestaltQuickTimeThreadSafeMovieImport = 2;
alias gestaltQuickTimeThreadSafeMovieExport = 3;
alias gestaltQuickTimeThreadSafeGraphicsImport = 4;
alias gestaltQuickTimeThreadSafeGraphicsExport = 5;
alias gestaltQuickTimeThreadSafeMoviePlayback = 6;

alias gestaltQTVRMgrAttr = 1903457906;
alias gestaltQTVRMgrPresent = 0;
alias gestaltQTVRObjMoviesPresent = 1;
alias gestaltQTVRCylinderPanosPresent = 2;
alias gestaltQTVRCubicPanosPresent = 3;

alias gestaltQTVRMgrVers = 1903457910;

alias gestaltPhysicalRAMSize = 1918987552;

alias gestaltPhysicalRAMSizeInMegabytes = 1918987629;

alias gestaltRBVAddr = 1919055392;

alias gestaltROMSize = 1919905056;

alias gestaltROMVersion = 1919905142;

alias gestaltResourceMgrAttr = 1920168547;
alias gestaltPartialRsrcs = 0;
alias gestaltHasResourceOverrides = 1;

alias gestaltResourceMgrBugFixesAttrs = 1919771239;
alias gestaltRMForceSysHeapRolledIn = 0;
alias gestaltRMFakeAppleMenuItemsRolledIn = 1;
alias gestaltSanityCheckResourceFiles = 2;
alias gestaltSupportsFSpResourceFileAlreadyOpenBit = 3;
alias gestaltRMSupportsFSCalls = 4;
alias gestaltRMTypeIndexOrderingReverse = 8;

alias gestaltRealtimeMgrAttr = 1920232818;
alias gestaltRealtimeMgrPresent = 0;

alias gestaltSafeOFAttr = 1935763045;
alias gestaltVMZerosPagesBit = 0;
alias gestaltInitHeapZerosOutHeapsBit = 1;
alias gestaltNewHandleReturnsZeroedMemoryBit = 2;
alias gestaltNewPtrReturnsZeroedMemoryBit = 3;
alias gestaltFileAllocationZeroedBlocksBit = 4;

alias gestaltSCCReadAddr = 1935893362;

alias gestaltSCCWriteAddr = 1935893367;

alias gestaltScrapMgrAttr = 1935897185;
alias gestaltScrapMgrTranslationAware = 0;

alias gestaltScriptMgrVersion = 1935897193;

alias gestaltScriptCount = 1935897123;

alias gestaltSCSI = 1935897449;
alias gestaltAsyncSCSI = 0;
alias gestaltAsyncSCSIINROM = 1;
alias gestaltSCSISlotBoot = 2;
alias gestaltSCSIPollSIH = 3;

alias gestaltControlStripAttr = 1935959414;
alias gestaltControlStripExists = 0;
alias gestaltControlStripVersionFixed = 1;
alias gestaltControlStripUserFont = 2;
alias gestaltControlStripUserHotKey = 3;

alias gestaltSDPStandardDirectoryVersion = 1935963762;

alias gestaltSerialAttr = 1936028192;
alias gestaltHasGPIaToDCDa = 0;
alias gestaltHasGPIaToRTxCa = 1;
alias gestaltHasGPIbToDCDb = 2;
alias gestaltHidePortA = 3;
alias gestaltHidePortB = 4;
alias gestaltPortADisabled = 5;
alias gestaltPortBDisabled = 6;

alias gestaltShutdownAttributes = 1936225652;
alias gestaltShutdownHassdOnBootVolUnmount = 0;

alias gestaltNuBusConnectors = 1936487523;

alias gestaltSlotAttr = 1936486260;
alias gestaltSlotMgrExists = 0;
alias gestaltNuBusPresent = 1;
alias gestaltSESlotPresent = 2;
alias gestaltSE30SlotPresent = 3;
alias gestaltPortableSlotPresent = 4;

alias gestaltFirstSlotNumber = 1936487473;

alias gestaltSoundAttr = 1936614432;
alias gestaltStereoCapability = 0;
alias gestaltStereoMixing = 1;
alias gestaltSoundIOMgrPresent = 3;
alias gestaltBuiltInSoundInput = 4;
alias gestaltHasSoundInputDevice = 5;
alias gestaltPlayAndRecord = 6;
alias gestalt16BitSoundIO = 7;
alias gestaltStereoInput = 8;
alias gestaltLineLevelInput = 9;
alias gestaltSndPlayDoubleBuffer = 10;
alias gestaltMultiChannels = 11;
alias gestalt16BitAudioSupport = 12;

alias gestaltSplitOSAttr = 1936748403;
alias gestaltSplitOSBootDriveIsNetworkVolume = 0;
alias gestaltSplitOSAware = 1;
alias gestaltSplitOSEnablerVolumeIsDifferentFromBootVolume = 2;
alias gestaltSplitOSMachineNameSetToNetworkNameTemp = 3;
alias gestaltSplitOSMachineNameStartupDiskIsNonPersistent = 5;

alias gestaltSMPSPSendLetterVersion = 1936749420;

alias gestaltSpeechRecognitionAttr = 1936880737;
alias gestaltDesktopSpeechRecognition = 1;
alias gestaltTelephoneSpeechRecognition = 2;

alias gestaltSpeechRecognitionVersion = 1936880738;

alias gestaltSoftwareVendorCode = 1936875876;
alias gestaltSoftwareVendorApple = 1097887852;
alias gestaltSoftwareVendorLicensee = 1281584755;

alias gestaltStandardFileAttr = 1937007718;
alias gestaltStandardFile58 = 0;
alias gestaltStandardFileTranslationAware = 1;
alias gestaltStandardFileHasColorIcons = 2;
alias gestaltStandardFileUseGenericIcons = 3;
alias gestaltStandardFileHasDynamicVolumeAllocation = 4;

alias gestaltSysArchitecture = 1937339233;
alias gestalt68k = 1;
alias gestaltPowerPC = 2;
alias gestaltIntel = 10;

alias gestaltSystemUpdateVersion = 1937339253;

alias gestaltSystemVersion = 1937339254;
alias gestaltSystemVersionMajor = 1937339185;
alias gestaltSystemVersionMinor = 1937339186;
alias gestaltSystemVersionBugFix = 1937339187;

alias gestaltToolboxTable = 1952609396;

alias gestaltTextEditVersion = 1952784416;
alias gestaltTE1 = 1;
alias gestaltTE2 = 2;
alias gestaltTE3 = 3;
alias gestaltTE4 = 4;
alias gestaltTE5 = 5;

alias gestaltTE6 = 6;

alias gestaltTEAttr = 1952801140;
alias gestaltTEHasGetHiliteRgn = 0;
alias gestaltTESupportsInlineInput = 1;
alias gestaltTESupportsTextObjects = 2;
alias gestaltTEHasWhiteBackground = 3;

alias gestaltTeleMgrAttr = 1952803941;
alias gestaltTeleMgrPresent = 0;
alias gestaltTeleMgrPowerPCSupport = 1;
alias gestaltTeleMgrSoundStreams = 2;
alias gestaltTeleMgrAutoAnswer = 3;
alias gestaltTeleMgrIndHandset = 4;
alias gestaltTeleMgrSilenceDetect = 5;
alias gestaltTeleMgrNewTELNewSupport = 6;

alias gestaltTermMgrAttr = 1952805485;
alias gestaltTermMgrPresent = 0;
alias gestaltTermMgrErrorString = 2;

alias gestaltThreadMgrAttr = 1952998515;
alias gestaltThreadMgrPresent = 0;
alias gestaltSpecificMatchSupport = 1;
alias gestaltThreadsLibraryPresent = 2;

alias gestaltTimeMgrVersion = 1953326962;
alias gestaltStandardTimeMgr = 1;
alias gestaltRevisedTimeMgr = 2;
alias gestaltExtendedTimeMgr = 3;
alias gestaltNativeTimeMgr = 4;

alias gestaltTSMTEVersion = 1953322070;
alias gestaltTSMTE1 = 256;
alias gestaltTSMTE15 = 336;
alias gestaltTSMTE152 = 338;

alias gestaltTSMTEAttr = 1953322053;
alias gestaltTSMTEPresent = 0;
alias gestaltTSMTE = 0;

alias gestaltAVLTreeAttr = 1953654117;
alias gestaltAVLTreePresentBit = 0;
alias gestaltAVLTreeSupportsHandleBasedTreeBit = 1;
alias gestaltAVLTreeSupportsTreeLockingBit = 2;

alias gestaltALMAttr = 1953655152;
alias gestaltALMPresent = 0;
alias gestaltALMHasSFGroup = 1;
alias gestaltALMHasCFMSupport = 2;
alias gestaltALMHasRescanNotifiers = 3;

alias gestaltALMHasSFLocation = 1;

alias gestaltTSMgrVersion = 1953721718;
alias gestaltTSMgr15 = 336;
alias gestaltTSMgr20 = 512;
alias gestaltTSMgr22 = 544;
alias gestaltTSMgr23 = 560;

alias gestaltTSMgrAttr = 1953721697;
alias gestaltTSMDisplayMgrAwareBit = 0;
alias gestaltTSMdoesTSMTEBit = 1;

alias gestaltSpeechAttr = 1953788771;
alias gestaltSpeechMgrPresent = 0;
alias gestaltSpeechHasPPCGlue = 1;

alias gestaltTVAttr = 1953898528;
alias gestaltHasTVTuner = 0;
alias gestaltHasSoundFader = 1;
alias gestaltHasHWClosedCaptioning = 2;
alias gestaltHasIRRemote = 3;
alias gestaltHasVidDecoderScaler = 4;
alias gestaltHasStereoDecoder = 5;
alias gestaltHasSerialFader = 6;
alias gestaltHasFMTuner = 7;
alias gestaltHasSystemIRFunction = 8;
alias gestaltIRDisabled = 9;
alias gestaltINeedIRPowerOffConfirm = 10;
alias gestaltHasZoomedVideo = 11;

alias gestaltATSUVersion = 1969845110;
alias gestaltOriginalATSUVersion = 65536;
alias gestaltATSUUpdate1 = 131072;
alias gestaltATSUUpdate2 = 196608;
alias gestaltATSUUpdate3 = 262144;
alias gestaltATSUUpdate4 = 327680;
alias gestaltATSUUpdate5 = 393216;
alias gestaltATSUUpdate6 = 458752;
alias gestaltATSUUpdate7 = 524288;

alias gestaltATSUFeatures = 1969845094;
alias gestaltATSUTrackingFeature = 1;
alias gestaltATSUMemoryFeature = 1;
alias gestaltATSUFallbacksFeature = 1;
alias gestaltATSUGlyphBoundsFeature = 1;
alias gestaltATSULineControlFeature = 1;
alias gestaltATSULayoutCreateAndCopyFeature = 1;
alias gestaltATSULayoutCacheClearFeature = 1;
alias gestaltATSUTextLocatorUsageFeature = 2;
alias gestaltATSULowLevelOrigFeatures = 4;
alias gestaltATSUFallbacksObjFeatures = 8;
alias gestaltATSUIgnoreLeadingFeature = 8;
alias gestaltATSUByCharacterClusterFeature = 16;
alias gestaltATSUAscentDescentControlsFeature = 16;
alias gestaltATSUHighlightInactiveTextFeature = 16;
alias gestaltATSUPositionToCursorFeature = 16;
alias gestaltATSUBatchBreakLinesFeature = 16;
alias gestaltATSUTabSupportFeature = 16;
alias gestaltATSUDirectAccess = 16;
alias gestaltATSUDecimalTabFeature = 32;
alias gestaltATSUBiDiCursorPositionFeature = 32;
alias gestaltATSUNearestCharLineBreakFeature = 32;
alias gestaltATSUHighlightColorControlFeature = 32;
alias gestaltATSUUnderlineOptionsStyleFeature = 32;
alias gestaltATSUStrikeThroughStyleFeature = 32;
alias gestaltATSUDropShadowStyleFeature = 32;

alias gestaltUSBAttr = 1970496032;
alias gestaltUSBPresent = 0;
alias gestaltUSBHasIsoch = 1;

alias gestaltUSBVersion = 1970496118;

alias gestaltVersion = 1986359923;
alias gestaltValueImplementedVers = 5;

alias gestaltVIA1Addr = 1986617649;

alias gestaltVIA2Addr = 1986617650;

alias gestaltVMAttr = 1986863136;
alias gestaltVMPresent = 0;
alias gestaltVMHasLockMemoryForOutput = 1;
alias gestaltVMFilemappingOn = 3;
alias gestaltVMHasPagingControl = 4;

alias gestaltVMInfoType = 1986881902;
alias gestaltVMInfoSizeStorageType = 0;
alias gestaltVMInfoSizeType = 1;
alias gestaltVMInfoSimpleType = 2;
alias gestaltVMInfoNoneType = 3;

alias gestaltVMBackingStoreFileRefNum = 1986880115;

alias gestaltALMVers = 2002873451;

alias gestaltWindowMgrAttr = 2003398244;
alias gestaltWindowMgrPresent = 1;
alias gestaltWindowMgrPresentBit = 0;
alias gestaltExtendedWindowAttributes = 1;
alias gestaltExtendedWindowAttributesBit = 1;
alias gestaltHasFloatingWindows = 2;
alias gestaltHasFloatingWindowsBit = 2;
alias gestaltHasWindowBuffering = 3;
alias gestaltHasWindowBufferingBit = 3;
alias gestaltWindowLiveResizeBit = 4;
alias gestaltWindowMinimizeToDockBit = 5;
alias gestaltHasWindowShadowsBit = 6;
alias gestaltSheetsAreWindowModalBit = 7;
alias gestaltFrontWindowMayBeHiddenBit = 8;
alias gestaltWindowMgrPresentMask = 1;
alias gestaltExtendedWindowAttributesMask = 2;
alias gestaltHasFloatingWindowsMask = 4;
alias gestaltHasWindowBufferingMask = 8;
alias gestaltWindowLiveResizeMask = 16;
alias gestaltWindowMinimizeToDockMask = 32;
alias gestaltHasWindowShadowsMask = 64;
alias gestaltSheetsAreWindowModalMask = 128;
alias gestaltFrontWindowMayBeHiddenMask = 256;

alias gestaltHasSingleWindowModeBit = 8;
alias gestaltHasSingleWindowModeMask = 256;

alias gestaltX86Features = 2016949862;
alias gestaltX86HasFPU = 0;
alias gestaltX86HasVME = 1;
alias gestaltX86HasDE = 2;
alias gestaltX86HasPSE = 3;
alias gestaltX86HasTSC = 4;
alias gestaltX86HasMSR = 5;
alias gestaltX86HasPAE = 6;
alias gestaltX86HasMCE = 7;
alias gestaltX86HasCX8 = 8;
alias gestaltX86HasAPIC = 9;
alias gestaltX86HasSEP = 11;
alias gestaltX86HasMTRR = 12;
alias gestaltX86HasPGE = 13;
alias gestaltX86HasMCA = 14;
alias gestaltX86HasCMOV = 15;
alias gestaltX86HasPAT = 16;
alias gestaltX86HasPSE36 = 17;
alias gestaltX86HasPSN = 18;
alias gestaltX86HasCLFSH = 19;
alias gestaltX86Serviced20 = 20;
alias gestaltX86HasDS = 21;
alias gestaltX86ResACPI = 22;
alias gestaltX86HasMMX = 23;
alias gestaltX86HasFXSR = 24;
alias gestaltX86HasSSE = 25;
alias gestaltX86HasSSE2 = 26;
alias gestaltX86HasSS = 27;
alias gestaltX86HasHTT = 28;
alias gestaltX86HasTM = 29;

alias gestaltX86AdditionalFeatures = 2016949857;
alias gestaltX86HasSSE3 = 0;
alias gestaltX86HasMONITOR = 3;
alias gestaltX86HasDSCPL = 4;
alias gestaltX86HasVMX = 5;
alias gestaltX86HasSMX = 6;
alias gestaltX86HasEST = 7;
alias gestaltX86HasTM2 = 8;
alias gestaltX86HasSupplementalSSE3 = 9;
alias gestaltX86HasCID = 10;
alias gestaltX86HasCX16 = 13;
alias gestaltX86HasxTPR = 14;

alias gestaltTranslationAttr = 2020368756;
alias gestaltTranslationMgrExists = 0;
alias gestaltTranslationMgrHintOrder = 1;
alias gestaltTranslationPPCAvail = 2;
alias gestaltTranslationGetPathAPIAvail = 3;

alias gestaltExtToolboxTable = 2020897908;

alias gestaltUSBPrinterSharingVersion = 2053204768;
alias gestaltUSBPrinterSharingVersionMask = 65535;
alias gestaltUSBPrinterSharingAttr = 2053204768;
alias gestaltUSBPrinterSharingAttrMask = 4294901760;
alias gestaltUSBPrinterSharingAttrRunning = 2147483648;
alias gestaltUSBPrinterSharingAttrBooted = 1073741824;

alias gestaltWorldScriptIIVersion = 1685026146;
alias gestaltWorldScriptIIAttr = 2004050292;
alias gestaltWSIICanPrintWithoutPrGeneralBit = 0;

alias maxSize = 2147483632;

alias defaultPhysicalEntryCount = 8;

alias kPageInMemory = 0;
alias kPageOnDisk = 1;
alias kNotPaged = 2;

alias k32BitHeap = 1;
alias kNewStyleHeap = 2;
alias kNewDebugHeap = 4;

alias kHandleIsResourceBit = 5;
alias kHandlePurgeableBit = 6;
alias kHandleLockedBit = 7;

alias kHandleIsResourceMask = 32;
alias kHandlePurgeableMask = 64;
alias kHandleLockedMask = 128;

external MemError() : Short;

external LMGetMemErr() : Short;

external LMSetMemErr(
    value : Short);

external NewHandle(
    byteCount : CLong) : Handle;

external NewHandleClear(
    byteCount : CLong) : Handle;

external RecoverHandle(
    p : Ptr) : Handle;

external NewPtr(
    byteCount : CLong) : Ptr;

external NewPtrClear(
    byteCount : CLong) : Ptr;

external NewEmptyHandle() : Handle;

external HLock(
    h : Handle);

external HLockHi(
    h : Handle);

external HUnlock(
    h : Handle);

external TempNewHandle(
    logicalSize : CLong,
    resultCode : Pointer[Short]) : Handle;

external DisposePtr(
    p : Ptr);

external GetPtrSize(
    p : Ptr) : CLong;

external SetPtrSize(
    p : Ptr,
    newSize : CLong);

external DisposeHandle(
    h : Handle);

external SetHandleSize(
    h : Handle,
    newSize : CLong);

external GetHandleSize(
    h : Handle) : CLong;

external ReallocateHandle(
    h : Handle,
    byteCount : CLong);

external EmptyHandle(
    h : Handle);

external HSetRBit(
    h : Handle);

external HClrRBit(
    h : Handle);

external HGetState(
    h : Handle) : CChar;

external HSetState(
    h : Handle,
    flags : CChar);

external HandToHand(
    theHndl : Pointer[Handle]) : Short;

external PtrToXHand(
    srcPtr : RawPointer,
    dstHndl : Handle,
    size : CLong) : Short;

external PtrToHand(
    srcPtr : RawPointer,
    dstHndl : Pointer[Handle],
    size : CLong) : Short;

external HandAndHand(
    hand1 : Handle,
    hand2 : Handle) : Short;

external PtrAndHand(
    ptr1 : RawPointer,
    hand2 : Handle,
    size : CLong) : Short;

external IsHeapValid() : CUChar;

external IsHandleValid(
    h : Handle) : CUChar;

external IsPointerValid(
    p : Ptr) : CUChar;

external S64Max() : Int64;

external S64Min() : Int64;

external S64Add(
    left : Int64,
    right : Int64) : Int64;

external S64Subtract(
    left : Int64,
    right : Int64) : Int64;

external S64Negate(
    value : Int64) : Int64;

external S64Multiply(
    left : Int64,
    right : Int64) : Int64;

external S64Mod(
    dividend : Int64,
    divisor : Int64) : Int64;

external S64Divide(
    dividend : Int64,
    divisor : Int64,
    remainder : Pointer[Int64]) : Int64;

external S64Div(
    dividend : Int64,
    divisor : Int64) : Int64;

external S64Set(
    value : Int) : Int64;

external S64SetU(
    value : UInt) : Int64;

external S32Set(
    value : Int64) : Int;

external S64And(
    left : Int64,
    right : Int64) : CUChar;

external S64Or(
    left : Int64,
    right : Int64) : CUChar;

external S64Eor(
    left : Int64,
    right : Int64) : CUChar;

external S64Not(
    value : Int64) : CUChar;

external S64Compare(
    left : Int64,
    right : Int64) : Int;

external S64BitwiseAnd(
    left : Int64,
    right : Int64) : Int64;

external S64BitwiseOr(
    left : Int64,
    right : Int64) : Int64;

external S64BitwiseEor(
    left : Int64,
    right : Int64) : Int64;

external S64BitwiseNot(
    value : Int64) : Int64;

external S64ShiftRight(
    value : Int64,
    shift : UInt) : Int64;

external S64ShiftLeft(
    value : Int64,
    shift : UInt) : Int64;

external SInt64ToLongDouble(
    value : Int64) : UnsupportedCBuiltinType21;

external LongDoubleToSInt64(
    value : UnsupportedCBuiltinType21) : Int64;

external U64Max() : UInt64;

external U64Add(
    left : UInt64,
    right : UInt64) : UInt64;

external U64Subtract(
    left : UInt64,
    right : UInt64) : UInt64;

external U64Multiply(
    left : UInt64,
    right : UInt64) : UInt64;

external U64Mod(
    dividend : UInt64,
    divisor : UInt64) : UInt64;

external U64Divide(
    dividend : UInt64,
    divisor : UInt64,
    remainder : Pointer[UInt64]) : UInt64;

external U64Div(
    dividend : UInt64,
    divisor : UInt64) : UInt64;

external U64Set(
    value : Int) : UInt64;

external U64SetU(
    value : UInt) : UInt64;

external U32SetU(
    value : UInt64) : UInt;

external U64And(
    left : UInt64,
    right : UInt64) : CUChar;

external U64Or(
    left : UInt64,
    right : UInt64) : CUChar;

external U64Eor(
    left : UInt64,
    right : UInt64) : CUChar;

external U64Not(
    value : UInt64) : CUChar;

external U64Compare(
    left : UInt64,
    right : UInt64) : Int;

external U64BitwiseAnd(
    left : UInt64,
    right : UInt64) : UInt64;

external U64BitwiseOr(
    left : UInt64,
    right : UInt64) : UInt64;

external U64BitwiseEor(
    left : UInt64,
    right : UInt64) : UInt64;

external U64BitwiseNot(
    value : UInt64) : UInt64;

external U64ShiftRight(
    value : UInt64,
    shift : UInt) : UInt64;

external U64ShiftLeft(
    value : UInt64,
    shift : UInt) : UInt64;

external UInt64ToLongDouble(
    value : UInt64) : UnsupportedCBuiltinType21;

external LongDoubleToUInt64(
    value : UnsupportedCBuiltinType21) : UInt64;

external UInt64ToSInt64(
    value : UInt64) : Int64;

external SInt64ToUInt64(
    value : Int64) : UInt64;

external CSBackupSetItemExcluded(
    item : CFURLRef,
    exclude : CUChar,
    excludeByPath : CUChar) : Int;

external CSBackupIsItemExcluded(
    item : CFURLRef,
    excludeByPath : Pointer[CUChar]) : CUChar;

alias ToggleResults = Short;

alias toggleUndefined = 0;
alias toggleOK = 1;
alias toggleBadField = 2;
alias toggleBadDelta = 3;
alias toggleBadChar = 4;
alias toggleUnknown = 5;
alias toggleBadNum = 6;
alias toggleOutOfRange = 7;
alias toggleErr3 = 7;
alias toggleErr4 = 8;
alias toggleErr5 = 9;

alias smallDateBit = 31;
alias togChar12HourBit = 30;
alias togCharZCycleBit = 29;
alias togDelta12HourBit = 28;
alias genCdevRangeBit = 27;
alias validDateFields = 4294967295;
alias maxDateField = 10;

alias eraMask = 1;
alias yearMask = 2;
alias monthMask = 4;
alias dayMask = 8;
alias hourMask = 16;
alias minuteMask = 32;
alias secondMask = 64;
alias dayOfWeekMask = 128;
alias dayOfYearMask = 256;
alias weekOfYearMask = 512;
alias pmMask = 1024;
alias dateStdMask = 127;

alias LongDateField = CChar;

alias eraField = 0;
alias yearField = 1;
alias monthField = 2;
alias dayField = 3;
alias hourField = 4;
alias minuteField = 5;
alias secondField = 6;
alias dayOfWeekField = 7;
alias dayOfYearField = 8;
alias weekOfYearField = 9;
alias pmField = 10;
alias res1Field = 11;
alias res2Field = 12;
alias res3Field = 13;

alias DateForm = CChar;

alias shortDate = 0;
alias longDate = 1;
alias abbrevDate = 2;

alias fatalDateTime = 32768;
alias longDateFound = 1;
alias leftOverChars = 2;
alias sepNotIntlSep = 4;
alias fieldOrderNotIntl = 8;
alias extraneousStrings = 16;
alias tooManySeps = 32;
alias sepNotConsistent = 64;
alias tokenErr = 33024;
alias cantReadUtilities = 33280;
alias dateTimeNotFound = 33792;
alias dateTimeInvalid = 34816;

alias StringToDateStatus = Short;

alias String2DateStatus = Short;

record Struct_DateCacheRecord (
    hidden : Array[Short,256],
);

alias DateCacheRecord = Struct_DateCacheRecord;

alias DateCachePtr = Pointer[DateCacheRecord];

record Struct_DateTimeRec (
    year : Short,
    month : Short,
    day : Short,
    hour : Short,
    minute : Short,
    second : Short,
    dayOfWeek : Short,
);

alias DateTimeRec = Struct_DateTimeRec;

alias LongDateTime = Int64;

alias LongDateCvt = AUnionType;

alias LongDateRec = AUnionType;

alias DateDelta = CChar;

record Struct_TogglePB (
    togFlags : CLong,
    amChars : UInt,
    pmChars : UInt,
    reserved : Array[CLong,4],
);

alias TogglePB = Struct_TogglePB;

external UCConvertUTCDateTimeToCFAbsoluteTime(
    iUTCDate : Pointer[UTCDateTime],
    oCFTime : Pointer[Double]) : Int;

external UCConvertSecondsToCFAbsoluteTime(
    iSeconds : UInt,
    oCFTime : Pointer[Double]) : Int;

external UCConvertLongDateTimeToCFAbsoluteTime(
    iLongTime : Int64,
    oCFTime : Pointer[Double]) : Int;

external UCConvertCFAbsoluteTimeToUTCDateTime(
    iCFTime : Double,
    oUTCDate : Pointer[UTCDateTime]) : Int;

external UCConvertCFAbsoluteTimeToSeconds(
    iCFTime : Double,
    oSeconds : Pointer[UInt]) : Int;

external UCConvertCFAbsoluteTimeToLongDateTime(
    iCFTime : Double,
    oLongDate : Pointer[Int64]) : Int;

alias sortsBefore = 4294967295;
alias sortsEqual = 0;
alias sortsAfter = 1;

alias dummyType = 0;
alias vType = 1;
alias ioQType = 2;
alias drvQType = 3;
alias evType = 4;
alias fsQType = 5;
alias sIQType = 6;
alias dtQType = 7;
alias nmType = 8;

alias QTypes = CChar;

record Struct_QElem (
    qLink : Pointer[Struct_QElem],
    qType : Short,
    qData : Array[Short,1],
);

alias QElem = Struct_QElem;

alias QElemPtr = Pointer[QElem];

record Struct_QHdr (
    qFlags : Short,
    qHead : QElemPtr,
    qTail : QElemPtr,
);

alias QHdr = Struct_QHdr;

alias QHdrPtr = Pointer[QHdr];

record Struct_MachineLocation (
    latitude : Int,
    longitude : Int,
    u : AUnionType,
);

alias MachineLocation = Struct_MachineLocation;

external IsMetric() : CUChar;

external Delay(
    numTicks : CULong,
    finalTicks : Pointer[CULong]);

external Enqueue(
    qElement : QElemPtr,
    qHeader : QHdrPtr);

external Dequeue(
    qElement : QElemPtr,
    qHeader : QHdrPtr) : Short;

external ReadLocation(
    loc : Pointer[MachineLocation]);

external TickCount() : UInt;

external CSCopyUserName(
    useShortName : CUChar) : CFStringRef;

external CSCopyMachineName() : CFStringRef;

alias useFree = 0;
alias useATalk = 1;
alias useAsync = 2;
alias useExtClk = 3;
alias useMIDI = 4;

alias false32b = 0;
alias true32b = 1;

alias SysPPtr = RawPointer;

alias DeferredTaskProcPtr = CCodePointer[[CLong],[]];

alias DeferredTaskUPP = DeferredTaskProcPtr;

external NewDeferredTaskUPP(
    userRoutine : DeferredTaskProcPtr) : DeferredTaskUPP;

external DisposeDeferredTaskUPP(
    userUPP : DeferredTaskUPP);

external InvokeDeferredTaskUPP(
    dtParam : CLong,
    userUPP : DeferredTaskUPP);

record Struct_DeferredTask (
    qLink : QElemPtr,
    qType : Short,
    dtFlags : Short,
    dtAddr : DeferredTaskUPP,
    dtParam : CLong,
    dtReserved : CLong,
);

alias DeferredTask = Struct_DeferredTask;

alias DeferredTaskPtr = Pointer[DeferredTask];

record Struct_HFSUniStr255 (
    length : UShort,
    unicode : Array[UShort,255],
);

alias HFSUniStr255 = Struct_HFSUniStr255;

alias ConstHFSUniStr255Param = Pointer[HFSUniStr255];

alias fsCurPerm = 0;
alias fsRdPerm = 1;
alias fsWrPerm = 2;
alias fsRdWrPerm = 3;
alias fsRdWrShPerm = 4;

alias fsRdAccessPerm = 1;
alias fsWrAccessPerm = 2;
alias fsRdDenyPerm = 16;
alias fsWrDenyPerm = 32;

alias fsRtParID = 1;
alias fsRtDirID = 2;

alias fsAtMark = 0;
alias fsFromStart = 1;
alias fsFromLEOF = 2;
alias fsFromMark = 3;

alias kFSAllowConcurrentAsyncIOBit = 3;
alias kFSAllowConcurrentAsyncIOMask = 8;
alias kFSPleaseCacheBit = 4;
alias kFSPleaseCacheMask = 16;
alias kFSNoCacheBit = 5;
alias kFSNoCacheMask = 32;
alias kFSRdVerifyBit = 6;
alias kFSRdVerifyMask = 64;
alias kFSForceReadBit = 6;
alias kFSForceReadMask = 64;
alias kFSNewLineBit = 7;
alias kFSNewLineMask = 128;
alias kFSNewLineCharMask = 65280;

alias fsSBPartialName = 1;
alias fsSBFullName = 2;
alias fsSBFlAttrib = 4;
alias fsSBFlFndrInfo = 8;
alias fsSBFlLgLen = 32;
alias fsSBFlPyLen = 64;
alias fsSBFlRLgLen = 128;
alias fsSBFlRPyLen = 256;
alias fsSBFlCrDat = 512;
alias fsSBFlMdDat = 1024;
alias fsSBFlBkDat = 2048;
alias fsSBFlXFndrInfo = 4096;
alias fsSBFlParID = 8192;
alias fsSBNegate = 16384;
alias fsSBDrUsrWds = 8;
alias fsSBDrNmFls = 16;
alias fsSBDrCrDat = 512;
alias fsSBDrMdDat = 1024;
alias fsSBDrBkDat = 2048;
alias fsSBDrFndrInfo = 4096;
alias fsSBDrParID = 8192;
alias fsSBNodeID = 32768;
alias fsSBAttributeModDate = 65536;
alias fsSBAccessDate = 131072;
alias fsSBPermissions = 262144;
alias fsSBSkipPackageContents = 524288;
alias fsSBSkipHiddenItems = 1048576;
alias fsSBUserID = 2097152;
alias fsSBGroupID = 4194304;

alias fsSBPartialNameBit = 0;
alias fsSBFullNameBit = 1;
alias fsSBFlAttribBit = 2;
alias fsSBFlFndrInfoBit = 3;
alias fsSBFlLgLenBit = 5;
alias fsSBFlPyLenBit = 6;
alias fsSBFlRLgLenBit = 7;
alias fsSBFlRPyLenBit = 8;
alias fsSBFlCrDatBit = 9;
alias fsSBFlMdDatBit = 10;
alias fsSBFlBkDatBit = 11;
alias fsSBFlXFndrInfoBit = 12;
alias fsSBFlParIDBit = 13;
alias fsSBNegateBit = 14;
alias fsSBDrUsrWdsBit = 3;
alias fsSBDrNmFlsBit = 4;
alias fsSBDrCrDatBit = 9;
alias fsSBDrMdDatBit = 10;
alias fsSBDrBkDatBit = 11;
alias fsSBDrFndrInfoBit = 12;
alias fsSBDrParIDBit = 13;
alias fsSBNodeIDBit = 15;
alias fsSBAttributeModDateBit = 16;
alias fsSBAccessDateBit = 17;
alias fsSBPermissionsBit = 18;
alias fsSBSkipPackageContentsBit = 19;
alias fsSBSkipHiddenItemsBit = 20;
alias fsSBUserIDBit = 21;
alias fsSBGroupIDBit = 22;

alias bLimitFCBs = 31;
alias bLocalWList = 30;
alias bNoMiniFndr = 29;
alias bNoVNEdit = 28;
alias bNoLclSync = 27;
alias bTrshOffLine = 26;
alias bNoSwitchTo = 25;
alias bNoDeskItems = 20;
alias bNoBootBlks = 19;
alias bAccessCntl = 18;
alias bNoSysDir = 17;
alias bHasExtFSVol = 16;
alias bHasOpenDeny = 15;
alias bHasCopyFile = 14;
alias bHasMoveRename = 13;
alias bHasDesktopMgr = 12;
alias bHasShortName = 11;
alias bHasFolderLock = 10;
alias bHasPersonalAccessPrivileges = 9;
alias bHasUserGroupList = 8;
alias bHasCatSearch = 7;
alias bHasFileIDs = 6;
alias bHasBTreeMgr = 5;
alias bHasBlankAccessPrivileges = 4;
alias bSupportsAsyncRequests = 3;
alias bSupportsTrashVolumeCache = 2;

alias bHasDirectIO = 1;

alias bIsEjectable = 0;
alias bSupportsHFSPlusAPIs = 1;
alias bSupportsFSCatalogSearch = 2;
alias bSupportsFSExchangeObjects = 3;
alias bSupports2TBFiles = 4;
alias bSupportsLongNames = 5;
alias bSupportsMultiScriptNames = 6;
alias bSupportsNamedForks = 7;
alias bSupportsSubtreeIterators = 8;
alias bL2PCanMapFileBlocks = 9;
alias bParentModDateChanges = 10;
alias bAncestorModDateChanges = 11;
alias bSupportsSymbolicLinks = 13;
alias bIsAutoMounted = 14;
alias bAllowCDiDataHandler = 17;
alias bSupportsExclusiveLocks = 18;
alias bSupportsJournaling = 19;
alias bNoVolumeSizes = 20;
alias bIsOnInternalBus = 21;
alias bIsCaseSensitive = 22;
alias bIsCasePreserving = 23;
alias bDoNotDisplay = 24;
alias bIsRemovable = 25;
alias bNoRootTimes = 26;
alias bIsOnExternalBus = 27;
alias bSupportsExtendedFileSecurity = 28;

alias kWidePosOffsetBit = 8;
alias kUseWidePositioning = 256;
alias kMaximumBlocksIn4GB = 8388607;

alias fsUnixPriv = 1;

alias kNoUserAuthentication = 1;
alias kPassword = 2;
alias kEncryptPassword = 3;
alias kTwoWayEncryptPassword = 6;

alias knoUser = 0;
alias kadministratorUser = 1;

alias knoGroup = 0;

alias FSVolumeRefNum = Short;

alias FSIORefNum = Int;

alias kFSInvalidVolumeRefNum = 0;

record Struct_FSRef (
    hidden : Array[CUChar,80],
);

alias FSRef = Struct_FSRef;

alias FSRefPtr = Pointer[FSRef];

alias FSFileSecurityRef = OpaquePointer;

record Struct_CatPositionRec (
    initialize : Int,
    priv : Array[Short,6],
);

alias CatPositionRec = Struct_CatPositionRec;

record Struct_FSSpec (
    hidden : Array[CUChar,70],
);

alias FSSpec = Struct_FSSpec;

alias FSSpecPtr = Pointer[FSSpec];

alias FSSpecHandle = Pointer[FSSpecPtr];

alias FSSpecArrayPtr = FSSpecPtr;

alias ConstFSSpecPtr = Pointer[FSSpec];

alias ParamBlockRec = AUnionType;

alias ParmBlkPtr = RawPointer;

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

alias IOCompletionUPP = IOCompletionProcPtr;

record Struct_FSPermissionInfo (
    userID : UInt,
    groupID : UInt,
    reserved1 : CUChar,
    userAccess : CUChar,
    mode : UShort,
    fileSec : FSFileSecurityRef,
);

alias FSPermissionInfo = Struct_FSPermissionInfo;

alias FSCatalogInfoBitmap = UInt;

alias kFSCatInfoNone = 0;
alias kFSCatInfoTextEncoding = 1;
alias kFSCatInfoNodeFlags = 2;
alias kFSCatInfoVolume = 4;
alias kFSCatInfoParentDirID = 8;
alias kFSCatInfoNodeID = 16;
alias kFSCatInfoCreateDate = 32;
alias kFSCatInfoContentMod = 64;
alias kFSCatInfoAttrMod = 128;
alias kFSCatInfoAccessDate = 256;
alias kFSCatInfoBackupDate = 512;
alias kFSCatInfoPermissions = 1024;
alias kFSCatInfoFinderInfo = 2048;
alias kFSCatInfoFinderXInfo = 4096;
alias kFSCatInfoValence = 8192;
alias kFSCatInfoDataSizes = 16384;
alias kFSCatInfoRsrcSizes = 32768;
alias kFSCatInfoSharingFlags = 65536;
alias kFSCatInfoUserPrivs = 131072;
alias kFSCatInfoUserAccess = 524288;
alias kFSCatInfoSetOwnership = 1048576;
alias kFSCatInfoFSFileSecurityRef = 4194304;
alias kFSCatInfoAllDates = 992;
alias kFSCatInfoGettableInfo = 262143;
alias kFSCatInfoSettableInfo = 8163;
alias kFSCatInfoReserved = 4294705152;

alias kFSNodeLockedBit = 0;
alias kFSNodeLockedMask = 1;
alias kFSNodeResOpenBit = 2;
alias kFSNodeResOpenMask = 4;
alias kFSNodeDataOpenBit = 3;
alias kFSNodeDataOpenMask = 8;
alias kFSNodeIsDirectoryBit = 4;
alias kFSNodeIsDirectoryMask = 16;
alias kFSNodeCopyProtectBit = 6;
alias kFSNodeCopyProtectMask = 64;
alias kFSNodeForkOpenBit = 7;
alias kFSNodeForkOpenMask = 128;
alias kFSNodeHardLinkBit = 8;
alias kFSNodeHardLinkMask = 256;

alias kFSNodeInSharedBit = 2;
alias kFSNodeInSharedMask = 4;
alias kFSNodeIsMountedBit = 3;
alias kFSNodeIsMountedMask = 8;
alias kFSNodeIsSharePointBit = 5;
alias kFSNodeIsSharePointMask = 32;

record Struct_FSCatalogInfo (
    nodeFlags : UShort,
    volume : Short,
    parentDirID : UInt,
    nodeID : UInt,
    sharingFlags : CUChar,
    userPrivileges : CUChar,
    reserved1 : CUChar,
    reserved2 : CUChar,
    createDate : UTCDateTime,
    contentModDate : UTCDateTime,
    attributeModDate : UTCDateTime,
    accessDate : UTCDateTime,
    backupDate : UTCDateTime,
    permissions : FSPermissionInfo,
    finderInfo : Array[CUChar,16],
    extFinderInfo : Array[CUChar,16],
    dataLogicalSize : UInt64,
    dataPhysicalSize : UInt64,
    rsrcLogicalSize : UInt64,
    rsrcPhysicalSize : UInt64,
    valence : UInt,
    textEncodingHint : UInt,
);

alias FSCatalogInfo = Struct_FSCatalogInfo;

alias FSCatalogInfoPtr = Pointer[FSCatalogInfo];

record Struct_FSRefParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    ioNamePtr : ConstStringPtr,
    ioVRefNum : Short,
    reserved1 : Short,
    reserved2 : CUChar,
    reserved3 : CUChar,
    ref_ : Pointer[FSRef],
    whichInfo : UInt,
    catInfo : Pointer[FSCatalogInfo],
    nameLength : CULong,
    name : Pointer[UShort],
    ioDirID : UInt,
    spec : FSSpecPtr,
    parentRef : Pointer[FSRef],
    newRef : Pointer[FSRef],
    textEncodingHint : UInt,
    outName : Pointer[HFSUniStr255],
);

alias FSRefParam = Struct_FSRefParam;

alias FSRefParamPtr = Pointer[FSRefParam];

record Struct_FSRefForkIOParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    whichInfo : UInt,
    catInfo : Pointer[FSCatalogInfo],
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    permissions : CChar,
    reserved1 : CUChar,
    forkRefNum : Int,
    newRef : Pointer[FSRef],
);

alias FSRefForkIOParam = Struct_FSRefForkIOParam;

alias FSRefForkIOParamPtr = Pointer[FSRefForkIOParam];

alias FSIterator = OpaquePointer;

alias kFSIterateFlat = 0;
alias kFSIterateSubtree = 1;
alias kFSIterateDelete = 2;
alias kFSIterateReserved = 4294967292;

alias FSIteratorFlags = UInt;

record Struct_FSSearchParams (
    searchTime : Int,
    searchBits : UInt,
    searchNameLength : CULong,
    searchName : Pointer[UShort],
    searchInfo1 : Pointer[FSCatalogInfo],
    searchInfo2 : Pointer[FSCatalogInfo],
);

alias FSSearchParams = Struct_FSSearchParams;

alias FSSearchParamsPtr = Pointer[FSSearchParams];

record Struct_FSCatalogBulkParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    containerChanged : CUChar,
    reserved : CUChar,
    iteratorFlags : UInt,
    iterator : FSIterator,
    container : Pointer[FSRef],
    maximumItems : CULong,
    actualItems : CULong,
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    refs : Pointer[FSRef],
    specs : FSSpecPtr,
    names : Pointer[HFSUniStr255],
    searchParams : Pointer[FSSearchParams],
);

alias FSCatalogBulkParam = Struct_FSCatalogBulkParam;

alias FSCatalogBulkParamPtr = Pointer[FSCatalogBulkParam];

alias FSAllocationFlags = UShort;

alias kFSAllocDefaultFlags = 0;
alias kFSAllocAllOrNothingMask = 1;
alias kFSAllocContiguousMask = 2;
alias kFSAllocNoRoundUpMask = 4;
alias kFSAllocReservedMask = 65528;

record Struct_FSForkIOParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    reserved1 : RawPointer,
    reserved2 : Short,
    forkRefNum : Int,
    reserved3 : CUChar,
    permissions : CChar,
    ref_ : Pointer[FSRef],
    buffer : Ptr,
    requestCount : UInt,
    actualCount : UInt,
    positionMode : UShort,
    positionOffset : Int64,
    allocationFlags : UShort,
    allocationAmount : UInt64,
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    forkIterator : CatPositionRec,
    outForkName : Pointer[HFSUniStr255],
);

alias FSForkIOParam = Struct_FSForkIOParam;

alias FSForkIOParamPtr = Pointer[FSForkIOParam];

alias FSForkInfoFlags = CUChar;

record Struct_FSForkInfo (
    flags : CUChar,
    permissions : CChar,
    volume : Short,
    reserved2 : UInt,
    nodeID : UInt,
    forkID : UInt,
    currentPosition : UInt64,
    logicalEOF : UInt64,
    physicalEOF : UInt64,
    process : UInt64,
);

alias FSForkInfo = Struct_FSForkInfo;

alias FSForkInfoPtr = Pointer[FSForkInfo];

record Struct_FSForkCBInfoParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    desiredRefNum : Int,
    volumeRefNum : Short,
    iterator : Int,
    actualRefNum : Short,
    ref_ : Pointer[FSRef],
    forkInfo : Pointer[FSForkInfo],
    forkName : Pointer[HFSUniStr255],
);

alias FSForkCBInfoParam = Struct_FSForkCBInfoParam;

alias FSForkCBInfoParamPtr = Pointer[FSForkCBInfoParam];

record Struct_FSRangeLockParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    forkRefNum : Int,
    requestCount : UInt64,
    positionMode : UShort,
    positionOffset : Int64,
    rangeStart : UInt64,
);

alias FSRangeLockParam = Struct_FSRangeLockParam;

alias FSRangeLockParamPtr = Pointer[FSRangeLockParam];

alias FSVolumeInfoBitmap = UInt;

alias kFSVolInfoNone = 0;
alias kFSVolInfoCreateDate = 1;
alias kFSVolInfoModDate = 2;
alias kFSVolInfoBackupDate = 4;
alias kFSVolInfoCheckedDate = 8;
alias kFSVolInfoFileCount = 16;
alias kFSVolInfoDirCount = 32;
alias kFSVolInfoSizes = 64;
alias kFSVolInfoBlocks = 128;
alias kFSVolInfoNextAlloc = 256;
alias kFSVolInfoRsrcClump = 512;
alias kFSVolInfoDataClump = 1024;
alias kFSVolInfoNextID = 2048;
alias kFSVolInfoFinderInfo = 4096;
alias kFSVolInfoFlags = 8192;
alias kFSVolInfoFSInfo = 16384;
alias kFSVolInfoDriveInfo = 32768;
alias kFSVolInfoGettableInfo = 65535;
alias kFSVolInfoSettableInfo = 12292;

alias kFSVolFlagDefaultVolumeBit = 5;
alias kFSVolFlagDefaultVolumeMask = 32;
alias kFSVolFlagFilesOpenBit = 6;
alias kFSVolFlagFilesOpenMask = 64;
alias kFSVolFlagHardwareLockedBit = 7;
alias kFSVolFlagHardwareLockedMask = 128;
alias kFSVolFlagJournalingActiveBit = 14;
alias kFSVolFlagJournalingActiveMask = 16384;
alias kFSVolFlagSoftwareLockedBit = 15;
alias kFSVolFlagSoftwareLockedMask = 32768;

record Struct_FSVolumeInfo (
    createDate : UTCDateTime,
    modifyDate : UTCDateTime,
    backupDate : UTCDateTime,
    checkedDate : UTCDateTime,
    fileCount : UInt,
    folderCount : UInt,
    totalBytes : UInt64,
    freeBytes : UInt64,
    blockSize : UInt,
    totalBlocks : UInt,
    freeBlocks : UInt,
    nextAllocation : UInt,
    rsrcClumpSize : UInt,
    dataClumpSize : UInt,
    nextCatalogID : UInt,
    finderInfo : Array[CUChar,32],
    flags : UShort,
    filesystemID : UShort,
    signature : UShort,
    driveNumber : UShort,
    driverRefNum : Int,
);

alias FSVolumeInfo = Struct_FSVolumeInfo;

alias FSVolumeInfoPtr = Pointer[FSVolumeInfo];

record Struct_FSVolumeInfoParam (
    qLink : QElemPtr,
    qType : Short,
    ioTrap : Short,
    ioCmdAddr : Ptr,
    ioCompletion : IOCompletionUPP,
    ioResult : Short,
    ioNamePtr : StringPtr,
    ioVRefNum : Short,
    volumeIndex : UInt,
    whichInfo : UInt,
    volumeInfo : Pointer[FSVolumeInfo],
    volumeName : Pointer[HFSUniStr255],
    ref_ : Pointer[FSRef],
);

alias FSVolumeInfoParam = Struct_FSVolumeInfoParam;

alias FSVolumeInfoParamPtr = Pointer[FSVolumeInfoParam];

record Struct_GetVolParmsInfoBuffer (
    vMVersion : Short,
    vMAttrib : Int,
    vMLocalHand : Handle,
    vMServerAdr : Int,
    vMVolumeGrade : Int,
    vMForeignPrivID : Short,
    vMExtendedAttributes : Int,
    vMDeviceID : RawPointer,
    vMMaxNameLength : CULong,
);

alias GetVolParmsInfoBuffer = Struct_GetVolParmsInfoBuffer;

alias VolumeType = UInt;

alias AppleShareMediaType = 1634103405;

record Struct_VolMountInfoHeader (
    length : Short,
    media : UInt,
);

alias VolMountInfoHeader = Struct_VolMountInfoHeader;

alias VolMountInfoPtr = Pointer[VolMountInfoHeader];

record Struct_VolumeMountInfoHeader (
    length : Short,
    media : UInt,
    flags : Short,
);

alias VolumeMountInfoHeader = Struct_VolumeMountInfoHeader;

alias VolumeMountInfoHeaderPtr = Pointer[VolumeMountInfoHeader];

alias volMountNoLoginMsgFlagBit = 0;
alias volMountNoLoginMsgFlagMask = 1;
alias volMountExtendedFlagsBit = 7;
alias volMountExtendedFlagsMask = 128;
alias volMountInteractBit = 15;
alias volMountInteractMask = 32768;
alias volMountChangedBit = 14;
alias volMountChangedMask = 16384;
alias volMountFSReservedMask = 255;
alias volMountSysReservedMask = 65280;

record Struct_AFPVolMountInfo (
    length : Short,
    media : UInt,
    flags : Short,
    nbpInterval : CChar,
    nbpCount : CChar,
    uamType : Short,
    zoneNameOffset : Short,
    serverNameOffset : Short,
    volNameOffset : Short,
    userNameOffset : Short,
    userPasswordOffset : Short,
    volPasswordOffset : Short,
    AFPData : Array[CChar,144],
);

alias AFPVolMountInfo = Struct_AFPVolMountInfo;

alias AFPVolMountInfoPtr = Pointer[AFPVolMountInfo];

record Struct_AFPXVolMountInfo (
    length : Short,
    media : UInt,
    flags : Short,
    nbpInterval : CChar,
    nbpCount : CChar,
    uamType : Short,
    zoneNameOffset : Short,
    serverNameOffset : Short,
    volNameOffset : Short,
    userNameOffset : Short,
    userPasswordOffset : Short,
    volPasswordOffset : Short,
    extendedFlags : Short,
    uamNameOffset : Short,
    alternateAddressOffset : Short,
    AFPData : Array[CChar,176],
);

alias AFPXVolMountInfo = Struct_AFPXVolMountInfo;

alias AFPXVolMountInfoPtr = Pointer[AFPXVolMountInfo];

alias kAFPExtendedFlagsAlternateAddressMask = 1;

alias kAFPTagTypeIP = 1;
alias kAFPTagTypeIPPort = 2;
alias kAFPTagTypeDDP = 3;
alias kAFPTagTypeDNS = 4;

alias kAFPTagLengthIP = 6;
alias kAFPTagLengthIPPort = 8;
alias kAFPTagLengthDDP = 6;

record Struct_AFPTagData (
    fLength : CUChar,
    fType : CUChar,
    fData : Array[CUChar,1],
);

alias AFPTagData = Struct_AFPTagData;

record Struct_AFPAlternateAddress (
    fVersion : CUChar,
    fAddressCount : CUChar,
    fAddressList : Array[CUChar,1],
);

alias AFPAlternateAddress = Struct_AFPAlternateAddress;

alias kLargeIconSize = 256;
alias kLarge4BitIconSize = 512;
alias kLarge8BitIconSize = 1024;
alias kSmallIconSize = 64;
alias kSmall4BitIconSize = 128;
alias kSmall8BitIconSize = 256;

external NewIOCompletionUPP(
    userRoutine : IOCompletionProcPtr) : IOCompletionUPP;

external DisposeIOCompletionUPP(
    userUPP : IOCompletionUPP);

external InvokeIOCompletionUPP(
    paramBlock : ParmBlkPtr,
    userUPP : IOCompletionUPP);

external FSMakeFSRefUnicode(
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    textEncodingHint : UInt,
    newRef : Pointer[FSRef]) : Short;

external PBMakeFSRefUnicodeSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBMakeFSRefUnicodeAsync(
    paramBlock : Pointer[FSRefParam]);

external FSCompareFSRefs(
    ref1 : Pointer[FSRef],
    ref2 : Pointer[FSRef]) : Short;

external PBCompareFSRefsSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBCompareFSRefsAsync(
    paramBlock : Pointer[FSRefParam]);

external FSCreateFileUnicode(
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    newRef : Pointer[FSRef],
    newSpec : FSSpecPtr) : Short;

external PBCreateFileUnicodeSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBCreateFileUnicodeAsync(
    paramBlock : Pointer[FSRefParam]);

external FSCreateDirectoryUnicode(
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    newRef : Pointer[FSRef],
    newSpec : FSSpecPtr,
    newDirID : Pointer[UInt]) : Short;

external PBCreateDirectoryUnicodeSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBCreateDirectoryUnicodeAsync(
    paramBlock : Pointer[FSRefParam]);

external FSDeleteObject(
    ref_ : Pointer[FSRef]) : Short;

external PBDeleteObjectSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBDeleteObjectAsync(
    paramBlock : Pointer[FSRefParam]);

external FSUnlinkObject(
    ref_ : Pointer[FSRef]) : Short;

external PBUnlinkObjectSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBUnlinkObjectAsync(
    paramBlock : Pointer[FSRefParam]);

external FSMoveObject(
    ref_ : Pointer[FSRef],
    destDirectory : Pointer[FSRef],
    newRef : Pointer[FSRef]) : Short;

external PBMoveObjectSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBMoveObjectAsync(
    paramBlock : Pointer[FSRefParam]);

external FSExchangeObjects(
    ref_ : Pointer[FSRef],
    destRef : Pointer[FSRef]) : Short;

external PBExchangeObjectsSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBExchangeObjectsAsync(
    paramBlock : Pointer[FSRefParam]);

alias kFSReplaceObjectDefaultOptions = 0;
alias kFSReplaceObjectReplaceMetadata = 1;
alias kFSReplaceObjectSaveOriginalAsABackup = 2;
alias kFSReplaceObjectReplacePermissionInfo = 4;
alias kFSReplaceObjectPreservePermissionInfo = 8;
alias kFSReplaceObjectDoNotCheckObjectWriteAccess = 16;

external FSReplaceObject(
    originalObject : Pointer[FSRef],
    replacementObject : Pointer[FSRef],
    newName : CFStringRef,
    temporaryName : CFStringRef,
    temporaryDirectory : Pointer[FSRef],
    flags : UInt,
    resultObject : Pointer[FSRef]) : Int;

external FSPathReplaceObject(
    originalObjectPath : Pointer[CChar],
    replacementObjectPath : Pointer[CChar],
    newName : CFStringRef,
    temporaryName : CFStringRef,
    temporaryDirectoryPath : Pointer[CChar],
    flags : UInt) : Int;

external FSGetTemporaryDirectoryForReplaceObject(
    originalObject : Pointer[FSRef],
    temporaryDirectory : Pointer[FSRef],
    flags : UInt) : Int;

external FSPathGetTemporaryDirectoryForReplaceObject(
    originalObjectPath : Pointer[CChar],
    temporaryDirectoryPath : Pointer[CChar],
    maxPathSize : UInt,
    flags : UInt) : Int;

external FSRenameUnicode(
    ref_ : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    textEncodingHint : UInt,
    newRef : Pointer[FSRef]) : Short;

external PBRenameUnicodeSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBRenameUnicodeAsync(
    paramBlock : Pointer[FSRefParam]);

external FSGetCatalogInfo(
    ref_ : Pointer[FSRef],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    outName : Pointer[HFSUniStr255],
    fsSpec : FSSpecPtr,
    parentRef : Pointer[FSRef]) : Short;

external PBGetCatalogInfoSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBGetCatalogInfoAsync(
    paramBlock : Pointer[FSRefParam]);

external FSSetCatalogInfo(
    ref_ : Pointer[FSRef],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo]) : Short;

external PBSetCatalogInfoSync(
    paramBlock : Pointer[FSRefParam]) : Short;

external PBSetCatalogInfoAsync(
    paramBlock : Pointer[FSRefParam]);

external FSOpenIterator(
    container : Pointer[FSRef],
    iteratorFlags : UInt,
    iterator : Pointer[FSIterator]) : Short;

external PBOpenIteratorSync(
    paramBlock : Pointer[FSCatalogBulkParam]) : Short;

external PBOpenIteratorAsync(
    paramBlock : Pointer[FSCatalogBulkParam]);

external FSCloseIterator(
    iterator : FSIterator) : Short;

external PBCloseIteratorSync(
    paramBlock : Pointer[FSCatalogBulkParam]) : Short;

external PBCloseIteratorAsync(
    paramBlock : Pointer[FSCatalogBulkParam]);

external FSGetCatalogInfoBulk(
    iterator : FSIterator,
    maximumObjects : CULong,
    actualObjects : Pointer[CULong],
    containerChanged : Pointer[CUChar],
    whichInfo : UInt,
    catalogInfos : Pointer[FSCatalogInfo],
    refs : Pointer[FSRef],
    specs : FSSpecPtr,
    names : Pointer[HFSUniStr255]) : Short;

external PBGetCatalogInfoBulkSync(
    paramBlock : Pointer[FSCatalogBulkParam]) : Short;

external PBGetCatalogInfoBulkAsync(
    paramBlock : Pointer[FSCatalogBulkParam]);

external FSCatalogSearch(
    iterator : FSIterator,
    searchCriteria : Pointer[FSSearchParams],
    maximumObjects : CULong,
    actualObjects : Pointer[CULong],
    containerChanged : Pointer[CUChar],
    whichInfo : UInt,
    catalogInfos : Pointer[FSCatalogInfo],
    refs : Pointer[FSRef],
    specs : FSSpecPtr,
    names : Pointer[HFSUniStr255]) : Short;

external PBCatalogSearchSync(
    paramBlock : Pointer[FSCatalogBulkParam]) : Short;

external PBCatalogSearchAsync(
    paramBlock : Pointer[FSCatalogBulkParam]);

external FSCreateFileAndOpenForkUnicode(
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    permissions : CChar,
    forkRefNum : Pointer[Int],
    newRef : Pointer[FSRef]) : Int;

external PBCreateFileAndOpenForkUnicodeSync(
    paramBlock : FSRefForkIOParamPtr) : Int;

external PBCreateFileAndOpenForkUnicodeAsync(
    paramBlock : FSRefForkIOParamPtr);

external FSCreateFork(
    ref_ : Pointer[FSRef],
    forkNameLength : CULong,
    forkName : Pointer[UShort]) : Short;

external PBCreateForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBCreateForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSDeleteFork(
    ref_ : Pointer[FSRef],
    forkNameLength : CULong,
    forkName : Pointer[UShort]) : Short;

external PBDeleteForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBDeleteForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSIterateForks(
    ref_ : Pointer[FSRef],
    forkIterator : Pointer[CatPositionRec],
    forkName : Pointer[HFSUniStr255],
    forkSize : Pointer[Int64],
    forkPhysicalSize : Pointer[UInt64]) : Short;

external PBIterateForksSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBIterateForksAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSOpenFork(
    ref_ : Pointer[FSRef],
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    permissions : CChar,
    forkRefNum : Pointer[Int]) : Short;

external PBOpenForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBOpenForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSReadFork(
    forkRefNum : Int,
    positionMode : UShort,
    positionOffset : Int64,
    requestCount : CULong,
    buffer : RawPointer,
    actualCount : Pointer[CULong]) : Short;

external PBReadForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBReadForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSWriteFork(
    forkRefNum : Int,
    positionMode : UShort,
    positionOffset : Int64,
    requestCount : CULong,
    buffer : RawPointer,
    actualCount : Pointer[CULong]) : Short;

external PBWriteForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBWriteForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSGetForkPosition(
    forkRefNum : Int,
    position : Pointer[Int64]) : Short;

external PBGetForkPositionSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBGetForkPositionAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSSetForkPosition(
    forkRefNum : Int,
    positionMode : UShort,
    positionOffset : Int64) : Short;

external PBSetForkPositionSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBSetForkPositionAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSGetForkSize(
    forkRefNum : Int,
    forkSize : Pointer[Int64]) : Short;

external PBGetForkSizeSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBGetForkSizeAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSSetForkSize(
    forkRefNum : Int,
    positionMode : UShort,
    positionOffset : Int64) : Short;

external PBSetForkSizeSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBSetForkSizeAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSAllocateFork(
    forkRefNum : Int,
    flags : UShort,
    positionMode : UShort,
    positionOffset : Int64,
    requestCount : UInt64,
    actualCount : Pointer[UInt64]) : Short;

external PBAllocateForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBAllocateForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSFlushFork(
    forkRefNum : Int) : Short;

external PBFlushForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBFlushForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSCloseFork(
    forkRefNum : Int) : Short;

external PBCloseForkSync(
    paramBlock : Pointer[FSForkIOParam]) : Short;

external PBCloseForkAsync(
    paramBlock : Pointer[FSForkIOParam]);

external FSGetForkCBInfo(
    desiredRefNum : Int,
    volume : Short,
    iterator : Pointer[Short],
    actualRefNum : Pointer[Int],
    forkInfo : Pointer[FSForkInfo],
    ref_ : Pointer[FSRef],
    outForkName : Pointer[HFSUniStr255]) : Short;

external PBGetForkCBInfoSync(
    paramBlock : Pointer[FSForkCBInfoParam]) : Short;

external PBGetForkCBInfoAsync(
    paramBlock : Pointer[FSForkCBInfoParam]);

external FSLockRange(
    forkRefNum : Int,
    positionMode : UShort,
    positionOffset : Int64,
    requestCount : UInt64,
    rangeStart : Pointer[UInt64]) : Int;

external PBXLockRangeSync(
    paramBlock : FSRangeLockParamPtr) : Int;

external PBXLockRangeAsync(
    paramBlock : FSRangeLockParamPtr) : Int;

external FSUnlockRange(
    forkRefNum : Int,
    positionMode : UShort,
    positionOffset : Int64,
    requestCount : UInt64,
    rangeStart : Pointer[UInt64]) : Int;

external PBXUnlockRangeSync(
    paramBlock : FSRangeLockParamPtr) : Int;

external PBXUnlockRangeAsync(
    paramBlock : FSRangeLockParamPtr) : Int;

external FSGetVolumeInfo(
    volume : Short,
    volumeIndex : CULong,
    actualVolume : Pointer[Short],
    whichInfo : UInt,
    info : Pointer[FSVolumeInfo],
    volumeName : Pointer[HFSUniStr255],
    rootDirectory : Pointer[FSRef]) : Short;

external PBGetVolumeInfoSync(
    paramBlock : Pointer[FSVolumeInfoParam]) : Short;

external PBGetVolumeInfoAsync(
    paramBlock : Pointer[FSVolumeInfoParam]);

external FSSetVolumeInfo(
    volume : Short,
    whichInfo : UInt,
    info : Pointer[FSVolumeInfo]) : Short;

external PBSetVolumeInfoSync(
    paramBlock : Pointer[FSVolumeInfoParam]) : Short;

external PBSetVolumeInfoAsync(
    paramBlock : Pointer[FSVolumeInfoParam]);

external FSGetDataForkName(
    dataForkName : Pointer[HFSUniStr255]) : Short;

external FSGetResourceForkName(
    resourceForkName : Pointer[HFSUniStr255]) : Short;

external FSRefMakePath(
    ref_ : Pointer[FSRef],
    path : Pointer[CUChar],
    pathBufferSize : UInt) : Int;

external FSPathMakeRef(
    path : Pointer[CUChar],
    ref_ : Pointer[FSRef],
    isDirectory : Pointer[CUChar]) : Int;

alias kFSPathMakeRefDefaultOptions = 0;
alias kFSPathMakeRefDoNotFollowLeafSymlink = 1;

external FSPathMakeRefWithOptions(
    path : Pointer[CUChar],
    options : UInt,
    ref_ : Pointer[FSRef],
    isDirectory : Pointer[CUChar]) : Int;

external FSIsFSRefValid(
    ref_ : Pointer[FSRef]) : CUChar;

alias FNMessage = UInt;

alias kFNDirectoryModifiedMessage = 1;

external FNNotify(
    ref_ : Pointer[FSRef],
    message : UInt,
    flags : UInt) : Int;

external FNNotifyByPath(
    path : Pointer[CUChar],
    message : UInt,
    flags : UInt) : Int;

external FNNotifyAll(
    message : UInt,
    flags : UInt) : Int;

alias FNSubscriptionRef = OpaquePointer;

alias kFNNoImplicitAllSubscription = 1;
alias kFNNotifyInBackground = 2;

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

alias FNSubscriptionUPP = FNSubscriptionProcPtr;

external NewFNSubscriptionUPP(
    userRoutine : FNSubscriptionProcPtr) : FNSubscriptionUPP;

external DisposeFNSubscriptionUPP(
    userUPP : FNSubscriptionUPP);

external InvokeFNSubscriptionUPP(
    message : UInt,
    flags : UInt,
    refcon : RawPointer,
    subscription : FNSubscriptionRef,
    userUPP : FNSubscriptionUPP);

external FNSubscribe(
    directoryRef : Pointer[FSRef],
    callback : FNSubscriptionUPP,
    refcon : RawPointer,
    flags : UInt,
    subscription : Pointer[FNSubscriptionRef]) : Int;

external FNSubscribeByPath(
    directoryPath : Pointer[CUChar],
    callback : FNSubscriptionUPP,
    refcon : RawPointer,
    flags : UInt,
    subscription : Pointer[FNSubscriptionRef]) : Int;

external FNUnsubscribe(
    subscription : FNSubscriptionRef) : Int;

external FNGetDirectoryForSubscription(
    subscription : FNSubscriptionRef,
    ref_ : Pointer[FSRef]) : Int;

alias kAsyncMountInProgress = 1;
alias kAsyncMountComplete = 2;
alias kAsyncUnmountInProgress = 3;
alias kAsyncUnmountComplete = 4;
alias kAsyncEjectInProgress = 5;
alias kAsyncEjectComplete = 6;

alias FSMountStatus = UInt;

alias FSEjectStatus = UInt;

alias FSUnmountStatus = UInt;

alias FSVolumeOperation = OpaquePointer;

alias FSVolumeMountProcPtr = CCodePointer[[OpaquePointer,RawPointer,Int,Short],[]];

alias FSVolumeUnmountProcPtr = CCodePointer[[OpaquePointer,RawPointer,Int,Short,Int],[]];

alias FSVolumeEjectProcPtr = CCodePointer[[OpaquePointer,RawPointer,Int,Short,Int],[]];

alias FSVolumeMountUPP = FSVolumeMountProcPtr;

alias FSVolumeUnmountUPP = FSVolumeUnmountProcPtr;

alias FSVolumeEjectUPP = FSVolumeEjectProcPtr;

external NewFSVolumeMountUPP(
    userRoutine : FSVolumeMountProcPtr) : FSVolumeMountUPP;

external NewFSVolumeUnmountUPP(
    userRoutine : FSVolumeUnmountProcPtr) : FSVolumeUnmountUPP;

external NewFSVolumeEjectUPP(
    userRoutine : FSVolumeEjectProcPtr) : FSVolumeEjectUPP;

external DisposeFSVolumeMountUPP(
    userUPP : FSVolumeMountUPP);

external DisposeFSVolumeUnmountUPP(
    userUPP : FSVolumeUnmountUPP);

external DisposeFSVolumeEjectUPP(
    userUPP : FSVolumeEjectUPP);

external InvokeFSVolumeMountUPP(
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    err : Int,
    mountedVolumeRefNum : Short,
    userUPP : FSVolumeMountUPP);

external InvokeFSVolumeUnmountUPP(
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    err : Int,
    volumeRefNum : Short,
    dissenter : Int,
    userUPP : FSVolumeUnmountUPP);

external InvokeFSVolumeEjectUPP(
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    err : Int,
    volumeRefNum : Short,
    dissenter : Int,
    userUPP : FSVolumeEjectUPP);

alias kFSMountServerMarkDoNotDisplay = 1;
alias kFSMountServerMountOnMountDir = 4;

alias kFSMountServerMountWithoutNotification = 2;

alias kFSEjectVolumeForceEject = 1;

alias kFSUnmountVolumeForceUnmount = 1;

external FSCreateVolumeOperation(
    volumeOp : Pointer[FSVolumeOperation]) : Int;

external FSDisposeVolumeOperation(
    volumeOp : FSVolumeOperation) : Int;

external FSMountLocalVolumeSync(
    diskID : CFStringRef,
    mountDir : CFURLRef,
    mountedVolumeRefNum : Pointer[Short],
    flags : UInt) : Int;

external FSMountLocalVolumeAsync(
    diskID : CFStringRef,
    mountDir : CFURLRef,
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    flags : UInt,
    callback : FSVolumeMountUPP,
    runloop : CFRunLoopRef,
    runloopMode : CFStringRef) : Int;

external FSMountServerVolumeSync(
    url : CFURLRef,
    mountDir : CFURLRef,
    user : CFStringRef,
    password : CFStringRef,
    mountedVolumeRefNum : Pointer[Short],
    flags : UInt) : Int;

external FSMountServerVolumeAsync(
    url : CFURLRef,
    mountDir : CFURLRef,
    user : CFStringRef,
    password : CFStringRef,
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    flags : UInt,
    callback : FSVolumeMountUPP,
    runloop : CFRunLoopRef,
    runloopMode : CFStringRef) : Int;

external FSGetAsyncMountStatus(
    volumeOp : FSVolumeOperation,
    status : Pointer[UInt],
    volumeOpStatus : Pointer[Int],
    mountedVolumeRefNum : Pointer[Short],
    clientData : Pointer[RawPointer]) : Int;

external FSUnmountVolumeSync(
    vRefNum : Short,
    flags : UInt,
    dissenter : Pointer[Int]) : Int;

external FSUnmountVolumeAsync(
    vRefNum : Short,
    flags : UInt,
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    callback : FSVolumeUnmountUPP,
    runloop : CFRunLoopRef,
    runloopMode : CFStringRef) : Int;

external FSGetAsyncUnmountStatus(
    volumeOp : FSVolumeOperation,
    status : Pointer[UInt],
    volumeOpStatus : Pointer[Int],
    volumeRefNum : Pointer[Short],
    dissenter : Pointer[Int],
    clientData : Pointer[RawPointer]) : Int;

external FSCancelVolumeOperation(
    volumeOp : FSVolumeOperation) : Int;

external FSEjectVolumeSync(
    vRefNum : Short,
    flags : UInt,
    dissenter : Pointer[Int]) : Int;

external FSEjectVolumeAsync(
    vRefNum : Short,
    flags : UInt,
    volumeOp : FSVolumeOperation,
    clientData : RawPointer,
    callback : FSVolumeEjectUPP,
    runloop : CFRunLoopRef,
    runloopMode : CFStringRef) : Int;

external FSGetAsyncEjectStatus(
    volumeOp : FSVolumeOperation,
    status : Pointer[UInt],
    volumeOpStatus : Pointer[Int],
    volumeRefNum : Pointer[Short],
    dissenter : Pointer[Int],
    clientData : Pointer[RawPointer]) : Int;

external FSCopyDiskIDForVolume(
    vRefNum : Short,
    diskID : Pointer[CFStringRef]) : Int;

external FSCopyURLForVolume(
    vRefNum : Short,
    url : Pointer[CFURLRef]) : Int;

external FSGetVolumeForDiskID(
    diskID : CFStringRef,
    vRefNum : Pointer[Short]) : Int;

external FSCopyDADiskForVolume(
    vRefNum : Short,
    disk : Pointer[DADiskRef]) : Int;

external FSGetVolumeForDADisk(
    disk : DADiskRef,
    vRefNum : Pointer[Short]) : Int;

alias FSFileOperationRef = OpaquePointer;

alias FSFileOperationStage = UInt;

record Struct_FSFileOperationClientContext (
    version : CLong,
    info : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
    copyDescription : CFAllocatorCopyDescriptionCallBack,
);

alias FSFileOperationClientContext = Struct_FSFileOperationClientContext;

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

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

alias kFSFileOperationDefaultOptions = 0;
alias kFSFileOperationOverwrite = 1;
alias kFSFileOperationSkipSourcePermissionErrors = 2;
alias kFSFileOperationDoNotMoveAcrossVolumes = 4;
alias kFSFileOperationSkipPreflight = 8;

alias kFSOperationStageUndefined = 0;
alias kFSOperationStagePreflighting = 1;
alias kFSOperationStageRunning = 2;
alias kFSOperationStageComplete = 3;

external kFSOperationTotalBytesKey : CFStringRef;

external kFSOperationBytesCompleteKey : CFStringRef;

external kFSOperationBytesRemainingKey : CFStringRef;

external kFSOperationTotalObjectsKey : CFStringRef;

external kFSOperationObjectsCompleteKey : CFStringRef;

external kFSOperationObjectsRemainingKey : CFStringRef;

external kFSOperationTotalUserVisibleObjectsKey : CFStringRef;

external kFSOperationUserVisibleObjectsCompleteKey : CFStringRef;

external kFSOperationUserVisibleObjectsRemainingKey : CFStringRef;

external kFSOperationThroughputKey : CFStringRef;

external FSCopyObjectSync(
    source : Pointer[FSRef],
    destDir : Pointer[FSRef],
    destName : CFStringRef,
    target : Pointer[FSRef],
    options : UInt) : Int;

external FSMoveObjectSync(
    source : Pointer[FSRef],
    destDir : Pointer[FSRef],
    destName : CFStringRef,
    target : Pointer[FSRef],
    options : UInt) : Int;

external FSMoveObjectToTrashSync(
    source : Pointer[FSRef],
    target : Pointer[FSRef],
    options : UInt) : Int;

external FSPathCopyObjectSync(
    sourcePath : Pointer[CChar],
    destDirPath : Pointer[CChar],
    destName : CFStringRef,
    targetPath : Pointer[Pointer[CChar]],
    options : UInt) : Int;

external FSPathMoveObjectSync(
    sourcePath : Pointer[CChar],
    destDirPath : Pointer[CChar],
    destName : CFStringRef,
    targetPath : Pointer[Pointer[CChar]],
    options : UInt) : Int;

external FSPathMoveObjectToTrashSync(
    sourcePath : Pointer[CChar],
    targetPath : Pointer[Pointer[CChar]],
    options : UInt) : Int;

external FSFileOperationGetTypeID() : CULong;

external FSFileOperationCreate(
    alloc : CFAllocatorRef) : FSFileOperationRef;

external FSFileOperationScheduleWithRunLoop(
    fileOp : FSFileOperationRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef) : Int;

external FSFileOperationUnscheduleFromRunLoop(
    fileOp : FSFileOperationRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef) : Int;

external FSCopyObjectAsync(
    fileOp : FSFileOperationRef,
    source : Pointer[FSRef],
    destDir : Pointer[FSRef],
    destName : CFStringRef,
    flags : UInt,
    callback : FSFileOperationStatusProcPtr,
    statusChangeInterval : Double,
    clientContext : Pointer[FSFileOperationClientContext]) : Int;

external FSMoveObjectAsync(
    fileOp : FSFileOperationRef,
    source : Pointer[FSRef],
    destDir : Pointer[FSRef],
    destName : CFStringRef,
    flags : UInt,
    callback : FSFileOperationStatusProcPtr,
    statusChangeInterval : Double,
    clientContext : Pointer[FSFileOperationClientContext]) : Int;

external FSMoveObjectToTrashAsync(
    fileOp : FSFileOperationRef,
    source : Pointer[FSRef],
    flags : UInt,
    callback : FSFileOperationStatusProcPtr,
    statusChangeInterval : Double,
    clientContext : Pointer[FSFileOperationClientContext]) : Int;

external FSPathCopyObjectAsync(
    fileOp : FSFileOperationRef,
    sourcePath : Pointer[CChar],
    destDirPath : Pointer[CChar],
    destName : CFStringRef,
    flags : UInt,
    callback : FSPathFileOperationStatusProcPtr,
    statusChangeInterval : Double,
    clientContext : Pointer[FSFileOperationClientContext]) : Int;

external FSPathMoveObjectAsync(
    fileOp : FSFileOperationRef,
    sourcePath : Pointer[CChar],
    destDirPath : Pointer[CChar],
    destName : CFStringRef,
    flags : UInt,
    callback : FSPathFileOperationStatusProcPtr,
    statusChangeInterval : Double,
    clientContext : Pointer[FSFileOperationClientContext]) : Int;

external FSPathMoveObjectToTrashAsync(
    fileOp : FSFileOperationRef,
    sourcePath : Pointer[CChar],
    flags : UInt,
    callback : FSPathFileOperationStatusProcPtr,
    statusChangeInterval : Double,
    clientContext : Pointer[FSFileOperationClientContext]) : Int;

external FSFileOperationCancel(
    fileOp : FSFileOperationRef) : Int;

external FSFileOperationCopyStatus(
    fileOp : FSFileOperationRef,
    currentItem : Pointer[FSRef],
    stage : Pointer[UInt],
    error : Pointer[Int],
    statusDictionary : Pointer[CFDictionaryRef],
    info : Pointer[RawPointer]) : Int;

external FSPathFileOperationCopyStatus(
    fileOp : FSFileOperationRef,
    currentItem : Pointer[Pointer[CChar]],
    stage : Pointer[UInt],
    error : Pointer[Int],
    statusDictionary : Pointer[CFDictionaryRef],
    info : Pointer[RawPointer]) : Int;

external FSCreateStringFromHFSUniStr(
    alloc : CFAllocatorRef,
    uniStr : Pointer[HFSUniStr255]) : CFStringRef;

external FSGetHFSUniStrFromString(
    theString : CFStringRef,
    uniStr : Pointer[HFSUniStr255]) : Int;

external FSFileSecurityGetTypeID() : CULong;

external FSFileSecurityCreate(
    alloc : CFAllocatorRef) : FSFileSecurityRef;

external FSFileSecurityCreateWithFSPermissionInfo(
    alloc : CFAllocatorRef,
    permissions : Pointer[FSPermissionInfo]) : FSFileSecurityRef;

external FSFileSecurityRefCreateCopy(
    alloc : CFAllocatorRef,
    fileSec : FSFileSecurityRef) : FSFileSecurityRef;

external FSFileSecurityGetOwnerUUID(
    fileSec : FSFileSecurityRef,
    owner : Pointer[CFUUIDBytes]) : Int;

external FSFileSecuritySetOwnerUUID(
    fileSec : FSFileSecurityRef,
    owner : Pointer[CFUUIDBytes]) : Int;

external FSFileSecurityGetGroupUUID(
    fileSec : FSFileSecurityRef,
    group : Pointer[CFUUIDBytes]) : Int;

external FSFileSecuritySetGroupUUID(
    fileSec : FSFileSecurityRef,
    group : Pointer[CFUUIDBytes]) : Int;

external FSFileSecurityCopyAccessControlList(
    fileSec : FSFileSecurityRef,
    accessControlList : Pointer[acl_t]) : Int;

external FSFileSecuritySetAccessControlList(
    fileSec : FSFileSecurityRef,
    accessControlList : acl_t) : Int;

external FSFileSecurityGetOwner(
    fileSec : FSFileSecurityRef,
    owner : Pointer[UInt]) : Int;

external FSFileSecuritySetOwner(
    fileSec : FSFileSecurityRef,
    owner : UInt) : Int;

external FSFileSecurityGetGroup(
    fileSec : FSFileSecurityRef,
    group : Pointer[UInt]) : Int;

external FSFileSecuritySetGroup(
    fileSec : FSFileSecurityRef,
    group : UInt) : Int;

external FSFileSecurityGetMode(
    fileSec : FSFileSecurityRef,
    mode : Pointer[UShort]) : Int;

external FSFileSecuritySetMode(
    fileSec : FSFileSecurityRef,
    mode : UShort) : Int;

alias pleaseCacheBit = 4;
alias pleaseCacheMask = 16;
alias noCacheBit = 5;
alias noCacheMask = 32;
alias rdVerifyBit = 6;
alias rdVerifyMask = 64;
alias rdVerify = 64;
alias forceReadBit = 6;
alias forceReadMask = 64;
alias newLineBit = 7;
alias newLineMask = 128;
alias newLineCharMask = 65280;

alias kOwnerID2Name = 1;
alias kGroupID2Name = 2;
alias kOwnerName2ID = 3;
alias kGroupName2ID = 4;
alias kReturnNextUser = 1;
alias kReturnNextGroup = 2;
alias kReturnNextUG = 3;

alias kVCBFlagsIdleFlushBit = 3;
alias kVCBFlagsIdleFlushMask = 8;
alias kVCBFlagsHFSPlusAPIsBit = 4;
alias kVCBFlagsHFSPlusAPIsMask = 16;
alias kVCBFlagsHardwareGoneBit = 5;
alias kVCBFlagsHardwareGoneMask = 32;
alias kVCBFlagsVolumeDirtyBit = 15;
alias kVCBFlagsVolumeDirtyMask = 32768;

alias kioVAtrbDefaultVolumeBit = 5;
alias kioVAtrbDefaultVolumeMask = 32;
alias kioVAtrbFilesOpenBit = 6;
alias kioVAtrbFilesOpenMask = 64;
alias kioVAtrbHardwareLockedBit = 7;
alias kioVAtrbHardwareLockedMask = 128;
alias kioVAtrbSoftwareLockedBit = 15;
alias kioVAtrbSoftwareLockedMask = 32768;

alias kioFlAttribLockedBit = 0;
alias kioFlAttribLockedMask = 1;
alias kioFlAttribResOpenBit = 2;
alias kioFlAttribResOpenMask = 4;
alias kioFlAttribDataOpenBit = 3;
alias kioFlAttribDataOpenMask = 8;
alias kioFlAttribDirBit = 4;
alias kioFlAttribDirMask = 16;
alias ioDirFlg = 4;
alias ioDirMask = 16;
alias kioFlAttribCopyProtBit = 6;
alias kioFlAttribCopyProtMask = 64;
alias kioFlAttribFileOpenBit = 7;
alias kioFlAttribFileOpenMask = 128;
alias kioFlAttribInSharedBit = 2;
alias kioFlAttribInSharedMask = 4;
alias kioFlAttribMountedBit = 3;
alias kioFlAttribMountedMask = 8;
alias kioFlAttribSharePointBit = 5;
alias kioFlAttribSharePointMask = 32;

alias kioFCBWriteBit = 8;
alias kioFCBWriteMask = 256;
alias kioFCBResourceBit = 9;
alias kioFCBResourceMask = 512;
alias kioFCBWriteLockedBit = 10;
alias kioFCBWriteLockedMask = 1024;
alias kioFCBLargeFileBit = 11;
alias kioFCBLargeFileMask = 2048;
alias kioFCBSharedWriteBit = 12;
alias kioFCBSharedWriteMask = 4096;
alias kioFCBFileLockedBit = 13;
alias kioFCBFileLockedMask = 8192;
alias kioFCBOwnClumpBit = 14;
alias kioFCBOwnClumpMask = 16384;
alias kioFCBModifiedBit = 15;
alias kioFCBModifiedMask = 32768;

alias kForkInfoFlagsWriteBit = 0;
alias kForkInfoFlagsWriteMask = 1;
alias kForkInfoFlagsResourceBit = 1;
alias kForkInfoFlagsResourceMask = 2;
alias kForkInfoFlagsWriteLockedBit = 2;
alias kForkInfoFlagsWriteLockedMask = 4;
alias kForkInfoFlagsLargeFileBit = 3;
alias kForkInfoFlagsLargeFileMask = 8;
alias kForkInfoFlagsSharedWriteBit = 4;
alias kForkInfoFlagsSharedWriteMask = 16;
alias kForkInfoFlagsFileLockedBit = 5;
alias kForkInfoFlagsFileLockedMask = 32;
alias kForkInfoFlagsOwnClumpBit = 6;
alias kForkInfoFlagsOwnClumpMask = 64;
alias kForkInfoFlagsModifiedBit = 7;
alias kForkInfoFlagsModifiedMask = 128;

alias kioACUserNoSeeFolderBit = 0;
alias kioACUserNoSeeFolderMask = 1;
alias kioACUserNoSeeFilesBit = 1;
alias kioACUserNoSeeFilesMask = 2;
alias kioACUserNoMakeChangesBit = 2;
alias kioACUserNoMakeChangesMask = 4;
alias kioACUserNotOwnerBit = 7;
alias kioACUserNotOwnerMask = 128;

alias kioACAccessOwnerBit = 31;
alias kioACAccessOwnerMask = 2147483648;
alias kioACAccessBlankAccessBit = 28;
alias kioACAccessBlankAccessMask = 268435456;
alias kioACAccessUserWriteBit = 26;
alias kioACAccessUserWriteMask = 67108864;
alias kioACAccessUserReadBit = 25;
alias kioACAccessUserReadMask = 33554432;
alias kioACAccessUserSearchBit = 24;
alias kioACAccessUserSearchMask = 16777216;
alias kioACAccessEveryoneWriteBit = 18;
alias kioACAccessEveryoneWriteMask = 262144;
alias kioACAccessEveryoneReadBit = 17;
alias kioACAccessEveryoneReadMask = 131072;
alias kioACAccessEveryoneSearchBit = 16;
alias kioACAccessEveryoneSearchMask = 65536;
alias kioACAccessGroupWriteBit = 10;
alias kioACAccessGroupWriteMask = 1024;
alias kioACAccessGroupReadBit = 9;
alias kioACAccessGroupReadMask = 512;
alias kioACAccessGroupSearchBit = 8;
alias kioACAccessGroupSearchMask = 256;
alias kioACAccessOwnerWriteBit = 2;
alias kioACAccessOwnerWriteMask = 4;
alias kioACAccessOwnerReadBit = 1;
alias kioACAccessOwnerReadMask = 2;
alias kioACAccessOwnerSearchBit = 0;
alias kioACAccessOwnerSearchMask = 1;
alias kfullPrivileges = 458759;
alias kownerPrivileges = 7;

external FSGetVolumeParms(
    volume : Short,
    buffer : Pointer[GetVolParmsInfoBuffer],
    bufferSize : CULong) : Int;

external FSGetVolumeMountInfoSize(
    volume : Short,
    size : Pointer[CULong]) : Int;

external FSGetVolumeMountInfo(
    volume : Short,
    buffer : BytePtr,
    bufferSize : CULong,
    actualSize : Pointer[CULong]) : Int;

external FSVolumeMount(
    buffer : BytePtr,
    mountedVolume : Pointer[Short]) : Int;

external FSFlushVolume(
    vRefNum : Short) : Int;

external PBFlushVolumeSync(
    paramBlock : FSRefParamPtr) : Int;

external PBFlushVolumeAsync(
    paramBlock : FSRefParamPtr) : Int;

external PBFSCopyFileSync(
    paramBlock : FSRefParamPtr) : Int;

external PBFSCopyFileAsync(
    paramBlock : FSRefParamPtr) : Int;

external FSResolveNodeID(
    volume : Short,
    nodeID : UInt,
    newRef : FSRefPtr) : Int;

external PBFSResolveNodeIDSync(
    paramBlock : FSRefParamPtr) : Int;

external PBFSResolveNodeIDAsync(
    paramBlock : FSRefParamPtr) : Int;

alias ResID = Short;

alias ResAttributes = Short;

alias ResFileAttributes = Short;

alias ResourceCount = Short;

alias ResourceIndex = Short;

alias ResFileRefNum = Int;

alias resSysRefBit = 7;
alias resSysHeapBit = 6;
alias resPurgeableBit = 5;
alias resLockedBit = 4;
alias resProtectedBit = 3;
alias resPreloadBit = 2;
alias resChangedBit = 1;

alias resSysHeap = 64;
alias resPurgeable = 32;
alias resLocked = 16;
alias resProtected = 8;
alias resPreload = 4;
alias resChanged = 2;

alias mapReadOnlyBit = 7;
alias mapCompactBit = 6;
alias mapChangedBit = 5;

alias mapReadOnly = 128;
alias mapCompact = 64;
alias mapChanged = 32;

alias kResFileNotOpened = 4294967295;
alias kSystemResFile = 0;

alias ResErrProcPtr = CCodePointer[[Short],[]];

alias ResErrUPP = ResErrProcPtr;

external NewResErrUPP(
    userRoutine : ResErrProcPtr) : ResErrUPP;

external DisposeResErrUPP(
    userUPP : ResErrUPP);

external InvokeResErrUPP(
    thErr : Short,
    userUPP : ResErrUPP);

alias ResourceEndianFilterPtr = CCodePointer[[Pointer[Pointer[CChar]],CUChar],[Short]];

external CloseResFile(
    refNum : Int);

external ResError() : Short;

external CurResFile() : Int;

external HomeResFile(
    theResource : Handle) : Int;

external UseResFile(
    refNum : Int);

external CountTypes() : Short;

external Count1Types() : Short;

external GetIndType(
    theType : Pointer[UInt],
    itemIndex : Short);

external Get1IndType(
    theType : Pointer[UInt],
    itemIndex : Short);

external SetResLoad(
    load : CUChar);

external CountResources(
    theType : UInt) : Short;

external Count1Resources(
    theType : UInt) : Short;

external GetIndResource(
    theType : UInt,
    itemIndex : Short) : Handle;

external Get1IndResource(
    theType : UInt,
    itemIndex : Short) : Handle;

external GetResource(
    theType : UInt,
    theID : Short) : Handle;

external Get1Resource(
    theType : UInt,
    theID : Short) : Handle;

external GetNamedResource(
    theType : UInt,
    name : ConstStr255Param) : Handle;

external Get1NamedResource(
    theType : UInt,
    name : ConstStr255Param) : Handle;

external LoadResource(
    theResource : Handle);

external ReleaseResource(
    theResource : Handle);

external DetachResource(
    theResource : Handle);

external UniqueID(
    theType : UInt) : Short;

external Unique1ID(
    theType : UInt) : Short;

external GetResAttrs(
    theResource : Handle) : Short;

external GetResInfo(
    theResource : Handle,
    theID : Pointer[Short],
    theType : Pointer[UInt],
    name : Pointer[CUChar]);

external SetResInfo(
    theResource : Handle,
    theID : Short,
    name : ConstStr255Param);

external AddResource(
    theData : Handle,
    theType : UInt,
    theID : Short,
    name : ConstStr255Param);

external GetResourceSizeOnDisk(
    theResource : Handle) : CLong;

external GetMaxResourceSize(
    theResource : Handle) : CLong;

external SetResAttrs(
    theResource : Handle,
    attrs : Short);

external ChangedResource(
    theResource : Handle);

external RemoveResource(
    theResource : Handle);

external UpdateResFile(
    refNum : Int);

external WriteResource(
    theResource : Handle);

external SetResPurge(
    install : CUChar);

external GetResFileAttrs(
    refNum : Int) : Short;

external SetResFileAttrs(
    refNum : Int,
    attrs : Short);

external ReadPartialResource(
    theResource : Handle,
    offset : CLong,
    buffer : RawPointer,
    count : CLong);

external WritePartialResource(
    theResource : Handle,
    offset : CLong,
    buffer : RawPointer,
    count : CLong);

external SetResourceSize(
    theResource : Handle,
    newSize : CLong);

external GetNextFOND(
    fondHandle : Handle) : Handle;

alias RsrcChainLocation = Short;

alias kRsrcChainBelowSystemMap = 0;
alias kRsrcChainBelowApplicationMap = 1;
alias kRsrcChainAboveApplicationMap = 2;
alias kRsrcChainAboveAllMaps = 4;

external InsertResourceFile(
    refNum : Int,
    where : Short) : Short;

external DetachResourceFile(
    refNum : Int) : Short;

external GetTopResourceFile(
    refNum : Pointer[Int]) : Short;

external GetNextResourceFile(
    curRefNum : Int,
    nextRefNum : Pointer[Int]) : Short;

external FSOpenResFile(
    ref_ : Pointer[FSRef],
    permission : CChar) : Int;

external FSCreateResFile(
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    newRef : Pointer[FSRef],
    newSpec : FSSpecPtr);

external FSResourceFileAlreadyOpen(
    resourceFileRef : Pointer[FSRef],
    inChain : Pointer[CUChar],
    refNum : Pointer[Int]) : CUChar;

external FSOpenOrphanResFile(
    ref_ : Pointer[FSRef],
    permission : CChar,
    refNum : Pointer[Int]) : Short;

external FSCreateResourceFile(
    parentRef : Pointer[FSRef],
    nameLength : CULong,
    name : Pointer[UShort],
    whichInfo : UInt,
    catalogInfo : Pointer[FSCatalogInfo],
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    newRef : Pointer[FSRef],
    newSpec : FSSpecPtr) : Short;

external FSCreateResourceFork(
    ref_ : Pointer[FSRef],
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    flags : UInt) : Short;

external FSOpenResourceFile(
    ref_ : Pointer[FSRef],
    forkNameLength : CULong,
    forkName : Pointer[UShort],
    permissions : CChar,
    refNum : Pointer[Int]) : Short;

alias kAppleManufacturer = 1634758764;
alias kComponentResourceType = 1953001063;
alias kComponentAliasResourceType = 1952999265;

alias kAnyComponentType = 0;
alias kAnyComponentSubType = 0;
alias kAnyComponentManufacturer = 0;
alias kAnyComponentFlagsMask = 0;

alias cmpThreadSafe = 268435456;
alias cmpIsMissing = 536870912;
alias cmpWantsRegisterMessage = 2147483648;

alias kComponentOpenSelect = 4294967295;
alias kComponentCloseSelect = 4294967294;
alias kComponentCanDoSelect = 4294967293;
alias kComponentVersionSelect = 4294967292;
alias kComponentRegisterSelect = 4294967291;
alias kComponentTargetSelect = 4294967290;
alias kComponentUnregisterSelect = 4294967289;
alias kComponentGetMPWorkFunctionSelect = 4294967288;
alias kComponentExecuteWiredActionSelect = 4294967287;
alias kComponentGetPublicResourceSelect = 4294967286;

alias componentDoAutoVersion = 1;
alias componentWantsUnregister = 2;
alias componentAutoVersionIncludeFlags = 4;
alias componentHasMultiplePlatforms = 8;
alias componentLoadResident = 16;

alias defaultComponentIdentical = 0;
alias defaultComponentAnyFlags = 1;
alias defaultComponentAnyManufacturer = 2;
alias defaultComponentAnySubType = 4;
alias defaultComponentAnyFlagsAnyManufacturer = 3;
alias defaultComponentAnyFlagsAnyManufacturerAnySubType = 7;

alias registerComponentGlobal = 1;
alias registerComponentNoDuplicates = 2;
alias registerComponentAfterExisting = 4;
alias registerComponentAliasesOnly = 8;

record Struct_ComponentDescription (
    componentType : UInt,
    componentSubType : UInt,
    componentManufacturer : UInt,
    componentFlags : UInt,
    componentFlagsMask : UInt,
);

alias ComponentDescription = Struct_ComponentDescription;

record Struct_ResourceSpec (
    resType : UInt,
    resID : Short,
);

alias ResourceSpec = Struct_ResourceSpec;

record Struct_ComponentResource (
    cd : ComponentDescription,
    component : ResourceSpec,
    componentName : ResourceSpec,
    componentInfo : ResourceSpec,
    componentIcon : ResourceSpec,
);

alias ComponentResource = Struct_ComponentResource;

alias ComponentResourcePtr = Pointer[ComponentResource];

alias ComponentResourceHandle = Pointer[ComponentResourcePtr];

record Struct_ComponentPlatformInfo (
    componentFlags : Int,
    component : ResourceSpec,
    platformType : Short,
);

alias ComponentPlatformInfo = Struct_ComponentPlatformInfo;

record Struct_ComponentResourceExtension (
    componentVersion : Int,
    componentRegisterFlags : Int,
    componentIconFamily : Short,
);

alias ComponentResourceExtension = Struct_ComponentResourceExtension;

record Struct_ComponentPlatformInfoArray (
    count : Int,
    platformArray : Array[ComponentPlatformInfo,1],
);

alias ComponentPlatformInfoArray = Struct_ComponentPlatformInfoArray;

record Struct_ExtComponentResource (
    cd : ComponentDescription,
    component : ResourceSpec,
    componentName : ResourceSpec,
    componentInfo : ResourceSpec,
    componentIcon : ResourceSpec,
    componentVersion : Int,
    componentRegisterFlags : Int,
    componentIconFamily : Short,
    count : Int,
    platformArray : Array[ComponentPlatformInfo,1],
);

alias ExtComponentResource = Struct_ExtComponentResource;

alias ExtComponentResourcePtr = Pointer[ExtComponentResource];

alias ExtComponentResourceHandle = Pointer[ExtComponentResourcePtr];

record Struct_ComponentAliasResource (
    cr : ComponentResource,
    aliasCD : ComponentDescription,
);

alias ComponentAliasResource = Struct_ComponentAliasResource;

record Struct_ComponentParameters (
    flags : CUChar,
    paramSize : CUChar,
    what : Short,
    padding : UInt,
    params : Array[CLong,1],
);

alias ComponentParameters = Struct_ComponentParameters;

record Struct_ComponentRecord (
    data : Array[CLong,1],
);

alias ComponentRecord = Struct_ComponentRecord;

alias Component = Pointer[ComponentRecord];

record Struct_ComponentInstanceRecord (
    data : Array[CLong,1],
);

alias ComponentInstanceRecord = Struct_ComponentInstanceRecord;

alias ComponentInstance = Pointer[ComponentInstanceRecord];

record Struct_RegisteredComponentRecord (
    data : Array[CLong,1],
);

alias RegisteredComponentRecord = Struct_RegisteredComponentRecord;

alias RegisteredComponentRecordPtr = Pointer[RegisteredComponentRecord];

record Struct_RegisteredComponentInstanceRecord (
    data : Array[CLong,1],
);

alias RegisteredComponentInstanceRecord = Struct_RegisteredComponentInstanceRecord;

alias RegisteredComponentInstanceRecordPtr = Pointer[RegisteredComponentInstanceRecord];

alias ComponentResult = Int;

alias platform68k = 1;
alias platformPowerPC = 2;
alias platformInterpreted = 3;
alias platformWin32 = 4;
alias platformPowerPCNativeEntryPoint = 5;
alias platformIA32NativeEntryPoint = 6;
alias platformPowerPC64NativeEntryPoint = 7;
alias platformX86_64NativeEntryPoint = 8;

alias platformIRIXmips = 1000;
alias platformSunOSsparc = 1100;
alias platformSunOSintel = 1101;
alias platformLinuxppc = 1200;
alias platformLinuxintel = 1201;
alias platformAIXppc = 1300;
alias platformNeXTIntel = 1400;
alias platformNeXTppc = 1401;
alias platformNeXTsparc = 1402;
alias platformNeXT68k = 1403;
alias platformMacOSx86 = 1500;

alias mpWorkFlagDoWork = 1;
alias mpWorkFlagDoCompletion = 2;
alias mpWorkFlagCopyWorkBlock = 4;
alias mpWorkFlagDontBlock = 8;
alias mpWorkFlagGetProcessorCount = 16;
alias mpWorkFlagGetIsRunning = 64;

alias cmpAliasNoFlags = 0;
alias cmpAliasOnlyThisFile = 1;

alias CSComponentsThreadMode = UInt;

alias kCSAcceptAllComponentsMode = 0;
alias kCSAcceptThreadSafeComponentsOnlyMode = 1;

external CSSetComponentsThreadMode(
    mode : UInt);

external CSGetComponentsThreadMode() : UInt;

record Struct_ComponentMPWorkFunctionHeaderRecord (
    headerSize : UInt,
    recordSize : UInt,
    workFlags : UInt,
    processorCount : UShort,
    unused : CUChar,
    isRunning : CUChar,
);

alias ComponentMPWorkFunctionHeaderRecord = Struct_ComponentMPWorkFunctionHeaderRecord;

alias ComponentMPWorkFunctionHeaderRecordPtr = Pointer[ComponentMPWorkFunctionHeaderRecord];

alias ComponentMPWorkFunctionProcPtr = CCodePointer[[RawPointer,Pointer[Struct_ComponentMPWorkFunctionHeaderRecord]],[Int]];

alias ComponentRoutineProcPtr = CCodePointer[[Pointer[Struct_ComponentParameters],Pointer[Pointer[CChar]]],[Int]];

alias GetMissingComponentResourceProcPtr = CCodePointer[[Pointer[Struct_ComponentRecord],UInt,Short,RawPointer,Pointer[Pointer[Pointer[CChar]]]],[Short]];

alias ComponentMPWorkFunctionUPP = ComponentMPWorkFunctionProcPtr;

alias ComponentRoutineUPP = ComponentRoutineProcPtr;

alias GetMissingComponentResourceUPP = GetMissingComponentResourceProcPtr;

alias ComponentFunctionUPP = UniversalProcPtr;

external NewComponentFunctionUPP(
    userRoutine : ProcPtr,
    procInfo : CULong) : ComponentFunctionUPP;

external DisposeComponentFunctionUPP(
    userUPP : ComponentFunctionUPP);

external RegisterComponent(
    cd : Pointer[ComponentDescription],
    componentEntryPoint : ComponentRoutineUPP,
    global : Short,
    componentName : Handle,
    componentInfo : Handle,
    componentIcon : Handle) : Component;

external RegisterComponentResource(
    cr : ComponentResourceHandle,
    global : Short) : Component;

external UnregisterComponent(
    aComponent : Component) : Short;

external FindNextComponent(
    aComponent : Component,
    looking : Pointer[ComponentDescription]) : Component;

external CountComponents(
    looking : Pointer[ComponentDescription]) : CLong;

external GetComponentInfo(
    aComponent : Component,
    cd : Pointer[ComponentDescription],
    componentName : Handle,
    componentInfo : Handle,
    componentIcon : Handle) : Short;

external GetComponentListModSeed() : Int;

external GetComponentTypeModSeed(
    componentType : UInt) : Int;

external OpenAComponent(
    aComponent : Component,
    ci : Pointer[ComponentInstance]) : Short;

external OpenComponent(
    aComponent : Component) : ComponentInstance;

external CloseComponent(
    aComponentInstance : ComponentInstance) : Short;

external GetComponentInstanceError(
    aComponentInstance : ComponentInstance) : Short;

external ResolveComponentAlias(
    aComponent : Component) : Component;

external GetComponentPublicResource(
    aComponent : Component,
    resourceType : UInt,
    resourceID : Short,
    theResource : Pointer[Handle]) : Short;

external GetComponentPublicResourceList(
    resourceType : UInt,
    resourceID : Short,
    flags : Int,
    cd : Pointer[ComponentDescription],
    missingProc : GetMissingComponentResourceUPP,
    refCon : RawPointer,
    atomContainerPtr : RawPointer) : Short;

external GetComponentPublicIndString(
    aComponent : Component,
    theString : Pointer[CUChar],
    strListID : Short,
    index : Short) : Short;

external SetComponentInstanceError(
    aComponentInstance : ComponentInstance,
    theError : Short);

external GetComponentRefcon(
    aComponent : Component) : CLong;

external SetComponentRefcon(
    aComponent : Component,
    theRefcon : CLong);

external OpenComponentResFile(
    aComponent : Component) : Int;

external OpenAComponentResFile(
    aComponent : Component,
    resRef : Pointer[Int]) : Short;

external CloseComponentResFile(
    refnum : Int) : Short;

external GetComponentResource(
    aComponent : Component,
    resType : UInt,
    resID : Short,
    theResource : Pointer[Handle]) : Short;

external GetComponentIndString(
    aComponent : Component,
    theString : Pointer[CUChar],
    strListID : Short,
    index : Short) : Short;

external GetComponentInstanceStorage(
    aComponentInstance : ComponentInstance) : Handle;

external SetComponentInstanceStorage(
    aComponentInstance : ComponentInstance,
    theStorage : Handle);

external CountComponentInstances(
    aComponent : Component) : CLong;

external CallComponentFunction(
    params : Pointer[ComponentParameters],
    func : ComponentFunctionUPP) : Int;

external CallComponentFunctionWithStorage(
    storage : Handle,
    params : Pointer[ComponentParameters],
    func : ComponentFunctionUPP) : Int;

external CallComponentFunctionWithStorageProcInfo(
    storage : Handle,
    params : Pointer[ComponentParameters],
    func : ProcPtr,
    funcProcInfo : CULong) : Int;

external DelegateComponentCall(
    originalParams : Pointer[ComponentParameters],
    ci : ComponentInstance) : Int;

external SetDefaultComponent(
    aComponent : Component,
    flags : Short) : Short;

external OpenDefaultComponent(
    componentType : UInt,
    componentSubType : UInt) : ComponentInstance;

external OpenADefaultComponent(
    componentType : UInt,
    componentSubType : UInt,
    ci : Pointer[ComponentInstance]) : Short;

external CaptureComponent(
    capturedComponent : Component,
    capturingComponent : Component) : Component;

external UncaptureComponent(
    aComponent : Component) : Short;

external RegisterComponentResourceFile(
    resRefNum : Short,
    global : Short) : Int;

external RegisterComponentFileRef(
    ref_ : Pointer[FSRef],
    global : Short) : Short;

external RegisterComponentFileRefEntries(
    ref_ : Pointer[FSRef],
    global : Short,
    toRegister : Pointer[ComponentDescription],
    registerCount : UInt) : Short;

external CallComponentOpen(
    ci : ComponentInstance,
    self : ComponentInstance) : Int;

external CallComponentClose(
    ci : ComponentInstance,
    self : ComponentInstance) : Int;

external CallComponentCanDo(
    ci : ComponentInstance,
    ftnNumber : Short) : Int;

external CallComponentVersion(
    ci : ComponentInstance) : Int;

external CallComponentRegister(
    ci : ComponentInstance) : Int;

external CallComponentTarget(
    ci : ComponentInstance,
    target : ComponentInstance) : Int;

external CallComponentUnregister(
    ci : ComponentInstance) : Int;

external CallComponentGetMPWorkFunction(
    ci : ComponentInstance,
    workFunction : Pointer[ComponentMPWorkFunctionUPP],
    refCon : Pointer[RawPointer]) : Int;

external CallComponentGetPublicResource(
    ci : ComponentInstance,
    resourceType : UInt,
    resourceID : Short,
    resource : Pointer[Handle]) : Int;

external CallComponentDispatch(
    cp : Pointer[ComponentParameters]) : Int;

external NewComponentMPWorkFunctionUPP(
    userRoutine : ComponentMPWorkFunctionProcPtr) : ComponentMPWorkFunctionUPP;

external NewComponentRoutineUPP(
    userRoutine : ComponentRoutineProcPtr) : ComponentRoutineUPP;

external NewGetMissingComponentResourceUPP(
    userRoutine : GetMissingComponentResourceProcPtr) : GetMissingComponentResourceUPP;

external DisposeComponentMPWorkFunctionUPP(
    userUPP : ComponentMPWorkFunctionUPP);

external DisposeComponentRoutineUPP(
    userUPP : ComponentRoutineUPP);

external DisposeGetMissingComponentResourceUPP(
    userUPP : GetMissingComponentResourceUPP);

external InvokeComponentMPWorkFunctionUPP(
    globalRefCon : RawPointer,
    header : ComponentMPWorkFunctionHeaderRecordPtr,
    userUPP : ComponentMPWorkFunctionUPP) : Int;

external InvokeComponentRoutineUPP(
    cp : Pointer[ComponentParameters],
    componentStorage : Handle,
    userUPP : ComponentRoutineUPP) : Int;

external InvokeGetMissingComponentResourceUPP(
    c : Component,
    resType : UInt,
    resID : Short,
    refCon : RawPointer,
    resource : Pointer[Handle],
    userUPP : GetMissingComponentResourceUPP) : Short;

alias uppComponentFunctionImplementedProcInfo = 752;
alias uppGetComponentVersionProcInfo = 240;
alias uppComponentSetTargetProcInfo = 1008;
alias uppCallComponentOpenProcInfo = 1008;
alias uppCallComponentCloseProcInfo = 1008;
alias uppCallComponentCanDoProcInfo = 752;
alias uppCallComponentVersionProcInfo = 240;
alias uppCallComponentRegisterProcInfo = 240;
alias uppCallComponentTargetProcInfo = 1008;
alias uppCallComponentUnregisterProcInfo = 240;
alias uppCallComponentGetMPWorkFunctionProcInfo = 4080;
alias uppCallComponentGetPublicResourceProcInfo = 15344;

alias MPLibrary_MajorVersion = 2;
alias MPLibrary_MinorVersion = 3;
alias MPLibrary_Release = 1;
alias MPLibrary_DevelopmentRevision = 1;

alias MPProcessID = OpaquePointer;

alias MPTaskID = OpaquePointer;

alias MPQueueID = OpaquePointer;

alias MPSemaphoreID = OpaquePointer;

alias MPCriticalRegionID = OpaquePointer;

alias MPTimerID = OpaquePointer;

alias MPEventID = OpaquePointer;

alias MPAddressSpaceID = OpaquePointer;

alias MPNotificationID = OpaquePointer;

alias MPCoherenceID = OpaquePointer;

alias MPCpuID = OpaquePointer;

alias MPAreaID = OpaquePointer;

alias MPConsoleID = OpaquePointer;

alias MPOpaqueID = OpaquePointer;

alias kOpaqueAnyID = 0;
alias kOpaqueProcessID = 1;
alias kOpaqueTaskID = 2;
alias kOpaqueTimerID = 3;
alias kOpaqueQueueID = 4;
alias kOpaqueSemaphoreID = 5;
alias kOpaqueCriticalRegionID = 6;
alias kOpaqueCpuID = 7;
alias kOpaqueAddressSpaceID = 8;
alias kOpaqueEventID = 9;
alias kOpaqueCoherenceID = 10;
alias kOpaqueAreaID = 11;
alias kOpaqueNotificationID = 12;
alias kOpaqueConsoleID = 13;

alias MPOpaqueIDClass = UInt;

alias kMPNoID = 0;

alias MPTaskOptions = UInt;

alias TaskStorageIndex = CULong;

alias TaskStorageValue = LogicalAddress;

alias MPSemaphoreCount = CULong;

alias MPTaskWeight = UInt;

alias MPEventFlags = UInt;

alias MPExceptionKind = UInt;

alias MPTaskStateKind = UInt;

alias MPPageSizeClass = UInt;

alias kDurationImmediate = 0;
alias kDurationForever = 2147483647;
alias kDurationMillisecond = 1;
alias kDurationMicrosecond = 4294967295;

external MPProcessors() : CULong;

external MPProcessorsScheduled() : CULong;

alias kMPCreateTaskSuspendedMask = 1;
alias kMPCreateTaskTakesAllExceptionsMask = 2;
alias kMPCreateTaskNotDebuggableMask = 4;
alias kMPCreateTaskValidOptionsMask = 7;

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

external MPCreateTask(
    entryPoint : TaskProc,
    parameter : RawPointer,
    stackSize : CULong,
    notifyQueue : MPQueueID,
    terminationParameter1 : RawPointer,
    terminationParameter2 : RawPointer,
    options : UInt,
    task : Pointer[MPTaskID]) : Int;

external MPTerminateTask(
    task : MPTaskID,
    terminationStatus : Int) : Int;

external MPSetTaskWeight(
    task : MPTaskID,
    weight : UInt) : Int;

external MPTaskIsPreemptive(
    taskID : MPTaskID) : CUChar;

external MPExit(
    status : Int);

external MPYield();

external MPCurrentTaskID() : MPTaskID;

external MPSetTaskType(
    task : MPTaskID,
    taskType : UInt) : Int;

external MPAllocateTaskStorageIndex(
    taskIndex : Pointer[CULong]) : Int;

external MPDeallocateTaskStorageIndex(
    taskIndex : CULong) : Int;

external MPSetTaskStorageValue(
    taskIndex : CULong,
    value : TaskStorageValue) : Int;

external MPGetTaskStorageValue(
    taskIndex : CULong) : TaskStorageValue;

external MPCreateQueue(
    queue : Pointer[MPQueueID]) : Int;

external MPDeleteQueue(
    queue : MPQueueID) : Int;

external MPNotifyQueue(
    queue : MPQueueID,
    param1 : RawPointer,
    param2 : RawPointer,
    param3 : RawPointer) : Int;

external MPWaitOnQueue(
    queue : MPQueueID,
    param1 : Pointer[RawPointer],
    param2 : Pointer[RawPointer],
    param3 : Pointer[RawPointer],
    timeout : Int) : Int;

external MPSetQueueReserve(
    queue : MPQueueID,
    count : CULong) : Int;

external MPCreateSemaphore(
    maximumValue : CULong,
    initialValue : CULong,
    semaphore : Pointer[MPSemaphoreID]) : Int;

external MPDeleteSemaphore(
    semaphore : MPSemaphoreID) : Int;

external MPSignalSemaphore(
    semaphore : MPSemaphoreID) : Int;

external MPWaitOnSemaphore(
    semaphore : MPSemaphoreID,
    timeout : Int) : Int;

external MPCreateCriticalRegion(
    criticalRegion : Pointer[MPCriticalRegionID]) : Int;

external MPDeleteCriticalRegion(
    criticalRegion : MPCriticalRegionID) : Int;

external MPEnterCriticalRegion(
    criticalRegion : MPCriticalRegionID,
    timeout : Int) : Int;

external MPExitCriticalRegion(
    criticalRegion : MPCriticalRegionID) : Int;

external MPCreateEvent(
    event : Pointer[MPEventID]) : Int;

external MPDeleteEvent(
    event : MPEventID) : Int;

external MPSetEvent(
    event : MPEventID,
    flags : UInt) : Int;

external MPWaitForEvent(
    event : MPEventID,
    flags : Pointer[UInt],
    timeout : Int) : Int;

external MPCreateNotification(
    notificationID : Pointer[MPNotificationID]) : Int;

external MPDeleteNotification(
    notificationID : MPNotificationID) : Int;

external MPModifyNotification(
    notificationID : MPNotificationID,
    anID : MPOpaqueID,
    notifyParam1 : RawPointer,
    notifyParam2 : RawPointer,
    notifyParam3 : RawPointer) : Int;

external MPModifyNotificationParameters(
    notificationID : MPNotificationID,
    kind : UInt,
    notifyParam1 : RawPointer,
    notifyParam2 : RawPointer,
    notifyParam3 : RawPointer) : Int;

external MPCauseNotification(
    notificationID : MPNotificationID) : Int;

alias kMPPreserveTimerIDMask = 1;
alias kMPTimeIsDeltaMask = 2;
alias kMPTimeIsDurationMask = 4;

external MPDelayUntil(
    expirationTime : Pointer[AbsoluteTime]) : Int;

external MPCreateTimer(
    timerID : Pointer[MPTimerID]) : Int;

external MPDeleteTimer(
    timerID : MPTimerID) : Int;

external MPSetTimerNotify(
    timerID : MPTimerID,
    anID : MPOpaqueID,
    notifyParam1 : RawPointer,
    notifyParam2 : RawPointer,
    notifyParam3 : RawPointer) : Int;

external MPArmTimer(
    timerID : MPTimerID,
    expirationTime : Pointer[AbsoluteTime],
    options : UInt) : Int;

external MPCancelTimer(
    timerID : MPTimerID,
    timeRemaining : Pointer[AbsoluteTime]) : Int;

alias kMPMaxAllocSize = 1073741824;

alias kMPAllocateDefaultAligned = 0;
alias kMPAllocate8ByteAligned = 3;
alias kMPAllocate16ByteAligned = 4;
alias kMPAllocate32ByteAligned = 5;
alias kMPAllocate1024ByteAligned = 10;
alias kMPAllocate4096ByteAligned = 12;
alias kMPAllocateMaxAlignment = 16;
alias kMPAllocateAltiVecAligned = 4;
alias kMPAllocateVMXAligned = 4;
alias kMPAllocateVMPageAligned = 254;
alias kMPAllocateInterlockAligned = 255;

alias kMPAllocateClearMask = 1;
alias kMPAllocateGloballyMask = 2;
alias kMPAllocateResidentMask = 4;
alias kMPAllocateNoGrowthMask = 16;
alias kMPAllocateNoCreateMask = 32;

external MPAllocateAligned(
    size : CULong,
    alignment : CUChar,
    options : UInt) : LogicalAddress;

external MPAllocate(
    size : CULong) : LogicalAddress;

external MPFree(
    object : LogicalAddress);

external MPGetAllocatedBlockSize(
    object : LogicalAddress) : CULong;

external MPBlockCopy(
    source : LogicalAddress,
    destination : LogicalAddress,
    size : CULong);

external MPBlockClear(
    address : LogicalAddress,
    size : CULong);

alias kMPTaskStateRegisters = 0;
alias kMPTaskStateFPU = 1;
alias kMPTaskStateVectors = 2;
alias kMPTaskStateMachine = 3;
alias kMPTaskState32BitMemoryException = 4;
alias kMPTaskStateTaskInfo = 5;

alias kMPTaskPropagate = 0;
alias kMPTaskResumeStep = 1;
alias kMPTaskResumeBranch = 2;
alias kMPTaskResumeMask = 0;
alias kMPTaskPropagateMask = 1;
alias kMPTaskResumeStepMask = 2;
alias kMPTaskResumeBranchMask = 4;

alias kMPTaskBlocked = 0;
alias kMPTaskReady = 1;
alias kMPTaskRunning = 2;

alias kMPTaskInfoVersion = 3;

record Struct_MPTaskInfoVersion2 (
    version : UInt,
    name : UInt,
    queueName : UInt,
    runState : UShort,
    lastCPU : UShort,
    weight : UInt,
    processID : MPProcessID,
    cpuTime : AbsoluteTime,
    schedTime : AbsoluteTime,
    creationTime : AbsoluteTime,
    codePageFaults : CULong,
    dataPageFaults : CULong,
    preemptions : CULong,
    cpuID : MPCpuID,
);

alias MPTaskInfoVersion2 = Struct_MPTaskInfoVersion2;

record Struct_MPTaskInfo (
    version : UInt,
    name : UInt,
    queueName : UInt,
    runState : UShort,
    lastCPU : UShort,
    weight : UInt,
    processID : MPProcessID,
    cpuTime : AbsoluteTime,
    schedTime : AbsoluteTime,
    creationTime : AbsoluteTime,
    codePageFaults : CULong,
    dataPageFaults : CULong,
    preemptions : CULong,
    cpuID : MPCpuID,
    blockedObject : MPOpaqueID,
    spaceID : MPAddressSpaceID,
    stackBase : LogicalAddress,
    stackLimit : LogicalAddress,
    stackCurr : LogicalAddress,
);

alias MPTaskInfo = Struct_MPTaskInfo;

external MPSetExceptionHandler(
    task : MPTaskID,
    exceptionQ : MPQueueID) : Int;

external MPDisposeTaskException(
    task : MPTaskID,
    action : UInt) : Int;

external MPExtractTaskState(
    task : MPTaskID,
    kind : UInt,
    info : RawPointer) : Int;

external MPSetTaskState(
    task : MPTaskID,
    kind : UInt,
    info : RawPointer) : Int;

external MPThrowException(
    task : MPTaskID,
    kind : UInt) : Int;

alias MPDebuggerLevel = UInt;

alias kMPLowLevelDebugger = 0;
alias kMPMidLevelDebugger = 268435456;
alias kMPHighLevelDebugger = 536870912;

external MPRegisterDebugger(
    queue : MPQueueID,
    level : UInt) : Int;

external MPUnregisterDebugger(
    queue : MPQueueID) : Int;

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

alias MPRemoteContext = CUChar;

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

external MPRemoteCall(
    remoteProc : MPRemoteProcedure,
    parameter : RawPointer,
    context : CUChar) : RawPointer;

external MPRemoteCallCFM(
    remoteProc : MPRemoteProcedure,
    parameter : RawPointer,
    context : CUChar) : RawPointer;

external _MPIsFullyInitialized() : CUChar;

alias MPIsFullyInitializedProc = CCodePointer[[],[CUChar]];

external _MPLibraryVersion(
    versionCString : Pointer[Pointer[CChar]],
    major : Pointer[UInt],
    minor : Pointer[UInt],
    release : Pointer[UInt],
    revision : Pointer[UInt]);

external _MPLibraryIsCompatible(
    versionCString : Pointer[CChar],
    major : UInt,
    minor : UInt,
    release : UInt,
    revision : UInt) : CUChar;

alias FSAliasInfoBitmap = UInt;

alias kFSAliasInfoNone = 0;
alias kFSAliasInfoVolumeCreateDate = 1;
alias kFSAliasInfoTargetCreateDate = 2;
alias kFSAliasInfoFinderInfo = 4;
alias kFSAliasInfoIsDirectory = 8;
alias kFSAliasInfoIDs = 16;
alias kFSAliasInfoFSInfo = 32;
alias kFSAliasInfoVolumeFlags = 64;

alias rAliasType = 1634494835;

alias kARMMountVol = 1;
alias kARMNoUI = 2;
alias kARMMultVols = 8;
alias kARMSearch = 256;
alias kARMSearchMore = 512;
alias kARMSearchRelFirst = 1024;
alias kARMTryFileIDFirst = 2048;

alias asiZoneName = 4294967293;
alias asiServerName = 4294967294;
alias asiVolumeName = 4294967295;
alias asiAliasName = 0;
alias asiParentName = 1;

alias kResolveAliasFileNoUI = 1;
alias kResolveAliasTryFileIDFirst = 2;

record Struct_AliasRecord (
    hidden : Array[CUChar,6],
);

alias AliasRecord = Struct_AliasRecord;

alias AliasPtr = Pointer[AliasRecord];

alias AliasHandle = Pointer[AliasPtr];

record Struct_FSAliasInfo (
    volumeCreateDate : UTCDateTime,
    targetCreateDate : UTCDateTime,
    fileType : UInt,
    fileCreator : UInt,
    parentDirID : UInt,
    nodeID : UInt,
    filesystemID : UShort,
    signature : UShort,
    volumeIsBootVolume : CUChar,
    volumeIsAutomounted : CUChar,
    volumeIsEjectable : CUChar,
    volumeHasPersistentFileIDs : CUChar,
    isDirectory : CUChar,
);

alias FSAliasInfo = Struct_FSAliasInfo;

alias FSAliasInfoPtr = Pointer[FSAliasInfo];

alias AliasInfoType = Short;

alias FSAliasFilterProcPtr = CCodePointer[[Pointer[Struct_FSRef],Pointer[CUChar],Pointer[CChar]],[CUChar]];

external FSNewAlias(
    fromFile : Pointer[FSRef],
    target : Pointer[FSRef],
    inAlias : Pointer[AliasHandle]) : Short;

external FSNewAliasMinimal(
    target : Pointer[FSRef],
    inAlias : Pointer[AliasHandle]) : Short;

external FSIsAliasFile(
    fileRef : Pointer[FSRef],
    aliasFileFlag : Pointer[CUChar],
    folderFlag : Pointer[CUChar]) : Short;

external FSResolveAliasWithMountFlags(
    fromFile : Pointer[FSRef],
    inAlias : AliasHandle,
    target : Pointer[FSRef],
    wasChanged : Pointer[CUChar],
    mountFlags : CULong) : Short;

external FSResolveAlias(
    fromFile : Pointer[FSRef],
    alias_ : AliasHandle,
    target : Pointer[FSRef],
    wasChanged : Pointer[CUChar]) : Short;

external FSResolveAliasFileWithMountFlags(
    theRef : Pointer[FSRef],
    resolveAliasChains : CUChar,
    targetIsFolder : Pointer[CUChar],
    wasAliased : Pointer[CUChar],
    mountFlags : CULong) : Short;

external FSResolveAliasFile(
    theRef : Pointer[FSRef],
    resolveAliasChains : CUChar,
    targetIsFolder : Pointer[CUChar],
    wasAliased : Pointer[CUChar]) : Short;

external FSFollowFinderAlias(
    fromFile : Pointer[FSRef],
    alias_ : AliasHandle,
    logon : CUChar,
    target : Pointer[FSRef],
    wasChanged : Pointer[CUChar]) : Short;

external FSUpdateAlias(
    fromFile : Pointer[FSRef],
    target : Pointer[FSRef],
    alias_ : AliasHandle,
    wasChanged : Pointer[CUChar]) : Short;

external FSNewAliasUnicode(
    fromFile : Pointer[FSRef],
    targetParentRef : Pointer[FSRef],
    targetNameLength : CULong,
    targetName : Pointer[UShort],
    inAlias : Pointer[AliasHandle],
    isDirectory : Pointer[CUChar]) : Short;

external FSNewAliasMinimalUnicode(
    targetParentRef : Pointer[FSRef],
    targetNameLength : CULong,
    targetName : Pointer[UShort],
    inAlias : Pointer[AliasHandle],
    isDirectory : Pointer[CUChar]) : Short;

external FSNewAliasFromPath(
    fromFilePath : Pointer[CChar],
    targetPath : Pointer[CChar],
    flags : UInt,
    inAlias : Pointer[AliasHandle],
    isDirectory : Pointer[CUChar]) : Int;

external FSMatchAliasBulk(
    fromFile : Pointer[FSRef],
    rulesMask : CULong,
    inAlias : AliasHandle,
    aliasCount : Pointer[Short],
    aliasList : Pointer[FSRef],
    needsUpdate : Pointer[CUChar],
    aliasFilter : FSAliasFilterProcPtr,
    yourDataPtr : RawPointer) : Int;

external FSCopyAliasInfo(
    inAlias : AliasHandle,
    targetName : Pointer[HFSUniStr255],
    volumeName : Pointer[HFSUniStr255],
    pathString : Pointer[CFStringRef],
    whichInfo : Pointer[UInt],
    info : Pointer[FSAliasInfo]) : Int;

external GetAliasSize(
    alias_ : AliasHandle) : CLong;

external GetAliasUserType(
    alias_ : AliasHandle) : UInt;

external SetAliasUserType(
    alias_ : AliasHandle,
    userType : UInt);

external GetAliasSizeFromPtr(
    alias_ : Pointer[AliasRecord]) : CLong;

external GetAliasUserTypeFromPtr(
    alias_ : Pointer[AliasRecord]) : UInt;

external SetAliasUserTypeWithPtr(
    alias_ : AliasPtr,
    userType : UInt);

alias LocaleRef = OpaquePointer;

alias LocalePartMask = UInt;

alias kLocaleLanguageMask = 1;
alias kLocaleLanguageVariantMask = 2;
alias kLocaleScriptMask = 4;
alias kLocaleScriptVariantMask = 8;
alias kLocaleRegionMask = 16;
alias kLocaleRegionVariantMask = 32;
alias kLocaleAllPartsMask = 63;

alias LocaleOperationClass = UInt;

alias LocaleOperationVariant = UInt;

record Struct_LocaleAndVariant (
    locale : LocaleRef,
    opVariant : UInt,
);

alias LocaleAndVariant = Struct_LocaleAndVariant;

alias LocaleNameMask = UInt;

alias kLocaleNameMask = 1;
alias kLocaleOperationVariantNameMask = 2;
alias kLocaleAndVariantNameMask = 3;

external LocaleRefFromLangOrRegionCode(
    lang : Short,
    region : Short,
    locale : Pointer[LocaleRef]) : Int;

external LocaleRefFromLocaleString(
    localeString : Pointer[CChar],
    locale : Pointer[LocaleRef]) : Int;

external LocaleRefGetPartString(
    locale : LocaleRef,
    partMask : UInt,
    maxStringLen : CULong,
    partString : Pointer[CChar]) : Int;

external LocaleStringToLangAndRegionCodes(
    localeString : Pointer[CChar],
    lang : Pointer[Short],
    region : Pointer[Short]) : Int;

external LocaleOperationCountLocales(
    opClass : UInt,
    localeCount : Pointer[CULong]) : Int;

external LocaleOperationGetLocales(
    opClass : UInt,
    maxLocaleCount : CULong,
    actualLocaleCount : Pointer[CULong],
    localeVariantList : Pointer[LocaleAndVariant]) : Int;

external LocaleGetName(
    locale : LocaleRef,
    opVariant : UInt,
    nameMask : UInt,
    displayLocale : LocaleRef,
    maxNameLen : CULong,
    actualNameLen : Pointer[CULong],
    displayName : Pointer[UShort]) : Int;

external LocaleCountNames(
    locale : LocaleRef,
    opVariant : UInt,
    nameMask : UInt,
    nameCount : Pointer[CULong]) : Int;

external LocaleGetIndName(
    locale : LocaleRef,
    opVariant : UInt,
    nameMask : UInt,
    nameIndex : CULong,
    maxNameLen : CULong,
    actualNameLen : Pointer[CULong],
    displayName : Pointer[UShort],
    displayLocale : Pointer[LocaleRef]) : Int;

external LocaleOperationGetName(
    opClass : UInt,
    displayLocale : LocaleRef,
    maxNameLen : CULong,
    actualNameLen : Pointer[CULong],
    displayName : Pointer[UShort]) : Int;

external LocaleOperationCountNames(
    opClass : UInt,
    nameCount : Pointer[CULong]) : Int;

external LocaleOperationGetIndName(
    opClass : UInt,
    nameIndex : CULong,
    maxNameLen : CULong,
    actualNameLen : Pointer[CULong],
    displayName : Pointer[UShort],
    displayLocale : Pointer[LocaleRef]) : Int;

alias kBlessedBusErrorBait = 1760651505;

external DebugAssert(
    componentSignature : UInt,
    options : UInt,
    assertionString : Pointer[CChar],
    exceptionLabelString : Pointer[CChar],
    errorString : Pointer[CChar],
    fileName : Pointer[CChar],
    lineNumber : CLong,
    value : RawPointer);

alias k68kInterruptLevelMask = 7;
alias kInVBLTaskMask = 16;
alias kInDeferredTaskMask = 32;
alias kInSecondaryIntHandlerMask = 64;
alias kInNestedInterruptMask = 128;

external TaskLevel() : UInt;

alias kComponentDebugOption = 0;

alias kGetDebugOption = 1;
alias kSetDebugOption = 2;

alias DebugComponentCallbackProcPtr = CCodePointer[[Int,UInt,Pointer[CUChar]],[]];

alias DebugComponentCallbackUPP = DebugComponentCallbackProcPtr;

external NewDebugComponent(
    componentSignature : UInt,
    componentName : ConstStr255Param,
    componentCallback : DebugComponentCallbackUPP) : Int;

external NewDebugOption(
    componentSignature : UInt,
    optionSelectorNum : Int,
    optionName : ConstStr255Param) : Int;

external DisposeDebugComponent(
    componentSignature : UInt) : Int;

external GetDebugComponentInfo(
    itemIndex : UInt,
    componentSignature : Pointer[UInt],
    componentName : Pointer[CUChar]) : Int;

external GetDebugOptionInfo(
    itemIndex : UInt,
    componentSignature : UInt,
    optionSelectorNum : Pointer[Int],
    optionName : Pointer[CUChar],
    optionSetting : Pointer[CUChar]) : Int;

external SetDebugOptionValue(
    componentSignature : UInt,
    optionSelectorNum : Int,
    newOptionSetting : CUChar) : Int;

alias DebugAssertOutputHandlerProcPtr = CCodePointer[[UInt,UInt,Pointer[CChar],Pointer[CChar],Pointer[CChar],Pointer[CChar],CLong,RawPointer,Pointer[CUChar]],[]];

alias DebugAssertOutputHandlerUPP = DebugAssertOutputHandlerProcPtr;

external InstallDebugAssertOutputHandler(
    handler : DebugAssertOutputHandlerUPP);

external GetMacOSStatusErrorString(
    err : Int) : Pointer[CChar];

external GetMacOSStatusCommentString(
    err : Int) : Pointer[CChar];

external NewDebugComponentCallbackUPP(
    userRoutine : DebugComponentCallbackProcPtr) : DebugComponentCallbackUPP;

external NewDebugAssertOutputHandlerUPP(
    userRoutine : DebugAssertOutputHandlerProcPtr) : DebugAssertOutputHandlerUPP;

external DisposeDebugComponentCallbackUPP(
    userUPP : DebugComponentCallbackUPP);

external DisposeDebugAssertOutputHandlerUPP(
    userUPP : DebugAssertOutputHandlerUPP);

external InvokeDebugComponentCallbackUPP(
    optionSelectorNum : Int,
    command : UInt,
    optionSetting : Pointer[CUChar],
    userUPP : DebugComponentCallbackUPP);

external InvokeDebugAssertOutputHandlerUPP(
    componentSignature : UInt,
    options : UInt,
    assertionString : Pointer[CChar],
    exceptionLabelString : Pointer[CChar],
    errorString : Pointer[CChar],
    fileName : Pointer[CChar],
    lineNumber : CLong,
    value : RawPointer,
    outputMsg : ConstStr255Param,
    userUPP : DebugAssertOutputHandlerUPP);

external PLstrcmp(
    str1 : ConstStr255Param,
    str2 : ConstStr255Param) : Short;

external PLstrncmp(
    str1 : ConstStr255Param,
    str2 : ConstStr255Param,
    num : Short) : Short;

external PLstrcpy(
    dest : StringPtr,
    source : ConstStr255Param) : StringPtr;

external PLstrncpy(
    dest : StringPtr,
    source : ConstStr255Param,
    num : Short) : StringPtr;

external PLstrcat(
    str : StringPtr,
    append : ConstStr255Param) : StringPtr;

external PLstrncat(
    str1 : StringPtr,
    append : ConstStr255Param,
    num : Short) : StringPtr;

external PLstrchr(
    str1 : ConstStr255Param,
    ch1 : Short) : Ptr;

external PLstrrchr(
    str1 : ConstStr255Param,
    ch1 : Short) : Ptr;

external PLstrpbrk(
    str1 : ConstStr255Param,
    charSet : ConstStr255Param) : Ptr;

external PLstrspn(
    str1 : ConstStr255Param,
    charSet : ConstStr255Param) : Short;

external PLstrstr(
    str1 : ConstStr255Param,
    searchStr : ConstStr255Param) : Ptr;

external PLstrlen(
    str : ConstStr255Param) : Short;

external PLpos(
    str1 : ConstStr255Param,
    searchStr : ConstStr255Param) : Short;

external CompareAndSwap(
    oldValue : UInt,
    newValue : UInt,
    address : Pointer[UInt]) : CUChar;

external TestAndClear(
    bit : UInt,
    address : Pointer[CUChar]) : CUChar;

external TestAndSet(
    bit : UInt,
    address : Pointer[CUChar]) : CUChar;

external IncrementAtomic8(
    address : Pointer[CChar]) : CChar;

external DecrementAtomic8(
    address : Pointer[CChar]) : CChar;

external AddAtomic8(
    amount : Int,
    address : Pointer[CChar]) : CChar;

external BitAndAtomic8(
    mask : UInt,
    address : Pointer[CUChar]) : CUChar;

external BitOrAtomic8(
    mask : UInt,
    address : Pointer[CUChar]) : CUChar;

external BitXorAtomic8(
    mask : UInt,
    address : Pointer[CUChar]) : CUChar;

external IncrementAtomic16(
    address : Pointer[Short]) : Short;

external DecrementAtomic16(
    address : Pointer[Short]) : Short;

external AddAtomic16(
    amount : Int,
    address : Pointer[Short]) : Short;

external BitAndAtomic16(
    mask : UInt,
    address : Pointer[UShort]) : UShort;

external BitOrAtomic16(
    mask : UInt,
    address : Pointer[UShort]) : UShort;

external BitXorAtomic16(
    mask : UInt,
    address : Pointer[UShort]) : UShort;

external IncrementAtomic(
    address : Pointer[Int]) : Int;

external DecrementAtomic(
    address : Pointer[Int]) : Int;

external AddAtomic(
    amount : Int,
    address : Pointer[Int]) : Int;

external BitAndAtomic(
    mask : UInt,
    address : Pointer[UInt]) : UInt;

external BitOrAtomic(
    mask : UInt,
    address : Pointer[UInt]) : UInt;

external BitXorAtomic(
    mask : UInt,
    address : Pointer[UInt]) : UInt;

alias AreaID = OpaquePointer;

record Struct_MachineInformationPowerPC (
    CTR : UnsignedWide,
    LR : UnsignedWide,
    PC : UnsignedWide,
    CRRegister : CULong,
    XER : CULong,
    MSR : CULong,
    MQ : CULong,
    ExceptKind : CULong,
    DSISR : CULong,
    DAR : UnsignedWide,
    Reserved : UnsignedWide,
);

alias MachineInformationPowerPC = Struct_MachineInformationPowerPC;

record Struct_RegisterInformationPowerPC (
    R0 : UnsignedWide,
    R1 : UnsignedWide,
    R2 : UnsignedWide,
    R3 : UnsignedWide,
    R4 : UnsignedWide,
    R5 : UnsignedWide,
    R6 : UnsignedWide,
    R7 : UnsignedWide,
    R8 : UnsignedWide,
    R9 : UnsignedWide,
    R10 : UnsignedWide,
    R11 : UnsignedWide,
    R12 : UnsignedWide,
    R13 : UnsignedWide,
    R14 : UnsignedWide,
    R15 : UnsignedWide,
    R16 : UnsignedWide,
    R17 : UnsignedWide,
    R18 : UnsignedWide,
    R19 : UnsignedWide,
    R20 : UnsignedWide,
    R21 : UnsignedWide,
    R22 : UnsignedWide,
    R23 : UnsignedWide,
    R24 : UnsignedWide,
    R25 : UnsignedWide,
    R26 : UnsignedWide,
    R27 : UnsignedWide,
    R28 : UnsignedWide,
    R29 : UnsignedWide,
    R30 : UnsignedWide,
    R31 : UnsignedWide,
);

alias RegisterInformationPowerPC = Struct_RegisterInformationPowerPC;

record Struct_FPUInformationPowerPC (
    Registers : Array[UnsignedWide,32],
    FPSCR : CULong,
    Reserved : CULong,
);

alias FPUInformationPowerPC = Struct_FPUInformationPowerPC;

alias Vector128 = AUnionType;

record Struct_VectorInformationPowerPC (
    Registers : Array[Vector128,32],
    VSCR : Vector128,
    VRsave : UInt,
);

alias VectorInformationPowerPC = Struct_VectorInformationPowerPC;

alias kWriteReference = 0;
alias kReadReference = 1;
alias kFetchReference = 2;
alias writeReference = 0;
alias readReference = 1;
alias fetchReference = 2;

alias MemoryReferenceKind = CULong;

record Struct_MemoryExceptionInformation (
    theArea : AreaID,
    theAddress : LogicalAddress,
    theError : Int,
    theReference : CULong,
);

alias MemoryExceptionInformation = Struct_MemoryExceptionInformation;

alias kUnknownException = 0;
alias kIllegalInstructionException = 1;
alias kTrapException = 2;
alias kAccessException = 3;
alias kUnmappedMemoryException = 4;
alias kExcludedMemoryException = 5;
alias kReadOnlyMemoryException = 6;
alias kUnresolvablePageFaultException = 7;
alias kPrivilegeViolationException = 8;
alias kTraceException = 9;
alias kInstructionBreakpointException = 10;
alias kDataBreakpointException = 11;
alias kIntegerException = 12;
alias kFloatingPointException = 13;
alias kStackOverflowException = 14;
alias kTaskTerminationException = 15;
alias kTaskCreationException = 16;
alias kDataAlignmentException = 17;

alias ExceptionKind = CULong;

alias ExceptionInfo = AUnionType;

record Struct_ExceptionInformationPowerPC (
    theKind : CULong,
    machineState : Pointer[MachineInformationPowerPC],
    registerImage : Pointer[RegisterInformationPowerPC],
    FPUImage : Pointer[FPUInformationPowerPC],
    info : ExceptionInfo,
    vectorImage : Pointer[VectorInformationPowerPC],
);

alias ExceptionInformationPowerPC = Struct_ExceptionInformationPowerPC;

alias Vector128Intel = AUnionType;

record Struct_MachineInformationIntel64 (
    CS : CULong,
    FS : CULong,
    GS : CULong,
    RFLAGS : CULong,
    RIP : CULong,
    ExceptTrap : CULong,
    ExceptErr : CULong,
    ExceptAddr : CULong,
);

alias MachineInformationIntel64 = Struct_MachineInformationIntel64;

record Struct_RegisterInformationIntel64 (
    RAX : CULong,
    RBX : CULong,
    RCX : CULong,
    RDX : CULong,
    RDI : CULong,
    RSI : CULong,
    RBP : CULong,
    RSP : CULong,
    R8 : CULong,
    R9 : CULong,
    R10 : CULong,
    R11 : CULong,
    R12 : CULong,
    R13 : CULong,
    R14 : CULong,
    R15 : CULong,
);

alias RegisterInformationIntel64 = Struct_RegisterInformationIntel64;

alias FPRegIntel = Array[CUChar,10];

record Struct_FPUInformationIntel64 (
    Registers : Array[FPRegIntel,8],
    Control : UShort,
    Status : UShort,
    Tag : UShort,
    Opcode : UShort,
    IP : UInt,
    DP : UInt,
    DS : UInt,
);

alias FPUInformationIntel64 = Struct_FPUInformationIntel64;

record Struct_VectorInformationIntel64 (
    Registers : Array[Vector128Intel,16],
);

alias VectorInformationIntel64 = Struct_VectorInformationIntel64;

alias MachineInformation = MachineInformationIntel64;

alias RegisterInformation = RegisterInformationIntel64;

alias FPUInformation = FPUInformationIntel64;

alias VectorInformation = VectorInformationIntel64;

record Struct_ExceptionInformation (
    theKind : CULong,
    machineState : Pointer[MachineInformation],
    registerImage : Pointer[RegisterInformation],
    FPUImage : Pointer[FPUInformation],
    info : ExceptionInfo,
    vectorImage : Pointer[VectorInformation],
);

alias ExceptionInformation = Struct_ExceptionInformation;

alias ExceptionHandlerProcPtr = CCodePointer[[Pointer[Struct_ExceptionInformation]],[Int]];

alias ExceptionHandlerUPP = ExceptionHandlerProcPtr;

external NewExceptionHandlerUPP(
    userRoutine : ExceptionHandlerProcPtr) : ExceptionHandlerUPP;

external DisposeExceptionHandlerUPP(
    userUPP : ExceptionHandlerUPP);

external InvokeExceptionHandlerUPP(
    theException : Pointer[ExceptionInformation],
    userUPP : ExceptionHandlerUPP) : Int;

alias ExceptionHandlerTPP = ExceptionHandlerUPP;

alias ExceptionHandler = ExceptionHandlerTPP;

external InstallExceptionHandler(
    theHandler : ExceptionHandlerTPP) : ExceptionHandlerTPP;

alias durationMicrosecond = 4294967295;
alias durationMillisecond = 1;
alias durationSecond = 1000;
alias durationMinute = 60000;
alias durationHour = 3600000;
alias durationDay = 86400000;
alias durationNoWait = 0;
alias durationForever = 2147483647;

alias Nanoseconds = UnsignedWide;

external UpTime() : AbsoluteTime;

external AbsoluteToNanoseconds(
    absoluteTime : AbsoluteTime) : Nanoseconds;

external AbsoluteToDuration(
    absoluteTime : AbsoluteTime) : Int;

external NanosecondsToAbsolute(
    nanoseconds : Nanoseconds) : AbsoluteTime;

external DurationToAbsolute(
    duration : Int) : AbsoluteTime;

external AddAbsoluteToAbsolute(
    absoluteTime1 : AbsoluteTime,
    absoluteTime2 : AbsoluteTime) : AbsoluteTime;

external SubAbsoluteFromAbsolute(
    leftAbsoluteTime : AbsoluteTime,
    rightAbsoluteTime : AbsoluteTime) : AbsoluteTime;

external AddNanosecondsToAbsolute(
    nanoseconds : Nanoseconds,
    absoluteTime : AbsoluteTime) : AbsoluteTime;

external AddDurationToAbsolute(
    duration : Int,
    absoluteTime : AbsoluteTime) : AbsoluteTime;

external SubNanosecondsFromAbsolute(
    nanoseconds : Nanoseconds,
    absoluteTime : AbsoluteTime) : AbsoluteTime;

external SubDurationFromAbsolute(
    duration : Int,
    absoluteTime : AbsoluteTime) : AbsoluteTime;

external AbsoluteDeltaToNanoseconds(
    leftAbsoluteTime : AbsoluteTime,
    rightAbsoluteTime : AbsoluteTime) : Nanoseconds;

external AbsoluteDeltaToDuration(
    leftAbsoluteTime : AbsoluteTime,
    rightAbsoluteTime : AbsoluteTime) : Int;

external DurationToNanoseconds(
    theDuration : Int) : Nanoseconds;

external NanosecondsToDuration(
    theNanoseconds : Nanoseconds) : Int;

record Struct_NumFormatString (
    fLength : CUChar,
    fVersion : CUChar,
    data : Array[CChar,254],
);

alias NumFormatString = Struct_NumFormatString;

alias NumFormatStringRec = NumFormatString;

alias FormatStatus = Short;

alias fVNumber = 0;

alias FormatClass = CChar;

alias fPositive = 0;
alias fNegative = 1;
alias fZero = 2;

alias FormatResultType = CChar;

alias fFormatOK = 0;
alias fBestGuess = 1;
alias fOutOfSynch = 2;
alias fSpuriousChars = 3;
alias fMissingDelimiter = 4;
alias fExtraDecimal = 5;
alias fMissingLiteral = 6;
alias fExtraExp = 7;
alias fFormatOverflow = 8;
alias fFormStrIsNAN = 9;
alias fBadPartsTable = 10;
alias fExtraPercent = 11;
alias fExtraSeparator = 12;
alias fEmptyFormatString = 13;

record Struct_FVector (
    start : Short,
    length : Short,
);

alias FVector = Struct_FVector;

alias TripleInt = Array[FVector,3];

external numtostring(
    theNum : CLong,
    theString : Pointer[CChar]);

alias systemCurLang = 4294967294;
alias systemDefLang = 4294967293;
alias currentCurLang = 4294967292;
alias currentDefLang = 4294967291;
alias scriptCurLang = 4294967290;
alias scriptDefLang = 4294967289;

alias iuSystemCurLang = 4294967294;
alias iuSystemDefLang = 4294967293;
alias iuCurrentCurLang = 4294967292;
alias iuCurrentDefLang = 4294967291;
alias iuScriptCurLang = 4294967290;
alias iuScriptDefLang = 4294967289;

external Munger(
    h : Handle,
    offset : CLong,
    ptr1 : RawPointer,
    len1 : CLong,
    ptr2 : RawPointer,
    len2 : CLong) : CLong;

external BitTst(
    bytePtr : RawPointer,
    bitNum : CLong) : CUChar;

external BitSet(
    bytePtr : RawPointer,
    bitNum : CLong);

external BitClr(
    bytePtr : RawPointer,
    bitNum : CLong);

external BitAnd(
    value1 : CLong,
    value2 : CLong) : CLong;

external BitOr(
    value1 : CLong,
    value2 : CLong) : CLong;

external BitXor(
    value1 : CLong,
    value2 : CLong) : CLong;

external BitNot(
    value : CLong) : CLong;

external BitShift(
    value : CLong,
    count : Short) : CLong;

alias UCKeyOutput = UShort;

alias UCKeyCharSeq = UShort;

alias kUCKeyOutputStateIndexMask = 16384;
alias kUCKeyOutputSequenceIndexMask = 32768;
alias kUCKeyOutputTestForIndexMask = 49152;
alias kUCKeyOutputGetIndexMask = 16383;

record Struct_UCKeyStateRecord (
    stateZeroCharData : UShort,
    stateZeroNextState : UShort,
    stateEntryCount : UShort,
    stateEntryFormat : UShort,
    stateEntryData : Array[UInt,1],
);

alias UCKeyStateRecord = Struct_UCKeyStateRecord;

alias kUCKeyStateEntryTerminalFormat = 1;
alias kUCKeyStateEntryRangeFormat = 2;

record Struct_UCKeyStateEntryTerminal (
    curState : UShort,
    charData : UShort,
);

alias UCKeyStateEntryTerminal = Struct_UCKeyStateEntryTerminal;

record Struct_UCKeyStateEntryRange (
    curStateStart : UShort,
    curStateRange : CUChar,
    deltaMultiplier : CUChar,
    charData : UShort,
    nextState : UShort,
);

alias UCKeyStateEntryRange = Struct_UCKeyStateEntryRange;

record Struct_UCKeyboardTypeHeader (
    keyboardTypeFirst : UInt,
    keyboardTypeLast : UInt,
    keyModifiersToTableNumOffset : UInt,
    keyToCharTableIndexOffset : UInt,
    keyStateRecordsIndexOffset : UInt,
    keyStateTerminatorsOffset : UInt,
    keySequenceDataIndexOffset : UInt,
);

alias UCKeyboardTypeHeader = Struct_UCKeyboardTypeHeader;

record Struct_UCKeyboardLayout (
    keyLayoutHeaderFormat : UShort,
    keyLayoutDataVersion : UShort,
    keyLayoutFeatureInfoOffset : UInt,
    keyboardTypeCount : UInt,
    keyboardTypeList : Array[UCKeyboardTypeHeader,1],
);

alias UCKeyboardLayout = Struct_UCKeyboardLayout;

record Struct_UCKeyLayoutFeatureInfo (
    keyLayoutFeatureInfoFormat : UShort,
    reserved : UShort,
    maxOutputStringLength : UInt,
);

alias UCKeyLayoutFeatureInfo = Struct_UCKeyLayoutFeatureInfo;

record Struct_UCKeyModifiersToTableNum (
    keyModifiersToTableNumFormat : UShort,
    defaultTableNum : UShort,
    modifiersCount : UInt,
    tableNum : Array[CUChar,1],
);

alias UCKeyModifiersToTableNum = Struct_UCKeyModifiersToTableNum;

record Struct_UCKeyToCharTableIndex (
    keyToCharTableIndexFormat : UShort,
    keyToCharTableSize : UShort,
    keyToCharTableCount : UInt,
    keyToCharTableOffsets : Array[UInt,1],
);

alias UCKeyToCharTableIndex = Struct_UCKeyToCharTableIndex;

record Struct_UCKeyStateRecordsIndex (
    keyStateRecordsIndexFormat : UShort,
    keyStateRecordCount : UShort,
    keyStateRecordOffsets : Array[UInt,1],
);

alias UCKeyStateRecordsIndex = Struct_UCKeyStateRecordsIndex;

record Struct_UCKeyStateTerminators (
    keyStateTerminatorsFormat : UShort,
    keyStateTerminatorCount : UShort,
    keyStateTerminators : Array[UShort,1],
);

alias UCKeyStateTerminators = Struct_UCKeyStateTerminators;

record Struct_UCKeySequenceDataIndex (
    keySequenceDataIndexFormat : UShort,
    charSequenceCount : UShort,
    charSequenceOffsets : Array[UShort,1],
);

alias UCKeySequenceDataIndex = Struct_UCKeySequenceDataIndex;

alias kUCKeyLayoutHeaderFormat = 4098;
alias kUCKeyLayoutFeatureInfoFormat = 8193;
alias kUCKeyModifiersToTableNumFormat = 12289;
alias kUCKeyToCharTableIndexFormat = 16385;
alias kUCKeyStateRecordsIndexFormat = 20481;
alias kUCKeyStateTerminatorsFormat = 24577;
alias kUCKeySequenceDataIndexFormat = 28673;

alias kUCKeyActionDown = 0;
alias kUCKeyActionUp = 1;
alias kUCKeyActionAutoKey = 2;
alias kUCKeyActionDisplay = 3;

alias kUCKeyTranslateNoDeadKeysBit = 0;

alias kUCKeyTranslateNoDeadKeysMask = 1;

alias kUnicodeCollationClass = 1969450860;

alias CollatorRef = OpaquePointer;

alias UCCollateOptions = UInt;

alias kUCCollateComposeInsensitiveMask = 2;
alias kUCCollateWidthInsensitiveMask = 4;
alias kUCCollateCaseInsensitiveMask = 8;
alias kUCCollateDiacritInsensitiveMask = 16;
alias kUCCollatePunctuationSignificantMask = 32768;
alias kUCCollateDigitsOverrideMask = 65536;
alias kUCCollateDigitsAsNumberMask = 131072;

alias kUCCollateStandardOptions = 6;

alias kUCCollateTypeHFSExtended = 1;

alias kUCCollateTypeSourceMask = 255;
alias kUCCollateTypeShiftBits = 24;

alias kUCCollateTypeMask = 4278190080;

alias UCCollationValue = UInt;

alias UCTypeSelectRef = OpaquePointer;

alias UCTypeSelectCompareResult = Int;

alias UCTSWalkDirection = UShort;

alias kUCTSDirectionNext = 0;
alias kUCTSDirectionPrevious = 1;

alias UCTypeSelectOptions = UShort;

alias kUCTSOptionsNoneMask = 0;
alias kUCTSOptionsReleaseStringMask = 1;
alias kUCTSOptionsDataIsOrderedMask = 2;

alias IndexToUCStringProcPtr = CCodePointer[[UInt,RawPointer,RawPointer,Pointer[OpaquePointer],Pointer[UShort]],[CUChar]];

alias IndexToUCStringUPP = IndexToUCStringProcPtr;

external NewIndexToUCStringUPP(
    userRoutine : IndexToUCStringProcPtr) : IndexToUCStringUPP;

external DisposeIndexToUCStringUPP(
    userUPP : IndexToUCStringUPP);

external InvokeIndexToUCStringUPP(
    index : UInt,
    listDataPtr : RawPointer,
    refcon : RawPointer,
    outString : Pointer[CFStringRef],
    tsOptions : Pointer[UShort],
    userUPP : IndexToUCStringUPP) : CUChar;

alias kUCTypeSelectMaxListSize = 4294967295;

alias kUnicodeTextBreakClass = 1969386091;

alias TextBreakLocatorRef = OpaquePointer;

alias UCTextBreakType = UInt;

alias kUCTextBreakCharMask = 1;
alias kUCTextBreakClusterMask = 4;
alias kUCTextBreakWordMask = 16;
alias kUCTextBreakLineMask = 64;
alias kUCTextBreakParagraphMask = 256;

alias UCTextBreakOptions = UInt;

alias kUCTextBreakLeadingEdgeMask = 1;
alias kUCTextBreakGoBackwardsMask = 2;
alias kUCTextBreakIterateMask = 4;

external UCKeyTranslate(
    keyLayoutPtr : Pointer[UCKeyboardLayout],
    virtualKeyCode : UShort,
    keyAction : UShort,
    modifierKeyState : UInt,
    keyboardType : UInt,
    keyTranslateOptions : UInt,
    deadKeyState : Pointer[UInt],
    maxStringLength : CULong,
    actualStringLength : Pointer[CULong],
    unicodeString : Pointer[UShort]) : Int;

external UCCreateCollator(
    locale : LocaleRef,
    opVariant : UInt,
    options : UInt,
    collatorRef : Pointer[CollatorRef]) : Int;

external UCGetCollationKey(
    collatorRef : CollatorRef,
    textPtr : Pointer[UShort],
    textLength : CULong,
    maxKeySize : CULong,
    actualKeySize : Pointer[CULong],
    collationKey : Pointer[UInt]) : Int;

external UCCompareCollationKeys(
    key1Ptr : Pointer[UInt],
    key1Length : CULong,
    key2Ptr : Pointer[UInt],
    key2Length : CULong,
    equivalent : Pointer[CUChar],
    order : Pointer[Int]) : Int;

external UCCompareText(
    collatorRef : CollatorRef,
    text1Ptr : Pointer[UShort],
    text1Length : CULong,
    text2Ptr : Pointer[UShort],
    text2Length : CULong,
    equivalent : Pointer[CUChar],
    order : Pointer[Int]) : Int;

external UCDisposeCollator(
    collatorRef : Pointer[CollatorRef]) : Int;

external UCCompareTextDefault(
    options : UInt,
    text1Ptr : Pointer[UShort],
    text1Length : CULong,
    text2Ptr : Pointer[UShort],
    text2Length : CULong,
    equivalent : Pointer[CUChar],
    order : Pointer[Int]) : Int;

external UCCompareTextNoLocale(
    options : UInt,
    text1Ptr : Pointer[UShort],
    text1Length : CULong,
    text2Ptr : Pointer[UShort],
    text2Length : CULong,
    equivalent : Pointer[CUChar],
    order : Pointer[Int]) : Int;

external UCCreateTextBreakLocator(
    locale : LocaleRef,
    opVariant : UInt,
    breakTypes : UInt,
    breakRef : Pointer[TextBreakLocatorRef]) : Int;

external UCFindTextBreak(
    breakRef : TextBreakLocatorRef,
    breakType : UInt,
    options : UInt,
    textPtr : Pointer[UShort],
    textLength : CULong,
    startOffset : CULong,
    breakOffset : Pointer[CULong]) : Int;

external UCDisposeTextBreakLocator(
    breakRef : Pointer[TextBreakLocatorRef]) : Int;

external UCTypeSelectCreateSelector(
    locale : LocaleRef,
    opVariant : UInt,
    options : UInt,
    newSelector : Pointer[UCTypeSelectRef]) : Int;

external UCTypeSelectFlushSelectorData(
    ref_ : UCTypeSelectRef) : Int;

external UCTypeSelectReleaseSelector(
    ref_ : Pointer[UCTypeSelectRef]) : Int;

external UCTypeSelectWouldResetBuffer(
    inRef : UCTypeSelectRef,
    inText : CFStringRef,
    inEventTime : Double) : CUChar;

external UCTypeSelectAddKeyToSelector(
    inRef : UCTypeSelectRef,
    inText : CFStringRef,
    inEventTime : Double,
    updateFlag : Pointer[CUChar]) : Int;

external UCTypeSelectCompare(
    ref_ : UCTypeSelectRef,
    inText : CFStringRef,
    result : Pointer[Int]) : Int;

external UCTypeSelectFindItem(
    ref_ : UCTypeSelectRef,
    listSize : UInt,
    listDataPtr : RawPointer,
    refcon : RawPointer,
    userUPP : IndexToUCStringUPP,
    closestItem : Pointer[UInt]) : Int;

external UCTypeSelectWalkList(
    ref_ : UCTypeSelectRef,
    currSelect : CFStringRef,
    direction : UShort,
    listSize : UInt,
    listDataPtr : RawPointer,
    refcon : RawPointer,
    userUPP : IndexToUCStringUPP,
    closestItem : Pointer[UInt]) : Int;

external pi : Double;

external compound(
    rate : Double,
    periods : Double) : Double;

external annuity(
    rate : Double,
    periods : Double) : Double;

external randomx(
    x : Pointer[Double]) : Double;

alias relop = Short;

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

external relation(
    x : Double,
    y : Double) : Short;

record Struct_decimal (
    sgn : CChar,
    unused : CChar,
    exp : Short,
    sig : UnnamedRecord,
);

record UnnamedRecord (
    length : CUChar,
    text : Array[CUChar,36],
    unused : CUChar,
);

alias decimal = Struct_decimal;

record Struct_decform (
    style : CChar,
    unused : CChar,
    digits : Short,
);

alias decform = Struct_decform;

external num2dec(
    f : Pointer[decform],
    x : Double,
    d : Pointer[decimal]);

external dec2num(
    d : Pointer[decimal]) : Double;

external dec2str(
    f : Pointer[decform],
    d : Pointer[decimal],
    s : Pointer[CChar]);

external str2dec(
    s : Pointer[CChar],
    ix : Pointer[Short],
    d : Pointer[decimal],
    vp : Pointer[Short]);

external dec2f(
    d : Pointer[decimal]) : Float;

external dec2s(
    d : Pointer[decimal]) : Short;

external dec2l(
    d : Pointer[decimal]) : CLong;

external relationl(
    x : UnsupportedCBuiltinType21,
    y : UnsupportedCBuiltinType21) : Short;

external num2decl(
    f : Pointer[decform],
    x : UnsupportedCBuiltinType21,
    d : Pointer[decimal]);

external dec2numl(
    d : Pointer[decimal]) : UnsupportedCBuiltinType21;

external x80tod(
    x80 : Pointer[extended80]) : Double;

external dtox80(
    x : Pointer[Double],
    x80 : Pointer[extended80]);

external x80told(
    x80 : Pointer[extended80],
    x : Pointer[UnsupportedCBuiltinType21]);

external ldtox80(
    x : Pointer[UnsupportedCBuiltinType21],
    x80 : Pointer[extended80]);

alias TECPluginSignature = UInt;

alias TECPluginVersion = UInt;

alias kTECSignature = 1701733238;
alias kTECUnicodePluginSignature = 1886744169;
alias kTECJapanesePluginSignature = 1886023790;
alias kTECChinesePluginSignature = 1887070319;
alias kTECKoreanPluginSignature = 1886089074;

alias TECObjectRef = OpaquePointer;

alias TECSnifferObjectRef = OpaquePointer;

alias TECPluginSig = UInt;

record Struct_TECConversionInfo (
    sourceEncoding : UInt,
    destinationEncoding : UInt,
    reserved1 : UShort,
    reserved2 : UShort,
);

alias TECConversionInfo = Struct_TECConversionInfo;

alias TECInternetNameUsageMask = UInt;

alias kTECInternetNameDefaultUsageMask = 0;
alias kTECInternetNameStrictUsageMask = 1;
alias kTECInternetNameTolerantUsageMask = 2;

alias kTEC_MIBEnumDontCare = 4294967295;

alias kTECDisableFallbacksBit = 16;
alias kTECDisableLooseMappingsBit = 17;

alias kTECDisableFallbacksMask = 65536;
alias kTECDisableLooseMappingsMask = 131072;

external TECCountAvailableTextEncodings(
    numberEncodings : Pointer[CULong]) : Int;

external TECGetAvailableTextEncodings(
    availableEncodings : Pointer[UInt],
    maxAvailableEncodings : CULong,
    actualAvailableEncodings : Pointer[CULong]) : Int;

external TECCountDirectTextEncodingConversions(
    numberOfEncodings : Pointer[CULong]) : Int;

external TECGetDirectTextEncodingConversions(
    availableConversions : Pointer[TECConversionInfo],
    maxAvailableConversions : CULong,
    actualAvailableConversions : Pointer[CULong]) : Int;

external TECCountDestinationTextEncodings(
    inputEncoding : UInt,
    numberOfEncodings : Pointer[CULong]) : Int;

external TECGetDestinationTextEncodings(
    inputEncoding : UInt,
    destinationEncodings : Pointer[UInt],
    maxDestinationEncodings : CULong,
    actualDestinationEncodings : Pointer[CULong]) : Int;

external TECGetTextEncodingInternetName(
    textEncoding : UInt,
    encodingName : Pointer[CUChar]) : Int;

external TECGetTextEncodingFromInternetName(
    textEncoding : Pointer[UInt],
    encodingName : ConstStr255Param) : Int;

external TECCreateConverter(
    newEncodingConverter : Pointer[TECObjectRef],
    inputEncoding : UInt,
    outputEncoding : UInt) : Int;

external TECCreateConverterFromPath(
    newEncodingConverter : Pointer[TECObjectRef],
    inPath : Pointer[UInt],
    inEncodings : CULong) : Int;

external TECDisposeConverter(
    newEncodingConverter : TECObjectRef) : Int;

external TECClearConverterContextInfo(
    encodingConverter : TECObjectRef) : Int;

external TECConvertText(
    encodingConverter : TECObjectRef,
    inputBuffer : ConstTextPtr,
    inputBufferLength : CULong,
    actualInputLength : Pointer[CULong],
    outputBuffer : TextPtr,
    outputBufferLength : CULong,
    actualOutputLength : Pointer[CULong]) : Int;

external TECFlushText(
    encodingConverter : TECObjectRef,
    outputBuffer : TextPtr,
    outputBufferLength : CULong,
    actualOutputLength : Pointer[CULong]) : Int;

external TECCountSubTextEncodings(
    inputEncoding : UInt,
    numberOfEncodings : Pointer[CULong]) : Int;

external TECGetSubTextEncodings(
    inputEncoding : UInt,
    subEncodings : Pointer[UInt],
    maxSubEncodings : CULong,
    actualSubEncodings : Pointer[CULong]) : Int;

external TECGetEncodingList(
    encodingConverter : TECObjectRef,
    numEncodings : Pointer[CULong],
    encodingList : Pointer[Handle]) : Int;

external TECCreateOneToManyConverter(
    newEncodingConverter : Pointer[TECObjectRef],
    inputEncoding : UInt,
    numOutputEncodings : CULong,
    outputEncodings : Pointer[UInt]) : Int;

external TECConvertTextToMultipleEncodings(
    encodingConverter : TECObjectRef,
    inputBuffer : ConstTextPtr,
    inputBufferLength : CULong,
    actualInputLength : Pointer[CULong],
    outputBuffer : TextPtr,
    outputBufferLength : CULong,
    actualOutputLength : Pointer[CULong],
    outEncodingsBuffer : Pointer[TextEncodingRun],
    maxOutEncodingRuns : CULong,
    actualOutEncodingRuns : Pointer[CULong]) : Int;

external TECFlushMultipleEncodings(
    encodingConverter : TECObjectRef,
    outputBuffer : TextPtr,
    outputBufferLength : CULong,
    actualOutputLength : Pointer[CULong],
    outEncodingsBuffer : Pointer[TextEncodingRun],
    maxOutEncodingRuns : CULong,
    actualOutEncodingRuns : Pointer[CULong]) : Int;

external TECCountWebTextEncodings(
    locale : Short,
    numberEncodings : Pointer[CULong]) : Int;

external TECGetWebTextEncodings(
    locale : Short,
    availableEncodings : Pointer[UInt],
    maxAvailableEncodings : CULong,
    actualAvailableEncodings : Pointer[CULong]) : Int;

external TECCountMailTextEncodings(
    locale : Short,
    numberEncodings : Pointer[CULong]) : Int;

external TECGetMailTextEncodings(
    locale : Short,
    availableEncodings : Pointer[UInt],
    maxAvailableEncodings : CULong,
    actualAvailableEncodings : Pointer[CULong]) : Int;

external TECCountAvailableSniffers(
    numberOfEncodings : Pointer[CULong]) : Int;

external TECGetAvailableSniffers(
    availableSniffers : Pointer[UInt],
    maxAvailableSniffers : CULong,
    actualAvailableSniffers : Pointer[CULong]) : Int;

external TECCreateSniffer(
    encodingSniffer : Pointer[TECSnifferObjectRef],
    testEncodings : Pointer[UInt],
    numTextEncodings : CULong) : Int;

external TECSniffTextEncoding(
    encodingSniffer : TECSnifferObjectRef,
    inputBuffer : ConstTextPtr,
    inputBufferLength : CULong,
    testEncodings : Pointer[UInt],
    numTextEncodings : CULong,
    numErrsArray : Pointer[CULong],
    maxErrs : CULong,
    numFeaturesArray : Pointer[CULong],
    maxFeatures : CULong) : Int;

external TECDisposeSniffer(
    encodingSniffer : TECSnifferObjectRef) : Int;

external TECClearSnifferContextInfo(
    encodingSniffer : TECSnifferObjectRef) : Int;

external TECSetBasicOptions(
    encodingConverter : TECObjectRef,
    controlFlags : UInt) : Int;

external TECCopyTextEncodingInternetNameAndMIB(
    textEncoding : UInt,
    usage : UInt,
    encodingNamePtr : Pointer[CFStringRef],
    mibEnumPtr : Pointer[Int]) : Int;

external TECGetTextEncodingFromInternetNameOrMIB(
    textEncodingPtr : Pointer[UInt],
    usage : UInt,
    encodingName : CFStringRef,
    mibEnum : Int) : Int;

alias TextToUnicodeInfo = OpaquePointer;

alias UnicodeToTextInfo = OpaquePointer;

alias UnicodeToTextRunInfo = OpaquePointer;

alias ConstTextToUnicodeInfo = TextToUnicodeInfo;

alias ConstUnicodeToTextInfo = UnicodeToTextInfo;

alias UnicodeMapVersion = Int;

alias kUnicodeUseLatestMapping = 4294967295;
alias kUnicodeUseHFSPlusMapping = 4;

record Struct_UnicodeMapping (
    unicodeEncoding : UInt,
    otherEncoding : UInt,
    mappingVersion : Int,
);

alias UnicodeMapping = Struct_UnicodeMapping;

alias UnicodeMappingPtr = Pointer[UnicodeMapping];

alias ConstUnicodeMappingPtr = Pointer[UnicodeMapping];

alias kUnicodeUseFallbacksBit = 0;
alias kUnicodeKeepInfoBit = 1;
alias kUnicodeDirectionalityBits = 2;
alias kUnicodeVerticalFormBit = 4;
alias kUnicodeLooseMappingsBit = 5;
alias kUnicodeStringUnterminatedBit = 6;
alias kUnicodeTextRunBit = 7;
alias kUnicodeKeepSameEncodingBit = 8;
alias kUnicodeForceASCIIRangeBit = 9;
alias kUnicodeNoHalfwidthCharsBit = 10;
alias kUnicodeTextRunHeuristicsBit = 11;
alias kUnicodeMapLineFeedToReturnBit = 12;
alias kUnicodeUseExternalEncodingFormBit = 13;

alias kUnicodeUseFallbacksMask = 1;
alias kUnicodeKeepInfoMask = 2;
alias kUnicodeDirectionalityMask = 12;
alias kUnicodeVerticalFormMask = 16;
alias kUnicodeLooseMappingsMask = 32;
alias kUnicodeStringUnterminatedMask = 64;
alias kUnicodeTextRunMask = 128;
alias kUnicodeKeepSameEncodingMask = 256;
alias kUnicodeForceASCIIRangeMask = 512;
alias kUnicodeNoHalfwidthCharsMask = 1024;
alias kUnicodeTextRunHeuristicsMask = 2048;
alias kUnicodeMapLineFeedToReturnMask = 4096;
alias kUnicodeUseExternalEncodingFormMask = 8192;

alias kUnicodeDefaultDirection = 0;
alias kUnicodeLeftToRight = 1;
alias kUnicodeRightToLeft = 2;

alias kUnicodeDefaultDirectionMask = 0;
alias kUnicodeLeftToRightMask = 4;
alias kUnicodeRightToLeftMask = 8;

alias kUnicodeMatchUnicodeBaseBit = 0;
alias kUnicodeMatchUnicodeVariantBit = 1;
alias kUnicodeMatchUnicodeFormatBit = 2;
alias kUnicodeMatchOtherBaseBit = 3;
alias kUnicodeMatchOtherVariantBit = 4;
alias kUnicodeMatchOtherFormatBit = 5;

alias kUnicodeMatchUnicodeBaseMask = 1;
alias kUnicodeMatchUnicodeVariantMask = 2;
alias kUnicodeMatchUnicodeFormatMask = 4;
alias kUnicodeMatchOtherBaseMask = 8;
alias kUnicodeMatchOtherVariantMask = 16;
alias kUnicodeMatchOtherFormatMask = 32;

alias kUnicodeFallbackSequencingBits = 0;

alias kUnicodeFallbackSequencingMask = 3;
alias kUnicodeFallbackInterruptSafeMask = 4;

alias kUnicodeFallbackDefaultOnly = 0;
alias kUnicodeFallbackCustomOnly = 1;
alias kUnicodeFallbackDefaultFirst = 2;
alias kUnicodeFallbackCustomFirst = 3;

alias UnicodeToTextFallbackProcPtr = CCodePointer[[Pointer[UShort],CULong,Pointer[CULong],Pointer[CUChar],CULong,Pointer[CULong],RawPointer,Pointer[Struct_UnicodeMapping]],[Int]];

alias UnicodeToTextFallbackUPP = UnicodeToTextFallbackProcPtr;

external NewUnicodeToTextFallbackUPP(
    userRoutine : UnicodeToTextFallbackProcPtr) : UnicodeToTextFallbackUPP;

external DisposeUnicodeToTextFallbackUPP(
    userUPP : UnicodeToTextFallbackUPP);

external InvokeUnicodeToTextFallbackUPP(
    iSrcUniStr : Pointer[UShort],
    iSrcUniStrLen : CULong,
    oSrcConvLen : Pointer[CULong],
    oDestStr : TextPtr,
    iDestStrLen : CULong,
    oDestConvLen : Pointer[CULong],
    iInfoPtr : LogicalAddress,
    iUnicodeMappingPtr : ConstUnicodeMappingPtr,
    userUPP : UnicodeToTextFallbackUPP) : Int;

external CreateTextToUnicodeInfo(
    iUnicodeMapping : ConstUnicodeMappingPtr,
    oTextToUnicodeInfo : Pointer[TextToUnicodeInfo]) : Int;

external CreateTextToUnicodeInfoByEncoding(
    iEncoding : UInt,
    oTextToUnicodeInfo : Pointer[TextToUnicodeInfo]) : Int;

external CreateUnicodeToTextInfo(
    iUnicodeMapping : ConstUnicodeMappingPtr,
    oUnicodeToTextInfo : Pointer[UnicodeToTextInfo]) : Int;

external CreateUnicodeToTextInfoByEncoding(
    iEncoding : UInt,
    oUnicodeToTextInfo : Pointer[UnicodeToTextInfo]) : Int;

external CreateUnicodeToTextRunInfo(
    iNumberOfMappings : CULong,
    iUnicodeMappings : Pointer[UnicodeMapping],
    oUnicodeToTextInfo : Pointer[UnicodeToTextRunInfo]) : Int;

external CreateUnicodeToTextRunInfoByEncoding(
    iNumberOfEncodings : CULong,
    iEncodings : Pointer[UInt],
    oUnicodeToTextInfo : Pointer[UnicodeToTextRunInfo]) : Int;

external CreateUnicodeToTextRunInfoByScriptCode(
    iNumberOfScriptCodes : CULong,
    iScripts : Pointer[Short],
    oUnicodeToTextInfo : Pointer[UnicodeToTextRunInfo]) : Int;

external ChangeTextToUnicodeInfo(
    ioTextToUnicodeInfo : TextToUnicodeInfo,
    iUnicodeMapping : ConstUnicodeMappingPtr) : Int;

external ChangeUnicodeToTextInfo(
    ioUnicodeToTextInfo : UnicodeToTextInfo,
    iUnicodeMapping : ConstUnicodeMappingPtr) : Int;

external DisposeTextToUnicodeInfo(
    ioTextToUnicodeInfo : Pointer[TextToUnicodeInfo]) : Int;

external DisposeUnicodeToTextInfo(
    ioUnicodeToTextInfo : Pointer[UnicodeToTextInfo]) : Int;

external DisposeUnicodeToTextRunInfo(
    ioUnicodeToTextRunInfo : Pointer[UnicodeToTextRunInfo]) : Int;

external ConvertFromTextToUnicode(
    iTextToUnicodeInfo : TextToUnicodeInfo,
    iSourceLen : CULong,
    iSourceStr : ConstLogicalAddress,
    iControlFlags : UInt,
    iOffsetCount : CULong,
    iOffsetArray : Pointer[CULong],
    oOffsetCount : Pointer[CULong],
    oOffsetArray : Pointer[CULong],
    iOutputBufLen : CULong,
    oSourceRead : Pointer[CULong],
    oUnicodeLen : Pointer[CULong],
    oUnicodeStr : Pointer[UShort]) : Int;

external ConvertFromUnicodeToText(
    iUnicodeToTextInfo : UnicodeToTextInfo,
    iUnicodeLen : CULong,
    iUnicodeStr : Pointer[UShort],
    iControlFlags : UInt,
    iOffsetCount : CULong,
    iOffsetArray : Pointer[CULong],
    oOffsetCount : Pointer[CULong],
    oOffsetArray : Pointer[CULong],
    iOutputBufLen : CULong,
    oInputRead : Pointer[CULong],
    oOutputLen : Pointer[CULong],
    oOutputStr : LogicalAddress) : Int;

external ConvertFromUnicodeToTextRun(
    iUnicodeToTextInfo : UnicodeToTextRunInfo,
    iUnicodeLen : CULong,
    iUnicodeStr : Pointer[UShort],
    iControlFlags : UInt,
    iOffsetCount : CULong,
    iOffsetArray : Pointer[CULong],
    oOffsetCount : Pointer[CULong],
    oOffsetArray : Pointer[CULong],
    iOutputBufLen : CULong,
    oInputRead : Pointer[CULong],
    oOutputLen : Pointer[CULong],
    oOutputStr : LogicalAddress,
    iEncodingRunBufLen : CULong,
    oEncodingRunOutLen : Pointer[CULong],
    oEncodingRuns : Pointer[TextEncodingRun]) : Int;

external ConvertFromUnicodeToScriptCodeRun(
    iUnicodeToTextInfo : UnicodeToTextRunInfo,
    iUnicodeLen : CULong,
    iUnicodeStr : Pointer[UShort],
    iControlFlags : UInt,
    iOffsetCount : CULong,
    iOffsetArray : Pointer[CULong],
    oOffsetCount : Pointer[CULong],
    oOffsetArray : Pointer[CULong],
    iOutputBufLen : CULong,
    oInputRead : Pointer[CULong],
    oOutputLen : Pointer[CULong],
    oOutputStr : LogicalAddress,
    iScriptRunBufLen : CULong,
    oScriptRunOutLen : Pointer[CULong],
    oScriptCodeRuns : Pointer[ScriptCodeRun]) : Int;

external TruncateForTextToUnicode(
    iTextToUnicodeInfo : ConstTextToUnicodeInfo,
    iSourceLen : CULong,
    iSourceStr : ConstLogicalAddress,
    iMaxLen : CULong,
    oTruncatedLen : Pointer[CULong]) : Int;

external TruncateForUnicodeToText(
    iUnicodeToTextInfo : ConstUnicodeToTextInfo,
    iSourceLen : CULong,
    iSourceStr : Pointer[UShort],
    iControlFlags : UInt,
    iMaxLen : CULong,
    oTruncatedLen : Pointer[CULong]) : Int;

external ConvertFromPStringToUnicode(
    iTextToUnicodeInfo : TextToUnicodeInfo,
    iPascalStr : ConstStr255Param,
    iOutputBufLen : CULong,
    oUnicodeLen : Pointer[CULong],
    oUnicodeStr : Pointer[UShort]) : Int;

external ConvertFromUnicodeToPString(
    iUnicodeToTextInfo : UnicodeToTextInfo,
    iUnicodeLen : CULong,
    iUnicodeStr : Pointer[UShort],
    oPascalStr : Pointer[CUChar]) : Int;

external CountUnicodeMappings(
    iFilter : UInt,
    iFindMapping : ConstUnicodeMappingPtr,
    oActualCount : Pointer[CULong]) : Int;

external QueryUnicodeMappings(
    iFilter : UInt,
    iFindMapping : ConstUnicodeMappingPtr,
    iMaxCount : CULong,
    oActualCount : Pointer[CULong],
    oReturnedMappings : Pointer[UnicodeMapping]) : Int;

external SetFallbackUnicodeToText(
    iUnicodeToTextInfo : UnicodeToTextInfo,
    iFallback : UnicodeToTextFallbackUPP,
    iControlFlags : UInt,
    iInfoPtr : LogicalAddress) : Int;

external SetFallbackUnicodeToTextRun(
    iUnicodeToTextRunInfo : UnicodeToTextRunInfo,
    iFallback : UnicodeToTextFallbackUPP,
    iControlFlags : UInt,
    iInfoPtr : LogicalAddress) : Int;

external ResetTextToUnicodeInfo(
    ioTextToUnicodeInfo : TextToUnicodeInfo) : Int;

external ResetUnicodeToTextInfo(
    ioUnicodeToTextInfo : UnicodeToTextInfo) : Int;

external ResetUnicodeToTextRunInfo(
    ioUnicodeToTextRunInfo : UnicodeToTextRunInfo) : Int;

alias ThreadState = UShort;

alias kReadyThreadState = 0;
alias kStoppedThreadState = 1;
alias kRunningThreadState = 2;

alias ThreadTaskRef = RawPointer;

alias ThreadStyle = UInt;

alias kCooperativeThread = 1;
alias kPreemptiveThread = 2;

alias ThreadID = CULong;

alias kNoThreadID = 0;
alias kCurrentThreadID = 1;
alias kApplicationThreadID = 2;

alias ThreadOptions = UInt;

alias kNewSuspend = 1;
alias kUsePremadeThread = 2;
alias kCreateIfNeeded = 4;
alias kFPUNotNeeded = 8;
alias kExactMatchThread = 16;

record Struct_SchedulerInfoRec (
    InfoRecSize : UInt,
    CurrentThreadID : CULong,
    SuggestedThreadID : CULong,
    InterruptedCoopThreadID : CULong,
);

alias SchedulerInfoRec = Struct_SchedulerInfoRec;

alias SchedulerInfoRecPtr = Pointer[SchedulerInfoRec];

alias voidPtr = RawPointer;

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

alias ThreadSchedulerProcPtr = CCodePointer[[Pointer[Struct_SchedulerInfoRec]],[CULong]];

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

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

alias DebuggerNewThreadProcPtr = CCodePointer[[CULong],[]];

alias DebuggerDisposeThreadProcPtr = CCodePointer[[CULong],[]];

alias DebuggerThreadSchedulerProcPtr = CCodePointer[[Pointer[Struct_SchedulerInfoRec]],[CULong]];

alias ThreadEntryUPP = ThreadEntryProcPtr;

alias ThreadSchedulerUPP = ThreadSchedulerProcPtr;

alias ThreadSwitchUPP = ThreadSwitchProcPtr;

alias ThreadTerminationUPP = ThreadTerminationProcPtr;

alias DebuggerNewThreadUPP = DebuggerNewThreadProcPtr;

alias DebuggerDisposeThreadUPP = DebuggerDisposeThreadProcPtr;

alias DebuggerThreadSchedulerUPP = DebuggerThreadSchedulerProcPtr;

external NewThreadEntryUPP(
    userRoutine : ThreadEntryProcPtr) : ThreadEntryUPP;

external NewThreadSchedulerUPP(
    userRoutine : ThreadSchedulerProcPtr) : ThreadSchedulerUPP;

external NewThreadSwitchUPP(
    userRoutine : ThreadSwitchProcPtr) : ThreadSwitchUPP;

external NewThreadTerminationUPP(
    userRoutine : ThreadTerminationProcPtr) : ThreadTerminationUPP;

external NewDebuggerNewThreadUPP(
    userRoutine : DebuggerNewThreadProcPtr) : DebuggerNewThreadUPP;

external NewDebuggerDisposeThreadUPP(
    userRoutine : DebuggerDisposeThreadProcPtr) : DebuggerDisposeThreadUPP;

external NewDebuggerThreadSchedulerUPP(
    userRoutine : DebuggerThreadSchedulerProcPtr) : DebuggerThreadSchedulerUPP;

external DisposeThreadEntryUPP(
    userUPP : ThreadEntryUPP);

external DisposeThreadSchedulerUPP(
    userUPP : ThreadSchedulerUPP);

external DisposeThreadSwitchUPP(
    userUPP : ThreadSwitchUPP);

external DisposeThreadTerminationUPP(
    userUPP : ThreadTerminationUPP);

external DisposeDebuggerNewThreadUPP(
    userUPP : DebuggerNewThreadUPP);

external DisposeDebuggerDisposeThreadUPP(
    userUPP : DebuggerDisposeThreadUPP);

external DisposeDebuggerThreadSchedulerUPP(
    userUPP : DebuggerThreadSchedulerUPP);

external InvokeThreadEntryUPP(
    threadParam : RawPointer,
    userUPP : ThreadEntryUPP) : voidPtr;

external InvokeThreadSchedulerUPP(
    schedulerInfo : SchedulerInfoRecPtr,
    userUPP : ThreadSchedulerUPP) : CULong;

external InvokeThreadSwitchUPP(
    threadBeingSwitched : CULong,
    switchProcParam : RawPointer,
    userUPP : ThreadSwitchUPP);

external InvokeThreadTerminationUPP(
    threadTerminated : CULong,
    terminationProcParam : RawPointer,
    userUPP : ThreadTerminationUPP);

external InvokeDebuggerNewThreadUPP(
    threadCreated : CULong,
    userUPP : DebuggerNewThreadUPP);

external InvokeDebuggerDisposeThreadUPP(
    threadDeleted : CULong,
    userUPP : DebuggerDisposeThreadUPP);

external InvokeDebuggerThreadSchedulerUPP(
    schedulerInfo : SchedulerInfoRecPtr,
    userUPP : DebuggerThreadSchedulerUPP) : CULong;

alias ThreadEntryTPP = ThreadEntryUPP;

alias ThreadSchedulerTPP = ThreadSchedulerUPP;

alias ThreadSwitchTPP = ThreadSwitchUPP;

alias ThreadTerminationTPP = ThreadTerminationUPP;

alias DebuggerNewThreadTPP = DebuggerNewThreadUPP;

alias DebuggerDisposeThreadTPP = DebuggerDisposeThreadUPP;

alias DebuggerThreadSchedulerTPP = DebuggerThreadSchedulerUPP;

external NewThread(
    threadStyle : UInt,
    threadEntry : ThreadEntryTPP,
    threadParam : RawPointer,
    stackSize : CLong,
    options : UInt,
    threadResult : Pointer[RawPointer],
    threadMade : Pointer[CULong]) : Short;

external SetThreadScheduler(
    threadScheduler : ThreadSchedulerTPP) : Short;

external SetThreadSwitcher(
    thread : CULong,
    threadSwitcher : ThreadSwitchTPP,
    switchProcParam : RawPointer,
    inOrOut : CUChar) : Short;

external SetThreadTerminator(
    thread : CULong,
    threadTerminator : ThreadTerminationTPP,
    terminationProcParam : RawPointer) : Short;

external SetDebuggerNotificationProcs(
    notifyNewThread : DebuggerNewThreadTPP,
    notifyDisposeThread : DebuggerDisposeThreadTPP,
    notifyThreadScheduler : DebuggerThreadSchedulerTPP) : Short;

external CreateThreadPool(
    threadStyle : UInt,
    numToCreate : Short,
    stackSize : CLong) : Short;

external GetDefaultThreadStackSize(
    threadStyle : UInt,
    stackSize : Pointer[CLong]) : Short;

external ThreadCurrentStackSpace(
    thread : CULong,
    freeStack : Pointer[CULong]) : Short;

external DisposeThread(
    threadToDump : CULong,
    threadResult : RawPointer,
    recycleThread : CUChar) : Short;

external YieldToThread(
    suggestedThread : CULong) : Short;

external YieldToAnyThread() : Short;

external GetCurrentThread(
    currentThreadID : Pointer[CULong]) : Short;

external GetThreadState(
    threadToGet : CULong,
    threadState : Pointer[UShort]) : Short;

external SetThreadState(
    threadToSet : CULong,
    newState : UShort,
    suggestedThread : CULong) : Short;

external SetThreadStateEndCritical(
    threadToSet : CULong,
    newState : UShort,
    suggestedThread : CULong) : Short;

external ThreadBeginCritical() : Short;

external ThreadEndCritical() : Short;

external GetThreadCurrentTaskRef(
    threadTRef : Pointer[ThreadTaskRef]) : Short;

external GetThreadStateGivenTaskRef(
    threadTRef : ThreadTaskRef,
    threadToGet : CULong,
    threadState : Pointer[UShort]) : Short;

external SetThreadReadyGivenTaskRef(
    threadTRef : ThreadTaskRef,
    threadToSet : CULong) : Short;

alias kOnSystemDisk = 4294934528;
alias kOnAppropriateDisk = 4294934529;
alias kSystemDomain = 4294934530;
alias kLocalDomain = 4294934531;
alias kNetworkDomain = 4294934532;
alias kUserDomain = 4294934533;
alias kClassicDomain = 4294934534;
alias kFolderManagerLastDomain = 4294934536;

alias kLastDomainConstant = 4294934536;

alias kCreateFolder = 1;
alias kDontCreateFolder = 0;

external FindFolder(
    vRefNum : Short,
    folderType : UInt,
    createFolder : CUChar,
    foundVRefNum : Pointer[Short],
    foundDirID : Pointer[Int]) : Short;

external ReleaseFolder(
    vRefNum : Short,
    folderType : UInt) : Short;

external FSFindFolder(
    vRefNum : Short,
    folderType : UInt,
    createFolder : CUChar,
    foundRef : Pointer[FSRef]) : Short;

alias kDesktopFolderType = 1684370283;
alias kTrashFolderType = 1953657704;
alias kWhereToEmptyTrashFolderType = 1701671028;
alias kFontsFolderType = 1718578804;
alias kPreferencesFolderType = 1886545254;
alias kSystemPreferencesFolderType = 1936749158;
alias kTemporaryFolderType = 1952804208;
alias kChewableItemsFolderType = 1718382196;
alias kTemporaryItemsInCacheDataFolderType = 1987341680;
alias kApplicationsFolderType = 1634758771;
alias kVolumeRootFolderType = 1919905652;
alias kDomainTopLevelFolderType = 1685352304;
alias kDomainLibraryFolderType = 1684826466;
alias kUsersFolderType = 1970500211;
alias kCurrentUserFolderType = 1668641650;
alias kSharedUserDataFolderType = 1935958388;

alias kDocumentsFolderType = 1685021555;
alias kPictureDocumentsFolderType = 1885630307;
alias kMovieDocumentsFolderType = 1835298659;
alias kMusicDocumentsFolderType = 3043258211;
alias kInternetSitesFolderType = 1936290917;
alias kPublicFolderType = 1886741090;

alias kSharedLibrariesFolderType = 3295439202;
alias kVoicesFolderType = 1719037795;
alias kUtilitiesFolderType = 1970563524;
alias kThemesFolderType = 1953000805;
alias kFavoritesFolderType = 1717663347;
alias kInternetSearchSitesFolderType = 1769173862;
alias kInstallerLogsFolderType = 1768712038;
alias kScriptsFolderType = 1935897284;
alias kFolderActionsFolderType = 1717662566;
alias kSpeakableItemsFolderType = 1936747369;
alias kKeychainFolderType = 1801676910;

alias kColorSyncFolderType = 1937337955;
alias kColorSyncCMMFolderType = 1667460461;
alias kColorSyncScriptingFolderType = 1668506482;
alias kPrintersFolderType = 1768779890;
alias kSpeechFolderType = 1936745320;
alias kCarbonLibraryFolderType = 1667330658;
alias kDocumentationFolderType = 1768842863;
alias kISSDownloadsFolderType = 1769173860;
alias kUserSpecificTmpFolderType = 1970564464;
alias kCachedDataFolderType = 1667326824;
alias kFrameworksFolderType = 1718772077;
alias kPrivateFrameworksFolderType = 1885762157;
alias kClassicDesktopFolderType = 1935962987;
alias kSystemSoundsFolderType = 1936944740;
alias kComponentsFolderType = 1668116580;
alias kQuickTimeComponentsFolderType = 2003004784;
alias kCoreServicesFolderType = 1668510326;
alias kAudioSupportFolderType = 1633970543;
alias kAudioPresetsFolderType = 1634759540;
alias kAudioSoundsFolderType = 1634954852;
alias kAudioSoundBanksFolderType = 1650552427;
alias kAudioAlertSoundsFolderType = 1634497140;
alias kAudioPlugInsFolderType = 1634757735;
alias kAudioComponentsFolderType = 1633906032;
alias kKernelExtensionsFolderType = 1801812084;
alias kDirectoryServicesFolderType = 1685287542;
alias kDirectoryServicesPlugInsFolderType = 1685089383;
alias kInstallerReceiptsFolderType = 1919119476;
alias kFileSystemSupportFolderType = 1718843763;
alias kAppleShareSupportFolderType = 1936220530;
alias kAppleShareAuthenticationFolderType = 1635087464;
alias kMIDIDriversFolderType = 1835623529;
alias kKeyboardLayoutsFolderType = 1802264953;
alias kIndexFilesFolderType = 1768842360;
alias kFindByContentIndexesFolderType = 1717724024;
alias kManagedItemsFolderType = 1835101799;
alias kBootTimeStartupItemsFolderType = 1701671034;
alias kAutomatorWorkflowsFolderType = 1718382455;
alias kAutosaveInformationFolderType = 1634951542;
alias kSpotlightSavedSearchesFolderType = 1936748404;
alias kSpotlightImportersFolderType = 1936289136;
alias kSpotlightMetadataCacheFolderType = 1935893352;
alias kInputManagersFolderType = 1768845428;
alias kInputMethodsFolderType = 1768845414;
alias kLibraryAssistantsFolderType = 1634956396;
alias kAudioDigidesignFolderType = 1633970535;
alias kAudioVSTFolderType = 1635152756;
alias kColorPickersFolderType = 1668311922;
alias kCompositionsFolderType = 1668116595;
alias kFontCollectionsFolderType = 1718510444;
alias kiMovieFolderType = 1768779638;
alias kiMoviePlugInsFolderType = 1768779881;
alias kiMovieSoundEffectsFolderType = 1768780645;
alias kDownloadsFolderType = 1685026670;

alias kColorSyncProfilesFolderType = 1886547814;
alias kApplicationSupportFolderType = 1634956656;
alias kTextEncodingsFolderType = 3295962488;
alias kPrinterDescriptionFolderType = 1886413926;
alias kPrinterDriverFolderType = 3295703652;
alias kScriptingAdditionsFolderType = 3295896434;

alias kClassicPreferencesFolderType = 1668313702;

alias kQuickLookFolderType = 1902928747;

alias kSystemFolderType = 1835098995;
alias kSystemDesktopFolderType = 1935962987;
alias kSystemTrashFolderType = 1937011315;
alias kPrintMonitorDocsFolderType = 1886547572;
alias kALMModulesFolderType = 2002873451;
alias kALMPreferencesFolderType = 1953655152;
alias kALMLocationsFolderType = 1717660780;
alias kAppleExtrasFolderType = 1634040004;
alias kContextualMenuItemsFolderType = 1668116085;
alias kMacOSReadMesFolderType = 1836020420;
alias kStartupFolderType = 1937011316;
alias kShutdownFolderType = 1936221286;
alias kAppleMenuFolderType = 1634561653;
alias kControlPanelFolderType = 1668575852;
alias kSystemControlPanelFolderType = 1935897708;
alias kExtensionFolderType = 1702392942;
alias kExtensionDisabledFolderType = 1702392900;
alias kControlPanelDisabledFolderType = 1668575812;
alias kSystemExtensionDisabledFolderType = 1835098948;
alias kStartupItemsDisabledFolderType = 1937011268;
alias kShutdownItemsDisabledFolderType = 1936221252;
alias kAssistantsFolderType = 1634956484;
alias kStationeryFolderType = 1868854132;
alias kOpenDocFolderType = 1868853092;
alias kOpenDocShellPlugInsFolderType = 1868854128;
alias kEditorsFolderType = 1868850532;
alias kOpenDocEditorsFolderType = 3295634534;
alias kOpenDocLibrariesFolderType = 1868852322;
alias kGenEditorsFolderType = 3294979177;
alias kHelpFolderType = 3295177840;
alias kInternetPlugInFolderType = 3295569268;
alias kModemScriptsFolderType = 3295506276;
alias kControlStripModulesFolderType = 1935959414;
alias kInternetFolderType = 1768846532;
alias kAppearanceFolderType = 1634758770;
alias kSoundSetsFolderType = 1936614515;
alias kDesktopPicturesFolderType = 1685352644;
alias kFindSupportFolderType = 1718510707;
alias kRecentApplicationsFolderType = 1918988400;
alias kRecentDocumentsFolderType = 1919184739;
alias kRecentServersFolderType = 1920169586;
alias kLauncherItemsFolderType = 1818326382;
alias kQuickTimeExtensionsFolderType = 1903453560;
alias kDisplayExtensionsFolderType = 1685287020;
alias kMultiprocessingFolderType = 1836087398;
alias kPrintingPlugInsFolderType = 1886415975;
alias kAppleshareAutomountServerAliasesFolderType = 1936881348;
alias kVolumeSettingsFolderType = 1987274340;
alias kPreMacOS91ApplicationsFolderType = 2356179059;
alias kPreMacOS91InstallerLogsFolderType = 2490132326;
alias kPreMacOS91AssistantsFolderType = 2356376772;
alias kPreMacOS91UtilitiesFolderType = 2675206596;
alias kPreMacOS91AppleExtrasFolderType = 2355460292;
alias kPreMacOS91MacOSReadMesFolderType = 3043979972;
alias kPreMacOS91InternetFolderType = 2490266820;
alias kPreMacOS91AutomountedServersFolderType = 2809296580;
alias kPreMacOS91StationeryFolderType = 3211031412;
alias kLocalesFolderType = 3295440739;
alias kFindByContentPluginsFolderType = 1717724016;
alias kFindByContentFolderType = 1717724006;

alias kMagicTemporaryItemsFolderType = 1836346736;
alias kTemporaryItemsInUserDomainFolderType = 1952804209;
alias kCurrentUserRemoteFolderLocation = 1920299878;
alias kCurrentUserRemoteFolderType = 1920299890;

alias kDeveloperDocsFolderType = 1684303715;
alias kDeveloperHelpFolderType = 1684371048;
alias kDeveloperFolderType = 1684371046;
alias kDeveloperApplicationsFolderType = 1684107376;

alias kCreateFolderAtBoot = 2;
alias kCreateFolderAtBootBit = 1;
alias kFolderCreatedInvisible = 4;
alias kFolderCreatedInvisibleBit = 2;
alias kFolderCreatedNameLocked = 8;
alias kFolderCreatedNameLockedBit = 3;
alias kFolderCreatedAdminPrivs = 16;
alias kFolderCreatedAdminPrivsBit = 4;

alias kFolderInUserFolder = 32;
alias kFolderInUserFolderBit = 5;
alias kFolderTrackedByAlias = 64;
alias kFolderTrackedByAliasBit = 6;
alias kFolderInRemoteUserFolderIfAvailable = 128;
alias kFolderInRemoteUserFolderIfAvailableBit = 7;
alias kFolderNeverMatchedInIdentifyFolder = 256;
alias kFolderNeverMatchedInIdentifyFolderBit = 8;
alias kFolderMustStayOnSameVolume = 512;
alias kFolderMustStayOnSameVolumeBit = 9;
alias kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledMask = 1024;
alias kFolderManagerFolderInMacOS9FolderIfMacOSXIsInstalledBit = 10;
alias kFolderInLocalOrRemoteUserFolder = 160;
alias kFolderManagerNotCreatedOnRemoteVolumesBit = 11;
alias kFolderManagerNotCreatedOnRemoteVolumesMask = 2048;
alias kFolderManagerNewlyCreatedFolderIsLocalizedBit = 12;
alias kFolderManagerNewlyCreatedFolderShouldHaveDotLocalizedCreatedWithinMask = 4096;

alias FolderDescFlags = UInt;

alias kRelativeFolder = 1919249510;
alias kRedirectedRelativeFolder = 1920099692;
alias kSpecialFolder = 1936745318;

alias FolderClass = UInt;

alias kBlessedFolder = 1651274598;
alias kRootFolder = 1919906918;

alias kCurrentUserFolderLocation = 1668641638;

alias kDictionariesFolderType = 1684628340;
alias kLogsFolderType = 1819240307;
alias kPreferencePanesFolderType = 1886413166;

alias kWidgetsFolderType = 2003068788;
alias kScreenSaversFolderType = 1935897198;

alias FolderType = UInt;

alias FolderLocation = UInt;

record Struct_FolderDesc (
    descSize : CLong,
    foldType : UInt,
    flags : UInt,
    foldClass : UInt,
    foldLocation : UInt,
    badgeSignature : UInt,
    badgeType : UInt,
    reserved : UInt,
    name : StrFileName,
);

alias FolderDesc = Struct_FolderDesc;

alias FolderDescPtr = Pointer[FolderDesc];

alias RoutingFlags = UInt;

record Struct_FolderRouting (
    descSize : CLong,
    fileType : UInt,
    routeFromFolder : UInt,
    routeToFolder : UInt,
    flags : UInt,
);

alias FolderRouting = Struct_FolderRouting;

alias FolderRoutingPtr = Pointer[FolderRouting];

external AddFolderDescriptor(
    foldType : UInt,
    flags : UInt,
    foldClass : UInt,
    foldLocation : UInt,
    badgeSignature : UInt,
    badgeType : UInt,
    name : ConstStrFileNameParam,
    replaceFlag : CUChar) : Short;

external GetFolderTypes(
    requestedTypeCount : UInt,
    totalTypeCount : Pointer[UInt],
    theTypes : Pointer[UInt]) : Short;

external RemoveFolderDescriptor(
    foldType : UInt) : Short;

external GetFolderNameUnicode(
    vRefNum : Short,
    foldType : UInt,
    foundVRefNum : Pointer[Short],
    name : Pointer[HFSUniStr255]) : Int;

external InvalidateFolderDescriptorCache(
    vRefNum : Short,
    dirID : Int) : Short;

external IdentifyFolder(
    vRefNum : Short,
    dirID : Int,
    foldType : Pointer[UInt]) : Short;

external FSDetermineIfRefIsEnclosedByFolder(
    domainOrVRefNum : Short,
    folderType : UInt,
    inRef : Pointer[FSRef],
    outResult : Pointer[CUChar]) : Short;

external DetermineIfPathIsEnclosedByFolder(
    domainOrVRefNum : Short,
    folderType : UInt,
    utf8Path : Pointer[CUChar],
    pathIsRealPath : CUChar,
    outResult : Pointer[CUChar]) : Short;

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

alias FolderManagerNotificationUPP = FolderManagerNotificationProcPtr;

external NewFolderManagerNotificationUPP(
    userRoutine : FolderManagerNotificationProcPtr) : FolderManagerNotificationUPP;

external DisposeFolderManagerNotificationUPP(
    userUPP : FolderManagerNotificationUPP);

external InvokeFolderManagerNotificationUPP(
    message : UInt,
    arg : RawPointer,
    userRefCon : RawPointer,
    userUPP : FolderManagerNotificationUPP) : Int;

external Microseconds(
    microTickCount : Pointer[UnsignedWide]);

alias kTMTaskActive = 32768;

alias TMTask = Struct_TMTask;

alias TMTaskPtr = Pointer[TMTask];

alias TimerProcPtr = CCodePointer[[Pointer[Struct_TMTask]],[]];

alias TimerUPP = TimerProcPtr;

record Struct_TMTask (
    qLink : QElemPtr,
    qType : Short,
    tmAddr : TimerUPP,
    tmCount : CLong,
    tmWakeUp : CLong,
    tmReserved : CLong,
);

external InsTime(
    tmTaskPtr : QElemPtr);

external InsXTime(
    tmTaskPtr : QElemPtr);

external PrimeTime(
    tmTaskPtr : QElemPtr,
    count : CLong);

external RmvTime(
    tmTaskPtr : QElemPtr);

external InstallTimeTask(
    tmTaskPtr : QElemPtr) : Short;

external InstallXTimeTask(
    tmTaskPtr : QElemPtr) : Short;

external PrimeTimeTask(
    tmTaskPtr : QElemPtr,
    count : CLong) : Short;

external RemoveTimeTask(
    tmTaskPtr : QElemPtr) : Short;

external NewTimerUPP(
    userRoutine : TimerProcPtr) : TimerUPP;

external DisposeTimerUPP(
    userUPP : TimerUPP);

external InvokeTimerUPP(
    tmTaskPtr : TMTaskPtr,
    userUPP : TimerUPP);

external MPGetNextCpuID(
    owningCoherenceID : MPCoherenceID,
    cpuID : Pointer[MPCpuID]) : Int;

external MPGetNextTaskID(
    owningProcessID : MPProcessID,
    taskID : Pointer[MPTaskID]) : Int;

alias kMPQueueInfoVersion = 262145;
alias kMPSemaphoreInfoVersion = 327681;
alias kMPEventInfoVersion = 589825;
alias kMPCriticalRegionInfoVersion = 393217;
alias kMPNotificationInfoVersion = 786433;
alias kMPAddressSpaceInfoVersion = 524289;

record Struct_MPQueueInfo (
    version : UInt,
    processID : MPProcessID,
    queueName : UInt,
    nWaiting : CULong,
    waitingTaskID : MPTaskID,
    nMessages : CULong,
    nReserved : CULong,
    p1 : RawPointer,
    p2 : RawPointer,
    p3 : RawPointer,
);

alias MPQueueInfo = Struct_MPQueueInfo;

record Struct_MPSemaphoreInfo (
    version : UInt,
    processID : MPProcessID,
    semaphoreName : UInt,
    nWaiting : CULong,
    waitingTaskID : MPTaskID,
    maximum : CULong,
    count : CULong,
);

alias MPSemaphoreInfo = Struct_MPSemaphoreInfo;

record Struct_MPEventInfo (
    version : UInt,
    processID : MPProcessID,
    eventName : UInt,
    nWaiting : CULong,
    waitingTaskID : MPTaskID,
    events : UInt,
);

alias MPEventInfo = Struct_MPEventInfo;

record Struct_MPCriticalRegionInfo (
    version : UInt,
    processID : MPProcessID,
    regionName : UInt,
    nWaiting : CULong,
    waitingTaskID : MPTaskID,
    owningTask : MPTaskID,
    count : CULong,
);

alias MPCriticalRegionInfo = Struct_MPCriticalRegionInfo;

record Struct_MPNotificationInfo (
    version : UInt,
    processID : MPProcessID,
    notificationName : UInt,
    queueID : MPQueueID,
    p1 : RawPointer,
    p2 : RawPointer,
    p3 : RawPointer,
    eventID : MPEventID,
    events : UInt,
    semaphoreID : MPSemaphoreID,
);

alias MPNotificationInfo = Struct_MPNotificationInfo;

record Struct_MPAddressSpaceInfo (
    version : UInt,
    processID : MPProcessID,
    groupID : MPCoherenceID,
    nTasks : CULong,
    vsid : Array[UInt,16],
);

alias MPAddressSpaceInfo = Struct_MPAddressSpaceInfo;

external LMGetBootDrive() : Short;

external LMSetBootDrive(
    value : Short);

external LMGetApFontID() : Short;

external LMSetApFontID(
    value : Short);

external LMGetSysMap() : Short;

external LMSetSysMap(
    value : Short);

external LMGetResLoad() : CUChar;

external LMSetResLoad(
    value : CUChar);

external LMGetResErr() : Short;

external LMSetResErr(
    value : Short);

external LMGetTmpResLoad() : CUChar;

external LMSetTmpResLoad(
    value : CUChar);

external LMGetIntlSpec() : Ptr;

external LMSetIntlSpec(
    value : Ptr);

external LMSetSysFontFam(
    value : Short);

external LMGetSysFontSize() : Short;

external LMSetSysFontSize(
    value : Short);

alias AVLVisitStage = UShort;

alias kAVLPreOrder = 0;
alias kAVLInOrder = 1;
alias kAVLPostOrder = 2;

alias AVLOrder = UShort;

alias kLeftToRight = 0;
alias kRightToLeft = 1;

alias AVLNodeType = UShort;

alias kAVLIsTree = 0;
alias kAVLIsLeftBranch = 1;
alias kAVLIsRightBranch = 2;
alias kAVLIsLeaf = 3;
alias kAVLNullNode = 4;

alias errItemAlreadyInTree = 4294966336;
alias errNotValidTree = 4294966335;
alias errItemNotFoundInTree = 4294966334;
alias errCanNotInsertWhileWalkProcInProgress = 4294966333;
alias errTreeIsLocked = 4294966332;

record Struct_AVLTreeStruct (
    signature : UInt,
    privateStuff : Array[CULong,8],
);

alias AVLTreeStruct = Struct_AVLTreeStruct;

alias AVLTreePtr = Pointer[AVLTreeStruct];

alias AVLCompareItemsProcPtr = CCodePointer[[Pointer[Struct_AVLTreeStruct],RawPointer,RawPointer,UShort],[Int]];

alias AVLItemSizeProcPtr = CCodePointer[[Pointer[Struct_AVLTreeStruct],RawPointer],[CULong]];

alias AVLDisposeItemProcPtr = CCodePointer[[Pointer[Struct_AVLTreeStruct],RawPointer],[]];

alias AVLWalkProcPtr = CCodePointer[[Pointer[Struct_AVLTreeStruct],RawPointer,UShort,UShort,UInt,Int,RawPointer],[Short]];

alias AVLCompareItemsUPP = AVLCompareItemsProcPtr;

alias AVLItemSizeUPP = AVLItemSizeProcPtr;

alias AVLDisposeItemUPP = AVLDisposeItemProcPtr;

alias AVLWalkUPP = AVLWalkProcPtr;

external NewAVLCompareItemsUPP(
    userRoutine : AVLCompareItemsProcPtr) : AVLCompareItemsUPP;

external NewAVLItemSizeUPP(
    userRoutine : AVLItemSizeProcPtr) : AVLItemSizeUPP;

external NewAVLDisposeItemUPP(
    userRoutine : AVLDisposeItemProcPtr) : AVLDisposeItemUPP;

external NewAVLWalkUPP(
    userRoutine : AVLWalkProcPtr) : AVLWalkUPP;

external DisposeAVLCompareItemsUPP(
    userUPP : AVLCompareItemsUPP);

external DisposeAVLItemSizeUPP(
    userUPP : AVLItemSizeUPP);

external DisposeAVLDisposeItemUPP(
    userUPP : AVLDisposeItemUPP);

external DisposeAVLWalkUPP(
    userUPP : AVLWalkUPP);

external InvokeAVLCompareItemsUPP(
    tree : AVLTreePtr,
    i1 : RawPointer,
    i2 : RawPointer,
    nd_typ : UShort,
    userUPP : AVLCompareItemsUPP) : Int;

external InvokeAVLItemSizeUPP(
    tree : AVLTreePtr,
    itemPtr : RawPointer,
    userUPP : AVLItemSizeUPP) : CULong;

external InvokeAVLDisposeItemUPP(
    tree : AVLTreePtr,
    dataP : RawPointer,
    userUPP : AVLDisposeItemUPP);

external InvokeAVLWalkUPP(
    tree : AVLTreePtr,
    dataPtr : RawPointer,
    visitStage : UShort,
    node : UShort,
    level : UInt,
    balance : Int,
    refCon : RawPointer,
    userUPP : AVLWalkUPP) : Short;

record Struct_PEFContainerHeader (
    tag1 : UInt,
    tag2 : UInt,
    architecture : UInt,
    formatVersion : UInt,
    dateTimeStamp : UInt,
    oldDefVersion : UInt,
    oldImpVersion : UInt,
    currentVersion : UInt,
    sectionCount : UShort,
    instSectionCount : UShort,
    reservedA : UInt,
);

alias PEFContainerHeader = Struct_PEFContainerHeader;

alias kPEFTag1 = 1248819489;
alias kPEFTag2 = 1885693542;
alias kPEFVersion = 1;

alias kPEFFirstSectionHeaderOffset = 40;

record Struct_PEFSectionHeader (
    nameOffset : Int,
    defaultAddress : UInt,
    totalLength : UInt,
    unpackedLength : UInt,
    containerLength : UInt,
    containerOffset : UInt,
    sectionKind : CUChar,
    shareKind : CUChar,
    alignment : CUChar,
    reservedA : CUChar,
);

alias PEFSectionHeader = Struct_PEFSectionHeader;

alias kPEFCodeSection = 0;
alias kPEFUnpackedDataSection = 1;
alias kPEFPackedDataSection = 2;
alias kPEFConstantSection = 3;
alias kPEFExecDataSection = 6;
alias kPEFLoaderSection = 4;
alias kPEFDebugSection = 5;
alias kPEFExceptionSection = 7;
alias kPEFTracebackSection = 8;

alias kPEFProcessShare = 1;
alias kPEFGlobalShare = 4;
alias kPEFProtectedShare = 5;

alias kPEFPkDataZero = 0;
alias kPEFPkDataBlock = 1;
alias kPEFPkDataRepeat = 2;
alias kPEFPkDataRepeatBlock = 3;
alias kPEFPkDataRepeatZero = 4;

alias kPEFPkDataOpcodeShift = 5;
alias kPEFPkDataCount5Mask = 31;
alias kPEFPkDataMaxCount5 = 31;
alias kPEFPkDataVCountShift = 7;
alias kPEFPkDataVCountMask = 127;
alias kPEFPkDataVCountEndMask = 128;

record Struct_PEFLoaderInfoHeader (
    mainSection : Int,
    mainOffset : UInt,
    initSection : Int,
    initOffset : UInt,
    termSection : Int,
    termOffset : UInt,
    importedLibraryCount : UInt,
    totalImportedSymbolCount : UInt,
    relocSectionCount : UInt,
    relocInstrOffset : UInt,
    loaderStringsOffset : UInt,
    exportHashOffset : UInt,
    exportHashTablePower : UInt,
    exportedSymbolCount : UInt,
);

alias PEFLoaderInfoHeader = Struct_PEFLoaderInfoHeader;

record Struct_PEFImportedLibrary (
    nameOffset : UInt,
    oldImpVersion : UInt,
    currentVersion : UInt,
    importedSymbolCount : UInt,
    firstImportedSymbol : UInt,
    options : CUChar,
    reservedA : CUChar,
    reservedB : UShort,
);

alias PEFImportedLibrary = Struct_PEFImportedLibrary;

alias kPEFWeakImportLibMask = 64;
alias kPEFInitLibBeforeMask = 128;

record Struct_PEFImportedSymbol (
    classAndName : UInt,
);

alias PEFImportedSymbol = Struct_PEFImportedSymbol;

alias kPEFImpSymClassShift = 24;
alias kPEFImpSymNameOffsetMask = 16777215;
alias kPEFImpSymMaxNameOffset = 16777215;

alias kPEFCodeSymbol = 0;
alias kPEFDataSymbol = 1;
alias kPEFTVectorSymbol = 2;
alias kPEFTOCSymbol = 3;
alias kPEFGlueSymbol = 4;
alias kPEFUndefinedSymbol = 15;
alias kPEFWeakImportSymMask = 128;

record Struct_PEFExportedSymbolHashSlot (
    countAndStart : UInt,
);

alias PEFExportedSymbolHashSlot = Struct_PEFExportedSymbolHashSlot;

alias kPEFHashSlotSymCountShift = 18;
alias kPEFHashSlotFirstKeyMask = 262143;
alias kPEFHashSlotMaxSymbolCount = 16383;
alias kPEFHashSlotMaxKeyIndex = 262143;

record Struct_PEFSplitHashWord (
    nameLength : UShort,
    hashValue : UShort,
);

alias PEFSplitHashWord = Struct_PEFSplitHashWord;

record Struct_PEFExportedSymbolKey (
    u : AUnionType,
);

alias PEFExportedSymbolKey = Struct_PEFExportedSymbolKey;

alias kPEFHashLengthShift = 16;
alias kPEFHashValueMask = 65535;
alias kPEFHashMaxLength = 65535;

record Struct_PEFExportedSymbol (
    classAndName : UInt,
    symbolValue : UInt,
    sectionIndex : Short,
);

alias PEFExportedSymbol = Struct_PEFExportedSymbol;

alias kPEFExpSymClassShift = 24;
alias kPEFExpSymNameOffsetMask = 16777215;
alias kPEFExpSymMaxNameOffset = 16777215;

alias kPEFAbsoluteExport = 4294967294;
alias kPEFReexportedImport = 4294967293;

alias PEFRelocChunk = UShort;

record Struct_PEFLoaderRelocationHeader (
    sectionIndex : UShort,
    reservedA : UShort,
    relocCount : UInt,
    firstRelocOffset : UInt,
);

alias PEFLoaderRelocationHeader = Struct_PEFLoaderRelocationHeader;

alias kPEFRelocBasicOpcodeRange = 128;

alias kPEFRelocBySectDWithSkip = 0;
alias kPEFRelocBySectC = 32;
alias kPEFRelocBySectD = 33;
alias kPEFRelocTVector12 = 34;
alias kPEFRelocTVector8 = 35;
alias kPEFRelocVTable8 = 36;
alias kPEFRelocImportRun = 37;
alias kPEFRelocSmByImport = 48;
alias kPEFRelocSmSetSectC = 49;
alias kPEFRelocSmSetSectD = 50;
alias kPEFRelocSmBySection = 51;
alias kPEFRelocIncrPosition = 64;
alias kPEFRelocSmRepeat = 72;
alias kPEFRelocSetPosition = 80;
alias kPEFRelocLgByImport = 82;
alias kPEFRelocLgRepeat = 88;
alias kPEFRelocLgSetOrBySection = 90;
alias kPEFRelocUndefinedOpcode = 255;

alias kPEFRelocLgBySectionSubopcode = 0;
alias kPEFRelocLgSetSectCSubopcode = 1;
alias kPEFRelocLgSetSectDSubopcode = 2;

alias kPEFRelocWithSkipMaxSkipCount = 255;
alias kPEFRelocWithSkipMaxRelocCount = 63;

alias kPEFRelocRunMaxRunLength = 512;

alias kPEFRelocSmIndexMaxIndex = 511;

alias kPEFRelocIncrPositionMaxOffset = 4096;

alias kPEFRelocSmRepeatMaxChunkCount = 16;
alias kPEFRelocSmRepeatMaxRepeatCount = 256;

alias kPEFRelocSetPosMaxOffset = 67108863;

alias kPEFRelocLgByImportMaxIndex = 67108863;

alias kPEFRelocLgRepeatMaxChunkCount = 16;
alias kPEFRelocLgRepeatMaxRepeatCount = 4194303;

alias kPEFRelocLgSetOrBySectionMaxIndex = 4194303;

record Struct_XLibContainerHeader (
    tag1 : UInt,
    tag2 : UInt,
    currentFormat : UInt,
    containerStringsOffset : UInt,
    exportHashOffset : UInt,
    exportKeyOffset : UInt,
    exportSymbolOffset : UInt,
    exportNamesOffset : UInt,
    exportHashTablePower : UInt,
    exportedSymbolCount : UInt,
    fragNameOffset : UInt,
    fragNameLength : UInt,
    dylibPathOffset : UInt,
    dylibPathLength : UInt,
    cpuFamily : UInt,
    cpuModel : UInt,
    dateTimeStamp : UInt,
    currentVersion : UInt,
    oldDefVersion : UInt,
    oldImpVersion : UInt,
);

alias XLibContainerHeader = Struct_XLibContainerHeader;

alias kXLibTag1 = 4031603043;
alias kVLibTag2 = 1447848290;
alias kBLibTag2 = 1112303970;
alias kXLibVersion = 1;

alias XLibExportedSymbolHashSlot = PEFExportedSymbolHashSlot;

alias XLibExportedSymbolKey = PEFExportedSymbolKey;

record Struct_XLibExportedSymbol (
    classAndName : UInt,
    bpOffset : UInt,
);

alias XLibExportedSymbol = Struct_XLibExportedSymbol;

alias HFSCatalogNodeID = UInt;

alias AIFFID = 1095321158;
alias AIFCID = 1095321155;
alias FormatVersionID = 1180058962;
alias CommonID = 1129270605;
alias FORMID = 1179603533;
alias SoundDataID = 1397968452;
alias MarkerID = 1296126539;
alias InstrumentID = 1229869908;
alias MIDIDataID = 1296647241;
alias AudioRecordingID = 1095062340;
alias ApplicationSpecificID = 1095782476;
alias CommentID = 1129270612;
alias NameID = 1312902469;
alias AuthorID = 1096111176;
alias CopyrightID = 677587232;
alias AnnotationID = 1095650895;

alias NoLooping = 0;
alias ForwardLooping = 1;
alias ForwardBackwardLooping = 2;

alias AIFCVersion1 = 2726318400;

alias NoneType = 1313820229;
alias ACE2Type = 1094927666;
alias ACE8Type = 1094927672;
alias MACE3Type = 1296122675;
alias MACE6Type = 1296122678;

alias MarkerIdType = Short;

record Struct_ChunkHeader (
    ckID : UInt,
    ckSize : Int,
);

alias ChunkHeader = Struct_ChunkHeader;

record Struct_ContainerChunk (
    ckID : UInt,
    ckSize : Int,
    formType : UInt,
);

alias ContainerChunk = Struct_ContainerChunk;

record Struct_FormatVersionChunk (
    ckID : UInt,
    ckSize : Int,
    timestamp : UInt,
);

alias FormatVersionChunk = Struct_FormatVersionChunk;

alias FormatVersionChunkPtr = Pointer[FormatVersionChunk];

record Struct_CommonChunk (
    ckID : UInt,
    ckSize : Int,
    numChannels : Short,
    numSampleFrames : UInt,
    sampleSize : Short,
    sampleRate : extended80,
);

alias CommonChunk = Struct_CommonChunk;

alias CommonChunkPtr = Pointer[CommonChunk];

record Struct_ExtCommonChunk (
    ckID : UInt,
    ckSize : Int,
    numChannels : Short,
    numSampleFrames : UInt,
    sampleSize : Short,
    sampleRate : extended80,
    compressionType : UInt,
    compressionName : Array[CChar,1],
);

alias ExtCommonChunk = Struct_ExtCommonChunk;

alias ExtCommonChunkPtr = Pointer[ExtCommonChunk];

record Struct_SoundDataChunk (
    ckID : UInt,
    ckSize : Int,
    offset : UInt,
    blockSize : UInt,
);

alias SoundDataChunk = Struct_SoundDataChunk;

alias SoundDataChunkPtr = Pointer[SoundDataChunk];

record Struct_Marker (
    id : Short,
    position : UInt,
    markerName : Str255,
);

alias Marker = Struct_Marker;

record Struct_MarkerChunk (
    ckID : UInt,
    ckSize : Int,
    numMarkers : UShort,
    Markers : Array[Marker,1],
);

alias MarkerChunk = Struct_MarkerChunk;

alias MarkerChunkPtr = Pointer[MarkerChunk];

record Struct_AIFFLoop (
    playMode : Short,
    beginLoop : Short,
    endLoop : Short,
);

alias AIFFLoop = Struct_AIFFLoop;

record Struct_InstrumentChunk (
    ckID : UInt,
    ckSize : Int,
    baseFrequency : CUChar,
    detune : CUChar,
    lowFrequency : CUChar,
    highFrequency : CUChar,
    lowVelocity : CUChar,
    highVelocity : CUChar,
    gain : Short,
    sustainLoop : AIFFLoop,
    releaseLoop : AIFFLoop,
);

alias InstrumentChunk = Struct_InstrumentChunk;

alias InstrumentChunkPtr = Pointer[InstrumentChunk];

record Struct_MIDIDataChunk (
    ckID : UInt,
    ckSize : Int,
    MIDIdata : Array[CUChar,1],
);

alias MIDIDataChunk = Struct_MIDIDataChunk;

alias MIDIDataChunkPtr = Pointer[MIDIDataChunk];

record Struct_AudioRecordingChunk (
    ckID : UInt,
    ckSize : Int,
    AESChannelStatus : Array[CUChar,24],
);

alias AudioRecordingChunk = Struct_AudioRecordingChunk;

alias AudioRecordingChunkPtr = Pointer[AudioRecordingChunk];

record Struct_ApplicationSpecificChunk (
    ckID : UInt,
    ckSize : Int,
    applicationSignature : UInt,
    data : Array[CUChar,1],
);

alias ApplicationSpecificChunk = Struct_ApplicationSpecificChunk;

alias ApplicationSpecificChunkPtr = Pointer[ApplicationSpecificChunk];

record Struct_Comment (
    timeStamp : UInt,
    marker : Short,
    count : UShort,
    text : Array[CChar,1],
);

alias Comment = Struct_Comment;

record Struct_CommentsChunk (
    ckID : UInt,
    ckSize : Int,
    numComments : UShort,
    comments : Array[Comment,1],
);

alias CommentsChunk = Struct_CommentsChunk;

alias CommentsChunkPtr = Pointer[CommentsChunk];

record Struct_TextChunk (
    ckID : UInt,
    ckSize : Int,
    text : Array[CChar,1],
);

alias TextChunk = Struct_TextChunk;

alias TextChunkPtr = Pointer[TextChunk];

alias kTECAvailableEncodingsResType = 1668703598;
alias kTECAvailableSniffersResType = 1668707174;
alias kTECSubTextEncodingsResType = 1668707170;
alias kTECConversionInfoResType = 1668704614;
alias kTECMailEncodingsResType = 1668705644;
alias kTECWebEncodingsResType = 1668708194;
alias kTECInternetNamesResType = 1668705645;

alias kTECPluginType = 1701015655;
alias kTECPluginCreator = 1701733238;
alias kTECPluginOneToOne = 1869901679;
alias kTECPluginOneToMany = 1869901677;
alias kTECPluginManyToOne = 1836347247;
alias kTECPluginSniffObj = 1936615782;

alias verUnspecified = 32767;
alias kTECResourceID = 128;

record Struct_TextEncodingRec (
    base : UInt,
    variant_ : UInt,
    format : UInt,
);

alias TextEncodingRec = Struct_TextEncodingRec;

record Struct_TECEncodingsListRec (
    count : UInt,
    encodings : TextEncodingRec,
);

alias TECEncodingsListRec = Struct_TECEncodingsListRec;

alias TECEncodingsListPtr = Pointer[TECEncodingsListRec];

alias TECEncodingsListHandle = Pointer[TECEncodingsListPtr];

record Struct_TECSubTextEncodingRec (
    offset : UInt,
    searchEncoding : TextEncodingRec,
    count : UInt,
    subEncodings : TextEncodingRec,
);

alias TECSubTextEncodingRec = Struct_TECSubTextEncodingRec;

record Struct_TECSubTextEncodingsRec (
    count : UInt,
    subTextEncodingRec : TECSubTextEncodingRec,
);

alias TECSubTextEncodingsRec = Struct_TECSubTextEncodingsRec;

alias TECSubTextEncodingsPtr = Pointer[TECSubTextEncodingsRec];

alias TECSubTextEncodingsHandle = Pointer[TECSubTextEncodingsPtr];

record Struct_TECEncodingPairRec (
    source : TextEncodingRec,
    dest : TextEncodingRec,
);

alias TECEncodingPairRec = Struct_TECEncodingPairRec;

record Struct_TECEncodingPairs (
    encodingPair : TECEncodingPairRec,
    flags : UInt,
    speed : UInt,
);

alias TECEncodingPairs = Struct_TECEncodingPairs;

record Struct_TECEncodingPairsRec (
    count : UInt,
    encodingPairs : TECEncodingPairs,
);

alias TECEncodingPairsRec = Struct_TECEncodingPairsRec;

alias TECEncodingPairsPtr = Pointer[TECEncodingPairsRec];

alias TECEncodingPairsHandle = Pointer[TECEncodingPairsPtr];

record Struct_TECLocaleListToEncodingListRec (
    offset : UInt,
    count : UInt,
    locales : Short,
);

alias TECLocaleListToEncodingListRec = Struct_TECLocaleListToEncodingListRec;

alias TECLocaleListToEncodingListPtr = Pointer[TECLocaleListToEncodingListRec];

record Struct_TECLocaleToEncodingsListRec (
    count : UInt,
    localeListToEncodingList : TECLocaleListToEncodingListRec,
);

alias TECLocaleToEncodingsListRec = Struct_TECLocaleToEncodingsListRec;

alias TECLocaleToEncodingsListPtr = Pointer[TECLocaleToEncodingsListRec];

alias TECLocaleToEncodingsListHandle = Pointer[TECLocaleToEncodingsListPtr];

record Struct_TECInternetNameRec (
    offset : UInt,
    searchEncoding : TextEncodingRec,
    encodingNameLength : CUChar,
    encodingName : Array[CUChar,1],
);

alias TECInternetNameRec = Struct_TECInternetNameRec;

record Struct_TECInternetNamesRec (
    count : UInt,
    InternetNames : TECInternetNameRec,
);

alias TECInternetNamesRec = Struct_TECInternetNamesRec;

alias TECInternetNamesPtr = Pointer[TECInternetNamesRec];

alias TECInternetNamesHandle = Pointer[TECInternetNamesPtr];

record Struct_TECBufferContextRec (
    textInputBuffer : ConstTextPtr,
    textInputBufferEnd : ConstTextPtr,
    textOutputBuffer : TextPtr,
    textOutputBufferEnd : TextPtr,
    encodingInputBuffer : ConstTextEncodingRunPtr,
    encodingInputBufferEnd : ConstTextEncodingRunPtr,
    encodingOutputBuffer : TextEncodingRunPtr,
    encodingOutputBufferEnd : TextEncodingRunPtr,
);

alias TECBufferContextRec = Struct_TECBufferContextRec;

record Struct_TECPluginStateRec (
    state1 : CUChar,
    state2 : CUChar,
    state3 : CUChar,
    state4 : CUChar,
    longState1 : UInt,
    longState2 : UInt,
    longState3 : UInt,
    longState4 : UInt,
);

alias TECPluginStateRec = Struct_TECPluginStateRec;

record Struct_TECConverterContextRec (
    pluginRec : Ptr,
    sourceEncoding : UInt,
    destEncoding : UInt,
    reserved1 : UInt,
    reserved2 : UInt,
    bufferContext : TECBufferContextRec,
    contextRefCon : URefCon,
    conversionProc : ProcPtr,
    flushProc : ProcPtr,
    clearContextInfoProc : ProcPtr,
    options1 : UInt,
    options2 : UInt,
    pluginState : TECPluginStateRec,
);

alias TECConverterContextRec = Struct_TECConverterContextRec;

record Struct_TECSnifferContextRec (
    pluginRec : Ptr,
    encoding : UInt,
    maxErrors : CULong,
    maxFeatures : CULong,
    textInputBuffer : ConstTextPtr,
    textInputBufferEnd : ConstTextPtr,
    numFeatures : CULong,
    numErrors : CULong,
    contextRefCon : URefCon,
    sniffProc : ProcPtr,
    clearContextInfoProc : ProcPtr,
    pluginState : TECPluginStateRec,
);

alias TECSnifferContextRec = Struct_TECSnifferContextRec;

alias TECPluginNewEncodingConverterPtr = CCodePointer[[Pointer[OpaquePointer],Pointer[Struct_TECConverterContextRec],UInt,UInt],[Int]];

alias TECPluginClearContextInfoPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECConverterContextRec]],[Int]];

alias TECPluginConvertTextEncodingPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECConverterContextRec]],[Int]];

alias TECPluginFlushConversionPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECConverterContextRec]],[Int]];

alias TECPluginDisposeEncodingConverterPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECConverterContextRec]],[Int]];

alias TECPluginNewEncodingSnifferPtr = CCodePointer[[Pointer[OpaquePointer],Pointer[Struct_TECSnifferContextRec],UInt],[Int]];

alias TECPluginClearSnifferContextInfoPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECSnifferContextRec]],[Int]];

alias TECPluginSniffTextEncodingPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECSnifferContextRec]],[Int]];

alias TECPluginDisposeEncodingSnifferPtr = CCodePointer[[OpaquePointer,Pointer[Struct_TECSnifferContextRec]],[Int]];

alias TECPluginGetCountAvailableTextEncodingsPtr = CCodePointer[[Pointer[UInt],CULong,Pointer[CULong]],[Int]];

alias TECPluginGetCountAvailableTextEncodingPairsPtr = CCodePointer[[Pointer[Struct_TECConversionInfo],CULong,Pointer[CULong]],[Int]];

alias TECPluginGetCountDestinationTextEncodingsPtr = CCodePointer[[UInt,Pointer[UInt],CULong,Pointer[CULong]],[Int]];

alias TECPluginGetCountSubTextEncodingsPtr = CCodePointer[[UInt,Pointer[UInt],CULong,Pointer[CULong]],[Int]];

alias TECPluginGetCountAvailableSniffersPtr = CCodePointer[[Pointer[UInt],CULong,Pointer[CULong]],[Int]];

alias TECPluginGetTextEncodingInternetNamePtr = CCodePointer[[UInt,Pointer[CUChar]],[Int]];

alias TECPluginGetTextEncodingFromInternetNamePtr = CCodePointer[[Pointer[UInt],Pointer[CUChar]],[Int]];

alias TECPluginGetCountWebEncodingsPtr = CCodePointer[[Pointer[UInt],CULong,Pointer[CULong]],[Int]];

alias TECPluginGetCountMailEncodingsPtr = CCodePointer[[Pointer[UInt],CULong,Pointer[CULong]],[Int]];

alias kTECPluginDispatchTableVersion1 = 65536;
alias kTECPluginDispatchTableVersion1_1 = 65537;
alias kTECPluginDispatchTableVersion1_2 = 65538;
alias kTECPluginDispatchTableCurrentVersion = 65538;

record Struct_TECPluginDispatchTable (
    version : UInt,
    compatibleVersion : UInt,
    PluginID : UInt,
    PluginNewEncodingConverter : TECPluginNewEncodingConverterPtr,
    PluginClearContextInfo : TECPluginClearContextInfoPtr,
    PluginConvertTextEncoding : TECPluginConvertTextEncodingPtr,
    PluginFlushConversion : TECPluginFlushConversionPtr,
    PluginDisposeEncodingConverter : TECPluginDisposeEncodingConverterPtr,
    PluginNewEncodingSniffer : TECPluginNewEncodingSnifferPtr,
    PluginClearSnifferContextInfo : TECPluginClearSnifferContextInfoPtr,
    PluginSniffTextEncoding : TECPluginSniffTextEncodingPtr,
    PluginDisposeEncodingSniffer : TECPluginDisposeEncodingSnifferPtr,
    PluginGetCountAvailableTextEncodings : TECPluginGetCountAvailableTextEncodingsPtr,
    PluginGetCountAvailableTextEncodingPairs : TECPluginGetCountAvailableTextEncodingPairsPtr,
    PluginGetCountDestinationTextEncodings : TECPluginGetCountDestinationTextEncodingsPtr,
    PluginGetCountSubTextEncodings : TECPluginGetCountSubTextEncodingsPtr,
    PluginGetCountAvailableSniffers : TECPluginGetCountAvailableSniffersPtr,
    PluginGetCountWebTextEncodings : TECPluginGetCountWebEncodingsPtr,
    PluginGetCountMailTextEncodings : TECPluginGetCountMailEncodingsPtr,
    PluginGetTextEncodingInternetName : TECPluginGetTextEncodingInternetNamePtr,
    PluginGetTextEncodingFromInternetName : TECPluginGetTextEncodingFromInternetNamePtr,
);

alias TECPluginDispatchTable = Struct_TECPluginDispatchTable;

alias TECPluginGetPluginDispatchTablePtr = CCodePointer[[],[Pointer[Struct_TECPluginDispatchTable]]];

alias FSEventStreamCreateFlags = UInt;

alias kFSEventStreamCreateFlagNone = 0;
alias kFSEventStreamCreateFlagUseCFTypes = 1;
alias kFSEventStreamCreateFlagNoDefer = 2;
alias kFSEventStreamCreateFlagWatchRoot = 4;
alias kFSEventStreamCreateFlagIgnoreSelf = 8;

alias FSEventStreamEventFlags = UInt;

alias kFSEventStreamEventFlagNone = 0;
alias kFSEventStreamEventFlagMustScanSubDirs = 1;
alias kFSEventStreamEventFlagUserDropped = 2;
alias kFSEventStreamEventFlagKernelDropped = 4;
alias kFSEventStreamEventFlagEventIdsWrapped = 8;
alias kFSEventStreamEventFlagHistoryDone = 16;
alias kFSEventStreamEventFlagRootChanged = 32;
alias kFSEventStreamEventFlagMount = 64;
alias kFSEventStreamEventFlagUnmount = 128;

alias FSEventStreamEventId = UInt64;

alias kFSEventStreamEventIdSinceNow = 18446744073709551615;

alias FSEventStreamRef = OpaquePointer;

alias ConstFSEventStreamRef = OpaquePointer;

record Struct_FSEventStreamContext (
    version : CLong,
    info : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
    copyDescription : CFAllocatorCopyDescriptionCallBack,
);

alias FSEventStreamContext = Struct_FSEventStreamContext;

alias FSEventStreamCallback = CCodePointer[[OpaquePointer,RawPointer,CULong,RawPointer,Pointer[UInt],Pointer[UInt64]],[]];

external FSEventStreamCreate(
    allocator : CFAllocatorRef,
    callback : FSEventStreamCallback,
    context : Pointer[FSEventStreamContext],
    pathsToWatch : CFArrayRef,
    sinceWhen : UInt64,
    latency : Double,
    flags : UInt) : FSEventStreamRef;

external FSEventStreamCreateRelativeToDevice(
    allocator : CFAllocatorRef,
    callback : FSEventStreamCallback,
    context : Pointer[FSEventStreamContext],
    deviceToWatch : Int,
    pathsToWatchRelativeToDevice : CFArrayRef,
    sinceWhen : UInt64,
    latency : Double,
    flags : UInt) : FSEventStreamRef;

external FSEventStreamGetLatestEventId(
    streamRef : ConstFSEventStreamRef) : UInt64;

external FSEventStreamGetDeviceBeingWatched(
    streamRef : ConstFSEventStreamRef) : Int;

external FSEventStreamCopyPathsBeingWatched(
    streamRef : ConstFSEventStreamRef) : CFArrayRef;

external FSEventsGetCurrentEventId() : UInt64;

external FSEventsCopyUUIDForDevice(
    dev : Int) : CFUUIDRef;

external FSEventsGetLastEventIdForDeviceBeforeTime(
    dev : Int,
    time : Double) : UInt64;

external FSEventsPurgeEventsForDeviceUpToEventId(
    dev : Int,
    eventId : UInt64) : CUChar;

external FSEventStreamRetain(
    streamRef : FSEventStreamRef);

external FSEventStreamRelease(
    streamRef : FSEventStreamRef);

external FSEventStreamScheduleWithRunLoop(
    streamRef : FSEventStreamRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external FSEventStreamUnscheduleFromRunLoop(
    streamRef : FSEventStreamRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external FSEventStreamSetDispatchQueue(
    streamRef : FSEventStreamRef,
    q : dispatch_queue_t);

external FSEventStreamInvalidate(
    streamRef : FSEventStreamRef);

external FSEventStreamStart(
    streamRef : FSEventStreamRef) : CUChar;

external FSEventStreamFlushAsync(
    streamRef : FSEventStreamRef) : UInt64;

external FSEventStreamFlushSync(
    streamRef : FSEventStreamRef);

external FSEventStreamStop(
    streamRef : FSEventStreamRef);

external FSEventStreamShow(
    streamRef : ConstFSEventStreamRef);

external FSEventStreamCopyDescription(
    streamRef : ConstFSEventStreamRef) : CFStringRef;

alias typeBoolean = 1651470188;
alias typeChar = 1413830740;

alias typeStyledUnicodeText = 1937077368;
alias typeEncodedString = 1701733235;
alias typeUnicodeText = 1970567284;
alias typeCString = 1668510834;
alias typePString = 1886614642;

alias typeUTF16ExternalRepresentation = 1970549046;
alias typeUTF8Text = 1970562616;

alias typeSInt16 = 1936224114;
alias typeUInt16 = 1970497650;
alias typeSInt32 = 1819242087;
alias typeUInt32 = 1835100014;
alias typeSInt64 = 1668246896;
alias typeUInt64 = 1969450861;
alias typeIEEE32BitFloatingPoint = 1936289383;
alias typeIEEE64BitFloatingPoint = 1685026146;
alias type128BitFloatingPoint = 1818518124;
alias typeDecimalStruct = 1684366189;

alias typeAEList = 1818850164;
alias typeAERecord = 1919247215;
alias typeAppleEvent = 1634039412;
alias typeEventRecord = 1702261347;
alias typeTrue = 1953658213;
alias typeFalse = 1717660787;
alias typeAlias = 1634494835;
alias typeEnumerated = 1701737837;
alias typeType = 1954115685;
alias typeAppParameters = 1634758753;
alias typeProperty = 1886547824;
alias typeFSRef = 1718841958;
alias typeFileURL = 1718973036;
alias typeBookmarkData = 1651339883;
alias typeKeyword = 1801812343;
alias typeSectionH = 1936024436;
alias typeWildCard = 707406378;
alias typeApplSignature = 1936287598;
alias typeQDRectangle = 1902408308;
alias typeFixed = 1718188132;
alias typeProcessSerialNumber = 1886613024;
alias typeApplicationURL = 1634759276;
alias typeNull = 1853189228;

alias typeCFAttributedStringRef = 1667654003;
alias typeCFMutableAttributedStringRef = 1667653985;
alias typeCFStringRef = 1667658612;
alias typeCFMutableStringRef = 1667657075;
alias typeCFArrayRef = 1667654002;
alias typeCFMutableArrayRef = 1667657057;
alias typeCFDictionaryRef = 1667654755;
alias typeCFMutableDictionaryRef = 1667657060;
alias typeCFNumberRef = 1667657314;
alias typeCFBooleanRef = 1667658854;
alias typeCFTypeRef = 1667658873;

alias typeKernelProcessID = 1802529124;
alias typeMachPort = 1886351988;

alias typeApplicationBundleID = 1651863140;

alias keyTransactionIDAttr = 1953653102;
alias keyReturnIDAttr = 1920231780;
alias keyEventClassAttr = 1702257516;
alias keyEventIDAttr = 1702259044;
alias keyAddressAttr = 1633969266;
alias keyOptionalKeywordAttr = 1869640811;
alias keyTimeoutAttr = 1953066351;
alias keyInteractLevelAttr = 1768846437;
alias keyEventSourceAttr = 1702064739;
alias keyMissedKeywordAttr = 1835627379;
alias keyOriginalAddressAttr = 1718775661;
alias keyAcceptTimeoutAttr = 1633907821;
alias keyReplyRequestedAttr = 1919250545;
alias keySenderEUIDAttr = 1936025956;
alias keySenderEGIDAttr = 1936157028;
alias keySenderUIDAttr = 1969841267;
alias keySenderGIDAttr = 1734960243;
alias keySenderPIDAttr = 1936746852;

alias kAEDebugPOSTHeader = 1;
alias kAEDebugReplyHeader = 2;
alias kAEDebugXMLRequest = 4;
alias kAEDebugXMLResponse = 8;
alias kAEDebugXMLDebugAll = 4294967295;

alias kSOAP1999Schema = 1936931129;
alias kSOAP2001Schema = 1936928817;

alias keyUserNameAttr = 1970168173;
alias keyUserPasswordAttr = 1885434739;
alias keyDisableAuthenticationAttr = 1635087464;
alias keyXMLDebuggingAttr = 2019844711;
alias kAERPCClass = 1919968032;
alias kAEXMLRPCScheme = 1380991794;
alias kAESOAPScheme = 1397702992;
alias kAESharedScriptHandler = 2004050800;
alias keyRPCMethodName = 1835365480;
alias keyRPCMethodParam = 1885434477;
alias keyRPCMethodParamOrder = 795832932;
alias keyAEPOSTHeaderData = 1885889892;
alias keyAEReplyHeaderData = 1919444324;
alias keyAEXMLRequestData = 2020762993;
alias keyAEXMLReplyData = 2020762992;
alias keyAdditionalHTTPHeaders = 1634231652;
alias keySOAPAction = 1935762292;
alias keySOAPMethodNameSpace = 1836281955;
alias keySOAPMethodNameSpaceURI = 1836281973;
alias keySOAPSchemaVersion = 1936941928;

alias keySOAPStructureMetaData = 796093796;
alias keySOAPSMDNamespace = 1936944755;
alias keySOAPSMDNamespaceURI = 1936944757;
alias keySOAPSMDType = 1936946288;

alias kAEUseHTTPProxyAttr = 2020962418;
alias kAEHTTPProxyPortAttr = 2020111472;
alias kAEHTTPProxyHostAttr = 2020111464;

alias kAESocks4Protocol = 4;
alias kAESocks5Protocol = 5;

alias kAEUseSocksAttr = 2020828019;
alias kAESocksProxyAttr = 2020831083;
alias kAESocksHostAttr = 2020829299;
alias kAESocksPortAttr = 2020829296;
alias kAESocksUserAttr = 2020829301;
alias kAESocksPasswordAttr = 2020829303;

alias kAEDescListFactorNone = 0;
alias kAEDescListFactorType = 4;
alias kAEDescListFactorTypeAndSize = 8;

alias kAutoGenerateReturnID = 4294967295;
alias kAnyTransactionID = 0;

alias DescType = UInt;

alias AEKeyword = UInt;

alias AEDataStorageType = OpaquePointer;

alias AEDataStorage = Pointer[AEDataStorageType];

record Struct_AEDesc (
    descriptorType : UInt,
    dataHandle : AEDataStorage,
);

alias AEDesc = Struct_AEDesc;

alias AEDescPtr = Pointer[AEDesc];

record Struct_AEKeyDesc (
    descKey : UInt,
    descContent : AEDesc,
);

alias AEKeyDesc = Struct_AEKeyDesc;

alias AEDescList = AEDesc;

alias AERecord = AEDescList;

alias AEAddressDesc = AEDesc;

alias AppleEvent = AERecord;

alias AppleEventPtr = Pointer[AppleEvent];

alias AEReturnID = Short;

alias AETransactionID = Int;

alias AEEventClass = UInt;

alias AEEventID = UInt;

alias AEArrayType = CChar;

alias kAEDataArray = 0;
alias kAEPackedArray = 1;
alias kAEDescArray = 3;
alias kAEKeyDescArray = 4;

alias kAEHandleArray = 2;

alias AEArrayData = AUnionType;

alias AEArrayDataPointer = Pointer[AEArrayData];

alias AESendPriority = Short;

alias kAENormalPriority = 0;
alias kAEHighPriority = 1;

alias AESendMode = Int;

alias kAENoReply = 1;
alias kAEQueueReply = 2;
alias kAEWaitReply = 3;
alias kAEDontReconnect = 128;
alias kAEWantReceipt = 512;
alias kAENeverInteract = 16;
alias kAECanInteract = 32;
alias kAEAlwaysInteract = 48;
alias kAECanSwitchLayer = 64;
alias kAEDontRecord = 4096;
alias kAEDontExecute = 8192;
alias kAEProcessNonReplyEvents = 32768;

alias kAEDefaultTimeout = 4294967295;
alias kNoTimeOut = 4294967294;

alias AECoerceDescProcPtr = CCodePointer[[Pointer[Struct_AEDesc],UInt,RawPointer,Pointer[Struct_AEDesc]],[Short]];

alias AECoercePtrProcPtr = CCodePointer[[UInt,RawPointer,CLong,UInt,RawPointer,Pointer[Struct_AEDesc]],[Short]];

alias AECoerceDescUPP = AECoerceDescProcPtr;

alias AECoercePtrUPP = AECoercePtrProcPtr;

external NewAECoerceDescUPP(
    userRoutine : AECoerceDescProcPtr) : AECoerceDescUPP;

external NewAECoercePtrUPP(
    userRoutine : AECoercePtrProcPtr) : AECoercePtrUPP;

external DisposeAECoerceDescUPP(
    userUPP : AECoerceDescUPP);

external DisposeAECoercePtrUPP(
    userUPP : AECoercePtrUPP);

external InvokeAECoerceDescUPP(
    fromDesc : Pointer[AEDesc],
    toType : UInt,
    handlerRefcon : SRefCon,
    toDesc : Pointer[AEDesc],
    userUPP : AECoerceDescUPP) : Short;

external InvokeAECoercePtrUPP(
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong,
    toType : UInt,
    handlerRefcon : SRefCon,
    result : Pointer[AEDesc],
    userUPP : AECoercePtrUPP) : Short;

alias AECoercionHandlerUPP = AECoerceDescUPP;

external AEInstallCoercionHandler(
    fromType : UInt,
    toType : UInt,
    handler : AECoercionHandlerUPP,
    handlerRefcon : SRefCon,
    fromTypeIsDesc : CUChar,
    isSysHandler : CUChar) : Short;

external AERemoveCoercionHandler(
    fromType : UInt,
    toType : UInt,
    handler : AECoercionHandlerUPP,
    isSysHandler : CUChar) : Short;

external AEGetCoercionHandler(
    fromType : UInt,
    toType : UInt,
    handler : Pointer[AECoercionHandlerUPP],
    handlerRefcon : Pointer[SRefCon],
    fromTypeIsDesc : Pointer[CUChar],
    isSysHandler : CUChar) : Short;

external AECoercePtr(
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong,
    toType : UInt,
    result : Pointer[AEDesc]) : Short;

external AECoerceDesc(
    theAEDesc : Pointer[AEDesc],
    toType : UInt,
    result : Pointer[AEDesc]) : Short;

external AEInitializeDesc(
    desc : Pointer[AEDesc]);

external AECreateDesc(
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong,
    result : Pointer[AEDesc]) : Short;

external AEDisposeDesc(
    theAEDesc : Pointer[AEDesc]) : Short;

external AEDuplicateDesc(
    theAEDesc : Pointer[AEDesc],
    result : Pointer[AEDesc]) : Short;

alias AEDisposeExternalProcPtr = CCodePointer[[RawPointer,CLong,RawPointer],[]];

alias AEDisposeExternalUPP = AEDisposeExternalProcPtr;

external AECreateDescFromExternalPtr(
    descriptorType : UInt,
    dataPtr : RawPointer,
    dataLength : CLong,
    disposeCallback : AEDisposeExternalUPP,
    disposeRefcon : SRefCon,
    theDesc : Pointer[AEDesc]) : Int;

external AECreateList(
    factoringPtr : RawPointer,
    factoredSize : CLong,
    isRecord : CUChar,
    resultList : Pointer[AEDescList]) : Short;

external AECountItems(
    theAEDescList : Pointer[AEDescList],
    theCount : Pointer[CLong]) : Short;

external AEPutPtr(
    theAEDescList : Pointer[AEDescList],
    index : CLong,
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong) : Short;

external AEPutDesc(
    theAEDescList : Pointer[AEDescList],
    index : CLong,
    theAEDesc : Pointer[AEDesc]) : Short;

external AEGetNthPtr(
    theAEDescList : Pointer[AEDescList],
    index : CLong,
    desiredType : UInt,
    theAEKeyword : Pointer[UInt],
    typeCode : Pointer[UInt],
    dataPtr : RawPointer,
    maximumSize : CLong,
    actualSize : Pointer[CLong]) : Short;

external AEGetNthDesc(
    theAEDescList : Pointer[AEDescList],
    index : CLong,
    desiredType : UInt,
    theAEKeyword : Pointer[UInt],
    result : Pointer[AEDesc]) : Short;

external AESizeOfNthItem(
    theAEDescList : Pointer[AEDescList],
    index : CLong,
    typeCode : Pointer[UInt],
    dataSize : Pointer[CLong]) : Short;

external AEGetArray(
    theAEDescList : Pointer[AEDescList],
    arrayType : CChar,
    arrayPtr : AEArrayDataPointer,
    maximumSize : CLong,
    itemType : Pointer[UInt],
    itemSize : Pointer[CLong],
    itemCount : Pointer[CLong]) : Short;

external AEPutArray(
    theAEDescList : Pointer[AEDescList],
    arrayType : CChar,
    arrayPtr : Pointer[AEArrayData],
    itemType : UInt,
    itemSize : CLong,
    itemCount : CLong) : Short;

external AEDeleteItem(
    theAEDescList : Pointer[AEDescList],
    index : CLong) : Short;

external AECheckIsRecord(
    theDesc : Pointer[AEDesc]) : CUChar;

external AECreateAppleEvent(
    theAEEventClass : UInt,
    theAEEventID : UInt,
    target : Pointer[AEAddressDesc],
    returnID : Short,
    transactionID : Int,
    result : Pointer[AppleEvent]) : Short;

external AEPutParamPtr(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong) : Short;

external AEPutParamDesc(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    theAEDesc : Pointer[AEDesc]) : Short;

external AEGetParamPtr(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    desiredType : UInt,
    actualType : Pointer[UInt],
    dataPtr : RawPointer,
    maximumSize : CLong,
    actualSize : Pointer[CLong]) : Short;

external AEGetParamDesc(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    desiredType : UInt,
    result : Pointer[AEDesc]) : Short;

external AESizeOfParam(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    typeCode : Pointer[UInt],
    dataSize : Pointer[CLong]) : Short;

external AEDeleteParam(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt) : Short;

external AEGetAttributePtr(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    desiredType : UInt,
    typeCode : Pointer[UInt],
    dataPtr : RawPointer,
    maximumSize : CLong,
    actualSize : Pointer[CLong]) : Short;

external AEGetAttributeDesc(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    desiredType : UInt,
    result : Pointer[AEDesc]) : Short;

external AESizeOfAttribute(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    typeCode : Pointer[UInt],
    dataSize : Pointer[CLong]) : Short;

external AEPutAttributePtr(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong) : Short;

external AEPutAttributeDesc(
    theAppleEvent : Pointer[AppleEvent],
    theAEKeyword : UInt,
    theAEDesc : Pointer[AEDesc]) : Short;

external AESizeOfFlattenedDesc(
    theAEDesc : Pointer[AEDesc]) : CLong;

external AEFlattenDesc(
    theAEDesc : Pointer[AEDesc],
    buffer : Ptr,
    bufferSize : CLong,
    actualSize : Pointer[CLong]) : Int;

external AEUnflattenDesc(
    buffer : RawPointer,
    result : Pointer[AEDesc]) : Int;

external AEGetDescData(
    theAEDesc : Pointer[AEDesc],
    dataPtr : RawPointer,
    maximumSize : CLong) : Short;

external AEGetDescDataSize(
    theAEDesc : Pointer[AEDesc]) : CLong;

external AEReplaceDescData(
    typeCode : UInt,
    dataPtr : RawPointer,
    dataSize : CLong,
    theAEDesc : Pointer[AEDesc]) : Short;

external AEGetDescDataRange(
    dataDesc : Pointer[AEDesc],
    buffer : RawPointer,
    offset : CLong,
    length : CLong) : Int;

alias AEEventHandlerProcPtr = CCodePointer[[Pointer[Struct_AEDesc],Pointer[Struct_AEDesc],RawPointer],[Short]];

alias AEEventHandlerUPP = AEEventHandlerProcPtr;

external NewAEDisposeExternalUPP(
    userRoutine : AEDisposeExternalProcPtr) : AEDisposeExternalUPP;

external NewAEEventHandlerUPP(
    userRoutine : AEEventHandlerProcPtr) : AEEventHandlerUPP;

external DisposeAEDisposeExternalUPP(
    userUPP : AEDisposeExternalUPP);

external DisposeAEEventHandlerUPP(
    userUPP : AEEventHandlerUPP);

external InvokeAEDisposeExternalUPP(
    dataPtr : RawPointer,
    dataLength : CLong,
    refcon : SRefCon,
    userUPP : AEDisposeExternalUPP);

external InvokeAEEventHandlerUPP(
    theAppleEvent : Pointer[AppleEvent],
    reply : Pointer[AppleEvent],
    handlerRefcon : SRefCon,
    userUPP : AEEventHandlerUPP) : Short;

alias keyDirectObject = 757935405;
alias keyErrorNumber = 1701999214;
alias keyErrorString = 1701999219;
alias keyProcessSerialNumber = 1886613024;
alias keyPreDispatch = 1885888867;
alias keySelectProc = 1936026728;
alias keyAERecorderCount = 1919247218;
alias keyAEVersion = 1986359923;

alias kCoreEventClass = 1634039412;

alias kAEOpenApplication = 1868656752;
alias kAEOpenDocuments = 1868853091;
alias kAEPrintDocuments = 1885630307;
alias kAEOpenContents = 1868787566;
alias kAEQuitApplication = 1903520116;
alias kAEAnswer = 1634628466;
alias kAEApplicationDied = 1868720500;
alias kAEShowPreferences = 1886545254;

alias kAEStartRecording = 1919247201;
alias kAEStopRecording = 1919247203;
alias kAENotifyStartRecording = 1919247153;
alias kAENotifyStopRecording = 1919247152;
alias kAENotifyRecording = 1919247218;

alias AEEventSource = CChar;

alias kAEUnknownSource = 0;
alias kAEDirectCall = 1;
alias kAESameProcess = 2;
alias kAELocalProcess = 3;
alias kAERemoteProcess = 4;

external AEInstallEventHandler(
    theAEEventClass : UInt,
    theAEEventID : UInt,
    handler : AEEventHandlerUPP,
    handlerRefcon : SRefCon,
    isSysHandler : CUChar) : Short;

external AERemoveEventHandler(
    theAEEventClass : UInt,
    theAEEventID : UInt,
    handler : AEEventHandlerUPP,
    isSysHandler : CUChar) : Short;

external AEGetEventHandler(
    theAEEventClass : UInt,
    theAEEventID : UInt,
    handler : Pointer[AEEventHandlerUPP],
    handlerRefcon : Pointer[SRefCon],
    isSysHandler : CUChar) : Short;

external AEInstallSpecialHandler(
    functionClass : UInt,
    handler : AEEventHandlerUPP,
    isSysHandler : CUChar) : Short;

external AERemoveSpecialHandler(
    functionClass : UInt,
    handler : AEEventHandlerUPP,
    isSysHandler : CUChar) : Short;

external AEGetSpecialHandler(
    functionClass : UInt,
    handler : Pointer[AEEventHandlerUPP],
    isSysHandler : CUChar) : Short;

external AEManagerInfo(
    keyWord : UInt,
    result : Pointer[CLong]) : Short;

external kAERemoteProcessURLKey : CFStringRef;

external kAERemoteProcessNameKey : CFStringRef;

external kAERemoteProcessUserIDKey : CFStringRef;

external kAERemoteProcessProcessIDKey : CFStringRef;

record Struct_AERemoteProcessResolverContext (
    version : CLong,
    info : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
    copyDescription : CFAllocatorCopyDescriptionCallBack,
);

alias AERemoteProcessResolverContext = Struct_AERemoteProcessResolverContext;

alias AERemoteProcessResolverRef = OpaquePointer;

external AECreateRemoteProcessResolver(
    allocator : CFAllocatorRef,
    url : CFURLRef) : AERemoteProcessResolverRef;

external AEDisposeRemoteProcessResolver(
    ref_ : AERemoteProcessResolverRef);

external AERemoteProcessResolverGetProcesses(
    ref_ : AERemoteProcessResolverRef,
    outError : Pointer[CFStreamError]) : CFArrayRef;

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

external AERemoteProcessResolverScheduleWithRunLoop(
    ref_ : AERemoteProcessResolverRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef,
    callback : AERemoteProcessResolverCallback,
    ctx : Pointer[AERemoteProcessResolverContext]);

external CreateOffsetDescriptor(
    theOffset : CLong,
    theDescriptor : Pointer[AEDesc]) : Short;

external CreateCompDescriptor(
    comparisonOperator : UInt,
    operand1 : Pointer[AEDesc],
    operand2 : Pointer[AEDesc],
    disposeInputs : CUChar,
    theDescriptor : Pointer[AEDesc]) : Short;

external CreateLogicalDescriptor(
    theLogicalTerms : Pointer[AEDescList],
    theLogicOperator : UInt,
    disposeInputs : CUChar,
    theDescriptor : Pointer[AEDesc]) : Short;

external CreateObjSpecifier(
    desiredClass : UInt,
    theContainer : Pointer[AEDesc],
    keyForm : UInt,
    keyData : Pointer[AEDesc],
    disposeInputs : CUChar,
    objSpecifier : Pointer[AEDesc]) : Short;

external CreateRangeDescriptor(
    rangeStart : Pointer[AEDesc],
    rangeStop : Pointer[AEDesc],
    disposeInputs : CUChar,
    theDescriptor : Pointer[AEDesc]) : Short;

alias kAEAND = 1095648288;
alias kAEOR = 1330782240;
alias kAENOT = 1313821728;
alias kAEFirst = 1718186611;
alias kAELast = 1818325876;
alias kAEMiddle = 1835623524;
alias kAEAny = 1634629920;
alias kAEAll = 1634495520;
alias kAENext = 1852143732;
alias kAEPrevious = 1886545270;
alias keyAECompOperator = 1919249519;
alias keyAELogicalTerms = 1952805485;
alias keyAELogicalOperator = 1819240291;
alias keyAEObject1 = 1868720689;
alias keyAEObject2 = 1868720690;
alias keyAEDesiredClass = 2002873972;
alias keyAEContainer = 1718775661;
alias keyAEKeyForm = 1718579821;
alias keyAEKeyData = 1936026724;

alias keyAERangeStart = 1937006962;
alias keyAERangeStop = 1937010544;
alias keyDisposeTokenProc = 2020896619;
alias keyAECompareProc = 1668116594;
alias keyAECountProc = 1668247156;
alias keyAEMarkTokenProc = 1835755876;
alias keyAEMarkProc = 1835102827;
alias keyAEAdjustMarksProc = 1633970797;
alias keyAEGetErrDescProc = 1768842339;

alias formAbsolutePosition = 1768842360;
alias formRelativePosition = 1919249509;
alias formTest = 1952805748;
alias formRange = 1918987879;
alias formPropertyID = 1886547824;
alias formName = 1851878757;
alias formUniqueID = 1229201440;
alias typeObjectSpecifier = 1868720672;
alias typeObjectBeingExamined = 1702391150;
alias typeCurrentContainer = 1667460724;
alias typeToken = 1953459045;
alias typeRelativeDescriptor = 1919249440;
alias typeAbsoluteOrdinal = 1633842031;
alias typeIndexDescriptor = 1768842341;
alias typeRangeDescriptor = 1918987879;
alias typeLogicalDescriptor = 1819240297;
alias typeCompDescriptor = 1668116580;
alias typeOSLTokenList = 1869837420;

alias kAEIDoMinimum = 0;
alias kAEIDoWhose = 1;
alias kAEIDoMarking = 4;
alias kAEPassSubDescs = 8;
alias kAEResolveNestedLists = 16;
alias kAEHandleSimpleRanges = 32;
alias kAEUseRelativeIterators = 64;

alias typeWhoseDescriptor = 2003332979;
alias formWhose = 2003332979;
alias typeWhoseRange = 2003988071;
alias keyAEWhoseRangeStart = 2004055154;
alias keyAEWhoseRangeStop = 2004055152;
alias keyAEIndex = 1802069112;
alias keyAETest = 1802793844;

record Struct_ccntTokenRecord (
    tokenClass : UInt,
    token : AEDesc,
);

alias ccntTokenRecord = Struct_ccntTokenRecord;

alias ccntTokenRecPtr = Pointer[ccntTokenRecord];

alias ccntTokenRecHandle = Pointer[ccntTokenRecPtr];

alias OSLAccessorProcPtr = CCodePointer[[UInt,Pointer[Struct_AEDesc],UInt,UInt,Pointer[Struct_AEDesc],Pointer[Struct_AEDesc],RawPointer],[Short]];

alias OSLCompareProcPtr = CCodePointer[[UInt,Pointer[Struct_AEDesc],Pointer[Struct_AEDesc],Pointer[CUChar]],[Short]];

alias OSLCountProcPtr = CCodePointer[[UInt,UInt,Pointer[Struct_AEDesc],Pointer[CLong]],[Short]];

alias OSLDisposeTokenProcPtr = CCodePointer[[Pointer[Struct_AEDesc]],[Short]];

alias OSLGetMarkTokenProcPtr = CCodePointer[[Pointer[Struct_AEDesc],UInt,Pointer[Struct_AEDesc]],[Short]];

alias OSLGetErrDescProcPtr = CCodePointer[[Pointer[Pointer[Struct_AEDesc]]],[Short]];

alias OSLMarkProcPtr = CCodePointer[[Pointer[Struct_AEDesc],Pointer[Struct_AEDesc],CLong],[Short]];

alias OSLAdjustMarksProcPtr = CCodePointer[[CLong,CLong,Pointer[Struct_AEDesc]],[Short]];

alias OSLAccessorUPP = OSLAccessorProcPtr;

alias OSLCompareUPP = OSLCompareProcPtr;

alias OSLCountUPP = OSLCountProcPtr;

alias OSLDisposeTokenUPP = OSLDisposeTokenProcPtr;

alias OSLGetMarkTokenUPP = OSLGetMarkTokenProcPtr;

alias OSLGetErrDescUPP = OSLGetErrDescProcPtr;

alias OSLMarkUPP = OSLMarkProcPtr;

alias OSLAdjustMarksUPP = OSLAdjustMarksProcPtr;

external NewOSLAccessorUPP(
    userRoutine : OSLAccessorProcPtr) : OSLAccessorUPP;

external NewOSLCompareUPP(
    userRoutine : OSLCompareProcPtr) : OSLCompareUPP;

external NewOSLCountUPP(
    userRoutine : OSLCountProcPtr) : OSLCountUPP;

external NewOSLDisposeTokenUPP(
    userRoutine : OSLDisposeTokenProcPtr) : OSLDisposeTokenUPP;

external NewOSLGetMarkTokenUPP(
    userRoutine : OSLGetMarkTokenProcPtr) : OSLGetMarkTokenUPP;

external NewOSLGetErrDescUPP(
    userRoutine : OSLGetErrDescProcPtr) : OSLGetErrDescUPP;

external NewOSLMarkUPP(
    userRoutine : OSLMarkProcPtr) : OSLMarkUPP;

external NewOSLAdjustMarksUPP(
    userRoutine : OSLAdjustMarksProcPtr) : OSLAdjustMarksUPP;

external DisposeOSLAccessorUPP(
    userUPP : OSLAccessorUPP);

external DisposeOSLCompareUPP(
    userUPP : OSLCompareUPP);

external DisposeOSLCountUPP(
    userUPP : OSLCountUPP);

external DisposeOSLDisposeTokenUPP(
    userUPP : OSLDisposeTokenUPP);

external DisposeOSLGetMarkTokenUPP(
    userUPP : OSLGetMarkTokenUPP);

external DisposeOSLGetErrDescUPP(
    userUPP : OSLGetErrDescUPP);

external DisposeOSLMarkUPP(
    userUPP : OSLMarkUPP);

external DisposeOSLAdjustMarksUPP(
    userUPP : OSLAdjustMarksUPP);

external InvokeOSLAccessorUPP(
    desiredClass : UInt,
    container : Pointer[AEDesc],
    containerClass : UInt,
    form : UInt,
    selectionData : Pointer[AEDesc],
    value : Pointer[AEDesc],
    accessorRefcon : SRefCon,
    userUPP : OSLAccessorUPP) : Short;

external InvokeOSLCompareUPP(
    oper : UInt,
    obj1 : Pointer[AEDesc],
    obj2 : Pointer[AEDesc],
    result : Pointer[CUChar],
    userUPP : OSLCompareUPP) : Short;

external InvokeOSLCountUPP(
    desiredType : UInt,
    containerClass : UInt,
    container : Pointer[AEDesc],
    result : Pointer[CLong],
    userUPP : OSLCountUPP) : Short;

external InvokeOSLDisposeTokenUPP(
    unneededToken : Pointer[AEDesc],
    userUPP : OSLDisposeTokenUPP) : Short;

external InvokeOSLGetMarkTokenUPP(
    dContainerToken : Pointer[AEDesc],
    containerClass : UInt,
    result : Pointer[AEDesc],
    userUPP : OSLGetMarkTokenUPP) : Short;

external InvokeOSLGetErrDescUPP(
    appDescPtr : Pointer[Pointer[AEDesc]],
    userUPP : OSLGetErrDescUPP) : Short;

external InvokeOSLMarkUPP(
    dToken : Pointer[AEDesc],
    markToken : Pointer[AEDesc],
    index : CLong,
    userUPP : OSLMarkUPP) : Short;

external InvokeOSLAdjustMarksUPP(
    newStart : CLong,
    newStop : CLong,
    markToken : Pointer[AEDesc],
    userUPP : OSLAdjustMarksUPP) : Short;

external AEObjectInit() : Short;

external AESetObjectCallbacks(
    myCompareProc : OSLCompareUPP,
    myCountProc : OSLCountUPP,
    myDisposeTokenProc : OSLDisposeTokenUPP,
    myGetMarkTokenProc : OSLGetMarkTokenUPP,
    myMarkProc : OSLMarkUPP,
    myAdjustMarksProc : OSLAdjustMarksUPP,
    myGetErrDescProcPtr : OSLGetErrDescUPP) : Short;

external AEResolve(
    objectSpecifier : Pointer[AEDesc],
    callbackFlags : Short,
    theToken : Pointer[AEDesc]) : Short;

external AEInstallObjectAccessor(
    desiredClass : UInt,
    containerType : UInt,
    theAccessor : OSLAccessorUPP,
    accessorRefcon : SRefCon,
    isSysHandler : CUChar) : Short;

external AERemoveObjectAccessor(
    desiredClass : UInt,
    containerType : UInt,
    theAccessor : OSLAccessorUPP,
    isSysHandler : CUChar) : Short;

external AEGetObjectAccessor(
    desiredClass : UInt,
    containerType : UInt,
    accessor : Pointer[OSLAccessorUPP],
    accessorRefcon : Pointer[SRefCon],
    isSysHandler : CUChar) : Short;

external AEDisposeToken(
    theToken : Pointer[AEDesc]) : Short;

external AECallObjectAccessor(
    desiredClass : UInt,
    containerToken : Pointer[AEDesc],
    containerClass : UInt,
    keyForm : UInt,
    keyData : Pointer[AEDesc],
    token : Pointer[AEDesc]) : Short;

alias cAEList = 1818850164;
alias cApplication = 1667330160;
alias cArc = 1667330659;
alias cBoolean = 1651470188;
alias cCell = 1667458412;
alias cChar = 1667784992;
alias cColorTable = 1668051572;
alias cColumn = 1667460972;
alias cDocument = 1685021557;
alias cDrawingArea = 1667527287;
alias cEnumeration = 1701737837;
alias cFile = 1718185061;
alias cFixed = 1718188132;
alias cFixedPoint = 1718644340;
alias cFixedRectangle = 1718772596;
alias cGraphicLine = 1735158126;
alias cGraphicObject = 1667723106;
alias cGraphicShape = 1667724136;
alias cGraphicText = 1667724408;
alias cGroupedGraphic = 1668311395;

alias cInsertionLoc = 1768846188;
alias cInsertionPoint = 1667853939;
alias cIntlText = 1769240692;
alias cIntlWritingCode = 1768846444;
alias cItem = 1667855469;
alias cLine = 1668049262;
alias cLongDateTime = 1818522656;
alias cLongFixed = 1818654820;
alias cLongFixedPoint = 1818652788;
alias cLongFixedRectangle = 1818653283;
alias cLongInteger = 1819242087;
alias cLongPoint = 1819307636;
alias cLongRectangle = 1819435892;
alias cMachineLoc = 1833725795;
alias cMenu = 1668116085;
alias cMenuItem = 1668113774;
alias cObject = 1668244074;
alias cObjectSpecifier = 1868720672;
alias cOpenableObject = 1668247394;
alias cOval = 1668249196;

alias cParagraph = 1668309362;
alias cPICT = 1346978644;
alias cPixel = 1668315244;
alias cPixelMap = 1668311416;
alias cPolygon = 1668310894;
alias cProperty = 1886547824;
alias cQDPoint = 1363439732;
alias cQDRectangle = 1902408308;
alias cRectangle = 1668441443;
alias cRGBColor = 1666336578;
alias cRotation = 1953656692;
alias cRoundedRectangle = 1668444771;
alias cRow = 1668444023;
alias cSelection = 1668506988;
alias cShortInteger = 1936224114;
alias cTable = 1668571756;
alias cText = 1668577396;
alias cTextFlow = 1667656815;
alias cTextStyles = 1953723513;
alias cType = 1954115685;

alias cVersion = 1986359923;
alias cWindow = 1668770158;
alias cWord = 1668771698;
alias enumArrows = 1634890351;
alias enumJustification = 1786082164;
alias enumKeyForm = 1801876077;
alias enumPosition = 1886352233;
alias enumProtection = 1886549102;
alias enumQuality = 1903518060;
alias enumSaveOptions = 1935767151;
alias enumStyle = 1937013100;
alias enumTransferMode = 1953653102;
alias kAEAbout = 1633841013;
alias kAEAfter = 1634104421;
alias kAEAliasSelection = 1935764585;
alias kAEAllCaps = 1634493296;
alias kAEArrowAtEnd = 1634887022;
alias kAEArrowAtStart = 1634890612;
alias kAEArrowBothEnds = 1634886255;

alias kAEAsk = 1634954016;
alias kAEBefore = 1650812527;
alias kAEBeginning = 1650945639;
alias kAEBeginsWith = 1650947956;
alias kAEBeginTransaction = 1650812777;
alias kAEBold = 1651469412;
alias kAECaseSensEquals = 1668506993;
alias kAECentered = 1667591796;
alias kAEChangeView = 1986618743;
alias kAEClone = 1668050798;
alias kAEClose = 1668050803;
alias kAECondensed = 1668247140;
alias kAEContains = 1668247156;
alias kAECopy = 1668247673;
alias kAECoreSuite = 1668248165;
alias kAECountElements = 1668183141;
alias kAECreateElement = 1668441452;
alias kAECreatePublisher = 1668314466;
alias kAECut = 1668641824;
alias kAEDelete = 1684368495;

alias kAEDoObjectsExist = 1685022072;
alias kAEDoScript = 1685025635;
alias kAEDrag = 1685217639;
alias kAEDuplicateSelection = 1935963504;
alias kAEEditGraphic = 1701079412;
alias kAEEmptyTrash = 1701671028;
alias kAEEnd = 1701733408;
alias kAEEndsWith = 1701733491;
alias kAEEndTransaction = 1701733492;
alias kAEEquals = 1025515552;
alias kAEExpanded = 1885698160;
alias kAEFast = 1717662580;
alias kAEFinderEvents = 1179534418;
alias kAEFormulaProtect = 1718645359;
alias kAEFullyJustified = 1718971500;
alias kAEGetClassInfo = 1903125098;
alias kAEGetData = 1734702180;
alias kAEGetDataSize = 1685285242;
alias kAEGetEventInfo = 1735681385;
alias kAEGetInfoSelection = 1936289382;

alias kAEGetPrivilegeSelection = 1936749174;
alias kAEGetSuiteInfo = 1735684969;
alias kAEGreaterThan = 1042292768;
alias kAEGreaterThanEquals = 1044193312;
alias kAEGrow = 1735552887;
alias kAEHidden = 1751737454;
alias kAEHiQuality = 1751740789;
alias kAEImageGraphic = 1768777586;
alias kAEIsUniform = 1769174382;
alias kAEItalic = 1769234796;
alias kAELeftJustified = 1818584692;
alias kAELessThan = 1008738336;
alias kAELessThanEquals = 1010638880;
alias kAELowercase = 1819244387;
alias kAEMakeObjectsVisible = 1836476787;
alias kAEMiscStandards = 1835627363;
alias kAEModifiable = 1836016742;
alias kAEMove = 1836021349;
alias kAENo = 1852776480;
alias kAENoArrow = 1634889327;

alias kAENonmodifiable = 1852665700;
alias kAEOpen = 1868853091;
alias kAEOpenSelection = 1936683109;
alias kAEOutline = 1869968492;
alias kAEPageSetup = 1885827957;
alias kAEPaste = 1885434740;
alias kAEPlain = 1886151022;
alias kAEPrint = 1885630307;
alias kAEPrintSelection = 1936749161;
alias kAEPrintWindow = 1886873966;
alias kAEPutAwaySelection = 1936749940;
alias kAEQDAddOver = 1633969263;
alias kAEQDAddPin = 1633969264;
alias kAEQDAdMax = 1633971576;
alias kAEQDAdMin = 1633971566;
alias kAEQDBic = 1651073824;
alias kAEQDBlend = 1651273316;
alias kAEQDCopy = 1668315424;
alias kAEQDNotBic = 1851943267;
alias kAEQDNotCopy = 1852010617;

alias kAEQDNotOr = 1853124466;
alias kAEQDNotXor = 1853386610;
alias kAEQDOr = 1869750304;
alias kAEQDSubOver = 1937072751;
alias kAEQDSubPin = 1937072752;
alias kAEQDSupplementalSuite = 1902408560;
alias kAEQDXor = 2020569632;
alias kAEQuickdrawSuite = 1902408311;
alias kAEQuitAll = 1903520097;
alias kAERedo = 1919247471;
alias kAERegular = 1919248236;
alias kAEReopenApplication = 1918988400;
alias kAEReplace = 1919970403;
alias kAERequiredSuite = 1919250788;
alias kAERestart = 1919251316;
alias kAERevealSelection = 1936876918;
alias kAERevert = 1920365172;
alias kAERightJustified = 1919379572;
alias kAESave = 1935767141;
alias kAESelect = 1936483188;
alias kAESetData = 1936028772;

alias kAESetPosition = 1886352238;
alias kAEShadow = 1936220516;
alias kAEShowClipboard = 1936221036;
alias kAEShutDown = 1936225652;
alias kAESleep = 1936483696;
alias kAESmallCaps = 1936548720;
alias kAESpecialClassProperties = 1665147681;
alias kAEStrikethrough = 1937011307;
alias kAESubscript = 1935831907;
alias kAESuperscript = 1936749411;
alias kAETableSuite = 1952607347;
alias kAETextSuite = 1413830740;
alias kAETransactionTerminated = 1953788525;
alias kAEUnderline = 1970168940;
alias kAEUndo = 1970168943;
alias kAEWholeWordEquals = 2004313457;
alias kAEYes = 2036691744;
alias kAEZoom = 2054123373;

alias kAELogOut = 1819240303;
alias kAEReallyLogOut = 1919706991;
alias kAEShowRestartDialog = 1920103284;
alias kAEShowShutdownDialog = 1920164974;

alias kAEMouseClass = 1836021107;
alias kAEDown = 1685026670;
alias kAEUp = 1970282528;
alias kAEMoved = 1836021349;
alias kAEStoppedMoving = 1937010544;
alias kAEWindowClass = 2003398244;
alias kAEUpdate = 1970300020;
alias kAEActivate = 1633907830;
alias kAEDeactivate = 1684104052;
alias kAECommandClass = 1668116068;
alias kAEKeyClass = 1801812323;
alias kAERawKey = 1919640953;
alias kAEVirtualKey = 1801812323;
alias kAENavigationKey = 1851881061;
alias kAEAutoDown = 1635087471;
alias kAEApplicationClass = 1634758764;
alias kAESuspend = 1937077104;
alias kAEResume = 1920167269;
alias kAEDiskEvent = 1684632427;
alias kAENullEvent = 1853189228;
alias kAEWakeUpEvent = 2002873189;
alias kAEScrapEvent = 1935897200;
alias kAEHighLevel = 1751738216;

alias keyAEAngle = 1801547367;
alias keyAEArcAngle = 1885434467;

alias keyAEBaseAddr = 1650549860;
alias keyAEBestType = 1885500276;
alias keyAEBgndColor = 1801610092;
alias keyAEBgndPattern = 1801613428;
alias keyAEBounds = 1885498980;
alias keyAECellList = 1801677940;
alias keyAEClassID = 1668041028;
alias keyAEColor = 1668246642;
alias keyAEColorTable = 1668052066;
alias keyAECurveHeight = 1801676900;
alias keyAECurveWidth = 1801680740;
alias keyAEDashStyle = 1885631348;
alias keyAEData = 1684108385;
alias keyAEDefaultType = 1684366964;
alias keyAEDefinitionRect = 1885631092;
alias keyAEDescType = 1685288048;
alias keyAEDestination = 1684370292;
alias keyAEDoAntiAlias = 1634628705;
alias keyAEDoDithered = 1734633844;
alias keyAEDoRotate = 1801745012;

alias keyAEDoScale = 1802724193;
alias keyAEDoTranslate = 1802793569;
alias keyAEEditionFileLoc = 1701605219;
alias keyAEElements = 1701604723;
alias keyAEEndPoint = 1885695588;
alias keyAEEventClass = 1702257516;
alias keyAEEventID = 1702261865;
alias keyAEFile = 1801873772;
alias keyAEFileType = 1718383728;
alias keyAEFillColor = 1718379372;
alias keyAEFillPattern = 1718382708;
alias keyAEFlipHorizontal = 1801873519;
alias keyAEFlipVertical = 1801877108;
alias keyAEFont = 1718578804;
alias keyAEFormula = 1885761394;
alias keyAEGraphicObjects = 1735352947;
alias keyAEID = 1229201440;
alias keyAEImageQuality = 1735488865;
alias keyAEInsertHere = 1768846184;
alias keyAEKeyForms = 1801812326;

alias keyAEKeyword = 1803122532;
alias keyAELevel = 1818588780;
alias keyAELineArrow = 1634890351;
alias keyAEName = 1886282093;
alias keyAENewElementLoc = 1886283116;
alias keyAEObject = 1802461802;
alias keyAEObjectClass = 1802462060;
alias keyAEOffStyles = 1868985204;
alias keyAEOnStyles = 1869509492;
alias keyAEParameters = 1886547315;
alias keyAEParamFlags = 1886217831;
alias keyAEPenColor = 1886413676;
alias keyAEPenPattern = 1886416993;
alias keyAEPenWidth = 1886418788;
alias keyAEPixelDepth = 1885630580;
alias keyAEPixMapMinus = 1802530157;
alias keyAEPMTable = 1802530164;
alias keyAEPointList = 1886678132;
alias keyAEPointSize = 1886679930;
alias keyAEPosition = 1802530675;

alias keyAEPropData = 1886545012;
alias keyAEProperties = 1903194735;
alias keyAEProperty = 1802531440;
alias keyAEPropFlags = 1886545511;
alias keyAEPropID = 1886547824;
alias keyAEProtection = 1886417519;
alias keyAERenderAs = 1802659182;
alias keyAERequestedType = 1920235888;
alias keyAEResult = 757935405;
alias keyAEResultInfo = 1920166254;
alias keyAERotation = 1886547828;
alias keyAERotPoint = 1802663024;
alias keyAERowList = 1802660979;
alias keyAESaveOptions = 1935767151;
alias keyAEScale = 1886610284;
alias keyAEScriptTag = 1886610292;
alias keyAESearchText = 1937012852;
alias keyAEShowWhere = 1936224119;
alias keyAEStartAngle = 1885433447;
alias keyAEStartPoint = 1886614640;
alias keyAEStyles = 1802728569;

alias keyAESuiteID = 1937074548;
alias keyAEText = 1802795124;
alias keyAETextColor = 1886681187;
alias keyAETextFont = 1886681190;
alias keyAETextPointSize = 1886679155;
alias keyAETextStyles = 1954050932;
alias keyAETextLineHeight = 1802792040;
alias keyAETextLineAscent = 1802789235;
alias keyAETheText = 1953002616;
alias keyAETransferMode = 1886418029;
alias keyAETranslation = 1886679667;
alias keyAETryAsStructGraf = 1953460071;
alias keyAEUniformStyles = 1970500716;
alias keyAEUpdateOn = 1886744676;
alias keyAEUserTerm = 1970565741;
alias keyAEWindow = 2003723383;
alias keyAEWritingCode = 2003985252;

alias keyMiscellaneous = 1718448995;
alias keySelection = 1718838636;
alias keyWindow = 1802989156;
alias keyWhen = 2003330414;
alias keyWhere = 2003330418;
alias keyModifiers = 1836016755;
alias keyKey = 1801812256;
alias keyKeyCode = 1668244581;
alias keyKeyboard = 1801812322;
alias keyDriveNumber = 1685222947;
alias keyErrorCode = 1701999139;
alias keyHighLevelClass = 1751346291;
alias keyHighLevelID = 1751737376;

alias pArcAngle = 1885434467;
alias pBackgroundColor = 1885496172;
alias pBackgroundPattern = 1885499508;
alias pBestType = 1885500276;
alias pBounds = 1885498980;
alias pClass = 1885564019;
alias pClipboard = 1885564009;
alias pColor = 1668246642;
alias pColorTable = 1668052066;
alias pContents = 1885564532;
alias pCornerCurveHeight = 1885562980;
alias pCornerCurveWidth = 1885566820;
alias pDashStyle = 1885631348;
alias pDefaultType = 1684366964;
alias pDefinitionRect = 1885631092;
alias pEnabled = 1701732972;
alias pEndPoint = 1885695588;
alias pFillColor = 1718379372;
alias pFillPattern = 1718382708;
alias pFont = 1718578804;

alias pFormula = 1885761394;
alias pGraphicObjects = 1735352947;
alias pHasCloseBox = 1751346274;
alias pHasTitleBar = 1886677364;
alias pID = 1229201440;
alias pIndex = 1885955192;
alias pInsertionLoc = 1885957747;
alias pIsFloating = 1769170540;
alias pIsFrontProcess = 1885959014;
alias pIsModal = 1886220132;
alias pIsModified = 1768779620;
alias pIsResizable = 1886548858;
alias pIsStationeryPad = 1886613604;
alias pIsZoomable = 1769175661;
alias pIsZoomed = 1887073645;
alias pItemNumber = 1769237870;
alias pJustification = 1886024564;
alias pLineArrow = 1634890351;
alias pMenuID = 1835952484;
alias pName = 1886282093;

alias pNewElementLoc = 1886283116;
alias pPenColor = 1886413676;
alias pPenPattern = 1886416993;
alias pPenWidth = 1886418788;
alias pPixelDepth = 1885630580;
alias pPointList = 1886678132;
alias pPointSize = 1886679930;
alias pProtection = 1886417519;
alias pRotation = 1886547828;
alias pScale = 1886610284;
alias pScript = 1935896692;
alias pScriptTag = 1886610292;
alias pSelected = 1936026723;
alias pSelection = 1936026725;
alias pStartAngle = 1885433447;
alias pStartPoint = 1886614640;
alias pTextColor = 1886681187;
alias pTextFont = 1886681190;
alias pTextItemDelimiters = 1954047084;
alias pTextPointSize = 1886679155;

alias pTextStyles = 1954050932;
alias pTransferMode = 1886418029;
alias pTranslation = 1886679667;
alias pUniformStyles = 1970500716;
alias pUpdateOn = 1886744676;
alias pUserSelection = 1886745452;
alias pVersion = 1986359923;
alias pVisible = 1886808435;

alias typeAEText = 1951684692;
alias typeArc = 1667330659;
alias typeBest = 1650815860;
alias typeCell = 1667458412;
alias typeClassInfo = 1734569065;
alias typeColorTable = 1668051572;
alias typeColumn = 1667460972;
alias typeDashStyle = 1952735603;
alias typeData = 1952740449;
alias typeDrawingArea = 1667527287;
alias typeElemInfo = 1701603694;
alias typeEnumeration = 1701737837;
alias typeEPS = 1162892064;
alias typeEventInfo = 1702259054;

alias typeFinderWindow = 1719101806;
alias typeFixedPoint = 1718644340;
alias typeFixedRectangle = 1718772596;
alias typeGraphicLine = 1735158126;
alias typeGraphicText = 1667724408;
alias typeGroupedGraphic = 1668311395;
alias typeInsertionLoc = 1768846188;
alias typeIntlText = 1769240692;
alias typeIntlWritingCode = 1768846444;
alias typeLongDateTime = 1818522656;
alias typeCFAbsoluteTime = 1667654004;
alias typeISO8601DateTime = 1769172852;
alias typeLongFixed = 1818654820;
alias typeLongFixedPoint = 1818652788;
alias typeLongFixedRectangle = 1818653283;
alias typeLongPoint = 1819307636;
alias typeLongRectangle = 1819435892;
alias typeMachineLoc = 1833725795;
alias typeOval = 1668249196;
alias typeParamInfo = 1886218606;
alias typePict = 1346978644;

alias typePixelMap = 1668311416;
alias typePixMapMinus = 1953525101;
alias typePolygon = 1668310894;
alias typePropInfo = 1885957734;
alias typePtr = 1886679584;
alias typeQDPoint = 1363439732;
alias typeQDRegion = 1366452078;
alias typeRectangle = 1668441443;
alias typeRGB16 = 1953640758;
alias typeRGB96 = 1953642806;
alias typeRGBColor = 1666336578;
alias typeRotation = 1953656692;
alias typeRoundedRectangle = 1668444771;
alias typeRow = 1668444023;
alias typeScrapStyles = 1937013100;
alias typeScript = 1935896692;
alias typeStyledText = 1398036564;
alias typeSuiteInfo = 1937074542;
alias typeTable = 1668571756;
alias typeTextStyles = 1953723513;

alias typeTIFF = 1414088262;
alias typeJPEG = 1246774599;
alias typeGIF = 1195984486;
alias typeVersion = 1986359923;

alias kAEMenuClass = 1835363957;
alias kAEMenuSelect = 1835559284;
alias kAEMouseDown = 1835300718;
alias kAEMouseDownInBack = 1835295339;
alias kAEKeyDown = 1801746286;
alias kAEResized = 1920166266;
alias kAEPromise = 1886547821;

alias keyMenuID = 1835623456;
alias keyMenuItem = 1835627629;
alias keyCloseAllWindows = 1667331872;
alias keyOriginalBounds = 1868721764;
alias keyNewBounds = 1851944548;
alias keyLocalWhere = 1819764850;

alias typeHIMenu = 1836016234;
alias typeHIWindow = 2003788394;

alias kAEQuitReason = 2003335487;

alias kBySmallIcon = 0;
alias kByIconView = 1;
alias kByNameView = 2;
alias kByDateView = 3;
alias kBySizeView = 4;
alias kByKindView = 5;
alias kByCommentView = 6;
alias kByLabelView = 7;
alias kByVersionView = 8;

alias kAEInfo = 11;
alias kAEMain = 0;
alias kAESharing = 13;

alias kAEZoomIn = 7;
alias kAEZoomOut = 8;

alias kTextServiceClass = 1953724003;
alias kUpdateActiveInputArea = 1970300020;
alias kShowHideInputWindow = 1936222583;
alias kPos2Offset = 1882354548;
alias kOffset2Pos = 1936994928;
alias kUnicodeNotFromInputMethod = 1970170221;
alias kGetSelectedText = 1735686260;
alias keyAETSMDocumentRefcon = 1919247971;
alias keyAEServerInstance = 1936881257;
alias keyAETheData = 1801740660;
alias keyAEFixLength = 1718188140;
alias keyAEUpdateRange = 1969516135;
alias keyAECurrentPoint = 1668312947;
alias keyAEBufferSize = 1651861094;
alias keyAEMoveView = 1836480119;
alias keyAENextBody = 1853383268;
alias keyAETSMScriptTag = 1935895655;
alias keyAETSMTextFont = 1802795110;
alias keyAETSMTextFMFont = 1802795117;
alias keyAETSMTextPointSize = 1802793075;
alias keyAETSMEventRecord = 1952806516;
alias keyAETSMEventRef = 1952806514;
alias keyAETextServiceEncoding = 1953719662;
alias keyAETextServiceMacEncoding = 1953326446;
alias keyAETSMGlyphInfoArray = 1952934241;
alias typeTextRange = 1954050670;
alias typeComponentInstance = 1668116585;
alias typeOffsetArray = 1868980601;
alias typeTextRangeArray = 1953653113;
alias typeLowLevelEventRecord = 1702261874;
alias typeGlyphInfoArray = 1735158113;
alias typeEventRef = 1702261350;
alias typeText = 1413830740;

alias kTSMOutsideOfBody = 1;
alias kTSMInsideOfBody = 2;
alias kTSMInsideOfActiveInputArea = 3;

alias kNextBody = 1;
alias kPreviousBody = 2;

record Struct_TextRange (
    fStart : Int,
    fEnd : Int,
    fHiliteStyle : Short,
);

alias TextRange = Struct_TextRange;

alias TextRangePtr = Pointer[TextRange];

alias TextRangeHandle = Pointer[TextRangePtr];

record Struct_TextRangeArray (
    fNumOfRanges : Short,
    fRange : Array[TextRange,1],
);

alias TextRangeArray = Struct_TextRangeArray;

alias TextRangeArrayPtr = Pointer[TextRangeArray];

alias TextRangeArrayHandle = Pointer[TextRangeArrayPtr];

record Struct_OffsetArray (
    fNumOfOffsets : Short,
    fOffset : Array[Int,1],
);

alias OffsetArray = Struct_OffsetArray;

alias OffsetArrayPtr = Pointer[OffsetArray];

alias OffsetArrayHandle = Pointer[OffsetArrayPtr];

record Struct_WritingCode (
    theScriptCode : Short,
    theLangCode : Short,
);

alias WritingCode = Struct_WritingCode;

record Struct_IntlText (
    theScriptCode : Short,
    theLangCode : Short,
    theText : Array[CChar,1],
);

alias IntlText = Struct_IntlText;

alias kTSMHiliteCaretPosition = 1;
alias kTSMHiliteRawText = 2;
alias kTSMHiliteSelectedRawText = 3;
alias kTSMHiliteConvertedText = 4;
alias kTSMHiliteSelectedConvertedText = 5;
alias kTSMHiliteBlockFillText = 6;
alias kTSMHiliteOutlineText = 7;
alias kTSMHiliteSelectedText = 8;
alias kTSMHiliteNoHilite = 9;

alias keyAEHiliteRange = 1752329831;
alias keyAEPinRange = 1886286439;
alias keyAEClauseOffsets = 1668047221;
alias keyAEOffset = 1868985204;
alias keyAEPoint = 1735421811;
alias keyAELeftSide = 1802265958;
alias keyAERegionClass = 1919381091;
alias keyAEDragging = 1651470188;

alias typeMeters = 1835365490;
alias typeInches = 1768842088;
alias typeFeet = 1717921140;
alias typeYards = 2036429412;
alias typeMiles = 1835625573;
alias typeKilometers = 1802335346;
alias typeCentimeters = 1668117618;
alias typeSquareMeters = 1936814701;
alias typeSquareFeet = 1936811636;
alias typeSquareYards = 1936816484;
alias typeSquareMiles = 1936813417;
alias typeSquareKilometers = 1936812909;
alias typeLiters = 1818850418;
alias typeQuarts = 1903326323;
alias typeGallons = 1734437998;
alias typeCubicMeters = 1668113780;
alias typeCubicFeet = 1667655028;
alias typeCubicInches = 1668639086;
alias typeCubicCentimeter = 1667460468;
alias typeCubicYards = 1668903524;
alias typeKilograms = 1801941613;
alias typeGrams = 1735549293;
alias typeOunces = 1870295840;
alias typePounds = 1818391328;
alias typeDegreesC = 1684367203;
alias typeDegreesF = 1684367206;
alias typeDegreesK = 1684367211;

alias kFAServerApp = 1936945782;
alias kDoFolderActionEvent = 1718578273;
alias kFolderActionCode = 1633907822;
alias kFolderOpenedEvent = 1718579310;
alias kFolderClosedEvent = 1717791855;
alias kFolderWindowMovedEvent = 1718839674;
alias kFolderItemsAddedEvent = 1718052212;
alias kFolderItemsRemovedEvent = 1718382451;
alias kItemList = 1718383476;
alias kNewSizeParameter = 1718514554;
alias kFASuiteCode = 1717658479;
alias kFAAttachCommand = 1635018337;
alias kFARemoveCommand = 1919772257;
alias kFAEditCommand = 1701078625;
alias kFAFileParam = 1717657964;
alias kFAIndexParam = 1768842360;

alias kAEInternetSuite = 1735750252;
alias kAEISWebStarSuite = 1465341885;

alias kAEISGetURL = 1735750252;
alias KAEISHandleCGI = 1935961955;

alias cURL = 1970433056;
alias cInternetAddress = 1229996356;
alias cHTML = 1752460652;
alias cFTPItem = 1718906912;

alias kAEISHTTPSearchArgs = 1801875314;
alias kAEISPostArgs = 1886352244;
alias kAEISMethod = 1835365480;
alias kAEISClientAddress = 1633969266;
alias kAEISUserName = 1970496882;
alias kAEISPassword = 1885434739;
alias kAEISFromUser = 1718775157;
alias kAEISServerName = 1937141357;
alias kAEISServerPort = 1937141876;
alias kAEISScriptName = 1935896173;
alias kAEISContentType = 1668577648;
alias kAEISReferrer = 1919247986;
alias kAEISUserAgent = 1097297524;
alias kAEISAction = 1264673652;
alias kAEISActionPath = 1264676980;
alias kAEISClientIP = 1264806256;
alias kAEISFullRequest = 1265005169;

alias pScheme = 1886745443;
alias pHost = 1213158228;
alias pPath = 1179930723;
alias pUserName = 1380021614;
alias pUserPassword = 1380020343;
alias pDNSForm = 1883524691;
alias pURL = 1884639820;
alias pTextEncoding = 1886681189;
alias pFTPKind = 1802071652;

alias eScheme = 1702060904;
alias eurlHTTP = 1752462448;
alias eurlHTTPS = 1752461427;
alias eurlFTP = 1718906912;
alias eurlMail = 1835100524;
alias eurlFile = 1718185061;
alias eurlGopher = 1735420018;
alias eurlTelnet = 1953263220;
alias eurlNews = 1852143475;
alias eurlSNews = 1936619379;
alias eurlNNTP = 1852732528;
alias eurlMessage = 1835365235;
alias eurlMailbox = 1835167608;
alias eurlMulti = 1836412020;
alias eurlLaunch = 1818326382;
alias eurlAFP = 1634103328;
alias eurlAT = 1635000352;
alias eurlEPPC = 1701867619;
alias eurlRTSP = 1920234352;
alias eurlIMAP = 1768776048;
alias eurlNFS = 1970169459;
alias eurlPOP = 1970302832;
alias eurlLDAP = 1970037872;
alias eurlUnknown = 1970433087;

alias kConnSuite = 1835098979;
alias cDevSpec = 1667523958;
alias cAddressSpec = 1667327090;
alias cADBAddress = 1667327074;
alias cAppleTalkAddress = 1667331104;
alias cBusAddress = 1667396979;
alias cEthernetAddress = 1667591712;
alias cFireWireAddress = 1667659552;
alias cIPAddress = 1667854368;
alias cLocalTalkAddress = 1668052000;
alias cSCSIAddress = 1668506483;
alias cTokenRingAddress = 1668575083;
alias cUSBAddress = 1668641634;
alias pDeviceType = 1885632116;
alias pDeviceAddress = 1885632097;
alias pConduit = 1885564782;
alias pProtocol = 1886417524;
alias pATMachine = 1885434989;
alias pATZone = 1885435002;
alias pATType = 1885434996;
alias pDottedDecimal = 1885958244;
alias pDNS = 1885630067;
alias pPort = 1886416754;
alias pNetwork = 1886283124;
alias pNode = 1886285668;
alias pSocket = 1886613347;
alias pSCSIBus = 1886610274;
alias pSCSILUN = 1886612597;
alias eDeviceType = 1701082740;
alias eAddressSpec = 1700881523;
alias eConduit = 1701015406;
alias eProtocol = 1701868143;
alias eADB = 1700881506;
alias eAnalogAudio = 1701863797;
alias eAppleTalk = 1701863796;
alias eAudioLineIn = 1701011817;
alias eAudioLineOut = 1701011820;
alias eAudioOut = 1701011823;
alias eBus = 1700951411;
alias eCDROM = 1701012512;
alias eCommSlot = 1701012333;
alias eDigitalAudio = 1701864545;
alias eDisplay = 1701078131;
alias eDVD = 1701082724;
alias eEthernet = 1701012846;
alias eFireWire = 1701013111;
alias eFloppy = 1701209120;
alias eHD = 1701340192;
alias eInfrared = 1701013874;
alias eIP = 1701865840;
alias eIrDA = 1701865842;
alias eIRTalk = 1701865844;
alias eKeyboard = 1701536356;
alias eLCD = 1701080163;
alias eLocalTalk = 1701014644;
alias eMacIP = 1701866857;
alias eMacVideo = 1701866870;
alias eMicrophone = 1701014889;
alias eModemPort = 1701014896;
alias eModemPrinterPort = 1701671024;
alias eModem = 1701080429;
alias eMonitorOut = 1701014894;
alias eMouse = 1701670773;
alias eNuBusCard = 1701080674;
alias eNuBus = 1701737826;
alias ePCcard = 1701015651;
alias ePCIbus = 1701015657;
alias ePCIcard = 1701081193;
alias ePDSslot = 1701015652;
alias ePDScard = 1701864563;
alias ePointingDevice = 1701081188;
alias ePostScript = 1701867635;
alias ePPP = 1701867632;
alias ePrinterPort = 1701015664;
alias ePrinter = 1701081202;
alias eSvideo = 1701868406;
alias eSCSI = 1701016419;
alias eSerial = 1701868402;
alias eSpeakers = 1701081968;
alias eStorageDevice = 1701081972;
alias eSVGA = 1701868391;
alias eTokenRing = 1702129515;
alias eTrackball = 1702130283;
alias eTrackpad = 1701082224;
alias eUSB = 1701016947;
alias eVideoIn = 1701017193;
alias eVideoMonitor = 1701082733;
alias eVideoOut = 1701017199;

alias cKeystroke = 1802531443;
alias pKeystrokeKey = 1800237927;
alias pModifiers = 1800236900;
alias pKeyKind = 1802202724;
alias eModifiers = 1699570803;
alias eOptionDown = 1265594484;
alias eCommandDown = 1264807268;
alias eControlDown = 1264809068;
alias eShiftDown = 1265854068;
alias eCapsLockDown = 1264807019;
alias eKeyKind = 1701540724;
alias eEscapeKey = 1802712320;
alias eDeleteKey = 1802711808;
alias eTabKey = 1802711040;
alias eReturnKey = 1802707968;
alias eClearKey = 1802716928;
alias eEnterKey = 1802718208;
alias eUpArrowKey = 1802731008;
alias eDownArrowKey = 1802730752;
alias eLeftArrowKey = 1802730240;
alias eRightArrowKey = 1802730496;
alias eHelpKey = 1802727936;
alias eHomeKey = 1802728192;
alias ePageUpKey = 1802728448;
alias ePageDownKey = 1802729728;
alias eForwardDelKey = 1802728704;
alias eEndKey = 1802729216;
alias eF1Key = 1802729984;
alias eF2Key = 1802729472;
alias eF3Key = 1802724096;
alias eF4Key = 1802728960;
alias eF5Key = 1802723328;
alias eF6Key = 1802723584;
alias eF7Key = 1802723840;
alias eF8Key = 1802724352;
alias eF9Key = 1802724608;
alias eF10Key = 1802726656;
alias eF11Key = 1802725120;
alias eF12Key = 1802727168;
alias eF13Key = 1802725632;
alias eF14Key = 1802726144;
alias eF15Key = 1802727680;

alias keyAELaunchedAsLogInItem = 1818716532;
alias keyAELaunchedAsServiceItem = 1937140084;

alias kAEUserTerminology = 1634039156;
alias kAETerminologyExtension = 1634038885;
alias kAEScriptingSizeResource = 1935897466;
alias kAEOSAXSizeResource = 1869834618;

alias kAEUTHasReturningParam = 31;
alias kAEUTOptional = 15;
alias kAEUTlistOfItems = 14;
alias kAEUTEnumerated = 13;
alias kAEUTReadWrite = 12;
alias kAEUTChangesState = 12;
alias kAEUTTightBindingFunction = 12;
alias kAEUTEnumsAreTypes = 11;
alias kAEUTEnumListIsExclusive = 10;
alias kAEUTReplyIsReference = 9;
alias kAEUTDirectParamIsReference = 9;
alias kAEUTParamIsReference = 9;
alias kAEUTPropertyIsReference = 9;
alias kAEUTNotDirectParamIsTarget = 8;
alias kAEUTParamIsTarget = 8;
alias kAEUTApostrophe = 3;
alias kAEUTFeminine = 2;
alias kAEUTMasculine = 1;
alias kAEUTPlural = 0;

record Struct_TScriptingSizeResource (
    scriptingSizeFlags : Short,
    minStackSize : UInt,
    preferredStackSize : UInt,
    maxStackSize : UInt,
    minHeapSize : UInt,
    preferredHeapSize : UInt,
    maxHeapSize : UInt,
);

alias TScriptingSizeResource = Struct_TScriptingSizeResource;

alias kLaunchToGetTerminology = 32768;
alias kDontFindAppBySignature = 16384;
alias kAlwaysSendSubject = 8192;

alias kReadExtensionTermsMask = 32768;

alias kOSIZDontOpenResourceFile = 15;
alias kOSIZdontAcceptRemoteEvents = 14;
alias kOSIZOpenWithReadPermission = 13;
alias kOSIZCodeInSharedLibraries = 11;

alias AEBuildErrorCode = UInt;

alias aeBuildSyntaxNoErr = 0;
alias aeBuildSyntaxBadToken = 1;
alias aeBuildSyntaxBadEOF = 2;
alias aeBuildSyntaxNoEOF = 3;
alias aeBuildSyntaxBadNegative = 4;
alias aeBuildSyntaxMissingQuote = 5;
alias aeBuildSyntaxBadHex = 6;
alias aeBuildSyntaxOddHex = 7;
alias aeBuildSyntaxNoCloseHex = 8;
alias aeBuildSyntaxUncoercedHex = 9;
alias aeBuildSyntaxNoCloseString = 10;
alias aeBuildSyntaxBadDesc = 11;
alias aeBuildSyntaxBadData = 12;
alias aeBuildSyntaxNoCloseParen = 13;
alias aeBuildSyntaxNoCloseBracket = 14;
alias aeBuildSyntaxNoCloseBrace = 15;
alias aeBuildSyntaxNoKey = 16;
alias aeBuildSyntaxNoColon = 17;
alias aeBuildSyntaxCoercedList = 18;
alias aeBuildSyntaxUncoercedDoubleAt = 19;

record Struct_AEBuildError (
    fError : UInt,
    fErrorPos : UInt,
);

alias AEBuildError = Struct_AEBuildError;

external AEBuildDesc(
    dst : Pointer[AEDesc],
    error : Pointer[AEBuildError],
    src : Pointer[CChar],
    ..) : Int;

external vAEBuildDesc(
    dst : Pointer[AEDesc],
    error : Pointer[AEBuildError],
    src : Pointer[CChar],
    args : Pointer[__va_list_tag]) : Int;

external AEBuildParameters(
    event : Pointer[AppleEvent],
    error : Pointer[AEBuildError],
    format : Pointer[CChar],
    ..) : Int;

external vAEBuildParameters(
    event : Pointer[AppleEvent],
    error : Pointer[AEBuildError],
    format : Pointer[CChar],
    args : Pointer[__va_list_tag]) : Int;

external AEBuildAppleEvent(
    theClass : UInt,
    theID : UInt,
    addressType : UInt,
    addressData : RawPointer,
    addressLength : CLong,
    returnID : Short,
    transactionID : Int,
    result : Pointer[AppleEvent],
    error : Pointer[AEBuildError],
    paramsFmt : Pointer[CChar],
    ..) : Int;

external vAEBuildAppleEvent(
    theClass : UInt,
    theID : UInt,
    addressType : UInt,
    addressData : RawPointer,
    addressLength : CLong,
    returnID : Short,
    transactionID : Int,
    resultEvt : Pointer[AppleEvent],
    error : Pointer[AEBuildError],
    paramsFmt : Pointer[CChar],
    args : Pointer[__va_list_tag]) : Int;

external AEPrintDescToHandle(
    desc : Pointer[AEDesc],
    result : Pointer[Handle]) : Int;

alias AEStreamRef = OpaquePointer;

external AEStreamOpen() : AEStreamRef;

external AEStreamClose(
    ref_ : AEStreamRef,
    desc : Pointer[AEDesc]) : Int;

external AEStreamOpenDesc(
    ref_ : AEStreamRef,
    newType : UInt) : Int;

external AEStreamWriteData(
    ref_ : AEStreamRef,
    data : RawPointer,
    length : CLong) : Int;

external AEStreamCloseDesc(
    ref_ : AEStreamRef) : Int;

external AEStreamWriteDesc(
    ref_ : AEStreamRef,
    newType : UInt,
    data : RawPointer,
    length : CLong) : Int;

external AEStreamWriteAEDesc(
    ref_ : AEStreamRef,
    desc : Pointer[AEDesc]) : Int;

external AEStreamOpenList(
    ref_ : AEStreamRef) : Int;

external AEStreamCloseList(
    ref_ : AEStreamRef) : Int;

external AEStreamOpenRecord(
    ref_ : AEStreamRef,
    newType : UInt) : Int;

external AEStreamSetRecordType(
    ref_ : AEStreamRef,
    newType : UInt) : Int;

external AEStreamCloseRecord(
    ref_ : AEStreamRef) : Int;

external AEStreamWriteKeyDesc(
    ref_ : AEStreamRef,
    key : UInt,
    newType : UInt,
    data : RawPointer,
    length : CLong) : Int;

external AEStreamOpenKeyDesc(
    ref_ : AEStreamRef,
    key : UInt,
    newType : UInt) : Int;

external AEStreamWriteKey(
    ref_ : AEStreamRef,
    key : UInt) : Int;

external AEStreamCreateEvent(
    clazz : UInt,
    id : UInt,
    targetType : UInt,
    targetData : RawPointer,
    targetLength : CLong,
    returnID : Short,
    transactionID : Int) : AEStreamRef;

external AEStreamOpenEvent(
    event : Pointer[AppleEvent]) : AEStreamRef;

external AEStreamOptionalParam(
    ref_ : AEStreamRef,
    key : UInt) : Int;

alias keyReplyPortAttr = 1919250544;

alias typeReplyPortAttr = 1919250544;

external AEGetRegisteredMachPort() : UInt;

external AEDecodeMessage(
    header : Pointer[mach_msg_header_t],
    event : Pointer[AppleEvent],
    reply : Pointer[AppleEvent]) : Int;

external AEProcessMessage(
    header : Pointer[mach_msg_header_t]) : Int;

external AESendMessage(
    event : Pointer[AppleEvent],
    reply : Pointer[AppleEvent],
    sendMode : Int,
    timeOutInTicks : CLong) : Int;

alias CSIdentityAuthorityRef = OpaquePointer;

external CSIdentityAuthorityGetTypeID() : CULong;

external CSGetDefaultIdentityAuthority() : CSIdentityAuthorityRef;

external CSGetLocalIdentityAuthority() : CSIdentityAuthorityRef;

external CSGetManagedIdentityAuthority() : CSIdentityAuthorityRef;

external CSIdentityAuthorityCopyLocalizedName(
    authority : CSIdentityAuthorityRef) : CFStringRef;

external kCSIdentityErrorDomain : CFStringRef;

alias kCSIdentityUnknownAuthorityErr = 4294967295;
alias kCSIdentityAuthorityNotAccessibleErr = 4294967294;
alias kCSIdentityPermissionErr = 4294967293;
alias kCSIdentityDeletedErr = 4294967292;
alias kCSIdentityInvalidFullNameErr = 4294967291;
alias kCSIdentityDuplicateFullNameErr = 4294967290;
alias kCSIdentityInvalidPosixNameErr = 4294967289;
alias kCSIdentityDuplicatePosixNameErr = 4294967288;

alias CSIdentityRef = OpaquePointer;

alias CSIdentityQueryRef = OpaquePointer;

external kCSIdentityGeneratePosixName : CFStringRef;

alias kCSIdentityClassUser = 1;
alias kCSIdentityClassGroup = 2;

alias CSIdentityClass = CLong;

alias kCSIdentityFlagNone = 0;
alias kCSIdentityFlagHidden = 1;

alias CSIdentityFlags = CULong;

external CSIdentityGetTypeID() : CULong;

external CSIdentityCreate(
    allocator : CFAllocatorRef,
    identityClass : CLong,
    fullName : CFStringRef,
    posixName : CFStringRef,
    flags : CULong,
    authority : CSIdentityAuthorityRef) : CSIdentityRef;

external CSIdentityCreateCopy(
    allocator : CFAllocatorRef,
    identity : CSIdentityRef) : CSIdentityRef;

external CSIdentityGetClass(
    identity : CSIdentityRef) : CLong;

external CSIdentityGetAuthority(
    identity : CSIdentityRef) : CSIdentityAuthorityRef;

external CSIdentityGetUUID(
    identity : CSIdentityRef) : CFUUIDRef;

external CSIdentityGetFullName(
    identity : CSIdentityRef) : CFStringRef;

external CSIdentityGetPosixID(
    identity : CSIdentityRef) : UInt;

external CSIdentityGetPosixName(
    identity : CSIdentityRef) : CFStringRef;

external CSIdentityGetEmailAddress(
    identity : CSIdentityRef) : CFStringRef;

external CSIdentityGetImageURL(
    identity : CSIdentityRef) : CFURLRef;

external CSIdentityGetImageData(
    identity : CSIdentityRef) : CFDataRef;

external CSIdentityGetImageDataType(
    identity : CSIdentityRef) : CFStringRef;

external CSIdentityGetAliases(
    identity : CSIdentityRef) : CFArrayRef;

external CSIdentityIsMemberOfGroup(
    identity : CSIdentityRef,
    group : CSIdentityRef) : CUChar;

external CSIdentityIsHidden(
    identity : CSIdentityRef) : CUChar;

external CSIdentityCreatePersistentReference(
    allocator : CFAllocatorRef,
    identity : CSIdentityRef) : CFDataRef;

external CSIdentityIsEnabled(
    user : CSIdentityRef) : CUChar;

external CSIdentityAuthenticateUsingPassword(
    user : CSIdentityRef,
    password : CFStringRef) : CUChar;

external CSIdentityGetCertificate(
    user : CSIdentityRef) : SecCertificateRef;

external CSIdentityCreateGroupMembershipQuery(
    allocator : CFAllocatorRef,
    group : CSIdentityRef) : CSIdentityQueryRef;

external CSIdentitySetFullName(
    identity : CSIdentityRef,
    fullName : CFStringRef);

external CSIdentitySetEmailAddress(
    identity : CSIdentityRef,
    emailAddress : CFStringRef);

external CSIdentitySetImageURL(
    identity : CSIdentityRef,
    url : CFURLRef);

external CSIdentitySetImageData(
    identity : CSIdentityRef,
    imageData : CFDataRef,
    imageDataType : CFStringRef);

external CSIdentityAddAlias(
    identity : CSIdentityRef,
    alias_ : CFStringRef);

external CSIdentityRemoveAlias(
    identity : CSIdentityRef,
    alias_ : CFStringRef);

external CSIdentityAddMember(
    group : CSIdentityRef,
    member : CSIdentityRef);

external CSIdentityRemoveMember(
    group : CSIdentityRef,
    member : CSIdentityRef);

external CSIdentitySetIsEnabled(
    user : CSIdentityRef,
    isEnabled : CUChar);

external CSIdentitySetPassword(
    user : CSIdentityRef,
    password : CFStringRef);

external CSIdentitySetCertificate(
    user : CSIdentityRef,
    certificate : SecCertificateRef);

external CSIdentityDelete(
    identity : CSIdentityRef);

external CSIdentityCommit(
    identity : CSIdentityRef,
    authorization : AuthorizationRef,
    error : Pointer[CFErrorRef]) : CUChar;

alias kCSIdentityCommitCompleted = 1;

alias CSIdentityStatusUpdatedCallback = CCodePointer[[OpaquePointer,CLong,OpaquePointer,RawPointer],[]];

record Struct_CSIdentityClientContext (
    version : CLong,
    info : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
    copyDescription : CFAllocatorCopyDescriptionCallBack,
    statusUpdated : CSIdentityStatusUpdatedCallback,
);

alias CSIdentityClientContext = Struct_CSIdentityClientContext;

external CSIdentityCommitAsynchronously(
    identity : CSIdentityRef,
    clientContext : Pointer[CSIdentityClientContext],
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef,
    authorization : AuthorizationRef) : CUChar;

external CSIdentityIsCommitting(
    identity : CSIdentityRef) : CUChar;

external CSIdentityRemoveClient(
    identity : CSIdentityRef);

external CSIdentityQueryGetTypeID() : CULong;

alias kCSIdentityQueryGenerateUpdateEvents = 1;
alias kCSIdentityQueryIncludeHiddenIdentities = 2;

alias CSIdentityQueryFlags = CULong;

alias kCSIdentityQueryStringEquals = 1;
alias kCSIdentityQueryStringBeginsWith = 2;

alias CSIdentityQueryStringComparisonMethod = CLong;

external CSIdentityQueryCreate(
    allocator : CFAllocatorRef,
    identityClass : CLong,
    authority : CSIdentityAuthorityRef) : CSIdentityQueryRef;

external CSIdentityQueryCreateForName(
    allocator : CFAllocatorRef,
    name : CFStringRef,
    comparisonMethod : CLong,
    identityClass : CLong,
    authority : CSIdentityAuthorityRef) : CSIdentityQueryRef;

external CSIdentityQueryCreateForUUID(
    allocator : CFAllocatorRef,
    uuid : CFUUIDRef,
    authority : CSIdentityAuthorityRef) : CSIdentityQueryRef;

external CSIdentityQueryCreateForPosixID(
    allocator : CFAllocatorRef,
    posixID : UInt,
    identityClass : CLong,
    authority : CSIdentityAuthorityRef) : CSIdentityQueryRef;

external CSIdentityQueryCreateForPersistentReference(
    allocator : CFAllocatorRef,
    referenceData : CFDataRef) : CSIdentityQueryRef;

external CSIdentityQueryCreateForCurrentUser(
    allocator : CFAllocatorRef) : CSIdentityQueryRef;

external CSIdentityQueryCopyResults(
    query : CSIdentityQueryRef) : CFArrayRef;

external CSIdentityQueryExecute(
    query : CSIdentityQueryRef,
    flags : CULong,
    error : Pointer[CFErrorRef]) : CUChar;

alias kCSIdentityQueryEventSearchPhaseFinished = 1;
alias kCSIdentityQueryEventResultsAdded = 2;
alias kCSIdentityQueryEventResultsChanged = 3;
alias kCSIdentityQueryEventResultsRemoved = 4;
alias kCSIdentityQueryEventErrorOccurred = 5;

alias CSIdentityQueryEvent = CLong;

alias CSIdentityQueryReceiveEventCallback = CCodePointer[[OpaquePointer,CLong,OpaquePointer,OpaquePointer,RawPointer],[]];

record Struct_CSIdentityQueryClientContext (
    version : CLong,
    info : RawPointer,
    retainInfo : CFAllocatorRetainCallBack,
    releaseInfo : CFAllocatorReleaseCallBack,
    copyInfoDescription : CFAllocatorCopyDescriptionCallBack,
    receiveEvent : CSIdentityQueryReceiveEventCallback,
);

alias CSIdentityQueryClientContext = Struct_CSIdentityQueryClientContext;

external CSIdentityQueryExecuteAsynchronously(
    query : CSIdentityQueryRef,
    flags : CULong,
    clientContext : Pointer[CSIdentityQueryClientContext],
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef) : CUChar;

external CSIdentityQueryStop(
    query : CSIdentityQueryRef);

alias kIconServices16PixelDataARGB = 1768108084;
alias kIconServices32PixelDataARGB = 1768108085;
alias kIconServices48PixelDataARGB = 1768108086;
alias kIconServices128PixelDataARGB = 1768108087;

alias kIconServices256PixelDataARGB = 1768108088;
alias kIconServices512PixelDataARGB = 1768108089;
alias kThumbnail32BitData = 1769222962;
alias kThumbnail8BitMask = 1949855083;

alias kHuge1BitMask = 1768122403;
alias kHuge4BitData = 1768122420;
alias kHuge8BitData = 1768122424;
alias kHuge32BitData = 1768436530;
alias kHuge8BitMask = 1748528491;

alias kLarge1BitMask = 1229147683;
alias kLarge4BitData = 1768123444;
alias kLarge8BitData = 1768123448;
alias kLarge32BitData = 1768698674;
alias kLarge8BitMask = 1815637355;
alias kSmall1BitMask = 1768125219;
alias kSmall4BitData = 1768125236;
alias kSmall8BitData = 1768125240;
alias kSmall32BitData = 1769157426;
alias kSmall8BitMask = 1933077867;
alias kMini1BitMask = 1768123683;
alias kMini4BitData = 1768123700;
alias kMini8BitData = 1768123704;

alias large1BitMask = 1229147683;
alias large4BitData = 1768123444;
alias large8BitData = 1768123448;
alias small1BitMask = 1768125219;
alias small4BitData = 1768125236;
alias small8BitData = 1768125240;
alias mini1BitMask = 1768123683;
alias mini4BitData = 1768123700;
alias mini8BitData = 1768123704;

alias kIconFamilyType = 1768124019;

record Struct_IconFamilyElement (
    elementType : UInt,
    elementSize : Int,
    elementData : Array[CUChar,1],
);

alias IconFamilyElement = Struct_IconFamilyElement;

record Struct_IconFamilyResource (
    resourceType : UInt,
    resourceSize : Int,
    elements : Array[IconFamilyElement,1],
);

alias IconFamilyResource = Struct_IconFamilyResource;

alias IconFamilyPtr = Pointer[IconFamilyResource];

alias IconFamilyHandle = Pointer[IconFamilyPtr];

alias kTileIconVariant = 1953066085;
alias kRolloverIconVariant = 1870030194;
alias kDropIconVariant = 1685221232;
alias kOpenIconVariant = 1869636974;
alias kOpenDropIconVariant = 1868853872;

alias kSystemSoundNoError = 0;
alias kSystemSoundUnspecifiedError = 4294965796;
alias kSystemSoundClientTimedOutError = 4294965795;

alias SystemSoundActionID = UInt;

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

alias SystemSoundCompletionUPP = SystemSoundCompletionProcPtr;

external NewSystemSoundCompletionUPP(
    userRoutine : SystemSoundCompletionProcPtr) : SystemSoundCompletionUPP;

external DisposeSystemSoundCompletionUPP(
    userUPP : SystemSoundCompletionUPP);

external InvokeSystemSoundCompletionUPP(
    actionID : UInt,
    userData : RawPointer,
    userUPP : SystemSoundCompletionUPP) : Int;

external AlertSoundPlay();

external AlertSoundPlayCustomSound(
    inAction : UInt);

external SystemSoundPlay(
    inAction : UInt);

external SystemSoundGetActionID(
    userFile : Pointer[FSRef],
    outAction : Pointer[UInt]) : Int;

external SystemSoundRemoveActionID(
    inAction : UInt) : Int;

external SystemSoundSetCompletionRoutine(
    inAction : UInt,
    inRunLoop : CFRunLoopRef,
    inRunLoopMode : CFStringRef,
    inCompletionRoutine : SystemSoundCompletionUPP,
    inUserData : RawPointer) : Int;

external SystemSoundRemoveCompletionRoutine(
    inAction : UInt);

alias errWSInternalError = 4294901503;
alias errWSTransportError = 4294901502;
alias errWSParseError = 4294901501;
alias errWSTimeoutError = 4294901500;

alias eWSUnknownType = 0;
alias eWSNullType = 1;
alias eWSBooleanType = 2;
alias eWSIntegerType = 3;
alias eWSDoubleType = 4;
alias eWSStringType = 5;
alias eWSDateType = 6;
alias eWSDataType = 7;
alias eWSArrayType = 8;
alias eWSDictionaryType = 9;

alias WSTypeID = Int;

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

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

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

record Struct_WSClientContext (
    version : CLong,
    info : RawPointer,
    retain : WSClientContextRetainCallBackProcPtr,
    release : WSClientContextReleaseCallBackProcPtr,
    copyDescription : WSClientContextCopyDescriptionCallBackProcPtr,
);

alias WSClientContext = Struct_WSClientContext;

external kWSXMLRPCProtocol : CFStringRef;

external kWSSOAP1999Protocol : CFStringRef;

external kWSSOAP2001Protocol : CFStringRef;

external WSGetWSTypeIDFromCFType(
    ref_ : CFTypeRef) : WSTypeID;

external WSGetCFTypeIDFromWSTypeID(
    typeID : WSTypeID) : CULong;

external kWSMethodInvocationResult : CFStringRef;

external kWSFaultString : CFStringRef;

external kWSFaultCode : CFStringRef;

external kWSFaultExtra : CFStringRef;

external kWSNetworkStreamFaultString : CFStringRef;

external kWSStreamErrorMessage : CFStringRef;

external kWSStreamErrorDomain : CFStringRef;

external kWSStreamErrorError : CFStringRef;

external kWSHTTPMessage : CFStringRef;

external kWSHTTPResponseMessage : CFStringRef;

external kWSHTTPVersion : CFStringRef;

external kWSHTTPExtraHeaders : CFStringRef;

external kWSHTTPProxy : CFStringRef;

external kWSHTTPFollowsRedirects : CFStringRef;

external kWSDebugOutgoingHeaders : CFStringRef;

external kWSDebugOutgoingBody : CFStringRef;

external kWSDebugIncomingHeaders : CFStringRef;

external kWSDebugIncomingBody : CFStringRef;

external kWSSOAPMethodNamespaceURI : CFStringRef;

external kWSSOAPBodyEncodingStyle : CFStringRef;

external kWSSOAPStyleDoc : CFStringRef;

external kWSSOAPStyleRPC : CFStringRef;

external kWSSOAPMessageHeaders : CFStringRef;

external kWSRecordParameterOrder : CFStringRef;

external kWSRecordNamespaceURI : CFStringRef;

external kWSRecordType : CFStringRef;

external kWSMethodInvocationResultParameterName : CFStringRef;

external kWSMethodInvocationTimeoutValue : CFStringRef;

alias WSMethodInvocationRef = OpaquePointer;

external WSMethodInvocationGetTypeID() : CULong;

external WSMethodInvocationCreate(
    url : CFURLRef,
    methodName : CFStringRef,
    protocol : CFStringRef) : WSMethodInvocationRef;

external WSMethodInvocationCreateFromSerialization(
    contract : CFDataRef) : WSMethodInvocationRef;

external WSMethodInvocationCopySerialization(
    invocation : WSMethodInvocationRef) : CFDataRef;

external WSMethodInvocationSetParameters(
    invocation : WSMethodInvocationRef,
    parameters : CFDictionaryRef,
    parameterOrder : CFArrayRef);

external WSMethodInvocationCopyParameters(
    invocation : WSMethodInvocationRef,
    parameterOrder : Pointer[CFArrayRef]) : CFDictionaryRef;

external WSMethodInvocationSetProperty(
    invocation : WSMethodInvocationRef,
    propertyName : CFStringRef,
    propertyValue : CFTypeRef);

external WSMethodInvocationCopyProperty(
    invocation : WSMethodInvocationRef,
    propertyName : CFStringRef) : CFTypeRef;

external WSMethodInvocationInvoke(
    invocation : WSMethodInvocationRef) : CFDictionaryRef;

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

external WSMethodInvocationSetCallBack(
    invocation : WSMethodInvocationRef,
    clientCB : WSMethodInvocationCallBackProcPtr,
    context : Pointer[WSClientContext]);

external WSMethodInvocationScheduleWithRunLoop(
    invocation : WSMethodInvocationRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external WSMethodInvocationUnscheduleFromRunLoop(
    invocation : WSMethodInvocationRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external WSMethodResultIsFault(
    methodResult : CFDictionaryRef) : CUChar;

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

external WSMethodInvocationAddSerializationOverride(
    invocation : WSMethodInvocationRef,
    objType : CULong,
    serializationProc : WSMethodInvocationSerializationProcPtr,
    context : Pointer[WSClientContext]);

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

external WSMethodInvocationAddDeserializationOverride(
    invocation : WSMethodInvocationRef,
    typeNamespace : CFStringRef,
    typeName : CFStringRef,
    deserializationProc : WSMethodInvocationDeserializationProcPtr,
    context : Pointer[WSClientContext]);

alias WSProtocolHandlerRef = OpaquePointer;

external WSProtocolHandlerGetTypeID() : CULong;

external WSProtocolHandlerCreate(
    allocator : CFAllocatorRef,
    protocol : CFStringRef) : WSProtocolHandlerRef;

external WSProtocolHandlerCopyRequestDictionary(
    ref_ : WSProtocolHandlerRef,
    data : CFDataRef) : CFDictionaryRef;

external WSProtocolHandlerCopyReplyDictionary(
    ref_ : WSProtocolHandlerRef,
    methodName : CFStringRef,
    data : CFDataRef) : CFDictionaryRef;

external WSProtocolHandlerCopyReplyDocument(
    ref_ : WSProtocolHandlerRef,
    methodContext : CFDictionaryRef,
    resultValue : CFTypeRef) : CFDataRef;

external WSProtocolHandlerCopyFaultDocument(
    ref_ : WSProtocolHandlerRef,
    methodContext : CFDictionaryRef,
    faultDict : CFDictionaryRef) : CFDataRef;

external WSProtocolHandlerCopyRequestDocument(
    ref_ : WSProtocolHandlerRef,
    methodName : CFStringRef,
    methodParams : CFDictionaryRef,
    methodParamOrder : CFArrayRef,
    methodExtras : CFDictionaryRef) : CFDataRef;

external WSProtocolHandlerCopyProperty(
    ref_ : WSProtocolHandlerRef,
    propertyName : CFStringRef) : CFTypeRef;

external WSProtocolHandlerSetProperty(
    ref_ : WSProtocolHandlerRef,
    propertyName : CFStringRef,
    propertyValue : CFTypeRef);

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

external WSProtocolHandlerSetSerializationOverride(
    protocol : WSProtocolHandlerRef,
    objType : CULong,
    serializationProc : WSProtocolHandlerSerializationProcPtr,
    context : Pointer[WSClientContext]);

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

external WSProtocolHandlerSetDeserializationOverride(
    protocol : WSProtocolHandlerRef,
    typeNamespace : CFStringRef,
    typeName : CFStringRef,
    deserializationProc : WSProtocolHandlerDeserializationProcPtr,
    context : Pointer[WSClientContext]);

alias kSleepRequest = 1;
alias kSleepDemand = 2;
alias kSleepWakeUp = 3;
alias kSleepRevoke = 4;
alias kSleepUnlock = 4;
alias kSleepDeny = 5;
alias kSleepNow = 6;
alias kDozeDemand = 7;
alias kDozeWakeUp = 8;
alias kDozeRequest = 9;
alias kEnterStandby = 10;
alias kEnterRun = 11;
alias kSuspendRequest = 12;
alias kSuspendDemand = 13;
alias kSuspendRevoke = 14;
alias kSuspendWakeUp = 15;
alias kGetPowerLevel = 16;
alias kSetPowerLevel = 17;
alias kDeviceInitiatedWake = 18;
alias kWakeToDoze = 19;
alias kDozeToFullWakeUp = 20;
alias kGetPowerInfo = 21;
alias kGetWakeOnNetInfo = 22;
alias kSuspendWakeToDoze = 23;
alias kEnterIdle = 24;
alias kStillIdle = 25;
alias kExitIdle = 26;

alias noCalls = 1;
alias noRequest = 2;
alias slpQType = 16;
alias sleepQType = 16;

alias OverallAct = 0;
alias UsrActivity = 1;
alias NetActivity = 2;
alias HDActivity = 3;
alias IdleActivity = 4;

alias SleepQRec = Struct_SleepQRec;

alias SleepQRecPtr = Pointer[SleepQRec];

alias SleepQProcPtr = CCodePointer[[CLong,Pointer[Struct_SleepQRec]],[CLong]];

alias SleepQUPP = SleepQProcPtr;

external NewSleepQUPP(
    userRoutine : SleepQProcPtr) : SleepQUPP;

external DisposeSleepQUPP(
    userUPP : SleepQUPP);

external InvokeSleepQUPP(
    message : CLong,
    qRecPtr : SleepQRecPtr,
    userUPP : SleepQUPP) : CLong;

record Struct_SleepQRec (
    sleepQLink : SleepQRecPtr,
    sleepQType : Short,
    sleepQProc : SleepQUPP,
    sleepQFlags : Short,
);

external GetCPUSpeed() : CLong;

external SleepQInstall(
    qRecPtr : SleepQRecPtr);

external SleepQRemove(
    qRecPtr : SleepQRecPtr);

external MaximumProcessorSpeed() : Short;

external MinimumProcessorSpeed() : Short;

external CurrentProcessorSpeed() : Short;

external BatteryCount() : Short;

external UpdateSystemActivity(
    activity : CUChar) : Short;

alias RegEntryID = CULong;

alias PowerHandlerProcPtr = CCodePointer[[UInt,RawPointer,UInt,Pointer[CULong]],[Int]];

alias PowerHandlerUPP = PowerHandlerProcPtr;

alias HDQueueElement = Opaque;

alias PMgrQueueElement = Opaque;

alias HDSpindownProcPtr = CCodePointer[[OpaquePointer],[]];

alias PMgrStateChangeProcPtr = CCodePointer[[OpaquePointer,CLong],[]];

alias HDSpindownUPP = HDSpindownProcPtr;

alias PMgrStateChangeUPP = PMgrStateChangeProcPtr;

external NewHDSpindownUPP(
    userRoutine : HDSpindownProcPtr) : HDSpindownUPP;

external NewPMgrStateChangeUPP(
    userRoutine : PMgrStateChangeProcPtr) : PMgrStateChangeUPP;

external DisposeHDSpindownUPP(
    userUPP : HDSpindownUPP);

external DisposePMgrStateChangeUPP(
    userUPP : PMgrStateChangeUPP);

external InvokeHDSpindownUPP(
    theElement : Pointer[HDQueueElement],
    userUPP : HDSpindownUPP);

external InvokePMgrStateChangeUPP(
    theElement : Pointer[PMgrQueueElement],
    stateBits : CLong,
    userUPP : PMgrStateChangeUPP);

alias kNSLMinSystemVersion = 2304;
alias kNSLMinOTVersion = 304;

alias kNSLDefaultListSize = 256;

alias kNSLURLDelimiter = 44;

alias kNSLNoContext = 0;

record Struct_NSLError (
    theErr : Int,
    theContext : UInt,
);

alias NSLError = Struct_NSLError;

alias NSLErrorPtr = Pointer[NSLError];

alias kNSLDuplicateSearchInProgress = 100;
alias kNSLUserCanceled = 4294967168;
alias kNSLInvalidEnumeratorRef = 0;

alias NSLSearchState = UShort;

alias kNSLSearchStateBufferFull = 1;
alias kNSLSearchStateOnGoing = 2;
alias kNSLSearchStateComplete = 3;
alias kNSLSearchStateStalled = 4;
alias kNSLWaitingForContinue = 5;

alias NSLEventCode = UInt;

alias kNSLServicesLookupDataEvent = 6;
alias kNSLNeighborhoodLookupDataEvent = 7;
alias kNSLNewDataEvent = 8;
alias kNSLContinueLookupEvent = 9;

alias NSLClientRef = UInt;

alias NSLRequestRef = UInt;

alias NSLOneBasedIndex = UInt;

alias NSLPath = Pointer[CChar];

alias NSLServiceType = Pointer[CChar];

alias NSLServicesList = Handle;

alias NSLNeighborhood = Pointer[CUChar];

record Struct_NSLClientAsyncInfo (
    clientContextPtr : RawPointer,
    mgrContextPtr : RawPointer,
    resultBuffer : Pointer[CChar],
    bufferLen : CLong,
    maxBufferSize : CLong,
    startTime : UInt,
    intStartTime : UInt,
    maxSearchTime : UInt,
    alertInterval : UInt,
    totalItems : UInt,
    alertThreshold : UInt,
    searchState : UShort,
    searchResult : NSLError,
    searchDataType : UInt,
);

alias NSLClientAsyncInfo = Struct_NSLClientAsyncInfo;

alias NSLClientAsyncInfoPtr = Pointer[NSLClientAsyncInfo];

record Struct_NSLPluginAsyncInfo (
    mgrContextPtr : RawPointer,
    pluginContextPtr : RawPointer,
    pluginPtr : RawPointer,
    resultBuffer : Pointer[CChar],
    bufferLen : CLong,
    maxBufferSize : CLong,
    maxSearchTime : UInt,
    reserved1 : UInt,
    reserved2 : UInt,
    reserved3 : UInt,
    clientRef : UInt,
    requestRef : UInt,
    searchState : UShort,
    searchResult : Int,
);

alias NSLPluginAsyncInfo = Struct_NSLPluginAsyncInfo;

alias NSLPluginAsyncInfoPtr = Pointer[NSLPluginAsyncInfo];

alias NSLMgrNotifyProcPtr = CCodePointer[[Pointer[Struct_NSLPluginAsyncInfo]],[]];

alias NSLClientNotifyProcPtr = CCodePointer[[Pointer[Struct_NSLClientAsyncInfo]],[]];

alias NSLMgrNotifyUPP = NSLMgrNotifyProcPtr;

alias NSLClientNotifyUPP = NSLClientNotifyProcPtr;

external NewNSLMgrNotifyUPP(
    userRoutine : NSLMgrNotifyProcPtr) : NSLMgrNotifyUPP;

external NewNSLClientNotifyUPP(
    userRoutine : NSLClientNotifyProcPtr) : NSLClientNotifyUPP;

external DisposeNSLMgrNotifyUPP(
    userUPP : NSLMgrNotifyUPP);

external DisposeNSLClientNotifyUPP(
    userUPP : NSLClientNotifyUPP);

external InvokeNSLMgrNotifyUPP(
    thePluginAsyncInfo : Pointer[NSLPluginAsyncInfo],
    userUPP : NSLMgrNotifyUPP);

external InvokeNSLClientNotifyUPP(
    theClientAsyncInfo : Pointer[NSLClientAsyncInfo],
    userUPP : NSLClientNotifyUPP);

record Struct_NSLTypedData (
    dataType : CULong,
    lengthOfData : CULong,
);

alias NSLTypedData = Struct_NSLTypedData;

alias NSLTypedDataPtr = Pointer[NSLTypedData];

record Struct_NSLServicesListHeader (
    numServices : CULong,
    logicalLen : CULong,
);

alias NSLServicesListHeader = Struct_NSLServicesListHeader;

alias NSLServicesListHeaderPtr = Pointer[NSLServicesListHeader];

record Struct_NSLPluginData (
    reserved1 : CLong,
    reserved2 : CLong,
    reserved3 : CLong,
    supportsRegistration : CUChar,
    isPurgeable : CUChar,
    totalLen : UShort,
    dataTypeOffset : UShort,
    serviceListOffset : UShort,
    protocolListOffset : UShort,
    commentStringOffset : UShort,
);

alias NSLPluginData = Struct_NSLPluginData;

alias NSLPluginDataPtr = Pointer[NSLPluginData];

alias KCRef = SecKeychainRef;

alias KCItemRef = SecKeychainItemRef;

alias KCSearchRef = SecKeychainSearchRef;

alias KCAttribute = SecKeychainAttribute;

alias KCAttributeList = SecKeychainAttributeList;

alias KCAttrType = UInt;

alias KCStatus = UInt;

alias KCEvent = UShort;

alias kIdleKCEvent = 0;
alias kLockKCEvent = 1;
alias kUnlockKCEvent = 2;
alias kAddKCEvent = 3;
alias kDeleteKCEvent = 4;
alias kUpdateKCEvent = 5;
alias kPasswordChangedKCEvent = 6;
alias kSystemKCEvent = 8;
alias kDefaultChangedKCEvent = 9;
alias kDataAccessKCEvent = 10;
alias kKeychainListChangedKCEvent = 11;

alias KCEventMask = UShort;

alias kIdleKCEventMask = 1;
alias kLockKCEventMask = 2;
alias kUnlockKCEventMask = 4;
alias kAddKCEventMask = 8;
alias kDeleteKCEventMask = 16;
alias kUpdateKCEventMask = 32;
alias kPasswordChangedKCEventMask = 64;
alias kSystemEventKCEventMask = 256;
alias kDefaultChangedKCEventMask = 512;
alias kDataAccessKCEventMask = 1024;
alias kEveryKCEventMask = 65535;

alias AFPServerSignature = Array[CUChar,16];

alias KCPublicKeyHash = Array[CUChar,20];

record Struct_KCCallbackInfo (
    version : UInt,
    item : KCItemRef,
    processID : Array[Int,2],
    event : Array[Int,4],
    keychain : KCRef,
);

alias KCCallbackInfo = Struct_KCCallbackInfo;

alias kUnlockStateKCStatus = 1;
alias kRdPermKCStatus = 2;
alias kWrPermKCStatus = 4;

alias kCertificateKCItemClass = 1667592820;
alias kAppleSharePasswordKCItemClass = 1634953328;
alias kInternetPasswordKCItemClass = 1768842612;
alias kGenericPasswordKCItemClass = 1734700656;

alias KCItemClass = UInt;

alias kClassKCItemAttr = 1668047219;
alias kCreationDateKCItemAttr = 1667522932;
alias kModDateKCItemAttr = 1835295092;
alias kDescriptionKCItemAttr = 1684370275;
alias kCommentKCItemAttr = 1768123764;
alias kCreatorKCItemAttr = 1668445298;
alias kTypeKCItemAttr = 1954115685;
alias kScriptCodeKCItemAttr = 1935897200;
alias kLabelKCItemAttr = 1818321516;
alias kInvisibleKCItemAttr = 1768846953;
alias kNegativeKCItemAttr = 1852139361;
alias kCustomIconKCItemAttr = 1668641641;
alias kAccountKCItemAttr = 1633903476;
alias kServiceKCItemAttr = 1937138533;
alias kGenericKCItemAttr = 1734700641;
alias kSecurityDomainKCItemAttr = 1935961454;
alias kServerKCItemAttr = 1936881266;
alias kAuthTypeKCItemAttr = 1635023216;
alias kPortKCItemAttr = 1886351988;
alias kPathKCItemAttr = 1885434984;
alias kVolumeKCItemAttr = 1986817381;
alias kAddressKCItemAttr = 1633969266;
alias kSignatureKCItemAttr = 1936943463;
alias kProtocolKCItemAttr = 1886675820;
alias kSubjectKCItemAttr = 1937072746;
alias kCommonNameKCItemAttr = 1668161568;
alias kIssuerKCItemAttr = 1769173877;
alias kSerialNumberKCItemAttr = 1936614002;
alias kEMailKCItemAttr = 1835100524;
alias kPublicKeyHashKCItemAttr = 1752198009;
alias kIssuerURLKCItemAttr = 1769304684;
alias kEncryptKCItemAttr = 1701733234;
alias kDecryptKCItemAttr = 1684366194;
alias kSignKCItemAttr = 1936287598;
alias kVerifyKCItemAttr = 1986359913;
alias kWrapKCItemAttr = 2003984752;
alias kUnwrapKCItemAttr = 1970173810;
alias kStartDateKCItemAttr = 1935958388;
alias kEndDateKCItemAttr = 1701077364;

alias KCItemAttr = UInt;

alias kKCAuthTypeNTLM = 1853123693;
alias kKCAuthTypeMSN = 1836281441;
alias kKCAuthTypeDPA = 1685086561;
alias kKCAuthTypeRPA = 1919967585;
alias kKCAuthTypeHTTPDigest = 1752462436;
alias kKCAuthTypeDefault = 1684434036;

alias KCAuthType = UInt;

alias kKCProtocolTypeFTP = 1718906912;
alias kKCProtocolTypeFTPAccount = 1718906977;
alias kKCProtocolTypeHTTP = 1752462448;
alias kKCProtocolTypeIRC = 1769104160;
alias kKCProtocolTypeNNTP = 1852732528;
alias kKCProtocolTypePOP3 = 1886351411;
alias kKCProtocolTypeSMTP = 1936553072;
alias kKCProtocolTypeSOCKS = 1936685088;
alias kKCProtocolTypeIMAP = 1768776048;
alias kKCProtocolTypeLDAP = 1818517872;
alias kKCProtocolTypeAppleTalk = 1635019883;
alias kKCProtocolTypeAFP = 1634103328;
alias kKCProtocolTypeTelnet = 1952803950;

alias KCProtocolType = UInt;

alias KCCertAddOptions = UInt;

alias kSecOptionReserved = 255;
alias kCertUsageShift = 8;
alias kCertUsageSigningAdd = 256;
alias kCertUsageSigningAskAndAdd = 512;
alias kCertUsageVerifyAdd = 1024;
alias kCertUsageVerifyAskAndAdd = 2048;
alias kCertUsageEncryptAdd = 4096;
alias kCertUsageEncryptAskAndAdd = 8192;
alias kCertUsageDecryptAdd = 16384;
alias kCertUsageDecryptAskAndAdd = 32768;
alias kCertUsageKeyExchAdd = 65536;
alias kCertUsageKeyExchAskAndAdd = 131072;
alias kCertUsageRootAdd = 262144;
alias kCertUsageRootAskAndAdd = 524288;
alias kCertUsageSSLAdd = 1048576;
alias kCertUsageSSLAskAndAdd = 2097152;
alias kCertUsageAllAdd = 2147483392;

alias KCVerifyStopOn = UShort;

alias kPolicyKCStopOn = 0;
alias kNoneKCStopOn = 1;
alias kFirstPassKCStopOn = 2;
alias kFirstFailKCStopOn = 3;

alias KCCertSearchOptions = UInt;

alias kCertSearchShift = 0;
alias kCertSearchSigningIgnored = 0;
alias kCertSearchSigningAllowed = 1;
alias kCertSearchSigningDisallowed = 2;
alias kCertSearchSigningMask = 3;
alias kCertSearchVerifyIgnored = 0;
alias kCertSearchVerifyAllowed = 4;
alias kCertSearchVerifyDisallowed = 8;
alias kCertSearchVerifyMask = 12;
alias kCertSearchEncryptIgnored = 0;
alias kCertSearchEncryptAllowed = 16;
alias kCertSearchEncryptDisallowed = 32;
alias kCertSearchEncryptMask = 48;
alias kCertSearchDecryptIgnored = 0;
alias kCertSearchDecryptAllowed = 64;
alias kCertSearchDecryptDisallowed = 128;
alias kCertSearchDecryptMask = 192;
alias kCertSearchWrapIgnored = 0;
alias kCertSearchWrapAllowed = 256;
alias kCertSearchWrapDisallowed = 512;
alias kCertSearchWrapMask = 768;
alias kCertSearchUnwrapIgnored = 0;
alias kCertSearchUnwrapAllowed = 1024;
alias kCertSearchUnwrapDisallowed = 2048;
alias kCertSearchUnwrapMask = 3072;
alias kCertSearchPrivKeyRequired = 4096;
alias kCertSearchAny = 0;

alias kAnyPort = 0;

alias kAnyProtocol = 0;
alias kAnyAuthType = 0;

external KCGetKeychainManagerVersion(
    returnVers : Pointer[UInt]) : Int;

external KCSetInteractionAllowed(
    state : CUChar) : Int;

external KCIsInteractionAllowed() : CUChar;

external KCMakeKCRefFromFSRef(
    keychainFSRef : Pointer[FSRef],
    keychain : Pointer[KCRef]) : Int;

external KCMakeKCRefFromAlias(
    keychainAlias : AliasHandle,
    keychain : Pointer[KCRef]) : Int;

external KCMakeAliasFromKCRef(
    keychain : KCRef,
    keychainAlias : Pointer[AliasHandle]) : Int;

external KCReleaseKeychain(
    keychain : Pointer[KCRef]) : Int;

external KCGetDefaultKeychain(
    keychain : Pointer[KCRef]) : Int;

external KCSetDefaultKeychain(
    keychain : KCRef) : Int;

external KCGetStatus(
    keychain : KCRef,
    keychainStatus : Pointer[UInt]) : Int;

external KCGetKeychain(
    item : KCItemRef,
    keychain : Pointer[KCRef]) : Int;

external KCGetKeychainName(
    keychain : KCRef,
    keychainName : StringPtr) : Int;

external KCCountKeychains() : UShort;

external KCGetIndKeychain(
    index : UShort,
    keychain : Pointer[KCRef]) : Int;

alias KCCallbackProcPtr = CCodePointer[[UShort,Pointer[Struct_KCCallbackInfo],RawPointer],[Int]];

alias KCCallbackUPP = KCCallbackProcPtr;

external NewKCCallbackUPP(
    userRoutine : KCCallbackProcPtr) : KCCallbackUPP;

external DisposeKCCallbackUPP(
    userUPP : KCCallbackUPP);

external InvokeKCCallbackUPP(
    keychainEvent : UShort,
    info : Pointer[KCCallbackInfo],
    userContext : RawPointer,
    userUPP : KCCallbackUPP) : Int;

external KCFindAppleSharePassword(
    serverSignature : Pointer[AFPServerSignature],
    serverAddress : ConstStringPtr,
    serverName : ConstStringPtr,
    volumeName : ConstStringPtr,
    accountName : ConstStringPtr,
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external KCFindInternetPassword(
    serverName : ConstStringPtr,
    securityDomain : ConstStringPtr,
    accountName : ConstStringPtr,
    port : UShort,
    protocol : UInt,
    authType : UInt,
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external KCFindInternetPasswordWithPath(
    serverName : ConstStringPtr,
    securityDomain : ConstStringPtr,
    accountName : ConstStringPtr,
    path : ConstStringPtr,
    port : UShort,
    protocol : UInt,
    authType : UInt,
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external KCFindGenericPassword(
    serviceName : ConstStringPtr,
    accountName : ConstStringPtr,
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external KCAddCallback(
    callbackProc : KCCallbackUPP,
    eventMask : UShort,
    userContext : RawPointer) : Int;

external KCRemoveCallback(
    callbackProc : KCCallbackUPP) : Int;

external KCNewItem(
    itemClass : UInt,
    itemCreator : UInt,
    length : UInt,
    data : RawPointer,
    item : Pointer[KCItemRef]) : Int;

external KCSetAttribute(
    item : KCItemRef,
    attr : Pointer[KCAttribute]) : Int;

external KCGetAttribute(
    item : KCItemRef,
    attr : Pointer[KCAttribute],
    actualLength : Pointer[UInt]) : Int;

external KCSetData(
    item : KCItemRef,
    length : UInt,
    data : RawPointer) : Int;

external KCUpdateItem(
    item : KCItemRef) : Int;

external KCReleaseItem(
    item : Pointer[KCItemRef]) : Int;

external KCCopyItem(
    item : KCItemRef,
    destKeychain : KCRef,
    copy : Pointer[KCItemRef]) : Int;

external KCFindFirstItem(
    keychain : KCRef,
    attrList : Pointer[KCAttributeList],
    search : Pointer[KCSearchRef],
    item : Pointer[KCItemRef]) : Int;

external KCFindNextItem(
    search : KCSearchRef,
    item : Pointer[KCItemRef]) : Int;

external KCReleaseSearch(
    search : Pointer[KCSearchRef]) : Int;

external KCDeleteItem(
    item : KCItemRef) : Int;

external KCGetData(
    item : KCItemRef,
    maxLength : UInt,
    data : RawPointer,
    actualLength : Pointer[UInt]) : Int;

external KCLock(
    keychain : KCRef) : Int;

external kcgetkeychainname(
    keychain : KCRef,
    keychainName : Pointer[CChar]) : Int;

external kcfindapplesharepassword(
    serverSignature : Pointer[AFPServerSignature],
    serverAddress : Pointer[CChar],
    serverName : Pointer[CChar],
    volumeName : Pointer[CChar],
    accountName : Pointer[CChar],
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external kcfindinternetpassword(
    serverName : Pointer[CChar],
    securityDomain : Pointer[CChar],
    accountName : Pointer[CChar],
    port : UShort,
    protocol : UInt,
    authType : UInt,
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external kcfindinternetpasswordwithpath(
    serverName : Pointer[CChar],
    securityDomain : Pointer[CChar],
    accountName : Pointer[CChar],
    path : Pointer[CChar],
    port : UShort,
    protocol : UInt,
    authType : UInt,
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external kcfindgenericpassword(
    serviceName : Pointer[CChar],
    accountName : Pointer[CChar],
    maxLength : UInt,
    passwordData : RawPointer,
    actualLength : Pointer[UInt],
    item : Pointer[KCItemRef]) : Int;

external kCFErrorDomainCFNetwork : CFStringRef;

external kCFErrorDomainWinSock : CFStringRef;

alias kCFHostErrorHostNotFound = 1;
alias kCFHostErrorUnknown = 2;
alias kCFSOCKSErrorUnknownClientVersion = 100;
alias kCFSOCKSErrorUnsupportedServerVersion = 101;
alias kCFSOCKS4ErrorRequestFailed = 110;
alias kCFSOCKS4ErrorIdentdFailed = 111;
alias kCFSOCKS4ErrorIdConflict = 112;
alias kCFSOCKS4ErrorUnknownStatusCode = 113;
alias kCFSOCKS5ErrorBadState = 120;
alias kCFSOCKS5ErrorBadResponseAddr = 121;
alias kCFSOCKS5ErrorBadCredentials = 122;
alias kCFSOCKS5ErrorUnsupportedNegotiationMethod = 123;
alias kCFSOCKS5ErrorNoAcceptableMethod = 124;
alias kCFFTPErrorUnexpectedStatusCode = 200;
alias kCFErrorHTTPAuthenticationTypeUnsupported = 300;
alias kCFErrorHTTPBadCredentials = 301;
alias kCFErrorHTTPConnectionLost = 302;
alias kCFErrorHTTPParseFailure = 303;
alias kCFErrorHTTPRedirectionLoopDetected = 304;
alias kCFErrorHTTPBadURL = 305;
alias kCFErrorHTTPProxyConnectionFailure = 306;
alias kCFErrorHTTPBadProxyCredentials = 307;
alias kCFErrorPACFileError = 308;
alias kCFErrorPACFileAuth = 309;
alias kCFErrorHTTPSProxyConnectionFailure = 310;
alias kCFURLErrorUnknown = 4294966298;
alias kCFURLErrorCancelled = 4294966297;
alias kCFURLErrorBadURL = 4294966296;
alias kCFURLErrorTimedOut = 4294966295;
alias kCFURLErrorUnsupportedURL = 4294966294;
alias kCFURLErrorCannotFindHost = 4294966293;
alias kCFURLErrorCannotConnectToHost = 4294966292;
alias kCFURLErrorNetworkConnectionLost = 4294966291;
alias kCFURLErrorDNSLookupFailed = 4294966290;
alias kCFURLErrorHTTPTooManyRedirects = 4294966289;
alias kCFURLErrorResourceUnavailable = 4294966288;
alias kCFURLErrorNotConnectedToInternet = 4294966287;
alias kCFURLErrorRedirectToNonExistentLocation = 4294966286;
alias kCFURLErrorBadServerResponse = 4294966285;
alias kCFURLErrorUserCancelledAuthentication = 4294966284;
alias kCFURLErrorUserAuthenticationRequired = 4294966283;
alias kCFURLErrorZeroByteResource = 4294966282;
alias kCFURLErrorCannotDecodeRawData = 4294966281;
alias kCFURLErrorCannotDecodeContentData = 4294966280;
alias kCFURLErrorCannotParseResponse = 4294966279;
alias kCFURLErrorInternationalRoamingOff = 4294966278;
alias kCFURLErrorCallIsActive = 4294966277;
alias kCFURLErrorDataNotAllowed = 4294966276;
alias kCFURLErrorRequestBodyStreamExhausted = 4294966275;
alias kCFURLErrorFileDoesNotExist = 4294966196;
alias kCFURLErrorFileIsDirectory = 4294966195;
alias kCFURLErrorNoPermissionsToReadFile = 4294966194;
alias kCFURLErrorDataLengthExceedsMaximum = 4294966193;
alias kCFURLErrorSecureConnectionFailed = 4294966096;
alias kCFURLErrorServerCertificateHasBadDate = 4294966095;
alias kCFURLErrorServerCertificateUntrusted = 4294966094;
alias kCFURLErrorServerCertificateHasUnknownRoot = 4294966093;
alias kCFURLErrorServerCertificateNotYetValid = 4294966092;
alias kCFURLErrorClientCertificateRejected = 4294966091;
alias kCFURLErrorClientCertificateRequired = 4294966090;
alias kCFURLErrorCannotLoadFromNetwork = 4294965296;
alias kCFURLErrorCannotCreateFile = 4294964296;
alias kCFURLErrorCannotOpenFile = 4294964295;
alias kCFURLErrorCannotCloseFile = 4294964294;
alias kCFURLErrorCannotWriteToFile = 4294964293;
alias kCFURLErrorCannotRemoveFile = 4294964292;
alias kCFURLErrorCannotMoveFile = 4294964291;
alias kCFURLErrorDownloadDecodingFailedMidStream = 4294964290;
alias kCFURLErrorDownloadDecodingFailedToComplete = 4294964289;
alias kCFHTTPCookieCannotParseCookieFile = 4294963296;
alias kCFNetServiceErrorUnknown = 4294895296;
alias kCFNetServiceErrorCollision = 4294895295;
alias kCFNetServiceErrorNotFound = 4294895294;
alias kCFNetServiceErrorInProgress = 4294895293;
alias kCFNetServiceErrorBadArgument = 4294895292;
alias kCFNetServiceErrorCancel = 4294895291;
alias kCFNetServiceErrorInvalid = 4294895290;
alias kCFNetServiceErrorTimeout = 4294895289;
alias kCFNetServiceErrorDNSServiceFailure = 4294894296;

alias CFNetworkErrors = Int;

external kCFURLErrorFailingURLErrorKey : CFStringRef;

external kCFURLErrorFailingURLStringErrorKey : CFStringRef;

external kCFGetAddrInfoFailureKey : CFStringRef;

external kCFSOCKSStatusCodeKey : CFStringRef;

external kCFSOCKSVersionKey : CFStringRef;

external kCFSOCKSNegotiationMethodKey : CFStringRef;

external kCFDNSServiceFailureKey : CFStringRef;

external kCFFTPStatusCodeKey : CFStringRef;

alias CFHostRef = OpaquePointer;

external kCFStreamErrorDomainNetDB : Int;

external kCFStreamErrorDomainSystemConfiguration : Int;

alias kCFHostAddresses = 0;
alias kCFHostNames = 1;
alias kCFHostReachability = 2;

alias CFHostInfoType = Int;

record Struct_CFHostClientContext (
    version : CLong,
    info : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
    copyDescription : CFAllocatorCopyDescriptionCallBack,
);

alias CFHostClientContext = Struct_CFHostClientContext;

alias CFHostClientCallBack = CCodePointer[[OpaquePointer,Int,Pointer[UnnamedStruct53],RawPointer],[]];

external CFHostGetTypeID() : CULong;

external CFHostCreateWithName(
    allocator : CFAllocatorRef,
    hostname : CFStringRef) : CFHostRef;

external CFHostCreateWithAddress(
    allocator : CFAllocatorRef,
    addr : CFDataRef) : CFHostRef;

external CFHostCreateCopy(
    alloc : CFAllocatorRef,
    host : CFHostRef) : CFHostRef;

external CFHostStartInfoResolution(
    theHost : CFHostRef,
    info : CFHostInfoType,
    error : Pointer[CFStreamError]) : CUChar;

external CFHostGetAddressing(
    theHost : CFHostRef,
    hasBeenResolved : Pointer[CUChar]) : CFArrayRef;

external CFHostGetNames(
    theHost : CFHostRef,
    hasBeenResolved : Pointer[CUChar]) : CFArrayRef;

external CFHostGetReachability(
    theHost : CFHostRef,
    hasBeenResolved : Pointer[CUChar]) : CFDataRef;

external CFHostCancelInfoResolution(
    theHost : CFHostRef,
    info : CFHostInfoType);

external CFHostSetClient(
    theHost : CFHostRef,
    clientCB : CFHostClientCallBack,
    clientContext : Pointer[CFHostClientContext]) : CUChar;

external CFHostScheduleWithRunLoop(
    theHost : CFHostRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFHostUnscheduleFromRunLoop(
    theHost : CFHostRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

alias CFNetServiceRef = OpaquePointer;

alias CFNetServiceMonitorRef = OpaquePointer;

alias CFNetServiceBrowserRef = OpaquePointer;

external kCFStreamErrorDomainMach : Int;

external kCFStreamErrorDomainNetServices : Int;

alias kCFNetServicesErrorUnknown = 4294895296;
alias kCFNetServicesErrorCollision = 4294895295;
alias kCFNetServicesErrorNotFound = 4294895294;
alias kCFNetServicesErrorInProgress = 4294895293;
alias kCFNetServicesErrorBadArgument = 4294895292;
alias kCFNetServicesErrorCancel = 4294895291;
alias kCFNetServicesErrorInvalid = 4294895290;
alias kCFNetServicesErrorTimeout = 4294895289;

alias CFNetServicesError = Int;

alias kCFNetServiceMonitorTXT = 1;

alias CFNetServiceMonitorType = Int;

alias kCFNetServiceFlagNoAutoRename = 1;

alias kCFNetServiceFlagMoreComing = 1;
alias kCFNetServiceFlagIsDomain = 2;
alias kCFNetServiceFlagIsDefault = 4;
alias kCFNetServiceFlagIsRegistrationDomain = 4;
alias kCFNetServiceFlagRemove = 8;

record Struct_CFNetServiceClientContext (
    version : CLong,
    info : RawPointer,
    retain : CFAllocatorRetainCallBack,
    release : CFAllocatorReleaseCallBack,
    copyDescription : CFAllocatorCopyDescriptionCallBack,
);

alias CFNetServiceClientContext = Struct_CFNetServiceClientContext;

alias CFNetServiceClientCallBack = CCodePointer[[OpaquePointer,Pointer[UnnamedStruct53],RawPointer],[]];

alias CFNetServiceMonitorClientCallBack = CCodePointer[[OpaquePointer,OpaquePointer,Int,OpaquePointer,Pointer[UnnamedStruct53],RawPointer],[]];

alias CFNetServiceBrowserClientCallBack = CCodePointer[[OpaquePointer,CULong,RawPointer,Pointer[UnnamedStruct53],RawPointer],[]];

external CFNetServiceGetTypeID() : CULong;

external CFNetServiceMonitorGetTypeID() : CULong;

external CFNetServiceBrowserGetTypeID() : CULong;

external CFNetServiceCreate(
    alloc : CFAllocatorRef,
    domain : CFStringRef,
    serviceType : CFStringRef,
    name : CFStringRef,
    port : Int) : CFNetServiceRef;

external CFNetServiceCreateCopy(
    alloc : CFAllocatorRef,
    service : CFNetServiceRef) : CFNetServiceRef;

external CFNetServiceGetDomain(
    theService : CFNetServiceRef) : CFStringRef;

external CFNetServiceGetType(
    theService : CFNetServiceRef) : CFStringRef;

external CFNetServiceGetName(
    theService : CFNetServiceRef) : CFStringRef;

external CFNetServiceRegisterWithOptions(
    theService : CFNetServiceRef,
    options : CULong,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceResolveWithTimeout(
    theService : CFNetServiceRef,
    timeout : Double,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceCancel(
    theService : CFNetServiceRef);

external CFNetServiceGetTargetHost(
    theService : CFNetServiceRef) : CFStringRef;

external CFNetServiceGetPortNumber(
    theService : CFNetServiceRef) : Int;

external CFNetServiceGetAddressing(
    theService : CFNetServiceRef) : CFArrayRef;

external CFNetServiceGetTXTData(
    theService : CFNetServiceRef) : CFDataRef;

external CFNetServiceSetTXTData(
    theService : CFNetServiceRef,
    txtRecord : CFDataRef) : CUChar;

external CFNetServiceCreateDictionaryWithTXTData(
    alloc : CFAllocatorRef,
    txtRecord : CFDataRef) : CFDictionaryRef;

external CFNetServiceCreateTXTDataWithDictionary(
    alloc : CFAllocatorRef,
    keyValuePairs : CFDictionaryRef) : CFDataRef;

external CFNetServiceSetClient(
    theService : CFNetServiceRef,
    clientCB : CFNetServiceClientCallBack,
    clientContext : Pointer[CFNetServiceClientContext]) : CUChar;

external CFNetServiceScheduleWithRunLoop(
    theService : CFNetServiceRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFNetServiceUnscheduleFromRunLoop(
    theService : CFNetServiceRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFNetServiceMonitorCreate(
    alloc : CFAllocatorRef,
    theService : CFNetServiceRef,
    clientCB : CFNetServiceMonitorClientCallBack,
    clientContext : Pointer[CFNetServiceClientContext]) : CFNetServiceMonitorRef;

external CFNetServiceMonitorInvalidate(
    monitor : CFNetServiceMonitorRef);

external CFNetServiceMonitorStart(
    monitor : CFNetServiceMonitorRef,
    recordType : CFNetServiceMonitorType,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceMonitorStop(
    monitor : CFNetServiceMonitorRef,
    error : Pointer[CFStreamError]);

external CFNetServiceMonitorScheduleWithRunLoop(
    monitor : CFNetServiceMonitorRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFNetServiceMonitorUnscheduleFromRunLoop(
    monitor : CFNetServiceMonitorRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFNetServiceBrowserCreate(
    alloc : CFAllocatorRef,
    clientCB : CFNetServiceBrowserClientCallBack,
    clientContext : Pointer[CFNetServiceClientContext]) : CFNetServiceBrowserRef;

external CFNetServiceBrowserInvalidate(
    browser : CFNetServiceBrowserRef);

external CFNetServiceBrowserSearchForDomains(
    browser : CFNetServiceBrowserRef,
    registrationDomains : CUChar,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceBrowserSearchForServices(
    browser : CFNetServiceBrowserRef,
    domain : CFStringRef,
    serviceType : CFStringRef,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceBrowserStopSearch(
    browser : CFNetServiceBrowserRef,
    error : Pointer[CFStreamError]);

external CFNetServiceBrowserScheduleWithRunLoop(
    browser : CFNetServiceBrowserRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFNetServiceBrowserUnscheduleFromRunLoop(
    browser : CFNetServiceBrowserRef,
    runLoop : CFRunLoopRef,
    runLoopMode : CFStringRef);

external CFNetServiceRegister(
    theService : CFNetServiceRef,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceResolve(
    theService : CFNetServiceRef,
    error : Pointer[CFStreamError]) : CUChar;

external CFNetServiceGetProtocolSpecificInformation(
    theService : CFNetServiceRef) : CFStringRef;

external CFNetServiceSetProtocolSpecificInformation(
    theService : CFNetServiceRef,
    theInfo : CFStringRef);

external kCFStreamPropertySSLPeerTrust : CFStringRef;

external kCFStreamSSLValidatesCertificateChain : CFStringRef;

external kCFStreamPropertySSLSettings : CFStringRef;

external kCFStreamSSLLevel : CFStringRef;

external kCFStreamSSLPeerName : CFStringRef;

external kCFStreamSSLCertificates : CFStringRef;

external kCFStreamSSLIsServer : CFStringRef;

external kCFStreamPropertySSLPeerCertificates : CFStringRef;

external kCFStreamSSLAllowsExpiredCertificates : CFStringRef;

external kCFStreamSSLAllowsExpiredRoots : CFStringRef;

external kCFStreamSSLAllowsAnyRoot : CFStringRef;

external kCFStreamErrorDomainWinSock : CLong;

external kCFStreamErrorDomainSOCKS : Int;

alias kCFStreamErrorSOCKSSubDomainNone = 0;
alias kCFStreamErrorSOCKSSubDomainVersionCode = 1;
alias kCFStreamErrorSOCKS4SubDomainResponse = 2;
alias kCFStreamErrorSOCKS5SubDomainUserPass = 3;
alias kCFStreamErrorSOCKS5SubDomainMethod = 4;
alias kCFStreamErrorSOCKS5SubDomainResponse = 5;

alias kCFStreamErrorSOCKS5BadResponseAddr = 1;
alias kCFStreamErrorSOCKS5BadState = 2;
alias kCFStreamErrorSOCKSUnknownClientVersion = 3;

alias kCFStreamErrorSOCKS4RequestFailed = 91;
alias kCFStreamErrorSOCKS4IdentdFailed = 92;
alias kCFStreamErrorSOCKS4IdConflict = 93;

alias kSOCKS5NoAcceptableMethod = 255;

external kCFStreamPropertySOCKSProxy : CFStringRef;

external kCFStreamPropertySOCKSProxyHost : CFStringRef;

external kCFStreamPropertySOCKSProxyPort : CFStringRef;

external kCFStreamPropertySOCKSVersion : CFStringRef;

external kCFStreamSocketSOCKSVersion4 : CFStringRef;

external kCFStreamSocketSOCKSVersion5 : CFStringRef;

external kCFStreamPropertySOCKSUser : CFStringRef;

external kCFStreamPropertySOCKSPassword : CFStringRef;

external kCFStreamErrorDomainSSL : Int;

external kCFStreamPropertySocketSecurityLevel : CFStringRef;

external kCFStreamSocketSecurityLevelNone : CFStringRef;

external kCFStreamSocketSecurityLevelSSLv2 : CFStringRef;

external kCFStreamSocketSecurityLevelSSLv3 : CFStringRef;

external kCFStreamSocketSecurityLevelTLSv1 : CFStringRef;

external kCFStreamSocketSecurityLevelNegotiatedSSL : CFStringRef;

external kCFStreamPropertyShouldCloseNativeSocket : CFStringRef;

external kCFStreamPropertySocketRemoteHost : CFStringRef;

external kCFStreamPropertySocketRemoteNetService : CFStringRef;

external CFStreamCreatePairWithSocketToCFHost(
    alloc : CFAllocatorRef,
    host : CFHostRef,
    port : Int,
    readStream : Pointer[CFReadStreamRef],
    writeStream : Pointer[CFWriteStreamRef]);

external CFStreamCreatePairWithSocketToNetService(
    alloc : CFAllocatorRef,
    service : CFNetServiceRef,
    readStream : Pointer[CFReadStreamRef],
    writeStream : Pointer[CFWriteStreamRef]);

alias kCFStreamSocketSecurityNone = 0;
alias kCFStreamSocketSecuritySSLv2 = 1;
alias kCFStreamSocketSecuritySSLv3 = 2;
alias kCFStreamSocketSecuritySSLv23 = 3;
alias kCFStreamSocketSecurityTLSv1 = 4;

alias CFStreamSocketSecurityProtocol = Int;

external CFSocketStreamPairSetSecurityProtocol(
    socketReadStream : CFReadStreamRef,
    socketWriteStream : CFWriteStreamRef,
    securityProtocol : CFStreamSocketSecurityProtocol) : CUChar;

external kCFStreamPropertyProxyLocalBypass : CFStringRef;

external kCFStreamErrorDomainFTP : Int;

external kCFStreamPropertyFTPUserName : CFStringRef;

external kCFStreamPropertyFTPPassword : CFStringRef;

external kCFStreamPropertyFTPUsePassiveMode : CFStringRef;

external kCFStreamPropertyFTPResourceSize : CFStringRef;

external kCFStreamPropertyFTPFetchResourceInfo : CFStringRef;

external kCFStreamPropertyFTPFileTransferOffset : CFStringRef;

external kCFStreamPropertyFTPAttemptPersistentConnection : CFStringRef;

external kCFStreamPropertyFTPProxy : CFStringRef;

external kCFStreamPropertyFTPProxyHost : CFStringRef;

external kCFStreamPropertyFTPProxyPort : CFStringRef;

external kCFStreamPropertyFTPProxyUser : CFStringRef;

external kCFStreamPropertyFTPProxyPassword : CFStringRef;

external kCFFTPResourceMode : CFStringRef;

external kCFFTPResourceName : CFStringRef;

external kCFFTPResourceOwner : CFStringRef;

external kCFFTPResourceGroup : CFStringRef;

external kCFFTPResourceLink : CFStringRef;

external kCFFTPResourceSize : CFStringRef;

external kCFFTPResourceType : CFStringRef;

external kCFFTPResourceModDate : CFStringRef;

external CFReadStreamCreateWithFTPURL(
    alloc : CFAllocatorRef,
    ftpURL : CFURLRef) : CFReadStreamRef;

external CFFTPCreateParsedResourceListing(
    alloc : CFAllocatorRef,
    buffer : Pointer[CUChar],
    bufferLength : CLong,
    parsed : Pointer[CFDictionaryRef]) : CLong;

external CFWriteStreamCreateWithFTPURL(
    alloc : CFAllocatorRef,
    ftpURL : CFURLRef) : CFWriteStreamRef;

external kCFHTTPVersion1_0 : CFStringRef;

external kCFHTTPVersion1_1 : CFStringRef;

external kCFHTTPAuthenticationSchemeBasic : CFStringRef;

external kCFHTTPAuthenticationSchemeDigest : CFStringRef;

external kCFHTTPAuthenticationSchemeNTLM : CFStringRef;

external kCFHTTPAuthenticationSchemeNegotiate : CFStringRef;

alias CFHTTPMessageRef = OpaquePointer;

external CFHTTPMessageGetTypeID() : CULong;

external CFHTTPMessageCreateRequest(
    alloc : CFAllocatorRef,
    requestMethod : CFStringRef,
    url : CFURLRef,
    httpVersion : CFStringRef) : CFHTTPMessageRef;

external CFHTTPMessageCreateResponse(
    alloc : CFAllocatorRef,
    statusCode : CLong,
    statusDescription : CFStringRef,
    httpVersion : CFStringRef) : CFHTTPMessageRef;

external CFHTTPMessageCreateEmpty(
    alloc : CFAllocatorRef,
    isRequest : CUChar) : CFHTTPMessageRef;

external CFHTTPMessageCreateCopy(
    alloc : CFAllocatorRef,
    message : CFHTTPMessageRef) : CFHTTPMessageRef;

external CFHTTPMessageIsRequest(
    message : CFHTTPMessageRef) : CUChar;

external CFHTTPMessageCopyVersion(
    message : CFHTTPMessageRef) : CFStringRef;

external CFHTTPMessageCopyBody(
    message : CFHTTPMessageRef) : CFDataRef;

external CFHTTPMessageSetBody(
    message : CFHTTPMessageRef,
    bodyData : CFDataRef);

external CFHTTPMessageCopyHeaderFieldValue(
    message : CFHTTPMessageRef,
    headerField : CFStringRef) : CFStringRef;

external CFHTTPMessageCopyAllHeaderFields(
    message : CFHTTPMessageRef) : CFDictionaryRef;

external CFHTTPMessageSetHeaderFieldValue(
    message : CFHTTPMessageRef,
    headerField : CFStringRef,
    value : CFStringRef);

external CFHTTPMessageAppendBytes(
    message : CFHTTPMessageRef,
    newBytes : Pointer[CUChar],
    numBytes : CLong) : CUChar;

external CFHTTPMessageIsHeaderComplete(
    message : CFHTTPMessageRef) : CUChar;

external CFHTTPMessageCopySerializedMessage(
    request : CFHTTPMessageRef) : CFDataRef;

external CFHTTPMessageCopyRequestURL(
    request : CFHTTPMessageRef) : CFURLRef;

external CFHTTPMessageCopyRequestMethod(
    request : CFHTTPMessageRef) : CFStringRef;

external CFHTTPMessageAddAuthentication(
    request : CFHTTPMessageRef,
    authenticationFailureResponse : CFHTTPMessageRef,
    username : CFStringRef,
    password : CFStringRef,
    authenticationScheme : CFStringRef,
    forProxy : CUChar) : CUChar;

external CFHTTPMessageGetResponseStatusCode(
    response : CFHTTPMessageRef) : CLong;

external CFHTTPMessageCopyResponseStatusLine(
    response : CFHTTPMessageRef) : CFStringRef;

external kCFStreamErrorDomainHTTP : Int;

alias kCFStreamErrorHTTPParseFailure = 4294967295;
alias kCFStreamErrorHTTPRedirectionLoop = 4294967294;
alias kCFStreamErrorHTTPBadURL = 4294967293;

alias CFStreamErrorHTTP = Int;

external kCFStreamPropertyHTTPResponseHeader : CFStringRef;

external kCFStreamPropertyHTTPFinalURL : CFStringRef;

external kCFStreamPropertyHTTPFinalRequest : CFStringRef;

external kCFStreamPropertyHTTPProxy : CFStringRef;

external kCFStreamPropertyHTTPProxyHost : CFStringRef;

external kCFStreamPropertyHTTPProxyPort : CFStringRef;

external kCFStreamPropertyHTTPSProxyHost : CFStringRef;

external kCFStreamPropertyHTTPSProxyPort : CFStringRef;

external kCFStreamPropertyHTTPShouldAutoredirect : CFStringRef;

external kCFStreamPropertyHTTPAttemptPersistentConnection : CFStringRef;

external kCFStreamPropertyHTTPRequestBytesWrittenCount : CFStringRef;

external CFReadStreamCreateForHTTPRequest(
    alloc : CFAllocatorRef,
    request : CFHTTPMessageRef) : CFReadStreamRef;

external CFReadStreamCreateForStreamedHTTPRequest(
    alloc : CFAllocatorRef,
    requestHeaders : CFHTTPMessageRef,
    requestBody : CFReadStreamRef) : CFReadStreamRef;

external CFHTTPReadStreamSetRedirectsAutomatically(
    httpStream : CFReadStreamRef,
    shouldAutoRedirect : CUChar);

external CFHTTPReadStreamSetProxy(
    httpStream : CFReadStreamRef,
    proxyHost : CFStringRef,
    proxyPort : CLong);

alias CFHTTPAuthenticationRef = OpaquePointer;

alias kCFStreamErrorHTTPAuthenticationTypeUnsupported = 4294966296;
alias kCFStreamErrorHTTPAuthenticationBadUserName = 4294966295;
alias kCFStreamErrorHTTPAuthenticationBadPassword = 4294966294;

alias CFStreamErrorHTTPAuthentication = Int;

external kCFHTTPAuthenticationUsername : CFStringRef;

external kCFHTTPAuthenticationPassword : CFStringRef;

external kCFHTTPAuthenticationAccountDomain : CFStringRef;

external CFHTTPAuthenticationGetTypeID() : CULong;

external CFHTTPAuthenticationCreateFromResponse(
    alloc : CFAllocatorRef,
    response : CFHTTPMessageRef) : CFHTTPAuthenticationRef;

external CFHTTPAuthenticationIsValid(
    auth : CFHTTPAuthenticationRef,
    error : Pointer[CFStreamError]) : CUChar;

external CFHTTPAuthenticationAppliesToRequest(
    auth : CFHTTPAuthenticationRef,
    request : CFHTTPMessageRef) : CUChar;

external CFHTTPAuthenticationRequiresOrderedRequests(
    auth : CFHTTPAuthenticationRef) : CUChar;

external CFHTTPMessageApplyCredentials(
    request : CFHTTPMessageRef,
    auth : CFHTTPAuthenticationRef,
    username : CFStringRef,
    password : CFStringRef,
    error : Pointer[CFStreamError]) : CUChar;

external CFHTTPMessageApplyCredentialDictionary(
    request : CFHTTPMessageRef,
    auth : CFHTTPAuthenticationRef,
    dict : CFDictionaryRef,
    error : Pointer[CFStreamError]) : CUChar;

external CFHTTPAuthenticationCopyRealm(
    auth : CFHTTPAuthenticationRef) : CFStringRef;

external CFHTTPAuthenticationCopyDomains(
    auth : CFHTTPAuthenticationRef) : CFArrayRef;

external CFHTTPAuthenticationCopyMethod(
    auth : CFHTTPAuthenticationRef) : CFStringRef;

external CFHTTPAuthenticationRequiresUserNameAndPassword(
    auth : CFHTTPAuthenticationRef) : CUChar;

external CFHTTPAuthenticationRequiresAccountDomain(
    auth : CFHTTPAuthenticationRef) : CUChar;

alias CFNetDiagnosticRef = OpaquePointer;

alias kCFNetDiagnosticNoErr = 0;
alias kCFNetDiagnosticErr = 4294900736;
alias kCFNetDiagnosticConnectionUp = 4294900737;
alias kCFNetDiagnosticConnectionIndeterminate = 4294900738;
alias kCFNetDiagnosticConnectionDown = 4294900739;

alias CFNetDiagnosticStatusValues = Int;

alias CFNetDiagnosticStatus = CLong;

external CFNetDiagnosticCreateWithStreams(
    alloc : CFAllocatorRef,
    readStream : CFReadStreamRef,
    writeStream : CFWriteStreamRef) : CFNetDiagnosticRef;

external CFNetDiagnosticCreateWithURL(
    alloc : CFAllocatorRef,
    url : CFURLRef) : CFNetDiagnosticRef;

external CFNetDiagnosticSetName(
    details : CFNetDiagnosticRef,
    name : CFStringRef);

external CFNetDiagnosticDiagnoseProblemInteractively(
    details : CFNetDiagnosticRef) : CLong;

external CFNetDiagnosticCopyNetworkStatusPassively(
    details : CFNetDiagnosticRef,
    description : Pointer[CFStringRef]) : CLong;

external CFNetworkCopySystemProxySettings() : CFDictionaryRef;

external CFNetworkCopyProxiesForURL(
    url : CFURLRef,
    proxySettings : CFDictionaryRef) : CFArrayRef;

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

external CFNetworkCopyProxiesForAutoConfigurationScript(
    proxyAutoConfigurationScript : CFStringRef,
    targetURL : CFURLRef,
    error : Pointer[CFErrorRef]) : CFArrayRef;

external CFNetworkExecuteProxyAutoConfigurationScript(
    proxyAutoConfigurationScript : CFStringRef,
    targetURL : CFURLRef,
    cb : CFProxyAutoConfigurationResultCallback,
    clientContext : Pointer[CFStreamClientContext]) : CFRunLoopSourceRef;

external CFNetworkExecuteProxyAutoConfigurationURL(
    proxyAutoConfigURL : CFURLRef,
    targetURL : CFURLRef,
    cb : CFProxyAutoConfigurationResultCallback,
    clientContext : Pointer[CFStreamClientContext]) : CFRunLoopSourceRef;

external kCFProxyTypeKey : CFStringRef;

external kCFProxyHostNameKey : CFStringRef;

external kCFProxyPortNumberKey : CFStringRef;

external kCFProxyAutoConfigurationURLKey : CFStringRef;

external kCFProxyUsernameKey : CFStringRef;

external kCFProxyPasswordKey : CFStringRef;

external kCFProxyTypeNone : CFStringRef;

external kCFProxyTypeHTTP : CFStringRef;

external kCFProxyTypeHTTPS : CFStringRef;

external kCFProxyTypeSOCKS : CFStringRef;

external kCFProxyTypeFTP : CFStringRef;

external kCFProxyTypeAutoConfigurationURL : CFStringRef;

external kCFProxyAutoConfigurationHTTPResponseKey : CFStringRef;

external kCFNetworkProxiesExceptionsList : CFStringRef;

external kCFNetworkProxiesExcludeSimpleHostnames : CFStringRef;

external kCFNetworkProxiesFTPEnable : CFStringRef;

external kCFNetworkProxiesFTPPassive : CFStringRef;

external kCFNetworkProxiesFTPPort : CFStringRef;

external kCFNetworkProxiesFTPProxy : CFStringRef;

external kCFNetworkProxiesGopherEnable : CFStringRef;

external kCFNetworkProxiesGopherPort : CFStringRef;

external kCFNetworkProxiesGopherProxy : CFStringRef;

external kCFNetworkProxiesHTTPEnable : CFStringRef;

external kCFNetworkProxiesHTTPPort : CFStringRef;

external kCFNetworkProxiesHTTPProxy : CFStringRef;

external kCFNetworkProxiesHTTPSEnable : CFStringRef;

external kCFNetworkProxiesHTTPSPort : CFStringRef;

external kCFNetworkProxiesHTTPSProxy : CFStringRef;

external kCFNetworkProxiesRTSPEnable : CFStringRef;

external kCFNetworkProxiesRTSPPort : CFStringRef;

external kCFNetworkProxiesRTSPProxy : CFStringRef;

external kCFNetworkProxiesSOCKSEnable : CFStringRef;

external kCFNetworkProxiesSOCKSPort : CFStringRef;

external kCFNetworkProxiesSOCKSProxy : CFStringRef;

external kCFNetworkProxiesProxyAutoConfigEnable : CFStringRef;

external kCFNetworkProxiesProxyAutoConfigURLString : CFStringRef;

external kCFNetworkProxiesProxyAutoDiscoveryEnable : CFStringRef;

alias kGenericDocumentIconResource = 4294963296;
alias kGenericStationeryIconResource = 4294963311;
alias kGenericEditionFileIconResource = 4294963307;
alias kGenericApplicationIconResource = 4294963300;
alias kGenericDeskAccessoryIconResource = 4294963305;
alias kGenericFolderIconResource = 4294963297;
alias kPrivateFolderIconResource = 4294963302;
alias kFloppyIconResource = 4294963298;
alias kTrashIconResource = 4294963303;
alias kGenericRAMDiskIconResource = 4294963308;
alias kGenericCDROMIconResource = 4294963309;

alias kDesktopIconResource = 4294963304;
alias kOpenFolderIconResource = 4294963299;
alias kGenericHardDiskIconResource = 4294963301;
alias kGenericFileServerIconResource = 4294963324;
alias kGenericSuitcaseIconResource = 4294963326;
alias kGenericMoverObjectIconResource = 4294963327;

alias kGenericPreferencesIconResource = 4294963325;
alias kGenericQueryDocumentIconResource = 4294950790;
alias kGenericExtensionIconResource = 4294950881;
alias kSystemFolderIconResource = 4294963313;
alias kHelpIconResource = 4294947025;
alias kAppleMenuFolderIconResource = 4294963314;

alias genericDocumentIconResource = 4294963296;
alias genericStationeryIconResource = 4294963311;
alias genericEditionFileIconResource = 4294963307;
alias genericApplicationIconResource = 4294963300;
alias genericDeskAccessoryIconResource = 4294963305;
alias genericFolderIconResource = 4294963297;
alias privateFolderIconResource = 4294963302;
alias floppyIconResource = 4294963298;
alias trashIconResource = 4294963303;
alias genericRAMDiskIconResource = 4294963308;
alias genericCDROMIconResource = 4294963309;
alias desktopIconResource = 4294963304;
alias openFolderIconResource = 4294963299;
alias genericHardDiskIconResource = 4294963301;
alias genericFileServerIconResource = 4294963324;
alias genericSuitcaseIconResource = 4294963326;
alias genericMoverObjectIconResource = 4294963327;
alias genericPreferencesIconResource = 4294963325;
alias genericQueryDocumentIconResource = 4294950790;
alias genericExtensionIconResource = 4294950881;
alias systemFolderIconResource = 4294963313;
alias appleMenuFolderIconResource = 4294963314;

alias kStartupFolderIconResource = 4294963315;
alias kOwnedFolderIconResource = 4294963316;
alias kDropFolderIconResource = 4294963317;
alias kSharedFolderIconResource = 4294963318;
alias kMountedFolderIconResource = 4294963319;
alias kControlPanelFolderIconResource = 4294963320;
alias kPrintMonitorFolderIconResource = 4294963321;
alias kPreferencesFolderIconResource = 4294963322;
alias kExtensionsFolderIconResource = 4294963323;
alias kFontsFolderIconResource = 4294963328;
alias kFullTrashIconResource = 4294963312;

alias startupFolderIconResource = 4294963315;
alias ownedFolderIconResource = 4294963316;
alias dropFolderIconResource = 4294963317;
alias sharedFolderIconResource = 4294963318;
alias mountedFolderIconResource = 4294963319;
alias controlPanelFolderIconResource = 4294963320;
alias printMonitorFolderIconResource = 4294963321;
alias preferencesFolderIconResource = 4294963322;
alias extensionsFolderIconResource = 4294963323;
alias fontsFolderIconResource = 4294963328;
alias fullTrashIconResource = 4294963312;

alias IconRef = OpaquePointer;

alias kSystemIconsCreator = 1835098995;

alias kClipboardIcon = 1129072976;
alias kClippingUnknownTypeIcon = 1668051061;
alias kClippingPictureTypeIcon = 1668051056;
alias kClippingTextTypeIcon = 1668051060;
alias kClippingSoundTypeIcon = 1668051059;
alias kDesktopIcon = 1684370283;
alias kFinderIcon = 1179534418;
alias kComputerIcon = 1919905652;
alias kFontSuitcaseIcon = 1179011404;
alias kFullTrashIcon = 1718907496;
alias kGenericApplicationIcon = 1095782476;
alias kGenericCDROMIcon = 1667523698;
alias kGenericControlPanelIcon = 1095782467;
alias kGenericControlStripModuleIcon = 1935959414;
alias kGenericComponentIcon = 1953001063;
alias kGenericDeskAccessoryIcon = 1095782468;
alias kGenericDocumentIcon = 1685021557;
alias kGenericEditionFileIcon = 1701082214;
alias kGenericExtensionIcon = 1229867348;
alias kGenericFileServerIcon = 1936881266;
alias kGenericFontIcon = 1717987692;
alias kGenericFontScalerIcon = 1935895666;
alias kGenericFloppyIcon = 1718382713;
alias kGenericHardDiskIcon = 1751413611;
alias kGenericIDiskIcon = 1768190827;
alias kGenericRemovableMediaIcon = 1919774582;
alias kGenericMoverObjectIcon = 1836021362;
alias kGenericPCCardIcon = 1885564259;
alias kGenericPreferencesIcon = 1886545254;
alias kGenericQueryDocumentIcon = 1902473849;
alias kGenericRAMDiskIcon = 1918987620;
alias kGenericSharedLibaryIcon = 1936223330;
alias kGenericStationeryIcon = 1935961955;
alias kGenericSuitcaseIcon = 1937074548;
alias kGenericURLIcon = 1735750252;
alias kGenericWORMIcon = 2003792493;
alias kInternationalResourcesIcon = 1768319340;
alias kKeyboardLayoutIcon = 1801873772;
alias kSoundFileIcon = 1936091500;
alias kSystemSuitcaseIcon = 2054388083;
alias kTrashIcon = 1953657704;
alias kTrueTypeFontIcon = 1952868716;
alias kTrueTypeFlatFontIcon = 1936092788;
alias kTrueTypeMultiFlatFontIcon = 1953784678;
alias kUserIDiskIcon = 1969517419;
alias kUnknownFSObjectIcon = 1970169459;
alias kInternationResourcesIcon = 1768319340;

alias kInternetLocationHTTPIcon = 1768712308;
alias kInternetLocationFTPIcon = 1768711796;
alias kInternetLocationAppleShareIcon = 1768710502;
alias kInternetLocationAppleTalkZoneIcon = 1768710516;
alias kInternetLocationFileIcon = 1768711785;
alias kInternetLocationMailIcon = 1768713569;
alias kInternetLocationNewsIcon = 1768713847;
alias kInternetLocationNSLNeighborhoodIcon = 1768713843;
alias kInternetLocationGenericIcon = 1768712037;

alias kGenericFolderIcon = 1718379634;
alias kDropFolderIcon = 1684172664;
alias kMountedFolderIcon = 1835955300;
alias kOpenFolderIcon = 1868983396;
alias kOwnedFolderIcon = 1870098020;
alias kPrivateFolderIcon = 1886549606;
alias kSharedFolderIcon = 1936221804;

alias kSharingPrivsNotApplicableIcon = 1936223841;
alias kSharingPrivsReadOnlyIcon = 1936224879;
alias kSharingPrivsReadWriteIcon = 1936224887;
alias kSharingPrivsUnknownIcon = 1936225643;
alias kSharingPrivsWritableIcon = 2003986804;

alias kUserFolderIcon = 1969646692;
alias kWorkgroupFolderIcon = 2003201124;
alias kGuestUserIcon = 1735750514;
alias kUserIcon = 1970496882;
alias kOwnerIcon = 1937077106;
alias kGroupIcon = 1735554416;

alias kAppearanceFolderIcon = 1634758770;
alias kAppleExtrasFolderIcon = 1634040004;
alias kAppleMenuFolderIcon = 1634561653;
alias kApplicationsFolderIcon = 1634758771;
alias kApplicationSupportFolderIcon = 1634956656;
alias kAssistantsFolderIcon = 1634956484;
alias kColorSyncFolderIcon = 1886547814;
alias kContextualMenuItemsFolderIcon = 1668116085;
alias kControlPanelDisabledFolderIcon = 1668575812;
alias kControlPanelFolderIcon = 1668575852;
alias kControlStripModulesFolderIcon = 1935963844;
alias kDocumentsFolderIcon = 1685021555;
alias kExtensionsDisabledFolderIcon = 1702392900;
alias kExtensionsFolderIcon = 1702392942;
alias kFavoritesFolderIcon = 1717663347;
alias kFontsFolderIcon = 1718578804;
alias kHelpFolderIcon = 3295177840;
alias kInternetFolderIcon = 1768846532;
alias kInternetPlugInFolderIcon = 3295569268;
alias kInternetSearchSitesFolderIcon = 1769173862;
alias kLocalesFolderIcon = 3295440739;
alias kMacOSReadMeFolderIcon = 1836020420;
alias kPublicFolderIcon = 1886741094;
alias kPreferencesFolderIcon = 1886545604;
alias kPrinterDescriptionFolderIcon = 1886413926;
alias kPrinterDriverFolderIcon = 3295703652;
alias kPrintMonitorFolderIcon = 1886547572;
alias kRecentApplicationsFolderIcon = 1918988400;
alias kRecentDocumentsFolderIcon = 1919184739;
alias kRecentServersFolderIcon = 1920168566;
alias kScriptingAdditionsFolderIcon = 3295896434;
alias kSharedLibrariesFolderIcon = 3295439202;
alias kScriptsFolderIcon = 1935897284;
alias kShutdownItemsDisabledFolderIcon = 1936221252;
alias kShutdownItemsFolderIcon = 1936221286;
alias kSpeakableItemsFolder = 1936747369;
alias kStartupItemsDisabledFolderIcon = 1937011268;
alias kStartupItemsFolderIcon = 1937011316;
alias kSystemExtensionDisabledFolderIcon = 1835098948;
alias kSystemFolderIcon = 1835098995;
alias kTextEncodingsFolderIcon = 3295962488;
alias kUsersFolderIcon = 1970500292;
alias kUtilitiesFolderIcon = 1970563524;
alias kVoicesFolderIcon = 1719037795;

alias kAppleScriptBadgeIcon = 1935897200;
alias kLockedBadgeIcon = 1818387559;
alias kMountedBadgeIcon = 1835164775;
alias kSharedBadgeIcon = 1935828071;
alias kAliasBadgeIcon = 1633838183;
alias kAlertCautionBadgeIcon = 1667392615;

alias kAlertNoteIcon = 1852798053;
alias kAlertCautionIcon = 1667331444;
alias kAlertStopIcon = 1937010544;

alias kAppleTalkIcon = 1635019883;
alias kAppleTalkZoneIcon = 1635023470;
alias kAFPServerIcon = 1634103411;
alias kFTPServerIcon = 1718906995;
alias kHTTPServerIcon = 1752461427;
alias kGenericNetworkIcon = 1735288180;
alias kIPFileServerIcon = 1769173622;

alias kToolbarCustomizeIcon = 1952675187;
alias kToolbarDeleteIcon = 1952736620;
alias kToolbarFavoritesIcon = 1952866678;
alias kToolbarHomeIcon = 1953001325;
alias kToolbarAdvancedIcon = 1952604534;
alias kToolbarInfoIcon = 1952606574;
alias kToolbarLabelsIcon = 1952607330;
alias kToolbarApplicationsFolderIcon = 1950445683;
alias kToolbarDocumentsFolderIcon = 1950642019;
alias kToolbarMovieFolderIcon = 1951231862;
alias kToolbarMusicFolderIcon = 1951233395;
alias kToolbarPicturesFolderIcon = 1951426915;
alias kToolbarPublicFolderIcon = 1951429986;
alias kToolbarDesktopFolderIcon = 1950643051;
alias kToolbarDownloadsFolderIcon = 1950644078;
alias kToolbarLibraryFolderIcon = 1951164770;
alias kToolbarUtilitiesFolderIcon = 1951757420;
alias kToolbarSitesFolderIcon = 1951626355;

alias kAppleLogoIcon = 1667330156;
alias kAppleMenuIcon = 1935765612;
alias kBackwardArrowIcon = 1650553455;
alias kFavoriteItemsIcon = 1717663346;
alias kForwardArrowIcon = 1717662319;
alias kGridIcon = 1735551332;
alias kHelpIcon = 1751477360;
alias kKeepArrangedIcon = 1634889319;
alias kLockedIcon = 1819239275;
alias kNoFilesIcon = 1852205420;
alias kNoFolderIcon = 1852206180;
alias kNoWriteIcon = 1853321844;
alias kProtectedApplicationFolderIcon = 1885433968;
alias kProtectedSystemFolderIcon = 1886615923;
alias kRecentItemsIcon = 1919118964;
alias kShortcutIcon = 1936224884;
alias kSortAscendingIcon = 1634954852;
alias kSortDescendingIcon = 1685286500;
alias kUnlockedIcon = 1970037611;
alias kConnectToIcon = 1668178804;
alias kGenericWindowIcon = 1735879022;
alias kQuestionMarkIcon = 1903519091;
alias kDeleteAliasIcon = 1684106345;
alias kEjectMediaIcon = 1701471587;
alias kBurningIcon = 1651864174;
alias kRightContainerArrowIcon = 1919115634;

alias IconServicesUsageFlags = UInt;

alias kIconServicesNormalUsageFlag = 0;
alias kIconServicesNoBadgeFlag = 1;
alias kIconServicesUpdateIfNeededFlag = 2;

alias kIconServicesCatalogInfoMask = 531550;

external GetIconRefOwners(
    theIconRef : IconRef,
    owners : Pointer[UShort]) : Short;

external AcquireIconRef(
    theIconRef : IconRef) : Short;

external ReleaseIconRef(
    theIconRef : IconRef) : Short;

external GetIconRef(
    vRefNum : Short,
    creator : UInt,
    iconType : UInt,
    theIconRef : Pointer[IconRef]) : Short;

external GetIconRefFromFolder(
    vRefNum : Short,
    parentFolderID : Int,
    folderID : Int,
    attributes : CChar,
    accessPrivileges : CChar,
    theIconRef : Pointer[IconRef]) : Short;

external GetIconRefFromFileInfo(
    inRef : Pointer[FSRef],
    inFileNameLength : CULong,
    inFileName : Pointer[UShort],
    inWhichInfo : UInt,
    inCatalogInfo : Pointer[FSCatalogInfo],
    inUsageFlags : UInt,
    outIconRef : Pointer[IconRef],
    outLabel : Pointer[Short]) : Int;

external GetIconRefFromTypeInfo(
    inCreator : UInt,
    inType : UInt,
    inExtension : CFStringRef,
    inMIMEType : CFStringRef,
    inUsageFlags : UInt,
    outIconRef : Pointer[IconRef]) : Short;

external GetIconRefFromIconFamilyPtr(
    inIconFamilyPtr : Pointer[IconFamilyResource],
    inSize : CLong,
    outIconRef : Pointer[IconRef]) : Int;

external GetIconRefFromComponent(
    inComponent : Component,
    outIconRef : Pointer[IconRef]) : Int;

external RegisterIconRefFromIconFamily(
    creator : UInt,
    iconType : UInt,
    iconFamily : IconFamilyHandle,
    theIconRef : Pointer[IconRef]) : Short;

external RegisterIconRefFromFSRef(
    creator : UInt,
    iconType : UInt,
    iconFile : Pointer[FSRef],
    theIconRef : Pointer[IconRef]) : Int;

external UnregisterIconRef(
    creator : UInt,
    iconType : UInt) : Short;

external UpdateIconRef(
    theIconRef : IconRef) : Short;

external OverrideIconRef(
    oldIconRef : IconRef,
    newIconRef : IconRef) : Short;

external RemoveIconRefOverride(
    theIconRef : IconRef) : Short;

external CompositeIconRef(
    backgroundIconRef : IconRef,
    foregroundIconRef : IconRef,
    compositeIconRef : Pointer[IconRef]) : Short;

external IsIconRefComposite(
    compositeIconRef : IconRef,
    backgroundIconRef : Pointer[IconRef],
    foregroundIconRef : Pointer[IconRef]) : Short;

external IsValidIconRef(
    theIconRef : IconRef) : CUChar;

external IsDataAvailableInIconRef(
    inIconKind : UInt,
    inIconRef : IconRef) : CUChar;

external SetCustomIconsEnabled(
    vRefNum : Short,
    enableCustomIcons : CUChar) : Short;

external GetCustomIconsEnabled(
    vRefNum : Short,
    customIconsEnabled : Pointer[CUChar]) : Short;

external ReadIconFromFSRef(
    ref_ : Pointer[FSRef],
    iconFamily : Pointer[IconFamilyHandle]) : Int;

alias kLSAppInTrashErr = 4294956636;
alias kLSExecutableIncorrectFormat = 4294956635;
alias kLSAttributeNotFoundErr = 4294956634;
alias kLSAttributeNotSettableErr = 4294956633;
alias kLSIncompatibleApplicationVersionErr = 4294956632;
alias kLSNoRosettaEnvironmentErr = 4294956631;
alias kLSUnknownErr = 4294956486;
alias kLSNotAnApplicationErr = 4294956485;
alias kLSNotInitializedErr = 4294956484;
alias kLSDataUnavailableErr = 4294956483;
alias kLSApplicationNotFoundErr = 4294956482;
alias kLSUnknownTypeErr = 4294956481;
alias kLSDataTooOldErr = 4294956480;
alias kLSDataErr = 4294956479;
alias kLSLaunchInProgressErr = 4294956478;
alias kLSNotRegisteredErr = 4294956477;
alias kLSAppDoesNotClaimTypeErr = 4294956476;
alias kLSAppDoesNotSupportSchemeWarning = 4294956475;
alias kLSServerCommunicationErr = 4294956474;
alias kLSCannotSetInfoErr = 4294956473;
alias kLSNoRegistrationInfoErr = 4294956472;
alias kLSIncompatibleSystemVersionErr = 4294956471;
alias kLSNoLaunchPermissionErr = 4294956470;
alias kLSNoExecutableErr = 4294956469;
alias kLSNoClassicEnvironmentErr = 4294956468;
alias kLSMultipleSessionsNotSupportedErr = 4294956467;

alias LSInitializeFlags = UInt;

alias kLSInitializeDefaults = 1;

alias kLSMinCatInfoBitmap = 6154;

alias LSRequestedInfo = UInt;

alias kLSRequestExtension = 1;
alias kLSRequestTypeCreator = 2;
alias kLSRequestBasicFlagsOnly = 4;
alias kLSRequestAppTypeFlags = 8;
alias kLSRequestAllFlags = 16;
alias kLSRequestIconAndKind = 32;
alias kLSRequestExtensionFlagsOnly = 64;
alias kLSRequestAllInfo = 4294967295;

alias LSItemInfoFlags = UInt;

alias kLSItemInfoIsPlainFile = 1;
alias kLSItemInfoIsPackage = 2;
alias kLSItemInfoIsApplication = 4;
alias kLSItemInfoIsContainer = 8;
alias kLSItemInfoIsAliasFile = 16;
alias kLSItemInfoIsSymlink = 32;
alias kLSItemInfoIsInvisible = 64;
alias kLSItemInfoIsNativeApp = 128;
alias kLSItemInfoIsClassicApp = 256;
alias kLSItemInfoAppPrefersNative = 512;
alias kLSItemInfoAppPrefersClassic = 1024;
alias kLSItemInfoAppIsScriptable = 2048;
alias kLSItemInfoIsVolume = 4096;
alias kLSItemInfoExtensionIsHidden = 1048576;

alias LSRolesMask = UInt;

alias kLSRolesNone = 1;
alias kLSRolesViewer = 2;
alias kLSRolesEditor = 4;
alias kLSRolesShell = 8;
alias kLSRolesAll = 4294967295;

alias kLSUnknownType = 0;
alias kLSUnknownCreator = 0;

record Struct_LSItemInfoRecord (
    flags : UInt,
    filetype : UInt,
    creator : UInt,
    extension : CFStringRef,
);

alias LSItemInfoRecord = Struct_LSItemInfoRecord;

alias LSAcceptanceFlags = UInt;

alias kLSAcceptDefault = 1;
alias kLSAcceptAllowLoginUI = 2;

external LSInit(
    inFlags : UInt) : Int;

external LSTerm() : Int;

external LSCopyItemInfoForRef(
    inItemRef : Pointer[FSRef],
    inWhichInfo : UInt,
    outItemInfo : Pointer[LSItemInfoRecord]) : Int;

external LSCopyItemInfoForURL(
    inURL : CFURLRef,
    inWhichInfo : UInt,
    outItemInfo : Pointer[LSItemInfoRecord]) : Int;

external LSGetExtensionInfo(
    inNameLen : CULong,
    inNameBuffer : Pointer[UShort],
    outExtStartIndex : Pointer[CULong]) : Int;

external LSCopyDisplayNameForRef(
    inRef : Pointer[FSRef],
    outDisplayName : Pointer[CFStringRef]) : Int;

external LSCopyDisplayNameForURL(
    inURL : CFURLRef,
    outDisplayName : Pointer[CFStringRef]) : Int;

external LSSetExtensionHiddenForRef(
    inRef : Pointer[FSRef],
    inHide : CUChar) : Int;

external LSSetExtensionHiddenForURL(
    inURL : CFURLRef,
    inHide : CUChar) : Int;

external LSCopyKindStringForRef(
    inFSRef : Pointer[FSRef],
    outKindString : Pointer[CFStringRef]) : Int;

external LSCopyKindStringForURL(
    inURL : CFURLRef,
    outKindString : Pointer[CFStringRef]) : Int;

external LSCopyKindStringForTypeInfo(
    inType : UInt,
    inCreator : UInt,
    inExtension : CFStringRef,
    outKindString : Pointer[CFStringRef]) : Int;

external LSCopyKindStringForMIMEType(
    inMIMEType : CFStringRef,
    outKindString : Pointer[CFStringRef]) : Int;

external LSGetApplicationForItem(
    inItemRef : Pointer[FSRef],
    inRoleMask : UInt,
    outAppRef : Pointer[FSRef],
    outAppURL : Pointer[CFURLRef]) : Int;

external LSGetApplicationForInfo(
    inType : UInt,
    inCreator : UInt,
    inExtension : CFStringRef,
    inRoleMask : UInt,
    outAppRef : Pointer[FSRef],
    outAppURL : Pointer[CFURLRef]) : Int;

external LSCopyApplicationForMIMEType(
    inMIMEType : CFStringRef,
    inRoleMask : UInt,
    outAppURL : Pointer[CFURLRef]) : Int;

external LSGetApplicationForURL(
    inURL : CFURLRef,
    inRoleMask : UInt,
    outAppRef : Pointer[FSRef],
    outAppURL : Pointer[CFURLRef]) : Int;

external LSFindApplicationForInfo(
    inCreator : UInt,
    inBundleID : CFStringRef,
    inName : CFStringRef,
    outAppRef : Pointer[FSRef],
    outAppURL : Pointer[CFURLRef]) : Int;

external LSCanRefAcceptItem(
    inItemFSRef : Pointer[FSRef],
    inTargetRef : Pointer[FSRef],
    inRoleMask : UInt,
    inFlags : UInt,
    outAcceptsItem : Pointer[CUChar]) : Int;

external LSCanURLAcceptURL(
    inItemURL : CFURLRef,
    inTargetURL : CFURLRef,
    inRoleMask : UInt,
    inFlags : UInt,
    outAcceptsItem : Pointer[CUChar]) : Int;

external LSRegisterURL(
    inURL : CFURLRef,
    inUpdate : CUChar) : Int;

external LSRegisterFSRef(
    inRef : Pointer[FSRef],
    inUpdate : CUChar) : Int;

external LSCopyApplicationURLsForURL(
    inURL : CFURLRef,
    inRoleMask : UInt) : CFArrayRef;

external kLSItemContentType : CFStringRef;

external kLSItemFileType : CFStringRef;

external kLSItemFileCreator : CFStringRef;

external kLSItemExtension : CFStringRef;

external kLSItemDisplayName : CFStringRef;

external kLSItemDisplayKind : CFStringRef;

external kLSItemRoleHandlerDisplayName : CFStringRef;

external kLSItemIsInvisible : CFStringRef;

external kLSItemExtensionIsHidden : CFStringRef;

external kLSItemQuarantineProperties : CFStringRef;

external LSCopyItemAttribute(
    inItem : Pointer[FSRef],
    inRoles : UInt,
    inAttributeName : CFStringRef,
    outValue : Pointer[CFTypeRef]) : Int;

external LSCopyItemAttributes(
    inItem : Pointer[FSRef],
    inRoles : UInt,
    inAttributeNames : CFArrayRef,
    outValues : Pointer[CFDictionaryRef]) : Int;

external LSSetItemAttribute(
    inItem : Pointer[FSRef],
    inRoles : UInt,
    inAttributeName : CFStringRef,
    inValue : CFTypeRef) : Int;

external LSCopyDefaultRoleHandlerForContentType(
    inContentType : CFStringRef,
    inRole : UInt) : CFStringRef;

external LSCopyAllRoleHandlersForContentType(
    inContentType : CFStringRef,
    inRole : UInt) : CFArrayRef;

external LSSetDefaultRoleHandlerForContentType(
    inContentType : CFStringRef,
    inRole : UInt,
    inHandlerBundleID : CFStringRef) : Int;

alias LSHandlerOptions = UInt;

alias kLSHandlerOptionsDefault = 0;
alias kLSHandlerOptionsIgnoreCreator = 1;

external LSGetHandlerOptionsForContentType(
    inContentType : CFStringRef) : UInt;

external LSSetHandlerOptionsForContentType(
    inContentType : CFStringRef,
    inOptions : UInt) : Int;

external LSCopyDefaultHandlerForURLScheme(
    inURLScheme : CFStringRef) : CFStringRef;

external LSCopyAllHandlersForURLScheme(
    inURLScheme : CFStringRef) : CFArrayRef;

external LSSetDefaultHandlerForURLScheme(
    inURLScheme : CFStringRef,
    inHandlerBundleID : CFStringRef) : Int;

alias LSLaunchFlags = UInt;

alias kLSLaunchDefaults = 1;
alias kLSLaunchAndPrint = 2;
alias kLSLaunchReserved2 = 4;
alias kLSLaunchReserved3 = 8;
alias kLSLaunchReserved4 = 16;
alias kLSLaunchReserved5 = 32;
alias kLSLaunchAndDisplayErrors = 64;
alias kLSLaunchInhibitBGOnly = 128;
alias kLSLaunchDontAddToRecents = 256;
alias kLSLaunchDontSwitch = 512;
alias kLSLaunchNoParams = 2048;
alias kLSLaunchAsync = 65536;
alias kLSLaunchStartClassic = 131072;
alias kLSLaunchInClassic = 262144;
alias kLSLaunchNewInstance = 524288;
alias kLSLaunchAndHide = 1048576;
alias kLSLaunchAndHideOthers = 2097152;
alias kLSLaunchHasUntrustedContents = 4194304;

record Struct_LSLaunchFSRefSpec (
    appRef : Pointer[FSRef],
    numDocs : CULong,
    itemRefs : Pointer[FSRef],
    passThruParams : Pointer[AEDesc],
    launchFlags : UInt,
    asyncRefCon : RawPointer,
);

alias LSLaunchFSRefSpec = Struct_LSLaunchFSRefSpec;

record Struct_LSLaunchURLSpec (
    appURL : CFURLRef,
    itemURLs : CFArrayRef,
    passThruParams : Pointer[AEDesc],
    launchFlags : UInt,
    asyncRefCon : RawPointer,
);

alias LSLaunchURLSpec = Struct_LSLaunchURLSpec;

external LSOpenFSRef(
    inRef : Pointer[FSRef],
    outLaunchedRef : Pointer[FSRef]) : Int;

external LSOpenCFURLRef(
    inURL : CFURLRef,
    outLaunchedURL : Pointer[CFURLRef]) : Int;

external LSOpenFromRefSpec(
    inLaunchSpec : Pointer[LSLaunchFSRefSpec],
    outLaunchedRef : Pointer[FSRef]) : Int;

external LSOpenFromURLSpec(
    inLaunchSpec : Pointer[LSLaunchURLSpec],
    outLaunchedURL : Pointer[CFURLRef]) : Int;

record Struct_LSApplicationParameters (
    version : CLong,
    flags : UInt,
    application : Pointer[FSRef],
    asyncLaunchRefCon : RawPointer,
    environment : CFDictionaryRef,
    argv : CFArrayRef,
    initialEvent : Pointer[AppleEvent],
);

alias LSApplicationParameters = Struct_LSApplicationParameters;

external LSOpenApplication(
    appParams : Pointer[LSApplicationParameters],
    outPSN : Pointer[ProcessSerialNumber]) : Int;

external LSOpenItemsWithRole(
    inItems : Pointer[FSRef],
    inItemCount : CLong,
    inRole : UInt,
    inAEParam : Pointer[AEKeyDesc],
    inAppParams : Pointer[LSApplicationParameters],
    outPSNs : Pointer[ProcessSerialNumber],
    inMaxPSNCount : CLong) : Int;

external LSOpenURLsWithRole(
    inURLs : CFArrayRef,
    inRole : UInt,
    inAEParam : Pointer[AEKeyDesc],
    inAppParams : Pointer[LSApplicationParameters],
    outPSNs : Pointer[ProcessSerialNumber],
    inMaxPSNCount : CLong) : Int;

external kLSQuarantineAgentNameKey : CFStringRef;

external kLSQuarantineAgentBundleIdentifierKey : CFStringRef;

external kLSQuarantineTimeStampKey : CFStringRef;

external kLSQuarantineTypeKey : CFStringRef;

external kLSQuarantineTypeWebDownload : CFStringRef;

external kLSQuarantineTypeOtherDownload : CFStringRef;

external kLSQuarantineTypeEmailAttachment : CFStringRef;

external kLSQuarantineTypeInstantMessageAttachment : CFStringRef;

external kLSQuarantineTypeCalendarEventAttachment : CFStringRef;

external kLSQuarantineTypeOtherAttachment : CFStringRef;

external kLSQuarantineOriginURLKey : CFStringRef;

external kLSQuarantineDataURLKey : CFStringRef;

alias LSSharedFileListRef = OpaquePointer;

alias LSSharedFileListItemRef = OpaquePointer;

external kLSSharedFileListFavoriteVolumes : CFStringRef;

external kLSSharedFileListFavoriteItems : CFStringRef;

external kLSSharedFileListRecentApplicationItems : CFStringRef;

external kLSSharedFileListRecentDocumentItems : CFStringRef;

external kLSSharedFileListRecentServerItems : CFStringRef;

external kLSSharedFileListSessionLoginItems : CFStringRef;

external kLSSharedFileListGlobalLoginItems : CFStringRef;

external kLSSharedFileListRecentItemsMaxAmount : CFStringRef;

external kLSSharedFileListVolumesComputerVisible : CFStringRef;

external kLSSharedFileListVolumesIDiskVisible : CFStringRef;

external kLSSharedFileListVolumesNetworkVisible : CFStringRef;

external kLSSharedFileListItemBeforeFirst : LSSharedFileListItemRef;

external kLSSharedFileListItemLast : LSSharedFileListItemRef;

external kLSSharedFileListItemHidden : CFStringRef;

external kLSSharedFileListLoginItemHidden : CFStringRef;

alias kLSSharedFileListNoUserInteraction = 1;
alias kLSSharedFileListDoNotMountVolumes = 2;

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

external LSSharedFileListGetTypeID() : CULong;

external LSSharedFileListItemGetTypeID() : CULong;

external LSSharedFileListCreate(
    inAllocator : CFAllocatorRef,
    inListType : CFStringRef,
    listOptions : CFTypeRef) : LSSharedFileListRef;

external LSSharedFileListSetAuthorization(
    inList : LSSharedFileListRef,
    inAuthorization : AuthorizationRef) : Int;

external LSSharedFileListAddObserver(
    inList : LSSharedFileListRef,
    inRunloop : CFRunLoopRef,
    inRunloopMode : CFStringRef,
    callback : LSSharedFileListChangedProcPtr,
    context : RawPointer);

external LSSharedFileListRemoveObserver(
    inList : LSSharedFileListRef,
    inRunloop : CFRunLoopRef,
    inRunloopMode : CFStringRef,
    callback : LSSharedFileListChangedProcPtr,
    context : RawPointer);

external LSSharedFileListGetSeedValue(
    inList : LSSharedFileListRef) : UInt;

external LSSharedFileListCopyProperty(
    inList : LSSharedFileListRef,
    inPropertyName : CFStringRef) : CFTypeRef;

external LSSharedFileListSetProperty(
    inList : LSSharedFileListRef,
    inPropertyName : CFStringRef,
    inPropertyData : CFTypeRef) : Int;

external LSSharedFileListCopySnapshot(
    inList : LSSharedFileListRef,
    outSnapshotSeed : Pointer[UInt]) : CFArrayRef;

external LSSharedFileListInsertItemURL(
    inList : LSSharedFileListRef,
    insertAfterThisItem : LSSharedFileListItemRef,
    inDisplayName : CFStringRef,
    inIconRef : IconRef,
    inURL : CFURLRef,
    inPropertiesToSet : CFDictionaryRef,
    inPropertiesToClear : CFArrayRef) : LSSharedFileListItemRef;

external LSSharedFileListInsertItemFSRef(
    inList : LSSharedFileListRef,
    insertAfterThisItem : LSSharedFileListItemRef,
    inDisplayName : CFStringRef,
    inIconRef : IconRef,
    inFSRef : Pointer[FSRef],
    inPropertiesToSet : CFDictionaryRef,
    inPropertiesToClear : CFArrayRef) : LSSharedFileListItemRef;

external LSSharedFileListItemMove(
    inList : LSSharedFileListRef,
    inItem : LSSharedFileListItemRef,
    inMoveAfterItem : LSSharedFileListItemRef) : Int;

external LSSharedFileListItemRemove(
    inList : LSSharedFileListRef,
    inItem : LSSharedFileListItemRef) : Int;

external LSSharedFileListRemoveAllItems(
    inList : LSSharedFileListRef) : Int;

external LSSharedFileListItemGetID(
    inItem : LSSharedFileListItemRef) : UInt;

external LSSharedFileListItemCopyIconRef(
    inItem : LSSharedFileListItemRef) : IconRef;

external LSSharedFileListItemCopyDisplayName(
    inItem : LSSharedFileListItemRef) : CFStringRef;

external LSSharedFileListItemResolve(
    inItem : LSSharedFileListItemRef,
    inFlags : UInt,
    outURL : Pointer[CFURLRef],
    outRef : Pointer[FSRef]) : Int;

external LSSharedFileListItemCopyProperty(
    inItem : LSSharedFileListItemRef,
    inPropertyName : CFStringRef) : CFTypeRef;

external LSSharedFileListItemSetProperty(
    inItem : LSSharedFileListItemRef,
    inPropertyName : CFStringRef,
    inPropertyData : CFTypeRef) : Int;

external kUTTypeItem : CFStringRef;

external kUTTypeContent : CFStringRef;

external kUTTypeCompositeContent : CFStringRef;

external kUTTypeApplication : CFStringRef;

external kUTTypeMessage : CFStringRef;

external kUTTypeContact : CFStringRef;

external kUTTypeArchive : CFStringRef;

external kUTTypeDiskImage : CFStringRef;

external kUTTypeData : CFStringRef;

external kUTTypeDirectory : CFStringRef;

external kUTTypeResolvable : CFStringRef;

external kUTTypeSymLink : CFStringRef;

external kUTTypeMountPoint : CFStringRef;

external kUTTypeAliasFile : CFStringRef;

external kUTTypeAliasRecord : CFStringRef;

external kUTTypeURL : CFStringRef;

external kUTTypeFileURL : CFStringRef;

external kUTTypeText : CFStringRef;

external kUTTypePlainText : CFStringRef;

external kUTTypeUTF8PlainText : CFStringRef;

external kUTTypeUTF16ExternalPlainText : CFStringRef;

external kUTTypeUTF16PlainText : CFStringRef;

external kUTTypeRTF : CFStringRef;

external kUTTypeHTML : CFStringRef;

external kUTTypeXML : CFStringRef;

external kUTTypeSourceCode : CFStringRef;

external kUTTypeCSource : CFStringRef;

external kUTTypeObjectiveCSource : CFStringRef;

external kUTTypeCPlusPlusSource : CFStringRef;

external kUTTypeObjectiveCPlusPlusSource : CFStringRef;

external kUTTypeCHeader : CFStringRef;

external kUTTypeCPlusPlusHeader : CFStringRef;

external kUTTypeJavaSource : CFStringRef;

external kUTTypePDF : CFStringRef;

external kUTTypeRTFD : CFStringRef;

external kUTTypeFlatRTFD : CFStringRef;

external kUTTypeTXNTextAndMultimediaData : CFStringRef;

external kUTTypeWebArchive : CFStringRef;

external kUTTypeImage : CFStringRef;

external kUTTypeJPEG : CFStringRef;

external kUTTypeJPEG2000 : CFStringRef;

external kUTTypeTIFF : CFStringRef;

external kUTTypePICT : CFStringRef;

external kUTTypeGIF : CFStringRef;

external kUTTypePNG : CFStringRef;

external kUTTypeQuickTimeImage : CFStringRef;

external kUTTypeAppleICNS : CFStringRef;

external kUTTypeBMP : CFStringRef;

external kUTTypeICO : CFStringRef;

external kUTTypeAudiovisualContent : CFStringRef;

external kUTTypeMovie : CFStringRef;

external kUTTypeVideo : CFStringRef;

external kUTTypeAudio : CFStringRef;

external kUTTypeQuickTimeMovie : CFStringRef;

external kUTTypeMPEG : CFStringRef;

external kUTTypeMPEG4 : CFStringRef;

external kUTTypeMP3 : CFStringRef;

external kUTTypeMPEG4Audio : CFStringRef;

external kUTTypeAppleProtectedMPEG4Audio : CFStringRef;

external kUTTypeFolder : CFStringRef;

external kUTTypeVolume : CFStringRef;

external kUTTypePackage : CFStringRef;

external kUTTypeBundle : CFStringRef;

external kUTTypeFramework : CFStringRef;

external kUTTypeApplicationBundle : CFStringRef;

external kUTTypeApplicationFile : CFStringRef;

external kUTTypeVCard : CFStringRef;

external kUTTypeInkText : CFStringRef;

external kUTExportedTypeDeclarationsKey : CFStringRef;

external kUTImportedTypeDeclarationsKey : CFStringRef;

external kUTTypeIdentifierKey : CFStringRef;

external kUTTypeTagSpecificationKey : CFStringRef;

external kUTTypeConformsToKey : CFStringRef;

external kUTTypeDescriptionKey : CFStringRef;

external kUTTypeIconFileKey : CFStringRef;

external kUTTypeReferenceURLKey : CFStringRef;

external kUTTypeVersionKey : CFStringRef;

external kUTTagClassFilenameExtension : CFStringRef;

external kUTTagClassMIMEType : CFStringRef;

external kUTTagClassNSPboardType : CFStringRef;

external kUTTagClassOSType : CFStringRef;

external UTTypeCreatePreferredIdentifierForTag(
    inTagClass : CFStringRef,
    inTag : CFStringRef,
    inConformingToUTI : CFStringRef) : CFStringRef;

external UTTypeCreateAllIdentifiersForTag(
    inTagClass : CFStringRef,
    inTag : CFStringRef,
    inConformingToUTI : CFStringRef) : CFArrayRef;

external UTTypeCopyPreferredTagWithClass(
    inUTI : CFStringRef,
    inTagClass : CFStringRef) : CFStringRef;

external UTTypeEqual(
    inUTI1 : CFStringRef,
    inUTI2 : CFStringRef) : CUChar;

external UTTypeConformsTo(
    inUTI : CFStringRef,
    inConformsToUTI : CFStringRef) : CUChar;

external UTTypeCopyDescription(
    inUTI : CFStringRef) : CFStringRef;

external UTTypeCopyDeclaration(
    inUTI : CFStringRef) : CFDictionaryRef;

external UTTypeCopyDeclaringBundleURL(
    inUTI : CFStringRef) : CFURLRef;

external UTCreateStringForOSType(
    inOSType : UInt) : CFStringRef;

external UTGetOSTypeFromString(
    inString : CFStringRef) : UInt;

alias SKDocumentRef = CFTypeRef;

external SKDocumentGetTypeID() : CULong;

external SKDocumentCreateWithURL(
    inURL : CFURLRef) : SKDocumentRef;

external SKDocumentCopyURL(
    inDocument : SKDocumentRef) : CFURLRef;

external SKDocumentCreate(
    inScheme : CFStringRef,
    inParent : SKDocumentRef,
    inName : CFStringRef) : SKDocumentRef;

external SKDocumentGetSchemeName(
    inDocument : SKDocumentRef) : CFStringRef;

external SKDocumentGetName(
    inDocument : SKDocumentRef) : CFStringRef;

external SKDocumentGetParent(
    inDocument : SKDocumentRef) : SKDocumentRef;

external kSKMinTermLength : CFStringRef;

external kSKSubstitutions : CFStringRef;

external kSKStopWords : CFStringRef;

external kSKProximityIndexing : CFStringRef;

external kSKMaximumTerms : CFStringRef;

external kSKTermChars : CFStringRef;

external kSKStartTermChars : CFStringRef;

external kSKEndTermChars : CFStringRef;

external kSKLanguageTypes : CFStringRef;

alias SKIndexRef = OpaquePointer;

external SKIndexGetTypeID() : CULong;

alias SKIndexDocumentIteratorRef = OpaquePointer;

external SKIndexDocumentIteratorGetTypeID() : CULong;

alias kSKIndexUnknown = 0;
alias kSKIndexInverted = 1;
alias kSKIndexVector = 2;
alias kSKIndexInvertedVector = 3;

alias SKIndexType = Int;

alias kSKDocumentStateNotIndexed = 0;
alias kSKDocumentStateIndexed = 1;
alias kSKDocumentStateAddPending = 2;
alias kSKDocumentStateDeletePending = 3;

alias SKDocumentIndexState = Int;

external SKIndexCreateWithURL(
    inURL : CFURLRef,
    inIndexName : CFStringRef,
    inIndexType : SKIndexType,
    inAnalysisProperties : CFDictionaryRef) : SKIndexRef;

external SKIndexOpenWithURL(
    inURL : CFURLRef,
    inIndexName : CFStringRef,
    inWriteAccess : CUChar) : SKIndexRef;

external SKIndexCreateWithMutableData(
    inData : CFMutableDataRef,
    inIndexName : CFStringRef,
    inIndexType : SKIndexType,
    inAnalysisProperties : CFDictionaryRef) : SKIndexRef;

external SKIndexOpenWithData(
    inData : CFDataRef,
    inIndexName : CFStringRef) : SKIndexRef;

external SKIndexOpenWithMutableData(
    inData : CFMutableDataRef,
    inIndexName : CFStringRef) : SKIndexRef;

external SKIndexFlush(
    inIndex : SKIndexRef) : CUChar;

external SKIndexSetMaximumBytesBeforeFlush(
    inIndex : SKIndexRef,
    inBytesForUpdate : CLong);

external SKIndexGetMaximumBytesBeforeFlush(
    inIndex : SKIndexRef) : CLong;

external SKIndexCompact(
    inIndex : SKIndexRef) : CUChar;

external SKIndexGetIndexType(
    inIndex : SKIndexRef) : SKIndexType;

external SKIndexGetAnalysisProperties(
    inIndex : SKIndexRef) : CFDictionaryRef;

external SKIndexGetDocumentCount(
    inIndex : SKIndexRef) : CLong;

external SKIndexClose(
    inIndex : SKIndexRef);

alias SKDocumentID = CLong;

external SKIndexAddDocumentWithText(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef,
    inDocumentText : CFStringRef,
    inCanReplace : CUChar) : CUChar;

external SKIndexAddDocument(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef,
    inMIMETypeHint : CFStringRef,
    inCanReplace : CUChar) : CUChar;

external SKIndexRemoveDocument(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef) : CUChar;

external SKIndexCopyDocumentProperties(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef) : CFDictionaryRef;

external SKIndexSetDocumentProperties(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef,
    inProperties : CFDictionaryRef);

external SKIndexGetDocumentState(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef) : SKDocumentIndexState;

external SKIndexGetDocumentID(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef) : CLong;

external SKIndexCopyDocumentForDocumentID(
    inIndex : SKIndexRef,
    inDocumentID : CLong) : SKDocumentRef;

external SKIndexRenameDocument(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef,
    inNewName : CFStringRef) : CUChar;

external SKIndexMoveDocument(
    inIndex : SKIndexRef,
    inDocument : SKDocumentRef,
    inNewParent : SKDocumentRef) : CUChar;

external SKIndexDocumentIteratorCreate(
    inIndex : SKIndexRef,
    inParentDocument : SKDocumentRef) : SKIndexDocumentIteratorRef;

external SKIndexDocumentIteratorCopyNext(
    inIterator : SKIndexDocumentIteratorRef) : SKDocumentRef;

external SKIndexGetMaximumDocumentID(
    inIndex : SKIndexRef) : CLong;

external SKIndexGetDocumentTermCount(
    inIndex : SKIndexRef,
    inDocumentID : CLong) : CLong;

external SKIndexCopyTermIDArrayForDocumentID(
    inIndex : SKIndexRef,
    inDocumentID : CLong) : CFArrayRef;

external SKIndexGetDocumentTermFrequency(
    inIndex : SKIndexRef,
    inDocumentID : CLong,
    inTermID : CLong) : CLong;

external SKIndexGetMaximumTermID(
    inIndex : SKIndexRef) : CLong;

external SKIndexGetTermDocumentCount(
    inIndex : SKIndexRef,
    inTermID : CLong) : CLong;

external SKIndexCopyDocumentIDArrayForTermID(
    inIndex : SKIndexRef,
    inTermID : CLong) : CFArrayRef;

external SKIndexCopyTermStringForTermID(
    inIndex : SKIndexRef,
    inTermID : CLong) : CFStringRef;

external SKIndexGetTermIDForTermString(
    inIndex : SKIndexRef,
    inTermString : CFStringRef) : CLong;

external SKLoadDefaultExtractorPlugIns();

alias SKSearchRef = OpaquePointer;

external SKSearchGetTypeID() : CULong;

alias SKSearchOptions = UInt;

alias kSKSearchOptionDefault = 0;
alias kSKSearchOptionNoRelevanceScores = 1;
alias kSKSearchOptionSpaceMeansOR = 2;
alias kSKSearchOptionFindSimilar = 4;

external SKSearchCreate(
    inIndex : SKIndexRef,
    inQuery : CFStringRef,
    inSearchOptions : UInt) : SKSearchRef;

external SKSearchCancel(
    inSearch : SKSearchRef);

external SKSearchFindMatches(
    inSearch : SKSearchRef,
    inMaximumCount : CLong,
    outDocumentIDsArray : Pointer[CLong],
    outScoresArray : Pointer[Float],
    maximumTime : Double,
    outFoundCount : Pointer[CLong]) : CUChar;

external SKIndexCopyInfoForDocumentIDs(
    inIndex : SKIndexRef,
    inCount : CLong,
    inDocumentIDsArray : Pointer[CLong],
    outNamesArray : Pointer[CFStringRef],
    outParentIDsArray : Pointer[CLong]);

external SKIndexCopyDocumentRefsForDocumentIDs(
    inIndex : SKIndexRef,
    inCount : CLong,
    inDocumentIDsArray : Pointer[CLong],
    outDocumentRefsArray : Pointer[SKDocumentRef]);

external SKIndexCopyDocumentURLsForDocumentIDs(
    inIndex : SKIndexRef,
    inCount : CLong,
    inDocumentIDsArray : Pointer[CLong],
    outDocumentURLsArray : Pointer[CFURLRef]);

alias SKSearchGroupRef = OpaquePointer;

external SKSearchGroupGetTypeID() : CULong;

alias SKSearchResultsRef = OpaquePointer;

external SKSearchResultsGetTypeID() : CULong;

alias kSKSearchRanked = 0;
alias kSKSearchBooleanRanked = 1;
alias kSKSearchRequiredRanked = 2;
alias kSKSearchPrefixRanked = 3;

alias SKSearchType = Int;

alias SKSearchResultsFilterCallBack = CCodePointer[[OpaquePointer,RawPointer,RawPointer],[CUChar]];

external SKSearchGroupCreate(
    inArrayOfInIndexes : CFArrayRef) : SKSearchGroupRef;

external SKSearchGroupCopyIndexes(
    inSearchGroup : SKSearchGroupRef) : CFArrayRef;

external SKSearchResultsCreateWithQuery(
    inSearchGroup : SKSearchGroupRef,
    inQuery : CFStringRef,
    inSearchType : SKSearchType,
    inMaxFoundDocuments : CLong,
    inContext : RawPointer,
    inFilterCallBack : SKSearchResultsFilterCallBack) : SKSearchResultsRef;

external SKSearchResultsCreateWithDocuments(
    inSearchGroup : SKSearchGroupRef,
    inExampleDocuments : CFArrayRef,
    inMaxFoundDocuments : CLong,
    inContext : RawPointer,
    inFilterCallBack : SKSearchResultsFilterCallBack) : SKSearchResultsRef;

external SKSearchResultsGetCount(
    inSearchResults : SKSearchResultsRef) : CLong;

external SKSearchResultsGetInfoInRange(
    inSearchResults : SKSearchResultsRef,
    inRange : CFRange,
    outDocumentsArray : Pointer[SKDocumentRef],
    outIndexesArray : Pointer[SKIndexRef],
    outScoresArray : Pointer[Float]) : CLong;

external SKSearchResultsCopyMatchingTerms(
    inSearchResults : SKSearchResultsRef,
    inItem : CLong) : CFArrayRef;

alias SKSummaryRef = OpaquePointer;

external SKSummaryGetTypeID() : CULong;

external SKSummaryCreateWithString(
    inString : CFStringRef) : SKSummaryRef;

external SKSummaryGetSentenceCount(
    summary : SKSummaryRef) : CLong;

external SKSummaryGetParagraphCount(
    summary : SKSummaryRef) : CLong;

external SKSummaryCopySentenceAtIndex(
    summary : SKSummaryRef,
    i : CLong) : CFStringRef;

external SKSummaryCopyParagraphAtIndex(
    summary : SKSummaryRef,
    i : CLong) : CFStringRef;

external SKSummaryCopySentenceSummaryString(
    summary : SKSummaryRef,
    numSentences : CLong) : CFStringRef;

external SKSummaryCopyParagraphSummaryString(
    summary : SKSummaryRef,
    numParagraphs : CLong) : CFStringRef;

external SKSummaryGetSentenceSummaryInfo(
    summary : SKSummaryRef,
    numSentencesInSummary : CLong,
    outRankOrderOfSentences : Pointer[CLong],
    outSentenceIndexOfSentences : Pointer[CLong],
    outParagraphIndexOfSentences : Pointer[CLong]) : CLong;

external SKSummaryGetParagraphSummaryInfo(
    summary : SKSummaryRef,
    numParagraphsInSummary : CLong,
    outRankOrderOfParagraphs : Pointer[CLong],
    outParagraphIndexOfParagraphs : Pointer[CLong]) : CLong;

alias MDItemRef = OpaquePointer;

external MDItemGetTypeID() : CULong;

external MDItemCreate(
    allocator : CFAllocatorRef,
    path : CFStringRef) : MDItemRef;

external MDItemCreateWithURL(
    allocator : CFAllocatorRef,
    url : CFURLRef) : MDItemRef;

external MDItemCopyAttribute(
    item : MDItemRef,
    name : CFStringRef) : CFTypeRef;

external MDItemCopyAttributes(
    item : MDItemRef,
    names : CFArrayRef) : CFDictionaryRef;

external MDItemCopyAttributeList(
    item : MDItemRef,
    ..) : CFDictionaryRef;

external MDItemCopyAttributeNames(
    item : MDItemRef) : CFArrayRef;

external kMDItemAttributeChangeDate : CFStringRef;

external kMDItemContentType : CFStringRef;

external kMDItemContentTypeTree : CFStringRef;

external kMDItemKeywords : CFStringRef;

external kMDItemTitle : CFStringRef;

external kMDItemAuthors : CFStringRef;

external kMDItemEditors : CFStringRef;

external kMDItemParticipants : CFStringRef;

external kMDItemProjects : CFStringRef;

external kMDItemWhereFroms : CFStringRef;

external kMDItemComment : CFStringRef;

external kMDItemCopyright : CFStringRef;

external kMDItemLastUsedDate : CFStringRef;

external kMDItemContentCreationDate : CFStringRef;

external kMDItemContentModificationDate : CFStringRef;

external kMDItemDurationSeconds : CFStringRef;

external kMDItemContactKeywords : CFStringRef;

external kMDItemVersion : CFStringRef;

external kMDItemPixelHeight : CFStringRef;

external kMDItemPixelWidth : CFStringRef;

external kMDItemPixelCount : CFStringRef;

external kMDItemColorSpace : CFStringRef;

external kMDItemBitsPerSample : CFStringRef;

external kMDItemFlashOnOff : CFStringRef;

external kMDItemFocalLength : CFStringRef;

external kMDItemAcquisitionMake : CFStringRef;

external kMDItemAcquisitionModel : CFStringRef;

external kMDItemISOSpeed : CFStringRef;

external kMDItemOrientation : CFStringRef;

external kMDItemLayerNames : CFStringRef;

external kMDItemWhiteBalance : CFStringRef;

external kMDItemAperture : CFStringRef;

external kMDItemProfileName : CFStringRef;

external kMDItemResolutionWidthDPI : CFStringRef;

external kMDItemResolutionHeightDPI : CFStringRef;

external kMDItemExposureMode : CFStringRef;

external kMDItemExposureTimeSeconds : CFStringRef;

external kMDItemEXIFVersion : CFStringRef;

external kMDItemEXIFGPSVersion : CFStringRef;

external kMDItemAltitude : CFStringRef;

external kMDItemLatitude : CFStringRef;

external kMDItemLongitude : CFStringRef;

external kMDItemSpeed : CFStringRef;

external kMDItemTimestamp : CFStringRef;

external kMDItemGPSTrack : CFStringRef;

external kMDItemImageDirection : CFStringRef;

external kMDItemNamedLocation : CFStringRef;

external kMDItemCodecs : CFStringRef;

external kMDItemMediaTypes : CFStringRef;

external kMDItemStreamable : CFStringRef;

external kMDItemTotalBitRate : CFStringRef;

external kMDItemVideoBitRate : CFStringRef;

external kMDItemAudioBitRate : CFStringRef;

external kMDItemDeliveryType : CFStringRef;

external kMDItemAlbum : CFStringRef;

external kMDItemHasAlphaChannel : CFStringRef;

external kMDItemRedEyeOnOff : CFStringRef;

external kMDItemMeteringMode : CFStringRef;

external kMDItemMaxAperture : CFStringRef;

external kMDItemFNumber : CFStringRef;

external kMDItemExposureProgram : CFStringRef;

external kMDItemExposureTimeString : CFStringRef;

external kMDItemHeadline : CFStringRef;

external kMDItemInstructions : CFStringRef;

external kMDItemCity : CFStringRef;

external kMDItemStateOrProvince : CFStringRef;

external kMDItemCountry : CFStringRef;

external kMDItemFSName : CFStringRef;

external kMDItemDisplayName : CFStringRef;

external kMDItemPath : CFStringRef;

external kMDItemFSSize : CFStringRef;

external kMDItemFSCreationDate : CFStringRef;

external kMDItemFSContentChangeDate : CFStringRef;

external kMDItemFSOwnerUserID : CFStringRef;

external kMDItemFSOwnerGroupID : CFStringRef;

external kMDItemFSExists : CFStringRef;

external kMDItemFSIsReadable : CFStringRef;

external kMDItemFSIsWriteable : CFStringRef;

external kMDItemFSHasCustomIcon : CFStringRef;

external kMDItemFSIsExtensionHidden : CFStringRef;

external kMDItemFSIsStationery : CFStringRef;

external kMDItemFSInvisible : CFStringRef;

external kMDItemFSLabel : CFStringRef;

external kMDItemFSNodeCount : CFStringRef;

external kMDItemTextContent : CFStringRef;

external kMDItemAudioSampleRate : CFStringRef;

external kMDItemAudioChannelCount : CFStringRef;

external kMDItemTempo : CFStringRef;

external kMDItemKeySignature : CFStringRef;

external kMDItemTimeSignature : CFStringRef;

external kMDItemAudioEncodingApplication : CFStringRef;

external kMDItemComposer : CFStringRef;

external kMDItemLyricist : CFStringRef;

external kMDItemAudioTrackNumber : CFStringRef;

external kMDItemRecordingDate : CFStringRef;

external kMDItemMusicalGenre : CFStringRef;

external kMDItemIsGeneralMIDISequence : CFStringRef;

external kMDItemRecordingYear : CFStringRef;

external kMDItemOrganizations : CFStringRef;

external kMDItemLanguages : CFStringRef;

external kMDItemRights : CFStringRef;

external kMDItemPublishers : CFStringRef;

external kMDItemContributors : CFStringRef;

external kMDItemCoverage : CFStringRef;

external kMDItemSubject : CFStringRef;

external kMDItemTheme : CFStringRef;

external kMDItemDescription : CFStringRef;

external kMDItemIdentifier : CFStringRef;

external kMDItemAudiences : CFStringRef;

external kMDItemNumberOfPages : CFStringRef;

external kMDItemPageWidth : CFStringRef;

external kMDItemPageHeight : CFStringRef;

external kMDItemSecurityMethod : CFStringRef;

external kMDItemCreator : CFStringRef;

external kMDItemEncodingApplications : CFStringRef;

external kMDItemDueDate : CFStringRef;

external kMDItemStarRating : CFStringRef;

external kMDItemPhoneNumbers : CFStringRef;

external kMDItemEmailAddresses : CFStringRef;

external kMDItemInstantMessageAddresses : CFStringRef;

external kMDItemKind : CFStringRef;

external kMDItemRecipients : CFStringRef;

external kMDItemFinderComment : CFStringRef;

external kMDItemFonts : CFStringRef;

external kMDItemAppleLoopsRootKey : CFStringRef;

external kMDItemAppleLoopsKeyFilterType : CFStringRef;

external kMDItemAppleLoopsLoopMode : CFStringRef;

external kMDItemAppleLoopDescriptors : CFStringRef;

external kMDItemMusicalInstrumentCategory : CFStringRef;

external kMDItemMusicalInstrumentName : CFStringRef;

external kMDItemCFBundleIdentifier : CFStringRef;

external kMDItemSupportFileType : CFStringRef;

external kMDItemInformation : CFStringRef;

external kMDItemDirector : CFStringRef;

external kMDItemProducer : CFStringRef;

external kMDItemGenre : CFStringRef;

external kMDItemPerformers : CFStringRef;

external kMDItemOriginalFormat : CFStringRef;

external kMDItemOriginalSource : CFStringRef;

external kMDItemAuthorEmailAddresses : CFStringRef;

external kMDItemRecipientEmailAddresses : CFStringRef;

external kMDItemAuthorAddresses : CFStringRef;

external kMDItemRecipientAddresses : CFStringRef;

external kMDItemURL : CFStringRef;

external __MDItemCopyAttributesEllipsis1(
    item : MDItemRef,
    ..) : CFDictionaryRef;

alias MDQueryRef = OpaquePointer;

alias kMDQuerySynchronous = 1;
alias kMDQueryWantsUpdates = 4;

alias MDQueryOptionFlags = Int;

external MDQueryGetTypeID() : CULong;

external MDQueryCreate(
    allocator : CFAllocatorRef,
    queryString : CFStringRef,
    valueListAttrs : CFArrayRef,
    sortingAttrs : CFArrayRef) : MDQueryRef;

external MDQueryCreateSubset(
    allocator : CFAllocatorRef,
    query : MDQueryRef,
    queryString : CFStringRef,
    valueListAttrs : CFArrayRef,
    sortingAttrs : CFArrayRef) : MDQueryRef;

external MDQueryCopyQueryString(
    query : MDQueryRef) : CFStringRef;

external MDQueryCopyValueListAttributes(
    query : MDQueryRef) : CFArrayRef;

external MDQueryCopySortingAttributes(
    query : MDQueryRef) : CFArrayRef;

record UnnamedStruct80 (
    first_max_num : CULong,
    first_max_ms : CULong,
    progress_max_num : CULong,
    progress_max_ms : CULong,
    update_max_num : CULong,
    update_max_ms : CULong,
);

alias MDQueryBatchingParams = UnnamedStruct80;

external MDQueryGetBatchingParameters(
    query : MDQueryRef) : MDQueryBatchingParams;

external MDQuerySetBatchingParameters(
    query : MDQueryRef,
    params : MDQueryBatchingParams);

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

external MDQuerySetCreateResultFunction(
    query : MDQueryRef,
    func : MDQueryCreateResultFunction,
    context : RawPointer,
    cb : Pointer[CFArrayCallBacks]);

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

external MDQuerySetCreateValueFunction(
    query : MDQueryRef,
    func : MDQueryCreateValueFunction,
    context : RawPointer,
    cb : Pointer[CFArrayCallBacks]);

external MDQuerySetDispatchQueue(
    query : MDQueryRef,
    queue : dispatch_queue_t);

external MDQueryExecute(
    query : MDQueryRef,
    optionFlags : CULong) : CUChar;

external MDQueryStop(
    query : MDQueryRef);

external MDQueryDisableUpdates(
    query : MDQueryRef);

external MDQueryEnableUpdates(
    query : MDQueryRef);

external MDQueryIsGatheringComplete(
    query : MDQueryRef) : CUChar;

external MDQueryGetResultCount(
    query : MDQueryRef) : CLong;

external MDQueryGetResultAtIndex(
    query : MDQueryRef,
    idx : CLong) : RawPointer;

external MDQueryGetIndexOfResult(
    query : MDQueryRef,
    result : RawPointer) : CLong;

external MDQueryGetAttributeValueOfResultAtIndex(
    query : MDQueryRef,
    name : CFStringRef,
    idx : CLong) : RawPointer;

external MDQueryCopyValuesOfAttribute(
    query : MDQueryRef,
    name : CFStringRef) : CFArrayRef;

external MDQueryGetCountOfResultsWithAttributeValue(
    query : MDQueryRef,
    name : CFStringRef,
    value : CFTypeRef) : CLong;

alias MDQuerySortComparatorFunction = CCodePointer[[Pointer[RawPointer],Pointer[RawPointer],RawPointer],[CLong]];

external MDQuerySetSortComparator(
    query : MDQueryRef,
    comparator : MDQuerySortComparatorFunction,
    context : RawPointer);

external MDQuerySetSortComparatorBlock(
    query : MDQueryRef,
    comparator : UnknownType);

external kMDQueryProgressNotification : CFStringRef;

external kMDQueryDidFinishNotification : CFStringRef;

external kMDQueryDidUpdateNotification : CFStringRef;

external kMDQueryUpdateAddedItems : CFStringRef;

external kMDQueryUpdateChangedItems : CFStringRef;

external kMDQueryUpdateRemovedItems : CFStringRef;

external kMDQueryResultContentRelevance : CFStringRef;

external MDQuerySetSearchScope(
    query : MDQueryRef,
    scopeDirectories : CFArrayRef,
    scopeOptions : UInt);

external kMDQueryScopeHome : CFStringRef;

external kMDQueryScopeComputer : CFStringRef;

external kMDQueryScopeNetwork : CFStringRef;

external kMDQueryScopeAllIndexed : CFStringRef;

external kMDQueryScopeComputerIndexed : CFStringRef;

external kMDQueryScopeNetworkIndexed : CFStringRef;

external MDQuerySetMaxCount(
    query : MDQueryRef,
    size : CLong);

external MDSchemaCopyAttributesForContentType(
    contentTypeUTI : CFStringRef) : CFDictionaryRef;

external MDSchemaCopyMetaAttributesForAttribute(
    name : CFStringRef) : CFDictionaryRef;

external MDSchemaCopyAllAttributes() : CFArrayRef;

external MDSchemaCopyDisplayNameForAttribute(
    name : CFStringRef) : CFStringRef;

external MDSchemaCopyDisplayDescriptionForAttribute(
    name : CFStringRef) : CFStringRef;

external kMDAttributeDisplayValues : CFStringRef;

external kMDAttributeAllValues : CFStringRef;

external kMDAttributeReadOnlyValues : CFStringRef;

external kMDExporterAvaliable : CFStringRef;

external kMDAttributeName : CFStringRef;

external kMDAttributeType : CFStringRef;

external kMDAttributeMultiValued : CFStringRef;

alias DCSDictionaryRef = OpaquePointer;

external DCSGetTermRangeInString(
    dictionary : DCSDictionaryRef,
    textString : CFStringRef,
    offset : CLong) : CFRange;

external DCSCopyTextDefinition(
    dictionary : DCSDictionaryRef,
    textString : CFStringRef,
    range : CFRange) : CFStringRef;
