Browse Source

+ Apple universal interfaces for FPC

git-svn-id: trunk@3755 -
Jonas Maebe 19 years ago
parent
commit
2ded22701b
100 changed files with 46167 additions and 5 deletions
  1. 303 0
      .gitattributes
  2. 56 4
      packages/extra/Makefile
  3. 3 1
      packages/extra/Makefile.fpc
  4. 148 0
      packages/extra/univint/ABActions.pas
  5. 292 0
      packages/extra/univint/ABAddressBook.pas
  6. 353 0
      packages/extra/univint/ABGlobals.pas
  7. 265 0
      packages/extra/univint/ABPeoplePicker.pas
  8. 152 0
      packages/extra/univint/ABTypedefs.pas
  9. 957 0
      packages/extra/univint/AEDataModel.pas
  10. 387 0
      packages/extra/univint/AEHelpers.pas
  11. 400 0
      packages/extra/univint/AEInteraction.pas
  12. 222 0
      packages/extra/univint/AEMach.pas
  13. 604 0
      packages/extra/univint/AEObjects.pas
  14. 167 0
      packages/extra/univint/AEPackObject.pas
  15. 1005 0
      packages/extra/univint/AERegistry.pas
  16. 172 0
      packages/extra/univint/AEUserTermTypes.pas
  17. 290 0
      packages/extra/univint/AIFF.pas
  18. 286 0
      packages/extra/univint/ASDebugging.pas
  19. 374 0
      packages/extra/univint/ASRegistry.pas
  20. 970 0
      packages/extra/univint/ATSFont.pas
  21. 656 0
      packages/extra/univint/ATSLayoutTypes.pas
  22. 393 0
      packages/extra/univint/ATSTypes.pas
  23. 465 0
      packages/extra/univint/ATSUnicodeDirectAccess.pas
  24. 1695 0
      packages/extra/univint/ATSUnicodeDrawing.pas
  25. 821 0
      packages/extra/univint/ATSUnicodeFlattening.pas
  26. 1700 0
      packages/extra/univint/ATSUnicodeFonts.pas
  27. 1046 0
      packages/extra/univint/ATSUnicodeGlyphs.pas
  28. 2866 0
      packages/extra/univint/ATSUnicodeObjects.pas
  29. 1466 0
      packages/extra/univint/ATSUnicodeTypes.pas
  30. 545 0
      packages/extra/univint/AVLTree.pas
  31. 717 0
      packages/extra/univint/AXConstants.pas
  32. 121 0
      packages/extra/univint/AXErrors.pas
  33. 149 0
      packages/extra/univint/AXUIElement.pas
  34. 125 0
      packages/extra/univint/AXValue.pas
  35. 447 0
      packages/extra/univint/Aliases.pas
  36. 4683 0
      packages/extra/univint/Appearance.pas
  37. 216 0
      packages/extra/univint/AppleDiskPartitions.pas
  38. 248 0
      packages/extra/univint/AppleEvents.pas
  39. 284 0
      packages/extra/univint/AppleHelp.pas
  40. 253 0
      packages/extra/univint/AppleScript.pas
  41. 265 0
      packages/extra/univint/AuthSession.pas
  42. 481 0
      packages/extra/univint/Authorization.pas
  43. 223 0
      packages/extra/univint/AuthorizationDB.pas
  44. 162 0
      packages/extra/univint/AuthorizationTags.pas
  45. 751 0
      packages/extra/univint/CFArray.pas
  46. 245 0
      packages/extra/univint/CFAttributedString.pas
  47. 160 0
      packages/extra/univint/CFBag.pas
  48. 330 0
      packages/extra/univint/CFBase.pas
  49. 381 0
      packages/extra/univint/CFBinaryHeap.pas
  50. 128 0
      packages/extra/univint/CFBitVector.pas
  51. 342 0
      packages/extra/univint/CFBundle.pas
  52. 401 0
      packages/extra/univint/CFByteOrders.pas
  53. 191 0
      packages/extra/univint/CFCalendar.pas
  54. 460 0
      packages/extra/univint/CFCharacterSet.pas
  55. 136 0
      packages/extra/univint/CFData.pas
  56. 177 0
      packages/extra/univint/CFDate.pas
  57. 230 0
      packages/extra/univint/CFDateFormatter.pas
  58. 747 0
      packages/extra/univint/CFDictionary.pas
  59. 589 0
      packages/extra/univint/CFFTPStream.pas
  60. 408 0
      packages/extra/univint/CFHTTPMessage.pas
  61. 307 0
      packages/extra/univint/CFHTTPStream.pas
  62. 667 0
      packages/extra/univint/CFHost.pas
  63. 259 0
      packages/extra/univint/CFLocale.pas
  64. 130 0
      packages/extra/univint/CFMachPort.pas
  65. 144 0
      packages/extra/univint/CFMessagePort.pas
  66. 1112 0
      packages/extra/univint/CFNetServices.pas
  67. 161 0
      packages/extra/univint/CFNotificationCenter.pas
  68. 193 0
      packages/extra/univint/CFNumber.pas
  69. 283 0
      packages/extra/univint/CFNumberFormatter.pas
  70. 193 0
      packages/extra/univint/CFPlugIn.pas
  71. 213 0
      packages/extra/univint/CFPlugInCOM.pas
  72. 191 0
      packages/extra/univint/CFPreferences.pas
  73. 177 0
      packages/extra/univint/CFPropertyList.pas
  74. 487 0
      packages/extra/univint/CFRunLoop.pas
  75. 562 0
      packages/extra/univint/CFSet.pas
  76. 300 0
      packages/extra/univint/CFSocket.pas
  77. 616 0
      packages/extra/univint/CFSocketStream.pas
  78. 303 0
      packages/extra/univint/CFStream.pas
  79. 822 0
      packages/extra/univint/CFString.pas
  80. 265 0
      packages/extra/univint/CFStringEncodingExt.pas
  81. 130 0
      packages/extra/univint/CFTimeZone.pas
  82. 398 0
      packages/extra/univint/CFTree.pas
  83. 448 0
      packages/extra/univint/CFURL.pas
  84. 176 0
      packages/extra/univint/CFURLAccess.pas
  85. 149 0
      packages/extra/univint/CFUUID.pas
  86. 248 0
      packages/extra/univint/CFUserNotification.pas
  87. 278 0
      packages/extra/univint/CFXMLNode.pas
  88. 339 0
      packages/extra/univint/CFXMLParser.pas
  89. 221 0
      packages/extra/univint/CGAffineTransforms.pas
  90. 117 0
      packages/extra/univint/CGBase.pas
  91. 172 0
      packages/extra/univint/CGBitmapContext.pas
  92. 162 0
      packages/extra/univint/CGColor.pas
  93. 254 0
      packages/extra/univint/CGColorSpace.pas
  94. 863 0
      packages/extra/univint/CGContext.pas
  95. 152 0
      packages/extra/univint/CGDataConsumer.pas
  96. 230 0
      packages/extra/univint/CGDataProvider.pas
  97. 542 0
      packages/extra/univint/CGDirectDisplay.pas
  98. 202 0
      packages/extra/univint/CGDirectPalette.pas
  99. 343 0
      packages/extra/univint/CGDisplayConfiguration.pas
  100. 249 0
      packages/extra/univint/CGDisplayFade.pas

+ 303 - 0
.gitattributes

@@ -3324,6 +3324,309 @@ packages/extra/tcl/fpmake.pp svneol=native#text/plain
 packages/extra/tcl/tcl80.pp svneol=native#text/plain
 packages/extra/tcl/tcl_demo.pp svneol=native#text/plain
 packages/extra/tcl/test.tcl -text
+packages/extra/univint/ABActions.pas svneol=native#text/plain
+packages/extra/univint/ABAddressBook.pas svneol=native#text/plain
+packages/extra/univint/ABGlobals.pas svneol=native#text/plain
+packages/extra/univint/ABPeoplePicker.pas svneol=native#text/plain
+packages/extra/univint/ABTypedefs.pas svneol=native#text/plain
+packages/extra/univint/AEDataModel.pas svneol=native#text/plain
+packages/extra/univint/AEHelpers.pas svneol=native#text/plain
+packages/extra/univint/AEInteraction.pas svneol=native#text/plain
+packages/extra/univint/AEMach.pas svneol=native#text/plain
+packages/extra/univint/AEObjects.pas svneol=native#text/plain
+packages/extra/univint/AEPackObject.pas svneol=native#text/plain
+packages/extra/univint/AERegistry.pas svneol=native#text/plain
+packages/extra/univint/AEUserTermTypes.pas svneol=native#text/plain
+packages/extra/univint/AIFF.pas svneol=native#text/plain
+packages/extra/univint/ASDebugging.pas svneol=native#text/plain
+packages/extra/univint/ASRegistry.pas svneol=native#text/plain
+packages/extra/univint/ATSFont.pas svneol=native#text/plain
+packages/extra/univint/ATSLayoutTypes.pas svneol=native#text/plain
+packages/extra/univint/ATSTypes.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeDirectAccess.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeDrawing.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeFlattening.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeFonts.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeGlyphs.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeObjects.pas svneol=native#text/plain
+packages/extra/univint/ATSUnicodeTypes.pas svneol=native#text/plain
+packages/extra/univint/AVLTree.pas svneol=native#text/plain
+packages/extra/univint/AXConstants.pas svneol=native#text/plain
+packages/extra/univint/AXErrors.pas svneol=native#text/plain
+packages/extra/univint/AXUIElement.pas svneol=native#text/plain
+packages/extra/univint/AXValue.pas svneol=native#text/plain
+packages/extra/univint/Aliases.pas svneol=native#text/plain
+packages/extra/univint/Appearance.pas svneol=native#text/plain
+packages/extra/univint/AppleDiskPartitions.pas svneol=native#text/plain
+packages/extra/univint/AppleEvents.pas svneol=native#text/plain
+packages/extra/univint/AppleHelp.pas svneol=native#text/plain
+packages/extra/univint/AppleScript.pas svneol=native#text/plain
+packages/extra/univint/AuthSession.pas svneol=native#text/plain
+packages/extra/univint/Authorization.pas svneol=native#text/plain
+packages/extra/univint/AuthorizationDB.pas svneol=native#text/plain
+packages/extra/univint/AuthorizationTags.pas svneol=native#text/plain
+packages/extra/univint/CFArray.pas svneol=native#text/plain
+packages/extra/univint/CFAttributedString.pas svneol=native#text/plain
+packages/extra/univint/CFBag.pas svneol=native#text/plain
+packages/extra/univint/CFBase.pas svneol=native#text/plain
+packages/extra/univint/CFBinaryHeap.pas svneol=native#text/plain
+packages/extra/univint/CFBitVector.pas svneol=native#text/plain
+packages/extra/univint/CFBundle.pas svneol=native#text/plain
+packages/extra/univint/CFByteOrders.pas svneol=native#text/plain
+packages/extra/univint/CFCalendar.pas svneol=native#text/plain
+packages/extra/univint/CFCharacterSet.pas svneol=native#text/plain
+packages/extra/univint/CFData.pas svneol=native#text/plain
+packages/extra/univint/CFDate.pas svneol=native#text/plain
+packages/extra/univint/CFDateFormatter.pas svneol=native#text/plain
+packages/extra/univint/CFDictionary.pas svneol=native#text/plain
+packages/extra/univint/CFFTPStream.pas svneol=native#text/plain
+packages/extra/univint/CFHTTPMessage.pas svneol=native#text/plain
+packages/extra/univint/CFHTTPStream.pas svneol=native#text/plain
+packages/extra/univint/CFHost.pas svneol=native#text/plain
+packages/extra/univint/CFLocale.pas svneol=native#text/plain
+packages/extra/univint/CFMachPort.pas svneol=native#text/plain
+packages/extra/univint/CFMessagePort.pas svneol=native#text/plain
+packages/extra/univint/CFNetServices.pas svneol=native#text/plain
+packages/extra/univint/CFNotificationCenter.pas svneol=native#text/plain
+packages/extra/univint/CFNumber.pas svneol=native#text/plain
+packages/extra/univint/CFNumberFormatter.pas svneol=native#text/plain
+packages/extra/univint/CFPlugIn.pas svneol=native#text/plain
+packages/extra/univint/CFPlugInCOM.pas svneol=native#text/plain
+packages/extra/univint/CFPreferences.pas svneol=native#text/plain
+packages/extra/univint/CFPropertyList.pas svneol=native#text/plain
+packages/extra/univint/CFRunLoop.pas svneol=native#text/plain
+packages/extra/univint/CFSet.pas svneol=native#text/plain
+packages/extra/univint/CFSocket.pas svneol=native#text/plain
+packages/extra/univint/CFSocketStream.pas svneol=native#text/plain
+packages/extra/univint/CFStream.pas svneol=native#text/plain
+packages/extra/univint/CFString.pas svneol=native#text/plain
+packages/extra/univint/CFStringEncodingExt.pas svneol=native#text/plain
+packages/extra/univint/CFTimeZone.pas svneol=native#text/plain
+packages/extra/univint/CFTree.pas svneol=native#text/plain
+packages/extra/univint/CFURL.pas svneol=native#text/plain
+packages/extra/univint/CFURLAccess.pas svneol=native#text/plain
+packages/extra/univint/CFUUID.pas svneol=native#text/plain
+packages/extra/univint/CFUserNotification.pas svneol=native#text/plain
+packages/extra/univint/CFXMLNode.pas svneol=native#text/plain
+packages/extra/univint/CFXMLParser.pas svneol=native#text/plain
+packages/extra/univint/CGAffineTransforms.pas svneol=native#text/plain
+packages/extra/univint/CGBase.pas svneol=native#text/plain
+packages/extra/univint/CGBitmapContext.pas svneol=native#text/plain
+packages/extra/univint/CGColor.pas svneol=native#text/plain
+packages/extra/univint/CGColorSpace.pas svneol=native#text/plain
+packages/extra/univint/CGContext.pas svneol=native#text/plain
+packages/extra/univint/CGDataConsumer.pas svneol=native#text/plain
+packages/extra/univint/CGDataProvider.pas svneol=native#text/plain
+packages/extra/univint/CGDirectDisplay.pas svneol=native#text/plain
+packages/extra/univint/CGDirectPalette.pas svneol=native#text/plain
+packages/extra/univint/CGDisplayConfiguration.pas svneol=native#text/plain
+packages/extra/univint/CGDisplayFade.pas svneol=native#text/plain
+packages/extra/univint/CGErrors.pas svneol=native#text/plain
+packages/extra/univint/CGEvent.pas svneol=native#text/plain
+packages/extra/univint/CGEventSource.pas svneol=native#text/plain
+packages/extra/univint/CGEventTypes.pas svneol=native#text/plain
+packages/extra/univint/CGFont.pas svneol=native#text/plain
+packages/extra/univint/CGFunction.pas svneol=native#text/plain
+packages/extra/univint/CGGLContext.pas svneol=native#text/plain
+packages/extra/univint/CGGeometry.pas svneol=native#text/plain
+packages/extra/univint/CGImage.pas svneol=native#text/plain
+packages/extra/univint/CGLayer.pas svneol=native#text/plain
+packages/extra/univint/CGPDFArray.pas svneol=native#text/plain
+packages/extra/univint/CGPDFContentStream.pas svneol=native#text/plain
+packages/extra/univint/CGPDFContext.pas svneol=native#text/plain
+packages/extra/univint/CGPDFDictionary.pas svneol=native#text/plain
+packages/extra/univint/CGPDFDocument.pas svneol=native#text/plain
+packages/extra/univint/CGPDFObject.pas svneol=native#text/plain
+packages/extra/univint/CGPDFOperatorTable.pas svneol=native#text/plain
+packages/extra/univint/CGPDFPage.pas svneol=native#text/plain
+packages/extra/univint/CGPDFScanner.pas svneol=native#text/plain
+packages/extra/univint/CGPDFStream.pas svneol=native#text/plain
+packages/extra/univint/CGPDFString.pas svneol=native#text/plain
+packages/extra/univint/CGPSConverter.pas svneol=native#text/plain
+packages/extra/univint/CGPath.pas svneol=native#text/plain
+packages/extra/univint/CGPattern.pas svneol=native#text/plain
+packages/extra/univint/CGRemoteOperation.pas svneol=native#text/plain
+packages/extra/univint/CGSession.pas svneol=native#text/plain
+packages/extra/univint/CGShading.pas svneol=native#text/plain
+packages/extra/univint/CGWindowLevels.pas svneol=native#text/plain
+packages/extra/univint/CMApplication.pas svneol=native#text/plain
+packages/extra/univint/CMCalibrator.pas svneol=native#text/plain
+packages/extra/univint/CMDeviceIntegration.pas svneol=native#text/plain
+packages/extra/univint/CMICCProfile.pas svneol=native#text/plain
+packages/extra/univint/CMMComponent.pas svneol=native#text/plain
+packages/extra/univint/CMPRComponent.pas svneol=native#text/plain
+packages/extra/univint/CMScriptingPlugin.pas svneol=native#text/plain
+packages/extra/univint/CMTypes.pas svneol=native#text/plain
+packages/extra/univint/CarbonEvents.pas svneol=native#text/plain
+packages/extra/univint/CarbonEventsCore.pas svneol=native#text/plain
+packages/extra/univint/CodeFragments.pas svneol=native#text/plain
+packages/extra/univint/Collections.pas svneol=native#text/plain
+packages/extra/univint/ColorPicker.pas svneol=native#text/plain
+packages/extra/univint/Components.pas svneol=native#text/plain
+packages/extra/univint/ConditionalMacros.pas svneol=native#text/plain
+packages/extra/univint/ControlDefinitions.pas svneol=native#text/plain
+packages/extra/univint/Controls.pas svneol=native#text/plain
+packages/extra/univint/CoreFoundation.pas svneol=native#text/plain
+packages/extra/univint/CoreGraphics.pas svneol=native#text/plain
+packages/extra/univint/DHCPClientPreferences.pas svneol=native#text/plain
+packages/extra/univint/DateTimeUtils.pas svneol=native#text/plain
+packages/extra/univint/Debugging.pas svneol=native#text/plain
+packages/extra/univint/Devices.pas svneol=native#text/plain
+packages/extra/univint/Dialogs.pas svneol=native#text/plain
+packages/extra/univint/Dictionary.pas svneol=native#text/plain
+packages/extra/univint/Displays.pas svneol=native#text/plain
+packages/extra/univint/Drag.pas svneol=native#text/plain
+packages/extra/univint/DrawSprocket.pas svneol=native#text/plain
+packages/extra/univint/DriverFamilyMatching.pas svneol=native#text/plain
+packages/extra/univint/DriverGestalt.pas svneol=native#text/plain
+packages/extra/univint/DriverSynchronization.pas svneol=native#text/plain
+packages/extra/univint/Endian.pas svneol=native#text/plain
+packages/extra/univint/Events.pas svneol=native#text/plain
+packages/extra/univint/FPCMacOSAll.pas svneol=native#text/plain
+packages/extra/univint/FileTypesAndCreators.pas svneol=native#text/plain
+packages/extra/univint/Files.pas svneol=native#text/plain
+packages/extra/univint/FindByContent.pas svneol=native#text/plain
+packages/extra/univint/Finder.pas svneol=native#text/plain
+packages/extra/univint/FinderRegistry.pas svneol=native#text/plain
+packages/extra/univint/FixMath.pas svneol=native#text/plain
+packages/extra/univint/Folders.pas svneol=native#text/plain
+packages/extra/univint/FontSync.pas svneol=native#text/plain
+packages/extra/univint/Fonts.pas svneol=native#text/plain
+packages/extra/univint/GPCStrings.pas svneol=native#text/plain
+packages/extra/univint/GXTypes.pas svneol=native#text/plain
+packages/extra/univint/GestaltEqu.pas svneol=native#text/plain
+packages/extra/univint/HFSVolumes.pas svneol=native#text/plain
+packages/extra/univint/HIArchive.pas svneol=native#text/plain
+packages/extra/univint/HIGeometry.pas svneol=native#text/plain
+packages/extra/univint/HIObject.pas svneol=native#text/plain
+packages/extra/univint/HIObjectCore.pas svneol=native#text/plain
+packages/extra/univint/HIShape.pas svneol=native#text/plain
+packages/extra/univint/HITextUtils.pas svneol=native#text/plain
+packages/extra/univint/HITheme.pas svneol=native#text/plain
+packages/extra/univint/HIToolbar.pas svneol=native#text/plain
+packages/extra/univint/HIToolbox.pas svneol=native#text/plain
+packages/extra/univint/HIView.pas svneol=native#text/plain
+packages/extra/univint/HTMLRendering.pas svneol=native#text/plain
+packages/extra/univint/IBCarbonRuntime.pas svneol=native#text/plain
+packages/extra/univint/ICAApplication.pas svneol=native#text/plain
+packages/extra/univint/ICACamera.pas svneol=native#text/plain
+packages/extra/univint/ICADevice.pas svneol=native#text/plain
+packages/extra/univint/Icons.pas svneol=native#text/plain
+packages/extra/univint/ImageCodec.pas svneol=native#text/plain
+packages/extra/univint/ImageCompression.pas svneol=native#text/plain
+packages/extra/univint/InternetConfig.pas svneol=native#text/plain
+packages/extra/univint/IntlResources.pas svneol=native#text/plain
+packages/extra/univint/Keyboards.pas svneol=native#text/plain
+packages/extra/univint/KeychainCore.pas svneol=native#text/plain
+packages/extra/univint/KeychainHI.pas svneol=native#text/plain
+packages/extra/univint/LanguageAnalysis.pas svneol=native#text/plain
+packages/extra/univint/LaunchServices.pas svneol=native#text/plain
+packages/extra/univint/Lists.pas svneol=native#text/plain
+packages/extra/univint/LowMem.pas svneol=native#text/plain
+packages/extra/univint/MacApplication.pas svneol=native#text/plain
+packages/extra/univint/MacErrors.pas svneol=native#text/plain
+packages/extra/univint/MacHelp.pas svneol=native#text/plain
+packages/extra/univint/MacLocales.pas svneol=native#text/plain
+packages/extra/univint/MacMemory.pas svneol=native#text/plain
+packages/extra/univint/MacOS.pas svneol=native#text/plain
+packages/extra/univint/MacOSXPosix.pas svneol=native#text/plain
+packages/extra/univint/MacTextEditor.pas svneol=native#text/plain
+packages/extra/univint/MacTypes.pas svneol=native#text/plain
+packages/extra/univint/MacWindows.pas svneol=native#text/plain
+packages/extra/univint/MachineExceptions.pas svneol=native#text/plain
+packages/extra/univint/Makefile svneol=native#text/plain
+packages/extra/univint/Makefile.fpc svneol=native#text/plain
+packages/extra/univint/Math64.pas svneol=native#text/plain
+packages/extra/univint/MediaHandlers.pas svneol=native#text/plain
+packages/extra/univint/Menus.pas svneol=native#text/plain
+packages/extra/univint/MixedMode.pas svneol=native#text/plain
+packages/extra/univint/Movies.pas svneol=native#text/plain
+packages/extra/univint/MoviesFormat.pas svneol=native#text/plain
+packages/extra/univint/Multiprocessing.pas svneol=native#text/plain
+packages/extra/univint/NSL.pas svneol=native#text/plain
+packages/extra/univint/NSLCore.pas svneol=native#text/plain
+packages/extra/univint/NameRegistry.pas svneol=native#text/plain
+packages/extra/univint/Navigation.pas svneol=native#text/plain
+packages/extra/univint/Notification.pas svneol=native#text/plain
+packages/extra/univint/NumberFormatting.pas svneol=native#text/plain
+packages/extra/univint/OSA.pas svneol=native#text/plain
+packages/extra/univint/OSAComp.pas svneol=native#text/plain
+packages/extra/univint/OSAGeneric.pas svneol=native#text/plain
+packages/extra/univint/OSUtils.pas svneol=native#text/plain
+packages/extra/univint/OpenTransport.pas svneol=native#text/plain
+packages/extra/univint/OpenTransportProtocol.pas svneol=native#text/plain
+packages/extra/univint/OpenTransportProviders.pas svneol=native#text/plain
+packages/extra/univint/PEFBinaryFormat.pas svneol=native#text/plain
+packages/extra/univint/PLStringFuncs.pas svneol=native#text/plain
+packages/extra/univint/PMApplication.pas svneol=native#text/plain
+packages/extra/univint/PMCore.pas svneol=native#text/plain
+packages/extra/univint/PMDefinitions.pas svneol=native#text/plain
+packages/extra/univint/Palettes.pas svneol=native#text/plain
+packages/extra/univint/Pasteboard.pas svneol=native#text/plain
+packages/extra/univint/PictUtils.pas svneol=native#text/plain
+packages/extra/univint/Power.pas svneol=native#text/plain
+packages/extra/univint/Printing.pas svneol=native#text/plain
+packages/extra/univint/Processes.pas svneol=native#text/plain
+packages/extra/univint/QDOffscreen.pas svneol=native#text/plain
+packages/extra/univint/QDPictToCGContext.pas svneol=native#text/plain
+packages/extra/univint/QTML.pas svneol=native#text/plain
+packages/extra/univint/QTSMovie.pas svneol=native#text/plain
+packages/extra/univint/QTStreamingComponents.pas svneol=native#text/plain
+packages/extra/univint/QuickTimeComponents.pas svneol=native#text/plain
+packages/extra/univint/QuickTimeMusic.pas svneol=native#text/plain
+packages/extra/univint/QuickTimeStreaming.pas svneol=native#text/plain
+packages/extra/univint/QuickTimeVR.pas svneol=native#text/plain
+packages/extra/univint/QuickTimeVRFormat.pas svneol=native#text/plain
+packages/extra/univint/Quickdraw.pas svneol=native#text/plain
+packages/extra/univint/QuickdrawText.pas svneol=native#text/plain
+packages/extra/univint/Resources.pas svneol=native#text/plain
+packages/extra/univint/SCDynamicStore.pas svneol=native#text/plain
+packages/extra/univint/SCDynamicStoreCopyDHCPInfos.pas svneol=native#text/plain
+packages/extra/univint/SCDynamicStoreCopySpecific.pas svneol=native#text/plain
+packages/extra/univint/SCDynamicStoreKey.pas svneol=native#text/plain
+packages/extra/univint/SCNetwork.pas svneol=native#text/plain
+packages/extra/univint/SCNetworkConnection.pas svneol=native#text/plain
+packages/extra/univint/SCNetworkReachability.pas svneol=native#text/plain
+packages/extra/univint/SCPreferences.pas svneol=native#text/plain
+packages/extra/univint/SCPreferencesPath.pas svneol=native#text/plain
+packages/extra/univint/SCPreferencesSetSpecific.pas svneol=native#text/plain
+packages/extra/univint/SCSI.pas svneol=native#text/plain
+packages/extra/univint/SCSchemaDefinitions.pas svneol=native#text/plain
+packages/extra/univint/SFNTLayoutTypes.pas svneol=native#text/plain
+packages/extra/univint/SFNTTypes.pas svneol=native#text/plain
+packages/extra/univint/Scrap.pas svneol=native#text/plain
+packages/extra/univint/Script.pas svneol=native#text/plain
+packages/extra/univint/Sound.pas svneol=native#text/plain
+packages/extra/univint/SpeechRecognition.pas svneol=native#text/plain
+packages/extra/univint/SpeechSynthesis.pas svneol=native#text/plain
+packages/extra/univint/StringCompare.pas svneol=native#text/plain
+packages/extra/univint/SystemConfiguration.pas svneol=native#text/plain
+packages/extra/univint/SystemSound.pas svneol=native#text/plain
+packages/extra/univint/TSMTE.pas svneol=native#text/plain
+packages/extra/univint/TextCommon.pas svneol=native#text/plain
+packages/extra/univint/TextEdit.pas svneol=native#text/plain
+packages/extra/univint/TextEncodingConverter.pas svneol=native#text/plain
+packages/extra/univint/TextEncodingPlugin.pas svneol=native#text/plain
+packages/extra/univint/TextServices.pas svneol=native#text/plain
+packages/extra/univint/TextUtils.pas svneol=native#text/plain
+packages/extra/univint/Threads.pas svneol=native#text/plain
+packages/extra/univint/Timer.pas svneol=native#text/plain
+packages/extra/univint/ToolUtils.pas svneol=native#text/plain
+packages/extra/univint/Translation.pas svneol=native#text/plain
+packages/extra/univint/TranslationExtensions.pas svneol=native#text/plain
+packages/extra/univint/TypeSelect.pas svneol=native#text/plain
+packages/extra/univint/URLAccess.pas svneol=native#text/plain
+packages/extra/univint/USB.pas svneol=native#text/plain
+packages/extra/univint/UTCUtils.pas svneol=native#text/plain
+packages/extra/univint/UTType.pas svneol=native#text/plain
+packages/extra/univint/UnicodeConverter.pas svneol=native#text/plain
+packages/extra/univint/UnicodeUtilities.pas svneol=native#text/plain
+packages/extra/univint/Video.pas svneol=native#text/plain
+packages/extra/univint/WorldScript.pas svneol=native#text/plain
+packages/extra/univint/fenv.pas svneol=native#text/plain
+packages/extra/univint/fp.pas svneol=native#text/plain
+packages/extra/univint/vBLAS.pas svneol=native#text/plain
+packages/extra/univint/vDSP.pas svneol=native#text/plain
 packages/extra/unixutil/Makefile svneol=native#text/plain
 packages/extra/unixutil/Makefile.fpc svneol=native#text/plain
 packages/extra/unixutil/fpmake.inc svneol=native#text/plain

+ 56 - 4
packages/extra/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/04/23]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/05/30]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
@@ -258,7 +258,7 @@ ifeq ($(FULL_TARGET),i386-openbsd)
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1 univint
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_DIRS+=os2units rexx unzip zlib x11 gtk libpng tcl imlib fpgtk
@@ -294,7 +294,7 @@ ifeq ($(FULL_TARGET),powerpc-netbsd)
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1 univint
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
@@ -649,6 +649,11 @@ EXEEXT=
 HASSHAREDLIB=1
 SHORTSUFFIX=dwn
 endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1553,6 +1558,7 @@ TARGET_DIRS_FPGTK=1
 TARGET_DIRS_TCL=1
 TARGET_DIRS_IMLIB=1
 TARGET_DIRS_GNOME1=1
+TARGET_DIRS_UNIVINT=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 TARGET_DIRS_OS2UNITS=1
@@ -1744,6 +1750,7 @@ TARGET_DIRS_FPGTK=1
 TARGET_DIRS_TCL=1
 TARGET_DIRS_IMLIB=1
 TARGET_DIRS_GNOME1=1
+TARGET_DIRS_UNIVINT=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 TARGET_DIRS_UNZIP=1
@@ -3201,6 +3208,51 @@ rexx:
 	$(MAKE) -C rexx all
 .PHONY: rexx_all rexx_debug rexx_smart rexx_release rexx_units rexx_examples rexx_shared rexx_install rexx_sourceinstall rexx_exampleinstall rexx_distinstall rexx_zipinstall rexx_zipsourceinstall rexx_zipexampleinstall rexx_zipdistinstall rexx_clean rexx_distclean rexx_cleanall rexx_info rexx_makefiles rexx
 endif
+ifdef TARGET_DIRS_UNIVINT
+univint_all:
+	$(MAKE) -C univint all
+univint_debug:
+	$(MAKE) -C univint debug
+univint_smart:
+	$(MAKE) -C univint smart
+univint_release:
+	$(MAKE) -C univint release
+univint_units:
+	$(MAKE) -C univint units
+univint_examples:
+	$(MAKE) -C univint examples
+univint_shared:
+	$(MAKE) -C univint shared
+univint_install:
+	$(MAKE) -C univint install
+univint_sourceinstall:
+	$(MAKE) -C univint sourceinstall
+univint_exampleinstall:
+	$(MAKE) -C univint exampleinstall
+univint_distinstall:
+	$(MAKE) -C univint distinstall
+univint_zipinstall:
+	$(MAKE) -C univint zipinstall
+univint_zipsourceinstall:
+	$(MAKE) -C univint zipsourceinstall
+univint_zipexampleinstall:
+	$(MAKE) -C univint zipexampleinstall
+univint_zipdistinstall:
+	$(MAKE) -C univint zipdistinstall
+univint_clean:
+	$(MAKE) -C univint clean
+univint_distclean:
+	$(MAKE) -C univint distclean
+univint_cleanall:
+	$(MAKE) -C univint cleanall
+univint_info:
+	$(MAKE) -C univint info
+univint_makefiles:
+	$(MAKE) -C univint makefiles
+univint:
+	$(MAKE) -C univint all
+.PHONY: univint_all univint_debug univint_smart univint_release univint_units univint_examples univint_shared univint_install univint_sourceinstall univint_exampleinstall univint_distinstall univint_zipinstall univint_zipsourceinstall univint_zipexampleinstall univint_zipdistinstall univint_clean univint_distclean univint_cleanall univint_info univint_makefiles univint
+endif
 ifdef TARGET_DIRS_AMUNITS
 amunits_all:
 	$(MAKE) -C amunits all

+ 3 - 1
packages/extra/Makefile.fpc

@@ -44,7 +44,8 @@ dirs_netwlibc=unzip zlib
 dirs_darwin= unzip zlib fftw \
              x11 opengl gtk gtk2 syslog \
              forms svgalib ggi libpng libgd \
-             utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+             utmp bfd gdbm ncurses fpgtk tcl imlib gnome1 \
+             univint
 dirs_solaris= unzip zlib fftw \
              x11 opengl gtk gtk2 syslog \
              forms svgalib ggi libpng libgd \
@@ -56,3 +57,4 @@ fpcsubdir=packages/extra
 
 [default]
 fpcdir=../..
+

+ 148 - 0
packages/extra/univint/ABActions.pas

@@ -0,0 +1,148 @@
+//
+//  ABActionsC.h
+//  AddressBook Framework
+//
+//  Copyright (c) 2003 Apple Computer. All rights reserved.
+//
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ABActions;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ABAddressBook,CFBase;
+{$ALIGN MAC68K}
+
+// --------------------------------------------------------------------------------
+//      Action Support
+// --------------------------------------------------------------------------------
+// This API allows developers to populate AddressBook.app's roll-over menus with custom
+// entries. Your CFBundle must implement a function named ABActionRegisterCallbacks which
+// will return a pointer to an ABActionCallbacks struct. This struct should be filled out
+// as follows:
+//
+// version: The version of this structure is 0.
+//
+// proprty: A pointer to a function that returns the AddressBook property this action applies
+// to. Only items with labels may have actions at this time. (emails, phones, birthdays, etc)
+//
+// title: A pointer to a function which returns a copy of the title to be displayed. This function
+// takes two parameters, the selected person and item identifier. The item identifier will be NULL
+// for single value properties. AddressBook will release this string when it's done with it.
+//
+// enabled: A pointer to a function which returns YES if the action should be enabled for the
+// passed ABPersonRef and item identifier. The item identifier will be NULL for single value
+// properties. This field may be NULL. Actions with NULL enabled callbacks will always be enabled.
+//
+// selected. A pointer to a function which will be called when the user selects this action.
+// It's passed an ABPersonRef and item identifier. The item identifier will be NULL for single
+// value properties.
+//
+// Action plugins are stored in ~/Library/Address Book Plug-Ins or /Library/Address Book Plug-Ins
+//
+// There can be only 1 Action plug in per bundle.
+
+type ABActionGetPropertyCallback = function: CFStringRef;
+type ABActionCopyTitleCallback = function( person: ABPersonRef; identifier: CFStringRef ): CFStringRef;
+type ABActionEnabledCallback = function( person: ABPersonRef; identifier: CFStringRef ): Boolean;
+type ABActionSelectedCallback = procedure( person: ABPersonRef; identifier: CFStringRef );
+
+type ABActionCallbacks = record
+    version: CFIndex;
+    proprty: ABActionGetPropertyCallback;
+    title: ABActionCopyTitleCallback;
+    enabled: ABActionEnabledCallback;
+    selected: ABActionSelectedCallback;
+end;
+
+// Your CFBundle MUST include a function named ABActionRegisterCallbacks which returns a pointer
+// to a filled out ABActionCallbacks struct:
+//
+// ABActionCallbacks* ABActionRegisterCallbacks(void);
+
+end.

+ 292 - 0
packages/extra/univint/ABAddressBook.pas

@@ -0,0 +1,292 @@
+//
+//  ABAddressBookC.h
+//  AddressBook Framework
+//
+//  Copyright (c) 2002-2003 Apple Computer. All rights reserved.
+//
+
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ABAddressBook;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ABTypedefs,ABGlobals,CFBase,CFArray,CFDictionary,CFData;
+{$ALIGN MAC68K}
+
+type
+	ABRecordRef    = ^SInt32; { an opaque 32-bit type }
+	ABPersonRef    = ^SInt32; { an opaque 32-bit type }
+	ABGroupRef    = ^SInt32; { an opaque 32-bit type }
+	ABSearchElementRef    = ^SInt32; { an opaque 32-bit type }
+	ABAddressBookRef    = ^SInt32; { an opaque 32-bit type }
+	ABMultiValueRef    = ^SInt32; { an opaque 32-bit type }
+	ABMutableMultiValueRef    = ^SInt32; { an opaque 32-bit type }
+
+// --------------------------------------------------------------------------------
+//	LSOpenCFURLRef support
+// --------------------------------------------------------------------------------
+// An application can open the AddressBook app and select (and edit) a specific
+// person by using the LSOpenCFURLRef API.
+//
+// To launch (or bring to front) the Address Book app and select a given person
+//
+// CFStringRef uniqueId = ABRecordCopyUniqueId(aPerson);
+// CFStringRef urlString = CFStringCreateWithFormat(NULL, CFSTR(addressbook://%@), uniqueId);
+// CFURLRef urlRef = CFURLCreateWithString(NULL, urlString, NULL);
+// LSOpenCFURLRef(urlRef, NULL);
+// CFRelease(uniqueId);
+// CFRelease(urlRef);
+// CFRelease(urlString);
+//
+// To launch (or bring to front) the Address Book app and edit a given person
+//
+// CFStringRef uniqueId = ABRecordCopyUniqueId(aPerson);
+// CFStringRef urlString = CFStringCreateWithFormat(NULL, CFSTR(addressbook://%@?edit), uniqueId);
+// CFURLRef urlRef = CFURLCreateWithString(NULL, urlString, NULL);
+// LSOpenCFURLRef(urlRef, NULL);
+// CFRelease(uniqueId);
+// CFRelease(urlRef);
+// CFRelease(urlString);
+
+// --------------------------------------------------------------------------------
+//      AddressBook
+// --------------------------------------------------------------------------------
+
+    // --- There is only one Address Book
+function ABGetSharedAddressBook: ABAddressBookRef; external name '_ABGetSharedAddressBook';
+
+    // --- Searching
+function ABCopyArrayOfMatchingRecords( addressBook: ABAddressBookRef; search: ABSearchElementRef ): CFArrayRef; external name '_ABCopyArrayOfMatchingRecords';
+
+    // --- Saving
+function ABSave( addressBook: ABAddressBookRef ): Boolean; external name '_ABSave';
+function ABHasUnsavedChanges( addressBook: ABAddressBookRef ): Boolean; external name '_ABHasUnsavedChanges';
+
+    // --- Me
+function ABGetMe( addressBook: ABAddressBookRef ): ABPersonRef; external name '_ABGetMe'; // Not retain???
+procedure ABSetMe( addressBook: ABAddressBookRef; moi: ABPersonRef ); external name '_ABSetMe';
+
+    // Returns the record class Name for a particular uniqueId
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABCopyRecordTypeFromUniqueId( addressBook: ABAddressBookRef; uniqueId: CFStringRef ): CFStringRef; external name '_ABCopyRecordTypeFromUniqueId';
+
+    // --- Properties
+    // Property names must be unique for a record type
+function ABAddPropertiesAndTypes( addressBook: ABAddressBookRef; recordType: CFStringRef; propertiesAnTypes: CFDictionaryRef ): SInt32; external name '_ABAddPropertiesAndTypes';
+function ABRemoveProperties( addressBook: ABAddressBookRef; recordType: CFStringRef; properties: CFArrayRef ): SInt32; external name '_ABRemoveProperties';
+function ABCopyArrayOfPropertiesForRecordType( addressBook: ABAddressBookRef; recordType: CFStringRef ): CFArrayRef; external name '_ABCopyArrayOfPropertiesForRecordType';
+function ABTypeOfProperty( addressBook: ABAddressBookRef; recordType: CFStringRef; proprty: CFStringRef ): ABPropertyType; external name '_ABTypeOfProperty';
+
+    // --- Records (Person, Group)
+function ABCopyRecordForUniqueId( addressBook: ABAddressBookRef; uniqueId: CFStringRef ): ABRecordRef; external name '_ABCopyRecordForUniqueId';
+function ABAddRecord( addressBook: ABAddressBookRef; recrd: ABRecordRef ): Boolean; external name '_ABAddRecord';
+function ABRemoveRecord( addressBook: ABAddressBookRef; recrd: ABRecordRef ): Boolean; external name '_ABRemoveRecord';
+
+    // --- People
+function ABCopyArrayOfAllPeople( addressBook: ABAddressBookRef ): CFArrayRef; external name '_ABCopyArrayOfAllPeople';                  // Array of ABPerson
+
+    // --- Groups
+function ABCopyArrayOfAllGroups( addressBook: ABAddressBookRef ): CFArrayRef; external name '_ABCopyArrayOfAllGroups';                  // Array of ABGroup
+
+// --------------------------------------------------------------------------------
+//      ABRecord
+// --------------------------------------------------------------------------------
+
+function ABRecordCopyRecordType( recrd: ABRecordRef ): CFStringRef; external name '_ABRecordCopyRecordType';
+
+    // --- Property value
+function ABRecordCopyValue( recrd: ABRecordRef; proprty: CFStringRef ): CFTypeRef; external name '_ABRecordCopyValue';
+    // returns a CFDictionary for multi-value properties
+function ABRecordSetValue( recrd: ABRecordRef; proprty: CFStringRef; value: CFTypeRef ): Boolean; external name '_ABRecordSetValue';
+    // takes a CFDictionary for multi-value properties
+function ABRecordRemoveValue( recrd: ABRecordRef; proprty: CFStringRef ): Boolean; external name '_ABRecordRemoveValue';
+
+    // ---- Unique ID access convenience
+function ABRecordCopyUniqueId( recrd: ABRecordRef ): CFStringRef; external name '_ABRecordCopyUniqueId';
+
+// --------------------------------------------------------------------------------
+//      ABPerson
+// --------------------------------------------------------------------------------
+
+function ABPersonCreate: ABPersonRef; external name '_ABPersonCreate';
+
+function ABPersonCreateWithVCardRepresentation( vCard: CFDataRef ): ABPersonRef; external name '_ABPersonCreateWithVCardRepresentation';
+function ABPersonCopyVCardRepresentation( person: ABPersonRef ): CFDataRef; external name '_ABPersonCopyVCardRepresentation';
+
+function ABPersonCopyParentGroups( person: ABPersonRef ): CFArrayRef; external name '_ABPersonCopyParentGroups'; // Groups this person belongs to
+
+    // --- Search elements
+function ABPersonCreateSearchElement( proprty: CFStringRef; labl: CFStringRef; key: CFStringRef; value: CFTypeRef; comparison: ABSearchComparison ): ABSearchElementRef; external name '_ABPersonCreateSearchElement';
+
+// --------------------------------------------------------------------------------
+//      ABGroups
+// --------------------------------------------------------------------------------
+
+function ABGroupCreate: ABGroupRef; external name '_ABGroupCreate';
+
+    // --- Dealing with Persons
+function ABGroupCopyArrayOfAllMembers( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyArrayOfAllMembers';
+function ABGroupAddMember( group: ABGroupRef; personToAdd: ABPersonRef ): Boolean; external name '_ABGroupAddMember';
+function ABGroupRemoveMember( group: ABGroupRef; personToRemove: ABPersonRef ): Boolean; external name '_ABGroupRemoveMember';
+
+    // --- Dealing with Groups
+function ABGroupCopyArrayOfAllSubgroups( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyArrayOfAllSubgroups';
+function ABGroupAddGroup( group: ABGroupRef; groupToAdd: ABGroupRef ): Boolean; external name '_ABGroupAddGroup';
+function ABGroupRemoveGroup( group: ABGroupRef; groupToRemove: ABGroupRef ): Boolean; external name '_ABGroupRemoveGroup';
+
+    // --- Dealong with Parents
+function ABGroupCopyParentGroups( group: ABGroupRef ): CFArrayRef; external name '_ABGroupCopyParentGroups';
+
+    // --- Distribution list
+function ABGroupSetDistributionIdentifier( group: ABGroupRef; person: ABPersonRef; proprty: CFStringRef; identifier: CFStringRef ): Boolean; external name '_ABGroupSetDistributionIdentifier';
+function ABGroupCopyDistributionIdentifier( group: ABGroupRef; person: ABPersonRef; proprty: CFStringRef ): CFStringRef; external name '_ABGroupCopyDistributionIdentifier';
+
+    // --- Search elements
+function ABGroupCreateSearchElement( proprty: CFStringRef; labl: CFStringRef; key: CFStringRef; value: CFTypeRef; comparison: ABSearchComparison ): ABSearchElementRef; external name '_ABGroupCreateSearchElement';
+
+// --------------------------------------------------------------------------------
+//      ABSearchElement
+// --------------------------------------------------------------------------------
+
+function ABSearchElementCreateWithConjunction( conjunction: ABSearchConjunction; childrenSearchElement: CFArrayRef ): ABSearchElementRef; external name '_ABSearchElementCreateWithConjunction';
+
+function ABSearchElementMatchesRecord( searchElement: ABSearchElementRef; recrd: ABRecordRef ): Boolean; external name '_ABSearchElementMatchesRecord';
+
+// --------------------------------------------------------------------------------
+//      ABMultiValue
+// --------------------------------------------------------------------------------
+
+function ABMultiValueCreate: ABMultiValueRef; external name '_ABMultiValueCreate';
+function ABMultiValueCount( multiValue: ABMultiValueRef ): UInt32; external name '_ABMultiValueCount';
+function ABMultiValueCopyValueAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFTypeRef; external name '_ABMultiValueCopyValueAtIndex';
+function ABMultiValueCopyLabelAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFStringRef; external name '_ABMultiValueCopyLabelAtIndex';
+function ABMultiValueCopyPrimaryIdentifier( multiValue: ABMultiValueRef ): CFStringRef; external name '_ABMultiValueCopyPrimaryIdentifier';
+function ABMultiValueIndexForIdentifier( multiValue: ABMultiValueRef; identifier: CFStringRef ): SInt32; external name '_ABMultiValueIndexForIdentifier';
+function ABMultiValueCopyIdentifierAtIndex( multiValue: ABMultiValueRef; index: SInt32 ): CFStringRef; external name '_ABMultiValueCopyIdentifierAtIndex';
+function ABMultiValuePropertyType( multiValue: ABMultiValueRef ): ABPropertyType; external name '_ABMultiValuePropertyType';
+function ABMultiValueCreateCopy( multiValue: ABMultiValueRef ): ABMultiValueRef; external name '_ABMultiValueCreateCopy';
+
+// --------------------------------------------------------------------------------
+//      ABMutableMultiValue
+// --------------------------------------------------------------------------------
+
+function ABMultiValueCreateMutable: ABMutableMultiValueRef; external name '_ABMultiValueCreateMutable';
+function ABMultiValueAdd( multiValue: ABMutableMultiValueRef; value: CFTypeRef; labl: CFStringRef; var outIdentifier: CFStringRef ): Boolean; external name '_ABMultiValueAdd';
+function ABMultiValueInsert( multiValue: ABMutableMultiValueRef; value: CFTypeRef; labl: CFStringRef; index: SInt32; var outIdentifier: CFStringRef ): Boolean; external name '_ABMultiValueInsert';
+function ABMultiValueRemove( multiValue: ABMutableMultiValueRef; index: SInt32 ): Boolean; external name '_ABMultiValueRemove';
+function ABMultiValueReplaceValue( multiValue: ABMutableMultiValueRef; value: CFTypeRef; index: SInt32 ): Boolean; external name '_ABMultiValueReplaceValue';
+function ABMultiValueReplaceLabel( multiValue: ABMutableMultiValueRef; labl: CFStringRef; index: SInt32 ): Boolean; external name '_ABMultiValueReplaceLabel';
+function ABMultiValueSetPrimaryIdentifier( multiValue: ABMutableMultiValueRef; identifier: CFStringRef ): Boolean; external name '_ABMultiValueSetPrimaryIdentifier';
+function ABMultiValueCreateMutableCopy( multiValue: ABMultiValueRef ): ABMutableMultiValueRef; external name '_ABMultiValueCreateMutableCopy';
+
+// --------------------------------------------------------------------------------
+//      Localization of properties or labels
+// --------------------------------------------------------------------------------
+
+function ABCopyLocalizedPropertyOrLabel( labelOrProperty: CFStringRef ): CFStringRef; external name '_ABCopyLocalizedPropertyOrLabel';
+
+// --- Address formatting
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABCreateFormattedAddressFromDictionary( addressBook: ABAddressBookRef; address: CFDictionaryRef ): CFStringRef; external name '_ABCreateFormattedAddressFromDictionary';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABCopyDefaultCountryCode( addressBook: ABAddressBookRef ): CFStringRef; external name '_ABCopyDefaultCountryCode';
+
+// --------------------------------------------------------------------------------
+//      Person Image Loading
+// --------------------------------------------------------------------------------
+
+function ABPersonSetImageData( person: ABPersonRef; imageData: CFDataRef ): Boolean; external name '_ABPersonSetImageData';
+function ABPersonCopyImageData( person: ABPersonRef ): CFDataRef; external name '_ABPersonCopyImageData';
+
+type ABImageClientCallback = procedure ( imageData: CFDataRef; tag: SInt32; refcon: UnivPtr );
+
+function ABBeginLoadingImageDataForClient( person: ABPersonRef; callback: ABImageClientCallback; refcon: UnivPtr ): SInt32; external name '_ABBeginLoadingImageDataForClient';
+procedure ABCancelLoadingImageDataForTag( tag: SInt32 ); external name '_ABCancelLoadingImageDataForTag';
+
+end.

+ 353 - 0
packages/extra/univint/ABGlobals.pas

@@ -0,0 +1,353 @@
+{
+ *  ABGlobals.h
+ *  AddressBook Framework
+ *
+ *  Copyright (c) 2002-2003 Apple Computer. All rights reserved.
+ *
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, Feburary 2006 }
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ABGlobals;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+// NOTE: This header is for C programmers. For Objective-C use ABGlobals.h
+
+// ================================================================
+//      Global Table properties
+// ================================================================
+
+// ----- Properties common to all Records
+
+var kABUIDProperty: CFStringRef; external name '_kABUIDProperty'; (* attribute const *)                   // The UID property - kABStringProperty
+var kABCreationDateProperty: CFStringRef; external name '_kABCreationDateProperty'; (* attribute const *)          // Creation Date (when first saved) - kABDateProperty
+var kABModificationDateProperty: CFStringRef; external name '_kABModificationDateProperty'; (* attribute const *)      // Last saved date - kABDateProperty
+
+// ----- Person specific properties
+
+var kABFirstNameProperty: CFStringRef; external name '_kABFirstNameProperty'; (* attribute const *)             // First name - kABStringProperty
+var kABLastNameProperty: CFStringRef; external name '_kABLastNameProperty'; (* attribute const *)              // Last name - kABStringProperty
+
+var kABFirstNamePhoneticProperty: CFStringRef; external name '_kABFirstNamePhoneticProperty'; (* attribute const *)     // First name Phonetic - kABStringProperty
+var kABLastNamePhoneticProperty: CFStringRef; external name '_kABLastNamePhoneticProperty'; (* attribute const *)      // Last name Phonetic - kABStringProperty
+
+var kABNicknameProperty: CFStringRef; external name '_kABNicknameProperty'; (* attribute const *)              // kABStringProperty
+var kABMaidenNameProperty: CFStringRef; external name '_kABMaidenNameProperty'; (* attribute const *)            // kABStringProperty
+
+var kABBirthdayProperty: CFStringRef; external name '_kABBirthdayProperty'; (* attribute const *)              // Birth date - kABDateProperty
+
+var kABOrganizationProperty: CFStringRef; external name '_kABOrganizationProperty'; (* attribute const *)          // Company name - kABStringProperty
+
+var kABJobTitleProperty: CFStringRef; external name '_kABJobTitleProperty'; (* attribute const *)              // Job Title - kABStringProperty
+
+// Deprecated in Mac OS 10.4. You should use kABURLsProperty.
+var kABHomePageProperty: CFStringRef; external name '_kABHomePageProperty'; (* attribute const *)              // Home Web page - kABStringProperty
+
+var kABURLsProperty: CFStringRef; external name '_kABURLsProperty'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)          // URLs - kABMultiStringProperty
+var kABHomePageLabel: CFStringRef; external name '_kABHomePageLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // Homepage URL
+
+var kABEmailProperty: CFStringRef; external name '_kABEmailProperty'; (* attribute const *)                 // Email(s) - kABMultiStringProperty
+var kABEmailWorkLabel: CFStringRef; external name '_kABEmailWorkLabel'; (* attribute const *)        // Home email
+var kABEmailHomeLabel: CFStringRef; external name '_kABEmailHomeLabel'; (* attribute const *)        // Work email
+
+var kABAddressProperty: CFStringRef; external name '_kABAddressProperty'; (* attribute const *)                // Street Addresses - kABMultiDictionaryProperty
+var kABAddressStreetKey: CFStringRef; external name '_kABAddressStreetKey'; (* attribute const *)           // Street
+var kABAddressCityKey: CFStringRef; external name '_kABAddressCityKey'; (* attribute const *)             // City
+var kABAddressStateKey: CFStringRef; external name '_kABAddressStateKey'; (* attribute const *)            // State
+var kABAddressZIPKey: CFStringRef; external name '_kABAddressZIPKey'; (* attribute const *)              // Zip
+var kABAddressCountryKey: CFStringRef; external name '_kABAddressCountryKey'; (* attribute const *)          // Country
+var kABAddressCountryCodeKey: CFStringRef; external name '_kABAddressCountryCodeKey'; (* attribute const *)      // Country Code
+var kABAddressHomeLabel: CFStringRef; external name '_kABAddressHomeLabel'; (* attribute const *)       // Home Address
+var kABAddressWorkLabel: CFStringRef; external name '_kABAddressWorkLabel'; (* attribute const *)       // Work Address
+
+{
+ * kABAddressCountryCodeKey code must be one of the following:
+ * iso country codes
+ *
+ *    ae = United Arab Emirates
+ *    ar = Argentina
+ *    at = Austria
+ *    au = Australia
+ *    ba = Bosnia and Herzegovina
+ *    be = Belgium
+ *    bg = Bulgaria
+ *    bh = Bahrain
+ *    br = Brazil
+ *    ca = Canada
+ *    ch = Switzerland
+ *    cn = China
+ *    cs = Czech
+ *    de = Germany
+ *    dk = Denmark
+ *    eg = Egypt
+ *    es = Spain
+ *    fi = Finland
+ *    fr = France
+ *    gr = Greece
+ *    gl = Greenland
+ *    hk = Hong Kong
+ *    hr = Croatia
+ *    hu = Hungary
+ *    ie = Ireland
+ *    il = Israel
+ *    id = Indonesia
+ *    in = India
+ *    is = Iceland
+ *    it = Italy
+ *    ja = Japan
+ *    jo = Jordan
+ *    kr = South Korea
+ *    kw = Kuwait
+ *    lb = Lebanon
+ *    lu = Luxembourg
+ *    mk = Macedonia
+ *    mx = Mexico
+ *    nl = Netherlands
+ *    no = Norway
+ *    nz = New Zealand
+ *    om = Oman
+ *    pl = Poland
+ *    pt = Portugal
+ *    qa = Qatar
+ *    ro = Romania
+ *    ru = Russian Federation
+ *    sa = Saudi Arabia
+ *    se = Sweden
+ *    sg = Singapore
+ *    si = Slovenia
+ *    sk = Slovakia
+ *    sy = Syrian Arab Republic
+ *    tw = Taiwan
+ *    tr = Turkey
+ *    ua = Ukraine
+ *    uk = United Kingdom
+ *    us = United States
+ *    ye = Yemen
+ *    yu = Serbia and Montenegro
+ *    za = South Africa
+ *
+ }
+
+var kABOtherDatesProperty: CFStringRef; external name '_kABOtherDatesProperty'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)       // Dates associated with this person - kABMultiDateProperty - (Person)
+var kABAnniversaryLabel: CFStringRef; external name '_kABAnniversaryLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+var kABRelatedNamesProperty: CFStringRef; external name '_kABRelatedNamesProperty'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)       // names - kABMultiStringProperty
+var kABFatherLabel: CFStringRef; external name '_kABFatherLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABMotherLabel: CFStringRef; external name '_kABMotherLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABParentLabel: CFStringRef; external name '_kABParentLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABBrotherLabel: CFStringRef; external name '_kABBrotherLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABSisterLabel: CFStringRef; external name '_kABSisterLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABChildLabel: CFStringRef; external name '_kABChildLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABFriendLabel: CFStringRef; external name '_kABFriendLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABSpouseLabel: CFStringRef; external name '_kABSpouseLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABPartnerLabel: CFStringRef; external name '_kABPartnerLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABAssistantLabel: CFStringRef; external name '_kABAssistantLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABManagerLabel: CFStringRef; external name '_kABManagerLabel'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+var kABDepartmentProperty: CFStringRef; external name '_kABDepartmentProperty'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)     // Department name - (Person)
+
+var kABPersonFlags: CFStringRef; external name '_kABPersonFlags'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)     // Various flags - kABIntegerProperty
+
+const	
+	kABShowAsMask = 7;
+	kABShowAsPerson = 0;
+	kABShowAsCompany = 1;
+	
+	kABNameOrderingMask = 7 shl 3;
+	kABDefaultNameOrdering = 0 shl 3;
+	kABFirstNameFirst = 4 shl 3;
+	kABLastNameFirst = 2 shl 3;
+
+var kABPhoneProperty: CFStringRef; external name '_kABPhoneProperty'; (* attribute const *)                  // Generic phone number - kABMultiStringProperty
+var kABPhoneWorkLabel: CFStringRef; external name '_kABPhoneWorkLabel'; (* attribute const *)         // Work phone
+var kABPhoneHomeLabel: CFStringRef; external name '_kABPhoneHomeLabel'; (* attribute const *)         // Home phone
+var kABPhoneMobileLabel: CFStringRef; external name '_kABPhoneMobileLabel'; (* attribute const *)       // Cell phone
+var kABPhoneMainLabel: CFStringRef; external name '_kABPhoneMainLabel'; (* attribute const *)         // Main phone
+var kABPhoneHomeFAXLabel: CFStringRef; external name '_kABPhoneHomeFAXLabel'; (* attribute const *)      // FAX number
+var kABPhoneWorkFAXLabel: CFStringRef; external name '_kABPhoneWorkFAXLabel'; (* attribute const *)      // FAX number
+var kABPhonePagerLabel: CFStringRef; external name '_kABPhonePagerLabel'; (* attribute const *)        // Pager number
+
+var kABAIMInstantProperty: CFStringRef; external name '_kABAIMInstantProperty'; (* attribute const *)             // AIM Instant Messaging - kABMultiStringProperty
+var kABAIMWorkLabel: CFStringRef; external name '_kABAIMWorkLabel'; (* attribute const *)
+var kABAIMHomeLabel: CFStringRef; external name '_kABAIMHomeLabel'; (* attribute const *)
+
+var kABJabberInstantProperty: CFStringRef; external name '_kABJabberInstantProperty'; (* attribute const *)          // Jabber Instant Messaging - kABMultiStringProperty
+var kABJabberWorkLabel: CFStringRef; external name '_kABJabberWorkLabel'; (* attribute const *)
+var kABJabberHomeLabel: CFStringRef; external name '_kABJabberHomeLabel'; (* attribute const *)
+
+var kABMSNInstantProperty: CFStringRef; external name '_kABMSNInstantProperty'; (* attribute const *)             // MSN Instant Messaging  - kABMultiStringProperty
+var kABMSNWorkLabel: CFStringRef; external name '_kABMSNWorkLabel'; (* attribute const *)
+var kABMSNHomeLabel: CFStringRef; external name '_kABMSNHomeLabel'; (* attribute const *)
+
+var kABYahooInstantProperty: CFStringRef; external name '_kABYahooInstantProperty'; (* attribute const *)           // Yahoo Instant Messaging  - kABMultiStringProperty
+var kABYahooWorkLabel: CFStringRef; external name '_kABYahooWorkLabel'; (* attribute const *)
+var kABYahooHomeLabel: CFStringRef; external name '_kABYahooHomeLabel'; (* attribute const *)
+
+var kABICQInstantProperty: CFStringRef; external name '_kABICQInstantProperty'; (* attribute const *)             // ICQ Instant Messaging  - kABMultiStringProperty
+var kABICQWorkLabel: CFStringRef; external name '_kABICQWorkLabel'; (* attribute const *)
+var kABICQHomeLabel: CFStringRef; external name '_kABICQHomeLabel'; (* attribute const *)
+
+var kABNoteProperty: CFStringRef; external name '_kABNoteProperty'; (* attribute const *)                   // Note - kABStringProperty
+
+var kABMiddleNameProperty: CFStringRef; external name '_kABMiddleNameProperty'; (* attribute const *)             // kABStringProperty
+var kABMiddleNamePhoneticProperty: CFStringRef; external name '_kABMiddleNamePhoneticProperty'; (* attribute const *)     // kABStringProperty
+var kABTitleProperty: CFStringRef; external name '_kABTitleProperty'; (* attribute const *)                  // kABStringProperty "Sir" "Duke" "General" "Lord"
+var kABSuffixProperty: CFStringRef; external name '_kABSuffixProperty'; (* attribute const *)                 // kABStringProperty "Sr." "Jr." "III"
+
+// ----- Group Specific Properties
+
+var kABGroupNameProperty: CFStringRef; external name '_kABGroupNameProperty'; (* attribute const *)              // Name of the group - kABStringProperty
+
+// ================================================================
+//      Generic Labels
+// ================================================================
+
+    // All kABXXXXWorkLabel are equivalent to this label
+var kABWorkLabel: CFStringRef; external name '_kABWorkLabel'; (* attribute const *)
+
+    // All kABXXXXHomeLabel are equivalent to this label
+var kABHomeLabel: CFStringRef; external name '_kABHomeLabel'; (* attribute const *)
+
+    // Can be used with any multi-value property
+var kABOtherLabel: CFStringRef; external name '_kABOtherLabel'; (* attribute const *)
+
+// ================================================================
+//      Notifications published when something changes
+// ================================================================
+// These notifications are not sent until ABGetSharedAddressBook()
+// has been called somewhere
+
+    // This process has changed the DB
+var kABDatabaseChangedNotification: CFStringRef; external name '_kABDatabaseChangedNotification'; (* attribute const *)
+
+    // Another process has changed the DB
+var kABDatabaseChangedExternallyNotification: CFStringRef; external name '_kABDatabaseChangedExternallyNotification'; (* attribute const *)
+
+    // The user info (dictionary) in the above notification will contain
+    // the following 3 keys. Value for each keys is an array of
+    // uniqueId of the Inserted/Updated/Deleted Records.
+    // If all three values are nil assume that everything has changed (could be the case
+    // when restoring from backup)
+var kABInsertedRecords: CFStringRef; external name '_kABInsertedRecords'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABUpdatedRecords: CFStringRef; external name '_kABUpdatedRecords'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kABDeletedRecords: CFStringRef; external name '_kABDeletedRecords'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+
+// ================================================================
+//      Localization of property or label
+// ================================================================
+
+    // Returns the localized version of built in properties, labels or keys
+    // Returns propertyOrLabel if not found (e.g. if not built in)
+function ABLocalizedPropertyOrLabel( propertyOrLabel: CFStringRef ): CFStringRef; external name '_ABLocalizedPropertyOrLabel';
+
+end.

+ 265 - 0
packages/extra/univint/ABPeoplePicker.pas

@@ -0,0 +1,265 @@
+//
+//  ABPeoplePickerC.h
+//  AddressBook Framework
+//
+//  Copyright (c) 2003 Apple Computer. All rights reserved.
+//
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ABPeoplePicker;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ABAddressBook,CFBase,CFArray,CGGeometry,Drag,HIObjectCore,HIGeometry;
+{$ALIGN MAC68K}
+
+type
+	ABPickerRef							= ^SInt32;
+
+{
+ * Picker creation and manipulation
+ }
+
+// Creates an ABPickerRef. Release with CFRelease(). The window is created hidden. Call
+// ABPickerSetVisibility() to show it.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCreate: ABPickerRef; external name '_ABPickerCreate';
+
+// Change the structural frame of the window.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSetFrame( inPicker: ABPickerRef; const (*var*) inFrame: HIRect ); external name '_ABPickerSetFrame';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerGetFrame( inPicker: ABPickerRef; var outFrame: HIRect ); external name '_ABPickerGetFrame';
+
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSetVisibility( inPicker: ABPickerRef; visible: Boolean ); external name '_ABPickerSetVisibility';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerIsVisible( inPicker: ABPickerRef ): Boolean; external name '_ABPickerIsVisible';
+
+{
+ * Look and Feel
+ }
+
+const
+    // Choose the selection behavior for the value column. If multiple behaviors are selected,
+    // the most restrictive behavior will be used. Defaults to kABPickerSingleValueSelection set
+    // to TRUE.
+    kABPickerSingleValueSelection   = 1 shl 0; // Allow user to choose a single value for a person.
+    kABPickerMultipleValueSelection = 1 shl 1; // Allow user to choose multiple values for a person.
+
+    // Allow the user to select entire groups in the group column. If false, at least one
+    // person in the group will be selected. Defaults to FALSE.
+    kABPickerAllowGroupSelection    = 1 shl 2;
+
+    // Allow the user to select more than one group/record at a time. Defaults to TRUE.
+    kABPickerAllowMultipleSelection = 1 shl 3;
+
+type ABPickerAttributes = OptionBits;
+
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerGetAttributes( inPicker: ABPickerRef ): ABPickerAttributes; external name '_ABPickerGetAttributes';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerChangeAttributes( inPicker: ABPickerRef; inAttributesToSet: ABPickerAttributes; inAttributesToClear: ABPickerAttributes ); external name '_ABPickerChangeAttributes';
+
+{
+ * Value column
+ }
+
+    // These methods control what data (if any) is shown in the values column. The column will only
+    // display if an AB property is added. A popup button in the column header will be used if more
+    // than one property is added. Titles for built in properties will localized automatically. A
+    // list of AB properties can be found in <AddressBook/ABGlobals.h>.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerAddProperty( inPicker: ABPickerRef; inProperty: CFStringRef ); external name '_ABPickerAddProperty';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerRemoveProperty( inPicker: ABPickerRef; inProperty: CFStringRef ); external name '_ABPickerRemoveProperty';
+    // Returns an array of AB Properties as CFStringRefs.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopyProperties( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopyProperties';
+
+    // Localized titles for third party properties should be set with these methods.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSetColumnTitle( inPicker: ABPickerRef; inTitle: CFStringRef; inProperty: CFStringRef ); external name '_ABPickerSetColumnTitle';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopyColumnTitle( inPicker: ABPickerRef; inProperty: CFStringRef ): CFStringRef; external name '_ABPickerCopyColumnTitle';
+
+    // Display one of the properties added above in the values column.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSetDisplayedProperty( inPicker: ABPickerRef; inProperty: CFStringRef ); external name '_ABPickerSetDisplayedProperty';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopyDisplayedProperty( inPicker: ABPickerRef ): CFStringRef; external name '_ABPickerCopyDisplayedProperty';
+
+{
+ * Selection
+ }
+
+    // Returns group column selection as an array of ABGroupRef objects.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopySelectedGroups( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopySelectedGroups';
+
+    // Returns names column selection as an array of ABGroupRef or ABPersonRef objects.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopySelectedRecords( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopySelectedRecords';
+
+    // This method returns an array of selected multi-value identifiers. Returns nil if the displayed
+    // property is a single value type.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopySelectedIdentifiers( inPicker: ABPickerRef; inPerson: ABPersonRef ): CFArrayRef; external name '_ABPickerCopySelectedIdentifiers';
+
+    // Returns an array containing CFStringRefs for each item selected in the values column.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerCopySelectedValues( inPicker: ABPickerRef ): CFArrayRef; external name '_ABPickerCopySelectedValues';
+
+    // Select group/name/value programatically.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSelectGroup( inPicker: ABPickerRef; inGroup: ABGroupRef; inExtendSelection: Boolean ); external name '_ABPickerSelectGroup';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSelectRecord( inPicker: ABPickerRef; inRecord: ABRecordRef; inExtendSelection: Boolean ); external name '_ABPickerSelectRecord';
+    // Individual values contained within an multi-value property can be selected with this method.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSelectIdentifier( inPicker: ABPickerRef; inPerson: ABPersonRef; inIdentifier: CFStringRef; inExtendSelection: Boolean ); external name '_ABPickerSelectIdentifier';
+
+    // Remove selection
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerDeselectGroup( inPicker: ABPickerRef; inGroup: ABGroupRef ); external name '_ABPickerDeselectGroup';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerDeselectRecord( inPicker: ABPickerRef; inRecord: ABRecordRef ); external name '_ABPickerDeselectRecord';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerDeselectIdentifier( inPicker: ABPickerRef; inPerson: ABPersonRef; inIdentifier: CFStringRef ); external name '_ABPickerDeselectIdentifier';
+
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerDeselectAll( inPicker: ABPickerRef ); external name '_ABPickerDeselectAll';
+
+{
+ * Events and Actions
+ *
+ * Your delegate will be notified when the user changes the selection or displayed property of the picker.
+ * Picker events have an event class of kEventClassABPeoplePicker and one of the kinds listed below. Picker
+ * events contain an event parameter which contains the ABPickerRef. To obtain this:
+ *
+ * GetEventParameter(inEvent, kEventParamABPickerRef,
+ *                   typeCFTypeRef, NULL, sizeof(ABPickerRef),
+ *                   NULL, &outPickerRef);
+ *
+ }
+
+const
+    // Carbon Event class for People Picker
+    kEventClassABPeoplePicker = $61627070 (* 'abpp' *);
+
+const
+    // Carbon Event kinds for People Picker
+    kEventABPeoplePickerGroupSelectionChanged     = 1;
+    kEventABPeoplePickerNameSelectionChanged      = 2;
+    kEventABPeoplePickerValueSelectionChanged     = 3;
+    kEventABPeoplePickerDisplayedPropertyChanged  = 4;
+
+    kEventABPeoplePickerGroupDoubleClicked        = 5;
+    kEventABPeoplePickerNameDoubleClicked         = 6;
+
+const
+    // Carbon Event parameter name
+    kEventParamABPickerRef	=  $61627070 (* 'abpp' *);
+
+    // Set the event handler for People Picker events.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSetDelegate( inPicker: ABPickerRef; inDelegate: HIObjectRef ); external name '_ABPickerSetDelegate';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function ABPickerGetDelegate( inPicker: ABPickerRef ): HIObjectRef; external name '_ABPickerGetDelegate';
+
+    // Clear the search field and reset the list of displayed names.
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerClearSearchField( inPicker: ABPickerRef ); external name '_ABPickerClearSearchField';
+
+    // Launch AddressBook and edit the current selection
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerEditInAddressBook( inPicker: ABPickerRef ); external name '_ABPickerEditInAddressBook';
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure ABPickerSelectInAddressBook( inPicker: ABPickerRef ); external name '_ABPickerSelectInAddressBook';
+
+end.

+ 152 - 0
packages/extra/univint/ABTypedefs.pas

@@ -0,0 +1,152 @@
+{
+ *  ABTypedefs.h
+ *  AddressBook Framework
+ *
+ *  Copyright (c) 2002-2003 Apple Computer. All rights reserved.
+ *
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ABTypedefs;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+{$ALIGN MAC68K}
+const
+	kABMultiValueMask  = $100;
+
+type
+	ABPropertyType = SInt32;
+const
+    kABErrorInProperty           = 0;
+    kABStringProperty            = 1;
+    kABIntegerProperty           = 2;
+    kABRealProperty              = 3;
+    kABDateProperty              = 4;
+    kABArrayProperty             = 5;
+    kABDictionaryProperty        = 6;
+    kABDataProperty              = 7;
+    kABMultiStringProperty       = kABMultiValueMask or kABStringProperty;
+    kABMultiIntegerProperty      = kABMultiValueMask or kABIntegerProperty;
+    kABMultiRealProperty         = kABMultiValueMask or kABRealProperty;
+    kABMultiDateProperty         = kABMultiValueMask or kABDateProperty;
+    kABMultiArrayProperty        = kABMultiValueMask or kABArrayProperty;
+    kABMultiDictionaryProperty   = kABMultiValueMask or kABDictionaryProperty;
+    kABMultiDataProperty         = kABMultiValueMask or kABDataProperty;
+
+// ================================================================
+//      Search APIs
+// ================================================================
+
+type
+	ABSearchComparison = SInt32;
+const
+        kABEqual = 0;
+        kABNotEqual = 1;
+        kABLessThan = 2;
+        kABLessThanOrEqual = 3;
+        kABGreaterThan = 4;
+        kABGreaterThanOrEqual = 5;
+
+        kABEqualCaseInsensitive = 6;
+        kABContainsSubString = 7;
+        kABContainsSubStringCaseInsensitive = 8;
+        kABPrefixMatch = 9;
+        kABPrefixMatchCaseInsensitive = 10;
+// #if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED
+        kABBitsInBitFieldMatch = 11;
+// #endif
+
+type
+	ABSearchConjunction = SInt32;
+const
+        kABSearchAnd = 0;
+        kABSearchOr = 1;
+
+end.

+ 957 - 0
packages/extra/univint/AEDataModel.pas

@@ -0,0 +1,957 @@
+{
+     File:       AEDataModel.p
+ 
+     Contains:   AppleEvent Data Model Interfaces.
+ 
+     Version:    Technology: Mac OS 9
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1996-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEDataModel;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,MixedMode;
+
+
+{$ALIGN MAC68K}
+
+{ Apple event descriptor types }
+
+const
+	typeBoolean					= $626F6F6C (* 'bool' *);
+	typeChar					= $54455854 (* 'TEXT' *);
+
+	{	 Preferred numeric Apple event descriptor types 	}
+	typeSInt16					= $73686F72 (* 'shor' *);
+	typeSInt32					= $6C6F6E67 (* 'long' *);
+	typeUInt32					= $6D61676E (* 'magn' *);
+	typeSInt64					= $636F6D70 (* 'comp' *);
+	typeIEEE32BitFloatingPoint	= $73696E67 (* 'sing' *);
+	typeIEEE64BitFloatingPoint	= $646F7562 (* 'doub' *);
+	type128BitFloatingPoint		= $6C64626C (* 'ldbl' *);
+	typeDecimalStruct			= $6465636D (* 'decm' *);
+
+	{	 Non-preferred Apple event descriptor types 	}
+	typeSMInt					= $73686F72 (* 'shor' *);
+	typeShortInteger			= $73686F72 (* 'shor' *);
+	typeInteger					= $6C6F6E67 (* 'long' *);
+	typeLongInteger				= $6C6F6E67 (* 'long' *);
+	typeMagnitude				= $6D61676E (* 'magn' *);
+	typeComp					= $636F6D70 (* 'comp' *);
+	typeSMFloat					= $73696E67 (* 'sing' *);
+	typeShortFloat				= $73696E67 (* 'sing' *);
+	typeFloat					= $646F7562 (* 'doub' *);
+	typeLongFloat				= $646F7562 (* 'doub' *);
+	typeExtended				= $65787465 (* 'exte' *);
+
+	{	 More Apple event descriptor types 	}
+	typeAEList					= $6C697374 (* 'list' *);
+	typeAERecord				= $7265636F (* 'reco' *);
+	typeAppleEvent				= $61657674 (* 'aevt' *);
+	typeEventRecord				= $65767263 (* 'evrc' *);
+	typeTrue					= $74727565 (* 'true' *);
+	typeFalse					= $66616C73 (* 'fals' *);
+	typeAlias					= $616C6973 (* 'alis' *);
+	typeEnumerated				= $656E756D (* 'enum' *);
+	typeType					= $74797065 (* 'type' *);
+	typeAppParameters			= $61707061 (* 'appa' *);
+	typeProperty				= $70726F70 (* 'prop' *);
+	typeFSS						= $66737320 (* 'fss ' *);
+	typeFSRef					= $66737266 (* 'fsrf' *);
+	typeFileURL					= $6675726C (* 'furl' *);
+	typeKeyword					= $6B657977 (* 'keyw' *);
+	typeSectionH				= $73656374 (* 'sect' *);
+	typeWildCard				= $2A2A2A2A (* '****' *);
+	typeApplSignature			= $7369676E (* 'sign' *);
+	typeQDRectangle				= $71647274 (* 'qdrt' *);
+	typeFixed					= $66697864 (* 'fixd' *);
+	typeProcessSerialNumber		= $70736E20 (* 'psn ' *);
+	typeApplicationURL			= $6170726C (* 'aprl' *);
+	typeNull					= $6E756C6C (* 'null' *);						{  null or nonexistent data  }
+
+{$ifc CALL_NOT_IN_CARBON}
+	{	 Deprecated addressing modes under Carbon 	}
+	typeSessionID				= $73736964 (* 'ssid' *);
+	typeTargetID				= $74617267 (* 'targ' *);
+	typeDispatcherID			= $64737074 (* 'dspt' *);
+
+{$endc}  {CALL_NOT_IN_CARBON}
+
+	{	 Keywords for Apple event attributes 	}
+	keyTransactionIDAttr		= $7472616E (* 'tran' *);
+	keyReturnIDAttr				= $72746964 (* 'rtid' *);
+	keyEventClassAttr			= $6576636C (* 'evcl' *);
+	keyEventIDAttr				= $65766964 (* 'evid' *);
+	keyAddressAttr				= $61646472 (* 'addr' *);
+	keyOptionalKeywordAttr		= $6F70746B (* 'optk' *);
+	keyTimeoutAttr				= $74696D6F (* 'timo' *);
+	keyInteractLevelAttr		= $696E7465 (* 'inte' *);						{  this attribute is read only - will be set in AESend  }
+	keyEventSourceAttr			= $65737263 (* 'esrc' *);						{  this attribute is read only - returned as typeShortInteger  }
+	keyMissedKeywordAttr		= $6D697373 (* 'miss' *);						{  this attribute is read only  }
+	keyOriginalAddressAttr		= $66726F6D (* 'from' *);						{  new in 1.0.1  }
+	keyAcceptTimeoutAttr		= $6163746D (* 'actm' *);						{  new for Mac OS X  }
+
+
+	{	  Constants used for specifying the factoring of AEDescLists. 	}
+	kAEDescListFactorNone		= 0;
+	kAEDescListFactorType		= 4;
+	kAEDescListFactorTypeAndSize = 8;
+
+	{	 Constants used creating an AppleEvent 	}
+																{  Constant for the returnID param of AECreateAppleEvent  }
+	kAutoGenerateReturnID		= -1;							{  AECreateAppleEvent will generate a session-unique ID  }
+																{  Constant for transaction IDÕs  }
+	kAnyTransactionID			= 0;							{  no transaction is in use  }
+
+	{	 Apple event manager data types 	}
+
+type
+	DescType							= ResType;
+	DescTypePtr					= ^DescType;
+	AEKeyword							= FourCharCode;
+	AEKeywordPtr					= ^AEKeyword;
+{$ifc OPAQUE_TOOLBOX_STRUCTS}
+	AEDataStorage    = ^SInt32; { an opaque 32-bit type }
+	AEDataStoragePtr = ^AEDataStorage;  { when a var xx:AEDataStorage parameter can be nil, it is changed to xx: AEDataStoragePtr }
+{$elsec}
+	AEDataStorage						= Handle;
+{$endc}  {OPAQUE_TOOLBOX_STRUCTS}
+
+	AEDescPtr = ^AEDesc;
+	AEDesc = record
+		descriptorType:			DescType;
+		dataHandle:				AEDataStorage;
+	end;
+
+	AEKeyDescPtr = ^AEKeyDesc;
+	AEKeyDesc = record
+		descKey:				AEKeyword;
+		descContent:			AEDesc;
+	end;
+
+	{	 a list of AEDesc's is a special kind of AEDesc 	}
+	AEDescList							= AEDesc;
+	AEDescListPtr 						= ^AEDescList;
+	{	 AERecord is a list of keyworded AEDesc's 	}
+	AERecord							= AEDescList;
+	AERecordPtr 						= ^AERecord;
+	{	 an AEDesc which contains address data 	}
+	AEAddressDesc						= AEDesc;
+	AEAddressDescPtr 					= ^AEAddressDesc;
+	{	 an AERecord that contains an AppleEvent, and related data types 	}
+	AppleEvent							= AERecord;
+	AppleEventPtr 						= ^AppleEvent;
+	AEReturnID							= SInt16;
+	AETransactionID						= SInt32;
+	AEEventClass						= FourCharCode;
+	AEEventID							= FourCharCode;
+	AEArrayType							= SInt8;
+
+const
+	kAEDataArray				= 0;
+	kAEPackedArray				= 1;
+	kAEDescArray				= 3;
+	kAEKeyDescArray				= 4;
+
+
+	kAEHandleArray				= 2;
+
+
+type
+	AEArrayDataPtr = ^AEArrayData;
+	AEArrayData = record
+		case SInt16 of
+		0: (
+			kAEDataArray:		array [0..0] of SInt16;
+			);
+		1: (
+			kAEPackedArray:		SInt8;
+			);
+		2: (
+			kAEHandleArray:		array [0..0] of Handle;
+			);
+		3: (
+			kAEDescArray:		array [0..0] of AEDesc;
+			);
+		4: (
+			kAEKeyDescArray:	array [0..0] of AEKeyDesc;
+			);
+	end;
+
+	AEArrayDataPointer					= ^AEArrayData;
+	AEArrayDataPointerPtr 				= ^AEArrayDataPointer;
+	{	*************************************************************************
+	  These constants are used by AEMach and AEInteraction APIs.  They are not
+	  strictly part of the data format, but are declared here due to layering.
+	*************************************************************************	}
+	AESendPriority 				= SInt16;
+const
+	kAENormalPriority			= $00000000;					{  post message at the end of the event queue  }
+	kAEHighPriority				= $00000001;					{  post message at the front of the event queue (same as nAttnMsg)  }
+
+
+type
+	AESendMode 					= SInt32;
+const
+	kAENoReply					= $00000001;					{  sender doesn't want a reply to event  }
+	kAEQueueReply				= $00000002;					{  sender wants a reply but won't wait  }
+	kAEWaitReply				= $00000003;					{  sender wants a reply and will wait  }
+	kAEDontReconnect			= $00000080;					{  don't reconnect if there is a sessClosedErr from PPCToolbox  }
+	kAEWantReceipt				= $00000200;					{  (nReturnReceipt) sender wants a receipt of message  }
+	kAENeverInteract			= $00000010;					{  server should not interact with user  }
+	kAECanInteract				= $00000020;					{  server may try to interact with user  }
+	kAEAlwaysInteract			= $00000030;					{  server should always interact with user where appropriate  }
+	kAECanSwitchLayer			= $00000040;					{  interaction may switch layer  }
+	kAEDontRecord				= $00001000;					{  don't record this event - available only in vers 1.0.1 and greater  }
+	kAEDontExecute				= $00002000;					{  don't send the event for recording - available only in vers 1.0.1 and greater  }
+	kAEProcessNonReplyEvents	= $00008000;					{  allow processing of non-reply events while awaiting synchronous AppleEvent reply  }
+
+
+	{	 Constants for timeout durations 	}
+	kAEDefaultTimeout			= -1;							{  timeout value determined by AEM  }
+	kNoTimeOut					= -2;							{  wait until reply comes back, however long it takes  }
+
+
+	{	*************************************************************************
+	  These calls are used to set up and modify the coercion dispatch table.
+	*************************************************************************	}
+
+type
+{$ifc TYPED_FUNCTION_POINTERS}
+	AECoerceDescProcPtr = function(const (*var*) fromDesc: AEDesc; toType: DescType; handlerRefcon: SInt32; var toDesc: AEDesc): OSErr;
+{$elsec}
+	AECoerceDescProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	AECoercePtrProcPtr = function(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; toType: DescType; handlerRefcon: SInt32; var result: AEDesc): OSErr;
+{$elsec}
+	AECoercePtrProcPtr = ProcPtr;
+{$endc}
+
+{$ifc OPAQUE_UPP_TYPES}
+	AECoerceDescUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AECoerceDescUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	AECoercePtrUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AECoercePtrUPP = UniversalProcPtr;
+{$endc}	
+
+const
+	uppAECoerceDescProcInfo = $00003FE0;
+	uppAECoercePtrProcInfo = $0003FFE0;
+	{
+	 *  NewAECoerceDescUPP()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   available as macro/inline
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewAECoerceDescUPP(userRoutine: AECoerceDescProcPtr): AECoerceDescUPP; external name '_NewAECoerceDescUPP'; { old name was NewAECoerceDescProc }
+{
+ *  NewAECoercePtrUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewAECoercePtrUPP(userRoutine: AECoercePtrProcPtr): AECoercePtrUPP; external name '_NewAECoercePtrUPP'; { old name was NewAECoercePtrProc }
+{
+ *  DisposeAECoerceDescUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAECoerceDescUPP(userUPP: AECoerceDescUPP); external name '_DisposeAECoerceDescUPP';
+{
+ *  DisposeAECoercePtrUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAECoercePtrUPP(userUPP: AECoercePtrUPP); external name '_DisposeAECoercePtrUPP';
+{
+ *  InvokeAECoerceDescUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAECoerceDescUPP(const (*var*) fromDesc: AEDesc; toType: DescType; handlerRefcon: SInt32; var toDesc: AEDesc; userRoutine: AECoerceDescUPP): OSErr; external name '_InvokeAECoerceDescUPP'; { old name was CallAECoerceDescProc }
+{
+ *  InvokeAECoercePtrUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAECoercePtrUPP(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; toType: DescType; handlerRefcon: SInt32; var result: AEDesc; userRoutine: AECoercePtrUPP): OSErr; external name '_InvokeAECoercePtrUPP'; { old name was CallAECoercePtrProc }
+{ a AECoercionHandlerUPP is by default a AECoerceDescUPP.  If you are registering a 
+    Ptr based coercion handler you will have to add a cast to AECoerceDescUPP from 
+    your AECoercePtrUPP type.  A future release of the interfaces will fix this by
+    introducing seperate Desc and Ptr coercion handler installation/remove/query routines. }
+
+type
+	AECoercionHandlerUPP				= AECoerceDescUPP;
+	{
+	 *  AEInstallCoercionHandler()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function AEInstallCoercionHandler(fromType: DescType; toType: DescType; handler: AECoercionHandlerUPP; handlerRefcon: SInt32; fromTypeIsDesc: boolean; isSysHandler: boolean): OSErr; external name '_AEInstallCoercionHandler';
+{
+ *  AERemoveCoercionHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AERemoveCoercionHandler(fromType: DescType; toType: DescType; handler: AECoercionHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveCoercionHandler';
+{
+ *  AEGetCoercionHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetCoercionHandler(fromType: DescType; toType: DescType; var handler: AECoercionHandlerUPP; var handlerRefcon: SInt32; var fromTypeIsDesc: boolean; isSysHandler: boolean): OSErr; external name '_AEGetCoercionHandler';
+{*************************************************************************
+  The following calls provide for a coercion interface.
+*************************************************************************}
+{
+ *  AECoercePtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECoercePtr(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; toType: DescType; var result: AEDesc): OSErr; external name '_AECoercePtr';
+{
+ *  AECoerceDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECoerceDesc(const (*var*) theAEDesc: AEDesc; toType: DescType; var result: AEDesc): OSErr; external name '_AECoerceDesc';
+{*************************************************************************
+ The following calls apply to any AEDesc. Every 'result' descriptor is
+ created for you, so you will be responsible for memory management
+ (including disposing) of the descriptors so created.  
+*************************************************************************}
+{ because AEDescs are opaque under Carbon, this AEInitializeDesc provides a
+   'clean' way of initializating them to be empty. }
+{
+ *  AEInitializeDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.4 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure AEInitializeDesc(var desc: AEDesc); external name '_AEInitializeDesc';
+
+
+{
+ *  AECreateDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECreateDesc(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; var result: AEDesc): OSErr; external name '_AECreateDesc';
+{
+ *  AEDisposeDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEDisposeDesc(var theAEDesc: AEDesc): OSErr; external name '_AEDisposeDesc';
+{
+ *  AEDuplicateDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEDuplicateDesc(const (*var*) theAEDesc: AEDesc; var result: AEDesc): OSErr; external name '_AEDuplicateDesc';
+{*************************************************************************
+  The following calls apply to AEDescList. Since AEDescList is a subtype of
+  AEDesc, the calls in the previous section can also be used for AEDescList.
+  All list and array indices are 1-based. If the data was greater than
+  maximumSize in the routines below, then actualSize will be greater than
+  maximumSize, but only maximumSize bytes will actually be retrieved.
+*************************************************************************}
+{
+ *  AECreateList()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECreateList(factoringPtr: UnivPtr; factoredSize: Size; isRecord: boolean; var resultList: AEDescList): OSErr; external name '_AECreateList';
+{
+ *  AECountItems()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECountItems(const (*var*) theAEDescList: AEDescList; var theCount: SInt32): OSErr; external name '_AECountItems';
+{
+ *  AEPutPtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutPtr(var theAEDescList: AEDescList; index: SInt32; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutPtr';
+{
+ *  AEPutDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutDesc(var theAEDescList: AEDescList; index: SInt32; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutDesc';
+{
+ *  AEGetNthPtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetNthPtr(const (*var*) theAEDescList: AEDescList; index: SInt32; desiredType: DescType; theAEKeywordPtr: AEKeywordPtr; typeCode: DescTypePtr; dataPtr: UnivPtr; maximumSize: Size; actualSize: SizePtr): OSErr; external name '_AEGetNthPtr';
+{
+ *  AEGetNthDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetNthDesc(const (*var*) theAEDescList: AEDescList; index: SInt32; desiredType: DescType; theAEKeywordPtr: AEKeywordPtr; var result: AEDesc): OSErr; external name '_AEGetNthDesc';
+{
+ *  AESizeOfNthItem()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AESizeOfNthItem(const (*var*) theAEDescList: AEDescList; index: SInt32; typeCode: DescTypePtr; dataSize: SizePtr): OSErr; external name '_AESizeOfNthItem';
+{
+ *  AEGetArray()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetArray(const (*var*) theAEDescList: AEDescList; arrayType: AEArrayType; arrayPtr: AEArrayDataPointer; maximumSize: Size; var itemType: DescType; var itemSize: Size; var itemCount: SInt32): OSErr; external name '_AEGetArray';
+{
+ *  AEPutArray()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutArray(var theAEDescList: AEDescList; arrayType: AEArrayType; const (*var*) arrayPtr: AEArrayData; itemType: DescType; itemSize: Size; itemCount: SInt32): OSErr; external name '_AEPutArray';
+{
+ *  AEDeleteItem()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEDeleteItem(var theAEDescList: AEDescList; index: SInt32): OSErr; external name '_AEDeleteItem';
+{*************************************************************************
+ The following calls apply to AERecord. Since AERecord is a subtype of
+ AEDescList, the calls in the previous sections can also be used for
+ AERecord an AERecord can be created by using AECreateList with isRecord
+ set to true. 
+*************************************************************************}
+{************************************************************************
+ AERecords can have an abitrary descriptorType.  This allows you to
+ check if desc is truly an AERecord
+***********************************************************************}
+{
+ *  AECheckIsRecord()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.4 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECheckIsRecord(const (*var*) theDesc: AEDesc): boolean; external name '_AECheckIsRecord';
+
+{
+  Note: none of the ÒkeyÓ calls were available in the PowerPC 7.x IntefaceLib.
+  In C, a #define is used to map ÒkeyÓ calls to ÒparamÓ calls.  In pascal
+  this mapping is done in externally linked glue code.
+}
+{$ifc CALL_NOT_IN_CARBON}
+{
+ *  AEPutKeyPtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AEPutKeyPtr(var theAERecord: AERecord; theAEKeyword: AEKeyword; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutKeyPtr';
+{
+ *  AEPutKeyDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AEPutKeyDesc(var theAERecord: AERecord; theAEKeyword: AEKeyword; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutKeyDesc';
+{
+ *  AEGetKeyPtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AEGetKeyPtr(const (*var*) theAERecord: AERecord; theAEKeyword: AEKeyword; desiredType: DescType; var typeCode: DescType; dataPtr: UnivPtr; maximumSize: Size; var actualSize: Size): OSErr; external name '_AEGetKeyPtr';
+{
+ *  AEGetKeyDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AEGetKeyDesc(const (*var*) theAERecord: AERecord; theAEKeyword: AEKeyword; desiredType: DescType; var result: AEDesc): OSErr; external name '_AEGetKeyDesc';
+{
+ *  AESizeOfKeyDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AESizeOfKeyDesc(const (*var*) theAERecord: AERecord; theAEKeyword: AEKeyword; var typeCode: DescType; var dataSize: Size): OSErr; external name '_AESizeOfKeyDesc';
+{
+ *  AEDeleteKeyDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AEDeleteKeyDesc(var theAERecord: AERecord; theAEKeyword: AEKeyword): OSErr; external name '_AEDeleteKeyDesc';
+{$endc}  {CALL_NOT_IN_CARBON}
+
+{*************************************************************************
+  The following calls create and manipulate the AppleEvent data type.
+*************************************************************************}
+{
+ *  AECreateAppleEvent()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECreateAppleEvent(theAEEventClass: AEEventClass; theAEEventID: AEEventID; const (*var*) target: AEAddressDesc; returnID: AEReturnID; transactionID: AETransactionID; var result: AppleEvent): OSErr; external name '_AECreateAppleEvent';
+{*************************************************************************
+  The following calls are used to pack and unpack parameters from records
+  of type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls
+  in the previous sections can also be used for variables of type
+  AppleEvent. The next six calls are in fact identical to the six calls
+  for AERecord.
+*************************************************************************}
+{
+ *  AEPutParamPtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutParamPtr(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutParamPtr';
+{
+ *  AEPutParamDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutParamDesc(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutParamDesc';
+{
+ *  AEGetParamPtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetParamPtr(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; actualType: DescTypePtr; dataPtr: UnivPtr; maximumSize: Size; actualSize: SizePtr): OSErr; external name '_AEGetParamPtr';
+{
+ *  AEGetParamDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetParamDesc(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; var result: AEDesc): OSErr; external name '_AEGetParamDesc';
+{
+ *  AESizeOfParam()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AESizeOfParam(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; typeCode: DescTypePtr; dataSize: SizePtr): OSErr; external name '_AESizeOfParam';
+{
+ *  AEDeleteParam()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEDeleteParam(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword): OSErr; external name '_AEDeleteParam';
+{*************************************************************************
+ The following calls also apply to type AppleEvent. Message attributes are
+ far more restricted, and can only be accessed through the following 5
+ calls. The various list and record routines cannot be used to access the
+ attributes of an event. 
+*************************************************************************}
+{
+ *  AEGetAttributePtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetAttributePtr(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; typeCode: DescTypePtr; dataPtr: UnivPtr; maximumSize: Size; actualSize: SizePtr): OSErr; external name '_AEGetAttributePtr';
+{
+ *  AEGetAttributeDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetAttributeDesc(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; desiredType: DescType; var result: AEDesc): OSErr; external name '_AEGetAttributeDesc';
+{
+ *  AESizeOfAttribute()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AESizeOfAttribute(const (*var*) theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; typeCode: DescTypePtr; dataSize: SizePtr): OSErr; external name '_AESizeOfAttribute';
+{
+ *  AEPutAttributePtr()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutAttributePtr(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; typeCode: DescType; dataPtr: UnivPtr; dataSize: Size): OSErr; external name '_AEPutAttributePtr';
+{
+ *  AEPutAttributeDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPutAttributeDesc(var theAppleEvent: AppleEvent; theAEKeyword: AEKeyword; const (*var*) theAEDesc: AEDesc): OSErr; external name '_AEPutAttributeDesc';
+{*************************************************************************
+ AppleEvent Serialization Support
+
+    AESizeOfFlattenedDesc, AEFlattenDesc, AEUnflattenDesc
+    
+    These calls will work for all AppleEvent data types and between different
+    versions of the OS (including between Mac OS 9 and X)
+    
+    Basic types, AEDesc, AEList and AERecord are OK, but AppleEvent records
+    themselves may not be reliably flattened for storage.
+*************************************************************************}
+{
+   AEFlattenDesc
+   Returns the amount of buffer space needed to flatten the
+   AEDesc. Call this before AEFlattenDesc to make sure your
+   buffer has enough room for the operation.
+}
+
+{
+ *  AESizeOfFlattenedDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.4 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AESizeOfFlattenedDesc(const (*var*) theAEDesc: AEDesc): Size; external name '_AESizeOfFlattenedDesc';
+
+{
+   AEFlattenDesc
+   Fills a buffer with a flattened representation of the
+   AEDesc and returns the amount of buffer used in actualSize.
+   If bufferSize was too small it returns errAEBufferTooSmall
+   (-1741) and does not fill in any of the buffer. The resulting
+   buffer is only useful with an AEUnflattenDesc call.
+   
+   Note: if you pass a NULL buffer pointer it returns noErr but
+   fills in the actualSize field anyway.
+}
+
+{
+ *  AEFlattenDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.4 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEFlattenDesc(const (*var*) theAEDesc: AEDesc; buffer: Ptr; bufferSize: Size; var actualSize: Size): OSStatus; external name '_AEFlattenDesc';
+
+{
+   AEUnflattenDesc
+   Allocates an AEDesc (given a Null Desc) given a flattened
+   data buffer. It assumes it was given a good buffer filled
+   in by AEFlattenDesc. It returns paramErr if it discovers
+   something fishy about the buffer.
+}
+
+{
+ *  AEUnflattenDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.4 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEUnflattenDesc(buffer: Ptr; var result: AEDesc): OSStatus; external name '_AEUnflattenDesc';
+
+{*************************************************************************
+ The following calls are necessary to deal with opaque data in AEDescs, because the
+ traditional way of dealing with a basic AEDesc has been to dereference the dataHandle
+ directly.  This is not supported under Carbon.
+*************************************************************************}
+{$ifc ACCESSOR_CALLS_ARE_FUNCTIONS}
+{
+        AEGetDescData no longer supports automatic coercion. If you'd like to
+        coerce the descriptor use AECoerceDesc.
+    }
+{
+ *  AEGetDescData()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetDescData(const (*var*) theAEDesc: AEDesc; dataPtr: UnivPtr; maximumSize: Size): OSErr; external name '_AEGetDescData';
+
+{
+ *  AEGetDescDataSize()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetDescDataSize(const (*var*) theAEDesc: AEDesc): Size; external name '_AEGetDescDataSize';
+
+{
+ *  AEReplaceDescData()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in CarbonAccessors.o 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEReplaceDescData(typeCode: DescType; dataPtr: UnivPtr; dataSize: Size; var theAEDesc: AEDesc): OSErr; external name '_AEReplaceDescData';
+
+{$endc}  {ACCESSOR_CALLS_ARE_FUNCTIONS}
+
+
+{*************************************************************************
+  A AEEventHandler is installed to process an AppleEvent 
+*************************************************************************}
+
+type
+{$ifc TYPED_FUNCTION_POINTERS}
+	AEEventHandlerProcPtr = function(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; handlerRefcon: SInt32): OSErr;
+{$elsec}
+	AEEventHandlerProcPtr = ProcPtr;
+{$endc}
+
+{$ifc OPAQUE_UPP_TYPES}
+	AEEventHandlerUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AEEventHandlerUPP = UniversalProcPtr;
+{$endc}	
+
+const
+	uppAEEventHandlerProcInfo = $00000FE0;
+	{
+	 *  NewAEEventHandlerUPP()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   available as macro/inline
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewAEEventHandlerUPP(userRoutine: AEEventHandlerProcPtr): AEEventHandlerUPP; external name '_NewAEEventHandlerUPP'; { old name was NewAEEventHandlerProc }
+{
+ *  DisposeAEEventHandlerUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAEEventHandlerUPP(userUPP: AEEventHandlerUPP); external name '_DisposeAEEventHandlerUPP';
+{
+ *  InvokeAEEventHandlerUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAEEventHandlerUPP(const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; handlerRefcon: SInt32; userRoutine: AEEventHandlerUPP): OSErr; external name '_InvokeAEEventHandlerUPP'; { old name was CallAEEventHandlerProc }
+{$ALIGN MAC68K}
+
+
+end.

+ 387 - 0
packages/extra/univint/AEHelpers.pas

@@ -0,0 +1,387 @@
+{
+     File:       AEHelpers.p
+ 
+     Contains:   AEPrint, AEBuild and AEStream for Carbon
+ 
+     Version:    Technology: Mac OS X, CarbonLib
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1999-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{
+ * Originally from AEGIzmos by Jens Alfke, circa 1992.
+ }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEHelpers;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,AppleEvents,AEDataModel;
+
+{$ALIGN MAC68K}
+
+{
+ * AEBuild is only available for C programmers.
+ }
+{
+ * AEPrintDescToHandle
+ *
+ * AEPrintDescToHandle provides a way to turn an AEDesc into a textual
+ * representation.  This is most useful for debugging calls to
+ * AEBuildDesc and friends.  The Handle returned should be disposed by
+ * the caller.  The size of the handle is the actual number of
+ * characters in the string.
+ }
+{
+ *  AEPrintDescToHandle()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEPrintDescToHandle(const (*var*) desc: AEDesc; var result: Handle): OSStatus; external name '_AEPrintDescToHandle';
+
+{
+ * AEStream:
+ *
+ * The AEStream interface allows you to build AppleEvents by appending
+ * to an opaque structure (an AEStreamRef) and then turning this
+ * structure into an AppleEvent.  The basic idea is to open the
+ * stream, write data, and then close it - closing it produces an
+ * AEDesc, which may be partially complete, or may be a complete
+ * AppleEvent.
+ }
+
+type
+	AEStreamRef    = ^SInt32; { an opaque 32-bit type }
+	AEStreamRefPtr = ^AEStreamRef;  { when a var xx:AEStreamRef parameter can be nil, it is changed to xx: AEStreamRefPtr }
+	{
+	   Create and return an AEStreamRef
+	   Returns NULL on memory allocation failure
+	}
+	{
+	 *  AEStreamOpen()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   not available
+	 *    CarbonLib:        in CarbonLib 1.1 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function AEStreamOpen: AEStreamRef; external name '_AEStreamOpen';
+
+{
+   Closes and disposes of an AEStreamRef, producing
+   results in the desc.  You must dispose of the desc yourself.
+   If you just want to dispose of the AEStreamRef, you can pass NULL for desc.
+}
+{
+ *  AEStreamClose()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamClose(ref: AEStreamRef; var desc: AEDesc): OSStatus; external name '_AEStreamClose';
+
+{
+   Prepares an AEStreamRef for appending data to a newly created desc.
+   You append data with AEStreamWriteData
+}
+{
+ *  AEStreamOpenDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamOpenDesc(ref: AEStreamRef; newType: DescType): OSStatus; external name '_AEStreamOpenDesc';
+
+{  Append data to the previously opened desc. }
+{
+ *  AEStreamWriteData()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamWriteData(ref: AEStreamRef; data: UnivPtr; length: Size): OSStatus; external name '_AEStreamWriteData';
+
+{
+   Finish a desc.  After this, you can close the stream, or adding new
+   descs, if you're assembling a list.
+}
+{
+ *  AEStreamCloseDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamCloseDesc(ref: AEStreamRef): OSStatus; external name '_AEStreamCloseDesc';
+
+{  Write data as a desc to the stream }
+{
+ *  AEStreamWriteDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamWriteDesc(ref: AEStreamRef; newType: DescType; data: UnivPtr; length: Size): OSStatus; external name '_AEStreamWriteDesc';
+
+{  Write an entire desc to the stream }
+{
+ *  AEStreamWriteAEDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamWriteAEDesc(ref: AEStreamRef; const (*var*) desc: AEDesc): OSStatus; external name '_AEStreamWriteAEDesc';
+
+{
+   Begin a list.  You can then append to the list by doing
+   AEStreamOpenDesc, or AEStreamWriteDesc.
+}
+{
+ *  AEStreamOpenList()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamOpenList(ref: AEStreamRef): OSStatus; external name '_AEStreamOpenList';
+
+{  Finish a list. }
+{
+ *  AEStreamCloseList()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamCloseList(ref: AEStreamRef): OSStatus; external name '_AEStreamCloseList';
+
+{
+   Begin a record.  A record usually has type 'reco', however, this is
+   rather generic, and frequently a different type is used.
+}
+{
+ *  AEStreamOpenRecord()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamOpenRecord(ref: AEStreamRef; newType: DescType): OSStatus; external name '_AEStreamOpenRecord';
+
+{  Change the type of a record. }
+{
+ *  AEStreamSetRecordType()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamSetRecordType(ref: AEStreamRef; newType: DescType): OSStatus; external name '_AEStreamSetRecordType';
+
+{  Finish a record }
+{
+ *  AEStreamCloseRecord()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamCloseRecord(ref: AEStreamRef): OSStatus; external name '_AEStreamCloseRecord';
+
+{
+   Add a keyed descriptor to a record.  This is analogous to AEPutParamDesc.
+   it can only be used when writing to a record.
+}
+{
+ *  AEStreamWriteKeyDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamWriteKeyDesc(ref: AEStreamRef; key: AEKeyword; newType: DescType; data: UnivPtr; length: Size): OSStatus; external name '_AEStreamWriteKeyDesc';
+
+{
+   OpenDesc for a keyed record entry.  You can youse AEStreamWriteData
+   after opening a keyed desc.
+}
+{
+ *  AEStreamOpenKeyDesc()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamOpenKeyDesc(ref: AEStreamRef; key: AEKeyword; newType: DescType): OSStatus; external name '_AEStreamOpenKeyDesc';
+
+{  Write a key to the stream - you can follow this with an AEWriteDesc. }
+{
+ *  AEStreamWriteKey()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamWriteKey(ref: AEStreamRef; key: AEKeyword): OSStatus; external name '_AEStreamWriteKey';
+
+{
+   Create a complete AppleEvent.  This creates and returns a new stream.
+   Use this call to populate the meta fields in an AppleEvent record.
+   After this, you can add your records, lists and other parameters.
+}
+{
+ *  AEStreamCreateEvent()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamCreateEvent(clazz: AEEventClass; id: AEEventID; targetType: DescType; targetData: UnivPtr; targetLength: SInt32; returnID: SInt16; transactionID: SInt32): AEStreamRef; external name '_AEStreamCreateEvent';
+
+{
+   This call lets you augment an existing AppleEvent using the stream
+   APIs.  This would be useful, for example, in constructing the reply
+   record in an AppleEvent handler.  Note that AEStreamOpenEvent will
+   consume the AppleEvent passed in - you can't access it again until the
+   stream is closed.  When you're done building the event, AEStreamCloseStream
+    will reconstitute it.
+}
+{
+ *  AEStreamOpenEvent()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamOpenEvent(var event: AppleEvent): AEStreamRef; external name '_AEStreamOpenEvent';
+
+{  Mark a keyword as being an optional parameter. }
+{
+ *  AEStreamOptionalParam()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEStreamOptionalParam(ref: AEStreamRef; key: AEKeyword): OSStatus; external name '_AEStreamOptionalParam';
+
+{$ALIGN MAC68K}
+
+
+end.

+ 400 - 0
packages/extra/univint/AEInteraction.pas

@@ -0,0 +1,400 @@
+{
+     File:       HIToolbox/AEInteraction.h
+ 
+     Contains:   AppleEvent functions that deal with Events and interacting with user
+ 
+     Version:    HIToolbox-219.4.81~2
+ 
+     Copyright:  © 2000-2005 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEInteraction;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,Quickdraw,AEDataModel,Notification,Events;
+{$ALIGN MAC68K}
+
+
+{*************************************************************************
+  AppleEvent callbacks. 
+*************************************************************************}
+type
+	AEIdleProcPtr = function( var theEvent: EventRecord; var sleepTime: SInt32; var mouseRgn: RgnHandle ): Boolean;
+type
+	AEFilterProcPtr = function( var theEvent: EventRecord; returnID: SInt32; transactionID: SInt32; const (*var*) sender: AEAddressDesc ): Boolean;
+type
+	AEIdleUPP = AEIdleProcPtr;
+type
+	AEFilterUPP = AEFilterProcPtr;
+
+{*************************************************************************
+  The next couple of calls are basic routines used to create, send,
+  and process AppleEvents. 
+*************************************************************************}
+{
+ *  AESend()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AESend( const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP { can be NULL }; filterProc: AEFilterUPP { can be NULL } ): OSErr; external name '_AESend';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  AEProcessAppleEvent()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AEProcessAppleEvent( const (*var*) theEventRecord: EventRecord ): OSErr; external name '_AEProcessAppleEvent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ 
+ Note: during event processing, an event handler may realize that it is likely
+ to exceed the client's timeout limit. Passing the reply to this
+ routine causes a wait event to be generated that asks the client
+ for more time. 
+}
+{
+ *  AEResetTimer()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AEResetTimer( const (*var*) reply: AppleEvent ): OSErr; external name '_AEResetTimer';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{*************************************************************************
+  The following three calls are used to allow applications to behave
+  courteously when a user interaction such as a dialog box is needed. 
+*************************************************************************}
+
+type
+	AEInteractAllowed = SInt8;
+const
+	kAEInteractWithSelf = 0;
+	kAEInteractWithLocal = 1;
+	kAEInteractWithAll = 2;
+
+{
+ *  AEGetInteractionAllowed()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AEGetInteractionAllowed( var level: AEInteractAllowed ): OSErr; external name '_AEGetInteractionAllowed';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  AESetInteractionAllowed()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AESetInteractionAllowed( level: AEInteractAllowed ): OSErr; external name '_AESetInteractionAllowed';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  AEInteractWithUser()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AEInteractWithUser( timeOutInTicks: SInt32; nmReqPtr: NMRecPtr; idleProc: AEIdleUPP ): OSErr; external name '_AEInteractWithUser';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{*************************************************************************
+ The following four calls are available for applications which need more
+ sophisticated control over when and how events are processed. Applications
+ which implement multi-session servers or which implement their own
+ internal event queueing will probably be the major clients of these
+ routines. They can be called from within a handler to prevent the AEM from
+ disposing of the AppleEvent when the handler returns. They can be used to
+ asynchronously process the event (as MacApp does).
+*************************************************************************}
+{
+ *  AESuspendTheCurrentEvent()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AESuspendTheCurrentEvent( const (*var*) theAppleEvent: AppleEvent ): OSErr; external name '_AESuspendTheCurrentEvent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ 
+ Note: The following routine tells the AppleEvent manager that processing
+ is either about to resume or has been completed on a previously suspended
+ event. The procPtr passed in as the dispatcher parameter will be called to
+ attempt to redispatch the event. Several constants for the dispatcher
+ parameter allow special behavior. They are:
+    - kAEUseStandardDispatch means redispatch as if the event was just
+      received, using the standard AppleEvent dispatch mechanism.
+    - kAENoDispatch means ignore the parameter.
+      Use this in the case where the event has been handled and no
+      redispatch is needed.
+    - non nil means call the routine which the dispatcher points to.
+}
+{ Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch }
+const
+	kAEDoNotIgnoreHandler = $00000000;
+	kAEIgnoreAppPhacHandler = $00000001; { available only in vers 1.0.1 and greater }
+	kAEIgnoreAppEventHandler = $00000002; { available only in vers 1.0.1 and greater }
+	kAEIgnoreSysPhacHandler = $00000004; { available only in vers 1.0.1 and greater }
+	kAEIgnoreSysEventHandler = $00000008; { available only in vers 1.0.1 and greater }
+	kAEIngoreBuiltInEventHandler = $00000010; { available only in vers 1.0.1 and greater }
+	kAEDontDisposeOnResume = $80000000; { available only in vers 1.0.1 and greater }
+
+{ Constants for AEResumeTheCurrentEvent }
+const
+	kAENoDispatch = 0;    { dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch }
+	kAEUseStandardDispatch = $FFFFFFFF; { table, or one of these two constants }
+
+{
+ *  AEResumeTheCurrentEvent()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AEResumeTheCurrentEvent( const (*var*) theAppleEvent: AppleEvent; const (*var*) reply: AppleEvent; dispatcher: AEEventHandlerUPP { can be NULL }; handlerRefcon: SInt32 ): OSErr; external name '_AEResumeTheCurrentEvent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  AEGetTheCurrentEvent()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AEGetTheCurrentEvent( var theAppleEvent: AppleEvent ): OSErr; external name '_AEGetTheCurrentEvent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  AESetTheCurrentEvent()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ }
+function AESetTheCurrentEvent( const (*var*) theAppleEvent: AppleEvent ): OSErr; external name '_AESetTheCurrentEvent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{*************************************************************************
+  AppleEvent callbacks. 
+*************************************************************************}
+{
+ *  NewAEIdleUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewAEIdleUPP( userRoutine: AEIdleProcPtr ): AEIdleUPP; external name '_NewAEIdleUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  NewAEFilterUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewAEFilterUPP( userRoutine: AEFilterProcPtr ): AEFilterUPP; external name '_NewAEFilterUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeAEIdleUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeAEIdleUPP( userUPP: AEIdleUPP ); external name '_DisposeAEIdleUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeAEFilterUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeAEFilterUPP( userUPP: AEFilterUPP ); external name '_DisposeAEFilterUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeAEIdleUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function InvokeAEIdleUPP( var theEvent: EventRecord; var sleepTime: SInt32; var mouseRgn: RgnHandle; userUPP: AEIdleUPP ): Boolean; external name '_InvokeAEIdleUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeAEFilterUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function InvokeAEFilterUPP( var theEvent: EventRecord; returnID: SInt32; transactionID: SInt32; const (*var*) sender: AEAddressDesc; userUPP: AEFilterUPP ): Boolean; external name '_InvokeAEFilterUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+end.

+ 222 - 0
packages/extra/univint/AEMach.pas

@@ -0,0 +1,222 @@
+{
+     File:       AEMach.p
+ 
+     Contains:   AppleEvent over mach_msg interfaces
+ 
+     Version:    Technology: For Mac OS X
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 2000-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEMach;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,MixedMode,AEDataModel;
+
+
+{$ALIGN MAC68K}
+
+{-
+ * AE Mach API --
+ *
+ * AppleEvents on OS X are implemented in terms of mach messages.
+ * To facilitate writing server processes that can send and receive
+ * AppleEvents, the following APIs are provided.
+ *
+ * AppleEvents are directed to a well known port uniquely tied to a
+ * process.  The AE framework will discover this port based on the
+ * keyAddressAttr of the event (as specifed in AECreateAppleEvent by
+ * the target parameter.)  If a port cannot be found,
+ * procNotFound (-600) will be returned on AESend.
+ *
+ * Of note is a new attribute for an AppleEvent, typeReplyPortAttr.
+ * This specifies the mach_port_t to which an AppleEvent reply
+ * should be directed.  By default, replies are sent to the
+ * processes registered port where they are culled from the normal  
+ * event stream if there is an outstanding AESend + kAEWaitReply.
+ * But it may be desirable for a client to specify their own port to
+ * receive quued replies.
+ * (In the case of AESendMessage with kAEWaitReply specified, an 
+ * anonymous port will be used to block until the reply is received.)
+ *
+ * Not supplied is a convenience routine to block a server and
+ * process AppleEvents.  This implementation will be detailed in a
+ * tech note.
+ *}
+
+const
+	typeReplyPortAttr			= $72657070 (* 'repp' *);
+
+{$ifc TARGET_RT_MAC_MACHO}
+{$ifc not undefined _MACH_MESSAGE_H_}
+	{	-
+	 * Return the mach_port_t that was registered with the bootstrap
+	 * server for this process.  This port is considered public, and
+	 * will be used by other applications to target your process.  You
+	 * are free to use this mach_port_t to add to a port set, if and
+	 * only if, you are not also using routines from HIToolbox.  In that
+	 * case, HIToolbox retains control of this port and AppleEvents are
+	 * dispatched through the main event loop.  
+	 *	}
+	{
+	 *  AEGetRegisteredMachPort()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   not available
+	 *    CarbonLib:        not available
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function AEGetRegisteredMachPort: mach_port_t; external name '_AEGetRegisteredMachPort';
+
+{-
+ * Decode a mach_msg into an AppleEvent and its related reply.  (The
+ * reply is set up from fields of the event.)  You can call this
+ * routine if you wish to dispatch or handle the event yourself.  To
+ * return a reply to the sender, you should call:
+ *
+ *  AESendMessage(reply, NULL, kAENoReply, kAENormalPriority, kAEDefaultTimeout);
+ *
+ * The contents of the header are invalid after this call.  
+ *}
+{
+ *  AEDecodeMessage()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEDecodeMessage(var header: mach_msg_header_t; var event: AppleEvent; reply: AppleEventPtr): OSStatus; external name '_AEDecodeMessage';
+
+{-
+ * Decodes and dispatches an event to an event handler.  Handles
+ * packaging and returning the reply to the sender.
+ *
+ * The contents of the header are invalid after this call.
+ *}
+{
+ *  AEProcessMessage()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEProcessMessage(var header: mach_msg_header_t): OSStatus; external name '_AEProcessMessage';
+
+{-
+ * Send an AppleEvent to a target process.  If the target is the
+ * current process (as specified by using typeProcessSerialNumber of
+ * ( 0, kCurrentProcess ) it is dispatched directly to the
+ * appropriate event handler in your process and not serialized.
+ *}
+{
+ *  AESendMessage()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AESendMessage(const (*var*) event: AppleEvent; reply: AppleEventPtr; sendMode: AESendMode; timeOutInTicks: SInt32): OSStatus; external name '_AESendMessage';
+
+{$endc}  {_MACH_MESSAGE_H_}
+{$endc}  {TARGET_RT_MAC_MACHO}
+
+{$ALIGN MAC68K}
+
+
+end.

+ 604 - 0
packages/extra/univint/AEObjects.pas

@@ -0,0 +1,604 @@
+{
+     File:       AEObjects.p
+ 
+     Contains:   Object Support Library Interfaces.
+ 
+     Version:    Technology: System 8.5
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1991-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEObjects;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,AEDataModel,OSUtils,AppleEvents,MacErrors;
+
+
+{$ALIGN MAC68K}
+
+
+const
+																{ *** LOGICAL OPERATOR CONSTANTS  *** }
+	kAEAND						= $414E4420 (* 'AND ' *);						{   0x414e4420   }
+	kAEOR						= $4F522020 (* 'OR  ' *);						{   0x4f522020   }
+	kAENOT						= $4E4F5420 (* 'NOT ' *);						{   0x4e4f5420   }
+																{ *** ABSOLUTE ORDINAL CONSTANTS  *** }
+	kAEFirst					= $66697273 (* 'firs' *);						{   0x66697273   }
+	kAELast						= $6C617374 (* 'last' *);						{   0x6c617374   }
+	kAEMiddle					= $6D696464 (* 'midd' *);						{   0x6d696464   }
+	kAEAny						= $616E7920 (* 'any ' *);						{   0x616e7920   }
+	kAEAll						= $616C6C20 (* 'all ' *);						{   0x616c6c20   }
+																{ *** RELATIVE ORDINAL CONSTANTS  *** }
+	kAENext						= $6E657874 (* 'next' *);						{   0x6e657874   }
+	kAEPrevious					= $70726576 (* 'prev' *);						{   0x70726576   }
+																{ *** KEYWORD CONSTANT    *** }
+	keyAECompOperator			= $72656C6F (* 'relo' *);						{   0x72656c6f   }
+	keyAELogicalTerms			= $7465726D (* 'term' *);						{   0x7465726d   }
+	keyAELogicalOperator		= $6C6F6763 (* 'logc' *);						{   0x6c6f6763   }
+	keyAEObject1				= $6F626A31 (* 'obj1' *);						{   0x6f626a31   }
+	keyAEObject2				= $6F626A32 (* 'obj2' *);						{   0x6f626a32   }
+																{     ... for Keywords for getting fields out of object specifier records.  }
+	keyAEDesiredClass			= $77616E74 (* 'want' *);						{   0x77616e74   }
+	keyAEContainer				= $66726F6D (* 'from' *);						{   0x66726f6d   }
+	keyAEKeyForm				= $666F726D (* 'form' *);						{   0x666f726d   }
+	keyAEKeyData				= $73656C64 (* 'seld' *);						{   0x73656c64   }
+
+																{     ... for Keywords for getting fields out of Range specifier records.  }
+	keyAERangeStart				= $73746172 (* 'star' *);						{   0x73746172   }
+	keyAERangeStop				= $73746F70 (* 'stop' *);						{   0x73746f70   }
+																{     ... special handler selectors for OSL Callbacks.  }
+	keyDisposeTokenProc			= $78746F6B (* 'xtok' *);						{   0x78746f6b   }
+	keyAECompareProc			= $636D7072 (* 'cmpr' *);						{   0x636d7072   }
+	keyAECountProc				= $636F6E74 (* 'cont' *);						{   0x636f6e74   }
+	keyAEMarkTokenProc			= $6D6B6964 (* 'mkid' *);						{   0x6d6b6964   }
+	keyAEMarkProc				= $6D61726B (* 'mark' *);						{   0x6d61726b   }
+	keyAEAdjustMarksProc		= $61646A6D (* 'adjm' *);						{   0x61646a6d   }
+	keyAEGetErrDescProc			= $696E6463 (* 'indc' *);						{   0x696e6463   }
+
+	{	***   VALUE and type CONSTANTS    ***	}
+																{     ... possible values for the keyAEKeyForm field of an object specifier.  }
+	formAbsolutePosition		= $696E6478 (* 'indx' *);						{   0x696e6478   }
+	formRelativePosition		= $72656C65 (* 'rele' *);						{   0x72656c65   }
+	formTest					= $74657374 (* 'test' *);						{   0x74657374   }
+	formRange					= $72616E67 (* 'rang' *);						{   0x72616e67   }
+	formPropertyID				= $70726F70 (* 'prop' *);						{   0x70726f70   }
+	formName					= $6E616D65 (* 'name' *);						{   0x6e616d65   }
+																{     ... relevant types (some of these are often pared with forms above).  }
+	typeObjectSpecifier			= $6F626A20 (* 'obj ' *);						{   0x6f626a20   }
+	typeObjectBeingExamined		= $65786D6E (* 'exmn' *);						{   0x65786d6e   }
+	typeCurrentContainer		= $63636E74 (* 'ccnt' *);						{   0x63636e74   }
+	typeToken					= $746F6B65 (* 'toke' *);						{   0x746f6b65   }
+	typeRelativeDescriptor		= $72656C20 (* 'rel ' *);						{   0x72656c20   }
+	typeAbsoluteOrdinal			= $6162736F (* 'abso' *);						{   0x6162736f   }
+	typeIndexDescriptor			= $696E6465 (* 'inde' *);						{   0x696e6465   }
+	typeRangeDescriptor			= $72616E67 (* 'rang' *);						{   0x72616e67   }
+	typeLogicalDescriptor		= $6C6F6769 (* 'logi' *);						{   0x6c6f6769   }
+	typeCompDescriptor			= $636D7064 (* 'cmpd' *);						{   0x636d7064   }
+	typeOSLTokenList			= $6F73746C (* 'ostl' *);						{   0x6F73746C   }
+
+	{	 Possible values for flags parameter to AEResolve.  They're additive 	}
+	kAEIDoMinimum				= $0000;
+	kAEIDoWhose					= $0001;
+	kAEIDoMarking				= $0004;
+	kAEPassSubDescs				= $0008;
+	kAEResolveNestedLists		= $0010;
+	kAEHandleSimpleRanges		= $0020;
+	kAEUseRelativeIterators		= $0040;
+
+	{	*** SPECIAL CONSTANTS FOR CUSTOM WHOSE-CLAUSE RESOLUTION 	}
+	typeWhoseDescriptor			= $77686F73 (* 'whos' *);						{   0x77686f73   }
+	formWhose					= $77686F73 (* 'whos' *);						{   0x77686f73   }
+	typeWhoseRange				= $77726E67 (* 'wrng' *);						{   0x77726e67   }
+	keyAEWhoseRangeStart		= $77737472 (* 'wstr' *);						{   0x77737472   }
+	keyAEWhoseRangeStop			= $77737470 (* 'wstp' *);						{   0x77737470   }
+	keyAEIndex					= $6B696478 (* 'kidx' *);						{   0x6b696478   }
+	keyAETest					= $6B747374 (* 'ktst' *);						{   0x6b747374   }
+
+	{	
+	    used for rewriting tokens in place of 'ccnt' descriptors
+	    This record is only of interest to those who, when they...
+	    ...get ranges as key data in their accessor procs, choose
+	    ...to resolve them manually rather than call AEResolve again.
+		}
+
+type
+	ccntTokenRecordPtr = ^ccntTokenRecord;
+	ccntTokenRecord = record
+		tokenClass:				DescType;
+		token:					AEDesc;
+	end;
+
+	ccntTokenRecPtr						= ^ccntTokenRecord;
+	ccntTokenRecHandle					= ^ccntTokenRecPtr;
+{$ifc OLDROUTINENAMES}
+	DescPtr								= ^AEDesc;
+	DescHandle							= ^DescPtr;
+{$endc}  {OLDROUTINENAMES}
+
+	{	 typedefs providing type checking for procedure pointers 	}
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLAccessorProcPtr = function(desiredClass: DescType; const (*var*) container: AEDesc; containerClass: DescType; form: DescType; const (*var*) selectionData: AEDesc; var value: AEDesc; accessorRefcon: SInt32): OSErr;
+{$elsec}
+	OSLAccessorProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLCompareProcPtr = function(oper: DescType; const (*var*) obj1: AEDesc; const (*var*) obj2: AEDesc; var result: boolean): OSErr;
+{$elsec}
+	OSLCompareProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLCountProcPtr = function(desiredType: DescType; containerClass: DescType; const (*var*) container: AEDesc; var result: SInt32): OSErr;
+{$elsec}
+	OSLCountProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLDisposeTokenProcPtr = function(var unneededToken: AEDesc): OSErr;
+{$elsec}
+	OSLDisposeTokenProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLGetMarkTokenProcPtr = function(const (*var*) dContainerToken: AEDesc; containerClass: DescType; var result: AEDesc): OSErr;
+{$elsec}
+	OSLGetMarkTokenProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLGetErrDescProcPtr = function(var appDescPtr: AEDescPtr): OSErr;
+{$elsec}
+	OSLGetErrDescProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLMarkProcPtr = function(const (*var*) dToken: AEDesc; const (*var*) markToken: AEDesc; index: SInt32): OSErr;
+{$elsec}
+	OSLMarkProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	OSLAdjustMarksProcPtr = function(newStart: SInt32; newStop: SInt32; const (*var*) markToken: AEDesc): OSErr;
+{$elsec}
+	OSLAdjustMarksProcPtr = ProcPtr;
+{$endc}
+
+{$ifc OPAQUE_UPP_TYPES}
+	OSLAccessorUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLAccessorUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLCompareUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLCompareUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLCountUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLCountUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLDisposeTokenUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLDisposeTokenUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLGetMarkTokenUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLGetMarkTokenUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLGetErrDescUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLGetErrDescUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLMarkUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLMarkUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	OSLAdjustMarksUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	OSLAdjustMarksUPP = UniversalProcPtr;
+{$endc}	
+
+const
+	uppOSLAccessorProcInfo = $000FFFE0;
+	uppOSLCompareProcInfo = $00003FE0;
+	uppOSLCountProcInfo = $00003FE0;
+	uppOSLDisposeTokenProcInfo = $000000E0;
+	uppOSLGetMarkTokenProcInfo = $00000FE0;
+	uppOSLGetErrDescProcInfo = $000000E0;
+	uppOSLMarkProcInfo = $00000FE0;
+	uppOSLAdjustMarksProcInfo = $00000FE0;
+	{
+	 *  NewOSLAccessorUPP()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   available as macro/inline
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewOSLAccessorUPP(userRoutine: OSLAccessorProcPtr): OSLAccessorUPP; external name '_NewOSLAccessorUPP'; { old name was NewOSLAccessorProc }
+{
+ *  NewOSLCompareUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLCompareUPP(userRoutine: OSLCompareProcPtr): OSLCompareUPP; external name '_NewOSLCompareUPP'; { old name was NewOSLCompareProc }
+{
+ *  NewOSLCountUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLCountUPP(userRoutine: OSLCountProcPtr): OSLCountUPP; external name '_NewOSLCountUPP'; { old name was NewOSLCountProc }
+{
+ *  NewOSLDisposeTokenUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLDisposeTokenUPP(userRoutine: OSLDisposeTokenProcPtr): OSLDisposeTokenUPP; external name '_NewOSLDisposeTokenUPP'; { old name was NewOSLDisposeTokenProc }
+{
+ *  NewOSLGetMarkTokenUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLGetMarkTokenUPP(userRoutine: OSLGetMarkTokenProcPtr): OSLGetMarkTokenUPP; external name '_NewOSLGetMarkTokenUPP'; { old name was NewOSLGetMarkTokenProc }
+{
+ *  NewOSLGetErrDescUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLGetErrDescUPP(userRoutine: OSLGetErrDescProcPtr): OSLGetErrDescUPP; external name '_NewOSLGetErrDescUPP'; { old name was NewOSLGetErrDescProc }
+{
+ *  NewOSLMarkUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLMarkUPP(userRoutine: OSLMarkProcPtr): OSLMarkUPP; external name '_NewOSLMarkUPP'; { old name was NewOSLMarkProc }
+{
+ *  NewOSLAdjustMarksUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewOSLAdjustMarksUPP(userRoutine: OSLAdjustMarksProcPtr): OSLAdjustMarksUPP; external name '_NewOSLAdjustMarksUPP'; { old name was NewOSLAdjustMarksProc }
+{
+ *  DisposeOSLAccessorUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLAccessorUPP(userUPP: OSLAccessorUPP); external name '_DisposeOSLAccessorUPP';
+{
+ *  DisposeOSLCompareUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLCompareUPP(userUPP: OSLCompareUPP); external name '_DisposeOSLCompareUPP';
+{
+ *  DisposeOSLCountUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLCountUPP(userUPP: OSLCountUPP); external name '_DisposeOSLCountUPP';
+{
+ *  DisposeOSLDisposeTokenUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLDisposeTokenUPP(userUPP: OSLDisposeTokenUPP); external name '_DisposeOSLDisposeTokenUPP';
+{
+ *  DisposeOSLGetMarkTokenUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLGetMarkTokenUPP(userUPP: OSLGetMarkTokenUPP); external name '_DisposeOSLGetMarkTokenUPP';
+{
+ *  DisposeOSLGetErrDescUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLGetErrDescUPP(userUPP: OSLGetErrDescUPP); external name '_DisposeOSLGetErrDescUPP';
+{
+ *  DisposeOSLMarkUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLMarkUPP(userUPP: OSLMarkUPP); external name '_DisposeOSLMarkUPP';
+{
+ *  DisposeOSLAdjustMarksUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeOSLAdjustMarksUPP(userUPP: OSLAdjustMarksUPP); external name '_DisposeOSLAdjustMarksUPP';
+{
+ *  InvokeOSLAccessorUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLAccessorUPP(desiredClass: DescType; const (*var*) container: AEDesc; containerClass: DescType; form: DescType; const (*var*) selectionData: AEDesc; var value: AEDesc; accessorRefcon: SInt32; userRoutine: OSLAccessorUPP): OSErr; external name '_InvokeOSLAccessorUPP'; { old name was CallOSLAccessorProc }
+{
+ *  InvokeOSLCompareUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLCompareUPP(oper: DescType; const (*var*) obj1: AEDesc; const (*var*) obj2: AEDesc; var result: boolean; userRoutine: OSLCompareUPP): OSErr; external name '_InvokeOSLCompareUPP'; { old name was CallOSLCompareProc }
+{
+ *  InvokeOSLCountUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLCountUPP(desiredType: DescType; containerClass: DescType; const (*var*) container: AEDesc; var result: SInt32; userRoutine: OSLCountUPP): OSErr; external name '_InvokeOSLCountUPP'; { old name was CallOSLCountProc }
+{
+ *  InvokeOSLDisposeTokenUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLDisposeTokenUPP(var unneededToken: AEDesc; userRoutine: OSLDisposeTokenUPP): OSErr; external name '_InvokeOSLDisposeTokenUPP'; { old name was CallOSLDisposeTokenProc }
+{
+ *  InvokeOSLGetMarkTokenUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLGetMarkTokenUPP(const (*var*) dContainerToken: AEDesc; containerClass: DescType; var result: AEDesc; userRoutine: OSLGetMarkTokenUPP): OSErr; external name '_InvokeOSLGetMarkTokenUPP'; { old name was CallOSLGetMarkTokenProc }
+{
+ *  InvokeOSLGetErrDescUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLGetErrDescUPP(var appDescPtr: AEDescPtr; userRoutine: OSLGetErrDescUPP): OSErr; external name '_InvokeOSLGetErrDescUPP'; { old name was CallOSLGetErrDescProc }
+{
+ *  InvokeOSLMarkUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLMarkUPP(const (*var*) dToken: AEDesc; const (*var*) markToken: AEDesc; index: SInt32; userRoutine: OSLMarkUPP): OSErr; external name '_InvokeOSLMarkUPP'; { old name was CallOSLMarkProc }
+{
+ *  InvokeOSLAdjustMarksUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeOSLAdjustMarksUPP(newStart: SInt32; newStop: SInt32; const (*var*) markToken: AEDesc; userRoutine: OSLAdjustMarksUPP): OSErr; external name '_InvokeOSLAdjustMarksUPP'; { old name was CallOSLAdjustMarksProc }
+{
+ *  AEObjectInit()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEObjectInit: OSErr; external name '_AEObjectInit';
+
+{ Not done by inline, but by direct linking into code.  It sets up the pack
+  such that further calls can be via inline }
+{
+ *  AESetObjectCallbacks()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AESetObjectCallbacks(myCompareProc: OSLCompareUPP; myCountProc: OSLCountUPP; myDisposeTokenProc: OSLDisposeTokenUPP; myGetMarkTokenProc: OSLGetMarkTokenUPP; myMarkProc: OSLMarkUPP; myAdjustMarksProc: OSLAdjustMarksUPP; myGetErrDescProcPtr: OSLGetErrDescUPP): OSErr; external name '_AESetObjectCallbacks';
+{
+ *  AEResolve()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEResolve(const (*var*) objectSpecifier: AEDesc; callbackFlags: SInt16; var theToken: AEDesc): OSErr; external name '_AEResolve';
+{
+ *  AEInstallObjectAccessor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEInstallObjectAccessor(desiredClass: DescType; containerType: DescType; theAccessor: OSLAccessorUPP; accessorRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEInstallObjectAccessor';
+{
+ *  AERemoveObjectAccessor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AERemoveObjectAccessor(desiredClass: DescType; containerType: DescType; theAccessor: OSLAccessorUPP; isSysHandler: boolean): OSErr; external name '_AERemoveObjectAccessor';
+{
+ *  AEGetObjectAccessor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetObjectAccessor(desiredClass: DescType; containerType: DescType; var accessor: OSLAccessorUPP; var accessorRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEGetObjectAccessor';
+{
+ *  AEDisposeToken()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEDisposeToken(var theToken: AEDesc): OSErr; external name '_AEDisposeToken';
+{
+ *  AECallObjectAccessor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AECallObjectAccessor(desiredClass: DescType; const (*var*) containerToken: AEDesc; containerClass: DescType; keyForm: DescType; const (*var*) keyData: AEDesc; var token: AEDesc): OSErr; external name '_AECallObjectAccessor';
+{$ALIGN MAC68K}
+
+
+end.

+ 167 - 0
packages/extra/univint/AEPackObject.pas

@@ -0,0 +1,167 @@
+{
+     File:       AEPackObject.p
+ 
+     Contains:   AppleEvents object packing Interfaces.
+ 
+     Version:    Technology: System 7.5
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1991-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEPackObject;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,AEDataModel,AppleEvents;
+
+
+{$ALIGN MAC68K}
+
+{ These are the object packing routines.  }
+{
+ *  CreateOffsetDescriptor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function CreateOffsetDescriptor(theOffset: SInt32; var theDescriptor: AEDesc): OSErr; external name '_CreateOffsetDescriptor';
+
+{
+ *  CreateCompDescriptor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function CreateCompDescriptor(comparisonOperator: DescType; var operand1: AEDesc; var operand2: AEDesc; disposeInputs: boolean; var theDescriptor: AEDesc): OSErr; external name '_CreateCompDescriptor';
+
+{
+ *  CreateLogicalDescriptor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function CreateLogicalDescriptor(var theLogicalTerms: AEDescList; theLogicOperator: DescType; disposeInputs: boolean; var theDescriptor: AEDesc): OSErr; external name '_CreateLogicalDescriptor';
+
+
+{
+ *  CreateObjSpecifier()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function CreateObjSpecifier(desiredClass: DescType; var theContainer: AEDesc; keyForm: DescType; var keyData: AEDesc; disposeInputs: boolean; var objSpecifier: AEDesc): OSErr; external name '_CreateObjSpecifier';
+
+{
+ *  CreateRangeDescriptor()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in ObjectSupportLib 1.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function CreateRangeDescriptor(var rangeStart: AEDesc; var rangeStop: AEDesc; disposeInputs: boolean; var theDescriptor: AEDesc): OSErr; external name '_CreateRangeDescriptor';
+
+{$ALIGN MAC68K}
+
+
+end.

+ 1005 - 0
packages/extra/univint/AERegistry.pas

@@ -0,0 +1,1005 @@
+{
+     File:       AERegistry.p
+ 
+     Contains:   AppleEvents Registry Interface.
+ 
+     Version:    Technology: Mac OS 8.5
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1993-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AERegistry;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ATSTypes,MacErrors,AppleEvents;
+
+
+{$ALIGN MAC68K}
+
+
+const
+	cAEList						= $6C697374 (* 'list' *);						{   0x6c697374   }
+	cApplication				= $63617070 (* 'capp' *);						{   0x63617070   }
+	cArc						= $63617263 (* 'carc' *);						{   0x63617263   }
+	cBoolean					= $626F6F6C (* 'bool' *);						{   0x626f6f6c   }
+	cCell						= $6363656C (* 'ccel' *);						{   0x6363656c   }
+	cChar						= $63686120 (* 'cha ' *);						{   0x63686120   }
+	cColorTable					= $636C7274 (* 'clrt' *);						{   0x636c7274   }
+	cColumn						= $63636F6C (* 'ccol' *);						{   0x63636f6c   }
+	cDocument					= $646F6375 (* 'docu' *);						{   0x646f6375   }
+	cDrawingArea				= $63647277 (* 'cdrw' *);						{   0x63647277   }
+	cEnumeration				= $656E756D (* 'enum' *);						{   0x656e756d   }
+	cFile						= $66696C65 (* 'file' *);						{   0x66696c65   }
+	cFixed						= $66697864 (* 'fixd' *);						{   0x66697864   }
+	cFixedPoint					= $66706E74 (* 'fpnt' *);						{   0x66706e74   }
+	cFixedRectangle				= $66726374 (* 'frct' *);						{   0x66726374   }
+	cGraphicLine				= $676C696E (* 'glin' *);						{   0x676c696e   }
+	cGraphicObject				= $63676F62 (* 'cgob' *);						{   0x63676f62   }
+	cGraphicShape				= $63677368 (* 'cgsh' *);						{   0x63677368   }
+	cGraphicText				= $63677478 (* 'cgtx' *);						{   0x63677478   }
+	cGroupedGraphic				= $63706963 (* 'cpic' *);						{   0x63706963   }
+
+	cInsertionLoc				= $696E736C (* 'insl' *);						{   0x696e736c   }
+	cInsertionPoint				= $63696E73 (* 'cins' *);						{   0x63696e73   }
+	cIntlText					= $69747874 (* 'itxt' *);						{   0x69747874   }
+	cIntlWritingCode			= $696E746C (* 'intl' *);						{   0x696e746c   }
+	cItem						= $6369746D (* 'citm' *);						{   0x6369746d   }
+	cLine						= $636C696E (* 'clin' *);						{   0x636c696e   }
+	cLongDateTime				= $6C647420 (* 'ldt ' *);						{   0x6c647420   }
+	cLongFixed					= $6C667864 (* 'lfxd' *);						{   0x6c667864   }
+	cLongFixedPoint				= $6C667074 (* 'lfpt' *);						{   0x6c667074   }
+	cLongFixedRectangle			= $6C667263 (* 'lfrc' *);						{   0x6c667263   }
+	cLongInteger				= $6C6F6E67 (* 'long' *);						{   0x6c6f6e67   }
+	cLongPoint					= $6C706E74 (* 'lpnt' *);						{   0x6c706e74   }
+	cLongRectangle				= $6C726374 (* 'lrct' *);						{   0x6c726374   }
+	cMachineLoc					= $6D4C6F63 (* 'mLoc' *);						{   0x6d4c6f63   }
+	cMenu						= $636D6E75 (* 'cmnu' *);						{   0x636d6e75   }
+	cMenuItem					= $636D656E (* 'cmen' *);						{   0x636d656e   }
+	cObject						= $636F626A (* 'cobj' *);						{   0x636f626a   }
+	cObjectSpecifier			= $6F626A20 (* 'obj ' *);						{   0x6f626a20   }
+	cOpenableObject				= $636F6F62 (* 'coob' *);						{   0x636f6f62   }
+	cOval						= $636F766C (* 'covl' *);						{   0x636f766c   }
+
+	cParagraph					= $63706172 (* 'cpar' *);						{   0x63706172   }
+	cPICT						= $50494354 (* 'PICT' *);						{   0x50494354   }
+	cPixel						= $6370786C (* 'cpxl' *);						{   0x6370786c   }
+	cPixelMap					= $63706978 (* 'cpix' *);						{   0x63706978   }
+	cPolygon					= $6370676E (* 'cpgn' *);						{   0x6370676e   }
+	cProperty					= $70726F70 (* 'prop' *);						{   0x70726f70   }
+	cQDPoint					= $51447074 (* 'QDpt' *);						{   0x51447074   }
+	cQDRectangle				= $71647274 (* 'qdrt' *);						{   0x71647274   }
+	cRectangle					= $63726563 (* 'crec' *);						{   0x63726563   }
+	cRGBColor					= $63524742 (* 'cRGB' *);						{   0x63524742   }
+	cRotation					= $74726F74 (* 'trot' *);						{   0x74726f74   }
+	cRoundedRectangle			= $63727263 (* 'crrc' *);						{   0x63727263   }
+	cRow						= $63726F77 (* 'crow' *);						{   0x63726f77   }
+	cSelection					= $6373656C (* 'csel' *);						{   0x6373656c   }
+	cShortInteger				= $73686F72 (* 'shor' *);						{   0x73686f72   }
+	cTable						= $6374626C (* 'ctbl' *);						{   0x6374626c   }
+	cText						= $63747874 (* 'ctxt' *);						{   0x63747874   }
+	cTextFlow					= $63666C6F (* 'cflo' *);						{   0x63666c6f   }
+	cTextStyles					= $74737479 (* 'tsty' *);						{   0x74737479   }
+	cType						= $74797065 (* 'type' *);						{   0x74797065   }
+
+	cVersion					= $76657273 (* 'vers' *);						{   0x76657273   }
+	cWindow						= $6377696E (* 'cwin' *);						{   0x6377696e   }
+	cWord						= $63776F72 (* 'cwor' *);						{   0x63776f72   }
+	enumArrows					= $6172726F (* 'arro' *);						{   0x6172726f   }
+	enumJustification			= $6A757374 (* 'just' *);						{   0x6a757374   }
+	enumKeyForm					= $6B66726D (* 'kfrm' *);						{   0x6b66726d   }
+	enumPosition				= $706F7369 (* 'posi' *);						{   0x706f7369   }
+	enumProtection				= $7072746E (* 'prtn' *);						{   0x7072746e   }
+	enumQuality					= $7175616C (* 'qual' *);						{   0x7175616c   }
+	enumSaveOptions				= $7361766F (* 'savo' *);						{   0x7361766f   }
+	enumStyle					= $7374796C (* 'styl' *);						{   0x7374796c   }
+	enumTransferMode			= $7472616E (* 'tran' *);						{   0x7472616e   }
+	formUniqueID				= $49442020 (* 'ID  ' *);						{   0x49442020   }
+	kAEAbout					= $61626F75 (* 'abou' *);						{   0x61626f75   }
+	kAEAfter					= $61667465 (* 'afte' *);						{   0x61667465   }
+	kAEAliasSelection			= $73616C69 (* 'sali' *);						{   0x73616c69   }
+	kAEAllCaps					= $616C6370 (* 'alcp' *);						{   0x616c6370   }
+	kAEArrowAtEnd				= $6172656E (* 'aren' *);						{   0x6172656e   }
+	kAEArrowAtStart				= $61727374 (* 'arst' *);						{   0x61727374   }
+	kAEArrowBothEnds			= $6172626F (* 'arbo' *);						{   0x6172626f   }
+
+	kAEAsk						= $61736B20 (* 'ask ' *);						{   0x61736b20   }
+	kAEBefore					= $6265666F (* 'befo' *);						{   0x6265666f   }
+	kAEBeginning				= $62676E67 (* 'bgng' *);						{   0x62676e67   }
+	kAEBeginsWith				= $62677774 (* 'bgwt' *);						{   0x62677774   }
+	kAEBeginTransaction			= $62656769 (* 'begi' *);						{   0x62656769   }
+	kAEBold						= $626F6C64 (* 'bold' *);						{   0x626f6c64   }
+	kAECaseSensEquals			= $63736571 (* 'cseq' *);						{   0x63736571   }
+	kAECentered					= $63656E74 (* 'cent' *);						{   0x63656e74   }
+	kAEChangeView				= $76696577 (* 'view' *);						{   0x76696577   }
+	kAEClone					= $636C6F6E (* 'clon' *);						{   0x636c6f6e   }
+	kAEClose					= $636C6F73 (* 'clos' *);						{   0x636c6f73   }
+	kAECondensed				= $636F6E64 (* 'cond' *);						{   0x636f6e64   }
+	kAEContains					= $636F6E74 (* 'cont' *);						{   0x636f6e74   }
+	kAECopy						= $636F7079 (* 'copy' *);						{   0x636f7079   }
+	kAECoreSuite				= $636F7265 (* 'core' *);						{   0x636f7265   }
+	kAECountElements			= $636E7465 (* 'cnte' *);						{   0x636e7465   }
+	kAECreateElement			= $6372656C (* 'crel' *);						{   0x6372656c   }
+	kAECreatePublisher			= $63707562 (* 'cpub' *);						{   0x63707562   }
+	kAECut						= $63757420 (* 'cut ' *);						{   0x63757420   }
+	kAEDelete					= $64656C6F (* 'delo' *);						{   0x64656c6f   }
+
+	kAEDoObjectsExist			= $646F6578 (* 'doex' *);						{   0x646f6578   }
+	kAEDoScript					= $646F7363 (* 'dosc' *);						{   0x646f7363   }
+	kAEDrag						= $64726167 (* 'drag' *);						{   0x64726167   }
+	kAEDuplicateSelection		= $73647570 (* 'sdup' *);						{   0x73647570   }
+	kAEEditGraphic				= $65646974 (* 'edit' *);						{   0x65646974   }
+	kAEEmptyTrash				= $656D7074 (* 'empt' *);						{   0x656d7074   }
+	kAEEnd						= $656E6420 (* 'end ' *);						{   0x656e6420   }
+	kAEEndsWith					= $656E6473 (* 'ends' *);						{   0x656e6473   }
+	kAEEndTransaction			= $656E6474 (* 'endt' *);						{   0x656e6474   }
+	kAEEquals					= $3D202020 (* '=   ' *);						{   0x3d202020   }
+	kAEExpanded					= $70657870 (* 'pexp' *);						{   0x70657870   }
+	kAEFast						= $66617374 (* 'fast' *);						{   0x66617374   }
+	kAEFinderEvents				= $464E4452 (* 'FNDR' *);						{   0x464e4452   }
+	kAEFormulaProtect			= $6670726F (* 'fpro' *);						{   0x6670726f   }
+	kAEFullyJustified			= $66756C6C (* 'full' *);						{   0x66756c6c   }
+	kAEGetClassInfo				= $716F626A (* 'qobj' *);						{   0x716f626a   }
+	kAEGetData					= $67657464 (* 'getd' *);						{   0x67657464   }
+	kAEGetDataSize				= $6473697A (* 'dsiz' *);						{   0x6473697a   }
+	kAEGetEventInfo				= $67746569 (* 'gtei' *);						{   0x67746569   }
+	kAEGetInfoSelection			= $73696E66 (* 'sinf' *);						{   0x73696e66   }
+
+	kAEGetPrivilegeSelection	= $73707276 (* 'sprv' *);						{   0x73707276   }
+	kAEGetSuiteInfo				= $67747369 (* 'gtsi' *);						{   0x67747369   }
+	kAEGreaterThan				= $3E202020 (* '>   ' *);						{   0x3e202020   }
+	kAEGreaterThanEquals		= $3E3D2020 (* '>=  ' *);						{   0x3e3d2020   }
+	kAEGrow						= $67726F77 (* 'grow' *);						{   0x67726f77   }
+	kAEHidden					= $6869646E (* 'hidn' *);						{   0x6869646e   }
+	kAEHiQuality				= $68697175 (* 'hiqu' *);						{   0x68697175   }
+	kAEImageGraphic				= $696D6772 (* 'imgr' *);						{   0x696d6772   }
+	kAEIsUniform				= $6973756E (* 'isun' *);						{   0x6973756e   }
+	kAEItalic					= $6974616C (* 'ital' *);						{   0x6974616c   }
+	kAELeftJustified			= $6C656674 (* 'left' *);						{   0x6c656674   }
+	kAELessThan					= $3C202020 (* '<   ' *);						{   0x3c202020   }
+	kAELessThanEquals			= $3C3D2020 (* '<=  ' *);						{   0x3c3d2020   }
+	kAELowercase				= $6C6F7763 (* 'lowc' *);						{   0x6c6f7763   }
+	kAEMakeObjectsVisible		= $6D766973 (* 'mvis' *);						{   0x6d766973   }
+	kAEMiscStandards			= $6D697363 (* 'misc' *);						{   0x6d697363   }
+	kAEModifiable				= $6D6F6466 (* 'modf' *);						{   0x6d6f6466   }
+	kAEMove						= $6D6F7665 (* 'move' *);						{   0x6d6f7665   }
+	kAENo						= $6E6F2020 (* 'no  ' *);						{   0x6e6f2020   }
+	kAENoArrow					= $61726E6F (* 'arno' *);						{   0x61726e6f   }
+
+	kAENonmodifiable			= $6E6D6F64 (* 'nmod' *);						{   0x6e6d6f64   }
+	kAEOpen						= $6F646F63 (* 'odoc' *);						{   0x6f646f63   }
+	kAEOpenSelection			= $736F7065 (* 'sope' *);						{   0x736f7065   }
+	kAEOutline					= $6F75746C (* 'outl' *);						{   0x6f75746c   }
+	kAEPageSetup				= $70677375 (* 'pgsu' *);						{   0x70677375   }
+	kAEPaste					= $70617374 (* 'past' *);						{   0x70617374   }
+	kAEPlain					= $706C616E (* 'plan' *);						{   0x706c616e   }
+	kAEPrint					= $70646F63 (* 'pdoc' *);						{   0x70646f63   }
+	kAEPrintSelection			= $73707269 (* 'spri' *);						{   0x73707269   }
+	kAEPrintWindow				= $7077696E (* 'pwin' *);						{   0x7077696e   }
+	kAEPutAwaySelection			= $73707574 (* 'sput' *);						{   0x73707574   }
+	kAEQDAddOver				= $6164646F (* 'addo' *);						{   0x6164646f   }
+	kAEQDAddPin					= $61646470 (* 'addp' *);						{   0x61646470   }
+	kAEQDAdMax					= $61646D78 (* 'admx' *);						{   0x61646d78   }
+	kAEQDAdMin					= $61646D6E (* 'admn' *);						{   0x61646d6e   }
+	kAEQDBic					= $62696320 (* 'bic ' *);						{   0x62696320   }
+	kAEQDBlend					= $626C6E64 (* 'blnd' *);						{   0x626c6e64   }
+	kAEQDCopy					= $63707920 (* 'cpy ' *);						{   0x63707920   }
+	kAEQDNotBic					= $6E626963 (* 'nbic' *);						{   0x6e626963   }
+	kAEQDNotCopy				= $6E637079 (* 'ncpy' *);						{   0x6e637079   }
+
+	kAEQDNotOr					= $6E746F72 (* 'ntor' *);						{   0x6e746f72   }
+	kAEQDNotXor					= $6E786F72 (* 'nxor' *);						{   0x6e786f72   }
+	kAEQDOr						= $6F722020 (* 'or  ' *);						{   0x6f722020   }
+	kAEQDSubOver				= $7375626F (* 'subo' *);						{   0x7375626f   }
+	kAEQDSubPin					= $73756270 (* 'subp' *);						{   0x73756270   }
+	kAEQDSupplementalSuite		= $71647370 (* 'qdsp' *);						{   0x71647370   }
+	kAEQDXor					= $786F7220 (* 'xor ' *);						{   0x786f7220   }
+	kAEQuickdrawSuite			= $71647277 (* 'qdrw' *);						{   0x71647277   }
+	kAEQuitAll					= $71756961 (* 'quia' *);						{   0x71756961   }
+	kAERedo						= $7265646F (* 'redo' *);						{   0x7265646f   }
+	kAERegular					= $7265676C (* 'regl' *);						{   0x7265676c   }
+	kAEReopenApplication		= $72617070 (* 'rapp' *);						{   0x72617070   }
+	kAEReplace					= $72706C63 (* 'rplc' *);						{   0x72706c63   }
+	kAERequiredSuite			= $72657164 (* 'reqd' *);						{   0x72657164   }
+	kAERestart					= $72657374 (* 'rest' *);						{   0x72657374   }
+	kAERevealSelection			= $73726576 (* 'srev' *);						{   0x73726576   }
+	kAERevert					= $72767274 (* 'rvrt' *);						{   0x72767274   }
+	kAERightJustified			= $72676874 (* 'rght' *);						{   0x72676874   }
+	kAESave						= $73617665 (* 'save' *);						{   0x73617665   }
+	kAESelect					= $736C6374 (* 'slct' *);						{   0x736c6374   }
+	kAESetData					= $73657464 (* 'setd' *);						{   0x73657464   }
+
+	kAESetPosition				= $706F736E (* 'posn' *);						{   0x706f736e   }
+	kAEShadow					= $73686164 (* 'shad' *);						{   0x73686164   }
+	kAEShowClipboard			= $7368636C (* 'shcl' *);						{   0x7368636c   }
+	kAEShutDown					= $73687574 (* 'shut' *);						{   0x73687574   }
+	kAESleep					= $736C6570 (* 'slep' *);						{   0x736c6570   }
+	kAESmallCaps				= $736D6370 (* 'smcp' *);						{   0x736d6370   }
+	kAESpecialClassProperties	= $63402321 (* 'c@#!' *);						{   0x63402321   }
+	kAEStrikethrough			= $7374726B (* 'strk' *);						{   0x7374726b   }
+	kAESubscript				= $73627363 (* 'sbsc' *);						{   0x73627363   }
+	kAESuperscript				= $73707363 (* 'spsc' *);						{   0x73707363   }
+	kAETableSuite				= $74626C73 (* 'tbls' *);						{   0x74626c73   }
+	kAETextSuite				= $54455854 (* 'TEXT' *);						{   0x54455854   }
+	kAETransactionTerminated	= $7474726D (* 'ttrm' *);						{   0x7474726d   }
+	kAEUnderline				= $756E646C (* 'undl' *);						{   0x756e646c   }
+	kAEUndo						= $756E646F (* 'undo' *);						{   0x756e646f   }
+	kAEWholeWordEquals			= $77776571 (* 'wweq' *);						{   0x77776571   }
+	kAEYes						= $79657320 (* 'yes ' *);						{   0x79657320   }
+	kAEZoom						= $7A6F6F6D (* 'zoom' *);						{   0x7a6f6f6d   }
+
+	{	 EventRecord Classes and EventIDs 	}
+	kAEMouseClass				= $6D6F7573 (* 'mous' *);
+	kAEDown						= $646F776E (* 'down' *);
+	kAEUp						= $75702020 (* 'up  ' *);
+	kAEMoved					= $6D6F7665 (* 'move' *);
+	kAEStoppedMoving			= $73746F70 (* 'stop' *);
+	kAEWindowClass				= $77696E64 (* 'wind' *);
+	kAEUpdate					= $75706474 (* 'updt' *);
+	kAEActivate					= $61637476 (* 'actv' *);
+	kAEDeactivate				= $64616374 (* 'dact' *);
+	kAECommandClass				= $636D6E64 (* 'cmnd' *);						{  Modern Command Event Class  }
+	kAEKeyClass					= $6B657963 (* 'keyc' *);
+	kAERawKey					= $726B6579 (* 'rkey' *);						{  Modern Raw Key Event  }
+	kAEVirtualKey				= $6B657963 (* 'keyc' *);						{  Modern Virtual Key Event  }
+	kAENavigationKey			= $6E617665 (* 'nave' *);						{  Modern Navigation Key Event  }
+	kAEAutoDown					= $6175746F (* 'auto' *);
+	kAEApplicationClass			= $6170706C (* 'appl' *);
+	kAESuspend					= $73757370 (* 'susp' *);
+	kAEResume					= $72736D65 (* 'rsme' *);
+	kAEDiskEvent				= $6469736B (* 'disk' *);
+	kAENullEvent				= $6E756C6C (* 'null' *);
+	kAEWakeUpEvent				= $77616B65 (* 'wake' *);
+	kAEScrapEvent				= $73637270 (* 'scrp' *);
+	kAEHighLevel				= $68696768 (* 'high' *);
+
+	keyAEAngle					= $6B616E67 (* 'kang' *);						{   0x6b616e67   }
+	keyAEArcAngle				= $70617263 (* 'parc' *);						{   0x70617263   }
+
+	keyAEBaseAddr				= $62616464 (* 'badd' *);						{   0x62616464   }
+	keyAEBestType				= $70627374 (* 'pbst' *);						{   0x70627374   }
+	keyAEBgndColor				= $6B62636C (* 'kbcl' *);						{   0x6b62636c   }
+	keyAEBgndPattern			= $6B627074 (* 'kbpt' *);						{   0x6b627074   }
+	keyAEBounds					= $70626E64 (* 'pbnd' *);						{   0x70626e64   }
+	keyAECellList				= $6B636C74 (* 'kclt' *);						{   0x6b636c74   }
+	keyAEClassID				= $636C4944 (* 'clID' *);						{   0x636c4944   }
+	keyAEColor					= $636F6C72 (* 'colr' *);						{   0x636f6c72   }
+	keyAEColorTable				= $636C7462 (* 'cltb' *);						{   0x636c7462   }
+	keyAECurveHeight			= $6B636864 (* 'kchd' *);						{   0x6b636864   }
+	keyAECurveWidth				= $6B637764 (* 'kcwd' *);						{   0x6b637764   }
+	keyAEDashStyle				= $70647374 (* 'pdst' *);						{   0x70647374   }
+	keyAEData					= $64617461 (* 'data' *);						{   0x64617461   }
+	keyAEDefaultType			= $64656674 (* 'deft' *);						{   0x64656674   }
+	keyAEDefinitionRect			= $70647274 (* 'pdrt' *);						{   0x70647274   }
+	keyAEDescType				= $64737470 (* 'dstp' *);						{   0x64737470   }
+	keyAEDestination			= $64657374 (* 'dest' *);						{   0x64657374   }
+	keyAEDoAntiAlias			= $616E7461 (* 'anta' *);						{   0x616e7461   }
+	keyAEDoDithered				= $67646974 (* 'gdit' *);						{   0x67646974   }
+	keyAEDoRotate				= $6B647274 (* 'kdrt' *);						{   0x6b647274   }
+
+	keyAEDoScale				= $6B736361 (* 'ksca' *);						{   0x6b736361   }
+	keyAEDoTranslate			= $6B747261 (* 'ktra' *);						{   0x6b747261   }
+	keyAEEditionFileLoc			= $656C6F63 (* 'eloc' *);						{   0x656c6f63   }
+	keyAEElements				= $656C6D73 (* 'elms' *);						{   0x656c6d73   }
+	keyAEEndPoint				= $70656E64 (* 'pend' *);						{   0x70656e64   }
+	keyAEEventClass				= $6576636C (* 'evcl' *);						{   0x6576636c   }
+	keyAEEventID				= $65767469 (* 'evti' *);						{   0x65767469   }
+	keyAEFile					= $6B66696C (* 'kfil' *);						{   0x6b66696c   }
+	keyAEFileType				= $666C7470 (* 'fltp' *);						{   0x666c7470   }
+	keyAEFillColor				= $666C636C (* 'flcl' *);						{   0x666c636c   }
+	keyAEFillPattern			= $666C7074 (* 'flpt' *);						{   0x666c7074   }
+	keyAEFlipHorizontal			= $6B66686F (* 'kfho' *);						{   0x6b66686f   }
+	keyAEFlipVertical			= $6B667674 (* 'kfvt' *);						{   0x6b667674   }
+	keyAEFont					= $666F6E74 (* 'font' *);						{   0x666f6e74   }
+	keyAEFormula				= $70666F72 (* 'pfor' *);						{   0x70666f72   }
+	keyAEGraphicObjects			= $676F6273 (* 'gobs' *);						{   0x676f6273   }
+	keyAEID						= $49442020 (* 'ID  ' *);						{   0x49442020   }
+	keyAEImageQuality			= $67717561 (* 'gqua' *);						{   0x67717561   }
+	keyAEInsertHere				= $696E7368 (* 'insh' *);						{   0x696e7368   }
+	keyAEKeyForms				= $6B657966 (* 'keyf' *);						{   0x6b657966   }
+
+	keyAEKeyword				= $6B797764 (* 'kywd' *);						{   0x6b797764   }
+	keyAELevel					= $6C65766C (* 'levl' *);						{   0x6c65766c   }
+	keyAELineArrow				= $6172726F (* 'arro' *);						{   0x6172726f   }
+	keyAEName					= $706E616D (* 'pnam' *);						{   0x706e616d   }
+	keyAENewElementLoc			= $706E656C (* 'pnel' *);						{   0x706e656c   }
+	keyAEObject					= $6B6F626A (* 'kobj' *);						{   0x6b6f626a   }
+	keyAEObjectClass			= $6B6F636C (* 'kocl' *);						{   0x6b6f636c   }
+	keyAEOffStyles				= $6F667374 (* 'ofst' *);						{   0x6f667374   }
+	keyAEOnStyles				= $6F6E7374 (* 'onst' *);						{   0x6f6e7374   }
+	keyAEParameters				= $70726D73 (* 'prms' *);						{   0x70726d73   }
+	keyAEParamFlags				= $706D6667 (* 'pmfg' *);						{   0x706d6667   }
+	keyAEPenColor				= $7070636C (* 'ppcl' *);						{   0x7070636c   }
+	keyAEPenPattern				= $70707061 (* 'pppa' *);						{   0x70707061   }
+	keyAEPenWidth				= $70707764 (* 'ppwd' *);						{   0x70707764   }
+	keyAEPixelDepth				= $70647074 (* 'pdpt' *);						{   0x70647074   }
+	keyAEPixMapMinus			= $6B706D6D (* 'kpmm' *);						{   0x6b706d6d   }
+	keyAEPMTable				= $6B706D74 (* 'kpmt' *);						{   0x6b706d74   }
+	keyAEPointList				= $70746C74 (* 'ptlt' *);						{   0x70746c74   }
+	keyAEPointSize				= $7074737A (* 'ptsz' *);						{   0x7074737a   }
+	keyAEPosition				= $6B706F73 (* 'kpos' *);						{   0x6b706f73   }
+
+	keyAEPropData				= $70726474 (* 'prdt' *);						{   0x70726474   }
+	keyAEProperties				= $7170726F (* 'qpro' *);						{   0x7170726f   }
+	keyAEProperty				= $6B707270 (* 'kprp' *);						{   0x6b707270   }
+	keyAEPropFlags				= $70726667 (* 'prfg' *);						{   0x70726667   }
+	keyAEPropID					= $70726F70 (* 'prop' *);						{   0x70726f70   }
+	keyAEProtection				= $7070726F (* 'ppro' *);						{   0x7070726f   }
+	keyAERenderAs				= $6B72656E (* 'kren' *);						{   0x6b72656e   }
+	keyAERequestedType			= $72747970 (* 'rtyp' *);						{   0x72747970   }
+	keyAEResult					= $2D2D2D2D (* '----' *);						{   0x2d2d2d2d   }
+	keyAEResultInfo				= $7273696E (* 'rsin' *);						{   0x7273696e   }
+	keyAERotation				= $70726F74 (* 'prot' *);						{   0x70726f74   }
+	keyAERotPoint				= $6B727470 (* 'krtp' *);						{   0x6b727470   }
+	keyAERowList				= $6B726C73 (* 'krls' *);						{   0x6b726c73   }
+	keyAESaveOptions			= $7361766F (* 'savo' *);						{   0x7361766f   }
+	keyAEScale					= $7073636C (* 'pscl' *);						{   0x7073636c   }
+	keyAEScriptTag				= $70736374 (* 'psct' *);						{   0x70736374   }
+	keyAEShowWhere				= $73686F77 (* 'show' *);						{   0x73686f77   }
+	keyAEStartAngle				= $70616E67 (* 'pang' *);						{   0x70616e67   }
+	keyAEStartPoint				= $70737470 (* 'pstp' *);						{   0x70737470   }
+	keyAEStyles					= $6B737479 (* 'ksty' *);						{   0x6b737479   }
+
+	keyAESuiteID				= $73756974 (* 'suit' *);						{   0x73756974   }
+	keyAEText					= $6B747874 (* 'ktxt' *);						{   0x6b747874   }
+	keyAETextColor				= $70747863 (* 'ptxc' *);						{   0x70747863   }
+	keyAETextFont				= $70747866 (* 'ptxf' *);						{   0x70747866   }
+	keyAETextPointSize			= $70747073 (* 'ptps' *);						{   0x70747073   }
+	keyAETextStyles				= $74787374 (* 'txst' *);						{   0x74787374   }
+	keyAETextLineHeight			= $6B746C68 (* 'ktlh' *);						{  type ShortInteger  }
+	keyAETextLineAscent			= $6B746173 (* 'ktas' *);						{  type ShortInteger  }
+	keyAETheText				= $74687478 (* 'thtx' *);						{   0x74687478   }
+	keyAETransferMode			= $7070746D (* 'pptm' *);						{   0x7070746d   }
+	keyAETranslation			= $70747273 (* 'ptrs' *);						{   0x70747273   }
+	keyAETryAsStructGraf		= $746F6F67 (* 'toog' *);						{   0x746f6f67   }
+	keyAEUniformStyles			= $7573746C (* 'ustl' *);						{   0x7573746c   }
+	keyAEUpdateOn				= $70757064 (* 'pupd' *);						{   0x70757064   }
+	keyAEUserTerm				= $7574726D (* 'utrm' *);						{   0x7574726d   }
+	keyAEWindow					= $776E6477 (* 'wndw' *);						{   0x776e6477   }
+	keyAEWritingCode			= $77726364 (* 'wrcd' *);						{   0x77726364   }
+
+	keyMiscellaneous			= $666D7363 (* 'fmsc' *);						{   0x666d7363   }
+	keySelection				= $6673656C (* 'fsel' *);						{   0x6673656c   }
+	keyWindow					= $6B776E64 (* 'kwnd' *);						{   0x6b776e64   }
+																{  EventRecord keys  }
+	keyWhen						= $7768656E (* 'when' *);
+	keyWhere					= $77686572 (* 'wher' *);
+	keyModifiers				= $6D6F6473 (* 'mods' *);
+	keyKey						= $6B657920 (* 'key ' *);
+	keyKeyCode					= $636F6465 (* 'code' *);
+	keyKeyboard					= $6B657962 (* 'keyb' *);
+	keyDriveNumber				= $64727623 (* 'drv#' *);
+	keyErrorCode				= $65727223 (* 'err#' *);
+	keyHighLevelClass			= $68636C73 (* 'hcls' *);
+	keyHighLevelID				= $68696420 (* 'hid ' *);
+
+	pArcAngle					= $70617263 (* 'parc' *);						{   0x70617263   }
+	pBackgroundColor			= $7062636C (* 'pbcl' *);						{   0x7062636c   }
+	pBackgroundPattern			= $70627074 (* 'pbpt' *);						{   0x70627074   }
+	pBestType					= $70627374 (* 'pbst' *);						{   0x70627374   }
+	pBounds						= $70626E64 (* 'pbnd' *);						{   0x70626e64   }
+	pClass						= $70636C73 (* 'pcls' *);						{   0x70636c73   }
+	pClipboard					= $70636C69 (* 'pcli' *);						{   0x70636c69   }
+	pColor						= $636F6C72 (* 'colr' *);						{   0x636f6c72   }
+	pColorTable					= $636C7462 (* 'cltb' *);						{   0x636c7462   }
+	pContents					= $70636E74 (* 'pcnt' *);						{   0x70636e74   }
+	pCornerCurveHeight			= $70636864 (* 'pchd' *);						{   0x70636864   }
+	pCornerCurveWidth			= $70637764 (* 'pcwd' *);						{   0x70637764   }
+	pDashStyle					= $70647374 (* 'pdst' *);						{   0x70647374   }
+	pDefaultType				= $64656674 (* 'deft' *);						{   0x64656674   }
+	pDefinitionRect				= $70647274 (* 'pdrt' *);						{   0x70647274   }
+	pEnabled					= $656E626C (* 'enbl' *);						{   0x656e626c   }
+	pEndPoint					= $70656E64 (* 'pend' *);						{   0x70656e64   }
+	pFillColor					= $666C636C (* 'flcl' *);						{   0x666c636c   }
+	pFillPattern				= $666C7074 (* 'flpt' *);						{   0x666c7074   }
+	pFont						= $666F6E74 (* 'font' *);						{   0x666f6e74   }
+
+	pFormula					= $70666F72 (* 'pfor' *);						{   0x70666f72   }
+	pGraphicObjects				= $676F6273 (* 'gobs' *);						{   0x676f6273   }
+	pHasCloseBox				= $68636C62 (* 'hclb' *);						{   0x68636c62   }
+	pHasTitleBar				= $70746974 (* 'ptit' *);						{   0x70746974   }
+	pID							= $49442020 (* 'ID  ' *);						{   0x49442020   }
+	pIndex						= $70696478 (* 'pidx' *);						{   0x70696478   }
+	pInsertionLoc				= $70696E73 (* 'pins' *);						{   0x70696e73   }
+	pIsFloating					= $6973666C (* 'isfl' *);						{   0x6973666c   }
+	pIsFrontProcess				= $70697366 (* 'pisf' *);						{   0x70697366   }
+	pIsModal					= $706D6F64 (* 'pmod' *);						{   0x706d6f64   }
+	pIsModified					= $696D6F64 (* 'imod' *);						{   0x696d6f64   }
+	pIsResizable				= $7072737A (* 'prsz' *);						{   0x7072737a   }
+	pIsStationeryPad			= $70737064 (* 'pspd' *);						{   0x70737064   }
+	pIsZoomable					= $69737A6D (* 'iszm' *);						{   0x69737a6d   }
+	pIsZoomed					= $707A756D (* 'pzum' *);						{   0x707a756d   }
+	pItemNumber					= $69746D6E (* 'itmn' *);						{   0x69746d6e   }
+	pJustification				= $706A7374 (* 'pjst' *);						{   0x706a7374   }
+	pLineArrow					= $6172726F (* 'arro' *);						{   0x6172726f   }
+	pMenuID						= $6D6E6964 (* 'mnid' *);						{   0x6d6e6964   }
+	pName						= $706E616D (* 'pnam' *);						{   0x706e616d   }
+
+	pNewElementLoc				= $706E656C (* 'pnel' *);						{   0x706e656c   }
+	pPenColor					= $7070636C (* 'ppcl' *);						{   0x7070636c   }
+	pPenPattern					= $70707061 (* 'pppa' *);						{   0x70707061   }
+	pPenWidth					= $70707764 (* 'ppwd' *);						{   0x70707764   }
+	pPixelDepth					= $70647074 (* 'pdpt' *);						{   0x70647074   }
+	pPointList					= $70746C74 (* 'ptlt' *);						{   0x70746c74   }
+	pPointSize					= $7074737A (* 'ptsz' *);						{   0x7074737a   }
+	pProtection					= $7070726F (* 'ppro' *);						{   0x7070726f   }
+	pRotation					= $70726F74 (* 'prot' *);						{   0x70726f74   }
+	pScale						= $7073636C (* 'pscl' *);						{   0x7073636c   }
+	pScript						= $73637074 (* 'scpt' *);						{   0x73637074   }
+	pScriptTag					= $70736374 (* 'psct' *);						{   0x70736374   }
+	pSelected					= $73656C63 (* 'selc' *);						{   0x73656c63   }
+	pSelection					= $73656C65 (* 'sele' *);						{   0x73656c65   }
+	pStartAngle					= $70616E67 (* 'pang' *);						{   0x70616e67   }
+	pStartPoint					= $70737470 (* 'pstp' *);						{   0x70737470   }
+	pTextColor					= $70747863 (* 'ptxc' *);						{   0x70747863   }
+	pTextFont					= $70747866 (* 'ptxf' *);						{   0x70747866   }
+	pTextItemDelimiters			= $7478646C (* 'txdl' *);						{   0x7478646c   }
+	pTextPointSize				= $70747073 (* 'ptps' *);						{   0x70747073   }
+
+	pTextStyles					= $74787374 (* 'txst' *);						{   0x74787374   }
+	pTransferMode				= $7070746D (* 'pptm' *);						{   0x7070746d   }
+	pTranslation				= $70747273 (* 'ptrs' *);						{   0x70747273   }
+	pUniformStyles				= $7573746C (* 'ustl' *);						{   0x7573746c   }
+	pUpdateOn					= $70757064 (* 'pupd' *);						{   0x70757064   }
+	pUserSelection				= $7075736C (* 'pusl' *);						{   0x7075736c   }
+	pVersion					= $76657273 (* 'vers' *);						{   0x76657273   }
+	pVisible					= $70766973 (* 'pvis' *);						{   0x70766973   }
+
+	typeAEText					= $74545854 (* 'tTXT' *);						{   0x74545854   }
+	typeArc						= $63617263 (* 'carc' *);						{   0x63617263   }
+	typeBest					= $62657374 (* 'best' *);						{   0x62657374   }
+	typeCell					= $6363656C (* 'ccel' *);						{   0x6363656c   }
+	typeClassInfo				= $67636C69 (* 'gcli' *);						{   0x67636c69   }
+	typeColorTable				= $636C7274 (* 'clrt' *);						{   0x636c7274   }
+	typeColumn					= $63636F6C (* 'ccol' *);						{   0x63636f6c   }
+	typeDashStyle				= $74646173 (* 'tdas' *);						{   0x74646173   }
+	typeData					= $74647461 (* 'tdta' *);						{   0x74647461   }
+	typeDrawingArea				= $63647277 (* 'cdrw' *);						{   0x63647277   }
+	typeElemInfo				= $656C696E (* 'elin' *);						{   0x656c696e   }
+	typeEnumeration				= $656E756D (* 'enum' *);						{   0x656e756d   }
+	typeEPS						= $45505320 (* 'EPS ' *);						{   0x45505320   }
+	typeEventInfo				= $6576696E (* 'evin' *);						{   0x6576696e   }
+
+	typeFinderWindow			= $6677696E (* 'fwin' *);						{   0x6677696e   }
+	typeFixedPoint				= $66706E74 (* 'fpnt' *);						{   0x66706e74   }
+	typeFixedRectangle			= $66726374 (* 'frct' *);						{   0x66726374   }
+	typeGraphicLine				= $676C696E (* 'glin' *);						{   0x676c696e   }
+	typeGraphicText				= $63677478 (* 'cgtx' *);						{   0x63677478   }
+	typeGroupedGraphic			= $63706963 (* 'cpic' *);						{   0x63706963   }
+	typeInsertionLoc			= $696E736C (* 'insl' *);						{   0x696e736c   }
+	typeIntlText				= $69747874 (* 'itxt' *);						{   0x69747874   }
+	typeIntlWritingCode			= $696E746C (* 'intl' *);						{   0x696e746c   }
+	typeLongDateTime			= $6C647420 (* 'ldt ' *);						{   0x6c647420   }
+	typeLongFixed				= $6C667864 (* 'lfxd' *);						{   0x6c667864   }
+	typeLongFixedPoint			= $6C667074 (* 'lfpt' *);						{   0x6c667074   }
+	typeLongFixedRectangle		= $6C667263 (* 'lfrc' *);						{   0x6c667263   }
+	typeLongPoint				= $6C706E74 (* 'lpnt' *);						{   0x6c706e74   }
+	typeLongRectangle			= $6C726374 (* 'lrct' *);						{   0x6c726374   }
+	typeMachineLoc				= $6D4C6F63 (* 'mLoc' *);						{   0x6d4c6f63   }
+	typeOval					= $636F766C (* 'covl' *);						{   0x636f766c   }
+	typeParamInfo				= $706D696E (* 'pmin' *);						{   0x706d696e   }
+	typePict					= $50494354 (* 'PICT' *);						{   0x50494354   }
+
+	typePixelMap				= $63706978 (* 'cpix' *);						{   0x63706978   }
+	typePixMapMinus				= $74706D6D (* 'tpmm' *);						{   0x74706d6d   }
+	typePolygon					= $6370676E (* 'cpgn' *);						{   0x6370676e   }
+	typePropInfo				= $70696E66 (* 'pinf' *);						{   0x70696e66   }
+	typePtr						= $70747220 (* 'ptr ' *);						{   0x70747220   }
+	typeQDPoint					= $51447074 (* 'QDpt' *);						{   0x51447074   }
+	typeQDRegion				= $5172676E (* 'Qrgn' *);						{   0x51447074  (data is actual region data, including rectangle and size, _not_ region handle or ptr) }
+	typeRectangle				= $63726563 (* 'crec' *);						{   0x63726563   }
+	typeRGB16					= $74723136 (* 'tr16' *);						{   0x74723136   }
+	typeRGB96					= $74723936 (* 'tr96' *);						{   0x74723936   }
+	typeRGBColor				= $63524742 (* 'cRGB' *);						{   0x63524742   }
+	typeRotation				= $74726F74 (* 'trot' *);						{   0x74726f74   }
+	typeRoundedRectangle		= $63727263 (* 'crrc' *);						{   0x63727263   }
+	typeRow						= $63726F77 (* 'crow' *);						{   0x63726f77   }
+	typeScrapStyles				= $7374796C (* 'styl' *);						{   0x7374796c   }
+	typeScript					= $73637074 (* 'scpt' *);						{   0x73637074   }
+	typeStyledText				= $53545854 (* 'STXT' *);						{   0x53545854   }
+	typeSuiteInfo				= $7375696E (* 'suin' *);						{   0x7375696e   }
+	typeTable					= $6374626C (* 'ctbl' *);						{   0x6374626c   }
+	typeTextStyles				= $74737479 (* 'tsty' *);						{   0x74737479   }
+
+	typeTIFF					= $54494646 (* 'TIFF' *);						{   0x54494646   }
+	typeVersion					= $76657273 (* 'vers' *);						{   0x76657273   }
+
+	kAEMenuClass				= $6D656E75 (* 'menu' *);
+	kAEMenuSelect				= $6D686974 (* 'mhit' *);
+	kAEMouseDown				= $6D64776E (* 'mdwn' *);
+	kAEMouseDownInBack			= $6D64626B (* 'mdbk' *);
+	kAEKeyDown					= $6B64776E (* 'kdwn' *);
+	kAEResized					= $7273697A (* 'rsiz' *);
+	kAEPromise					= $70726F6D (* 'prom' *);
+
+	keyMenuID					= $6D696420 (* 'mid ' *);
+	keyMenuItem					= $6D69746D (* 'mitm' *);
+	keyCloseAllWindows			= $63617720 (* 'caw ' *);
+	keyOriginalBounds			= $6F626E64 (* 'obnd' *);
+	keyNewBounds				= $6E626E64 (* 'nbnd' *);
+	keyLocalWhere				= $6C776872 (* 'lwhr' *);
+
+	typeHIMenu					= $6D6F626A (* 'mobj' *);
+	typeHIWindow				= $776F626A (* 'wobj' *);
+
+	kBySmallIcon				= 0;
+	kByIconView					= 1;
+	kByNameView					= 2;
+	kByDateView					= 3;
+	kBySizeView					= 4;
+	kByKindView					= 5;
+	kByCommentView				= 6;
+	kByLabelView				= 7;
+	kByVersionView				= 8;
+
+	kAEInfo						= 11;
+	kAEMain						= 0;
+	kAESharing					= 13;
+
+	kAEZoomIn					= 7;
+	kAEZoomOut					= 8;
+
+	kTextServiceClass			= $74737663 (* 'tsvc' *);
+	kUpdateActiveInputArea		= $75706474 (* 'updt' *);						{  update the active input area  }
+	kShowHideInputWindow		= $73686977 (* 'shiw' *);						{  show or hide the input window  }
+	kPos2Offset					= $70327374 (* 'p2st' *);						{  converting global coordinates to char position  }
+	kOffset2Pos					= $73743270 (* 'st2p' *);						{  converting char position to global coordinates  }
+	kUnicodeNotFromInputMethod	= $756E696D (* 'unim' *);						{  Unicode text when event not handled by Input Method or no Input Method  }
+	kGetSelectedText			= $67747874 (* 'gtxt' *);						{  Get text for current selection  }
+	keyAETSMDocumentRefcon		= $72656663 (* 'refc' *);						{  TSM document refcon, typeLongInteger  }
+	keyAEServerInstance			= $73727669 (* 'srvi' *);						{  component instance  }
+	keyAETheData				= $6B646174 (* 'kdat' *);						{  typeText  }
+	keyAEFixLength				= $6669786C (* 'fixl' *);						{  fix len  }
+	keyAEUpdateRange			= $75646E67 (* 'udng' *);						{  typeTextRangeArray  }
+	keyAECurrentPoint			= $63706F73 (* 'cpos' *);						{  current point  }
+	keyAEBufferSize				= $62756666 (* 'buff' *);						{  buffer size to get the text  }
+	keyAEMoveView				= $6D767677 (* 'mvvw' *);						{  move view flag  }
+	keyAENextBody				= $6E786264 (* 'nxbd' *);						{  next or previous body  }
+	keyAETSMScriptTag			= $73636C67 (* 'sclg' *);
+	keyAETSMTextFont			= $6B747866 (* 'ktxf' *);						{  FMFontFamily or FOND ID  }
+	keyAETSMTextFMFont			= $6B74786D (* 'ktxm' *);						{  FMFont  }
+	keyAETSMTextPointSize		= $6B747073 (* 'ktps' *);
+	keyAETSMEventRecord			= $74657674 (* 'tevt' *);						{  Low level Event Record, typeLowLevelEventRecord  }
+	keyAETSMEventRef			= $74657672 (* 'tevr' *);						{  Carbon EventRef, typeEventRef  }
+	keyAETextServiceEncoding	= $7473656E (* 'tsen' *);						{  Text Service encoding, mac or Unicode in UpdateActiveInputArea or GetSelectedText events.  }
+	keyAETextServiceMacEncoding	= $746D656E (* 'tmen' *);						{  Target mac encoding for TSM conversion of text from Unicode text service.  }
+	typeTextRange				= $7478726E (* 'txrn' *);						{  TextRange  }
+	typeComponentInstance		= $636D7069 (* 'cmpi' *);						{  server instance  }
+	typeOffsetArray				= $6F666179 (* 'ofay' *);						{  offset array  }
+	typeTextRangeArray			= $74726179 (* 'tray' *);
+	typeLowLevelEventRecord		= $65767472 (* 'evtr' *);						{  Low Level Event Record  }
+	typeEventRef				= $65767266 (* 'evrf' *);						{  Carbon EventRef  }
+	typeText					= $54455854 (* 'TEXT' *);						{  Plain text  }
+
+
+	{	 Desc type constants 	}
+	kTSMOutsideOfBody			= 1;
+	kTSMInsideOfBody			= 2;
+	kTSMInsideOfActiveInputArea	= 3;
+
+	kNextBody					= 1;
+	kPreviousBody				= 2;
+
+
+type
+	TextRangePtr = ^TextRange;
+	TextRange = record
+		fStart:					SInt32;
+		fEnd:					SInt32;
+		fHiliteStyle:			SInt16;
+	end;
+
+	TextRangeHandle						= ^TextRangePtr;
+	TextRangeArrayPtr = ^TextRangeArray;
+	TextRangeArray = record
+		fNumOfRanges:			SInt16;								{  specify the size of the fRange array  }
+		fRange:					array [0..0] of TextRange;				{  when fNumOfRanges > 1, the size of this array has to be calculated  }
+	end;
+
+	TextRangeArrayHandle				= ^TextRangeArrayPtr;
+	OffsetArrayPtr = ^OffsetArray;
+	OffsetArray = record
+		fNumOfOffsets:			SInt16;								{  specify the size of the fOffset array  }
+		fOffset:				array [0..0] of SInt32;				{  when fNumOfOffsets > 1, the size of this array has to be calculated  }
+	end;
+
+	OffsetArrayHandle					= ^OffsetArrayPtr;
+	WritingCodePtr = ^WritingCode;
+	WritingCode = record
+		theScriptCode:			ScriptCode;
+		theLangCode:			LangCode;
+	end;
+
+	IntlTextPtr = ^IntlText;
+	IntlText = record
+		theScriptCode:			ScriptCode;
+		theLangCode:			LangCode;
+		theText:				SInt8;									{  variable length data  }
+	end;
+
+
+	{	 Hilite styles 	}
+
+const
+	kCaretPosition				= 1;							{  specify caret position  }
+	kRawText					= 2;							{  specify range of raw text  }
+	kSelectedRawText			= 3;							{  specify range of selected raw text  }
+	kConvertedText				= 4;							{  specify range of converted text  }
+	kSelectedConvertedText		= 5;							{  specify range of selected converted text  }
+	kBlockFillText				= 6;							{  Block Fill hilite style  }
+	kOutlineText				= 7;							{  Outline hilite style  }
+	kSelectedText				= 8;							{  Selected hilite style  }
+
+	keyAEHiliteRange			= $68726E67 (* 'hrng' *);						{  typeTextRangeArray for System 7, typeHiliteRangeArray for System 8  }
+	keyAEPinRange				= $706E7267 (* 'pnrg' *);						{  typeTextRange for System 7, typeTextRegionRange for System 8    }
+	keyAEClauseOffsets			= $636C6175 (* 'clau' *);						{  typeOffsetArray for System 7, typeClauseOffsetArray for System 8  }
+	keyAEOffset					= $6F667374 (* 'ofst' *);						{  typeLongInteger for System 7, typeByteOffset for System 8   }
+	keyAEPoint					= $67706F73 (* 'gpos' *);						{  typePoint for System 7, typeQDPoint for System 8  }
+	keyAELeftSide				= $6B6C6566 (* 'klef' *);						{  typeBoolean  }
+	keyAERegionClass			= $72676E63 (* 'rgnc' *);						{  typeShortInteger for System 7, typeRegionClass for System 8  }
+	keyAEDragging				= $626F6F6C (* 'bool' *);						{  typeBoolean  }
+
+
+{$ifc OLDROUTINENAMES}
+	keyAELeadingEdge			= $6B6C6566 (* 'klef' *);
+
+{$endc}  {OLDROUTINENAMES}
+
+																{  AppleScript 1.3: New Text types  }
+	typeUnicodeText				= $75747874 (* 'utxt' *);
+	typeStyledUnicodeText		= $73757478 (* 'sutx' *);
+	typeEncodedString			= $656E6373 (* 'encs' *);
+	typeCString					= $63737472 (* 'cstr' *);
+	typePString					= $70737472 (* 'pstr' *);
+
+																{  AppleScript 1.3: Unit types  }
+	typeMeters					= $6D657472 (* 'metr' *);						{  Base Unit  }
+	typeInches					= $696E6368 (* 'inch' *);
+	typeFeet					= $66656574 (* 'feet' *);
+	typeYards					= $79617264 (* 'yard' *);
+	typeMiles					= $6D696C65 (* 'mile' *);
+	typeKilometers				= $6B6D7472 (* 'kmtr' *);
+	typeCentimeters				= $636D7472 (* 'cmtr' *);
+	typeSquareMeters			= $7371726D (* 'sqrm' *);						{  Base Unit  }
+	typeSquareFeet				= $73716674 (* 'sqft' *);
+	typeSquareYards				= $73717964 (* 'sqyd' *);
+	typeSquareMiles				= $73716D69 (* 'sqmi' *);
+	typeSquareKilometers		= $73716B6D (* 'sqkm' *);
+	typeLiters					= $6C697472 (* 'litr' *);						{  Base Unit  }
+	typeQuarts					= $71727473 (* 'qrts' *);
+	typeGallons					= $67616C6E (* 'galn' *);
+	typeCubicMeters				= $636D6574 (* 'cmet' *);						{  Base Unit  }
+	typeCubicFeet				= $63666574 (* 'cfet' *);
+	typeCubicInches				= $6375696E (* 'cuin' *);
+	typeCubicCentimeter			= $63636D74 (* 'ccmt' *);
+	typeCubicYards				= $63797264 (* 'cyrd' *);
+	typeKilograms				= $6B67726D (* 'kgrm' *);						{  Base Unit  }
+	typeGrams					= $6772616D (* 'gram' *);
+	typeOunces					= $6F7A7320 (* 'ozs ' *);
+	typePounds					= $6C627320 (* 'lbs ' *);
+	typeDegreesC				= $64656763 (* 'degc' *);						{  Base Unit  }
+	typeDegreesF				= $64656766 (* 'degf' *);
+	typeDegreesK				= $6465676B (* 'degk' *);
+
+																{  AppleScript 1.3: Folder Actions  }
+	kFAServerApp				= $73737276 (* 'ssrv' *);						{  Creator code for Folder Actions Server }
+	kDoFolderActionEvent		= $666F6C61 (* 'fola' *);						{  Event the Finder sends to the Folder Actions FBA }
+	kFolderActionCode			= $6163746E (* 'actn' *);						{  Parameter that contains the Folder Action }
+	kFolderOpenedEvent			= $666F706E (* 'fopn' *);						{  Value of kFolderActionCode parameter; sent to script as event }
+	kFolderClosedEvent			= $66636C6F (* 'fclo' *);
+	kFolderWindowMovedEvent		= $6673697A (* 'fsiz' *);
+	kFolderItemsAddedEvent		= $66676574 (* 'fget' *);
+	kFolderItemsRemovedEvent	= $666C6F73 (* 'flos' *);
+	kItemList					= $666C7374 (* 'flst' *);						{  List parameter for added and removed items }
+	kNewSizeParameter			= $666E737A (* 'fnsz' *);						{  Parameter for moved window }
+	kFASuiteCode				= $6661636F (* 'faco' *);						{  Suite code for the following events }
+	kFAAttachCommand			= $61746661 (* 'atfa' *);						{  Attach event id }
+	kFARemoveCommand			= $726D6661 (* 'rmfa' *);						{  Remove event id }
+	kFAEditCommand				= $65646661 (* 'edfa' *);						{  Edit event id }
+	kFAFileParam				= $6661616C (* 'faal' *);						{  Key for file parameter for Attach }
+	kFAIndexParam				= $696E6478 (* 'indx' *);						{  Key for index (0-based) parameter for Remove and Edit }
+
+	{	 AppleScript 1.3 Internet Suite 	}
+																{  Suite code  }
+	kAEInternetSuite			= $6775726C (* 'gurl' *);
+	kAEISWebStarSuite			= $575757CE (* 'WWW½' *);
+
+																{  Events  }
+	kAEISGetURL					= $6775726C (* 'gurl' *);
+	KAEISHandleCGI				= $73646F63 (* 'sdoc' *);
+
+																{  Classes  }
+	cURL						= $75726C20 (* 'url ' *);
+	cInternetAddress			= $49504144 (* 'IPAD' *);
+	cHTML						= $68746D6C (* 'html' *);
+	cFTPItem					= $66747020 (* 'ftp ' *);
+
+																{  Parameters  }
+	kAEISHTTPSearchArgs			= $6B666F72 (* 'kfor' *);
+	kAEISPostArgs				= $706F7374 (* 'post' *);
+	kAEISMethod					= $6D657468 (* 'meth' *);
+	kAEISClientAddress			= $61646472 (* 'addr' *);
+	kAEISUserName				= $75736572 (* 'user' *);
+	kAEISPassword				= $70617373 (* 'pass' *);
+	kAEISFromUser				= $66726D75 (* 'frmu' *);
+	kAEISServerName				= $73766E6D (* 'svnm' *);
+	kAEISServerPort				= $73767074 (* 'svpt' *);
+	kAEISScriptName				= $73636E6D (* 'scnm' *);
+	kAEISContentType			= $63747970 (* 'ctyp' *);
+	kAEISReferrer				= $72656672 (* 'refr' *);
+	kAEISUserAgent				= $41676E74 (* 'Agnt' *);
+	kAEISAction					= $4B616374 (* 'Kact' *);
+	kAEISActionPath				= $4B617074 (* 'Kapt' *);
+	kAEISClientIP				= $4B636970 (* 'Kcip' *);
+	kAEISFullRequest			= $4B667271 (* 'Kfrq' *);
+
+																{  Properties  }
+	pScheme						= $70757363 (* 'pusc' *);
+	pHost						= $484F5354 (* 'HOST' *);
+	pPath						= $46545063 (* 'FTPc' *);
+	pUserName					= $5241756E (* 'RAun' *);
+	pUserPassword				= $52417077 (* 'RApw' *);
+	pDNSForm					= $70444E53 (* 'pDNS' *);
+	pURL						= $7055524C (* 'pURL' *);
+	pTextEncoding				= $70747865 (* 'ptxe' *);
+	pFTPKind					= $6B696E64 (* 'kind' *);
+
+																{  Scheme enumerations  }
+	eScheme						= $65736368 (* 'esch' *);
+	eurlHTTP					= $68747470 (* 'http' *);						{  RFC 2068  }
+	eurlHTTPS					= $68747073 (* 'htps' *);
+	eurlFTP						= $66747020 (* 'ftp ' *);						{  RFC 1738  }
+	eurlMail					= $6D61696C (* 'mail' *);						{  RFC 2638  }
+	eurlFile					= $66696C65 (* 'file' *);						{  RFC 1738  }
+	eurlGopher					= $67706872 (* 'gphr' *);						{  RFC 1738  }
+	eurlTelnet					= $746C6E74 (* 'tlnt' *);						{  RFC 1738  }
+	eurlNews					= $6E657773 (* 'news' *);						{  RFC 1738  }
+	eurlSNews					= $736E7773 (* 'snws' *);
+	eurlNNTP					= $6E6E7470 (* 'nntp' *);						{  RFC 1738  }
+	eurlMessage					= $6D657373 (* 'mess' *);
+	eurlMailbox					= $6D626F78 (* 'mbox' *);
+	eurlMulti					= $6D756C74 (* 'mult' *);
+	eurlLaunch					= $6C61756E (* 'laun' *);
+	eurlAFP						= $61667020 (* 'afp ' *);
+	eurlAT						= $61742020 (* 'at  ' *);
+	eurlEPPC					= $65707063 (* 'eppc' *);
+	eurlRTSP					= $72747370 (* 'rtsp' *);						{  RFC 2326  }
+	eurlIMAP					= $696D6170 (* 'imap' *);						{  RFC 2192  }
+	eurlNFS						= $756E6673 (* 'unfs' *);						{  RFC 2224  }
+	eurlPOP						= $75706F70 (* 'upop' *);						{  RFC 2384  }
+	eurlLDAP					= $756C6470 (* 'uldp' *);						{  RFC 2255  }
+	eurlUnknown					= $75726C3F (* 'url?' *);
+
+																{  AppleScript 1.3: Connectivity Suite in aeut  }
+	kConnSuite					= $6D616363 (* 'macc' *);
+	cDevSpec					= $63646576 (* 'cdev' *);
+	cAddressSpec				= $63616472 (* 'cadr' *);
+	cADBAddress					= $63616462 (* 'cadb' *);
+	cAppleTalkAddress			= $63617420 (* 'cat ' *);
+	cBusAddress					= $63627573 (* 'cbus' *);
+	cEthernetAddress			= $63656E20 (* 'cen ' *);
+	cFireWireAddress			= $63667720 (* 'cfw ' *);
+	cIPAddress					= $63697020 (* 'cip ' *);
+	cLocalTalkAddress			= $636C7420 (* 'clt ' *);
+	cSCSIAddress				= $63736373 (* 'cscs' *);
+	cTokenRingAddress			= $63746F6B (* 'ctok' *);
+	cUSBAddress					= $63757362 (* 'cusb' *);						{   }
+																{  Properties  }
+	pDeviceType					= $70647674 (* 'pdvt' *);
+	pDeviceAddress				= $70647661 (* 'pdva' *);
+	pConduit					= $70636F6E (* 'pcon' *);
+	pProtocol					= $70707274 (* 'pprt' *);						{  cde 4/27/98 was 'ppro' conflicted with DB suite  }
+	pATMachine					= $7061746D (* 'patm' *);
+	pATZone						= $7061747A (* 'patz' *);
+	pATType						= $70617474 (* 'patt' *);
+	pDottedDecimal				= $70697064 (* 'pipd' *);
+	pDNS						= $70646E73 (* 'pdns' *);
+	pPort						= $70706F72 (* 'ppor' *);
+	pNetwork					= $706E6574 (* 'pnet' *);
+	pNode						= $706E6F64 (* 'pnod' *);
+	pSocket						= $70736F63 (* 'psoc' *);
+	pSCSIBus					= $70736362 (* 'pscb' *);
+	pSCSILUN					= $70736C75 (* 'pslu' *);						{  cde 5/22/98 per WWDC developer request  }
+																{  Enumerations and enumerators  }
+	eDeviceType					= $65647674 (* 'edvt' *);
+	eAddressSpec				= $65616473 (* 'eads' *);
+	eConduit					= $65636F6E (* 'econ' *);
+	eProtocol					= $6570726F (* 'epro' *);
+	eADB						= $65616462 (* 'eadb' *);
+	eAnalogAudio				= $65706175 (* 'epau' *);
+	eAppleTalk					= $65706174 (* 'epat' *);
+	eAudioLineIn				= $65636169 (* 'ecai' *);
+	eAudioLineOut				= $6563616C (* 'ecal' *);						{  cde 4/24/98 changed from 'ecao' to not conflict  }
+	eAudioOut					= $6563616F (* 'ecao' *);
+	eBus						= $65627573 (* 'ebus' *);
+	eCDROM						= $65636420 (* 'ecd ' *);
+	eCommSlot					= $6563636D (* 'eccm' *);
+	eDigitalAudio				= $65706461 (* 'epda' *);
+	eDisplay					= $65646473 (* 'edds' *);
+	eDVD						= $65647664 (* 'edvd' *);
+	eEthernet					= $6563656E (* 'ecen' *);
+	eFireWire					= $65636677 (* 'ecfw' *);
+	eFloppy						= $65666420 (* 'efd ' *);
+	eHD							= $65686420 (* 'ehd ' *);
+	eInfrared					= $65636972 (* 'ecir' *);
+	eIP							= $65706970 (* 'epip' *);
+	eIrDA						= $65706972 (* 'epir' *);
+	eIRTalk						= $65706974 (* 'epit' *);
+	eKeyboard					= $656B6264 (* 'ekbd' *);
+	eLCD						= $65646C63 (* 'edlc' *);
+	eLocalTalk					= $65636C74 (* 'eclt' *);
+	eMacIP						= $65706D69 (* 'epmi' *);
+	eMacVideo					= $65706D76 (* 'epmv' *);
+	eMicrophone					= $65636D69 (* 'ecmi' *);
+	eModemPort					= $65636D70 (* 'ecmp' *);
+	eModemPrinterPort			= $656D7070 (* 'empp' *);
+	eModem						= $65646D6D (* 'edmm' *);
+	eMonitorOut					= $65636D6E (* 'ecmn' *);
+	eMouse						= $656D6F75 (* 'emou' *);
+	eNuBusCard					= $65646E62 (* 'ednb' *);
+	eNuBus						= $656E7562 (* 'enub' *);
+	ePCcard						= $65637063 (* 'ecpc' *);
+	ePCIbus						= $65637069 (* 'ecpi' *);
+	ePCIcard					= $65647069 (* 'edpi' *);
+	ePDSslot					= $65637064 (* 'ecpd' *);
+	ePDScard					= $65706473 (* 'epds' *);
+	ePointingDevice				= $65647064 (* 'edpd' *);
+	ePostScript					= $65707073 (* 'epps' *);
+	ePPP						= $65707070 (* 'eppp' *);
+	ePrinterPort				= $65637070 (* 'ecpp' *);
+	ePrinter					= $65647072 (* 'edpr' *);
+	eSvideo						= $65707376 (* 'epsv' *);
+	eSCSI						= $65637363 (* 'ecsc' *);
+	eSerial						= $65707372 (* 'epsr' *);
+	eSpeakers					= $65647370 (* 'edsp' *);
+	eStorageDevice				= $65647374 (* 'edst' *);
+	eSVGA						= $65707367 (* 'epsg' *);
+	eTokenRing					= $65746F6B (* 'etok' *);
+	eTrackball					= $6574726B (* 'etrk' *);
+	eTrackpad					= $65647470 (* 'edtp' *);
+	eUSB						= $65637573 (* 'ecus' *);
+	eVideoIn					= $65637669 (* 'ecvi' *);
+	eVideoMonitor				= $6564766D (* 'edvm' *);
+	eVideoOut					= $6563766F (* 'ecvo' *);
+
+																{  AppleScript 1.3: Keystroke class  }
+	cKeystroke					= $6B707273 (* 'kprs' *);
+	pKeystrokeKey				= $6B4D7367 (* 'kMsg' *);
+	pModifiers					= $6B4D6F64 (* 'kMod' *);
+	pKeyKind					= $6B6B6E64 (* 'kknd' *);
+	eModifiers					= $654D6473 (* 'eMds' *);
+	eOptionDown					= $4B6F7074 (* 'Kopt' *);
+	eCommandDown				= $4B636D64 (* 'Kcmd' *);
+	eControlDown				= $4B63746C (* 'Kctl' *);
+	eShiftDown					= $4B736674 (* 'Ksft' *);
+	eCapsLockDown				= $4B636C6B (* 'Kclk' *);
+	eKeyKind					= $656B7374 (* 'ekst' *);						{   }
+																{  Special keys all start with 'ks'  }
+	eEscapeKey					= $6B733500;					{  Third byte is virtual key code byte         }
+	eDeleteKey					= $6B733300;					{  (see IM Mac Toolbox Essentials, pp. 2-43)  }
+	eTabKey						= $6B733000;
+	eReturnKey					= $6B732400;
+	eClearKey					= $6B734700;
+	eEnterKey					= $6B734C00;
+	eUpArrowKey					= $6B737E00;
+	eDownArrowKey				= $6B737D00;
+	eLeftArrowKey				= $6B737B00;
+	eRightArrowKey				= $6B737C00;
+	eHelpKey					= $6B737200;
+	eHomeKey					= $6B737300;
+	ePageUpKey					= $6B737400;
+	ePageDownKey				= $6B737900;
+	eForwardDelKey				= $6B737500;
+	eEndKey						= $6B737700;
+	eF1Key						= $6B737A00;
+	eF2Key						= $6B737800;
+	eF3Key						= $6B736300;
+	eF4Key						= $6B737600;
+	eF5Key						= $6B736000;
+	eF6Key						= $6B736100;
+	eF7Key						= $6B736200;
+	eF8Key						= $6B736400;
+	eF9Key						= $6B736500;
+	eF10Key						= $6B736D00;
+	eF11Key						= $6B736700;
+	eF12Key						= $6B736F00;
+	eF13Key						= $6B736900;
+	eF14Key						= $6B736B00;
+	eF15Key						= $6B737100;
+
+{$ALIGN MAC68K}
+
+
+end.

+ 172 - 0
packages/extra/univint/AEUserTermTypes.pas

@@ -0,0 +1,172 @@
+{
+     File:       AEUserTermTypes.p
+ 
+     Contains:   AppleEvents AEUT resource format Interfaces.
+ 
+     Version:    Technology: System 7.5
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1991-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AEUserTermTypes;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ConditionalMacros;
+
+
+{$ALIGN MAC68K}
+
+
+const
+	kAEUserTerminology			= $61657574 (* 'aeut' *);						{   0x61657574   }
+	kAETerminologyExtension		= $61657465 (* 'aete' *);						{   0x61657465   }
+	kAEScriptingSizeResource	= $7363737A (* 'scsz' *);						{   0x7363737a   }
+	kAEOSAXSizeResource			= $6F73697A (* 'osiz' *);
+
+	kAEUTHasReturningParam		= 31;							{  if event has a keyASReturning param  }
+	kAEUTOptional				= 15;							{  if something is optional  }
+	kAEUTlistOfItems			= 14;							{  if property or reply is a list.  }
+	kAEUTEnumerated				= 13;							{  if property or reply is of an enumerated type.  }
+	kAEUTReadWrite				= 12;							{  if property is writable.  }
+	kAEUTChangesState			= 12;							{  if an event changes state.  }
+	kAEUTTightBindingFunction	= 12;							{  if this is a tight-binding precedence function.  }
+																{  AppleScript 1.3: new bits for reply, direct parameter, parameter, and property flags  }
+	kAEUTEnumsAreTypes			= 11;							{  if the enumeration is a list of types, not constants  }
+	kAEUTEnumListIsExclusive	= 10;							{  if the list of enumerations is a proper set  }
+	kAEUTReplyIsReference		= 9;							{  if the reply is a reference, not a value  }
+	kAEUTDirectParamIsReference	= 9;							{  if the direct parameter is a reference, not a value  }
+	kAEUTParamIsReference		= 9;							{  if the parameter is a reference, not a value  }
+	kAEUTPropertyIsReference	= 9;							{  if the property is a reference, not a value  }
+	kAEUTNotDirectParamIsTarget	= 8;							{  if the direct parameter is not the target of the event  }
+	kAEUTParamIsTarget			= 8;							{  if the parameter is the target of the event  }
+	kAEUTApostrophe				= 3;							{  if a term contains an apostrophe.  }
+	kAEUTFeminine				= 2;							{  if a term is feminine gender.  }
+	kAEUTMasculine				= 1;							{  if a term is masculine gender.  }
+	kAEUTPlural					= 0;							{  if a term is plural.  }
+
+
+type
+	TScriptingSizeResourcePtr = ^TScriptingSizeResource;
+	TScriptingSizeResource = record
+		scriptingSizeFlags:		SInt16;
+		minStackSize:			UInt32;
+		preferredStackSize:		UInt32;
+		maxStackSize:			UInt32;
+		minHeapSize:			UInt32;
+		preferredHeapSize:		UInt32;
+		maxHeapSize:			UInt32;
+	end;
+
+
+const
+	kLaunchToGetTerminology		= $8000;						{     If kLaunchToGetTerminology is 0, 'aete' is read directly from res file.  If set to 1, then launch and use 'gdut' to get terminology.  }
+	kDontFindAppBySignature		= $4000;						{     If kDontFindAppBySignature is 0, then find app with signature if lost.  If 1, then don't  }
+	kAlwaysSendSubject			= $2000;						{     If kAlwaysSendSubject 0, then send subject when appropriate. If 1, then every event has Subject Attribute  }
+
+	{	 old names for above bits. 	}
+	kReadExtensionTermsMask		= $8000;
+
+																{  AppleScript 1.3: Bit positions for osiz resource  }
+																{  AppleScript 1.3: Bit masks for osiz resources  }
+	kOSIZDontOpenResourceFile	= 15;							{  If set, resource file is not opened when osax is loaded  }
+	kOSIZdontAcceptRemoteEvents	= 14;							{  If set, handler will not be called with events from remote machines  }
+	kOSIZOpenWithReadPermission	= 13;							{  If set, file will be opened with read permission only  }
+	kOSIZCodeInSharedLibraries	= 11;							{  If set, loader will look for handler in shared library, not osax resources  }
+
+{$ALIGN MAC68K}
+
+
+end.

+ 290 - 0
packages/extra/univint/AIFF.pas

@@ -0,0 +1,290 @@
+{
+     File:       AIFF.p
+ 
+     Contains:   Definition of AIFF file format components.
+ 
+     Version:    Technology: System 8.5
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1989-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AIFF;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+
+
+{$ALIGN MAC68K}
+
+
+const
+	AIFFID						= $41494646 (* 'AIFF' *);
+	AIFCID						= $41494643 (* 'AIFC' *);
+	FormatVersionID				= $46564552 (* 'FVER' *);
+	CommonID					= $434F4D4D (* 'COMM' *);
+	FORMID						= $464F524D (* 'FORM' *);
+	SoundDataID					= $53534E44 (* 'SSND' *);
+	MarkerID					= $4D41524B (* 'MARK' *);
+	InstrumentID				= $494E5354 (* 'INST' *);
+	MIDIDataID					= $4D494449 (* 'MIDI' *);
+	AudioRecordingID			= $41455344 (* 'AESD' *);
+	ApplicationSpecificID		= $4150504C (* 'APPL' *);
+	CommentID					= $434F4D54 (* 'COMT' *);
+	NameID						= $4E414D45 (* 'NAME' *);
+	AuthorID					= $41555448 (* 'AUTH' *);
+	CopyrightID					= $28632920 (* '(c) ' *);
+	AnnotationID				= $414E4E4F (* 'ANNO' *);
+
+	NoLooping					= 0;
+	ForwardLooping				= 1;
+	ForwardBackwardLooping		= 2;
+
+																{  AIFF-C Versions  }
+	AIFCVersion1				= $A2805140;
+
+	{	 Compression Names 	}
+	NoneName					= 'not compressed';
+	ACE2to1Name					= 'ACE 2-to-1';
+	ACE8to3Name					= 'ACE 8-to-3';
+	MACE3to1Name				= 'MACE 3-to-1';
+	MACE6to1Name				= 'MACE 6-to-1';
+																{  Compression Types  }
+	NoneType					= $4E4F4E45 (* 'NONE' *);
+	ACE2Type					= $41434532 (* 'ACE2' *);
+	ACE8Type					= $41434538 (* 'ACE8' *);
+	MACE3Type					= $4D414333 (* 'MAC3' *);
+	MACE6Type					= $4D414336 (* 'MAC6' *);
+
+
+type
+	ID									= UInt32;
+	MarkerIdType						= SInt16;
+	ChunkHeaderPtr = ^ChunkHeader;
+	ChunkHeader = record
+		ckID:					ID;
+		ckSize:					SInt32;
+	end;
+
+	ContainerChunkPtr = ^ContainerChunk;
+	ContainerChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		formType:				ID;
+	end;
+
+	FormatVersionChunkPtr = ^FormatVersionChunk;
+	FormatVersionChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		timestamp:				UInt32;
+	end;
+
+	CommonChunkPtr = ^CommonChunk;
+	CommonChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		numChannels:			SInt16;
+		numSampleFrames:		UInt32;
+		sampleSize:				SInt16;
+		sampleRate:				extended80;
+	end;
+
+	ExtCommonChunkPtr = ^ExtCommonChunk;
+	ExtCommonChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		numChannels:			SInt16;
+		numSampleFrames:		UInt32;
+		sampleSize:				SInt16;
+		sampleRate:				extended80;
+		compressionType:		ID;
+		compressionName:		SInt8;									{  variable length array, Pascal string  }
+	end;
+
+	SoundDataChunkPtr = ^SoundDataChunk;
+	SoundDataChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		offset:					UInt32;
+		blockSize:				UInt32;
+	end;
+
+	MarkerPtr = ^Marker;
+	Marker = record
+		id:						MarkerIdType;
+		position:				UInt32;
+		markerName:				Str255;
+	end;
+
+	MarkerChunkPtr = ^MarkerChunk;
+	MarkerChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		numMarkers:				UInt16;
+		Markers:				array [0..0] of Marker;					{  variable length array  }
+	end;
+
+	AIFFLoopPtr = ^AIFFLoop;
+	AIFFLoop = record
+		playMode:				SInt16;
+		beginLoop:				MarkerIdType;
+		endLoop:				MarkerIdType;
+	end;
+
+	InstrumentChunkPtr = ^InstrumentChunk;
+	InstrumentChunk = packed record
+		ckID:					ID;
+		ckSize:					SInt32;
+		baseFrequency:			UInt8;
+		detune:					UInt8;
+		lowFrequency:			UInt8;
+		highFrequency:			UInt8;
+		lowVelocity:			UInt8;
+		highVelocity:			UInt8;
+		gain:					SInt16;
+		sustainLoop:			AIFFLoop;
+		releaseLoop:			AIFFLoop;
+	end;
+
+	MIDIDataChunkPtr = ^MIDIDataChunk;
+	MIDIDataChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		MIDIdata:				SInt8;									{  variable length array  }
+	end;
+
+	AudioRecordingChunkPtr = ^AudioRecordingChunk;
+	AudioRecordingChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		AESChannelStatus:		packed array [0..23] of UInt8;
+	end;
+
+	ApplicationSpecificChunkPtr = ^ApplicationSpecificChunk;
+	ApplicationSpecificChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		applicationSignature:	OSType;
+		data:					SInt8;									{  variable length array  }
+	end;
+
+	CommentPtr = ^Comment;
+	Comment = record
+		timeStamp:				UInt32;
+		marker:					MarkerIdType;
+		count:					UInt16;
+		text:					SInt8;									{  variable length array, Pascal string  }
+	end;
+
+	CommentsChunkPtr = ^CommentsChunk;
+	CommentsChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		numComments:			UInt16;
+		comments:				array [0..0] of Comment;				{  variable length array  }
+	end;
+
+	TextChunkPtr = ^TextChunk;
+	TextChunk = record
+		ckID:					ID;
+		ckSize:					SInt32;
+		text:					SInt8;									{  variable length array, Pascal string  }
+	end;
+
+{$ALIGN MAC68K}
+
+
+end.

+ 286 - 0
packages/extra/univint/ASDebugging.pas

@@ -0,0 +1,286 @@
+{
+     File:       ASDebugging.p
+ 
+     Contains:   AppleScript Debugging Interfaces.
+ 
+     Version:    Technology: AppleScript 1.1
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1992-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ASDebugging;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,AEDataModel,OSA,Files,Components,AppleEvents,AppleScript;
+
+
+{$ALIGN MAC68K}
+
+{*************************************************************************
+    Mode Flags
+*************************************************************************}
+{    This mode flag can be passed to OSASetProperty or OSASetHandler
+    and will prevent properties or handlers from being defined in a context
+    that doesn't already have bindings for them. An error is returned if
+    a current binding doesn't already exist. 
+}
+
+const
+	kOSAModeDontDefine			= $0001;
+
+	{	*************************************************************************
+	    Component Selectors
+	*************************************************************************	}
+	kASSelectSetPropertyObsolete = $1101;
+	kASSelectGetPropertyObsolete = $1102;
+	kASSelectSetHandlerObsolete	= $1103;
+	kASSelectGetHandlerObsolete	= $1104;
+	kASSelectGetAppTerminologyObsolete = $1105;
+	kASSelectSetProperty		= $1106;
+	kASSelectGetProperty		= $1107;
+	kASSelectSetHandler			= $1108;
+	kASSelectGetHandler			= $1109;
+	kASSelectGetAppTerminology	= $110A;
+	kASSelectGetSysTerminology	= $110B;
+	kASSelectGetPropertyNames	= $110C;
+	kASSelectGetHandlerNames	= $110D;
+
+	{	*************************************************************************
+	    Context Accessors
+	*************************************************************************	}
+	{
+	 *  OSASetProperty()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function OSASetProperty(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) variableName: AEDesc; scriptValueID: OSAID): OSAError; external name '_OSASetProperty';
+{
+ *  OSAGetProperty()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSAGetProperty(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) variableName: AEDesc; var resultingScriptValueID: OSAID): OSAError; external name '_OSAGetProperty';
+{
+ *  OSAGetPropertyNames()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSAGetPropertyNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; var resultingPropertyNames: AEDescList): OSAError; external name '_OSAGetPropertyNames';
+{
+ *  OSASetHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSASetHandler(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) handlerName: AEDesc; compiledScriptID: OSAID): OSAError; external name '_OSASetHandler';
+{
+ *  OSAGetHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSAGetHandler(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; const (*var*) handlerName: AEDesc; var resultingCompiledScriptID: OSAID): OSAError; external name '_OSAGetHandler';
+{
+ *  OSAGetHandlerNames()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSAGetHandlerNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; contextID: OSAID; var resultingHandlerNames: AEDescList): OSAError; external name '_OSAGetHandlerNames';
+{
+ *  OSAGetAppTerminology()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSAGetAppTerminology(scriptingComponent: ComponentInstance; modeFlags: SInt32; var fileSpec: FSSpec; terminologyID: SInt16; var didLaunch: boolean; var terminologyList: AEDesc): OSAError; external name '_OSAGetAppTerminology';
+{ Errors:
+       errOSASystemError        operation failed
+    }
+{
+ *  OSAGetSysTerminology()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function OSAGetSysTerminology(scriptingComponent: ComponentInstance; modeFlags: SInt32; terminologyID: SInt16; var terminologyList: AEDesc): OSAError; external name '_OSAGetSysTerminology';
+{ Errors:
+       errOSASystemError        operation failed
+    }
+{ Notes on terminology ID
+
+    A terminology ID is derived from script code and language code
+    as follows;
+
+        terminologyID = ((scriptCode & 0x7F) << 8) | (langCode & 0xFF)
+}
+{*************************************************************************
+    Obsolete versions provided for backward compatibility:
+}
+{
+ *  ASSetProperty()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASSetProperty(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) variableName: AEDesc; scriptValueID: OSAID): OSAError; external name '_ASSetProperty';
+{
+ *  ASGetProperty()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASGetProperty(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) variableName: AEDesc; var resultingScriptValueID: OSAID): OSAError; external name '_ASGetProperty';
+{
+ *  ASSetHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASSetHandler(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) handlerName: AEDesc; compiledScriptID: OSAID): OSAError; external name '_ASSetHandler';
+{
+ *  ASGetHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASGetHandler(scriptingComponent: ComponentInstance; contextID: OSAID; const (*var*) handlerName: AEDesc; var resultingCompiledScriptID: OSAID): OSAError; external name '_ASGetHandler';
+{
+ *  ASGetAppTerminology()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASGetAppTerminology(scriptingComponent: ComponentInstance; var fileSpec: FSSpec; terminologID: SInt16; var didLaunch: boolean; var terminologyList: AEDesc): OSAError; external name '_ASGetAppTerminology';
+{ Errors:
+        errOSASystemError       operation failed
+    }
+{************************************************************************}
+
+
+{$ALIGN MAC68K}
+
+
+end.

+ 374 - 0
packages/extra/univint/ASRegistry.pas

@@ -0,0 +1,374 @@
+{
+     File:       ASRegistry.p
+ 
+     Contains:   AppleScript Registry constants.
+ 
+     Version:    Technology: AppleScript 1.3
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1991-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ASRegistry;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,AERegistry,AEObjects;
+
+
+{$ALIGN MAC68K}
+
+
+const
+	keyAETarget					= $74617267 (* 'targ' *);
+	keySubjectAttr				= $7375626A (* 'subj' *);						{  Magic 'returning' parameter:  }
+	keyASReturning				= $4B72746E (* 'Krtn' *);						{  AppleScript Specific Codes:  }
+	kASAppleScriptSuite			= $61736372 (* 'ascr' *);
+	kASScriptEditorSuite		= $546F7953 (* 'ToyS' *);
+	kASTypeNamesSuite			= $74706E6D (* 'tpnm' *);						{  dynamic terminologies  }
+	typeAETE					= $61657465 (* 'aete' *);
+	typeAEUT					= $61657574 (* 'aeut' *);
+	kGetAETE					= $67647465 (* 'gdte' *);
+	kGetAEUT					= $67647574 (* 'gdut' *);
+	kUpdateAEUT					= $75647574 (* 'udut' *);
+	kUpdateAETE					= $75647465 (* 'udte' *);
+	kCleanUpAEUT				= $63647574 (* 'cdut' *);
+	kASComment					= $636D6E74 (* 'cmnt' *);
+	kASLaunchEvent				= $6E6F6F70 (* 'noop' *);
+	keyScszResource				= $7363737A (* 'scsz' *);
+	typeScszResource			= $7363737A (* 'scsz' *);						{  subroutine calls  }
+	kASSubroutineEvent			= $70736272 (* 'psbr' *);
+	keyASSubroutineName			= $736E616D (* 'snam' *);
+	kASPrepositionalSubroutine	= $70736272 (* 'psbr' *);
+	keyASPositionalArgs			= $70617267 (* 'parg' *);
+
+																{  Add this parameter to a Get Data result if your app handled the 'as' parameter  }
+	keyAppHandledCoercion		= $69646173 (* 'idas' *);
+
+																{  Miscellaneous AppleScript commands  }
+	kASStartLogEvent			= $6C6F6731 (* 'log1' *);
+	kASStopLogEvent				= $6C6F6730 (* 'log0' *);
+	kASCommentEvent				= $636D6E74 (* 'cmnt' *);
+
+
+	{	 Operator Events: 	}
+																{  Binary:  }
+	kASAdd						= $2B202020 (* '+   ' *);
+	kASSubtract					= $2D202020 (* '-   ' *);
+	kASMultiply					= $2A202020 (* '*   ' *);
+	kASDivide					= $2F202020 (* '/   ' *);
+	kASQuotient					= $64697620 (* 'div ' *);
+	kASRemainder				= $6D6F6420 (* 'mod ' *);
+	kASPower					= $5E202020 (* '^   ' *);
+	kASEqual					= $3D202020 (* '=   ' *);
+	kASNotEqual					= $E289A020 (* '­   ' *);
+	kASGreaterThan				= $3E202020 (* '>   ' *);
+	kASGreaterThanOrEqual		= $3E3D2020 (* '>=  ' *);
+	kASLessThan					= $3C202020 (* '<   ' *);
+	kASLessThanOrEqual			= $3C3D2020 (* '<=  ' *);
+	kASComesBefore				= $63626672 (* 'cbfr' *);
+	kASComesAfter				= $63616672 (* 'cafr' *);
+	kASConcatenate				= $63636174 (* 'ccat' *);
+	kASStartsWith				= $62677774 (* 'bgwt' *);
+	kASEndsWith					= $656E6473 (* 'ends' *);
+	kASContains					= $636F6E74 (* 'cont' *);
+
+	kASAnd						= $414E4420 (* 'AND ' *);
+	kASOr						= $4F522020 (* 'OR  ' *);						{  Unary:  }
+	kASNot						= $4E4F5420 (* 'NOT ' *);
+	kASNegate					= $6E656720 (* 'neg ' *);
+	keyASArg					= $61726720 (* 'arg ' *);
+
+																{  event code for the 'error' statement  }
+	kASErrorEventCode			= $65727220 (* 'err ' *);
+	kOSAErrorArgs				= $65727261 (* 'erra' *);
+	keyAEErrorObject			= $65726F62 (* 'erob' *);						{  Properties:  }
+	pLength						= $6C656E67 (* 'leng' *);
+	pReverse					= $72767365 (* 'rvse' *);
+	pRest						= $72657374 (* 'rest' *);
+	pInherits					= $6340235E (* 'c@#^' *);
+	pProperties					= $70414C4C (* 'pALL' *);						{  User-Defined Record Fields:  }
+	keyASUserRecordFields		= $75737266 (* 'usrf' *);
+	typeUserRecordFields		= $6C697374 (* 'list' *);
+
+	{	 Prepositions: 	}
+	keyASPrepositionAt			= $61742020 (* 'at  ' *);
+	keyASPrepositionIn			= $696E2020 (* 'in  ' *);
+	keyASPrepositionFrom		= $66726F6D (* 'from' *);
+	keyASPrepositionFor			= $666F7220 (* 'for ' *);
+	keyASPrepositionTo			= $746F2020 (* 'to  ' *);
+	keyASPrepositionThru		= $74687275 (* 'thru' *);
+	keyASPrepositionThrough		= $74686768 (* 'thgh' *);
+	keyASPrepositionBy			= $62792020 (* 'by  ' *);
+	keyASPrepositionOn			= $6F6E2020 (* 'on  ' *);
+	keyASPrepositionInto		= $696E746F (* 'into' *);
+	keyASPrepositionOnto		= $6F6E746F (* 'onto' *);
+	keyASPrepositionBetween		= $6274776E (* 'btwn' *);
+	keyASPrepositionAgainst		= $61677374 (* 'agst' *);
+	keyASPrepositionOutOf		= $6F75746F (* 'outo' *);
+	keyASPrepositionInsteadOf	= $6973746F (* 'isto' *);
+	keyASPrepositionAsideFrom	= $61736466 (* 'asdf' *);
+	keyASPrepositionAround		= $61726E64 (* 'arnd' *);
+	keyASPrepositionBeside		= $62736964 (* 'bsid' *);
+	keyASPrepositionBeneath		= $626E7468 (* 'bnth' *);
+	keyASPrepositionUnder		= $756E6472 (* 'undr' *);
+
+	keyASPrepositionOver		= $6F766572 (* 'over' *);
+	keyASPrepositionAbove		= $61627665 (* 'abve' *);
+	keyASPrepositionBelow		= $62656C77 (* 'belw' *);
+	keyASPrepositionApartFrom	= $61707274 (* 'aprt' *);
+	keyASPrepositionGiven		= $6769766E (* 'givn' *);
+	keyASPrepositionWith		= $77697468 (* 'with' *);
+	keyASPrepositionWithout		= $776F7574 (* 'wout' *);
+	keyASPrepositionAbout		= $61626F75 (* 'abou' *);
+	keyASPrepositionSince		= $736E6365 (* 'snce' *);
+	keyASPrepositionUntil		= $74696C6C (* 'till' *);
+
+																{  Terminology & Dialect things:  }
+	kDialectBundleResType		= $4462646C (* 'Dbdl' *);						{  AppleScript Classes and Enums:  }
+	cConstant					= $656E756D (* 'enum' *);
+	cClassIdentifier			= $70636C73 (* 'pcls' *);
+	cObjectBeingExamined		= $65786D6E (* 'exmn' *);
+	cList						= $6C697374 (* 'list' *);
+	cSmallReal					= $73696E67 (* 'sing' *);
+	cReal						= $646F7562 (* 'doub' *);
+	cRecord						= $7265636F (* 'reco' *);
+	cReference					= $6F626A20 (* 'obj ' *);
+	cUndefined					= $756E6466 (* 'undf' *);
+	cMissingValue				= $6D736E67 (* 'msng' *);
+	cSymbol						= $73796D62 (* 'symb' *);
+	cLinkedList					= $6C6C7374 (* 'llst' *);
+	cVector						= $76656374 (* 'vect' *);
+	cEventIdentifier			= $65766E74 (* 'evnt' *);
+	cKeyIdentifier				= $6B796964 (* 'kyid' *);
+	cUserIdentifier				= $75696420 (* 'uid ' *);
+	cPreposition				= $70726570 (* 'prep' *);
+	cKeyForm					= $6B66726D (* 'kfrm' *);
+	cScript						= $73637074 (* 'scpt' *);
+	cHandler					= $68616E64 (* 'hand' *);
+	cProcedure					= $70726F63 (* 'proc' *);
+
+	cHandleBreakpoint			= $6272616B (* 'brak' *);
+
+	cClosure					= $636C7372 (* 'clsr' *);
+	cRawData					= $72646174 (* 'rdat' *);
+	cStringClass				= $54455854 (* 'TEXT' *);
+	cNumber						= $6E6D6272 (* 'nmbr' *);
+	cListElement				= $63656C6D (* 'celm' *);
+	cListOrRecord				= $6C722020 (* 'lr  ' *);
+	cListOrString				= $6C732020 (* 'ls  ' *);
+	cListRecordOrString			= $6C727320 (* 'lrs ' *);
+	cNumberOrString				= $6E732020 (* 'ns  ' *);
+	cNumberOrDateTime			= $6E642020 (* 'nd  ' *);
+	cNumberDateTimeOrString		= $6E647320 (* 'nds ' *);
+	cAliasOrString				= $73662020 (* 'sf  ' *);
+	cSeconds					= $73636E64 (* 'scnd' *);
+	typeSound					= $736E6420 (* 'snd ' *);
+	enumBooleanValues			= $626F6F76 (* 'boov' *);						{   Use this instead of typeBoolean to avoid with/without conversion   }
+	kAETrue						= $74727565 (* 'true' *);
+	kAEFalse					= $66616C73 (* 'fals' *);
+	enumMiscValues				= $6D697363 (* 'misc' *);
+	kASCurrentApplication		= $63757261 (* 'cura' *);						{  User-defined property ospecs:  }
+	formUserPropertyID			= $75737270 (* 'usrp' *);
+
+//	cString						= $54455854 (* 'TEXT' *);						{  old name for cStringClass - can't be used in .r files }
+
+																{  Global properties:  }
+	pASIt						= $69742020 (* 'it  ' *);
+	pASMe						= $6D652020 (* 'me  ' *);
+	pASResult					= $72736C74 (* 'rslt' *);
+	pASSpace					= $73706163 (* 'spac' *);
+	pASReturn					= $72657420 (* 'ret ' *);
+	pASTab						= $74616220 (* 'tab ' *);
+	pASPi						= $70692020 (* 'pi  ' *);
+	pASParent					= $70617265 (* 'pare' *);
+	kASInitializeEventCode		= $696E6974 (* 'init' *);
+	pASPrintLength				= $70726C6E (* 'prln' *);
+	pASPrintDepth				= $70726470 (* 'prdp' *);
+	pASTopLevelScript			= $61736372 (* 'ascr' *);
+
+																{  Considerations  }
+	kAECase						= $63617365 (* 'case' *);
+	kAEDiacritic				= $64696163 (* 'diac' *);
+	kAEWhiteSpace				= $77686974 (* 'whit' *);
+	kAEHyphens					= $68797068 (* 'hyph' *);
+	kAEExpansion				= $65787061 (* 'expa' *);
+	kAEPunctuation				= $70756E63 (* 'punc' *);
+	kAEZenkakuHankaku			= $7A6B686B (* 'zkhk' *);
+	kAESmallKana				= $736B6E61 (* 'skna' *);
+	kAEKataHiragana				= $68696B61 (* 'hika' *);
+	kASConsiderReplies			= $726D7465 (* 'rmte' *);
+	enumConsiderations			= $636F6E73 (* 'cons' *);
+
+	{	 Considerations bit masks 	}
+	kAECaseConsiderMask			= $00000001;
+	kAEDiacriticConsiderMask	= $00000002;
+	kAEWhiteSpaceConsiderMask	= $00000004;
+	kAEHyphensConsiderMask		= $00000008;
+	kAEExpansionConsiderMask	= $00000010;
+	kAEPunctuationConsiderMask	= $00000020;
+	kASConsiderRepliesConsiderMask = $00000040;
+	kAECaseIgnoreMask			= $00010000;
+	kAEDiacriticIgnoreMask		= $00020000;
+	kAEWhiteSpaceIgnoreMask		= $00040000;
+	kAEHyphensIgnoreMask		= $00080000;
+	kAEExpansionIgnoreMask		= $00100000;
+	kAEPunctuationIgnoreMask	= $00200000;
+	kASConsiderRepliesIgnoreMask = $00400000;
+	enumConsidsAndIgnores		= $63736967 (* 'csig' *);
+
+	cCoercion					= $636F6563 (* 'coec' *);
+	cCoerceUpperCase			= $74787570 (* 'txup' *);
+	cCoerceLowerCase			= $74786C6F (* 'txlo' *);
+	cCoerceRemoveDiacriticals	= $74786463 (* 'txdc' *);
+	cCoerceRemovePunctuation	= $74787063 (* 'txpc' *);
+	cCoerceRemoveHyphens		= $74786879 (* 'txhy' *);
+	cCoerceOneByteToTwoByte		= $74786578 (* 'txex' *);
+	cCoerceRemoveWhiteSpace		= $74787773 (* 'txws' *);
+	cCoerceSmallKana			= $7478736B (* 'txsk' *);
+	cCoerceZenkakuhankaku		= $74787A65 (* 'txze' *);
+	cCoerceKataHiragana			= $74786B68 (* 'txkh' *);						{  Lorax things:  }
+	cZone						= $7A6F6E65 (* 'zone' *);
+	cMachine					= $6D616368 (* 'mach' *);
+	cAddress					= $61646472 (* 'addr' *);
+	cRunningAddress				= $72616464 (* 'radd' *);
+	cStorage					= $73746F72 (* 'stor' *);
+
+																{  DateTime things:  }
+	pASWeekday					= $776B6479 (* 'wkdy' *);
+	pASMonth					= $6D6E7468 (* 'mnth' *);
+	pASDay						= $64617920 (* 'day ' *);
+	pASYear						= $79656172 (* 'year' *);
+	pASTime						= $74696D65 (* 'time' *);
+	pASDateString				= $64737472 (* 'dstr' *);
+	pASTimeString				= $74737472 (* 'tstr' *);						{  Months  }
+	cMonth						= $6D6E7468 (* 'mnth' *);
+	cJanuary					= $6A616E20 (* 'jan ' *);
+	cFebruary					= $66656220 (* 'feb ' *);
+	cMarch						= $6D617220 (* 'mar ' *);
+	cApril						= $61707220 (* 'apr ' *);
+	cMay						= $6D617920 (* 'may ' *);
+	cJune						= $6A756E20 (* 'jun ' *);
+	cJuly						= $6A756C20 (* 'jul ' *);
+	cAugust						= $61756720 (* 'aug ' *);
+	cSeptember					= $73657020 (* 'sep ' *);
+	cOctober					= $6F637420 (* 'oct ' *);
+	cNovember					= $6E6F7620 (* 'nov ' *);
+	cDecember					= $64656320 (* 'dec ' *);
+
+																{  Weekdays  }
+	cWeekday					= $776B6479 (* 'wkdy' *);
+	cSunday						= $73756E20 (* 'sun ' *);
+	cMonday						= $6D6F6E20 (* 'mon ' *);
+	cTuesday					= $74756520 (* 'tue ' *);
+	cWednesday					= $77656420 (* 'wed ' *);
+	cThursday					= $74687520 (* 'thu ' *);
+	cFriday						= $66726920 (* 'fri ' *);
+	cSaturday					= $73617420 (* 'sat ' *);						{  AS 1.1 Globals:  }
+	pASQuote					= $71756F74 (* 'quot' *);
+	pASSeconds					= $73656373 (* 'secs' *);
+	pASMinutes					= $6D696E20 (* 'min ' *);
+	pASHours					= $686F7572 (* 'hour' *);
+	pASDays						= $64617973 (* 'days' *);
+	pASWeeks					= $7765656B (* 'week' *);						{  Writing Code things:  }
+	cWritingCodeInfo			= $6369746C (* 'citl' *);
+	pScriptCode					= $70736364 (* 'pscd' *);
+	pLangCode					= $706C6364 (* 'plcd' *);						{  Magic Tell and End Tell events for logging:  }
+	kASMagicTellEvent			= $74656C6C (* 'tell' *);
+	kASMagicEndTellEvent		= $74656E64 (* 'tend' *);
+
+{$ALIGN MAC68K}
+
+
+end.

+ 970 - 0
packages/extra/univint/ATSFont.pas

@@ -0,0 +1,970 @@
+{
+     File:       ATSFont.p
+ 
+     Contains:   Public interface to the font access and data management functions of ATS.
+ 
+     Version:    Technology: Mac OS
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 2000-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSFont;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFRunLoop,CFPropertyList,ATSTypes,CFString,Files,TextCommon,SFNTTypes;
+
+
+{$ALIGN MAC68K}
+
+
+const
+	kATSOptionFlagsDefault		= 0;
+	kATSOptionFlagsComposeFontPostScriptName = $01;				{  ATSFontGetPostScriptName  }
+	kATSOptionFlagsUseDataForkAsResourceFork = $0100;			{  ATSFontActivateFromFileSpecification  }
+	kATSOptionFlagsUseResourceFork = $0200;
+	kATSOptionFlagsUseDataFork	= $0300;
+
+	kATSIterationCompleted		= -980;
+	kATSInvalidFontFamilyAccess	= -981;
+	kATSInvalidFontAccess		= -982;
+	kATSIterationScopeModified	= -983;
+	kATSInvalidFontTableAccess	= -984;
+	kATSInvalidFontContainerAccess = -985;
+  kATSInvalidGlyphAccess        = -986;
+
+
+type
+	ATSFontContext						= UInt32;
+
+const
+	kATSFontContextUnspecified	= 0;
+	kATSFontContextGlobal		= 1;
+  kATSFontContextLocal          = 2;
+
+const
+  kATSOptionFlagsProcessSubdirectories = $00000001 shl 6; { Used by activation/deactivation & iteration }
+  kATSOptionFlagsDoNotNotify    = $00000001 shl 7; { Do not notify after global activation/deactivation }
+
+{ Iteration Option Flags }
+const
+  kATSOptionFlagsIterateByPrecedenceMask = $00000001 shl 5;
+  kATSOptionFlagsIterationScopeMask = $00000007 shl 12; { Mask option bits 12-14 for iteration scopes }
+  kATSOptionFlagsDefaultScope   = $00000000 shl 12;
+  kATSOptionFlagsUnRestrictedScope = $00000001 shl 12;
+  kATSOptionFlagsRestrictedScope = $00000002 shl 12;
+
+
+type
+	ATSFontFormat						= UInt32;
+
+const
+	kATSFontFormatUnspecified	= 0;
+
+
+type
+{$ifc TYPED_FUNCTION_POINTERS}
+	ATSFontFamilyApplierFunction = function(iFamily: ATSFontFamilyRef; iRefCon: UnivPtr): OSStatus;
+{$elsec}
+	ATSFontFamilyApplierFunction = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	ATSFontApplierFunction = function(iFont: ATSFontRef; iRefCon: UnivPtr): OSStatus;
+{$elsec}
+	ATSFontApplierFunction = ProcPtr;
+{$endc}
+
+	ATSFontFamilyIterator    = ^SInt32; { an opaque 32-bit type }
+	ATSFontFamilyIteratorPtr = ^ATSFontFamilyIterator;  { when a var xx:ATSFontFamilyIterator parameter can be nil, it is changed to xx: ATSFontFamilyIteratorPtr }
+	ATSFontIterator    = ^SInt32; { an opaque 32-bit type }
+	ATSFontIteratorPtr = ^ATSFontIterator;  { when a var xx:ATSFontIterator parameter can be nil, it is changed to xx: ATSFontIteratorPtr }
+
+const
+	kATSFontFilterCurrentVersion = 0;
+
+
+type
+	ATSFontFilterSelector 		= SInt32;
+const
+	kATSFontFilterSelectorUnspecified = 0;
+	kATSFontFilterSelectorGeneration = 3;
+	kATSFontFilterSelectorFontFamily = 7;
+	kATSFontFilterSelectorFontFamilyApplierFunction = 8;
+	kATSFontFilterSelectorFontApplierFunction = 9;
+
+
+type
+	ATSFontFilterPtr = ^ATSFontFilter;
+	ATSFontFilter = record
+		version:				UInt32;
+		filterSelector:			ATSFontFilterSelector;
+		case SInt16 of
+		0: (
+			generationFilter:	ATSGeneration;
+			);
+		1: (
+			fontFamilyFilter:	ATSFontFamilyRef;
+			);
+		2: (
+			fontFamilyApplierFunctionFilter: ATSFontFamilyApplierFunction;
+			);
+		3: (
+			fontApplierFunctionFilter: ATSFontApplierFunction;
+			);
+	end;
+
+{ Notification related }
+type
+	ATSFontNotificationRef    = ^SInt32; { an opaque 32-bit type }
+	ATSFontNotificationRefPtr = ^ATSFontNotificationRef;
+	ATSFontNotificationInfoRef    = ^SInt32; { an opaque 32-bit type }
+	ATSFontNotificationInfoRefPtr = ^ATSFontNotificationInfoRef;
+
+{
+ *  ATSFontNotifyOption
+ *  
+ *  Discussion:
+ *    Options used with ATSFontNotificationSubscribe.  Any of the
+ *    options that follow may be used together in order to alter the
+ *    default behavior of ATS notifications.
+ }
+type
+	ATSFontNotifyOption = SInt32;
+const
+
+  {
+   * Default behavior of ATSFontNotificationSubscribe.
+   }
+  kATSFontNotifyOptionDefault   = 0;
+
+  {
+   * Normally applications will only receive ATS notifications while in
+   * the foreground.   If suspended, the notification will be delivered
+   * when then application comes to the foreground.  This is the
+   * default.  You should set this option if you are a server or tool
+   * that performs font management functions and require immediate
+   * notification when something changes.
+   }
+  kATSFontNotifyOptionReceiveWhileSuspended = 1 shl 0;
+
+{
+ *  ATSFontNotifyAction
+ *  
+ *  Discussion:
+ *    Used with ATSFontNotify.   The following is a list of actions you
+ *    might wish the ATS server to perform and notify clients if
+ *    appropriate.
+ }
+type
+	ATSFontNotifyAction = SInt32;
+const
+
+  {
+   * Used after a batch (de)activation of fonts occurs.   Typically the
+   * caller has exercised multiple global (De)Activation calls with the
+   * kATSOptionFlagsDoNotNotify set. Once all calls are completed, one
+   * may use ATSFontNotify with this action to ask ATS to notify all
+   * clients.
+   }
+  kATSFontNotifyActionFontsChanged = 1;
+
+  {
+   * The ATS system with the help of the Finder keeps track of changes
+   * to any of the font directories in the system domains ( System,
+   * Local, Network, User, & Classic). However, one may wish to
+   * add/remove fonts to these locations programmatically. This action
+   * is used to let ATS server to rescan these directories and post
+   * notifications if necessary.
+   }
+  kATSFontNotifyActionDirectoriesChanged = 2;
+
+
+{
+ *  ATSNotificationCallback
+ *  
+ *  Discussion:
+ *    Callback delivered for ATS notifications.
+ *  
+ *  Parameters:
+ *    
+ *    info:
+ *      Parameter is placed here for future improvements.  Initially
+ *      the contents of this parameter will be NULL.
+ *    
+ *    refCon:
+ *      User data/state to be supplied to callback function
+ }
+type ATSNotificationCallback = procedure( info: ATSFontNotificationInfoRef; refCon: UnivPtr );
+
+	{	 ----------------------------------------------------------------------------------------- 	}
+	{	 Font container                                                                            	}
+	{	 ----------------------------------------------------------------------------------------- 	}
+	{
+	 *  ATSGetGeneration()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   not available
+	 *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function ATSGetGeneration: ATSGeneration; external name '_ATSGetGeneration';
+
+{
+ *  ATSFontActivateFromFileSpecification()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontActivateFromFileSpecification(const (*var*) iFile: FSSpec; iContext: ATSFontContext; iFormat: ATSFontFormat; iReserved: UnivPtr; iOptions: ATSOptionFlags; var oContainer: ATSFontContainerRef): OSStatus; external name '_ATSFontActivateFromFileSpecification';
+
+{
+ *  ATSFontActivateFromMemory()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontActivateFromMemory(iData: LogicalAddress; iLength: ByteCount; iContext: ATSFontContext; iFormat: ATSFontFormat; iReserved: UnivPtr; iOptions: ATSOptionFlags; var oContainer: ATSFontContainerRef): OSStatus; external name '_ATSFontActivateFromMemory';
+
+{
+ *  ATSFontDeactivate()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontDeactivate(iContainer: ATSFontContainerRef; iRefCon: UnivPtr; iOptions: ATSOptionFlags): OSStatus; external name '_ATSFontDeactivate';
+
+{ ----------------------------------------------------------------------------------------- }
+{ Font family                                                                               }
+{ ----------------------------------------------------------------------------------------- }
+{
+ *  ATSFontFamilyApplyFunction()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyApplyFunction(iFunction: ATSFontFamilyApplierFunction; iRefCon: UnivPtr): OSStatus; external name '_ATSFontFamilyApplyFunction';
+
+{
+ *  ATSFontFamilyIteratorCreate()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyIteratorCreate(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorCreate';
+
+{
+ *  ATSFontFamilyIteratorRelease()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyIteratorRelease(var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorRelease';
+
+{
+ *  ATSFontFamilyIteratorReset()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyIteratorReset(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorReset';
+
+{
+ *  ATSFontFamilyIteratorNext()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyIteratorNext(iIterator: ATSFontFamilyIterator; var oFamily: ATSFontFamilyRef): OSStatus; external name '_ATSFontFamilyIteratorNext';
+
+{
+ *  ATSFontFamilyFindFromName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyFindFromName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontFamilyRef; external name '_ATSFontFamilyFindFromName';
+
+{
+ *  ATSFontFamilyGetGeneration()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyGetGeneration(iFamily: ATSFontFamilyRef): ATSGeneration; external name '_ATSFontFamilyGetGeneration';
+
+{
+ *  ATSFontFamilyGetName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyGetName(iFamily: ATSFontFamilyRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontFamilyGetName';
+
+{
+ *  ATSFontFamilyGetEncoding()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyGetEncoding(iFamily: ATSFontFamilyRef): TextEncoding; external name '_ATSFontFamilyGetEncoding';
+
+{ ----------------------------------------------------------------------------------------- }
+{ Font                                                                                      }
+{ ----------------------------------------------------------------------------------------- }
+{
+ *  ATSFontApplyFunction()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontApplyFunction(iFunction: ATSFontApplierFunction; iRefCon: UnivPtr): OSStatus; external name '_ATSFontApplyFunction';
+
+{
+ *  ATSFontIteratorCreate()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontIteratorCreate(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorCreate';
+
+{
+ *  ATSFontIteratorRelease()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontIteratorRelease(var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorRelease';
+
+{
+ *  ATSFontIteratorReset()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontIteratorReset(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorReset';
+
+{
+ *  ATSFontIteratorNext()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontIteratorNext(iIterator: ATSFontIterator; var oFont: ATSFontRef): OSStatus; external name '_ATSFontIteratorNext';
+
+{
+ *  ATSFontFindFromName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFindFromName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontRef; external name '_ATSFontFindFromName';
+
+{
+ *  ATSFontFindFromPostScriptName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFindFromPostScriptName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontRef; external name '_ATSFontFindFromPostScriptName';
+
+{
+ *  ATSFontFindFromContainer()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFindFromContainer(iContainer: ATSFontContainerRef; iOptions: ATSOptionFlags; iCount: ItemCount; var ioArray: ATSFontRef; var oCount: ItemCount): OSStatus; external name '_ATSFontFindFromContainer';
+
+{
+ *  ATSFontGetGeneration()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetGeneration(iFont: ATSFontRef): ATSGeneration; external name '_ATSFontGetGeneration';
+
+{
+ *  ATSFontGetName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetName(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontGetName';
+
+{
+ *  ATSFontGetPostScriptName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetPostScriptName(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontGetPostScriptName';
+
+{
+ *  ATSFontGetTableDirectory()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetTableDirectory(iFont: ATSFontRef; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetTableDirectory';
+
+{
+ *  ATSFontGetTable()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetTable(iFont: ATSFontRef; iTag: FourCharCode; iOffset: ByteOffset; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetTable';
+
+{
+ *  ATSFontGetHorizontalMetrics()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetHorizontalMetrics(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oMetrics: ATSFontMetrics): OSStatus; external name '_ATSFontGetHorizontalMetrics';
+
+{
+ *  ATSFontGetVerticalMetrics()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetVerticalMetrics(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oMetrics: ATSFontMetrics): OSStatus; external name '_ATSFontGetVerticalMetrics';
+
+{ ----------------------------------------------------------------------------------------- }
+{ Compatibiity                                                                              }
+{ ----------------------------------------------------------------------------------------- }
+{
+ *  ATSFontFamilyFindFromQuickDrawName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyFindFromQuickDrawName(const (*var*) iName: Str255): ATSFontFamilyRef; external name '_ATSFontFamilyFindFromQuickDrawName';
+
+{
+ *  ATSFontFamilyGetQuickDrawName()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontFamilyGetQuickDrawName(iFamily: ATSFontFamilyRef; var oName: Str255): OSStatus; external name '_ATSFontFamilyGetQuickDrawName';
+
+{
+ *  ATSFontGetFileSpecification()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetFileSpecification(iFont: ATSFontRef; var oFile: FSSpec): OSStatus; external name '_ATSFontGetFileSpecification';
+
+{
+ *  ATSFontGetFontFamilyResource()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ATSFontGetFontFamilyResource(iFont: ATSFontRef; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetFontFamilyResource';
+
+{ ----------------------------------------------------------------------------------------- }
+{ Notification                                                                              }
+{ ----------------------------------------------------------------------------------------- }
+{
+ *  ATSFontNotify()
+ *  
+ *  Summary:
+ *    Used to alert ATS that an action which may require notification
+ *    to clients has occurred.
+ *  
+ *  Parameters:
+ *    
+ *    action:
+ *      Action that should be taken by the ATS Server
+ *    
+ *    info:
+ *      Any required or optional information that may be required by
+ *      the action taken. can be NULL
+ *  
+ *  Result:
+ *    noErr Action successfully reported paramErr Invalid action passed
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSFontNotify( action: ATSFontNotifyAction; info: UnivPtr ): OSStatus; external name '_ATSFontNotify';
+
+
+{
+ *  ATSFontNotificationSubscribe()
+ *  
+ *  Summary:
+ *    Ask the ATS System to notify caller when certain events have
+ *    occurred.  Note that your application must have a CFRunLoop in
+ *    order to receive notifications. Any Appkit or Carbon event loop
+ *    based application will have one by default.
+ *  
+ *  Parameters:
+ *    
+ *    callback:
+ *      Function that will be called by the ATS system whenever an
+ *      event of interest takes place.
+ *    
+ *    options:
+ *      Set the wanted ATSFontNotificationOptions to modify the default
+ *      behavior of ATS Notifications.
+ *    
+ *    iRefcon:
+ *      User data/state which will be passed to the callback funtion. can be NULL
+ *    
+ *    oNotificationRef:
+ *      You may use this reference to un-subscribe to this notification. can be NULL
+ *  
+ *  Result:
+ *    noErr Subscribed successfully paramErr NULL callback was passed.
+ *    memFullErr Could not allocate enough memory for internal data
+ *    structures.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSFontNotificationSubscribe( callback: ATSNotificationCallback; options: ATSFontNotifyOption; iRefcon: UnivPtr; oNotificationRef: ATSFontNotificationRefPtr ): OSStatus; external name '_ATSFontNotificationSubscribe';
+
+
+{
+ *  ATSFontNotificationUnsubscribe()
+ *  
+ *  Summary:
+ *    Release subscription and stop receiving notifications for a given
+ *    reference.
+ *  
+ *  Parameters:
+ *    
+ *    notificationRef:
+ *      Notification reference for which you want to stop receiving
+ *      notifications. Note, if more than one notification has been
+ *      requested of ATS, you will still receive notifications on those
+ *      requests.
+ *  
+ *  Result:
+ *    noErr Unsubscribed successfully paramErr NULL/invalid
+ *    notificationRef passed
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSFontNotificationUnsubscribe( notificationRef: ATSFontNotificationRef ): OSStatus; external name '_ATSFontNotificationUnsubscribe';
+
+
+{ ----------------------------------------------------------------------------------------- }
+{ Font query message hooks                                                                  }
+{ ----------------------------------------------------------------------------------------- }
+
+{
+ *  ATSFontQuerySourceContext
+ *  
+ *  Summary:
+ *    A parameter block for client information to be retained by ATS
+ *    and passed back to an ATSFontQueryCallback function.
+ }
+type
+	ATSFontQuerySourceContext = record
+
+  {
+   * A 32-bit unsigned integer that indicates the version of this
+   * structure. This should be set to 0.
+   }
+		version: UInt32;
+
+  {
+   * A pointer-sized client datum that should be passed back to an
+   * ATSFontQueryCallback function.
+   }
+		refCon: Ptr;
+
+  {
+   * The callback used to add a retain to the refCon.
+   }
+		retain: CFAllocatorRetainCallBack;
+
+  {
+   * The callback used to remove a retain to the refCon.
+   }
+		release: CFAllocatorReleaseCallBack;
+	end;
+	ATSFontQuerySourceContextPtr = ^ATSFontQuerySourceContext;
+
+{
+ *  ATSFontQueryMessageID
+ *  
+ *  Discussion:
+ *    Constants for ATS font query message types.
+ }
+type
+	ATSFontQueryMessageID = SInt32;
+const
+
+  {
+   * The message ID for a font request query. The data for a message
+   * with this ID is a flattened CFDictionaryRef with keys and values
+   * as decribed below. A query dictionary may have any or all of these
+   * entries.
+   }
+  kATSQueryActivateFontMessage  = $61747361 (* 'atsa' *);
+
+
+{
+ *  ATSFontQueryCallback
+ *  
+ *  Summary:
+ *    Callback for receiving font-related queries from ATS.
+ *  
+ *  Parameters:
+ *    
+ *    msgid:
+ *      An ATSFontQueryMessageID that identifies the message type.
+ *    
+ *    data:
+ *      A CFPropertyListRef that represents the query. The content is
+ *      message type-specific.
+ *    
+ *    refCon:
+ *      A pointer-sized client datum that was optionally provided to
+ *      ATSCreateFontQueryRunLoopSource.
+ *  
+ *  Result:
+ *    A CFPropertyListRef that represents the message type-specific
+ *    response to the query. May be NULL.
+ }
+type ATSFontQueryCallback = function( msgid: ATSFontQueryMessageID; data: CFPropertyListRef; refCon: UnivPtr ): CFPropertyListRef;
+{
+ *  ATSCreateFontQueryRunLoopSource()
+ *  
+ *  Summary:
+ *    Creates a CFRunLoopSourceRef that will be used to convey font
+ *    queries from ATS.
+ *  
+ *  Parameters:
+ *    
+ *    queryOrder:
+ *      A CFIndex that specifies the priority of this query receiver
+ *      relative to others. When ATS makes a font query, it will send
+ *      the query to each receiver in priority order, from highest to
+ *      lowest. "Normal" priority is 0.
+ *    
+ *    sourceOrder:
+ *      The order of the created run loop source.
+ *    
+ *    callout:
+ *      A function pointer of type ATSFontQueryCallback that will be
+ *      called to process a font query.
+ *    
+ *    context:
+ *      An ATSFontQuerySourceContext parameter block that provides a
+ *      pointer-sized client datum which will be retained by ATS and
+ *      passed to the callout function. May be NULL.
+ *  
+ *  Result:
+ *    A CFRunLoopSourceRef. To stop receiving queries, invalidate this
+ *    run loop source.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSCreateFontQueryRunLoopSource( queryOrder: CFIndex; sourceOrder: CFIndex; callout: ATSFontQueryCallback; context: ATSFontQuerySourceContextPtr ): CFRunLoopSourceRef; external name '_ATSCreateFontQueryRunLoopSource';
+
+{ ----------------------------------------------------------------------------------------- }
+{ Font request query message content                                                        }
+{ ----------------------------------------------------------------------------------------- }
+{ Keys in a font request query dictionary. }
+{ These keys appear in the dictionary for a kATSQueryActivateFontMessage query. }
+
+//const
+{
+ *  kATSQueryClientPID
+ *  
+ *  Discussion:
+ *    The process ID of the application making the query. The
+ *    corresponding value is a CFNumberRef that contains a pid_t.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSQueryClientPID CFSTRP('ATS client pid')}
+{$endc}
+
+{
+ *  kATSQueryQDFamilyName
+ *  
+ *  Discussion:
+ *    The Quickdraw-style family name of the font being requested, e.g.
+ *    the name passed to GetFNum. The corresponding value is a
+ *    CFStringRef.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSQueryQDFamilyName CFSTRP('font family name')}
+{$endc}
+
+{
+ *  kATSQueryFontName
+ *  
+ *  Discussion:
+ *    The name of the font being requested. The corresponding value is
+ *    a CFStringRef suitable as an argument to ATSFontFindFromName().
+ *    This should match a candidate font's unique or full name.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSQueryFontName CFSTRP('font name')}
+{$endc}
+
+{
+ *  kATSQueryFontPostScriptName
+ *  
+ *  Discussion:
+ *    The PostScript name of the font being requested. The
+ *    corresponding value is a CFStringRef suitable as an argument to
+ *    ATSFontFindFromPostScriptName(). This should match either the
+ *    PostScript name derived from the font's FOND resource or its sfnt
+ *    name table, with preference given to the FOND PostScript name.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSQueryFontPostScriptName CFSTRP('font PS name')}
+{$endc}
+
+{
+ *  kATSQueryFontNameTableEntries
+ *  
+ *  Discussion:
+ *    A descriptor for sfnt name table entries that the requested font
+ *    must have. The corresponding value is a CFArrayRef of
+ *    CFDictionaryRefs that describe name table entries. A font must
+ *    have all of the specified entries to be considered a match.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSQueryFontNameTableEntries CFSTRP('font name table entries')}
+{$endc}
+{ Keys in a font raw name descriptor dictionary. }
+
+{
+ *  kATSFontNameTableCode
+ *  
+ *  Discussion:
+ *    The font name's name code. The corresponding value is a
+ *    CFNumberRef. If missing, assume kFontNoNameCode.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSFontNameTableCode CFSTRP('font name code')}
+{$endc}
+
+{
+ *  kATSFontNameTablePlatform
+ *  
+ *  Discussion:
+ *    The font name's platform code. The corresponding value is a
+ *    CFNumberRef. If missing, assume kFontNoPlatformCode.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSFontNameTablePlatform CFSTRP('font platform code')}
+{$endc}
+
+{
+ *  kATSFontNameTableScript
+ *  
+ *  Discussion:
+ *    The font name's script code. The corresponding value is a
+ *    CFNumberRef. If missing, assume kFontNoScriptCode.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSFontNameTableScript CFSTRP('font script code')}
+{$endc}
+
+{
+ *  kATSFontNameTableLanguage
+ *  
+ *  Discussion:
+ *    The font name's language code. The corresponding value is a
+ *    CFNumberRef. If missing, assume kFontNoLanguageCode.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSFontNameTableLanguage CFSTRP('font language code')}
+{$endc}
+
+{
+ *  kATSFontNameTableBytes
+ *  
+ *  Discussion:
+ *    The raw bytes of the font name. The corresponding value is a
+ *    CFDataRef that contains the raw name bytes.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kATSFontNameTableBytes CFSTRP('font name table bytes')}
+{$endc}
+
+{$ALIGN MAC68K}
+
+
+end.

+ 656 - 0
packages/extra/univint/ATSLayoutTypes.pas

@@ -0,0 +1,656 @@
+{
+     File:       ATSLayoutTypes.p
+ 
+     Contains:   Apple Type Services layout public structures and constants.
+ 
+     Version:    Technology: Mac OS 9/Carbon
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1994-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSLayoutTypes;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,SFNTLayoutTypes,ATSTypes;
+
+
+{$ALIGN MAC68K}
+
+{ --------------------------------------------------------------------------- }
+{ CONSTANTS and related scalar types }
+{ --------------------------------------------------------------------------- }
+{ Miscellaneous constants }
+
+const
+  kATSUseGlyphAdvance   = $7FFFFFFF;					{ assignment to use natural glyph advance value }
+	kATSUseLineHeight			= $7FFFFFFF;					{  assignment to use natural line ascent/descent values  }
+	kATSNoTracking				= $80000000;					{  negativeInfinity  }
+
+{
+ *  ATSULayoutOperationSelector
+ *  
+ *  Summary:
+ *    This is used to select which operations to override, or which
+ *    operation is currently being run.
+ }
+type ATSULayoutOperationSelector = UInt32;
+const
+
+  {
+   * No Layout operation is currently selected.
+   }
+  kATSULayoutOperationNone      = $00000000;
+
+  {
+   * Select the Justification operation.
+   }
+  kATSULayoutOperationJustification = $00000001;
+
+  {
+   * Select the character morphing operation.
+   }
+  kATSULayoutOperationMorph     = $00000002;
+
+  {
+   * Select the kerning adjustment operation.
+   }
+  kATSULayoutOperationKerningAdjustment = $00000004;
+
+  {
+   * Select the baseline adjustment operation.
+   }
+  kATSULayoutOperationBaselineAdjustment = $00000008;
+
+  {
+   * Select the tracking adjustment operation.
+   }
+  kATSULayoutOperationTrackingAdjustment = $00000010;
+
+  {
+   * Select the period of time after ATSUI has finished all of it's
+   * layout operations.
+   }
+  kATSULayoutOperationPostLayoutAdjustment = $00000020;
+  kATSULayoutOperationAppleReserved = $FFFFFFC0;
+
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSULayoutOperationCallbackStatus
+ *  
+ *  Summary:
+ *    One of these must be returned by a
+ *    ATSUDLayoutOperationOverrideUPP callback function in order to
+ *    indicate ATSUI's status.
+ }
+type ATSULayoutOperationCallbackStatus = UInt32;
+const
+
+  {
+   * Return this if the callback function has totally handled the
+   * operation which triggered the callback and does not need ATSUI to
+   * run any further processing for the operation.
+   }
+  kATSULayoutOperationCallbackStatusHandled = $00000000;
+
+  {
+   * Return this if the callback function has not totally handled the
+   * operation which triggered the callback and needs ATSUI to run it's
+   * own processing.
+   }
+  kATSULayoutOperationCallbackStatusContinue = $00000001;
+
+
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSLineLayoutOptions
+ *  
+ *  Summary:
+ *    ATSLineLayoutOptions are normally set in an ATSUTextLayout object
+ *    via the kATSULineLayoutOptionsTag layout control attribute. They
+ *    can also be set in an ATSLineLayoutParams structure.
+ }
+type ATSLineLayoutOptions = UInt32;
+const
+
+  {
+   * No options specified.
+   }
+  kATSLineNoLayoutOptions       = $00000000;
+
+  {
+   * This line option is no longer used.
+   }
+  kATSLineIsDisplayOnly         = $00000001; { obsolete option }
+
+  {
+   * Specifies that no hangers to be formed on the line.
+   }
+  kATSLineHasNoHangers          = $00000002;
+
+  {
+   * Specifies that no optical alignment to be performed on the line.
+   }
+  kATSLineHasNoOpticalAlignment = $00000004;
+
+  {
+   * Specifies that space charcters should not be treated as hangers.
+   }
+  kATSLineKeepSpacesOutOfMargin = $00000008;
+
+  {
+   * Specifies no post-compensation justification is to be performed.
+   }
+  kATSLineNoSpecialJustification = $00000010;
+
+  {
+   * Specifies that if the line is the last of a paragraph, it will not
+   * get justified.
+   }
+  kATSLineLastNoJustification   = $00000020;
+
+  {
+   * Specifies that the displayed line glyphs will adjust for device
+   * metrics.
+   }
+  kATSLineFractDisable          = $00000040;
+
+  {
+   * Specifies that the carets at the ends of the line will be
+   * guarenteed to be perpendicular to the baseline.
+   }
+  kATSLineImposeNoAngleForEnds  = $00000080;
+
+  {
+   * Highlights for the line end characters will be extended to 0 and
+   * the specified line width.
+   }
+  kATSLineFillOutToWidth        = $00000100;
+
+  {
+   * Specifies that the tab character width will be automatically
+   * adjusted to fit the specified line width.
+   }
+  kATSLineTabAdjustEnabled      = $00000200;
+
+  {
+   * Specifies that any leading value specified by a font will be
+   * ignored.
+   }
+  kATSLineIgnoreFontLeading     = $00000400;
+
+  {
+   * Specifies that ATS produce antialiased glyph images despite system
+   * preferences or CGContext settings.
+   }
+  kATSLineApplyAntiAliasing     = $00000800;
+
+  {
+   * Specifies that ATS turn-off antialiasing glyph imaging despite
+   * system preferences or CGContext settings (negates
+   * kATSLineApplyAntiAliasing bit if set).
+   }
+  kATSLineNoAntiAliasing        = $00001000;
+
+  {
+   * Specifies that if the line width is not sufficient to hold all its
+   * glyphs, glyph positions are allowed to extend beyond the line's
+   * assigned width so negative justification is not used.
+   }
+  kATSLineDisableNegativeJustification = $00002000;
+
+  {
+   * Specifies that lines with any integer glyph positioning (due to
+   * either any character non-antialiased or kATSLineFractDisable
+   * specified), not automatically esthetically adjust individual
+   * character positions while rendering to display.
+   }
+  kATSLineDisableAutoAdjustDisplayPos = $00004000;
+
+  {
+   * Specifies that rendering be done through Quickdraw (default
+   * rendering in ATSUI is through CoreGraphics on MacOSX).
+   }
+  kATSLineUseQDRendering        = $00008000;
+
+  {
+   * Specifies that any Justification operations will not be run.
+   }
+  kATSLineDisableAllJustification = $00010000;
+
+  {
+   * Specifies that any glyph morphing operations will not be run.
+   }
+  kATSLineDisableAllGlyphMorphing = $00020000;
+
+  {
+   * Specifies that any kerning adjustment operations will not be run.
+   }
+  kATSLineDisableAllKerningAdjustments = $00040000;
+
+  {
+   * Specifies that any baseline adjustment operations will not be run.
+   }
+  kATSLineDisableAllBaselineAdjustments = $00080000;
+
+  {
+   * Specifies that any tracking adjustment operations will not be run.
+   }
+  kATSLineDisableAllTrackingAdjustments = $00100000;
+
+  {
+   * Convenience constant for turning-off all adjustments.
+   }
+  kATSLineDisableAllLayoutOperations = kATSLineDisableAllJustification or kATSLineDisableAllGlyphMorphing or kATSLineDisableAllKerningAdjustments or kATSLineDisableAllBaselineAdjustments or kATSLineDisableAllTrackingAdjustments;
+
+  {
+   * Specifies to optimize for displaying text only.  Note, rounded
+   * device metrics will be used instead of fractional path metrics.
+   }
+  kATSLineUseDeviceMetrics      = $01000000;
+
+  {
+   * Specifies that line breaking should occur at the nearest
+   * character, not word.  This could cause a word to be split among
+   * multiple lines.
+   }
+  kATSLineBreakToNearestCharacter = $02000000;
+
+  {
+   * These bits are reserved by Apple and will result in a invalid
+   * value error if attemped to set. Obsolete constants:
+   }
+  kATSLineAppleReserved         = $FCE00000;
+
+
+{ --------------------------------------------------------------------------- }
+
+{
+ *  ATSStyleRenderingOptions
+ *  
+ *  Summary:
+ *    ATSStyleRenderingOptions are set in the ATSUStyle object via the
+ *    attribute tag kATSUStyleRenderingOptions. They provide finer
+ *    control over how the style is rendered.
+ }
+type ATSStyleRenderingOptions = UInt32;
+const
+
+  {
+   * No options specified.
+   }
+  kATSStyleNoOptions            = $00000000;
+
+  {
+   * Specifies that ATS produce "unhinted" glyph outlines (default is
+   * hinted glyph outlines).
+   }
+  kATSStyleNoHinting            = $00000001;
+
+  {
+   * Specifies that ATS produce antialiased glyph images despite system
+   * preferences or CGContext settings.
+   }
+  kATSStyleApplyAntiAliasing    = $00000002;
+
+  {
+   * Specifies that ATS turn-off antialiasing glyph imaging despite
+   * system preferences or CGContext settings (negates
+   * kATSStyleApplyAntiAliasing bit if set).
+   }
+  kATSStyleNoAntiAliasing       = $00000004;
+
+  {
+   * These bits are reserved by Apple and will result in a invalid
+   * value error if attemped to set.
+   }
+  kATSStyleAppleReserved        = $FFFFFFF8;
+
+  {
+   * (OBSOLETE) Specifies that ATS produce "hinted" glyph outlines (the
+   * default behavior). THIS NAME IS OBSOLETE. DO NOT USE. It's only
+   * left in for backwards compatibility.
+   }
+  kATSStyleApplyHints           = kATSStyleNoOptions;
+
+{
+ *  ATSGlyphInfoFlags
+ *  
+ *  Summary:
+ *    ATSGlyphInfoFlags are set in the individual ATSLayoutRecord
+ *    structures and apply only to the ATSGlyphRef in that structure.
+ *    The are used by the layout engine to flag a glyph with specific
+ *    properties.
+ }
+type ATSGlyphInfoFlags = UInt32;
+const
+
+  {
+   * These bits are Apple reserved and may result in an invalid value
+   * error if attempted to set.
+   }
+  kATSGlyphInfoAppleReserved    = $1FFBFFE8;
+
+  {
+   * The glyph attaches to another glyph.
+   }
+  kATSGlyphInfoIsAttachment     = $80000000;
+
+  {
+   * The glyph can hang off left/top edge of line.
+   }
+  kATSGlyphInfoIsLTHanger       = $40000000;
+
+  {
+   * The glyph can hang off right/bottom edge of line.
+   }
+  kATSGlyphInfoIsRBHanger       = $20000000;
+
+  {
+   * The glyph is not really a glyph at all, but an end-marker designed
+   * to allow the calculation of the previous glyph's advance.
+   }
+  kATSGlyphInfoTerminatorGlyph  = $00080000;
+
+  {
+   * The glyph is a white space glyph.
+   }
+  kATSGlyphInfoIsWhiteSpace     = $00040000;
+
+  {
+   * Glyph has a style specified imposed width (i.e. advance)
+   }
+  kATSGlyphInfoHasImposedWidth  = $00000010;
+
+  {
+   * A three-bit mask, that can be used to get the size of the original
+   * character that spawned this glyph. When a logical 'and' operation
+   * with this mask and an ATSGlyphInfoFlags variable, it will yield
+   * the size in bytes of the original character (0 - 7 bytes possible).
+   }
+  kATSGlyphInfoByteSizeMask     = $00000007;
+
+
+{ --------------------------------------------------------------------------- }
+
+{
+ *  Summary:
+ *    These values are passed into the ATSUGetGlyphBounds function to
+ *    indicate whether the width of the resulting typographic glyph
+ *    bounds will be determined using the caret origin, glyph origin in
+ *    device space, or glyph origin in fractional absolute positions
+ }
+const
+
+  {
+   * Specifies that the width of the typographic glyph bounds will be
+   * determined using the caret origin. The caret origin is halfway
+   * between two characters.
+   }
+  kATSUseCaretOrigins           = 0;
+
+  {
+   * Specifies that the width of the typographic glyph bounds will be
+   * determined using the glyph origin in device space. This is useful
+   * for adjusting text on the screen.
+   }
+  kATSUseDeviceOrigins          = 1;
+
+  {
+   * Specifies that the width of the typographic glyph bounds will be
+   * determined using the glyph origin in fractional absolute
+   * positions, which are uncorrected for device display. This provides
+   * the ideal position of laid-out text and is useful for scaling text
+   * on the screen. This origin is also used to get the width of the
+   * typographic bounding rectangle when you call ATSUMeasureText.
+   }
+  kATSUseFractionalOrigins      = 2;
+  kATSUseOriginFlags            = 3;
+
+
+	{	 --------------------------------------------------------------------------- 	}
+	{	 STRUCTURED TYPES and related constants 	}
+	{	 --------------------------------------------------------------------------- 	}
+
+	{	
+	    The ATSTrapezoid structure supplies a convenient container
+	    for glyph bounds in trapezoidal form.
+		}
+
+type
+	ATSTrapezoidPtr = ^ATSTrapezoid;
+	ATSTrapezoid = record
+		upperLeft:				FixedPoint;
+		upperRight:				FixedPoint;
+		lowerRight:				FixedPoint;
+		lowerLeft:				FixedPoint;
+	end;
+
+	{	
+	    The JustWidthDeltaEntryOverride structure specifies values for the grow and shrink case during
+	    justification, both on the left and on the right. It also contains flags.  This particular structure
+	    is used for passing justification overrides to LLC.  For further sfnt resource 'just' table
+	    constants and structures, see SFNTLayoutTypes.h.
+		}
+	ATSJustWidthDeltaEntryOverridePtr = ^ATSJustWidthDeltaEntryOverride;
+	ATSJustWidthDeltaEntryOverride = record
+		beforeGrowLimit:		Fixed;									{  ems AW can grow by at most on LT  }
+		beforeShrinkLimit:		Fixed;									{  ems AW can shrink by at most on LT  }
+		afterGrowLimit:			Fixed;									{  ems AW can grow by at most on RB  }
+		afterShrinkLimit:		Fixed;									{  ems AW can shrink by at most on RB  }
+		growFlags:				JustificationFlags;						{  flags controlling grow case  }
+		shrinkFlags:			JustificationFlags;						{  flags controlling shrink case  }
+	end;
+
+	{	 The JustPriorityOverrides type is an array of 4 width delta records, one per priority level override. 	}
+	ATSJustPriorityWidthDeltaOverrides	= array [0..3] of ATSJustWidthDeltaEntryOverride;
+	{	 --------------------------------------------------------------------------- 	}
+
+{
+ *  ATSULineRef
+ *  
+ *  Summary:
+ *    A reference to a line that is being laid out. This is passed into
+ *    the ATSUDirectLayoutOperationOverrideUPP callback function to be
+ *    used by the ATSUDirectGetLayoutDataArrayPtrFromLineRef function.
+ *    The only way to get a line ref is inside of the callback. The
+ *    only time the line ref is valid is inside of the callback.
+ }
+type
+	ATSULineRef    = ^SInt32; { an opaque 32-bit type }
+{ ---------------------------------------------------------------------------- }
+{ DirectAccess Layout Callback Definitions                                     }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUDirectLayoutOperationOverrideProcPtr
+ *  
+ *  Summary:
+ *    Callback definition for a low-level adjustment routine hook.
+ *  
+ *  Discussion:
+ *    This callback can be set in an ATSUTextLayout object by setting
+ *    the attribute tag kATSULayoutOperationOverrideTag and passing in
+ *    a ATSULayoutOperationOverrideSpecifier structure into
+ *    ATSUSetLayoutAttribute. This callback will be called whenever an
+ *    ATSUI call triggers a re-layout for each operation it is
+ *    installed for. The operation that triggered the callback will be
+ *    set in the iCurrentOperation parameter. The callback function
+ *    defined by the developer is only required to do one thing: return
+ *    it's status to ATSUI as to what it has done. This is done via the
+ *    oCallbackStatus parameter. It needs to tell ATSUI if it had
+ *    handled the layout operation or if it still needs ATSUI to run
+ *    it's own processes. iOperationCallbackParameterPtr is there in
+ *    case there are ever any ATSUDirectLayoutOperationSelector which
+ *    require extra parameters to be passed into the callback function.
+ *    It is currently unused and will always be set to NULL. iRefCon is
+ *    the constant that is set in the ATSUTextLayout object that
+ *    spawned the operation by the ATSUSetTextLayoutRefCon() API.
+ *    Within the context of the callback itself, only a limited subset
+ *    of ATSUI APIs may be called. Basically, only the APIs that have
+ *    no chance of triggering a re-layout are allowed to be called. The
+ *    reason for this restriction is to prevent runaway recursion. Most
+ *    of the APIs that have "create", "get", or "copy" are safe. Any
+ *    attempt to call one of the restricted APIs will result in an
+ *    immediate return with the kATSUInvalidCallInsideCallbackErr
+ *    error. ATSULayoutOperationSelector and
+ *    ATSULayoutOperationCallbackStatus are defined in ATSLayoutTypes.i.
+ }
+type ATSUDirectLayoutOperationOverrideProcPtr = function( iCurrentOperation: ATSULayoutOperationSelector; iLineRef: ATSULineRef; iRefCon: UInt32; iOperationCallbackParameterPtr: UnivPtr; var oCallbackStatus: ATSULayoutOperationCallbackStatus ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSUDirectLayoutOperationOverrideProcPtr)  ATSUDirectLayoutOperationOverrideUPP;
+type ATSUDirectLayoutOperationOverrideUPP = Ptr;
+{
+ *  NewATSUDirectLayoutOperationOverrideUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function NewATSUDirectLayoutOperationOverrideUPP( userRoutine: ATSUDirectLayoutOperationOverrideProcPtr ): ATSUDirectLayoutOperationOverrideUPP; external name '_NewATSUDirectLayoutOperationOverrideUPP';
+
+{
+ *  DisposeATSUDirectLayoutOperationOverrideUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure DisposeATSUDirectLayoutOperationOverrideUPP( userUPP: ATSUDirectLayoutOperationOverrideUPP ); external name '_DisposeATSUDirectLayoutOperationOverrideUPP';
+
+{
+ *  InvokeATSUDirectLayoutOperationOverrideUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function InvokeATSUDirectLayoutOperationOverrideUPP( iCurrentOperation: ATSULayoutOperationSelector; iLineRef: ATSULineRef; iRefCon: UInt32; iOperationCallbackParameterPtr: UnivPtr; var oCallbackStatus: ATSULayoutOperationCallbackStatus; userUPP: ATSUDirectLayoutOperationOverrideUPP ): OSStatus; external name '_InvokeATSUDirectLayoutOperationOverrideUPP';
+
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSULayoutOperationOverrideSpecifier
+ *  
+ *  Summary:
+ *    This structure is used to install a callback for one or more
+ *    ATSUI operations. To do this, simply passed one of these
+ *    structure into the ATSUSetLayoutControls call with the
+ *    kATSULayoutOperationOverrideTag tag.
+ }
+type
+	ATSULayoutOperationOverrideSpecifier = record
+			{
+			 * A bitfield containing the selector for the operations in which the
+			 * callback will be installed for.
+			 }
+		operationSelector: ATSULayoutOperationSelector;
+		overrideUPP: ATSUDirectLayoutOperationOverrideUPP;
+	end;
+	ATSULayoutOperationOverrideSpecifierPtr = ^ATSULayoutOperationOverrideSpecifier;
+
+
+{$ALIGN MAC68K}
+
+
+end.

+ 393 - 0
packages/extra/univint/ATSTypes.pas

@@ -0,0 +1,393 @@
+{
+     File:       ATSTypes.p
+ 
+     Contains:   Public interfaces for Apple Type Services components.
+ 
+     Version:    Technology: Mac OS 9 / Carbon
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1997-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSTypes;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,Files,MixedMode;
+
+
+{$ALIGN MAC68K}
+
+
+type
+	FMGeneration						= UInt32;
+	{	 The FMFontFamily reference represents a collection of fonts with the same design
+	   characteristics. It replaces the standard QuickDraw font identifer and may be used
+	   with all QuickDraw functions including GetFontName and TextFont. It cannot be used
+	   with the Resource Manager to access information from a FOND resource handle. A font
+	   reference does not imply a particular script system, nor is the character encoding
+	   of a font family determined by an arithmetic mapping of its value.
+		}
+	FMFontFamily						= SInt16;
+	FMFontStyle							= SInt16;
+	FMFontStylePtr						= ^FMFontStyle; { when a VAR xx: FMFontStyle parameter can be nil, it is changed to xx: FMFontStylePtr }
+	FMFontSize							= SInt16;
+	FMFontSizePtr						= ^FMFontSize; { when a VAR xx: FMFontSize parameter can be nil, it is changed to xx: FMFontSizePtr }
+	{	 
+	   The font family is a collection of fonts, each of which is identified
+	   by an FMFont reference that maps to a single object registered with
+	   the font database. The font references associated with the font
+	   family consist of individual outline and bitmapped fonts that may be
+	   used with the font access routines of the Font Manager and ATS.
+		}
+	FMFont								= UInt32;
+	FMFontPtr							= ^FMFont; { when a VAR xx: FMFont parameter can be nil, it is changed to xx: FMFontPtr }
+	FMFontFamilyInstancePtr = ^FMFontFamilyInstance;
+	FMFontFamilyInstance = record
+		fontFamily:				FMFontFamily;
+		fontStyle:				FMFontStyle;
+	end;
+
+	FMFontFamilyIteratorPtr = ^FMFontFamilyIterator;
+	FMFontFamilyIterator = record
+		reserved:				array [0..15] of UInt32;
+	end;
+
+	FMFontIteratorPtr = ^FMFontIterator;
+	FMFontIterator = record
+		reserved:				array [0..15] of UInt32;
+	end;
+
+	FMFontFamilyInstanceIteratorPtr = ^FMFontFamilyInstanceIterator;
+	FMFontFamilyInstanceIterator = record
+		reserved:				array [0..15] of UInt32;
+	end;
+
+
+const
+	kInvalidGeneration			= 0;
+	kInvalidFontFamily			= -1;
+	kInvalidFont				= 0;
+
+	kFMCurrentFilterFormat		= 0;
+
+	{	 kFMDefaultOptions & kFMUseGlobalScopeOption moved to Fonts.h 	}
+
+type
+	FMFilterSelector 			= UInt32;
+const
+	kFMFontTechnologyFilterSelector = 1;
+	kFMFontContainerFilterSelector = 2;
+	kFMGenerationFilterSelector	= 3;
+	kFMFontFamilyCallbackFilterSelector = 4;
+	kFMFontCallbackFilterSelector = 5;
+	kFMFontDirectoryFilterSelector = 6;
+
+	kFMTrueTypeFontTechnology	= $74727565 (* 'true' *);
+	kFMPostScriptFontTechnology	= $74797031 (* 'typ1' *);
+
+
+type
+{$ifc TYPED_FUNCTION_POINTERS}
+	FMFontFamilyCallbackFilterProcPtr = function(iFontFamily: FMFontFamily; iRefCon: UnivPtr): OSStatus;
+{$elsec}
+	FMFontFamilyCallbackFilterProcPtr = ProcPtr;
+{$endc}
+
+{$ifc TYPED_FUNCTION_POINTERS}
+	FMFontCallbackFilterProcPtr = function(iFont: FMFont; iRefCon: UnivPtr): OSStatus;
+{$elsec}
+	FMFontCallbackFilterProcPtr = ProcPtr;
+{$endc}
+
+{$ifc OPAQUE_UPP_TYPES}
+	FMFontFamilyCallbackFilterUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	FMFontFamilyCallbackFilterUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	FMFontCallbackFilterUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	FMFontCallbackFilterUPP = UniversalProcPtr;
+{$endc}	
+
+const
+	uppFMFontFamilyCallbackFilterProcInfo = $000003B0;
+	uppFMFontCallbackFilterProcInfo = $000003F0;
+	{
+	 *  NewFMFontFamilyCallbackFilterUPP()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   available as macro/inline
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewFMFontFamilyCallbackFilterUPP(userRoutine: FMFontFamilyCallbackFilterProcPtr): FMFontFamilyCallbackFilterUPP; external name '_NewFMFontFamilyCallbackFilterUPP'; { old name was NewFMFontFamilyCallbackFilterProc }
+{
+ *  NewFMFontCallbackFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewFMFontCallbackFilterUPP(userRoutine: FMFontCallbackFilterProcPtr): FMFontCallbackFilterUPP; external name '_NewFMFontCallbackFilterUPP'; { old name was NewFMFontCallbackFilterProc }
+{
+ *  DisposeFMFontFamilyCallbackFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeFMFontFamilyCallbackFilterUPP(userUPP: FMFontFamilyCallbackFilterUPP); external name '_DisposeFMFontFamilyCallbackFilterUPP';
+{
+ *  DisposeFMFontCallbackFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeFMFontCallbackFilterUPP(userUPP: FMFontCallbackFilterUPP); external name '_DisposeFMFontCallbackFilterUPP';
+{
+ *  InvokeFMFontFamilyCallbackFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeFMFontFamilyCallbackFilterUPP(iFontFamily: FMFontFamily; iRefCon: UnivPtr; userRoutine: FMFontFamilyCallbackFilterUPP): OSStatus; external name '_InvokeFMFontFamilyCallbackFilterUPP'; { old name was CallFMFontFamilyCallbackFilterProc }
+{
+ *  InvokeFMFontCallbackFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeFMFontCallbackFilterUPP(iFont: FMFont; iRefCon: UnivPtr; userRoutine: FMFontCallbackFilterUPP): OSStatus; external name '_InvokeFMFontCallbackFilterUPP'; { old name was CallFMFontCallbackFilterProc }
+type
+	FMFontDirectoryFilterPtr = ^FMFontDirectoryFilter;
+	FMFontDirectoryFilter = record
+		fontFolderDomain:		SInt16;
+		reserved:				array [0..1] of UInt32;
+	end;
+
+	FMFilterPtr = ^FMFilter;
+	FMFilter = record
+		format:					UInt32;
+		selector:				FMFilterSelector;
+		case SInt16 of
+		0: (
+			fontTechnologyFilter: FourCharCode;
+			);
+		1: (
+			fontContainerFilter: FSSpec;
+			);
+		2: (
+			generationFilter:	FMGeneration;
+			);
+		3: (
+			fontFamilyCallbackFilter: FMFontFamilyCallbackFilterUPP;
+			);
+		4: (
+			fontCallbackFilter:	FMFontCallbackFilterUPP;
+			);
+		5: (
+			fontDirectoryFilter: FMFontDirectoryFilter;
+			);
+	end;
+
+	ATSOptionFlags						= OptionBits;
+	ATSGeneration						= UInt32;
+	ATSFontContainerRef					= UInt32;
+	ATSFontFamilyRef					= UInt32;
+	ATSFontRef							= UInt32;
+	ATSGlyphRef							= UInt16;
+	ATSFontSize							= Float32;
+
+const
+	kATSGenerationUnspecified	= 0;
+	kATSFontContainerRefUnspecified = 0;
+	kATSFontFamilyRefUnspecified = 0;
+	kATSFontRefUnspecified		= 0;
+
+
+type
+	ATSFontMetricsPtr = ^ATSFontMetrics;
+	ATSFontMetrics = record
+		version:				UInt32;
+		ascent:					Float32;								{  Maximum height above baseline reached by the glyphs in the font  }
+																		{  or maximum distance to the right of the centerline reached by the glyphs in the font  }
+		descent:				Float32;								{  Maximum depth below baseline reached by the glyphs in the font  }
+																		{  or maximum distance to the left of the centerline reached by the glyphs in the font  }
+		leading:				Float32;								{  Desired spacing between lines of text  }
+		avgAdvanceWidth:		Float32;
+		maxAdvanceWidth:		Float32;								{  Maximum advance width or height of the glyphs in the font  }
+		minLeftSideBearing:		Float32;								{  Minimum left or top side bearing  }
+		minRightSideBearing:	Float32;								{  Minimum right or bottom side bearing  }
+		stemWidth:				Float32;								{  Width of the dominant vertical stems of the glyphs in the font  }
+		stemHeight:				Float32;								{  Vertical width of the dominant horizontal stems of glyphs in the font  }
+		capHeight:				Float32;								{  Height of a capital letter from the baseline to the top of the letter  }
+		xHeight:				Float32;								{  Height of lowercase characters in a font, specifically the letter x, excluding ascenders and descenders  }
+		italicAngle:			Float32;								{  Angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the glyphs in the font  }
+		underlinePosition:		Float32;								{  Distance from the baseline for positioning underlining strokes  }
+		underlineThickness:		Float32;								{  Stroke width for underlining  }
+	end;
+
+
+const
+	kATSItalicQDSkew			= $00004000;					{  fixed value of 0.25  }
+	kATSBoldQDStretch			= $00018000;					{  fixed value of 1.50  }
+	kATSRadiansFactor			= 1144;							{  fixed value of approx. pi/180 (0.0174560546875)  }
+
+	{	 Glyph outline path constants used in ATSFontGetNativeCurveType. 	}
+
+type
+	ATSCurveType 				= UInt16;
+const
+	kATSCubicCurveType			= $0001;
+	kATSQuadCurveType			= $0002;
+	kATSOtherCurveType			= $0003;
+
+{ 
+    This is what the ATSGlyphRef is set to when the glyph is deleted -
+    that is, when the glyph is set to no longer appear when the layout
+    is actually drawn
+}
+const
+  kATSDeletedGlyphcode          = $FFFF;
+
+
+type
+	ATSUCurvePathPtr = ^ATSUCurvePath;
+	ATSUCurvePath = record
+		vectors:				UInt32;
+		controlBits:			array [0..0] of UInt32;
+		vector:					array [0..0] of Float32Point;
+	end;
+
+	ATSUCurvePathsPtr = ^ATSUCurvePaths;
+	ATSUCurvePaths = record
+		contours:				UInt32;
+		contour:				array [0..0] of ATSUCurvePath;
+	end;
+
+	{	 Glyph ideal metrics 	}
+	ATSGlyphIdealMetricsPtr = ^ATSGlyphIdealMetrics;
+	ATSGlyphIdealMetrics = record
+		advance:				Float32Point;
+		sideBearing:			Float32Point;
+		otherSideBearing:		Float32Point;
+	end;
+
+	{	 Glyph screen metrics 	}
+	ATSGlyphScreenMetricsPtr = ^ATSGlyphScreenMetrics;
+	ATSGlyphScreenMetrics = record
+		deviceAdvance:			Float32Point;
+		topLeft:				Float32Point;
+		height:					UInt32;
+		width:					UInt32;
+		sideBearing:			Float32Point;
+		otherSideBearing:		Float32Point;
+	end;
+
+	GlyphID								= ATSGlyphRef;
+	GlyphIDPtr = ^GlyphID;
+{$ALIGN MAC68K}
+
+
+end.

+ 465 - 0
packages/extra/univint/ATSUnicodeDirectAccess.pas

@@ -0,0 +1,465 @@
+{
+     File:       QD/ATSUnicodeDirectAccess.h
+ 
+     Contains:   Public Interfaces/Types for Low Level ATSUI
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2002-2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeDirectAccess;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ATSLayoutTypes,ATSUnicodeTypes,TextCommon;
+{$ALIGN MAC68K}
+
+{ ---------------------------------------------------------------------------- }
+{ Constants                                                                    }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUDirectDataSelector
+ *  
+ *  Summary:
+ *    These are the data selectors used in the
+ *    ATSUDirectGetLayoutDataArrayPtr function to get the needed layout
+ *    data array pointer.
+ }
+type ATSUDirectDataSelector = UInt32;
+const
+
+  {
+   * Returns the parallel advance delta (delta X) array. (Array Type):
+   * Fixed (Return Time): Constant, unless creation is necessary, or
+   * unless requested by ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
+   * (Creation): This array is created only on demand. Thus, if any
+   * changes are to be made iCreate should be set to true. If the array
+   * had not been previously allocated it will be allocated and
+   * zero-filled when iCreate is set to true.
+   }
+  kATSUDirectDataAdvanceDeltaFixedArray = 0;
+
+  {
+   * Returns the parallel baseline delta (delta Y) array. (Array Type):
+   * Fixed (Return Time): Constant, unless creation is necessary, or
+   * unless requested by ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
+   * (Creation): This array is created only on demand. Thus, if any
+   * changes are to be made iCreate should be set to true. If the array
+   * had not been previously allocated it will be allocated and
+   * zero-filled when iCreate is set to true.
+   }
+  kATSUDirectDataBaselineDeltaFixedArray = 1;
+
+  {
+   * Returns the parallel device delta array for device- specific
+   * tweaking. This is an array of values which are used to adjust
+   * truncated fractional values for devices that do not accept
+   * fractional positioning. It is also used to provide precise
+   * positioning for connected scripts. (Array Type): SInt16 (Return
+   * Time): Constant, unless creation is necessary, or unless requested
+   * by ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
+   * array is created only on demand. Thus, if any changes are to be
+   * made iCreate should be set to true. If the array had not been
+   * previously allocated it will be allocated and zero-filled when
+   * iCreate is set to true.
+   }
+  kATSUDirectDataDeviceDeltaSInt16Array = 2;
+
+  {
+   * Returns the parallel style index array. The indexes setting in the
+   * array are indexes into the the StyleSetting array, which can be
+   * obtained using the
+   * kATSUDirectDataStyleSettingATSUStyleSettingRefArray below. (Array
+   * Type): UInt16 (Return Time): Constant, unless creation is
+   * necessary, or unless requested by
+   * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
+   * array is created only on demand. Thus, if any changes are to be
+   * made iCreate should be set to true. If the array had not been
+   * previously allocated it will be allocated and zero-filled when
+   * iCreate is set to true.
+   }
+  kATSUDirectDataStyleIndexUInt16Array = 3;
+
+  {
+   * Returns the style setting ref array. (Array Type):
+   * ATSUStyleSettingRef (Return Time): Linear, based on the number of
+   * styles applied to the given line. (Creation): This array is always
+   * present if the layout has any text assigned to it at all. Setting
+   * iCreate has no effect.
+   }
+  kATSUDirectDataStyleSettingATSUStyleSettingRefArray = 4;
+
+  {
+   * Returns the ATSLayoutRecord, version 1 array. This should not be
+   * used directly at all. Rather, use the
+   * kATSUDirectDataLayoutRecordATSLayoutRecordCurrent selector below.
+   * This will ensure that the code will always be using the most
+   * current version of the ATSLayoutRecord, should there ever be a
+   * change. ATSUI will only ensure the most efficient processing will
+   * occur for the latest version of ATSLayoutRecord. (Array Type):
+   * ATSLayoutRecord, version 1 (Return Time): Constant, unless
+   * creation is necessary, or unless requested by
+   * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
+   * array is always present if the layout has any text assigned to it
+   * at all. Setting iCreate has no effect
+   }
+  kATSUDirectDataLayoutRecordATSLayoutRecordVersion1 = 100;
+
+  {
+   * Returns the ATSLayoutRecord. This will return the most current
+   * version of the ATSLayoutRecord, and the one that's defined in this
+   * file. Always use kATSUDirectDataLayoutRecordATSLayoutRecordCurrent
+   * to get the array of ATSLayoutRecords. (Array Type):
+   * ATSLayoutRecord (Return Time): Constant, unless creation is
+   * necessary, or unless requested by
+   * ATSUDirectGetLayoutDataArrayPtrFromTextLayout. (Creation): This
+   * array is always present if the layout has any text assigned to it
+   * at all. Setting iCreate has no effect.
+   }
+  kATSUDirectDataLayoutRecordATSLayoutRecordCurrent = kATSUDirectDataLayoutRecordATSLayoutRecordVersion1;
+
+{ ---------------------------------------------------------------------------- }
+{ Data Types                                                                   }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUStyleSettingRef
+ *  
+ *  Summary:
+ *    A reference to a style setting object that represents an
+ *    ATSUStyle plus any cached/set information about that style.
+ }
+type
+	ATSUStyleSettingRef    = ^SInt32; { an opaque 32-bit type }
+{ ---------------------------------------------------------------------------- }
+{ Direct Accessors                                                             }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUDirectGetLayoutDataArrayPtrFromLineRef()
+ *  
+ *  Summary:
+ *    Returns the data pointer specified by iDataSelector and
+ *    referenced by iLineRef.
+ *  
+ *  Discussion:
+ *    This function simply returns the data pointer specified by
+ *    iDataSelector and referenced by iLineRef. This data pointer
+ *    should not be freed directly after it's been used. Rather, it
+ *    should be released using ATSUDirectReleaseLayoutDataArrayPtr.
+ *    Doing so serves as a signal to ATSUI that the caller is done with
+ *    the data and that it can merge it in smoothly and adjust its
+ *    internal processes. Furthermore, it may be the case that the
+ *    pointer returned may be dynamically allocated one or contain
+ *    dynamically allocated data. If it's not properly freed, a memory
+ *    leak may result. This function may only be called within the
+ *    context of an ATSUDirectLayoutOperationOverrideUPP callback. The
+ *    pointer returned points to the exact data referenced by the
+ *    ATSUTextLayout object that triggered the callback call. This is
+ *    by far the most efficient way to use the direct access calls
+ *    because for most requested data, no allocation and copy is done.
+ *    Furthermore, because this a direct pointer to the data that ATSUI
+ *    will use for it's layout, the data arrays returned by this can be
+ *    tweaked and edited. Many of the requested arrays are created by
+ *    ATSUI only when necessary. If these arrays are to be altered,
+ *    then be sure to set iCreate to true. This will ensure that this
+ *    array is created. If the arrays are not created, ATSUI
+ *    automatically assumes that all entries in the array are zero. The
+ *    pointer returned by this function is only valid within the
+ *    context of the callback. Do not attempt to retain it for later
+ *    use.
+ *  
+ *  Parameters:
+ *    
+ *    iLineRef:
+ *      The ATSULineRef which was passed into a
+ *      ATSUDirectLayoutOperationOverrideUPP callback function as a
+ *      parameter.
+ *    
+ *    iDataSelector:
+ *      The selector for the data that is being requested.
+ *    
+ *    iCreate:
+ *      If the ATSULineRef passed in iLineRef does not reference the
+ *      requested array, then a zero-filled one will be created and
+ *      returned in oLayoutDataArray if this is set to true. For some
+ *      ATSUDirectDataSelectors, these cannot be simply created. Thus,
+ *      this flag will have no affect on these few
+ *      ATSUDirectDataSelectors.
+ *    
+ *    oLayoutDataArrayPtr:
+ *      Upon sucessful return, this parameter will contain a pointer to
+ *      an array of the requested values if the ATSULineRef passed in
+ *      iLineRef references those values. If this is not the case, then
+ *      NULL will be returned, unless iCreate is set to true and the
+ *      array can be created. This parameter itself may be set to NULL
+ *      if only a count of the entries is needed. can be NULL
+ *    
+ *    oLayoutDataCount:
+ *      Upon sucessful return, this parameter will contain a count of
+ *      the entries in the array returned in oLayoutDataArray.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUDirectGetLayoutDataArrayPtrFromLineRef( iLineRef: ATSULineRef; iDataSelector: ATSUDirectDataSelector; iCreate: Boolean; oLayoutDataArrayPtr: PtrPtr; var oLayoutDataCount: ItemCount ): OSStatus; external name '_ATSUDirectGetLayoutDataArrayPtrFromLineRef';
+
+
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUDirectGetLayoutDataArrayPtrFromTextLayout()
+ *  
+ *  Summary:
+ *    Returns the data pointer specified by iDataSelector and
+ *    referenced by iTextLayout for the line starting at iLineOffset.
+ *  
+ *  Discussion:
+ *    This function simply returns the data pointer specified by
+ *    iDataSelector and referenced by iTextLayout for the line starting
+ *    at iLineOffset. This data pointer should not be freed directly
+ *    after it's been used. Rather, it should be released using
+ *    ATSUDirectReleaseLayoutDataArrayPtr. Doing so serves as a signal
+ *    to ATSUI that the caller is done with the data. Furthermore, it
+ *    may be the case that the pointer returned may be dynamically
+ *    allocated one or contain dynamically allocated data. If it's not
+ *    properly freed, a memory leak may result. This function may not
+ *    be called inside the context of an
+ *    ATSUDirectLayoutOperationOverrideUPP callback for the
+ *    ATSUTextLayout data that triggered the callback.  All data
+ *    returned will be a copy of the data in the object requested. This
+ *    means two things: first of all, this means that it's a very
+ *    inefficient way of using the data. All of the selectors that
+ *    would have returned in constant time now would be forced to
+ *    return in order-n time. Second of all, this means that the
+ *    developer cannot change any of the data. Any changes the
+ *    developer makes to the arrays returned by this API will have no
+ *    effect on the layout. Using the 
+ *    kATSULayoutOperationPostLayoutAdjustment operation selector
+ *    override and the ATSUDirectGetLayoutDataArrayPtrFromLineRef is a
+ *    great alternative to using this API. Many of the requested arrays
+ *    are created by ATSUI only when necessary. This means that it's
+ *    possible that this API will return NULL pointer and a count of 0.
+ *    In this case, if there's no error returned, the array simply
+ *    doesn't exist and the caller should treat all of the entries in
+ *    the array that they would have recieved as being 0.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The ATSUTextLayout object from which the requested data will
+ *      come from.
+ *    
+ *    iLineOffset:
+ *      The edge offset that corresponds to the beginning of the range
+ *      of text of the line of the requested data. If the text has
+ *      multiple lines, then ATSUDirectGetLayoutDataArrayPtrFromLineRef
+ *      will need to be called for each of the lines in which the
+ *      requested data is needed.
+ *    
+ *    iDataSelector:
+ *      The selector for the data that is being requested.
+ *    
+ *    oLayoutDataArrayPtr:
+ *      Upon sucessful return, this parameter will contain a pointer to
+ *      an array of the requested values if the ATSUTextLayout passed
+ *      in iTextLayout references those values for the line offset
+ *      iLineOffset. If this is not the case, then NULL will be
+ *      returned. This parameter itself may be set to NULL if only a
+ *      count of the entries is needed. can be NULL
+ *    
+ *    oLayoutDataCount:
+ *      Upon sucessful return, this parameter will contain a count of
+ *      the entries in the array returned in oLayoutDataArray.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUDirectGetLayoutDataArrayPtrFromTextLayout( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iDataSelector: ATSUDirectDataSelector; oLayoutDataArrayPtr: PtrPtr; var oLayoutDataCount: ItemCount ): OSStatus; external name '_ATSUDirectGetLayoutDataArrayPtrFromTextLayout';
+
+
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUDirectReleaseLayoutDataArrayPtr()
+ *  
+ *  Summary:
+ *    Properly releases of an array pointer returned by
+ *    ATSUDirectGetLayoutDataArrayPtrFromLineRef() or
+ *    ATSUDirectGetLayoutDataArrayPtrFromTextLayout.
+ *  
+ *  Discussion:
+ *    This function is needed to let ATSUI know that the caller is
+ *    finished with the pointer that was previously requested by
+ *    ATSUDirectGetLayoutDataArrayPtrFromLineRef() or
+ *    ATSUDirectGetLayoutDataArrayPtrFromTextLayout(). This is needed
+ *    in case ATSUI needs to make any internal adjustments to it's
+ *    internal structures.
+ *  
+ *  Parameters:
+ *    
+ *    iLineRef:
+ *      The lineRef from which the layout data array pointer came from.
+ *      If the layout data array pointer did not come from a lineRef,
+ *      then set this to NULL. can be NULL
+ *    
+ *    iDataSelector:
+ *      The selector for which iLayoutDataArrayPtr was obtained.
+ *    
+ *    iLayoutDataArrayPtr:
+ *      A pointer to the layout data array which is to be disposed of.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUDirectReleaseLayoutDataArrayPtr( iLineRef: ATSULineRef; iDataSelector: ATSUDirectDataSelector; iLayoutDataArrayPtr: PtrPtr ): OSStatus; external name '_ATSUDirectReleaseLayoutDataArrayPtr';
+
+
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUDirectAddStyleSettingRef()
+ *  
+ *  Summary:
+ *    This function will fetch a style index for the
+ *    ATSUStyleSettingRef passed in.
+ *  
+ *  Discussion:
+ *    This function allows for glyph replacement or substitution from
+ *    one layout or line to another layout or line. Not only will it
+ *    look up the style index for iStyleSettingRef, but if the
+ *    ATSUStyleSettingRef passed in iStyleSettingRef is not yet part of
+ *    the line referenced by iLineRef, it will add it. If there is an
+ *    outstanding ATSUStyleSettingRef array obtained by using the
+ *    kATSUDirectDataStyleSettingATSUStyleSettingRefArray selector, the
+ *    pointer obtained for this may no longer be valid after this
+ *    function has been called. These pointers should be freed before
+ *    calling this function and re-obtained afterwards.
+ *  
+ *  Parameters:
+ *    
+ *    iLineRef:
+ *      An ATSULineRef which was passed into a
+ *      ATSUDirectLayoutOperationOverrideUPP callback function as a
+ *      parameter.
+ *    
+ *    iStyleSettingRef:
+ *      The ATSUStyleSettingRef to be looked up or added to the
+ *      ATSUTextLayout referenced by iTextLayout for the line starting
+ *      at the offset iLineOffset.
+ *    
+ *    oStyleIndex:
+ *      Upon sucessful return, this will parameter will be set to the
+ *      index of the ATSUStyleSettingRef passed in iStyleSettingRef for
+ *      the line referenced by iLineRef. If the ATSUStyleSettingRef
+ *      does not exist, in that context, then it will be added and the
+ *      new index will be returned here.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUDirectAddStyleSettingRef( iLineRef: ATSULineRef; iStyleSettingRef: ATSUStyleSettingRef; var oStyleIndex: UInt16 ): OSStatus; external name '_ATSUDirectAddStyleSettingRef';
+
+end.

+ 1695 - 0
packages/extra/univint/ATSUnicodeDrawing.pas

@@ -0,0 +1,1695 @@
+{
+     File:       QD/ATSUnicodeDrawing.h
+ 
+     Contains:   ATSUI drawing, measuring, and highlighting functions.
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeDrawing;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,TextCommon,Quickdraw,ATSLayoutTypes,ATSUnicodeTypes;
+{$ALIGN MAC68K}
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI drawing and measuring                                                 }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUDrawText()
+ *  
+ *  Summary:
+ *    Draws a specified range of text in a QuickDraw graphics port or
+ *    Quartz graphics context.
+ *  
+ *  Discussion:
+ *    Before calling ATSUDrawText, you will most likely want to call
+ *    ATSUSetLayoutControls to set a value for the kATSUCGContextTag
+ *    attribute in order to specify your current graphics context.
+ *    Otherwise, ATSUI will attempt to draw using Quickdraw style text
+ *    rendering in whatever Quickdraw GrafPort is currently active (use
+ *    SetPort to determine the currently active Quickdraw GrafPort, see
+ *    Quickdraw.h). Carbon applications can create a CGContext from a
+ *    Quickdraw GrafPort using the functions QDBeginCGContext and
+ *    QDEndCGContext (see Quickdraw.h). Cocoa applications can call the
+ *    method "graphicsPort" on the current NSGraphicsContext in order
+ *    to get a CGContextRef to pass into ATSUI (use the method
+ *    "currentContext" to obtain the current NSGraphicsContext, see
+ *    NSGraphicsContext.h for more information). ATSUDrawText examines
+ *    the text layout object to ensure that each of the characters in
+ *    the range is assigned to a style run. If there are gaps between
+ *    style runs, ATSUI assigns the characters in the gap to the style
+ *    run that precedes (in storage order) the gap. If there is no
+ *    style run at the beginning of the text range, ATSUI assigns these
+ *    characters to the first style run it finds. If there is no style
+ *    run at the end of the text range, ATSUI assigns the remaining
+ *    characters to the last style run it finds. If you want to draw a
+ *    range of text that spans multiple lines, you should call
+ *    ATSUDrawText for each line of text to draw, even if all the lines
+ *    are in the same text layout object. You should adjust the
+ *    iLineOffset parameter to reflect the beginning of each line to be
+ *    drawn. Please note that when drawing into a GrafPort, calls to
+ *    QDSwapTextFlags have no effect on ATSUI text rendering. The
+ *    proper way to achieve Quartz text rendering from ATSUI is to use
+ *    the kATSUCGContextTag attribute to specify a CGContextRef in each
+ *    ATSUTextLayout before calling ATSUDrawText.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout containing text to draw.
+ *    
+ *    iLineOffset:
+ *      The starting offset of the range of text to draw. To specify
+ *      the beginning of the text buffer, pass kATSUFromTextBeginning
+ *      for this parameter.
+ *    
+ *    iLineLength:
+ *      The length of the range of text to draw. To specify a range
+ *      that continues to the end of the text buffer, pass
+ *      kATSUToTextEnd for this parameter.
+ *    
+ *    iLocationX:
+ *      The x-coordinate of the origin (in either the current graphics
+ *      port or Quartz graphics context) of the line containing the
+ *      text range to render. Note that the ATSUTextMeasurement type is
+ *      defined as a Fixed value, so you must ensure that your
+ *      coordinates are converted to Fixed values before passing them
+ *      to this function (see FixMath.h for conversion functions). Pass
+ *      the constant kATSUUseGrafPortPenLoc to draw relative to the
+ *      current pen location in the current graphics port.
+ *    
+ *    iLocationY:
+ *      The y-coordinate of the origin (in either the current graphics
+ *      port or Quartz graphics context) of the line containing the
+ *      text range to render. Note that the ATSUTextMeasurement type is
+ *      defined as a Fixed value, so you must ensure that your
+ *      coordinates are converted to Fixed values before passing them
+ *      to this function (see FixMath.h for conversion functions). Pass
+ *      the constant kATSUUseGrafPortPenLoc to draw relative to the
+ *      current pen location in the current graphics port.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUDrawText( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iLineLength: UniCharCount; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement ): OSStatus; external name '_ATSUDrawText';
+
+
+{
+ *  ATSUGetUnjustifiedBounds()
+ *  
+ *  Summary:
+ *    Obtains the typographic bounding rectangle for a line of text
+ *    prior to final layout.
+ *  
+ *  Discussion:
+ *    This function calculates the typographic bounds (in coordinates
+ *    independent of the rendering device) for a line of text. Note
+ *    that ATSUGetUnjustifiedBounds calculates these bounds prior to
+ *    the text's final layout, and therefore, the calculated bounds
+ *    might not reflect those of the final laid-out line.
+ *    Justification, truncation, and device level positioning are not
+ *    taken into account. To obtain the typographic bounds of a line
+ *    after it is laid out, you can call the function
+ *    ATSUGetGlyphBounds. For more infomration about the difference
+ *    between typographic and image bounds, please refer to the ATSUI
+ *    documentation. Note that ATSUGetUnjustifiedBounds treats the
+ *    specified text range as a single line. That is, if the range of
+ *    text you specify is less than a line, it nevertheless treats the
+ *    initial character in the range as the start of a line, for
+ *    measuring purposes. If the range of text extends beyond a line,
+ *    ATSUGetUnjustifiedBounds ignores soft line breaks, again,
+ *    treating the text as a single line.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout object to obtain bounds information for.
+ *    
+ *    iLineStart:
+ *      The start of the line of text to obtain bounds information for.
+ *      To indicate that the line starts at the beginning of the text
+ *      buffer, you can pass the constant kATSUFromTextBeginning . To
+ *      specify the entire text buffer, pass kATSUFromTextBeginning in
+ *      this parameter and kATSUToTextEnd in the iLineLength parameter.
+ *    
+ *    iLineLength:
+ *      The length of the line to obtain bounds information for. If you
+ *      want the line to extend to the end of the text buffer, you can
+ *      pass the constant kATSUToTextEnd .
+ *    
+ *    oTextBefore:
+ *      On return, the value specifies the starting point of the
+ *      typographic bounds for the line, relative to the origin (0,0)
+ *      of the line and taking into account cross-stream shifting. Note
+ *      that the ATSUMeasureText function might produce negative values
+ *      for the typographic starting point of the line if, for example,
+ *      the initial character of the line is allowed to hang into the
+ *      margin. For horizontal text, this value corresponds to the left
+ *      side of the bounding rectangle.
+ *    
+ *    oTextAfter:
+ *      On return, the end point of the typographic bounds for the
+ *      line, relative to the origin (0,0) of the line and taking into
+ *      account cross-stream shifting. For horizontal text, this value
+ *      corresponds to the right side of the bounding rectangle.
+ *    
+ *    oAscent:
+ *      On return, the typographic bounds for the line, relative to the
+ *      origin (0,0) of the line and taking into account cross-stream
+ *      shifting. For horizontal text, this value corresponds to the
+ *      top side of the bounding rectangle.
+ *    
+ *    oDescent:
+ *      On return, the typographic bounds for the line, relative to the
+ *      origin (0,0) of the line and taking into account cross-stream
+ *      shifting. For horizontal text, this value corresponds to the
+ *      bottom side of the bounding rectangle.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUGetUnjustifiedBounds( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; var oTextBefore: ATSUTextMeasurement; var oTextAfter: ATSUTextMeasurement; var oAscent: ATSUTextMeasurement; var oDescent: ATSUTextMeasurement ): OSStatus; external name '_ATSUGetUnjustifiedBounds';
+
+
+{
+ *  ATSUMeasureTextImage()
+ *  
+ *  Summary:
+ *    Obtains the image bounding rectangle for a line of text after
+ *    final layout.
+ *  
+ *  Discussion:
+ *    This function obtains the image bounds of a laid-out line of
+ *    text. These bounds are described by the smallest rectangle that
+ *    completely encloses the filled or framed parts of a block of
+ *    textÑthat is, the text's "inked" glyphs. In measuring the line,
+ *    the ATSUMeasureTextImage function takes into account line
+ *    rotation, alignment, and justification, as well as other
+ *    characteristics that affect layout, such as hanging punctuation.
+ *    (If the line is rotated, the sides of the rectangle are parallel
+ *    to the coordinate axes and encompass the rotated line.) If no
+ *    attributes are set for the line, ATSUMeasureTextImage uses the
+ *    global attributes set for the text layout object. Because the
+ *    height of the image bounding rectangle is determined by the
+ *    actual device metrics, ATSUMeasureTextImage ignores any
+ *    previously set line ascent and descent values for the line it is
+ *    measuring.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout for which to obtain image bounds.
+ *    
+ *    iLineOffset:
+ *      The first character of the line to examine. To indicate that
+ *      the specified line starts at the beginning of the text buffer,
+ *      you can pass the constant kATSUFromTextBeginning . To specify
+ *      the entire text buffer, pass kATSUFromTextBeginning in this
+ *      parameter and kATSUToTextEnd in the iLineLength parameter.
+ *    
+ *    iLineLength:
+ *      The length of the text range. If you want the range of text to
+ *      extend to the end of the text buffer, you can pass the constant
+ *      kATSUToTextEnd . However, the image bounds is restricted to the
+ *      line in which iLineOffset resides.
+ *    
+ *    iLocationX:
+ *      The x-coordinate of the line's origin in the current graphics
+ *      port or Quartz graphics context. Pass the constant
+ *      kATSUUseGrafPortPenLoc for the dimensions of the bounds
+ *      relative to the current pen location in the current graphics
+ *      port or graphics context. You can pass 0to obtain only the
+ *      dimensions of the bounding rectangle relative to one another,
+ *      not their actual onscreen position.
+ *    
+ *    iLocationY:
+ *      The y-coordinate of the line's origin in the current graphics
+ *      port or Quartz graphics context. Pass the constant
+ *      kATSUUseGrafPortPenLoc for the dimensions of the bounds
+ *      relative to the current pen location in the current graphics
+ *      port or graphics context. You can pass 0to obtain only the
+ *      dimensions of the bounding rectangle relative to one another,
+ *      not their actual onscreen position.
+ *    
+ *    oTextImageRect:
+ *      On return, the dimensions of the image bounding rectangle for
+ *      the text, offset by the values specified in the iLocationX and
+ *      iLocationY parameters. If the line is rotated, the sides of the
+ *      rectangle are parallel to the coordinate axis.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUMeasureTextImage( iTextLayout: ATSUTextLayout; iLineOffset: UniCharArrayOffset; iLineLength: UniCharCount; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; var oTextImageRect: Rect ): OSStatus; external name '_ATSUMeasureTextImage';
+
+
+{
+ *  ATSUGetGlyphBounds()
+ *  
+ *  Summary:
+ *    Obtains the typographic bounds of a line of glyphs after final
+ *    layout.
+ *  
+ *  Discussion:
+ *    This function produces the enclosing trapezoid(s) that represent
+ *    the typographic bounds for glyphs in a final, laid-out range of
+ *    text. You typically call this function when you need to obtain an
+ *    enclosing trapezoid for a line, taking rotation and all other
+ *    layout attributes into account. ATSUI determines the height of
+ *    each trapezoid by examining any line ascent and descent attribute
+ *    values you may have set for the line. If you have not set these
+ *    attributes for the line, the ATSUGetGlyphBounds function uses any
+ *    line ascent and descent values you may have set for the text
+ *    layout object containing the line. If these are not set,
+ *    ATSUGetGlyphBounds uses the font's natural line ascent and
+ *    descent values for the line. If these are previously set,
+ *    ATSUGetGlyphBounds uses the ATSUStyle ascent and or
+ *    descent/leading values. Note that the coordinates produced for
+ *    the trapezoid(s) are offset by the amount specified in the
+ *    iTextBasePointX and iTextBasePointY parameters. If your goal in
+ *    calling the ATSUGetGlyphBounds function is to obtain metrics for
+ *    drawing the typographic bounds on the screen, pass the position
+ *    of the origin of the line in the current graphics port or
+ *    graphics context in these parameters. This enables
+ *    ATSUGetGlyphBounds to match the trapezoids to their onscreen
+ *    image. When the range specified by the iBoundsCharStart and
+ *    iBoundsCharLength parameters covers an entire line, you are
+ *    guaranteed to receive only one trapezoid on return. Otherwise,
+ *    multiple trapezoids may be returned to cover incomplete sections
+ *    of bidi runs. In such cases, you would typically call
+ *    ATSUGetGlyphBounds twice, as follows: (1) Pass NULL for the
+ *    oGlyphBounds parameter, 0 for the iMaxNumberOfBounds parameter,
+ *    and valid values for the other parameters. The ATSUGetGlyphBounds
+ *    function returns the actual number of trapezoids needed to
+ *    enclose the glyphs in the oActualNumberOfBounds parameter. (2)
+ *    Allocate enough space for a buffer of the returned size, then
+ *    call the function again, passing a valid pointer to the buffer in
+ *    the oGlyphBounds parameter. On return, the buffer contains the
+ *    trapezoids for the glyphs' typographic bounds. To obtain the
+ *    typographic bounds of a line of text prior to line layout, call
+ *    the function ATSUGetUnjustifiedBounds. To calculate the image
+ *    bounding rectangle for a final laid-out line, call the function
+ *    ATSUMeasureTextImage. For more infomration about the difference
+ *    between typographic and image bounds, please refer to the ATSUI
+ *    documentation.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout object for which glyph bounds are to be
+ *      obtained.
+ *    
+ *    iTextBasePointX:
+ *      The x-coordinate of the origin of the line containing the
+ *      glyphs in the current graphics port or Quartz graphics context.
+ *      Pass the constant kATSUUseGrafPortPenLoc to obtain the glyph
+ *      bounds relative to the current pen location in the current
+ *      graphics port or graphics context. You may pass 0 to obtain
+ *      only the dimensions of the bounds relative to one another, not
+ *      their actual onscreen position.
+ *    
+ *    iTextBasePointY:
+ *      The y-coordinate of the origin of the line containing the
+ *      glyphs in the current graphics port or Quartz graphics context.
+ *      Pass the constant kATSUUseGrafPortPenLoc to obtain the glyph
+ *      bounds relative to the current pen location in the current
+ *      graphics port or graphics context. You may pass 0 to obtain
+ *      only the dimensions of the bounds relative to one another, not
+ *      their actual onscreen position.
+ *    
+ *    iBoundsCharStart:
+ *      The offset from the beginning of the text buffer to the
+ *      character corresponding to the first glyph to measure. To
+ *      indicate that the text range starts at the beginning of the
+ *      text buffer, you can pass the constant kATSUFromTextBeginning.
+ *    
+ *    iBoundsCharLength:
+ *      The length of text range to measure. If you want the range to
+ *      extend to the end of the text buffer, you can pass the constant
+ *      kATSUToTextEnd.
+ *    
+ *    iTypeOfBounds:
+ *      The type of bounds you wish to obtain. See ATSLayoutTypes.h for
+ *      a list of possible values to pass in here.
+ *    
+ *    iMaxNumberOfBounds:
+ *      The maximum number of bounding trapezoids to obtain. Typically,
+ *      this is equivalent to the number of bounds in the oGlyphBounds
+ *      array. To determine this value, see the Discussion.
+ *    
+ *    oGlyphBounds:
+ *      A pointer to memory you have allocated for an array of
+ *      ATSTrapezoid values. On return, the array contains a trapezoid
+ *      representing the typographic bounds for glyphs in the text
+ *      range. If the specified range of text encloses nested
+ *      bidirectional text, ATSUGetGlyphBounds produces multiple
+ *      trapezoids defining these regions.In ATSUI 1.1, the maximum
+ *      number of enclosing trapezoids that can be returned is 31; in
+ *      ATSUI 1.2, the maximum number is 127. If you pass a range that
+ *      covers an entire line, ATSUGetGlyphBounds always returns only 1
+ *      trapezoid. If you are uncertain of how much memory to allocate
+ *      for this array, see the Discussion. can be NULL
+ *    
+ *    oActualNumberOfBounds:
+ *      On return, the value specifies the actual number of enclosing
+ *      trapezoids bounding the specified characters. This may be
+ *      greater than the value you provide in the iMaxNumberOfBounds
+ *      parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetGlyphBounds( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iBoundsCharStart: UniCharArrayOffset; iBoundsCharLength: UniCharCount; iTypeOfBounds: UInt16; iMaxNumberOfBounds: ItemCount; oGlyphBounds: ATSTrapezoidPtr; var oActualNumberOfBounds: ItemCount ): OSStatus; external name '_ATSUGetGlyphBounds';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI line breaking                                                         }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUBatchBreakLines()
+ *  
+ *  Summary:
+ *    Soft wraps a range of text in a layout to a constant line width.
+ *  
+ *  Discussion:
+ *    Equivalent to repeatedly calling the ATSUBreakLine function with
+ *    the parameter iUseAsSoftLineBreak set to true. Use this function
+ *    to gain a substantial performance increase over the use of
+ *    ATSUBreakLine. It will set soft breaks in a layout for multiple
+ *    lines in a single call. It assumes constant line width. Soft line
+ *    breaks within a layout are what divide it into lines. You can
+ *    manipulate the soft breaks that are currently set within a layout
+ *    using the functions ATSUGetSoftLineBreaks, ATSUSetSoftLineBreak,
+ *    and ATSUClearSoftLineBreaks.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout containing text to be soft wrapped.
+ *    
+ *    iRangeStart:
+ *      Beginning offset for the rage of text to be soft wrapped.
+ *    
+ *    iRangeLength:
+ *      The length of the range of text to be soft wrapped.
+ *    
+ *    iLineWidth:
+ *      The line width at which to force soft wrapping of text. Note
+ *      that this parameter is of type ATSUTextMeasurement, which is
+ *      defined as Fixed. See FixMath.h for conversion routines for
+ *      fixed point values.
+ *    
+ *    oBreakCount:
+ *      On return, the number of soft breaks that were set in the
+ *      layout. Use this to determine how much memory to allocate when
+ *      calling ATSUGetSoftLineBreaks. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUBatchBreakLines( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount; iLineWidth: ATSUTextMeasurement; oBreakCount: ItemCountPtr ): OSStatus; external name '_ATSUBatchBreakLines';
+
+
+{
+ *  ATSUBreakLine()
+ *  
+ *  Summary:
+ *    Soft wraps a single line of text within a layout.
+ *  
+ *  Discussion:
+ *    This function will automatically determine the optimal place to
+ *    set a soft break in a given range of text. It suggests a soft
+ *    line break each time it encounters a hard line break character
+ *    such as a carriage return, line feed, form feed, line separator,
+ *    or paragraph separator. If ATSUBreakLine does not encounter a
+ *    hard line break, it uses the line width you specify to determine
+ *    how many characters fit on a line and suggests soft line breaks
+ *    accordingly. You can loop over ATSUBreakLine, repeatedly calling
+ *    it on the same layout, until all the text in the entire layout
+ *    has been soft wrapped. However, for maximum efficiency, you
+ *    should use ATSUBatchBreakLines. ATSUBreakLine should only be used
+ *    if you have special needs, such as a non-constant line width.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout containing text to be soft wrapped.
+ *    
+ *    iLineStart:
+ *      The beginning of the line you wish to soft wrap. To specify the
+ *      beginning of the text buffer, pass the constant
+ *      kATSUFromTextBeginning.
+ *    
+ *    iLineWidth:
+ *      The line width at which to force soft wrapping of text. Note
+ *      that this parameter is of type ATSUTextMeasurement, which is
+ *      defined as Fixed. See FixMath.h for conversion routines for
+ *      fixed point values.
+ *    
+ *    iUseAsSoftLineBreak:
+ *      A Boolean value indicating whether ATSUBreakLine should
+ *      automatically set the line break produced in the oLineBreak
+ *      parameter. If true ,ATSUBreakLine sets the line break and
+ *      clears any previously-set soft line breaks that precede the new
+ *      break in the line but lie after the offset specified by
+ *      iLineStart. You should ususally pass true for this parameter,
+ *      unless you plan to use ATSUSetSoftLineBreak to set the soft
+ *      break somewhere other than what is suggested by ATSUBreakLine.
+ *    
+ *    oLineBreak:
+ *      On return, the value specifies the soft line break as
+ *      determined by ATSUBreakLine. If the value returned is the same
+ *      value as specified in iLineStart , you have made an input
+ *      parameter error. In this case, check to make sure that the line
+ *      width specified in iLineWidth is big enough for ATSUBreakLine
+ *      to perform line breaking. ATSUBreakLine does not return an
+ *      error in this case.
+ *  
+ *  Result:
+ *    On success, noErr is returned. TSUI usually calculates a soft
+ *    line break to be at the beginning of the first word that does ont
+ *    fit on the line. But if ATSUBreakLine calculates the most optimal
+ *    line break to be in the middle of a word, it returns the result
+ *    code kATSULineBreakInWord. Note that ATSUI produces a line break
+ *    in the middle of a word only as a last resort. See MacErrors.h
+ *    for other possible error codes. can be NULL
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUBreakLine( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineWidth: ATSUTextMeasurement; iUseAsSoftLineBreak: Boolean; oLineBreak: UniCharArrayOffsetPtr ): OSStatus; external name '_ATSUBreakLine';
+
+
+{
+ *  ATSUSetSoftLineBreak()
+ *  
+ *  Summary:
+ *    Sets a soft line break at the specified point in a text layout.
+ *  
+ *  Discussion:
+ *    You should typically only call ATSUSetSoftLineBreak to set line
+ *    breaks when you are using your own line-breaking algorithm to
+ *    calculate these breaks. For optimal performance, you should use
+ *    ATSUBatchBreakLines to both calculate and set soft line breaks in
+ *    your text. After calling ATSUSetSoftLineBreak , you should call
+ *    the function ATSUGetUnjustifiedBounds to determine whether the
+ *    characters still fit within the line, which is necessary due to
+ *    end-of-line effects such as swashes.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which to set the soft break.
+ *    
+ *    iLineBreak:
+ *      An offset into the text buffer specifying the location to set
+ *      the soft break at.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetSoftLineBreak( iTextLayout: ATSUTextLayout; iLineBreak: UniCharArrayOffset ): OSStatus; external name '_ATSUSetSoftLineBreak';
+
+
+{
+ *  ATSUGetSoftLineBreaks()
+ *  
+ *  Summary:
+ *    Obtains the soft line breaks that are currently set in a given
+ *    text range.
+ *  
+ *  Discussion:
+ *    Typically you use the function ATSUGetSoftLineBreaks by calling
+ *    it twice, as follows: (1) Pass valid values for the iTextLayout,
+ *    iRangeStart, iRangeLength, and oBreakCount parameters. Pass NULL
+ *    for the oBreaks parameter and 0 for the iMaximumBreaks parameter.
+ *    ATSUGetSoftLineBreaks returns the size of the font array in the
+ *    oBreakCount parameter. (2) Allocate enough space for an array of
+ *    the returned size, then call the function again, passing a valid
+ *    pointer in the oBreaks parameter. On return, the pointer refers
+ *    to an array containing the text range's soft line breaks. If you
+ *    have just called ATSUBatchBreakLines, the oBreakCount parameter
+ *    will give you the value you would normally obtain from step 1,
+ *    allowing you to skip this step in such cases.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A text layout to obtain a list of soft breaks from.
+ *    
+ *    iRangeStart:
+ *      The beginning of the range of text for which to obtain a list
+ *      of softbreaks. To indicate that the specified text range starts
+ *      at the beginning of the text buffer, you can pass the constant
+ *      kATSUFromTextBeginning, To specify the entire text buffer, pass
+ *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
+ *      the iRangeLength parameter.
+ *    
+ *    iRangeLength:
+ *      The end of the range of text for which to obtain a list of
+ *      softbreaks. If you want the range of text to extend to the end
+ *      of the text buffer, you can pass the constant kATSUToTextEnd.
+ *    
+ *    iMaximumBreaks:
+ *      The maximum number of soft line breaks to obtain. Typically,
+ *      this is equivalent to the number of UniCharArrayOffset values
+ *      for which you have allocated memory in the oBreaks array. To
+ *      determine this value, see the Discussion.
+ *    
+ *    oBreaks:
+ *      On return, the array contains offsets from the beginning of the
+ *      text buffer to each of the soft line breaks in the text range.
+ *      If you are uncertain of how much memory to allocate for this
+ *      array, see the Discussion. can be NULL
+ *    
+ *    oBreakCount:
+ *      On return, the number of soft breaks set in iTextLayout. Note
+ *      that this value may be greater than what you pass in for
+ *      iMaximumBreaks. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetSoftLineBreaks( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount; iMaximumBreaks: ItemCount; oBreaks: UniCharArrayOffsetPtr; oBreakCount: ItemCountPtr ): OSStatus; external name '_ATSUGetSoftLineBreaks';
+
+
+{
+ *  ATSUClearSoftLineBreaks()
+ *  
+ *  Summary:
+ *    Unsets any currently set soft breaks in a range of text.
+ *  
+ *  Discussion:
+ *    This function clears all previously set soft line breaks for the
+ *    specified text range and clears any associated layout caches as
+ *    well.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout object for which to remove line breaks.
+ *    
+ *    iRangeStart:
+ *      The beginning of the text range over which to clear soft line
+ *      breaks. To indicate that the specified text range starts at the
+ *      beginning of the text buffer, you can pass the constant
+ *      kATSUFromTextBeginning . To specify the entire text buffer,
+ *      pass kATSUFromTextBeginning in this parameter and
+ *      kATSUToTextEnd in the iRangeLength parameter.
+ *    
+ *    iRangeLength:
+ *      The length of the text range over which to clear soft line
+ *      breaks. If you want the range of text to extend to the end of
+ *      the text buffer, you can pass the constant kATSUToTextEnd.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearSoftLineBreaks( iTextLayout: ATSUTextLayout; iRangeStart: UniCharArrayOffset; iRangeLength: UniCharCount ): OSStatus; external name '_ATSUClearSoftLineBreaks';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI highlighting                                                          }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUSetHighlightingMethod()
+ *  
+ *  Summary:
+ *    Specifies the methods ATSUI will use for highlighting and
+ *    unhighlighting text in a given layout.
+ *  
+ *  Discussion:
+ *    By default, ATSUI highlights text by "inverting" the region
+ *    containing the text, that is, its background color. Although
+ *    inversion provides satisfactory highlighting in most cases, it
+ *    does not always provide the best result for grayscale text. (Mac
+ *    OS X sets a lower threshold for antialiasing, while in Mac OS 9
+ *    grayscale text can be turned off by the user.) In Mac OS X, when
+ *    using a Quartz graphics context, you can instruct ATSUI to use
+ *    the redraw method of highlighting, rather than simple inversion.
+ *    (Note that Cocoa applications always use the redraw method of
+ *    highlighting.) The redraw method allows for accurate highlighting
+ *    of more complex backgrounds, such as those containing multiple
+ *    colors, patterns, or pictures. To set redrawing on, call the
+ *    ATSUSetHighlightingMethod function and specify that the redraw
+ *    method be used (by passing kRedrawHighlighting in the iMethod
+ *    parameter). If you specify the redraw method of highlighting when
+ *    you call ATSUSetHighlightingMethod, then you must also specify
+ *    how the background is to be redrawn when the function
+ *    ATSUUnhighlightText is called. ATSUI can restore the desired
+ *    background in one of two ways, depending on the background's
+ *    complexity: (1) When the background is a single color (such as
+ *    white), ATSUI can readily unhighlight the background. In such a
+ *    case, you specify the background color that ATSUI uses by calling
+ *    ATSUSetHighlightingMethod and setting iUnhighlightData.dataType
+ *    to kATSUBackgroundColor and providing the background color in
+ *    iUnhighlightData.unhighlightData. With these settings defined,
+ *    when you call ATSUUnhighlightText, ATSUI simply calculates the
+ *    previously highlighted area, repaints it with the specified
+ *    background color, and then redraws the text. (2) When the
+ *    background is more complex (containing, for example, multiple
+ *    colors, patterns, or pictures), you must provide a redraw
+ *    background callback function when you call
+ *    ATSUSetHighlightingMethod. You do this by setting
+ *    iUnhighlightData.dataType to kATSUBackgroundCallback and
+ *    providing a RedrawBackgroundUPP in
+ *    iUnhighlightData.unhighlightData . Then when you call
+ *    ATSUUnhighlightText and ATSUI calls your callback, you are
+ *    responsible for redrawing the background of the unhighlighted
+ *    area. If you choose to also redraw the text, then your callback
+ *    should return false as a function result. If your callback
+ *    returns true ATSUI redraws any text that needs to be redrawn. See
+ *    RedrawBackgroundProcPtr for additional information. 
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout to which this highlight method should be applied.
+ *    
+ *    iMethod:
+ *      The type of highlighting to use; inversion
+ *      (kInvertHighlighting) or redrawing (kRedrawHighlighting). The
+ *      default is inversion. If you are happy with that technique
+ *      there is no reason to call this function.
+ *    
+ *    iUnhighlightData:
+ *      Data needed to redraw the background or NULL if inversion is
+ *      being chosen. See the definition of ATSUUnhighlightData for
+ *      more information about the possible contents of this structure.
+ *      Also see the Discussion for this function. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetHighlightingMethod( iTextLayout: ATSUTextLayout; iMethod: ATSUHighlightMethod; iUnhighlightData: ATSUUnhighlightDataPtr ): OSStatus; external name '_ATSUSetHighlightingMethod';
+
+
+{
+ *  ATSUHighlightText()
+ *  
+ *  Summary:
+ *    Renders a highlighted range of text at a specified location in a
+ *    QuickDraw graphics port or Quartz graphics context.
+ *  
+ *  Discussion:
+ *    When the user selects a series of glyphs, the characters in
+ *    memory corresponding to the glyphs make up the selection range
+ *    and should be highlighted to indicate where the next editing
+ *    operation is to occur. The characters in a selection range are
+ *    always contiguous in memory, but their corresponding glyphs are
+ *    not necessarily so onscreen. If the selection range crosses a
+ *    direction boundary, it is appropriate to display discontinuous
+ *    highlighting. The ATSUHighlightText function renders a
+ *    highlighted range of text at a specified location in a QuickDraw
+ *    graphics port or Quartz graphics context, using the highlight
+ *    information in the graphics port or context. ATSUHighlightText
+ *    automatically produces discontinuous highlighting, if needed. You
+ *    typically call the ATSUHighlightText function every time you need
+ *    to draw or redraw highlighted text.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout containing text to be highlighted.
+ *    
+ *    iTextBasePointX:
+ *      The x-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iTextBasePointY:
+ *      The y-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iHighlightStart:
+ *      The first character of the text range to be highlighted. If the
+ *      text range spans multiple lines, you should call
+ *      ATSUHighlightText for each line, passing the offset
+ *      corresponding to the beginning of the new line to draw with
+ *      each call. To indicate that the specified text range starts at
+ *      the beginning of the text buffer, you can pass the constant
+ *      kATSUFromTextBeginning. To specify the entire text buffer, pass
+ *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
+ *      the iHighlightLength parameter.
+ *    
+ *    iHighlightLength:
+ *      The length of the text range to be highlighted. To indicate
+ *      that the text range extends to the end of the text buffer, pass
+ *      the constant kATSUToTextEnd.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUHighlightText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUHighlightText';
+
+
+{
+ *  ATSUUnhighlightText()
+ *  
+ *  Summary:
+ *    Renders a previously highlighted range of text in an
+ *    unhighlighted state.
+ *  
+ *  Discussion:
+ *    This function renders a previously highlighted range of text in
+ *    an unhighlighted state. You should always call
+ *    ATSUUnhighlightText after calling the function ATSUHighlightText
+ *    to properly redraw the unhighlighted text and background. If the
+ *    inversion method of highlighting was used, when you call
+ *    ATSUUnhighlightText, it merely undoes the inversion and renders
+ *    the text. If the redraw method of highlighting was used,
+ *    ATSUUnhighlightText turns off the highlighting and restores the
+ *    desired background. Depending on the complexity of the
+ *    background, ATSUI restores the background in one of two ways:
+ *    filling in a solid color, or repainting the background using a
+ *    callback. See the function ATSUSetHighlightingMethod and the
+ *    definition ATSUUnhighlightData for more information.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout containing text to be unhighlighted.
+ *    
+ *    iTextBasePointX:
+ *      The x-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iTextBasePointY:
+ *      The y-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iHighlightStart:
+ *      The first character of the text range to be unhighlighted. If
+ *      the text range spans multiple lines, you should call
+ *      ATSUUnhighlightText for each line, passing the offset
+ *      corresponding to the beginning of the new line to draw with
+ *      each call. To indicate that the specified text range starts at
+ *      the beginning of the text buffer, you can pass the constant
+ *      kATSUFromTextBeginning. To specify the entire text buffer, pass
+ *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
+ *      the iHighlightLength parameter.
+ *    
+ *    iHighlightLength:
+ *      The length of the text range to be unhighlighted. To indicate
+ *      that the text range extends to the end of the text buffer, pass
+ *      the constant kATSUToTextEnd.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUUnhighlightText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUUnhighlightText';
+
+
+{
+ *  ATSUGetTextHighlight()
+ *  
+ *  Summary:
+ *    Obtains the highlight region for a range of text.
+ *  
+ *  Discussion:
+ *    Use this function to obtain the screen region that ATSUI would
+ *    normally highlight automatically when ATSUHighlightText is
+ *    called. This is useful if you wish to perform your own
+ *    highlighting.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout containing text to be highlighted.
+ *    
+ *    iTextBasePointX:
+ *      The x-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iTextBasePointY:
+ *      The y-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iHighlightStart:
+ *      The first character of the text range to be highlighted. If the
+ *      text range spans multiple lines, you should call
+ *      ATSUGetTextHighlight for each line, passing the offset
+ *      corresponding to the beginning of the new line to draw with
+ *      each call. To indicate that the specified text range starts at
+ *      the beginning of the text buffer, you can pass the constant
+ *      kATSUFromTextBeginning. To specify the entire text buffer, pass
+ *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
+ *      the iHighlightLength parameter.
+ *    
+ *    iHighlightLength:
+ *      The length of the text range to be highlighted. To indicate
+ *      that the text range extends to the end of the text buffer, pass
+ *      the constant kATSUToTextEnd.
+ *    
+ *    oHighlightRegion:
+ *      On return, ATSUGetTextHighlight produces a MacRegion structure
+ *      containing the highlight region for the specified range of
+ *      text. In the case of discontinuous highlighting, the region
+ *      consists of multiple components, with MacRegion.rgnBBox
+ *      specifying the bounding box around the entire area of
+ *      discontinuous highlighting.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetTextHighlight( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount; oHighlightRegion: RgnHandle ): OSStatus; external name '_ATSUGetTextHighlight';
+
+
+{
+ *  ATSUHighlightInactiveText()
+ *  
+ *  Summary:
+ *    Highlights text using the standard Mac OS X UI convention for an
+ *    inactive window or UI pane.
+ *  
+ *  Discussion:
+ *    Use this function to redraw text when a window or UI pane
+ *    containing highlighted text becomes inactive. Once the window or
+ *    UI pane becomes active again, call ATSUHighlightText to
+ *    rehighlight the text in active mode.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout containing text to be highlighted.
+ *    
+ *    iTextBasePointX:
+ *      The x-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iTextBasePointY:
+ *      The y-coordinate of the origin (in either the current graphics
+ *      port or in a Quartz graphics context) of the line containing
+ *      the text range. Pass the constant kATSUUseGrafPortPenLoc to
+ *      draw relative to the current pen location in the current
+ *      graphics port.
+ *    
+ *    iHighlightStart:
+ *      The first character of the text range to be highlighted. If the
+ *      text range spans multiple lines, you should call
+ *      ATSUHighlightInactiveText for each line, passing the offset
+ *      corresponding to the beginning of the new line to draw with
+ *      each call. To indicate that the specified text range starts at
+ *      the beginning of the text buffer, you can pass the constant
+ *      kATSUFromTextBeginning. To specify the entire text buffer, pass
+ *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
+ *      the iHighlightLength parameter.
+ *    
+ *    iHighlightLength:
+ *      The length of the text range to be highlighted. To indicate
+ *      that the text range extends to the end of the text buffer, pass
+ *      the constant kATSUToTextEnd.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUHighlightInactiveText( iTextLayout: ATSUTextLayout; iTextBasePointX: ATSUTextMeasurement; iTextBasePointY: ATSUTextMeasurement; iHighlightStart: UniCharArrayOffset; iHighlightLength: UniCharCount ): OSStatus; external name '_ATSUHighlightInactiveText';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI hit-testing                                                           }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUPositionToOffset()
+ *  
+ *  Summary:
+ *    Obtains the memory offset for the glyph edge nearest a mouse-down
+ *    event.
+ *  
+ *  Discussion:
+ *    The process of hit-testing text obtains the location of a
+ *    mouse-down event relative both to the position of onscreen glyphs
+ *    and to the corresponding offset between character codes in
+ *    memory. You can then use the location information obtained by
+ *    hit-testing to set the insertion point (that is, the caret) or
+ *    selection range (for highlighting). Hit-testing text is
+ *    complicated by the fact that a given line of text may be
+ *    bidirectional. Therefore, the onscreen order of glyphs may not
+ *    readily correspond to the storage order of the corresponding
+ *    character codes. And the concept of which glyph comes "first" in
+ *    a line of text cannot always be limited to the visual terms
+ *    "left" and "right." Because of these complexities, it is more
+ *    accurate to speak in terms of "leading" and "trailing" edges to
+ *    glyphs. A "leading edge" is defined as the edge of a glyph that
+ *    you first encounter when you read the text that includes that
+ *    glyph. For example, when reading Roman text, you first encounter
+ *    the left edge of a Roman glyph. Similarly, the "trailing edge" is
+ *    defined as the edge of the glyph encountered last. This function
+ *    produces the memory offset corresponding to the glyph edge
+ *    nearest the event. If the mouse-down event occurs at a line
+ *    direction boundary or within a glyph cluster,
+ *    ATSUPositionToOffset produces two offsets. You can then provide
+ *    the offset(s) to the ATSUOffsetToPosition function to obtain the
+ *    actual caret position(s) for the event. When you call the
+ *    ATSUPositionToOffset function, ATSUI examines the Unicode
+ *    directionality of the character corresponding to the event
+ *    location. The ATSUPositionToOffset function produces a value of
+ *    true in the oIsLeading parameter if the offset is leading (that
+ *    is, more closely associated with the subsequent character in
+ *    memory and therefore indicative of a left-to-right line
+ *    direction). It produces a value of false if the offset is
+ *    trailing (that is, more closely associated with the preceding
+ *    character in memory and indicative of a right-to-left line
+ *    direction). Finally, note that when the event occurs beyond the
+ *    leftmost or rightmost caret positions of the line (not taking
+ *    into account line rotation), such that no glyph corresponds to
+ *    the location of the hit, the ATSUPositionToOffset function
+ *    produces the primary offset of the closest edge of the line to
+ *    the input location. The oIsLeading flag depends on the
+ *    directionality of the closest glyph and the side of the line to
+ *    which the input location is closest. In this case, the secondary
+ *    offset is equal to the primary offset, since no glyph was hit.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout object in which the mouse-down event occurred.
+ *    
+ *    iLocationX:
+ *      The x-coordinate of the event, in local coordinates, relative
+ *      to the origin of the line where the event occurred. That is, to
+ *      specify the x-coordinate value, you should subtract the
+ *      x-coordinate of the line origin from the x-coordinate of the
+ *      hit point (in local coordinates). You can pass the constant
+ *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
+ *      relative to the current pen location in the current graphics
+ *      port.
+ *    
+ *    iLocationY:
+ *      The y-coordinate of the event, in local coordinates, relative
+ *      to the origin of the line where the event occurred. That is, to
+ *      specify the y-coordinate value, you should subtract the
+ *      y-coordinate of the line origin from the y-coordinate of the
+ *      hit point (in local coordinates). You can pass the constant
+ *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
+ *      relative to the current pen location in the current graphics
+ *      port.
+ *    
+ *    ioPrimaryOffset:
+ *      On input, a pointer to a UniCharArrayOffset value specifying
+ *      the offset corresponding to the beginning of the line where the
+ *      event occurred. On return, the value specifies the offset
+ *      corresponding to the glyph edge that is visually closest to the
+ *      event. To determine whether this offset indicates the leading
+ *      or trailing edge of the glyph, you can examine the value
+ *      produced in the oIsLeading parameter.
+ *    
+ *    oIsLeading:
+ *      On return, the value indicates whether the offset produced in
+ *      the ioPrimaryOffset parameter is leading or trailing. The
+ *      function ATSUPositionToOffset produces a value of true if the
+ *      offset is leading (that is, more closely associated with the
+ *      subsequent character in memory). It produces a value of false
+ *      if the offset is trailing (that is, more closely associated
+ *      with the preceding character in memory).
+ *    
+ *    oSecondaryOffset:
+ *      On return, the value typically specifies the same offset as
+ *      that produced in the ioPrimaryOffset parameter, unless the
+ *      event occurred within a glyph cluster or at a line direction
+ *      boundary. If so, the value specifies a secondary offset. The
+ *      secondary offset is associated with the glyph that has a
+ *      different direction from the primary line direction.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUPositionToOffset( iTextLayout: ATSUTextLayout; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; var ioPrimaryOffset: UniCharArrayOffset; var oIsLeading: Boolean; var oSecondaryOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPositionToOffset';
+
+
+{
+ *  ATSUOffsetToPosition()
+ *  
+ *  Summary:
+ *    Obtains the caret position(s) corresponding to a memory offset.
+ *  
+ *  Discussion:
+ *    This function produces two structures of type ATSUCaret. These
+ *    structures contain the pen positioning information needed to draw
+ *    the caret(s) for the event, specified relative to the origin of
+ *    the line in the current graphics port or graphics context.
+ *    Specifically, the ATSUCaret structures contain x-y coordinates
+ *    for both the caret's starting and ending pen positions (the
+ *    latter taking into account line rotation, caret slanting, and
+ *    split-caret appearances). If the offset you pass to
+ *    ATSUOffsetToPosition is at a line boundary, the structure
+ *    produced in the oMainCaret parameter contains the starting and
+ *    ending pen locations for the high caret, while the oSecondCaret
+ *    parameter contains the corresponding values for the low caret. If
+ *    the offset is not at a line boundary, both parameters contain the
+ *    starting and ending pen locations of the main caret. Because you
+ *    provide the ATSUOffsetToPosition function an offset relative to
+ *    the origin of the line where the hit occurred,
+ *    ATSUOffsetToPosition produces positioning information that is
+ *    also relative. Therefore, you must transform the positions
+ *    produced by the ATSUOffsetToPosition function before drawing the
+ *    caret(s). To transform the caret location(s), add the starting
+ *    and ending caret coordinates to the coordinates of the origin of
+ *    the line in which the hit occurred. For example, if
+ *    ATSUOffsetToPosition produces starting and ending pen locations
+ *    of (25,0), (25,25) in the oMainCaret parameter (and the
+ *    oSecondCaret parameter contains the same coordinates, meaning
+ *    that the caret was not split), you would add these to the
+ *    position of the origin of the line in the graphics port or
+ *    context. If the position of the line origin was at (50,50), then
+ *    the starting and ending pen locations of the caret would be
+ *    (75,50), (75,75).
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout containing the offset.
+ *    
+ *    iOffset:
+ *      The offset into the text buffer for which you wish to obtain a
+ *      caret position. To respond to a mouse-down event, pass the
+ *      offset returned in the ioPrimaryOffset parameter from the
+ *      function ATSUPositionToOffset. That is, the offset
+ *      corresponding to the glyph edge closest to the event.
+ *    
+ *    iIsLeading:
+ *      A Boolean value indicating whether the offset corresponds to
+ *      the leading or trailing edge of the glyph. You can obtain this
+ *      information from the function ATSUPositionToOffset. This value
+ *      is relevant if the offset occurs at a line direction boundary
+ *      or within a glyph cluster.
+ *    
+ *    oMainCaret:
+ *      On return, contains the starting and ending pen locations of
+ *      the high caret if the value produced in oCaretIsSplit is true.
+ *      If the value is false, the structure contains the starting and
+ *      ending pen locations of the main caret.
+ *    
+ *    oSecondCaret:
+ *      On return, contains the starting and ending pen locations of
+ *      the low caret if the value passed back in the oCaretIsSplit
+ *      parameter is true. If the value is false, the structure
+ *      contains the starting and ending pen locations of the main
+ *      caret (that is, the same values as the oMainCaret parameter).
+ *    
+ *    oCaretIsSplit:
+ *      On return, indicates whether the offset specified in the
+ *      iOffset parameter occurs at a line direction boundary. If true,
+ *      the offset occurs at a line direction boundary; otherwise,
+ *      false.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUOffsetToPosition( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iIsLeading: Boolean; var oMainCaret: ATSUCaret; var oSecondCaret: ATSUCaret; var oCaretIsSplit: Boolean ): OSStatus; external name '_ATSUOffsetToPosition';
+
+
+{
+ *  ATSUPositionToCursorOffset()
+ *  
+ *  Summary:
+ *    Obtains the memory offset for the glyph edge nearest a mouse-down
+ *    event, after a move of the specified length.
+ *  
+ *  Discussion:
+ *    This function produces the memory offset for the glyph edge
+ *    nearest a mouse-down event, after a move of the specified length.
+ *    This offset corresponds to where an insertion point would be
+ *    placed after the move.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which the mouse down event occured.
+ *    
+ *    iLocationX:
+ *      The x-coordinate of the event, in local coordinates, relative
+ *      to the origin of the line where the event occurred. That is, to
+ *      specify the x-coordinate value, you should subtract the
+ *      x-coordinate of the line origin from the x-coordinate of the
+ *      hit point (in local coordinates). You can pass the constant
+ *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
+ *      relative to the current pen location in the current graphics
+ *      port.
+ *    
+ *    iLocationY:
+ *      The y-coordinate of the event, in local coordinates, relative
+ *      to the origin of the line where the event occurred. That is, to
+ *      specify the y-coordinate value, you should subtract the
+ *      y-coordinate of the line origin from the y-coordinate of the
+ *      hit point (in local coordinates). You can pass the constant
+ *      kATSUUseGrafPortPenLoc for the location of the mouse-down event
+ *      relative to the current pen location in the current graphics
+ *      port.
+ *    
+ *    iMovementType:
+ *      A constant specifying the type of cursor movement to use. See
+ *      the definition of ATSUCursorMovementType for possible values to
+ *      pass for this parameter.
+ *    
+ *    ioPrimaryOffset:
+ *      On input, the offset corresponding to the beginning of the line
+ *      where the event occurred. On return, the offset corresponding
+ *      to the glyph edge nearest the event, after a movement of the
+ *      specified type. This offset corresponds to where the insertion
+ *      point would be placed after the move. To determine whether this
+ *      offset indicates the leading or trailing edge of the glyph, you
+ *      can examine the value produced in the oIsLeading parameter.
+ *    
+ *    oIsLeading:
+ *      On return, the value indicates whether the offset produced in
+ *      the ioPrimaryOffset parameter is leading or trailing. The
+ *      ATSUPositionToOffset function produces a value of true if the
+ *      offset is leading (that is, more closely associated with the
+ *      subsequent character in memory). It produces a value of false
+ *      if the offset is trailing (that is, more closely associated
+ *      with the preceding character in memory).
+ *    
+ *    oSecondaryOffset:
+ *      On return, the value typically specifies the same offset as
+ *      that produced in the ioPrimaryOffset parameter, unless the
+ *      event occurred within a glyph cluster or at a line direction
+ *      boundary. If so, the value specifies the secondary offset, for
+ *      the glyph edge furthest from the event.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.5 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.2.2 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUPositionToCursorOffset( iTextLayout: ATSUTextLayout; iLocationX: ATSUTextMeasurement; iLocationY: ATSUTextMeasurement; iMovementType: ATSUCursorMovementType; var ioPrimaryOffset: UniCharArrayOffset; var oIsLeading: Boolean; var oSecondaryOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPositionToCursorOffset';
+
+
+{
+ *  ATSUOffsetToCursorPosition()
+ *  
+ *  Summary:
+ *    Obtains the caret position(s) corresponding to a memory offset,
+ *    after a move of the specified length.
+ *  
+ *  Discussion:
+ *    Use this function in conjunction with ATSUPositionToCursorOffset
+ *    to determine where to draw the caret after a mouse-down event.
+ *    The movement type parameter allows you to have the cursor "snap"
+ *    to different parts of the text depending on the type of movement
+ *    selected (i.e., words or characters). See the definition of
+ *    ATSUCursorMovementType for more information on possible values.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout object in which the mouse-down event occurred.
+ *    
+ *    iOffset:
+ *      The offset corresponding to the glyph edge nearest the event,
+ *      after a movement of the specified type. You can obtain this
+ *      value by examining the offset produced in the ioPrimaryOffset
+ *      parameter of the function ATSUPositionToCursorOffset.
+ *    
+ *    iIsLeading:
+ *      A Boolean value indicating whether the specified offset
+ *      corresponds to the leading or trailing edge of the glyph. You
+ *      can obtain this information from the function
+ *      ATSUPositionToCursorOffset . This value is relevant if the
+ *      offset occurs at a line direction boundary or within a glyph
+ *      cluster.
+ *    
+ *    iMovementType:
+ *      A constant specifying the unit of cursor movement. See the
+ *      definition of ATSUCursorMovementType for possible values to
+ *      pass for this parameter.
+ *    
+ *    oMainCaret:
+ *      On return, the structure contains the starting and ending pen
+ *      locations of the high caret if the value produced in the
+ *      oCaretIsSplit parameter is true. If the value is false, the
+ *      structure contains the starting and ending pen locations of the
+ *      main caret.
+ *    
+ *    oSecondCaret:
+ *      On return, the structure contains the starting and ending pen
+ *      locations of the low caret if the value passed back in the
+ *      oCaretIsSplit parameter is true. If the value is false, the
+ *      structure contains the starting and ending pen locations of the
+ *      main caret (that is, the same values as the oMainCaret
+ *      parameter).
+ *    
+ *    oCaretIsSplit:
+ *      On return, the value indicates whether the offset specified in
+ *      the iOffset parameter occurs at a line direction boundary. If
+ *      true, the offset occurs at a line direction boundary;
+ *      otherwise, false.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.5 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.2.2 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUOffsetToCursorPosition( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iIsLeading: Boolean; iMovementType: ATSUCursorMovementType; var oMainCaret: ATSUCaret; var oSecondCaret: ATSUCaret; var oCaretIsSplit: Boolean ): OSStatus; external name '_ATSUOffsetToCursorPosition';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI cursor movement                                                       }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUNextCursorPosition()
+ *  
+ *  Summary:
+ *    Obtains the memory offset for the insertion point that follows
+ *    the current insertion point in storage order, as determined by a
+ *    move of the specified length and type.
+ *  
+ *  Discussion:
+ *    Together with ATSUPreviousCursorPosition, this function allows an
+ *    application to "walk" the text buffer in storage order, moving
+ *    the cursor by a specified amount and movement type at each step.
+ *    To move through the text buffer in screen order, use the
+ *    functions ATSURightwardCursorPosition and
+ *    ATSULeftwardCursorPosition.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which to perform the cursor movement.
+ *    
+ *    iOldOffset:
+ *      The previous cursor position.
+ *    
+ *    iMovementType:
+ *      A constant specifying the unit of cursor movement. See the
+ *      definition of ATSUCursorMovementType for possible values to
+ *      pass for this parameter.
+ *    
+ *    oNewOffset:
+ *      On return, the new cursor position.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUNextCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUNextCursorPosition';
+
+
+{
+ *  ATSUPreviousCursorPosition()
+ *  
+ *  Summary:
+ *    Obtains the memory offset for the insertion point that preceeds
+ *    the current insertion point in storage order, as determined by a
+ *    move of the specified length and type.
+ *  
+ *  Discussion:
+ *    Together with ATSUNextCursorPosition, this function allows an
+ *    application to "walk" the text buffer in storage order, moving
+ *    the cursor by a specified amount and movement type at each step.
+ *    To move through the text buffer in screen order, use the
+ *    functions ATSURightwardCursorPosition and
+ *    ATSULeftwardCursorPosition.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which to perform the cursor movement.
+ *    
+ *    iOldOffset:
+ *      The previous cursor position.
+ *    
+ *    iMovementType:
+ *      A constant specifying the unit of cursor movement. See the
+ *      definition of ATSUCursorMovementType for possible values to
+ *      pass for this parameter.
+ *    
+ *    oNewOffset:
+ *      On return, the new cursor position.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUPreviousCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSUPreviousCursorPosition';
+
+
+{
+ *  ATSURightwardCursorPosition()
+ *  
+ *  Summary:
+ *    Obtains the memory offset for the insertion point that is to the
+ *    right of the current insertion point, as determined by a move of
+ *    the specified length and type.
+ *  
+ *  Discussion:
+ *    Together with ATSULeftwardCursorPosition, this function allows an
+ *    application to "walk" the text buffer in screen order, moving the
+ *    cursor by a specified amount and movement type at each step. To
+ *    move through the text buffer in storage order, use the functions
+ *    ATSUNextCursorPosition and ATSUPreviousCursorPosition. Note that
+ *    if you are drawing the cursor after a cursor move, you should use
+ *    ATSUOffsetToPosition to obtain an ATSUCaret that determines the
+ *    on screen location of the new cursor position. Always store the
+ *    ATSUCaret from the previous cursor position as well, as this can
+ *    help determine which caret to use in the case of a split caret.
+ *    When performing leftward and rightward cursor movement, always
+ *    use the caret closest to the previous caret. This maintains
+ *    visual order when moving the cursor on screen.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which to perform the cursor movement.
+ *    
+ *    iOldOffset:
+ *      The previous cursor position.
+ *    
+ *    iMovementType:
+ *      A constant specifying the unit of cursor movement. See the
+ *      definition of ATSUCursorMovementType for possible values to
+ *      pass for this parameter.
+ *    
+ *    oNewOffset:
+ *      On return, the new cursor position.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSURightwardCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSURightwardCursorPosition';
+
+
+{
+ *  ATSULeftwardCursorPosition()
+ *  
+ *  Summary:
+ *    Obtains the memory offset for the insertion point that is to the
+ *    left of the current insertion point, as determined by a move of
+ *    the specified length and type.
+ *  
+ *  Discussion:
+ *    Together with ATSURightwardCursorPosition, this function allows
+ *    an application to "walk" the text buffer in screen order, moving
+ *    the cursor by a specified amount and movement type at each step.
+ *    To move through the text buffer in storage order, use the
+ *    functions ATSUNextCursorPosition and ATSUPreviousCursorPosition.
+ *    Note that if you are drawing the cursor after a cursor move, you
+ *    should use ATSUOffsetToPosition to obtain an ATSUCaret that
+ *    determines the on screen location of the new cursor position.
+ *    Always store the ATSUCaret from the previous cursor position as
+ *    well, as this can help determine which caret to use in the case
+ *    of a split caret. When performing leftward and rightward cursor
+ *    movement, always use the caret closest to the previous caret.
+ *    This maintains visual order when moving the cursor on screen.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which to perform the cursor movement.
+ *    
+ *    iOldOffset:
+ *      The previous cursor position.
+ *    
+ *    iMovementType:
+ *      A constant specifying the unit of cursor movement. See the
+ *      definition of ATSUCursorMovementType for possible values to
+ *      pass for this parameter.
+ *    
+ *    oNewOffset:
+ *      On return, the new cursor position.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSULeftwardCursorPosition( iTextLayout: ATSUTextLayout; iOldOffset: UniCharArrayOffset; iMovementType: ATSUCursorMovementType; var oNewOffset: UniCharArrayOffset ): OSStatus; external name '_ATSULeftwardCursorPosition';
+
+
+{ Functions listed beyond this point are either deprecated or not recommended }
+
+{
+ *  ATSUMeasureText()
+ *  
+ *  Discussion:
+ *    This function is no longer recommended. Please use
+ *    ATSUGetUnjustifiedBounds instead.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUMeasureText( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; var oTextBefore: ATSUTextMeasurement; var oTextAfter: ATSUTextMeasurement; var oAscent: ATSUTextMeasurement; var oDescent: ATSUTextMeasurement ): OSStatus; external name '_ATSUMeasureText';
+
+end.

+ 821 - 0
packages/extra/univint/ATSUnicodeFlattening.pas

@@ -0,0 +1,821 @@
+{
+     File:       QD/ATSUnicodeFlattening.h
+ 
+     Contains:   Public interfaces for Apple Type Services for Unicode Imaging
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2002-2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeFlattening;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ATSUnicodeTypes,SFNTTypes;
+{$ALIGN MAC68K}
+
+{ ---------------------------------------------------------------------------- }
+{ Constants                                                                    }
+{ ---------------------------------------------------------------------------- }
+{
+   ATSUFlattenedDataStreamFormat is used to inform the APIs which flatten and
+   unflatten style runs exactly what type of data that they should be generating
+   or parsing.
+}
+
+type ATSUFlattenedDataStreamFormat = UInt32;
+const
+  kATSUDataStreamUnicodeStyledText = $7573746C (* 'ustl' *);
+
+
+{
+   ATSUFlattenStyleRunOptions is a bitfield list of options that can be passed
+   into the ATSUFlattenStyleRunsToStream API. Currently, there are no options. 
+   This is here for future expansion.
+}
+type ATSUFlattenStyleRunOptions = UInt32;
+const
+  kATSUFlattenOptionNoOptionsMask = $00000000;
+
+{
+   ATSUUnFlattenStyleRunOptions is a bitfield list of options that can be passed
+   into the ATSUUnFlattenStyleRunsToStream API. Currently, there are no options. 
+   This is here for future expansion.
+}
+type ATSUUnFlattenStyleRunOptions = UInt32;
+const
+  kATSUUnFlattenOptionNoOptionsMask = $00000000;
+
+
+{ ---------------------------------------------------------------------------- }
+{ Data Types                                                                   }
+{ ---------------------------------------------------------------------------- }
+
+{
+   ATSUStyleRunInfo is a structure that contrains an index into an array of 
+   unique ATSUStyle objects as well as the length of the run that the style run 
+   object covers. This structure is utilized by ATSUUnflattenStyleRunsFromStream() 
+   to return the style run info to the caller. 
+}
+type
+	ATSUStyleRunInfo = record
+		runLength: UniCharCount;
+		styleObjectIndex: ItemCount;
+	end;
+	ATSUStyleRunInfoPtr = ^ATSUStyleRunInfo;
+{ ---------------------------------------------------------------------------- }
+{ 'ustl' structure data structures and definitions                             }
+{ ---------------------------------------------------------------------------- }
+{
+   The 'ustl' data structure follows this format:
+   1. Main Data Structure Block Header
+   2. Flattened Text Layout Data
+   3. Flattened Style Run Data
+   4. Flattened Style Data
+   Per the 'ustl' spec, these structures should maintain four-byte alignment. 
+   For things that are variable width (such as font names), padding bytes must
+   be added to ensure that this alignment is always kept.
+}
+
+{
+   structure versioning - the version of the 'ustl' that the ATSUI parsing
+   and generating functions will handle is version 2 or greater. Earlier
+   versions were not completly specified and have been obsoleted.
+}
+const
+  kATSFlatDataUstlVersion0      = 0;
+  kATSFlatDataUstlVersion1      = 1;
+  kATSFlatDataUstlVersion2      = 2;
+  kATSFlatDataUstlCurrentVersion = kATSFlatDataUstlVersion2;
+
+{ ------------------ }
+{ Block 1 Structures }
+{ ------------------ }
+
+{
+   This is the main data structure block header. It describes the rest
+   of the data and how it is structured.
+}
+type
+	ATSFlatDataMainHeaderBlock = record
+
+                                              { the 'ustl' version number. This needs to be the first item in the}
+                                              { data block do as not to confuse parsers of earlier (and possibly}
+                                              { later) versions of the spec *|}
+		version: UInt32;
+
+                                              { the total size of the stream in bytes, including the four bytes in}
+                                              { the version above}
+		sizeOfDataBlock: ByteCount;
+
+                                              { offset from the beginning of the stream to the flattened text layout data.}
+                                              { This can be set to 0 if there are no text layouts stored in the stream.}
+		offsetToTextLayouts: ByteCount;
+
+                                              { offset from the beginning of the stream to the flattened style run data. }
+                                              { This can be set to 0 if there is no flattened style run data in the stream}
+		offsetToStyleRuns: ByteCount;
+
+                                              { offset to the flattened style list data. This can be set to 0 if there}
+                                              { is no flattened style list data}
+		offsetToStyleList: ByteCount;
+	end;
+	ATSFlatDataMainHeaderBlockPtr = ^ATSFlatDataMainHeaderBlock;
+{ ------------------ }
+{ Block 2 Structures }
+{ ------------------ }
+{
+   The Block 2 Structures are not currently used by any of ATSUI's internal parsing
+   or packing routines. They are, however, part of the 'ustl' standard and are put
+   here for developer conveniance, as well as to properly define the standard.
+}
+
+{
+   This is the header that is attached to each flattened text layout. The
+   number of flattened text layouts in the stucture is specified by the
+   ATSFlatDataTextLayoutHeader structure that is below.
+}
+type
+	ATSFlatDataTextLayoutDataHeader = record
+
+                                              { the total size of this particular flattened text layout, including any}
+                                              { padding bytes and such. }
+		sizeOfLayoutData: ByteCount;
+
+                                              { the number of characters covered by this flattened text layout}
+		textLayoutLength: ByteCount;
+
+                                              { the byte offset relative to the start of this structure to the flattened}
+                                              { layout control data. This can be set to zero if there are no layout}
+                                              { controls.}
+		offsetToLayoutControls: ByteCount;
+
+                                              { the byte offset, relative to the start of this structure to the}
+                                              { flattened line info. This can be set to zero if there is no line info }
+                                              { in this layout.}
+		offsetToLineInfo: ByteCount;
+
+                                              { if the offsetToLayoutControls is non-zero, then following this block}
+                                              { there will be a ATSFlattenedLayoutDataFlattenedLayoutControlsHeader}
+                                              { followed by an array of ATSFlattenedLayoutDataFlattenedLayoutControls}
+                                              { structures. If the offsetToLineInfo is non-zero, then following the}
+                                              { flattened layout controls will be a ATSFlatDataLineInfoHeader}
+                                              { structure.}
+	end;
+	ATSFlatDataTextLayoutDataHeaderPtr = ^ATSFlatDataTextLayoutDataHeader;
+{
+   This is the the main header for block 2. If there is a block 2, then there
+   needs to be one of these. This structure is what the offsetToTextLayouts
+   points to in block 1.
+}
+type
+	ATSFlatDataTextLayoutHeader = record
+
+                                              { the total number of flattened text layouts stored in this block.}
+                                              { This must be non-zero, as if there were no flattened text layouts, the}
+                                              { entire block 2 would not exist}
+		numFlattenedTextLayouts: ItemCount;
+
+                                              { first of possibly many flattened text layouts. There should be one of}
+                                              { these for each flattened text layout as determined by the}
+                                              { numFlattenedTextLayouts above. }
+		flattenedTextLayouts: array[0..0] of ATSFlatDataTextLayoutDataHeader;
+	end;
+	ATSFlatDataTextLayoutHeaderPtr = ^ATSFlatDataTextLayoutHeader;
+{
+   This is the header for the flattened layout controls structure. This is
+   the structure that a non-zero offsetToLayoutControls points to in the
+   ATSFlatDataTextLayoutDataHeader
+}
+type
+	ATSFlatDataLayoutControlsDataHeader = record
+
+                                              { the number of flattened layout controls. It is suggested that there be}
+                                              { at least one layout control to output the line direction for the layout}
+		numberOfLayoutControls: ItemCount;
+
+                                              { first of possibly many flattened layout controls. There should be one }
+                                              { of these for each layout control as determined by the}
+                                              { numberOfLayoutControls above. Of course, if there are no layout controls,}
+                                              { then this structure shouldn't even exist. Each attribute info structure}
+                                              { in the array could be followed by additional padding bytes in order}
+                                              { to maintain four-byte alignment. These padding bytes are not to be}
+                                              { included in the fValueSize member of each structure. }
+		controlArray: array[0..0] of ATSUAttributeInfo;
+	end;
+	ATSFlatDataLayoutControlsDataHeaderPtr = ^ATSFlatDataLayoutControlsDataHeader;
+type
+	ATSFlatDataLineInfoData = record
+
+                                              { the length of this particular line in UniChars}
+		lineLength: UniCharCount;
+
+                                              { the number of line controls applied to this line. This can be set}
+                                              { to zero if there are no special line controls applied to this line.}
+		numberOfLineControls: ItemCount;
+
+                                              { the numberOfLineControls is non-zero, then following this structure}
+                                              { must be an array of ATSUAttributeInfo structures. There must be one}
+                                              { ATSUAttributeInfo structure for each numberOfLineControls above.}
+	end;
+	ATSFlatDataLineInfoDataPtr = ^ATSFlatDataLineInfoData;
+{
+   This structure is the main data header for the flattened line info data. This
+   is what a non-zero offsetToLineInfo points to in the 
+   ATSFlatDataTextLayoutDataHeader structure above.
+}
+type
+	ATSFlatDataLineInfoHeader = record
+
+                                              { the number of flattened line info structures that are stored in this}
+                                              { block. This value should really be equal to the number of soft line}
+                                              { breaks in the layout + 1. Of course if numberOfLines is zero, then}
+                                              { this structure shouldn't even be used.}
+		numberOfLines: ItemCount;
+
+                                              { the first in a array of ATSFlatDataLineInfoData structures. There}
+                                              { needs to be a ATSFlatDataLineInfoData for each numberOfLines}
+                                              { specified above.}
+		lineInfoArray: array[0..0] of ATSFlatDataLineInfoData;
+	end;
+	ATSFlatDataLineInfoHeaderPtr = ^ATSFlatDataLineInfoHeader;
+{ ------------------ }
+{ Block 3 Structures }
+{ ------------------ }
+{
+   The block 3 structures are used by ATSUI style run flattening and parsing
+   functions, ATSUFlattenStyleRunsToStream and ATSUUnflattenStyleRunsFromStream
+   to represent flattened style run information. These structures go hand and
+   hand with the block 4 structures.
+}
+
+{
+   This is the data header that appears before the style run data structures.
+   This structure is what a non-zero offsetToStyleRuns in the
+   ATSFlatDataMainHeaderBlock points to in block 1.
+}
+type
+	ATSFlatDataStyleRunDataHeader = record
+
+                                              { the number of style run data structures stored in this block}
+		numberOfStyleRuns: ItemCount;
+
+                                              { the first in an array of ATSUStyleRunInfo structures. There needs to}
+                                              { be a ATSUStyleRunInfo structure for each numberOfStyleRuns specified}
+                                              { above. This structure is defined in ATSUnicode.h}
+		styleRunArray: array[0..0] of ATSUStyleRunInfo;
+	end;
+	ATSFlatDataStyleRunDataHeaderPtr = ^ATSFlatDataStyleRunDataHeader;
+{ ------------------ }
+{ Block 4 Structures }
+{ ------------------ }
+{
+   The block 4 structures store flattened ATSUStyle objects. This too, is
+   currently used by the ATSUI style run flattening and parsing functions,
+   ATSUFlattenStyleRunsToStream and ATSUUnflattenStyleRunsFromStream. 
+}
+
+{
+   this structure forms the beginning of an individually flattened ATSUStyle
+   object. 
+}
+type
+	ATSFlatDataStyleListStyleDataHeader = record
+
+                                              { the size of this flattened style object, including these four bytes and}
+                                              { any padding bytes at the end of the structure. Basically, this can be}
+                                              { used to determine where the next structure in the array begins.}
+		sizeOfStyleInfo: ByteCount;
+
+                                              { the number of attributes set in this flattened style object. This should }
+                                              { be at least one for the font data, although it can be 0 if this is to be}
+                                              { unspecfied.}
+		numberOfSetAttributes: ItemCount;
+
+                                              { the number of font features set in the flattened style object. This can}
+                                              { be set to 0 if there are no font features set in the style object. }
+		numberOfSetFeatures: ItemCount;
+
+                                              { the number of font variations set in the flattened style object. This}
+                                              { can be set to 0 if there are no font variations set in the style object.}
+		numberOfSetVariations: ItemCount;
+
+                                              { after this structure header, there is the following data in this block:}
+
+                                              { 1. if the numberOfSetAttributes is non-zero, then there will be an}
+                                              {       array of ATSUAttributeInfo structures immediately following the}
+                                              {       above header data to store the style attributes. This is a variable}
+                                              {       structure array. There must be one ATSUAttributeInfo for}
+                                              {       for each numberOfSetAttributes. If numberOfSetAttributes is zero,}
+                                              {       then skip to the next data section 2.}
+
+                                              { 2. if the numberOfSetFeatures is non-zero, then there will be an array}
+                                              {       of ATSFlatDataStyleListFeatureData structures immediately after}
+                                              {       the ATSUAttributeInfo array above (if any). There must be one}
+                                              {       ATSFlatDataStyleListFeatureData structure for each }
+                                              {       numberOfSetFeatures set in the header above. If numberOfSetFeatures}
+                                              {       is zero, then skip to the next data section 3.}
+
+                                              { 3. if the numberOfSetVariations is non-zero, then there will be an}
+                                              {       array of ATSFlatDataStyleListVariationData immediately after the}
+                                              {       ATSFlatDataStyleListFeatureData array above (if any). There must be}
+                                              {       one ATSFlatDataStyleListVariationData structure for each }
+                                              {       numberOfSetVariations set in the header above.}
+	end;
+	ATSFlatDataStyleListStyleDataHeaderPtr = ^ATSFlatDataStyleListStyleDataHeader;
+{
+   this structure is the main header for this block. This structure is what a
+   non-zero offsetToStyleList in the ATSFlatDataMainHeaderBlock points to in
+   block 1.
+}
+type
+	ATSFlatDataStyleListHeader = record
+
+                                              { the total number of flattened style objects stored in this block}
+		numberOfStyles: ItemCount;
+
+                                              { the first in an array of flattned style entries. The data stored}
+                                              { in them is variably sized, so a simply array access won't do for}
+                                              { iterating through these. However, there must be one of these}
+                                              { ATSFlatDataStyleListStyleDataHeader structures for each }
+                                              { numberOfStyles above.}
+		styleDataArray: array[0..0] of ATSFlatDataStyleListStyleDataHeader;
+
+	end;
+	ATSFlatDataStyleListHeaderPtr = ^ATSFlatDataStyleListHeader;
+{
+   this structure stores flattened font feature data. An array of these comes
+   after the array of font data attributes (if any) if the numberOfSetFeatures is
+   non-zero. There must be one of these structures for each numberOfSetFeatures.
+}
+type
+	ATSFlatDataStyleListFeatureData = record
+
+                                              { the font feature type}
+		theFeatureType: ATSUFontFeatureType;
+
+                                              { the font feature selector}
+		theFeatureSelector: ATSUFontFeatureSelector;
+	end;
+	ATSFlatDataStyleListFeatureDataPtr = ^ATSFlatDataStyleListFeatureData;
+{
+   this structure stores the flattened font variation data. An array of these 
+   comes after the array of ATSFlatDataStyleListFeatureData structures (if any) 
+   if the numberOfSetVariations is non-zero. There must be one of these
+   structures for each numberOfSetFeatures.
+}
+type
+	ATSFlatDataStyleListVariationData = record
+
+                                              { the variation axis}
+		theVariationAxis: ATSUFontVariationAxis;
+
+                                              { the variation value}
+		theVariationValue: ATSUFontVariationValue;
+	end;
+	ATSFlatDataStyleListVariationDataPtr = ^ATSFlatDataStyleListVariationData;
+{ ------------------------ }
+{ Flattened Font Data Info }
+{ ------------------------ }
+{
+   This is somewhat of an addendum to the 'ustl' structure above. These flattened 
+   data structures are stored in block 4 as a font attribute with the attribute 
+   tag of kATSUFontTag. They can store font data in a few different ways, such as
+   by a FontSync reference or by simple raw font name data. Just as with the 
+   'ustl' above, this structure must maintain four byte alignment.
+}
+
+
+{ these are the currenly supported font specifiers. }
+type ATSFlatDataFontSpeciferType = UInt32;
+const
+                                        { this specifier allows the storage of font data based on name data. This}
+                                        { uses the stuctures below to store the actual data itself.}
+  kATSFlattenedFontSpecifierRawNameData = $6E616D64 (* 'namd' *);
+
+{
+   this is the main header for the font data. It dictates what type of data
+   is stored. The actual data stored must match the type specified by the
+   nameSpecType. 
+}
+type
+	ATSFlatDataFontNameDataHeader = record
+
+                                              { the type of data that is flattened in this structure}
+		nameSpecifierType: ATSFlatDataFontSpeciferType;
+
+                                              { the size of the data that is flattened in this structre, not including }
+                                              { any padding bytes that may be necessary to achive the four byte }
+                                              { alignment of the data, unless they are specified as part of structure, }
+                                              { such as with the ATSFlatDataFontSpecRawNameData structure.}
+		nameSpecifierSize: ByteCount;
+
+                                              { after this header comes the flattened font name data which matches}
+                                              { the type specified by the nameSpecifierType above. For instance, if }
+                                              { the nameSpecType is kATSFlattenedFontNameSpecifierRawNameData, the}
+                                              { structure that immediately follows this would be a}
+                                              { ATSFlatDataFontNameRawNameDataHeader structure. }
+
+	end;
+	ATSFlatDataFontNameDataHeaderPtr = ^ATSFlatDataFontNameDataHeader;
+{
+   the next two structures are only used when the nameSpecType is set to
+   kATSFlattenedFontSpecifierRawNameData. They are setup to store multiple
+   font name table entries for the purposes of reconstructing an ATSUFontID
+   for (hopefully) the same font some time in the future.
+}
+{ this is the structure in which raw font name data is actually stored. }
+type
+	ATSFlatDataFontSpecRawNameData = record
+
+                                              { the type of name being specified}
+		fontNameType: FontNameCode;
+
+                                              { the platform type of the font name, whether it be Unicode, Mac, etc.  }
+                                              { This should be specified if known. If not known, then specify}
+                                              { kFontNoPlatform, but then all matching will be done based on the first}
+                                              { font in the name table matching the other parameters.}
+		fontNamePlatform: FontPlatformCode;
+
+                                              { the script code of the fontÕs name based on the platform that was passed}
+                                              { in above. If set to kFontNoScript, then the name will be matched based}
+                                              { on the first font in the name table matching the other font name}
+                                              { parameters.}
+		fontNameScript: FontScriptCode;
+
+                                              { the language of the font name. If set to kFontNoLanguage, then the name }
+                                              { will be matched based on the first font in the name table matching the}
+                                              { other font name parameters.}
+		fontNameLanguage: FontLanguageCode;
+
+                                              { the length of the font name in bytes, not including any padding bytes}
+                                              { added to maintain the four byte alignment}
+		fontNameLength: ByteCount;
+
+                                              { after the name length comes the actual font name data itself, plus any}
+                                              { padding bytes needed to maintain the four byte alignment.}
+
+	end;
+	ATSFlatDataFontSpecRawNameDataPtr = ^ATSFlatDataFontSpecRawNameData;
+{
+   this is a header structure that defines some things constant throughout
+   the entire search for the font name, as well as the array of
+   ATSFlatDataFontNameData structures. In order to gaurantee that the same font 
+   will be used, more than one name specifer should be stored. The standard ATSUI
+   style run flattening and parsing functions, ATSUFlattenStyleRunsToStream and
+   ATSUUnflattenStyleRunsFromStream. These will store both the font's full name
+   (kFontFullName) as well as the font's manufacturer name (kFontManufacturerName)
+   and match fonts based on both of
+   these. 
+}
+type
+	ATSFlatDataFontSpecRawNameDataHeader = record
+
+                                              { the number of flattened font names. There must be at least one flattened }
+                                              { font name, otherwise the structure is malformed.}
+		numberOfFlattenedNames: ItemCount;
+
+                                              { the first in an array of possibly many font name specifiers - depending}
+                                              { on how specific the caller wants this. There must be one }
+                                              { ATSFlatDataFontNameData structure for each numberOfFlattenedNames}
+                                              { above.}
+		nameDataArray: array[0..0] of ATSFlatDataFontSpecRawNameData;
+
+	end;
+	ATSFlatDataFontSpecRawNameDataHeaderPtr = ^ATSFlatDataFontSpecRawNameDataHeader;
+{ ---------------------------------------------------------------------------- }
+{ Style Flattening and Parsing Functions                                       }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUFlattenStyleRunsToStream()
+ *  
+ *  Summary:
+ *    Converts a series of ATSUStyle objects and associated run info to
+ *    a flat binary representation.
+ *  
+ *  Discussion:
+ *    This function takes an array of ATSUStyle objects and style run
+ *    information and flattens the data to the specified format. The
+ *    style runs must all reference the same block of Unicode text
+ *    (usually passed separately as text in the 'utxt' format). The
+ *    style runs must also be in ascending order relative to the text
+ *    in the text block. Typically you use the function
+ *    ATSUFlattenStyleRunsFromStream by calling it twice, as follows:
+ *    (1) Provide appropriate values for the iStreamFormat,
+ *    iFlattenOptions, iNumberOfRunInfo, iRunInfoArray,
+ *    iNumberOfStyleObjects, and iStyleArray parameters. Set
+ *    iStreamBufferSize to 0, oStreamBuffer to NULL, and pass a valid
+ *    reference to a ByteCount variable in the oActualStreamBufferSize
+ *    parameter. Call the function ATSUFlattenStyleRunsToStream. On
+ *    return, oActualStreamBufferSize points to the size needed for the
+ *    buffer. (2) Allocate an appropriately-sized buffer for the
+ *    oStreamBuffer parameter and then call the function
+ *    ATSUFlattenStyleRunsToStream a second time.
+ *  
+ *  Parameters:
+ *    
+ *    iStreamFormat:
+ *      The format of the flattened data. There is only one format
+ *      supported at this time ('ustl'), so you must pass the constant
+ *      kATSUDataStreamUnicodeStyledText.
+ *    
+ *    iFlattenOptions:
+ *      The options you want to use to flatten the data. There are no
+ *      options supported at this time, so you must pass the constant
+ *      kATSUFlattenOptionsNoOptionsMask.
+ *    
+ *    iNumberOfRunInfo:
+ *      The number of style run information structures passed in the
+ *      iRunInfoArray parameter. If you pass 0, ATSUI assumes there is
+ *      only one style for the entire text block passed in the
+ *      oStreamBuffer parameter. The flattened data format passed to
+ *      the iStreamFormat parameter must support the use of one style.
+ *    
+ *    iRunInfoArray:
+ *      An array of ATSUStyleRunInfo structures that describes the
+ *      style runs to be flattened. This array must contain
+ *      iNumberOfRunInfo entries. An ATSUStyleRunInfo structure
+ *      contains an index into an array of unique ATSUStyle objects and
+ *      the length of the run to which the style object applies. Each
+ *      index in the ATSUStyleRunInfo structure must reference a valid
+ *      ATSUStyle object passed in the iStyleArray parameter. You can
+ *      pass NULL, only if iNumberOfRunInfo is set to zero.
+ *    
+ *    iNumberOfStyleObjects:
+ *      The number of ATSUStyle objects in the array passed to the
+ *      iStyleArray parameter. You must pass a value that is greater
+ *      than 0.
+ *    
+ *    iStyleArray:
+ *      An array of ATSUStyle objects to be flattened. You cannot pass
+ *      NULL.
+ *    
+ *    iStreamBufferSize:
+ *      The size of the stream buffer, pointed to by the oStreamBuffer
+ *      parameter. You can pass 0only if the iStreamBufferSize
+ *      parameter is set to NULL. If you are uncertain of the size of
+ *      the array, see the Discussion.
+ *    
+ *    oStreamBuffer:
+ *      On input, a pointer to the data you want to flatten. On return,
+ *      points to the flattened data. If you pass NULL for this
+ *      parameter, no data is flattened. Instead, the size of the
+ *      buffer is calculated by ATSUI and returned in oActualStreamSize
+ *      parameter. See the Discussion for more details. You are
+ *      responsible for allocating the text buffer passed in the
+ *      oStreamBuffer parameter.
+ *    
+ *    oActualStreamBufferSize:
+ *      On return, the size of the data written to the oStreamBuffer
+ *      parameter. You can pass NULL only if the oStreamBuffer
+ *      parameter is not NULL.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUFlattenStyleRunsToStream( iStreamFormat: ATSUFlattenedDataStreamFormat; iFlattenOptions: ATSUFlattenStyleRunOptions; iNumberOfRunInfo: ItemCount; iRunInfoArray: ATSUStyleRunInfoPtr; iNumberOfStyleObjects: ItemCount; iStyleArray: ATSUStylePtr; iStreamBufferSize: ByteCount; oStreamBuffer: UnivPtr; oActualStreamBufferSize: ByteCountPtr ): OSStatus; external name '_ATSUFlattenStyleRunsToStream';
+
+
+{
+ *  ATSUUnflattenStyleRunsFromStream()
+ *  
+ *  Summary:
+ *    Creates a series of ATSUStyle objects and associated run
+ *    information from a flat binary representation.
+ *  
+ *  Discussion:
+ *    This function extracts the ATSUI style run information from
+ *    previously-flattened data. The style objects and style run
+ *    information structures are returned in two separate arraysÑthe
+ *    array oStyleArray and the array oRunInfoArray. These arrays are
+ *    not parallel. Each ATSUStyle object in the oStyleArray is a
+ *    unique ATSUStyle object. To figure out which ATSUStyle object
+ *    belongs to which text run, the caller must parse the array of
+ *    ATSUStyleRunInfo structures. These structures contain the style
+ *    run lengths and an index into the oStyleArray. Typically you use
+ *    the function ATSUUnflattenStyleRunsFromStream by calling it
+ *    twice, as follows: (1) Provide appropriate values for the
+ *    iStreamFormat, iUnflattenOptions, and iStreamBuffer parameters.
+ *    Pass 0for the iNumberOfRunInfo and iNumberOfStyleObjects
+ *    parameters, NULL for the oRunInfoArray and oStyleArray,
+ *    parameters and valid ItemCount references for the
+ *    oActualNumberOfRunInfo and oActualNumberOfStyleObjects
+ *    parameters. On return, oActualNumberOfRunInfo and
+ *    oActualNumberOfStyleObjects point to the sizes needed to allocate
+ *    these arrays. (2) Allocate appropriately-sized arrays of
+ *    ATSUStyleRunStructures and ATSUStyle object references. Call the
+ *    function ATSUUnflattenStyleRunsFromStream a second time, passing
+ *    the newly allocated arrays in the oRunInfoArray and oStyleArray
+ *    parameters, with the iNumberOfRunInfo and iNumberOfStyleObjects
+ *    parameters set to the values you obtained from the first call.
+ *  
+ *  Parameters:
+ *    
+ *    iStreamFormat:
+ *      The format of the flattened data. There is only one format
+ *      supported at this time ('ustl'), so you must pass the constant
+ *      kATSUDataStreamUnicodeStyledText.
+ *    
+ *    iUnflattenOptions:
+ *      The options you want to use to unflatten the data. There are no
+ *      options supported at this time, so you must pass the constant
+ *      kATSUUnflattenOptionsNoOptionsMask.
+ *    
+ *    iStreamBufferSize:
+ *      The size of the buffer pointed to by the iStreamBuffer
+ *      parameter. You must pass a value greater than 0.
+ *    
+ *    iStreamBuffer:
+ *      A pointer to the buffer that contains the flattened data. The
+ *      data must be of the format specified by the iStreamFormat
+ *      parameter and must be of size specified by the
+ *      iStreamBufferSize parameter. You cannot pass NULL .
+ *    
+ *    iNumberOfRunInfo:
+ *      The number of style run information structures passed in the
+ *      iRunInfoArray parameter. If you are uncertain of the number of
+ *      style run information structures, see the Discussion.
+ *    
+ *    iNumberOfStyleObjects:
+ *      The number of ATSUStyle objects in the array passed into the
+ *      iStyleArray parameter. If you are uncertain of the number of
+ *      ATSUStyle objects, see the Discussion.
+ *    
+ *    oRunInfoArray:
+ *      On return, points to an array of style run information
+ *      structures. Each structure contains a style run length and
+ *      index into the oStyleArray array. If you are uncertain of how
+ *      much memory to allocate for this array, see the Discussion. You
+ *      are responsible for disposing of the array when you no longer
+ *      need it.
+ *    
+ *    oStyleArray:
+ *      On return, a pointer to an array of the unique ATSUStyle
+ *      objects obtained from the flattened data. The indices returned
+ *      in the array oRunInfoArray are indices into this array. If you
+ *      are uncertain of how much memory to allocate for this array,
+ *      see the Discussion. You are responsible for disposing of the
+ *      array and the ATSUI style objects in the array when you no
+ *      longer need the array.
+ *    
+ *    oActualNumberOfRunInfo:
+ *      On return, points to the actual number of ATSUStyleRunInfo
+ *      structures obtained from the flattened data. The actual number
+ *      of structures is the number of entries added to the array
+ *      oRunInfoArray. You can pass NULL if you to not want to obtain
+ *      this value.
+ *    
+ *    oActualNumberOfStyleObjects:
+ *      On return, points to the actual number of unique ATSUStyle
+ *      objects obtained from the flattened data. The actual number is
+ *      the number of entries added to the oStyleArray array. You can
+ *      pass NULL if you do no want to obtain this value.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUUnflattenStyleRunsFromStream( iStreamFormat: ATSUFlattenedDataStreamFormat; iUnflattenOptions: ATSUUnFlattenStyleRunOptions; iStreamBufferSize: ByteCount; iStreamBuffer: UnivPtr; iNumberOfRunInfo: ItemCount; iNumberOfStyleObjects: ItemCount; oRunInfoArray: ATSUStyleRunInfoPtr; oStyleArray: ATSUStylePtr; oActualNumberOfRunInfo: ItemCountPtr; oActualNumberOfStyleObjects: ItemCountPtr ): OSStatus; external name '_ATSUUnflattenStyleRunsFromStream';
+
+
+{ Functions listed beyond this point are either deprecated or not recommended }
+
+{
+ *  ATSUCopyToHandle()
+ *  
+ *  Discussion:
+ *    This function is no longer recommended. Please use
+ *    ATSUFlattenStyleRunsToStream instead.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCopyToHandle( iStyle: ATSUStyle; oStyleHandle: Handle ): OSStatus; external name '_ATSUCopyToHandle';
+
+
+{
+ *  ATSUPasteFromHandle()
+ *  
+ *  Discussion:
+ *    This function is no longer recommended. Please use
+ *    ATSUUnflattenStyleRunsFromStream instead.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUPasteFromHandle( iStyle: ATSUStyle; iStyleHandle: Handle ): OSStatus; external name '_ATSUPasteFromHandle';
+
+
+end.

+ 1700 - 0
packages/extra/univint/ATSUnicodeFonts.pas

@@ -0,0 +1,1700 @@
+{
+     File:       QD/ATSUnicodeFonts.h
+ 
+     Contains:   ATSUI font handling functions.
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeFonts;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ATSUnicodeTypes,SFNTTypes;
+{$ALIGN MAC68K}
+
+{ ---------------------------------------------------------------------------- }
+{  Font features                                                               }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUSetFontFeatures()
+ *  
+ *  Summary:
+ *    Sets font features in a style object.
+ *  
+ *  Discussion:
+ *    This function enables you to set multiple font features for a
+ *    style object. Any unset font features retain their font-defined
+ *    default values. To set style attributes and font variations for a
+ *    style object, call the functions ATSUSetAttributes and
+ *    ATSUSetVariations, respectively. The constants that represent
+ *    font feature types are defined in the header file
+ *    SFNTLayoutTypes.h. When you use ATSUI to access and set font
+ *    features, you must use the constants defined in this header file,
+ *    which are described in "Inside Mac OS X: Rendering Unicode Text
+ *    With ATSUI". As feature types can be added at any time, you
+ *    should check Apple's font feature registry website for the most
+ *    up-to-date list of font feature types and selectors:
+ *    http://developer.apple.com/fonts/Registry/index.html.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style object for which to set font features.
+ *    
+ *    iFeatureCount:
+ *      The number of font features to set. This value should
+ *      correspond to the number of elements in the iType and iSelector
+ *      arrays.
+ *    
+ *    iType:
+ *      An array of feature types. Each element in the array must
+ *      contain a valid feature type that corresponds to a feature
+ *      selector in the iSelector array. To obtain the valid feature
+ *      types for a font, call the function ATSUGetFontFeatureTypes .
+ *    
+ *    iSelector:
+ *      An array of feature selectors. Each element in the array must
+ *      contain a valid feature selector that corresponds to a feature
+ *      type in the iType array. To obtain the valid feature selectors
+ *      for a font, call the function ATSUGetFontFeatureSelectors .
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetFontFeatures( iStyle: ATSUStyle; iFeatureCount: ItemCount; iType: ATSUFontFeatureTypePtr; iSelector: ATSUFontFeatureSelectorPtr ): OSStatus; external name '_ATSUSetFontFeatures';
+
+
+{
+ *  ATSUGetFontFeature()
+ *  
+ *  Summary:
+ *    Obtains the font feature corresponding to an index into an array
+ *    of font features for a style object.
+ *  
+ *  Discussion:
+ *    You might typically call ATSUGetFontFeature if you need to obtain
+ *    one previously set feature after another within your program's
+ *    processing loop. To obtain all previously set font features for a
+ *    given style object, you can call the function
+ *    ATSUGetAllFontFeatures. Before calling ATSUGetFontFeature, you
+ *    should call the function ATSUGetAllFontFeatures to obtain a count
+ *    of the font features that are set in the style object. You can
+ *    then pass the index for the feature whose setting you want to
+ *    obtain in the iTag and iMaximumValueSize parameters of
+ *    ATSUGetFontFeature.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style you wish to obtain font feature information for.
+ *    
+ *    iFeatureIndex:
+ *      An index into the array of font features for the style object.
+ *      This index identifies the font feature to examine. Because this
+ *      index is zero-based, you must pass a value between 0 and one
+ *      less than the value produced in the oActualFeatureCount
+ *      parameter of the function ATSUGetAllFontFeatures.
+ *    
+ *    oFeatureType:
+ *      On return, the value identifies the font feature type
+ *      corresponding to the index passed in the iFeatureIndex
+ *      parameter. You must allocate space for ATSUGetFontFeature to
+ *      store this value.
+ *    
+ *    oFeatureSelector:
+ *      On return, the value identifies the font feature selector that
+ *      corresponds to the feature type produced in the oFeatureType
+ *      parameter. ou must allocate space for ATSUGetFontFeature to
+ *      store this value.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontFeature( iStyle: ATSUStyle; iFeatureIndex: ItemCount; oFeatureType: ATSUFontFeatureTypePtr; oFeatureSelector: ATSUFontFeatureSelectorPtr ): OSStatus; external name '_ATSUGetFontFeature';
+
+
+{
+ *  ATSUGetAllFontFeatures()
+ *  
+ *  Summary:
+ *    Obtains the font features of a style object that are not at
+ *    default settings.
+ *  
+ *  Discussion:
+ *    The ATSUGetAllFontFeatures function obtains all of a style
+ *    object's font features that are not at default settings. Font
+ *    features are grouped into categories called feature types, within
+ *    which individual feature selectors define particular feature
+ *    settings. The arrays produced by ATSUGetAllFontFeatures contain
+ *    constants identifying the object's font types and their
+ *    corresponding font selectors. Typically you use the function
+ *    ATSUGetAllFontFeatures by calling it twice, as follows: (1) Pass
+ *    a reference to the style object to examine in the iStyle
+ *    parameter, a valid pointer to an ItemCount value in the
+ *    oActualFeatureCount parameter, NULL for the oFeatureType and
+ *    oFeatureSelector parameters, and 0 for the iMaximumFeatureCount
+ *    parameter. ATSUGetAllFontFeatures returns the size in the
+ *    oActualFeatureCount parameter to use for the feature type and
+ *    selector arrays. (2) Allocate enough space for arrays of the
+ *    returned size, then call ATSUGetAllFontFeatures again, passing a
+ *    pointer to the arrays in the oFeatureType and oFeatureSelector
+ *    parameters. On return, the arrays contain the font feature types
+ *    and selectors, respectively, for the style object.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style for which you wish to obtain font feature information.
+ *    
+ *    iMaximumFeatureCount:
+ *      The maximum number of feature types and selectors to obtain for
+ *      the style object. Typically, this is equivalent to the number
+ *      of ATSUFontFeatureType and ATSUFontFeatureSelector values for
+ *      which you have allocated memory in the oFeatureType and
+ *      oFeatureSelector parameters, respectively. To determine this
+ *      value, see the Discussion.
+ *    
+ *    oFeatureType:
+ *      On return, the array contains constants identifying each type
+ *      of font feature that is at a nondefault setting in the style
+ *      object. If you are uncertain of how much memory to allocate for
+ *      this array, see the Discussion. can be NULL
+ *    
+ *    oFeatureSelector:
+ *      On return, the array contains constants identifying the feature
+ *      selectors that are at nondefault settings in the style object.
+ *      Each selector determines the setting for a corresponding
+ *      feature type produced in the oFeatureType parameter. If you are
+ *      uncertain of how much memory to allocate for this array, see
+ *      the Discussion.  can be NULL
+ *    
+ *    oActualFeatureCount:
+ *      On return, the value specifies the actual number of font
+ *      feature types and selectors in the style object. This may be
+ *      greater than the value you specified in the
+ *      iMaximumFeatureCount parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetAllFontFeatures( iStyle: ATSUStyle; iMaximumFeatureCount: ItemCount; oFeatureType: ATSUFontFeatureTypePtr; oFeatureSelector: ATSUFontFeatureSelectorPtr; oActualFeatureCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllFontFeatures';
+
+
+{
+ *  ATSUClearFontFeatures()
+ *  
+ *  Summary:
+ *    Restores default settings to the specified font features of a
+ *    style object.
+ *  
+ *  Discussion:
+ *    This function removes those font features that are identified by
+ *    the feature selector and type constants in the iSelector and
+ *    iType arrays and replaces them with their font-defined default
+ *    values. Note that if you pass ATSUClearFontFeatures a font
+ *    feature and selector that are already at default settings, the
+ *    function does not return an error. To restore default font
+ *    variations to a style object, call the function
+ *    ATSUClearFontVariations. To restore default style attributes to a
+ *    style object, call ATSUClearAttributes. To restore all default
+ *    settings to a style object (for font features, variations, and
+ *    style attributes), call the function ATSUClearStyle.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      A style whose font features you wish to clear.
+ *    
+ *    iFeatureCount:
+ *      The number of font features to restore to default settings.
+ *      This value should correspond to the number of elements in the
+ *      iType and iSelector arrays. To restore default settings to all
+ *      the font features in the specified style object, pass the
+ *      constant kATSUClearAll in this parameter. In this case, the
+ *      values in the iType and iSelector parameters are ignored.
+ *    
+ *    iType:
+ *      An array of feature types. Each value should identify a font
+ *      feature to restore to its default setting. To obtain all
+ *      previously set font features for a given style object, you can
+ *      call the function ATSUGetAllFontFeatures. You may pass NULL for
+ *      this parameter if you are passing kATSUClearAll for the
+ *      iFeatureCount parameter. can be NULL
+ *    
+ *    iSelector:
+ *      An array of feature selectors. Each element in the array must
+ *      contain a valid feature selector corresponding to a font
+ *      feature you provide in the iType parameter. To obtain all
+ *      previously set feature selectors for a given style object, you
+ *      can call the function ATSUGetAllFontFeatures. You may pass NULL
+ *      for this parameter if you are passing kATSUClearAll for the
+ *      iFeatureCount parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearFontFeatures( iStyle: ATSUStyle; iFeatureCount: ItemCount; iType: ATSUFontFeatureTypePtr; iSelector: ATSUFontFeatureSelectorPtr ): OSStatus; external name '_ATSUClearFontFeatures';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font variations                                                             }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUSetVariations()
+ *  
+ *  Summary:
+ *    Sets font variation axes and values in a style object.
+ *  
+ *  Discussion:
+ *    If you supply font variation axes and values to the
+ *    ATSUSetVariations function, you can change the appearance of a
+ *    style object's font accordingly. You may specify any number of
+ *    variation axes and values in a style object. Any of the font's
+ *    variations that you do not set retain their font-defined default
+ *    values. You can also use the ATSUSetVariations function to supply
+ *    your own value within any variation axes defined for the font.
+ *    However, if the font does not support the variation axis you
+ *    specify, your custom variation has no visual effect. By calling
+ *    the function ATSUGetIndFontVariation, you can obtain a variation
+ *    axis and its maximum, minimum, and default values for a font.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style object for which to set font variation values.
+ *    
+ *    iVariationCount:
+ *      The number of font variation values to set. This value should
+ *      correspond to the number of elements in the iAxes and iValue
+ *      arrays.
+ *    
+ *    iAxes:
+ *      An array of font variation axes. Each element in the array must
+ *      represent a valid variation axis tag that corresponds to a
+ *      variation value in the iValue array. To obtain a valid
+ *      variation axis tag for a font, you can call the functions
+ *      ATSUGetIndFontVariation or ATSUGetFontInstance.
+ *    
+ *    iValue:
+ *      An array of font variation values. Each element in the array
+ *      must contain a value that is valid for the corresponding
+ *      variation axis in the iAxes parameter. You can obtain a font's
+ *      maximum, minimum, and default values for a given variation axis
+ *      by calling the function ATSUGetIndFontVariation . You can
+ *      obtain the font variation axis values for a font instance by
+ *      calling ATSUGetFontInstance.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetVariations( iStyle: ATSUStyle; iVariationCount: ItemCount; iAxes: ATSUFontVariationAxisPtr; iValue: ATSUFontVariationValuePtr ): OSStatus; external name '_ATSUSetVariations';
+
+
+{
+ *  ATSUGetFontVariationValue()
+ *  
+ *  Summary:
+ *    Obtains the current value for a single font variation axis in a
+ *    style object.
+ *  
+ *  Discussion:
+ *    This function obtains the setting for a specified font variation
+ *    axis in a style object. You might typically call
+ *    ATSUGetFontVariationValue if you need to obtain one previously
+ *    set variation axis value after another within your program's
+ *    processing loop. To obtain all nondefault font variation axis
+ *    values for a given style object, you can call the function
+ *    ATSUGetAllFontVariations. Before calling
+ *    ATSUGetFontVariationValue, call the function
+ *    ATSUGetAllFontVariations to obtain the font variation axes that
+ *    are set for the style object.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style for which you want to obtain a variation value.
+ *    
+ *    iFontVariationAxis:
+ *      A tag specifying the style object's variation axis to examine.
+ *      You can obtain a list of variation axis tags that are set to
+ *      non-default values in a particular style object from the
+ *      function ATSUGetAllFontVariations.
+ *    
+ *    oFontVariationValue:
+ *      On return, ATSUGetFontVariationValue produces the currently set
+ *      value for the style object's specified variation axis. If this
+ *      value has not been set, ATSUGetFontVariationValue produces the
+ *      font-defined default value.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontVariationValue( iStyle: ATSUStyle; iFontVariationAxis: ATSUFontVariationAxis; oFontVariationValue: ATSUFontVariationValuePtr ): OSStatus; external name '_ATSUGetFontVariationValue';
+
+
+{
+ *  ATSUGetAllFontVariations()
+ *  
+ *  Summary:
+ *    Obtains a style object's font variation values that are not at
+ *    default settings.
+ *  
+ *  Discussion:
+ *    This function obtains all of a style object's font variation axes
+ *    that are not at default settings, as well as the current values
+ *    for the axes. Typically you use the function
+ *    ATSUGetAllFontVariations by calling it twice, as follows: (1)
+ *    Pass a reference to the style object to examine in the iStyle
+ *    parameter, a pointer to an ItemCount value in the
+ *    oActualVariationCount parameter, NULL for the oVariationAxes and
+ *    oFontVariationValues parameters, and 0 for the iVariationCount
+ *    parameter. ATSUGetAllFontVariations returns the size to use for
+ *    the variation axes and value arrays in the oActualVariationCount
+ *    parameter. (2) Allocate enough space for arrays of the returned
+ *    size, then call ATSUGetAllFontVariations again, passing a pointer
+ *    to the arrays in the oVariationAxes and oFontVariationValues
+ *    parameters. On return, the arrays contain the font variation axes
+ *    and their corresponding values, respectively, for the style
+ *    object.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      A style for which you wish to obtain information about current
+ *      variation settings.
+ *    
+ *    iVariationCount:
+ *      The maximum number of font variation values to obtain for the
+ *      style object. Typically, this is equivalent to the number of
+ *      ATSUFontVariationAxis and ATSUFontVariationValue values for
+ *      which you have allocated memory in the oVariationAxes and
+ *      oFontVariationValues parameters, respectively. To determine
+ *      this value, see the Discussion.
+ *    
+ *    oVariationAxes:
+ *      On return, the array contains the current font variation values
+ *      for the font variation axes produced in the oVariationAxes
+ *      array. If you are uncertain of how much memory to allocate for
+ *      this array, see the Discussion. can be NULL
+ *    
+ *    oFontVariationValues:
+ *      On return, the value specifies the actual number of nondefault
+ *      font variation values in the style object. This may be greater
+ *      than the value you passed in the iVariationCount parameter. If
+ *      you are uncertain of how much memory to allocate for this
+ *      array, see the Discussion. can be NULL
+ *    
+ *    oActualVariationCount:
+ *      On return, the value specifies the actual number of nondefault
+ *      font variation values in the style object. This may be greater
+ *      than the value you passed in the iVariationCount parameter.
+ *       can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetAllFontVariations( iStyle: ATSUStyle; iVariationCount: ItemCount; oVariationAxes: ATSUFontVariationAxisPtr; oFontVariationValues: ATSUFontVariationValuePtr; oActualVariationCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllFontVariations';
+
+
+{
+ *  ATSUClearFontVariations()
+ *  
+ *  Summary:
+ *    Restores default values to the specified font variation axes of a
+ *    style object.
+ *  
+ *  Discussion:
+ *    The ATSUClearFontVariations function removes those font variation
+ *    axis values identified by variation axis tags in the iAxis array
+ *    and replaces them with their font-defined default values. You can
+ *    remove unset font variation values from a style object without a
+ *    function error. To restore default font features to a style
+ *    object, call the function ATSUClearFontFeatures. To restore
+ *    default style attributes, call ATSUClearAttributes. To restore
+ *    all default settings to a style object (for font features,
+ *    variations, and style attributes), call the function
+ *    ATSUClearStyle.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style in which you wish to clear font variation settings.
+ *    
+ *    iAxisCount:
+ *      The number of font variation axes to restore to default
+ *      settings. This value should correspond to the number of
+ *      elements in the iAxis array. To restore default values to all
+ *      the font variation axes in the style object, pass the constant
+ *      kATSUClearAll in this parameter. If you pass kATSUClearAll the
+ *      value in the iAxis parameter is ignored.
+ *    
+ *    iAxis:
+ *      An array of font variation axes. Each element in the array must
+ *      contain a valid tag that corresponds to a font variation axis
+ *      to restore to its default setting. You can obtain variation
+ *      axis tags for a style object from the function
+ *      ATSUGetAllFontVariations. You may pass NULL for this parameter
+ *      if you are passing kATSUClearAll for the iAxisCount parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearFontVariations( iStyle: ATSUStyle; iAxisCount: ItemCount; iAxis: ATSUFontVariationAxisPtr ): OSStatus; external name '_ATSUClearFontVariations';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font ID's                                                                   }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUFontCount()
+ *  
+ *  Summary:
+ *    Obtains the number of ATSUI-compatible fonts installed on a
+ *    user's system.
+ *  
+ *  Discussion:
+ *    The ATSUFontCount function obtains the number of fonts on a
+ *    user's system that are compatible with ATSUI. Incompatible fonts
+ *    include those that cannot be used to represent Unicode, the
+ *    missing-character glyph font, and fonts whose names begin with a
+ *    period or a percent sign. You can use the count produced in the
+ *    oFontCount parameter to determine the amount of memory to
+ *    allocate for the oFontIDs array in the function ATSUGetFontIDs.
+ *    It is important to note that the set of installed
+ *    ATSUI-compatible fonts may change while your application is
+ *    running. In Mac OS X, the set of installed fonts may change at
+ *    any time. Although in Mac OS 9, fonts cannot be removed from the
+ *    Fonts folder while an application other than the Finder is
+ *    running, they can be removed from other locations, and it is
+ *    possible for fonts to be added. Additionally, just because the
+ *    number of fonts stays the same between two successive calls to
+ *    ATSUFontCount , this does not mean that the font lists are the
+ *    same. It is possible for a font to be added and another removed
+ *    between two successive calls to ATSUFontCount , leaving the total
+ *    number unchanged.
+ *  
+ *  Parameters:
+ *    
+ *    oFontCount:
+ *      On return, the number of ATSUI-compatible fonts installed on a
+ *      user's system.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUFontCount( var oFontCount: ItemCount ): OSStatus; external name '_ATSUFontCount';
+
+
+{
+ *  ATSUGetFontIDs()
+ *  
+ *  Summary:
+ *    Obtains a list of all the ATSUI-compatible fonts installed on the
+ *    user's system.
+ *  
+ *  Discussion:
+ *    Use the function ATSUFontCount to determine how much memory to
+ *    allocate before calling this function. Also see the discussion
+ *    for the ATSUFontCount function.
+ *  
+ *  Parameters:
+ *    
+ *    oFontIDs:
+ *      On return, the array contains unique identifiers for each of
+ *      the ATSUI-compatible fonts installed on the user's system. You
+ *      should allocate enough memory to contain an array the size of
+ *      the count produced by the function ATSUFontCount.
+ *    
+ *    iArraySize:
+ *      The maximum number of fonts to obtain. Typically, this is
+ *      equivalent to the number of ATSUFontID values for which you
+ *      have allocated memory in the oFontIDs parameter.
+ *    
+ *    oFontCount:
+ *      On return, the value specifies the actual number of
+ *      ATSUI-compatible fonts installed on the user's system. This may
+ *      be greater than the value you specified in the iArraySize
+ *      parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontIDs( oFontIDs: ATSUFontIDPtr; iArraySize: ItemCount; oFontCount: ItemCountPtr ): OSStatus; external name '_ATSUGetFontIDs';
+
+
+{
+ *  ATSUFONDtoFontID()
+ *  
+ *  Summary:
+ *    Finds the ATSUI font ID that corresponds to a font family number,
+ *    if one exists.
+ *  
+ *  Discussion:
+ *    This function is not recommended. Instead, use the function
+ *    FMGetFontFromFontFamilyInstance (see Fonts.h). FMFont values are
+ *    equivalent to ATSUFontID values.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUFONDtoFontID( iFONDNumber: SInt16; iFONDStyle: Style; var oFontID: ATSUFontID ): OSStatus; external name '_ATSUFONDtoFontID';
+
+
+{
+ *  ATSUFontIDtoFOND()
+ *  
+ *  Summary:
+ *    Finds the font family number and style that correspond to an
+ *    ATSUI font ID, if these exist.
+ *  
+ *  Discussion:
+ *    This function is not recommended. Instead, use the function
+ *    FMGetFontFamilyInstanceFromFont (see Fonts.h). FMFont values are
+ *    equivalent to ATSUFontID values.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUFontIDtoFOND( iFontID: ATSUFontID; var oFONDNumber: SInt16; var oFONDStyle: Style ): OSStatus; external name '_ATSUFontIDtoFOND';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font names                                                                  }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCountFontNames()
+ *  
+ *  Summary:
+ *    Obtains the number of font names that correspond to a given ATSUI
+ *    font ID.
+ *  
+ *  Discussion:
+ *    This function obtains the number of font names defined in a font
+ *    name table for a given ATSUI font ID. This number includes
+ *    repetitions of the same name in different platforms, languages,
+ *    and scripts; names of font features, variations, tracking
+ *    settings, and instances for the font; and font names identified
+ *    by name code constants. You can pass an index value based on this
+ *    count to the function ATSUGetIndFontName to obtain a name string,
+ *    name code, platform, script, and language for a given ATSUI font
+ *    ID.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which you wish to obtain the font name count.
+ *    
+ *    oFontNameCount:
+ *      On return, the value specifies the number of entries in the
+ *      font name table corresponding to the given ATSUI font ID.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCountFontNames( iFontID: ATSUFontID; var oFontNameCount: ItemCount ): OSStatus; external name '_ATSUCountFontNames';
+
+
+{
+ *  ATSUGetIndFontName()
+ *  
+ *  Summary:
+ *    Obtains a name string, name code, platform, script, and language
+ *    for the font that matches an ATSUI font ID and name table index
+ *    value.
+ *  
+ *  Discussion:
+ *    Typically you use the ATSUGetIndFontName function by calling it
+ *    twice, as follows: (1) Pass valid values for the iFontID,
+ *    iFontNameIndex, and oActualNameLength parameters, 0 for the
+ *    iMaximumNameLength parameter, and NULL for the other parameters.
+ *    ATSUGetIndFontName returns the length of the font name string in
+ *    the oActualNameLength parameter. (2) Allocate enough space for a
+ *    buffer of the returned size, then call the function again,
+ *    passing a valid pointer to the buffer in the oName parameter. On
+ *    return, the buffer contains the font name string. To find a name
+ *    string and index value for the first font in a name table that
+ *    matches an ATSUI font ID and the specified font parameters, call
+ *    the function ATSUFindFontName. To obtain an ATSUI font ID for the
+ *    first font in a name table that matches the specified name
+ *    string, name code, platform, script, and/or language, call the
+ *    function ATSUFindFontFromName.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain information. Note that because
+ *      Apple Type Services assigns ATSUFontID values systemwide at
+ *      runtime, font IDs can change across system restarts.
+ *    
+ *    iFontNameIndex:
+ *      An index to the font for which to obtain information. Because
+ *      this index must be 0-based, you should pass a value between 0
+ *      and one less than the count produced by the function
+ *      ATSUCountFontNames.
+ *    
+ *    iMaximumNameLength:
+ *      The maximum length of the font name string to obtain.
+ *      Typically, this is equivalent to the size of the buffer that
+ *      you have allocated in the oName parameter. To determine this
+ *      length, see the Discussion.
+ *    
+ *    oName:
+ *      On return, the buffer contains the name string of the font
+ *      matching the ATSUI font ID and name table index value being
+ *      passed. If the buffer you allocate is not large enough to
+ *      contain the name string, ATSUGetIndFontName produces a partial
+ *      string. If you are unsure how much memory to allocate for this
+ *      parameter, see the Discussion.
+ *    
+ *    oActualNameLength:
+ *      On return, the value specifies the actual length of the
+ *      complete name string. This may be greater than the value passed
+ *      in the iMaximumNameLength parameter. You should check this
+ *      value to ensure that you have allocated sufficient memory and
+ *      therefore obtained the complete name string for the font. can be NULL
+ *    
+ *    oFontNameCode:
+ *      On return, a value specifying the type of name returned (i.e.,
+ *      full name, postscript name) of the font. See SFNTTypes.h for a
+ *      list of possible values. can be NULL
+ *    
+ *    oFontNamePlatform:
+ *      On return, a value specifying the encoding of the font. See
+ *      SFNTTypes.h for a list of possible values. can be NULL
+ *    
+ *    oFontNameScript:
+ *      On return, a value specifying the script of the font. See
+ *      SFNTTypes.h for a list of possible values. can be NULL
+ *    
+ *    oFontNameLanguage:
+ *      On return, a value specifying the language of the font. See
+ *      SFNTTypes.h for a list of possible values. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetIndFontName( iFontID: ATSUFontID; iFontNameIndex: ItemCount; iMaximumNameLength: ByteCount; oName: Ptr; oActualNameLength: ByteCountPtr; oFontNameCode: FontNameCodePtr; oFontNamePlatform: FontPlatformCodePtr; oFontNameScript: FontScriptCodePtr; oFontNameLanguage: FontLanguageCodePtr ): OSStatus; external name '_ATSUGetIndFontName';
+
+
+{
+ *  ATSUFindFontName()
+ *  
+ *  Summary:
+ *    Obtains a name string and index value for the first font in a
+ *    name table that matches the specified ATSUI font ID, name code,
+ *    platform, script, and/or language.
+ *  
+ *  Discussion:
+ *    Typically you use the ATSUFindFontName function by calling it
+ *    twice, as follows: (1) Pass NULL for the oName and oFontNameIndex
+ *    parameters, 0 for the iMaximumNameLength parameter, and valid
+ *    values for the other parameters. ATSUFindFontName returns the
+ *    length of the font name string in the oActualNameLength
+ *    parameter. (2) Allocate enough space for a buffer of the returned
+ *    size, then call the function again, passing a valid pointer to
+ *    the buffer in the oName parameter. On return, the buffer contains
+ *    the font name string. To obtain an ATSUI font ID for the first
+ *    font in a name table that matches the specified name string, name
+ *    code, platform, script, and/or language, call the function
+ *    ATSUFindFontFromName. To obtain the font name string, name code,
+ *    platform, script, and language for the font that matches an ATSUI
+ *    font ID and name table index, call the function
+ *    ATSUGetIndFontName. Although they will each accept NULL on input
+ *    individually, you must pass a vaild pointer to at least one of
+ *    the three parameters oName, oActualNameLength, or oFontNameIndex,
+ *    or ATSUFindFontName will return paramErr.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain a name string. Note that because
+ *      Apple Type Services assigns ATSUFontID values systemwide at
+ *      runtime, font IDs can change across system restarts.
+ *    
+ *    iFontNameCode:
+ *      A constant specifying the FontNameCode value of the font for
+ *      which to obtain a name string. See the SFNTTypes.h header file
+ *      for a definition of the FontNameCode type and a list of
+ *      possible values.
+ *    
+ *    iFontNamePlatform:
+ *      A constant specifying the encoding of the font. See SFNTTypes.h
+ *      for possible values to pass for this parameter. If you pass the
+ *      kFontNoPlatformCode constant, ATSUFindFontName produces the
+ *      first font in the name table matching the other specified
+ *      parameters.
+ *    
+ *    iFontNameScript:
+ *      A constant specifying the script of the font. See SFNTTypes.h
+ *      for possible values to pass for this parameter. If you pass the
+ *      kFontNoScriptCode constant, ATSUFindFontName produces the first
+ *      font in the name table matching the other specified parameters.
+ *    
+ *    iFontNameLanguage:
+ *      A constant specifying the language of the font you are
+ *      searching for. See SFNTLayoutTypes.h for possible values to
+ *      pass for this parameter.
+ *    
+ *    iMaximumNameLength:
+ *      The maximum size of string you want ATSUFindFontName to return.
+ *      Typically, this value is equal to the size of the buffer you
+ *      have allocated for the oName parameter. To determine this
+ *      length, see the Discussion.
+ *    
+ *    oName:
+ *      On return, the name string of the first font in the font name
+ *      table matching your specified parameters. If the buffer you
+ *      allocate is not large enough, ATSUFindFontName produces a
+ *      partial string. If you are unsure how much space to allocate
+ *      for this parameter, see the Discussion. can be NULL
+ *    
+ *    oActualNameLength:
+ *      On return, specifies the actual length of the complete name
+ *      string. This may be greater than the value passed in the
+ *      iMaximumNameLength parameter. You should check this value to
+ *      ensure that you have allocated sufficient memory and therefore
+ *      obtained the complete name string for the font. can be NULL
+ *    
+ *    oFontNameIndex:
+ *      On return, the value provides a 0-based index to the font name
+ *      in the font name table. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUFindFontName( iFontID: ATSUFontID; iFontNameCode: FontNameCode; iFontNamePlatform: FontPlatformCode; iFontNameScript: FontScriptCode; iFontNameLanguage: FontLanguageCode; iMaximumNameLength: ByteCount; oName: Ptr; oActualNameLength: ByteCountPtr; oFontNameIndex: ItemCountPtr ): OSStatus; external name '_ATSUFindFontName';
+
+
+{
+ *  ATSUFindFontFromName()
+ *  
+ *  Summary:
+ *    Obtains an ATSUI font ID for the first font in a name table that
+ *    matches the specified name string, name code, platform, script,
+ *    and/or language.
+ *  
+ *  Discussion:
+ *    Because ATSUI cannot guarantee the uniqueness of names among
+ *    installed fonts, ATSUFindFontFromName does not necessarily find
+ *    the only font that matches these parameters. As a result, you may
+ *    want to create a more sophisticated name-matching algorithm or
+ *    guarantee the uniqueness of names among installed fonts.
+ *  
+ *  Parameters:
+ *    
+ *    iName:
+ *      A pointer to a buffer containing the name string of the font
+ *      for which to obtain an ATSUI font ID.
+ *    
+ *    iNameLength:
+ *      The length, in bytes, of the name string provided in the iName
+ *      parameter.
+ *    
+ *    iFontNameCode:
+ *      A constant specifying the type of name to search for (i.e.,
+ *      full name, postcript name). See SFNTTypes.h for a list possible
+ *      values to pass for this parameter.
+ *    
+ *    iFontNamePlatform:
+ *      A constant specifying the encoding of the font you are
+ *      searching for. See SFNTTypes.h for possible values to pass for
+ *      this parameter. Pass kFontNoPlatformCode if you do not want to
+ *      limit your search to a particular encoding.
+ *    
+ *    iFontNameScript:
+ *      A constant specifying the script of the font you are searching
+ *      for. See SFNTTypes.h for possible values to pass for this
+ *      parameter. Pass kFontNoScriptCode if you do not want to limit
+ *      your search to a particular script.
+ *    
+ *    iFontNameLanguage:
+ *      A constant specifying the language of the font you are
+ *      searching for. See SFNTTypes.h for possible values to pass for
+ *      this parameter. Pass kFontNoLanguageCode if you do not want to
+ *      limit your search to a particular language.
+ *    
+ *    oFontID:
+ *      On return, the value provides a unique identifier for the
+ *      specified font. If no installed font matches the specified
+ *      parameters, kATSUInvalidFontID is returned for this parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. If the font cannot be found,
+ *    kATSUInvalidFontErr is returned. See MacErrors.h for other
+ *    possible error codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUFindFontFromName( iName: Ptr; iNameLength: ByteCount; iFontNameCode: FontNameCode; iFontNamePlatform: FontPlatformCode; iFontNameScript: FontScriptCode; iFontNameLanguage: FontLanguageCode; var oFontID: ATSUFontID ): OSStatus; external name '_ATSUFindFontFromName';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font features                                                               }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCountFontFeatureTypes()
+ *  
+ *  Summary:
+ *    Obtains the number of available feature types in a font.
+ *  
+ *  Discussion:
+ *    This function function obtains the total number of feature types
+ *    defined for a font. You can use the count produced by
+ *    ATSUCountFontFeatureTypes to determine how much memory to
+ *    allocate for the oTypes array in the function
+ *    ATSUGetFontFeatureTypes.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain a count of feature types.
+ *    
+ *    oTypeCount:
+ *      On return, the actual number of feature types defined for the
+ *      font.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCountFontFeatureTypes( iFontID: ATSUFontID; var oTypeCount: ItemCount ): OSStatus; external name '_ATSUCountFontFeatureTypes';
+
+
+{
+ *  ATSUCountFontFeatureSelectors()
+ *  
+ *  Summary:
+ *    Obtains the number of available feature selectors for a given
+ *    feature type in a font.
+ *  
+ *  Discussion:
+ *    This function obtains the total number of feature selectors
+ *    defined for a given feature type in the font. You can use the
+ *    count produced by ATSUCountFontFeatureSelectors to determine how
+ *    much memory to allocate for the oSelectors array in the function
+ *    ATSUGetFontFeatureSelectors.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain feature selector information.
+ *    
+ *    iType:
+ *      A value specifying one of the font's supported feature types.
+ *      To obtain the available feature types for a font, call the
+ *      function ATSUGetFontFeatureTypes.
+ *    
+ *    oSelectorCount:
+ *      On return, specifies the actual number of feature selectors
+ *      defined for the feature type by the font.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCountFontFeatureSelectors( iFontID: ATSUFontID; iType: ATSUFontFeatureType; var oSelectorCount: ItemCount ): OSStatus; external name '_ATSUCountFontFeatureSelectors';
+
+
+{
+ *  ATSUGetFontFeatureTypes()
+ *  
+ *  Summary:
+ *    Obtains the available feature types of a font.
+ *  
+ *  Discussion:
+ *    A given font may not support all possible feature types and
+ *    selectors. If you select features that are not available in a
+ *    font, you won't see a change in the glyph's appearance. To
+ *    determine the available features of a font, you can call the
+ *    functions ATSUGetFontFeatureTypes and
+ *    ATSUGetFontFeatureSelectors. The ATSUGetFontFeatureTypes function
+ *    reads the font data table for the specified font and obtains its
+ *    supported feature types. You can then use this information both
+ *    to present the user a list of font features from which to select
+ *    and to call such functions as ATSUSetFontFeatures with more
+ *    accuracy.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain information about feature types.
+ *    
+ *    iMaximumTypes:
+ *      The maximum number of feature types to obtain for the font.
+ *      Typically, this is equivalent to the number of elements in the
+ *      oTypes array.
+ *    
+ *    oTypes:
+ *      A pointer to memory you have allocated for an array of
+ *      ATSUFontFeatureType values.  You can call the function
+ *      ATSUCountFontFeatureTypes to obtain the number of available
+ *      feature types for a given font and thus determine the amount of
+ *      memory to allocate. On return, the array contains constants
+ *      identifying each type of feature that is defined for the font.
+ *      The constants that represent font feature types are defined in
+ *      the header file SFNTLayoutTypes.h and are described in the
+ *      official ATSUI documentation, available on the Apple developer
+ *      website. can be NULL
+ *    
+ *    oActualTypeCount:
+ *      On return, the actual number of feature types defined in the
+ *      font. This may be greater than the value you specify in the
+ *      iMaximumTypes parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontFeatureTypes( iFontID: ATSUFontID; iMaximumTypes: ItemCount; oTypes: ATSUFontFeatureTypePtr; oActualTypeCount: ItemCountPtr ): OSStatus; external name '_ATSUGetFontFeatureTypes';
+
+
+{
+ *  ATSUGetFontFeatureSelectors()
+ *  
+ *  Summary:
+ *    Obtains the available feature selectors for a given feature type
+ *    in a font.
+ *  
+ *  Discussion:
+ *    A given font may not support all possible feature types and
+ *    selectors. If you select features that are not available in a
+ *    font, you won't see a change in the glyph's appearance. To
+ *    determine the available features of a font, you can call the
+ *    functions ATSUGetFontFeatureTypes and
+ *    ATSUGetFontFeatureSelectors. The ATSUGetFontFeatureSelectors
+ *    function reads the font data table for the specified font and
+ *    obtains its supported feature selectors for the given feature
+ *    types. You can then use this information both to present the user
+ *    a list of font features from which to select and to call such
+ *    functions as ATSUSetFontFeatures with more accuracy.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain feature selectors.
+ *    
+ *    iType:
+ *      An ATSUFontFeatureType value specifying one of the font's
+ *      supported feature types. To obtain the available feature types
+ *      for a font, call the function ATSUGetFontFeatureTypes.
+ *    
+ *    iMaximumSelectors:
+ *      An ItemCount value specifying the maximum number of feature
+ *      selectors to obtain for the font's specified feature type.
+ *      Typically, this is equivalent to the number of elements in the
+ *      oSelectors array.
+ *    
+ *    oSelectors:
+ *      A pointer to memory you have allocated for an array of
+ *      ATSUFontFeatureSelector values.  You can call the function
+ *      ATSUCountFontFeatureSelectors to obtain the number of available
+ *      feature selectors for a given font feature type and thus
+ *      determine the amount of memory to allocate. On return, the
+ *      array contains constants identifying each available feature
+ *      selector for the given feature type. The constants that
+ *      represent font feature selectors are defined in the header file
+ *      SFNTLayoutTypes.h and are described in the official ATSUI
+ *      documentation, available on the Apple developer website. can be NULL
+ *    
+ *    oSelectorIsOnByDefault:
+ *      A pointer to memory you have allocated for an array of Boolean
+ *      values. The number of elements in this array should correspond
+ *      to the number of elements in the oSelectors array. On return,
+ *      the array contains Boolean values indicating whether the
+ *      corresponding feature selector in the oSelectors array is on or
+ *      off. If true, the feature selector is on by default; if false,
+ *      off. can be NULL
+ *    
+ *    oActualSelectorCount:
+ *      On return, the value specifies the actual number of feature
+ *      selectors defined for the given feature type. This value may be
+ *      greater than the value you specify in the iMaximumSelectors
+ *      parameter. can be NULL
+ *    
+ *    oIsMutuallyExclusive:
+ *      On return, the value indicates whether the feature selectors
+ *      for the given feature type are exclusive or nonexclusive. If a
+ *      feature type is exclusive you can choose only one of its
+ *      available feature selectors at a time, such as whether to
+ *      display numbers as proportional or fixed-width. If a feature
+ *      type is nonexclusive, you can enable any number of feature
+ *      selectors at once. If true , the feature type is exclusive and
+ *      only one selector can be used at a time. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontFeatureSelectors( iFontID: ATSUFontID; iType: ATSUFontFeatureType; iMaximumSelectors: ItemCount; oSelectors: ATSUFontFeatureSelectorPtr; oSelectorIsOnByDefault: BooleanPtr; oActualSelectorCount: ItemCountPtr; oIsMutuallyExclusive: BooleanPtr ): OSStatus; external name '_ATSUGetFontFeatureSelectors';
+
+
+{
+ *  ATSUGetFontFeatureNameCode()
+ *  
+ *  Summary:
+ *    btains the name code for a font's feature type or selector that
+ *    matches an ASTUI font ID, feature type, and feature selector.
+ *  
+ *  Discussion:
+ *    This function obtains the name code for a font's feature type or
+ *    selector that matches an ASTUI font ID, feature type and feature
+ *    selector values. By default, ATSUGetFontFeatureNameCode function
+ *    obtains the name code of a feature selector. To determine the
+ *    name code of a feature type, pass the constant kATSUNoSelector in
+ *    the iSelector parameter. You can use the function
+ *    ATSUFindFontName to obtain the localized name string for the name
+ *    code produced by ATSUGetFontFeatureNameCode.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain the name code for a feature type
+ *      or selector.
+ *    
+ *    iType:
+ *      A constant identifying a valid feature type. To obtain the
+ *      valid feature types for a font, call the function
+ *      ATSUGetFontFeatureTypes.
+ *    
+ *    iSelector:
+ *      A constant identifying a valid feature selector that
+ *      corresponds to the feature type passed in the iType parameter.
+ *      If you pass the constant kATSUNoSelector, the name code
+ *      produced by ATSUGetFontFeatureNameCode is that of the feature
+ *      type, not the feature selector. To obtain the valid feature
+ *      selectors for a font, call the function
+ *      ATSUGetFontFeatureSelectors.
+ *    
+ *    oNameCode:
+ *      On return, the value contains the name code for the font
+ *      feature selector or type. See the SFNTTypes.h header file for a
+ *      definition of the FontNameCode type and a list of possible
+ *      values.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontFeatureNameCode( iFontID: ATSUFontID; iType: ATSUFontFeatureType; iSelector: ATSUFontFeatureSelector; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetFontFeatureNameCode';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font tracking value & names                                                 }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCountFontTracking()
+ *  
+ *  Summary:
+ *    Obtains the number of entries in the font tracking table that
+ *    correspond to a given ATSUI font ID and glyph orientation.
+ *  
+ *  Discussion:
+ *    This function obtains the number of font tracking entries defined
+ *    in a font tracking table for a given ATSUI font ID and glyph
+ *    orientation. You can pass an index value based on this count to
+ *    the function ATSUGetIndFontTracking to obtain the name code and
+ *    tracking value of a font tracking.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain tracking table information.
+ *    
+ *    iCharacterOrientation:
+ *      A constant identifying the glyph orientation of the font
+ *      tracking entries. See the definition of
+ *      ATSUVerticalCharacterType for a list of possible values.
+ *    
+ *    oTrackingCount:
+ *      On return, the number of entries in the font tracking table
+ *      corresponding to the given ATSUI font ID and glyph orientation.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCountFontTracking( iFontID: ATSUFontID; iCharacterOrientation: ATSUVerticalCharacterType; var oTrackingCount: ItemCount ): OSStatus; external name '_ATSUCountFontTracking';
+
+
+{
+ *  ATSUGetIndFontTracking()
+ *  
+ *  Summary:
+ *    Obtains the name code and tracking value for the font tracking
+ *    that matches an ASTUI font ID, glyph orientation, and tracking
+ *    table index.
+ *  
+ *  Discussion:
+ *    You can call the ATSUGetIndFontTracking function to obtain the
+ *    name code and tracking value that matches the specified ATSUI
+ *    font ID, glyph orientation, and tracking table index value. This
+ *    information allows you to manipulate tracking settings for a
+ *    style using this font via the kATSUTrackingTag attribute. You can
+ *    use the function ATSUFindFontName to obtain the localized name
+ *    string for the name code produced by ATSUGetIndFontTracking.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain tracking information.
+ *    
+ *    iCharacterOrientation:
+ *      A constant identifying the glyph orientation of the font
+ *      tracking entries. See the definition of
+ *      ATSUVerticalCharacterType for a list of possible values.
+ *    
+ *    iTrackIndex:
+ *      An index to the font tracking for which to obtain information.
+ *      Because this index must be 0-based, you should pass a value
+ *      between 0 and one less than the count produced by the function
+ *      ATSUCountFontTracking.
+ *    
+ *    oFontTrackingValue:
+ *      On return, the value contains the font tracking value.
+ *    
+ *    oNameCode:
+ *      On return, the value contains the name code for the font
+ *      tracking. See the SFNTTypes.h header file for a definition of
+ *      the FontNameCode type and a list of possible values.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetIndFontTracking( iFontID: ATSUFontID; iCharacterOrientation: ATSUVerticalCharacterType; iTrackIndex: ItemCount; var oFontTrackingValue: Fixed; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetIndFontTracking';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font variations                                                             }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCountFontVariations()
+ *  
+ *  Summary:
+ *    Obtains the number of defined variation axes in a font.
+ *  
+ *  Discussion:
+ *    This function function obtains the total number of variation axes
+ *    defined for a font. You can use the count produced by
+ *    ATSUCountFontVariations to get information about a specific font
+ *    variation axis from the function ATSUGetIndFontVariation.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain a count of variation axes.
+ *    
+ *    oVariationCount:
+ *      On return, a count of the number of variation axes defined for
+ *      the font.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCountFontVariations( iFontID: ATSUFontID; var oVariationCount: ItemCount ): OSStatus; external name '_ATSUCountFontVariations';
+
+
+{
+ *  ATSUGetIndFontVariation()
+ *  
+ *  Summary:
+ *    Obtains a variation axis and its value range for a font.
+ *  
+ *  Discussion:
+ *    By calling this function, you can obtain a variation axis and its
+ *    maximum, minimum, and default values for a font. If you supply
+ *    font variation axes and values to the function ATSUSetVariations,
+ *    you can change the appearance of a style object's font
+ *    accordingly. Note that while you may pass NULL for any of the
+ *    output parameters, at least one must be non-NULL or paramErr will
+ *    be returned.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      A font for which to obtain variation information for.
+ *    
+ *    iVariationIndex:
+ *      A value specifying an index into the array of variation axes
+ *      for the font. This index identifies the font variation axis to
+ *      examine. Because this index is zero-based, you must pass a
+ *      value between 0 and one less than the value produced in the
+ *      oVariationCount parameter of the function
+ *      ATSUCountFontVariations.
+ *    
+ *    oATSUFontVariationAxis:
+ *      On return, a four-character code identifying the font variation
+ *      axis corresponding to the specified index. can be NULL
+ *    
+ *    oMinimumValue:
+ *      On return, the variation axis minimum. can be NULL
+ *    
+ *    oMaximumValue:
+ *      On return, the variation axis maximum. can be NULL
+ *    
+ *    oDefaultValue:
+ *      On return, the variation axis default. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetIndFontVariation( iFontID: ATSUFontID; iVariationIndex: ItemCount; oATSUFontVariationAxis: ATSUFontVariationAxisPtr; oMinimumValue: ATSUFontVariationValuePtr; oMaximumValue: ATSUFontVariationValuePtr; oDefaultValue: ATSUFontVariationValuePtr ): OSStatus; external name '_ATSUGetIndFontVariation';
+
+
+{
+ *  ATSUGetFontVariationNameCode()
+ *  
+ *  Summary:
+ *    Obtains the name code for the font variation that matches an
+ *    ASTUI font ID and font variation axis.
+ *  
+ *  Discussion:
+ *    This function function obtains the name code for the font
+ *    variation that matches an ASTUI font ID and font variation axis
+ *    tag. You can use the function ATSUFindFontName to obtain the
+ *    localized name string for the name code produced by
+ *    ATSUGetFontVariationNameCode.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain a font variation name code.
+ *    
+ *    iAxis:
+ *      An ATSUFontVariationAxis value representing a valid variation
+ *      axis tag. To obtain a valid variation axis tag for a font, you
+ *      can call the functions ATSUGetIndFontVariation or
+ *      ATSUGetFontInstance.
+ *    
+ *    oNameCode:
+ *      On return, the value contains the name code for the font
+ *      variation. See the SFNTTypes.h header file for a definition of
+ *      the FontNameCode type and a list of possible values.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontVariationNameCode( iFontID: ATSUFontID; iAxis: ATSUFontVariationAxis; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetFontVariationNameCode';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Font Instances                                                              }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCountFontInstances()
+ *  
+ *  Summary:
+ *    Obtains the number of defined font instances in a font.
+ *  
+ *  Discussion:
+ *    This function obtains the total number of font instances defined
+ *    in a font. You can use an index value derived from this count to
+ *    get information about a specific font instance by calling the
+ *    function ATSUGetFontInstance.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain a count of defined instances.
+ *    
+ *    oInstances:
+ *      On return, the value specifies the number of font instances
+ *      defined for the font.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCountFontInstances( iFontID: ATSUFontID; var oInstances: ItemCount ): OSStatus; external name '_ATSUCountFontInstances';
+
+
+{
+ *  ATSUGetFontInstance()
+ *  
+ *  Summary:
+ *    Obtains the font variation axis values for a font instance.
+ *  
+ *  Discussion:
+ *    with a minimum value of 0.0, a default of 0.5, and a maximum of
+ *    1.0. Additionally, the variation axis 'wdth' is also defined for
+ *    the font, with a similar value range. The type designer can then
+ *    choose to declare a font instance for a set of specific values
+ *    within these axes, such as ÒDemiboldÓ for a value of 0.8 for the
+ *    'wght' axis and 0.5 for the 'wdth' axis. By calling the function
+ *    ATSUGetFontInstance , you can obtain the variation axis values
+ *    for a given index into an array of font instances. Typically you
+ *    use the function ATSUGetFontInstance by calling it twice, as
+ *    follows: (1) Pass the ID of the font to examine in the iFont
+ *    parameter, a valid pointer to an ItemCount value in the
+ *    oActualVariationCount parameter, NULL for the oAxes and oValues
+ *    parameters, and 0 for the other parameters. ATSUGetFontInstance
+ *    returns the size to use for the oAxes and oValues arrays in the
+ *    oActualVariationCount parameter. (2) Allocate enough space for
+ *    arrays of the returned size, then call the ATSUGetFontInstance
+ *    again, passing pointers to the arrays in the oAxes and oValues
+ *    parameters. On return, the arrays contain the font variation axes
+ *    and their corresponding values, respectively, for the font
+ *    instance.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain instance information.
+ *    
+ *    iFontInstanceIndex:
+ *      An index into an array of instances for the font. This index
+ *      identifies the font instance to examine. Because this index is
+ *      zero-based, you must pass a value between 0 and one less than
+ *      the value produced in the oInstances parameter of the function
+ *      ATSUCountFontInstances.
+ *    
+ *    iMaximumVariations:
+ *      The maximum number of font variation axes to obtain for the
+ *      font instance. Typically, this is equivalent to the number of
+ *      ATSUFontVariationAxis and ATSUFontVariationValue values for
+ *      which you have allocated memory in the oAxes and oValues
+ *      parameters, respectively. To determine this value, see the
+ *      Discussion.
+ *    
+ *    oAxes:
+ *      On return, the array contains tags identifying the font
+ *      variation axes that constitute the font instance. If you are
+ *      uncertain of how much memory to allocate for this array, see
+ *      the Discussion. can be NULL
+ *    
+ *    oValues:
+ *      On return, the array contains the defined values for the font
+ *      variation axes produced in the oAxes array. If you are
+ *      uncertain of how much memory to allocate for this array, see
+ *      the Discussion. can be NULL
+ *    
+ *    oActualVariationCount:
+ *      On return, the actual number of font variation axes that
+ *      constitute the font instance. This may be greater than the
+ *      value you passed in the iMaximumVariations parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontInstance( iFontID: ATSUFontID; iFontInstanceIndex: ItemCount; iMaximumVariations: ItemCount; oAxes: ATSUFontVariationAxisPtr; oValues: ATSUFontVariationValuePtr; var oActualVariationCount: ItemCount ): OSStatus; external name '_ATSUGetFontInstance';
+
+
+{
+ *  ATSUGetFontInstanceNameCode()
+ *  
+ *  Summary:
+ *    Obtains the name code for the font instance that matches an ASTUI
+ *    font ID and font instance index value.
+ *  
+ *  Discussion:
+ *    A font instance consists of a named set of values for each
+ *    variation axis in a font. The ATSUGetFontInstanceNameCode
+ *    function obtains the name code for the font instance that matches
+ *    an ASTUI font ID and font instance index value. You can use the
+ *    function ATSUFindFontName to obtain the localized name string for
+ *    the name code produced by ATSUGetFontInstanceNameCode. You can
+ *    obtain the font variation axis values for a font instance by
+ *    calling the function ATSUGetFontInstance.
+ *  
+ *  Parameters:
+ *    
+ *    iFontID:
+ *      The font for which to obtain a font instance name code.
+ *    
+ *    iInstanceIndex:
+ *      An index to the font instance for which to obtain a name code.
+ *      Because this index must be 0-based, you should pass a value
+ *      between 0 and one less than the count produced by the function
+ *      ATSUCountFontInstances.
+ *    
+ *    oNameCode:
+ *      On return, the name code for the font instance. See the
+ *      SFNTTypes.h header file for a definition of the FontNameCode
+ *      type and a list of possible values.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontInstanceNameCode( iFontID: ATSUFontID; iInstanceIndex: ItemCount; var oNameCode: FontNameCode ): OSStatus; external name '_ATSUGetFontInstanceNameCode';
+
+end.

+ 1046 - 0
packages/extra/univint/ATSUnicodeGlyphs.pas

@@ -0,0 +1,1046 @@
+{
+     File:       QD/ATSUnicodeGlyphs.h
+ 
+     Contains:   ATSUI glyph handling functions.
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeGlyphs;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ATSUnicodeTypes,TextCommon,ATSTypes;
+{$ALIGN MAC68K}
+
+{ ---------------------------------------------------------------------------- }
+{ ATSUI glyph metrics                                                          }
+{ ---------------------------------------------------------------------------- }
+
+
+{
+ *  ATSUGlyphGetIdealMetrics()
+ *  
+ *  Summary:
+ *    Obtains resolution-independent font metric information for glyphs
+ *    associated with a given style object.
+ *  
+ *  Discussion:
+ *    The advance width is the full horizontal width of the glyph as
+ *    measured from its origin to the origin of the next glyph on the
+ *    line, including the left-side and right-side bearings. For
+ *    vertical text, the advance height is the sum of the top-side
+ *    bearing, the bounding-box height, and the bottom-side bearing.
+ *    You can call the ATSUGlyphGetIdealMetrics function to obtain an
+ *    array of ATSGlyphIdealMetrics structures containing values for
+ *    the specified glyphs' advance and side bearings.
+ *    ATSUGlyphGetIdealMetrics can analyze both horizontal and vertical
+ *    text, automatically producing the appropriate bearing values
+ *    (oriented for width or height, respectively) for each. You should
+ *    call ATSUGlyphGetIdealMetrics to obtain resolution-independent
+ *    glyph metrics. To obtain device-adjusted (that is,
+ *    resolution-dependent) glyph metrics, call the function
+ *    ATSUGlyphGetScreenMetrics.
+ *  
+ *  Parameters:
+ *    
+ *    iATSUStyle:
+ *      A style referring to a font you wish to obtain glyph metrics
+ *      from.
+ *    
+ *    iNumOfGlyphs:
+ *      The number of glyph IDs you are passing in to be examined. This
+ *      value should be equal to the size of the array you are passing
+ *      in for the iGlyphIDs parameter.
+ *    
+ *    iGlyphIDs:
+ *      An array of glyph IDs referring to glyphs for which you wish to
+ *      obtain metrics.
+ *    
+ *    iInputOffset:
+ *      A ByteOffset value specifying the offset in bytes between glyph
+ *      IDs in the iGlyphIDs array.
+ *    
+ *    oIdealMetrics:
+ *      A pointer to memory you have allocated for an array of
+ *      ATSGlyphIdealMetrics structures. On return, each structure
+ *      contains advance and side-bearing values for a glyph. See
+ *      ATSTypes.h for more information regarding the
+ *      ATSGlyphIdealMetrics structure.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGlyphGetIdealMetrics( iATSUStyle: ATSUStyle; iNumOfGlyphs: ItemCount; iGlyphIDs: GlyphIDPtr; iInputOffset: ByteOffset; oIdealMetrics: ATSGlyphIdealMetricsPtr ): OSStatus; external name '_ATSUGlyphGetIdealMetrics';
+
+
+{
+ *  ATSUGlyphGetScreenMetrics()
+ *  
+ *  Summary:
+ *    Obtains device-adjusted font metric information for glyphs
+ *    associated with a given style object.
+ *  
+ *  Discussion:
+ *    You can call the ATSUGlyphGetScreenMetrics function to obtain an
+ *    array of ATSGlyphScreenMetrics structures containing values for
+ *    the specified glyphs' advance and side bearings, top left,
+ *    height, and width. You should call ATSUGlyphGetScreenMetrics to
+ *    obtain device-adjusted (that is, resolution-dependent) glyph
+ *    metrics. To obtain resolution-independent glyph metrics, call the
+ *    function ATSUGlyphGetIdealMetrics.
+ *  
+ *  Parameters:
+ *    
+ *    iATSUStyle:
+ *      A style referring to a font you wish to obtain glyph metrics
+ *      from.
+ *    
+ *    iNumOfGlyphs:
+ *      The number of glyph IDs you are passing in to be examined. This
+ *      value should be equal to the size of the array you are passing
+ *      in for the iGlyphIDs parameter.
+ *    
+ *    iGlyphIDs:
+ *      An array of glyph IDs referring to glyphs for which you wish to
+ *      obtain metrics.
+ *    
+ *    iInputOffset:
+ *      A ByteOffset value specifying the offset in bytes between glyph
+ *      IDs in the iGlyphIDs array.
+ *    
+ *    iForcingAntiAlias:
+ *      A Boolean value indicating whether anti-aliasing is forced for
+ *      the style object.
+ *    
+ *    iAntiAliasSwitch:
+ *      A Boolean value indicating whether anti-aliasing is currently
+ *      on or off.
+ *    
+ *    oScreenMetrics:
+ *      A pointer to memory you have allocated for an array of
+ *      ATSGlyphScreenMetrics structures. On return, each structure
+ *      contains advance and side-bearing values for a glyph. See
+ *      ATSTypes.h for more information regarding the
+ *      ATSGlyphScreenMetrics structure.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGlyphGetScreenMetrics( iATSUStyle: ATSUStyle; iNumOfGlyphs: ItemCount; iGlyphIDs: GlyphIDPtr; iInputOffset: ByteOffset; iForcingAntiAlias: Boolean; iAntiAliasSwitch: Boolean; oScreenMetrics: ATSGlyphScreenMetricsPtr ): OSStatus; external name '_ATSUGlyphGetScreenMetrics';
+
+
+{ ---------------------------------------------------------------------------- }
+{ ATSUI glyph curve access functions and callbacks                             }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUGetNativeCurveType()
+ *  
+ *  Summary:
+ *    Returns the native curve format for a specific font.
+ *  
+ *  Discussion:
+ *    Use this function to decide whether to call
+ *    ATSUGlyphGetQuadraticPaths or ATSUGlyphGetCubicPaths. Both
+ *    functions will return curves for all valid ATSUI fonts, but if
+ *    the curve type you request is not the native curve type of the
+ *    font, the curves you get back will be mathematically converted,
+ *    rather than native font data. See the definition of ATSCurveType
+ *    in ATSTypes.h for possible return values from this function.
+ *  
+ *  Parameters:
+ *    
+ *    iATSUStyle:
+ *      A style referencing a font for which you wish to obtain the
+ *      native curve type.
+ *    
+ *    oCurveType:
+ *      On return, a value indicating the native curve type of the font
+ *      referenced by iATSUStyle. See the definition of ATSCurveType in
+ *      ATSTypes.h for a list of possible return values for this
+ *      parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetNativeCurveType( iATSUStyle: ATSUStyle; var oCurveType: ATSCurveType ): OSStatus; external name '_ATSUGetNativeCurveType';
+
+
+{
+ *  ATSQuadraticNewPathProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to start a new drawing path.
+ *  
+ *  Parameters:
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetQuadraticPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetQuadraticPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSQuadraticNewPathProcPtr = function( callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSQuadraticNewPathProcPtr)              ATSQuadraticNewPathUPP;
+type ATSQuadraticNewPathUPP = Ptr;
+
+{
+ *  NewATSQuadraticNewPathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSQuadraticNewPathUPP( userRoutine: ATSQuadraticNewPathProcPtr ): ATSQuadraticNewPathUPP; external name '_NewATSQuadraticNewPathUPP';
+
+{
+ *  DisposeATSQuadraticNewPathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSQuadraticNewPathUPP( userUPP: ATSQuadraticNewPathUPP ); external name '_DisposeATSQuadraticNewPathUPP';
+
+{
+ *  InvokeATSQuadraticNewPathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSQuadraticNewPathUPP( callBackDataPtr: UnivPtr; userUPP: ATSQuadraticNewPathUPP ): OSStatus; external name '_InvokeATSQuadraticNewPathUPP';
+
+
+{
+ *  ATSQuadraticLineProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to draw straight lines.
+ *  
+ *  Parameters:
+ *    
+ *    pt1:
+ *      The starting point of the line.
+ *    
+ *    pt2:
+ *      The end point of the line.
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetQuadraticPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetQuadraticPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSQuadraticLineProcPtr = function( const (*var*) pt1, pt2: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSQuadraticLineProcPtr)                 ATSQuadraticLineUPP;
+type ATSQuadraticLineUPP = Ptr;
+{
+ *  NewATSQuadraticLineUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSQuadraticLineUPP( userRoutine: ATSQuadraticLineProcPtr ): ATSQuadraticLineUPP; external name '_NewATSQuadraticLineUPP';
+
+{
+ *  DisposeATSQuadraticLineUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSQuadraticLineUPP( userUPP: ATSQuadraticLineUPP ); external name '_DisposeATSQuadraticLineUPP';
+
+{
+ *  InvokeATSQuadraticLineUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSQuadraticLineUPP( const (*var*) pt1, pt2: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSQuadraticLineUPP ): OSStatus; external name '_InvokeATSQuadraticLineUPP';
+
+
+{
+ *  ATSQuadraticCurveProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to draw curves. The curve is a quadratic patch specified by a
+ *    start point (pt1), and end point (pt2), and a single control
+ *    point (controlPt).
+ *  
+ *  Parameters:
+ *    
+ *    pt1:
+ *      The starting point of the curve.
+ *    
+ *    controlPt:
+ *      The off-curve control point.
+ *    
+ *    pt2:
+ *      The end point of the curve.
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetQuadraticPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetQuadraticPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSQuadraticCurveProcPtr = function( const (*var*) pt1, controlPt, pt2: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSQuadraticCurveProcPtr)                ATSQuadraticCurveUPP;
+type ATSQuadraticCurveUPP = Ptr;
+{
+ *  NewATSQuadraticCurveUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSQuadraticCurveUPP( userRoutine: ATSQuadraticCurveProcPtr ): ATSQuadraticCurveUPP; external name '_NewATSQuadraticCurveUPP';
+
+{
+ *  DisposeATSQuadraticCurveUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSQuadraticCurveUPP( userUPP: ATSQuadraticCurveUPP ); external name '_DisposeATSQuadraticCurveUPP';
+
+{
+ *  InvokeATSQuadraticCurveUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSQuadraticCurveUPP( const (*var*) pt1, controlPt, pt2: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSQuadraticCurveUPP ): OSStatus; external name '_InvokeATSQuadraticCurveUPP';
+
+
+{
+ *  ATSQuadraticClosePathProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to close the current drawing path.
+ *  
+ *  Parameters:
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetQuadraticPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetQuadraticPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSQuadraticClosePathProcPtr = function( callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSQuadraticClosePathProcPtr)            ATSQuadraticClosePathUPP;
+type ATSQuadraticClosePathUPP = Ptr;
+{
+ *  NewATSQuadraticClosePathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSQuadraticClosePathUPP( userRoutine: ATSQuadraticClosePathProcPtr ): ATSQuadraticClosePathUPP; external name '_NewATSQuadraticClosePathUPP';
+
+{
+ *  DisposeATSQuadraticClosePathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSQuadraticClosePathUPP( userUPP: ATSQuadraticClosePathUPP ); external name '_DisposeATSQuadraticClosePathUPP';
+
+{
+ *  InvokeATSQuadraticClosePathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSQuadraticClosePathUPP( callBackDataPtr: UnivPtr; userUPP: ATSQuadraticClosePathUPP ): OSStatus; external name '_InvokeATSQuadraticClosePathUPP';
+
+{
+ *  ATSUGlyphGetQuadraticPaths()
+ *  
+ *  Summary:
+ *    Uses a callback mechanism to obtain a set of Quadratic outlines
+ *    for a specified glyph in a specified font.
+ *  
+ *  Discussion:
+ *    This function will allow you to use callbacks to obtain the exact
+ *    outline of a specified glyph, in quadratic form. Although this
+ *    function will always return results for any valid ATSUI font, you
+ *    should first use the function ATSUGetNativeCurveType to determine
+ *    the native format of the glyph you are interested in. Then,
+ *    either call ATSUGlyphGetQuadraticPaths or ATSUGlyphGetCubicPaths
+ *    based on the result. Otherwise, you may end up with curves that
+ *    are mathematically converted from cubic to quadratic (or vice
+ *    versa), instead of getting native font data. See the definitions
+ *    of ATSQuadraticNewPathProcPtr, ATSQuadraticLineProcPtr,
+ *    ATSQuadraticCurveProcPtr, and ATSQuadraticClosePathProcPtr for
+ *    more information about setting up the callbacks.
+ *  
+ *  Parameters:
+ *    
+ *    iATSUStyle:
+ *      A style referring to a font you wish to obtain a set of glyph
+ *      outlines from.
+ *    
+ *    iGlyphID:
+ *      A ID number referring to the glyph for which you wish to obtain
+ *      outline data. Use the ATSUI direct access functions in
+ *      ATSUnicodeDirectAccess.h to obtain values to pass for this
+ *      parameter.
+ *    
+ *    iNewPathProc:
+ *      A pointer to a callback function for quadratic new path
+ *      operations. See the definition of ATSQuadraticNewPathProcPtr
+ *      for more information about creating, disposing, and invoking
+ *      this type of Universal Procedure Pointer.
+ *    
+ *    iLineProc:
+ *      A pointer to a callback function for quadratic LineTo
+ *      operations. See the definition of ATSQuadraticLineProcPtr for
+ *      more information about creating, disposing, and invoking this
+ *      type of Universal Procedure Pointer.
+ *    
+ *    iCurveProc:
+ *      A pointer to a callback function for quadratic curve
+ *      operations. See the definition of ATSQuadraticCurveProcPtr for
+ *      more information about creating, disposing, and invoking this
+ *      type of Universal Procedure Pointer.
+ *    
+ *    iClosePathProc:
+ *      A pointer to a callback function for quadratic close path
+ *      operations. See the definition of ATSQuadraticClosePathProcPtr
+ *      for more information about creating, disposing, and invoking
+ *      this type of Universal Procedure Pointer.
+ *    
+ *    iCallbackDataPtr:
+ *      Any valid pointer. Any application specific data you wish to
+ *      pass to your callbacks may be sent through this parameter.
+ *    
+ *    oCallbackResult:
+ *      On return, status returned by callback functions. If an error
+ *      occurs, callbacks may communicate it through this parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGlyphGetQuadraticPaths( iATSUStyle: ATSUStyle; iGlyphID: GlyphID; iNewPathProc: ATSQuadraticNewPathUPP; iLineProc: ATSQuadraticLineUPP; iCurveProc: ATSQuadraticCurveUPP; iClosePathProc: ATSQuadraticClosePathUPP; iCallbackDataPtr: UnivPtr; var oCallbackResult: OSStatus ): OSStatus; external name '_ATSUGlyphGetQuadraticPaths';
+
+
+{
+ *  ATSCubicMoveToProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to move the current pen location.
+ *  
+ *  Parameters:
+ *    
+ *    pt:
+ *      The point to which to move the current pen location.
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetCubicPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetCubicPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSCubicMoveToProcPtr = function( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSCubicMoveToProcPtr)                   ATSCubicMoveToUPP;
+type ATSCubicMoveToUPP = Ptr;
+{
+ *  NewATSCubicMoveToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSCubicMoveToUPP( userRoutine: ATSCubicMoveToProcPtr ): ATSCubicMoveToUPP; external name '_NewATSCubicMoveToUPP';
+
+{
+ *  DisposeATSCubicMoveToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSCubicMoveToUPP( userUPP: ATSCubicMoveToUPP ); external name '_DisposeATSCubicMoveToUPP';
+
+{
+ *  InvokeATSCubicMoveToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSCubicMoveToUPP( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSCubicMoveToUPP ): OSStatus; external name '_InvokeATSCubicMoveToUPP';
+
+
+{
+ *  ATSCubicLineToProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to draw straight lines.
+ *  
+ *  Parameters:
+ *    
+ *    pt:
+ *      The end point of the line to be drawn. The starting point is
+ *      whatever the current pen position is.
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetCubicPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetCubicPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSCubicLineToProcPtr = function( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSCubicLineToProcPtr)                   ATSCubicLineToUPP;
+type ATSCubicLineToUPP = Ptr;
+{
+ *  NewATSCubicLineToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSCubicLineToUPP( userRoutine: ATSCubicLineToProcPtr ): ATSCubicLineToUPP; external name '_NewATSCubicLineToUPP';
+
+{
+ *  DisposeATSCubicLineToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSCubicLineToUPP( userUPP: ATSCubicLineToUPP ); external name '_DisposeATSCubicLineToUPP';
+
+{
+ *  InvokeATSCubicLineToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSCubicLineToUPP( const (*var*) pt: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSCubicLineToUPP ): OSStatus; external name '_InvokeATSCubicLineToUPP';
+
+
+{
+ *  ATSCubicCurveToProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to draw a curve. The curve is a Bezier patch defined by two
+ *    off-curve control points (pt1 and pt2), and an endpoint (pt3).
+ *    The starting point is whatever the current pen position is.
+ *  
+ *  Parameters:
+ *    
+ *    pt1:
+ *      The first off-curve control point.
+ *    
+ *    pt2:
+ *      The second off-curve control point.
+ *    
+ *    pt3:
+ *      The end point of the curve.
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetCubicPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetCubicPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSCubicCurveToProcPtr = function( const (*var*) pt, pt2, pt3: Float32Point; callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSCubicCurveToProcPtr)                  ATSCubicCurveToUPP;
+type ATSCubicCurveToUPP = Ptr;
+{
+ *  NewATSCubicCurveToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSCubicCurveToUPP( userRoutine: ATSCubicCurveToProcPtr ): ATSCubicCurveToUPP; external name '_NewATSCubicCurveToUPP';
+
+{
+ *  DisposeATSCubicCurveToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSCubicCurveToUPP( userUPP: ATSCubicCurveToUPP ); external name '_DisposeATSCubicCurveToUPP';
+
+{
+ *  InvokeATSCubicCurveToUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSCubicCurveToUPP( const (*var*) pt, pt2, pt3: Float32Point; callBackDataPtr: UnivPtr; userUPP: ATSCubicCurveToUPP ): OSStatus; external name '_InvokeATSCubicCurveToUPP';
+
+
+{
+ *  ATSCubicClosePathProcPtr
+ *  
+ *  Discussion:
+ *    A pointer to a client supplied callback function for handling
+ *    glyph curve drawing operations. This callback handles operations
+ *    to close the current drawing path.
+ *  
+ *  Parameters:
+ *    
+ *    callBackDataPtr:
+ *      A pointer to any application specific data that may have been
+ *      passed to the callbacks through the iCallbackDataPtr parameter
+ *      of the ATSUGlyphGetCubicPaths function.
+ *  
+ *  Result:
+ *    Return status. Pass any errors you wish to propagate back to the
+ *    original caller of ATSUGlyphGetCubicPaths through this return
+ *    value. Note that any nonzero result from this callback will halt
+ *    the curve drawing process.
+ }
+type ATSCubicClosePathProcPtr = function( callBackDataPtr: UnivPtr ): OSStatus;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+// typedef STACK_UPP_TYPE(ATSCubicClosePathProcPtr)                ATSCubicClosePathUPP;
+type ATSCubicClosePathUPP = Ptr;
+{
+ *  NewATSCubicClosePathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewATSCubicClosePathUPP( userRoutine: ATSCubicClosePathProcPtr ): ATSCubicClosePathUPP; external name '_NewATSCubicClosePathUPP';
+
+{
+ *  DisposeATSCubicClosePathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeATSCubicClosePathUPP( userUPP: ATSCubicClosePathUPP ); external name '_DisposeATSCubicClosePathUPP';
+
+{
+ *  InvokeATSCubicClosePathUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeATSCubicClosePathUPP( callBackDataPtr: UnivPtr; userUPP: ATSCubicClosePathUPP ): OSStatus; external name '_InvokeATSCubicClosePathUPP';
+
+{
+ *  ATSUGlyphGetCubicPaths()
+ *  
+ *  Summary:
+ *    Uses a callback mechanism to obtain a set of Cubic outlines for a
+ *    specified glyph in a specified font.
+ *  
+ *  Discussion:
+ *    This function will allow you to use callbacks to obtain the exact
+ *    outline of a specified glyph, in cubic form. Although this
+ *    function will always return results for any valid ATSUI font, you
+ *    should first use the function ATSUGetNativeCurveType to determine
+ *    the native format of the glyph you are interested in. Then,
+ *    either call ATSUGlyphGetQuadraticPaths or ATSUGlyphGetCubicPaths
+ *    based on the result. Otherwise, you may end up with curves that
+ *    are mathematically converted from quadratic to cubic (or vice
+ *    versa), instead of getting native font data. See the definitions
+ *    of ATSCubicMoveToProcPtr, ATSCubicLineToProcPtr,
+ *    ATSCubicCurveToProcPtr, and ATSCubicClosePathProcPtr for more
+ *    information about setting up the callbacks.
+ *  
+ *  Parameters:
+ *    
+ *    iATSUStyle:
+ *      A style referring to a font you wish to obtain a set of glyph
+ *      outlines from.
+ *    
+ *    iGlyphID:
+ *      A ID number referring to the glyph for which you wish to obtain
+ *      outline data. Use the ATSUI direct access functions in
+ *      ATSUnicodeDirectAccess.h to obtain values to pass for this
+ *      parameter.
+ *    
+ *    iMoveToProc:
+ *      A pointer to a callback function for cubic MoveTo operations.
+ *      See the definition of ATSCubicMoveToProcPtr for more
+ *      information about creating, disposing, and invoking this type
+ *      of Universal Procedure Pointer.
+ *    
+ *    iLineToProc:
+ *      A pointer to a callback function for cubic LineTo operations.
+ *      See the definition of ATSCubicLineToProcPtr for more
+ *      information about creating, disposing, and invoking this type
+ *      of Universal Procedure Pointer.
+ *    
+ *    iCurveToProc:
+ *      A pointer to a callback function for cubic CurveTo operations.
+ *      See the definition of ATSCubicCurveToProcPtr for more
+ *      information about creating, disposing, and invoking this type
+ *      of Universal Procedure Pointer.
+ *    
+ *    iClosePathProc:
+ *      A pointer to a callback function for cubic MoveTo operations.
+ *      See the definition of ATSCubicClosePathProcPtr for more
+ *      information about creating, disposing, and invoking this type
+ *      of Universal Procedure Pointer.
+ *    
+ *    iCallbackDataPtr:
+ *      Any valid pointer. Any application specific data you wish to
+ *      pass to your callbacks may be sent through this parameter. can be NULL
+ *    
+ *    oCallbackResult:
+ *      On return, status returned by callback functions. If an error
+ *      occurs, callbacks may communicate it through this parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGlyphGetCubicPaths( iATSUStyle: ATSUStyle; iGlyphID: GlyphID; iMoveToProc: ATSCubicMoveToUPP; iLineToProc: ATSCubicLineToUPP; iCurveToProc: ATSCubicCurveToUPP; iClosePathProc: ATSCubicClosePathUPP; iCallbackDataPtr: UnivPtr; var oCallbackResult: OSStatus ): OSStatus; external name '_ATSUGlyphGetCubicPaths';
+
+
+{
+ *  ATSUGlyphGetCurvePaths()
+ *  
+ *  Summary:
+ *    Obtains glyph curve data without the use of callbacks.
+ *  
+ *  Discussion:
+ *    This function will return glyph curve data in a single data
+ *    structure rather than through the use of callbacks, but you must
+ *    parse the data structure yourself. ATSUGlyphGetCubicPaths and
+ *    ATSUGlyphGetQuadraticPaths will parse the glyph data for you and
+ *    use the callbacks you provide them to give you access to the
+ *    individual points on the curves. Typically you use the function
+ *    ATSUGlyphGetCurvePaths by calling it twice, as follows: (1) Pass
+ *    a valid style and glyphID into the iATSUStyle and iGlyphID
+ *    parameters, respectively, 0 for the ioBufferSize parameter, and
+ *    NULL for the oPaths parameter. ATSUGlyphGetCurvePaths returns the
+ *    size to use for the oPaths array in the ioBufferSize parameter.
+ *    (2) Allocate enough space an array of the returned size, then
+ *    call the ATSUGlyphGetCurvePaths again, passing a pointer to the
+ *    array in the oPaths parameter. On return, the array contains the
+ *    glyph outline data.
+ *  
+ *  Parameters:
+ *    
+ *    iATSUStyle:
+ *      A style referring to a font you wish to obtain a set of glyph
+ *      outlines from.
+ *    
+ *    iGlyphID:
+ *      A ID number referring to the glyph for which you wish to obtain
+ *      outline data. Use the ATSUI direct access functions in
+ *      ATSUnicodeDirectAccess.h to obtain values to pass for this
+ *      parameter.
+ *    
+ *    ioBufferSize:
+ *      On input, the size of the buffer you have allocated for the
+ *      oPaths parameter. On return, the actual size of the data
+ *      structure that has been copied into the oPaths parameter.
+ *    
+ *    oPaths:
+ *      On return, a data structure containing glyph outline
+ *      information. See ATSTypes.h for a definition of this data
+ *      structure. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGlyphGetCurvePaths( iATSUStyle: ATSUStyle; iGlyphID: GlyphID; ioBufferSize: ByteCountPtr; oPaths: ATSUCurvePathsPtr ): OSStatus; external name '_ATSUGlyphGetCurvePaths';
+
+
+{ Functions listed beyond this point are either deprecated or not recommended }
+
+{ ---------------------------------------------------------------------------- }
+{ ATSUI glyphInfo access (deprecated)                                          }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUGetGlyphInfo()
+ *  
+ *  Summary:
+ *    Obtains a copy of the style and layout information for each glyph
+ *    in a line.
+ *  
+ *  Discussion:
+ *    Please see ATSUnicodeDirectAccess.h for replacement functions.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetGlyphInfo( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iLineLength: UniCharCount; ioBufferSize: ByteCountPtr; oGlyphInfoPtr: ATSUGlyphInfoArrayPtr ): OSStatus; external name '_ATSUGetGlyphInfo';
+
+
+{
+ *  ATSUDrawGlyphInfo()
+ *  
+ *  Summary:
+ *    Draws glyphs at the specified location, based on style and layout
+ *    information specified for each glyph.
+ *  
+ *  Discussion:
+ *    Please see ATSUnicodeDirectAccess.h for replacement functions.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 9.1 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUDrawGlyphInfo( iGlyphInfoArray: ATSUGlyphInfoArrayPtr; iLocation: Float32Point ): OSStatus; external name '_ATSUDrawGlyphInfo';
+
+end.

+ 2866 - 0
packages/extra/univint/ATSUnicodeObjects.pas

@@ -0,0 +1,2866 @@
+{
+     File:       QD/ATSUnicodeObjects.h
+ 
+     Contains:   ATSUI object manipulation functions.
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeObjects;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ATSUnicodeTypes,TextCommon,SFNTLayoutTypes;
+{$ALIGN MAC68K}
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI basic style functions                                                 }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUCreateStyle()
+ *  
+ *  Summary:
+ *    Creates an ATSUStyle object with default settings.
+ *  
+ *  Discussion:
+ *    ATSUStyle objects created by this function have a default set of
+ *    values for all attributes. The attributes include settings such
+ *    as font, point size, color and so on. You can change the
+ *    attributes of a style object by calling the function
+ *    ATSUSetAttributes. You can also change font features and
+ *    variations set in an ATSUStyle by calling the functions
+ *    ATSUSetFontFeatures and ATSUSetVariations, respectively.
+ *    ATSUStyle objects are used by associating them with a run of
+ *    characters in an ATSUTextLayout object. You can do this by
+ *    calling functions such as ATSUSetRunStyle or
+ *    ATSUCreateTextLayoutWithTextPtr. You are responsible for freeing
+ *    memory assoicated with an ATSUStyle object by calling
+ *    ATSUDisposeStyle.
+ *  
+ *  Parameters:
+ *    
+ *    oStyle:
+ *      On return, a reference to an ATSUStyle object with default
+ *      settings.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCreateStyle( var oStyle: ATSUStyle ): OSStatus; external name '_ATSUCreateStyle';
+
+
+{
+ *  ATSUCreateAndCopyStyle()
+ *  
+ *  Summary:
+ *    Creates a new ATSUStyle object with the same attributes, font
+ *    features, and font variation settings as the input style.
+ *  
+ *  Discussion:
+ *    All attributes, font features, and font variation settings of the
+ *    input ATSUStyle object are copied over to a newly created
+ *    ATSUStyle object. Note that reference constants are not copied.
+ *    You are responsible for freeing memory assoicated with the
+ *    returned ATSUStyle object by calling ATSUDisposeStyle.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The ATSUStyle object you want to copy.
+ *    
+ *    oStyle:
+ *      On return, a newly created ATSUStyle object. This will be an
+ *      exact copy of iStyle, except for the reference constant (if
+ *      set).
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCreateAndCopyStyle( iStyle: ATSUStyle; var oStyle: ATSUStyle ): OSStatus; external name '_ATSUCreateAndCopyStyle';
+
+
+{
+ *  ATSUDisposeStyle()
+ *  
+ *  Summary:
+ *    Disposes of the memory associated with a style object.
+ *  
+ *  Discussion:
+ *    The ATSUDisposeStyle function frees the memory associated with
+ *    the specified style object and its internal structures, including
+ *    style run attributes. It does not dispose of the memory pointed
+ *    to by application-defined style run attributes or reference
+ *    constants. You are responsible for doing so. You should call this
+ *    function after calling the function ATSUDisposeTextLayout to
+ *    dispose of any text layout objects associated with the style
+ *    object. For best performance, once you create a style object, you
+ *    should keep it and use it as often as needed. You should dispose
+ *    of the style object only when it is no longer needed in your
+ *    application.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style you want to dispose of.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUDisposeStyle( iStyle: ATSUStyle ): OSStatus; external name '_ATSUDisposeStyle';
+
+
+{
+ *  ATSUSetStyleRefCon()
+ *  
+ *  Summary:
+ *    Sets a reference constant for an ATSUStyle object.
+ *  
+ *  Discussion:
+ *    Reference constants are any 32-bit value you wish to associate
+ *    with an object. It can be a pointer to application-specific data,
+ *    a SInt16 value, or anything you like. If you copy or clear a
+ *    style object that contains a reference constant, the reference
+ *    constant is neither copied nor removed. To obtain the reference
+ *    constant for a particular ATSUStyle object after it has been set,
+ *    use the function ATSUGetStyleRefCon.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      An ATSUStyle object you want to set the reference constant for.
+ *    
+ *    iRefCon:
+ *      Any arbitrary 32-bit value containing or referring to
+ *      application-specific data.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetStyleRefCon( iStyle: ATSUStyle; iRefCon: UInt32 ): OSStatus; external name '_ATSUSetStyleRefCon';
+
+
+{
+ *  ATSUGetStyleRefCon()
+ *  
+ *  Summary:
+ *    Returns the reference constant for an ATSUStyle object.
+ *  
+ *  Discussion:
+ *    Together with ATSUSetStyleRefCon, this function provides a
+ *    mechanism for keeping application-specific data associated with
+ *    ATSUStyle objects. Note that if an ATSUStyle object is copied or
+ *    cleared, its associated reference constant, if any, is not copied
+ *    or cleared.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style object for which to obtain application-specific data.
+ *    
+ *    oRefCon:
+ *      On return, the reference constant for iStyle.
+ *  
+ *  Result:
+ *    On success, noErr is returned. If no reference constant is set in
+ *    iStyle, paramErr is returned. See MacErrors.h for other possible
+ *    error codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetStyleRefCon( iStyle: ATSUStyle; var oRefCon: UInt32 ): OSStatus; external name '_ATSUGetStyleRefCon';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI style comparison                                                      }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCompareStyles()
+ *  
+ *  Summary:
+ *    Compares two ATSUStyleObjects.
+ *  
+ *  Discussion:
+ *    The ATSUCompareStyles function compares the contents of two style
+ *    objects, including their style attributes, font features, and
+ *    font variations. It does not consider reference constants or
+ *    application-defined style attributes in the comparison. Note that
+ *    order is important, as the ATSUStyleComparison constants that can
+ *    be returned indicate "contains" vs. "contained by" based on which
+ *    style is considered first in the comparsion.
+ *  
+ *  Parameters:
+ *    
+ *    iFirstStyle:
+ *      The first style to be compared.
+ *    
+ *    iSecondStyle:
+ *      The second style to be compared.
+ *    
+ *    oComparison:
+ *      On return, the value contains the results of the comparison and
+ *      indicates whether the two style objects are the same,
+ *      different, or if one is a subset of the other. See the
+ *      definition of the ATSUStyleComparison type for more information
+ *      on possible values returned for this parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCompareStyles( iFirstStyle: ATSUStyle; iSecondStyle: ATSUStyle; var oComparison: ATSUStyleComparison ): OSStatus; external name '_ATSUCompareStyles';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI style attribute manipulation                                          }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCopyAttributes()
+ *  
+ *  Summary:
+ *    Copies attributes from one style to another.
+ *  
+ *  Discussion:
+ *    There are three types of settings in a style: attributes, font
+ *    features, and font variations. This function copies only the
+ *    first. To copy all three types of settings, use the function
+ *    ATSUCreateAndCopyStyle. Also note that this function does not
+ *    copy reference constants.
+ *  
+ *  Parameters:
+ *    
+ *    iSourceStyle:
+ *      The style whose attributes you are copying from.
+ *    
+ *    iDestinationStyle:
+ *      The style whose attributes you are copying to.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCopyAttributes( iSourceStyle: ATSUStyle; iDestinationStyle: ATSUStyle ): OSStatus; external name '_ATSUCopyAttributes';
+
+
+{
+ *  ATSUOverwriteAttributes()
+ *  
+ *  Summary:
+ *    Copies to a destination style object the nondefault style
+ *    attribute settings of a source style object.
+ *  
+ *  Discussion:
+ *    The ATSUOverwriteAttributes function copies all nondefault style
+ *    attribute values from a source style object to a destination
+ *    style object. The source object's nondefault values are applied
+ *    to the destination object whether or not the destination object
+ *    also has nondefault values for the copied attributes. All other
+ *    settings in the destination style object are left unchanged.
+ *    ATSUOverwriteAttributes does not copy the contents of memory
+ *    referenced by pointers within custom style attributes or within
+ *    reference constants. You are responsible for ensuring that this
+ *    memory remains valid until both the source and destination style
+ *    objects are disposed of. To create a style object that contains
+ *    all the contents of another style object, call the function
+ *    ATSUCreateAndCopyStyle. To copy all the style attributes
+ *    (including any default settings) of a style object into an
+ *    existing style object, call the function ATSUCopyAttributes. To
+ *    copy style attributes that are set in the source but not in the
+ *    destination style object, call the function
+ *    ATSUUnderwriteAttributes.
+ *  
+ *  Parameters:
+ *    
+ *    iSourceStyle:
+ *      An ATSUStyle value specifying the style object from which to
+ *      copy nondefault style attributes.
+ *    
+ *    iDestinationStyle:
+ *      An ATSUStyle value specifying the style object containing the
+ *      style attributes to be overwritten.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUOverwriteAttributes( iSourceStyle: ATSUStyle; iDestinationStyle: ATSUStyle ): OSStatus; external name '_ATSUOverwriteAttributes';
+
+
+{
+ *  ATSUUnderwriteAttributes()
+ *  
+ *  Summary:
+ *    Copies to a destination style object only those nondefault style
+ *    attribute settings of a source style object that are at default
+ *    settings in the destination object.
+ *  
+ *  Discussion:
+ *    The ATSUUnderwriteAttributes function copies to a destination
+ *    style object only those nondefault style attribute values of a
+ *    source style object that are not currently set in a destination
+ *    style object. Note that the corresponding value in the
+ *    destination object must not be set in order for a copied value to
+ *    be applied. All other quantities in the destination style object
+ *    are left unchanged. ATSUUnderwriteAttributes does not copy the
+ *    contents of memory referenced by pointers within custom style
+ *    attributes or within reference constants. You are responsible for
+ *    ensuring that this memory remains valid until both the source and
+ *    destination style objects are disposed of. To create a style
+ *    object that contains all the contents of another style object,
+ *    call the function ATSUCreateAndCopyStyle. To copy all the style
+ *    attributes (including any default settings) of a style object
+ *    into an existing style object, call the function
+ *    ATSUCopyAttributes. To copy style attributes that are set in the
+ *    source whether or not they are set in the destination style
+ *    object, call the function ATSUOverwriteAttributes.
+ *  
+ *  Parameters:
+ *    
+ *    iSourceStyle:
+ *      An ATSUStyle value specifying the style object from which to
+ *      copy nondefault style attributes.
+ *    
+ *    iDestinationStyle:
+ *      An ATSUStyle value specifying the style object containing style
+ *      attribute values to be set.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUUnderwriteAttributes( iSourceStyle: ATSUStyle; iDestinationStyle: ATSUStyle ): OSStatus; external name '_ATSUUnderwriteAttributes';
+
+
+{ ---------------------------------------------------------------------------- }
+{  Empty ATSUI styles                                                          }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUClearStyle()
+ *  
+ *  Summary:
+ *    Restores default values to a style object.
+ *  
+ *  Discussion:
+ *    Clears a style object of all style attributes (including any
+ *    application-defined attributes), font features, and font
+ *    variations and returns these values to their default settings. To
+ *    clear attributes, font features, or font variations individually,
+ *    use the functions ATSUClearAttributes, ATSUClearFontVariations,
+ *    or ATSUClearFontFeatures, respectively. Note that ATSUClearStyle
+ *    does not affect Reference constants.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style to be cleared.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearStyle( iStyle: ATSUStyle ): OSStatus; external name '_ATSUClearStyle';
+
+
+{
+ *  ATSUStyleIsEmpty()
+ *  
+ *  Summary:
+ *    Indicates whether a style object contains only default values.
+ *  
+ *  Discussion:
+ *    You can call the ATSUStyleIsEmpty function to determine whether a
+ *    style object contains only default values for style attributes,
+ *    font features, and font variations. ATSUStyleIsEmpty does not
+ *    consider reference constants in its evaluation.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      An ATSUStyle value specifying the style object to examine.
+ *    
+ *    oIsClear:
+ *      On return, the value is set to true if the style object
+ *      contains only default values for style attributes, font
+ *      features, and font variations. If false , the style object
+ *      contains one or more nondefault values for style attributes,
+ *      font features, or font variations. Reference constants do not
+ *      affect this result.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUStyleIsEmpty( iStyle: ATSUStyle; var oIsClear: Boolean ): OSStatus; external name '_ATSUStyleIsEmpty';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI style attribute getters and setters                                   }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCalculateBaselineDeltas()
+ *  
+ *  Summary:
+ *    Obtains the optimal baseline positions for glyphs in a style run.
+ *  
+ *  Discussion:
+ *    Depending on the writing system, a baseline may be above, below,
+ *    or through the centers of glyphs. In general, a style run has a
+ *    default baseline, to which all glyphs are visually aligned when
+ *    the text is laid out. For example, in a run of Roman text, the
+ *    default baseline is the Roman baseline, upon which glyphs sit
+ *    (except for descenders, which extend below the baseline). You can
+ *    call the ATSUCalculateBaselineDeltas function to obtain the
+ *    distances from a specified baseline type to that of other
+ *    baseline types for a given style object.
+ *    ATSUCalculateBaselineDeltas takes into account font and text size
+ *    when performing these calculations. ATSUI uses these distances to
+ *    determine the cross-stream shifting to apply when aligning glyphs
+ *    in a style run. You can use the resulting array to set or obtain
+ *    the optimal baseline positions of glyphs in a style run. You can
+ *    also set various baseline values to create special effects such
+ *    as drop capitals. The functions ATSUSetLineControls and
+ *    ATSUSetLayoutControls allow you to set baseline offset values at
+ *    the line or layout level, respectively, using the
+ *    kATSULineBaselineValuesTag control attribute tag.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      An ATSUStyle value specifying the style object to examine.
+ *    
+ *    iBaselineClass:
+ *      A BslnBaselineClass constant identifying the primary baseline
+ *      from which to measure other baselines. See SFNTLayoutTypes.h
+ *      for an enumeration of possible values. Pass the constant
+ *      kBSLNNoBaselineOverride to use the standard baseline value from
+ *      the current font.
+ *    
+ *    oBaselineDeltas:
+ *      On return, an array that contains baseline offsets, specifying
+ *      distances measured in points, from the default baseline to each
+ *      of the other baseline types in the style object. Positive
+ *      values indicate baselines above the default baseline and
+ *      negative values indicate baselines below it. See
+ *      SFNTLayoutTypes.h for a description of the BslnBaselineRecord
+ *      type.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCalculateBaselineDeltas( iStyle: ATSUStyle; iBaselineClass: BslnBaselineClass; oBaselineDeltas: BslnBaselineRecord ): OSStatus; external name '_ATSUCalculateBaselineDeltas';
+
+
+{
+ *  ATSUSetAttributes()
+ *  
+ *  Summary:
+ *    Sets style attribute values in a style object.
+ *  
+ *  Discussion:
+ *    Style attributes are a collection of values and settings that
+ *    specify information about a style such as font, point size, and
+ *    color. To specify a style attribute, ATSUI uses a "triple"
+ *    consisting of (1) an attribute tag, (2) a value for that tag, and
+ *    (3) the size of the value. For a list of possible tags and their
+ *    default values, see the ATSUI documentation, or the definition of
+ *    ATSUAttributeTag elsewhere in this header file. When you call
+ *    ATSUSetAttributes, any style attributes that you do not set
+ *    retain their previous values. To set font features and font
+ *    variations, call the functions ATSUSetFontFeatures and
+ *    ATSUSetVariations, respectively.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      A style in which to set attributes.
+ *    
+ *    iAttributeCount:
+ *      An ItemCount value specifying the number of attributes to set.
+ *      This value should correspond to the number of elements in the
+ *      iTag, iValueSize, and iValue arrays.
+ *    
+ *    iTag:
+ *      An array of attribute tags. The number of elements in this
+ *      array must not be less than iAttributeCount. Each element in
+ *      the array must contain a valid style attribute tag (see the
+ *      definition of ATSUAttributeTag for possible values).
+ *    
+ *    iValueSize:
+ *      An array of ByteCount values. The number of elements in this
+ *      array must not be less than iAttributeCount. Each ByteCount
+ *      value corresoponds to the size of an element referred to by a
+ *      pointer in the iValue array.
+ *    
+ *    iValue:
+ *      An array of pointers of type ATSUAttributeValuePtr. Each
+ *      pointer referrs to a value that corresponds to a tag specified
+ *      by the iTag array. The size of the data referred to is
+ *      determined by a corresponding element in the iValueSize array.
+ *      The number of elements in this array must not be less than
+ *      iAttributeCount.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetAttributes( iStyle: ATSUStyle; iAttributeCount: ItemCount; iTag: ATSUAttributeTagPtr; iValueSize: ByteCountPtr; iValue: ATSUAttributeValuePtrPtr ): OSStatus; external name '_ATSUSetAttributes';
+
+
+{
+ *  ATSUGetAttribute()
+ *  
+ *  Summary:
+ *    Obtains a single attribute value for a style object.
+ *  
+ *  Discussion:
+ *    The ATSUGetAttribute function obtains the value of a specified
+ *    style attribute for a given style object. Before calling
+ *    ATSUGetAttribute, you should call the function
+ *    ATSUGetAllAttributes to obtain an array of nondefault style
+ *    attribute tags and value sizes for the style object. You can then
+ *    pass ATSUGetAttribute the tag and value size for the attribute
+ *    value to obtain. This function may return kATSUNotSetErr for some
+ *    attributes that have not been set to a non-default via a call to
+ *    ATSUSetAttributes.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style object you with to retrieve an attribute value from.
+ *    
+ *    iTag:
+ *      The tag you wish to obtain the value of.
+ *    
+ *    iExpectedValueSize:
+ *      The size of the buffer pointed to by oValue.
+ *    
+ *    oValue:
+ *      On input, a buffer you have allocated to retain the value of
+ *      the specified attribute. On return, the value of the requested
+ *      attribute will be placed here. You may pass NULL for this
+ *      parameter. can be NULL
+ *    
+ *    oActualValueSize:
+ *      On return, the actual number of bytes written to oValue is
+ *      placed here. You may pass NULL for this parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetAttribute( iStyle: ATSUStyle; iTag: ATSUAttributeTag; iExpectedValueSize: ByteCount; oValue: ATSUAttributeValuePtr; oActualValueSize: ByteCountPtr ): OSStatus; external name '_ATSUGetAttribute';
+
+
+{
+ *  ATSUGetAllAttributes()
+ *  
+ *  Summary:
+ *    Obtains an array of style attribute tags and value sizes for a
+ *    style object.
+ *  
+ *  Discussion:
+ *    This function returns information as to which attributes have had
+ *    non-default values set in a particular ATSUStyle object. It will
+ *    also return the size in bytes of the values of these attributes.
+ *    Using this information, you can then call ATSUGetAttribute to
+ *    obtain the value of a given attribute. Typically you use the
+ *    function ATSUGetAllAttributes by calling it twice, as follows:
+ *    (1) Pass a reference to the style object to examine in the iStyle
+ *    parameter, a valid pointer to an ItemCount value in the
+ *    oTagValuePairCount parameter, NULL for the oAttributeInfoArray
+ *    parameter, and 0 for the iTagValuePairArraySize parameter.
+ *    ATSUGetAllAttributes returns the size of the tag and value-size
+ *    arrays in the oTagValuePairCount parameter. (2) Allocate enough
+ *    space for an array of the returned size, then call the
+ *    ATSUGetAllAttributes function again, passing a valid pointer in
+ *    the oAttributeInfoArray parameter. On return, the pointer refers
+ *    to an array of the style attribute tag and value-size pairs
+ *    contained in the style object.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      The style object you wish to retrieve a list of attribute tags
+ *      from.
+ *    
+ *    oAttributeInfoArray:
+ *      On return, an array of ATSUAttributeInfo structures. Each
+ *      structure contains information about an attribute in iStyle
+ *      that has a non-default value. You must allocate space for this
+ *      array. If you are unsure how much space to allocate, you may
+ *      pass NULL for this parameter and use the oTagValuePairCount
+ *      parameter to determine how much space to allocate. can be NULL
+ *    
+ *    iTagValuePairArraySize:
+ *      The size of the array you allocated and are passing in for the
+ *      oAttributeInfoArray parameter. 
+ *    
+ *    oTagValuePairCount:
+ *      On return, the number of attributes whose information was
+ *      stored in the oAttributeInfoArray parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetAllAttributes( iStyle: ATSUStyle; oAttributeInfoArray: ATSUAttributeInfoPtr; iTagValuePairArraySize: ItemCount; oTagValuePairCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllAttributes';
+
+
+{
+ *  ATSUClearAttributes()
+ *  
+ *  Summary:
+ *    Restores default values to the specified style attributes of a
+ *    style object.
+ *  
+ *  Discussion:
+ *    Removes those style attribute values identified by the tag
+ *    constants in the iTag array and replaces them with the default
+ *    values. For a list of possible tags and their default values, see
+ *    the ATSUI documentation, or the definition of ATSUAttributeTag
+ *    elsewhere in this header file. If you specify that any currently
+ *    unset attribute values be removed, ATSUClearAttributes does not
+ *    return an error. Note this function only deals with attributes.
+ *    To remove all previously set style attributes as well as font
+ *    features and font variations from a style object, call the
+ *    function ATSUClearStyle.
+ *  
+ *  Parameters:
+ *    
+ *    iStyle:
+ *      A style whose attributes you want to clear.
+ *    
+ *    iTagCount:
+ *      The number of tags you are passing in via the iTag parameter.
+ *      Pass kATSUClearAll to clear all attributes.
+ *    
+ *    iTag:
+ *      An array of ATSUAttributeTag indicating which attributes to
+ *      clear. You may pass NULL for this parameter if you are passing
+ *      kATSUClearAll for the iTagCount parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearAttributes( iStyle: ATSUStyle; iTagCount: ItemCount; iTag: ATSUAttributeTagPtr ): OSStatus; external name '_ATSUClearAttributes';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI basic text layout functions                                           }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCreateTextLayout()
+ *  
+ *  Summary:
+ *    Creates an opaque text layout object containing only default text
+ *    layout attributes.
+ *  
+ *  Discussion:
+ *    This function creates a empty text layout object that has no
+ *    styles or text buffer associated with it. Most ATSUI functions
+ *    that operate on text layout objects require that the objects be
+ *    associated with style information and text. To associate style
+ *    objects and text with an empty text layout object, you can call
+ *    the functions ATSUSetRunStyle and ATSUSetTextPointerLocation .
+ *    Or, to create a text layout object and associate style objects
+ *    and text with it at the same time, you can call the function
+ *    ATSUCreateTextLayoutWithTextPtr. To provide nondefault line or
+ *    layout attributes for a text layout object, you can call the
+ *    functions ATSUSetLineControls or ATSUSetLayoutControls . After
+ *    setting text attributes, call ATSUDrawText to draw the text. Text
+ *    layout objects are readily reusable and should be cached for
+ *    later use, if possible. You can reuse a text layout object even
+ *    if the text associated with it is altered. Call the functions
+ *    ATSUSetTextPointerLocation, ATSUTextDeleted, or ATSUTextInserted
+ *    to manage the altered text.
+ *  
+ *  Parameters:
+ *    
+ *    oTextLayout:
+ *      On return, the value refers to an empty text layout object.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCreateTextLayout( var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateTextLayout';
+
+
+{
+ *  ATSUCreateAndCopyTextLayout()
+ *  
+ *  Summary:
+ *    Creates a copy of a text layout object.
+ *  
+ *  Discussion:
+ *    This function creates a copy of the source text layout object's
+ *    style runs (including references to the associated text buffer
+ *    and style objects), line attributes, layout attributes, and
+ *    layout caches. ATSUCreateAndCopyTextLayout does not copy
+ *    reference constants. To create a text layout object without
+ *    copying a source object, you can the function
+ *    ATSUCreateTextLayout or the function
+ *    ATSUCreateTextLayoutWithTextPtr.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout to be copied.
+ *    
+ *    oTextLayout:
+ *      On return, a reference to a layout object which is a copy of
+ *      iTextLayout.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCreateAndCopyTextLayout( iTextLayout: ATSUTextLayout; var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateAndCopyTextLayout';
+
+
+{
+ *  ATSUCreateTextLayoutWithTextPtr()
+ *  
+ *  Summary:
+ *    Creates an opaque text layout object containing default text
+ *    layout attributes as well as associated text and text styles.
+ *  
+ *  Discussion:
+ *    This function creates a text layout object and associates the
+ *    specified text buffer and style runs with it. All layout
+ *    attributes are set to their default values. To provide nondefault
+ *    line or layout attributes for a text layout object, you can call
+ *    the functions ATSUSetLineControls or ATSUSetLayoutControls. After
+ *    setting text attributes, call ATSUDrawText to draw the text.
+ *    Because the only way that ATSUI interacts with text is via the
+ *    memory references you associate with a text layout object, you
+ *    are responsible for keeping these references updated through use
+ *    of the functions ATSUTextInserted, ATSUTextDeleted,
+ *    ATSUTextMoved, and ATSUSetTextPointerLocation. Note that, because
+ *    ATSUI objects retain state information, doing superfluous calling
+ *    can degrade performance. For example, you could call
+ *    ATSUSetTextPointerLocation rather than ATSUTextInserted when the
+ *    user inserts text, but there would be a performance penalty, as
+ *    all the layout caches are flushed when you call
+ *    ATSUSetTextPointerLocation , rather than just the affected ones.
+ *    Text layout objects are readily reusable and should themselves be
+ *    cached for later use, if possible. Text objects are thread-safe
+ *    starting with ATSUI version 2.4.
+ *  
+ *  Parameters:
+ *    
+ *    iText:
+ *      A text buffer containing UTF-16Ðencoded text. ATSUI associates
+ *      this buffer with the new text layout object and analyzes the
+ *      complete text of the buffer when obtaining the layout context
+ *      for the current text range. Thus, for paragraph-format text, if
+ *      you specify a buffer containing less than a complete paragraph,
+ *      some of ATSUI's layout results are not guaranteed to be
+ *      accurate. For example, with a buffer of less than a full
+ *      paragraph, ATSUI can neither reliably obtain the context for
+ *      bidirectional processing nor reliably generate accent
+ *      attachments and ligature formations for Roman text.
+ *    
+ *    iTextOffset:
+ *      The offset from the beginning of the text buffer to the first
+ *      character of the range to include in the layout. To indicate
+ *      that the specified text range starts at the beginning of the
+ *      text buffer, you can pass the constant kATSUFromTextBeginning.
+ *      To specify the entire text buffer, pass kATSUFromTextBeginning
+ *      in this parameter and kATSUToTextEnd in the iTextLength
+ *      parameter. For best results, use one layout for each paragraph
+ *      within the text buffer.
+ *    
+ *    iTextLength:
+ *      The length of the text range. Note that the sum of iTextOffset
+ *      and iTextLength must be less than or equal to the value of the
+ *      iTextTotalLength parameter. If you want the range of text to
+ *      extend to the end of the text buffer, you can pass the constant
+ *      kATSUToTextEnd. For best results, use one layout for each
+ *      paragraph within the text buffer.
+ *    
+ *    iTextTotalLength:
+ *      The length of the entire text buffer referred to by iText. This
+ *      value should be greater than or equal to the range of text
+ *      defined by the iTextLength parameter.
+ *    
+ *    iNumberOfRuns:
+ *      The number of text style runs you want to define within the
+ *      overall text range. The number of style objects and style run
+ *      lengths passed in the iStyles and iRunLengths parameters,
+ *      respectively, should be equal to the number of runs specified
+ *      here.
+ *    
+ *    iRunLengths:
+ *      An array providing ATSUI with the lengths of each of the text's
+ *      style runs. You can pass kATSUToTextEnd for the last style run
+ *      length if you want the style run to extend to the end of the
+ *      text range. If the sum of the style run lengths is less than
+ *      the total length of the text range, the remaining characters
+ *      are assigned to the last style run.
+ *    
+ *    iStyles:
+ *      An array of styles, each corresponding to a style run defined
+ *      in iRunLengths. The same ATSUStyle object may be referred to
+ *      more than once in this array. The number of elements in this
+ *      array must be equal to the value specified by the iNumberOfRuns
+ *      parameter.
+ *    
+ *    oTextLayout:
+ *      A valid pointer to an ATSUTextLayout value. On return, the
+ *      value refers to the newly created text layout object.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCreateTextLayoutWithTextPtr( iText: ConstUniCharArrayPtr; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount; iNumberOfRuns: ItemCount; iRunLengths: UniCharCountPtr; iStyles: ATSUStylePtr; var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateTextLayoutWithTextPtr';
+
+
+{
+ *  ATSUClearLayoutCache()
+ *  
+ *  Summary:
+ *    Clears the layout cache of a line or an entire text layout object.
+ *  
+ *  Discussion:
+ *    The layout cache contains all the layout information ATSUI
+ *    calculates and needs to draw a range of text in a text layout
+ *    object. This includes caret positions, the memory locations of
+ *    glyphs, and other information needed to lay out the glyphs. ATSUI
+ *    uses information in the layout cache to avoid laying out the text
+ *    again, thereby improving performance. When you clear the layout
+ *    cache of a line or block of text, ATSUI takes longer to redraw a
+ *    line, since it must perform the calculations that support glyph
+ *    layout again. You should call the function ATSUClearLayoutCache
+ *    when you need to decrease the amount of memory your application
+ *    uses. This function reclaims memory at the cost of optimal
+ *    performance. By default, the ATSUClearLayoutCache function
+ *    removes the layout cache of a single line. To clear the layout
+ *    cache for multiple lines, you should call ATSUClearLayoutCache
+ *    for each line. To clear the layout cache of an entire text layout
+ *    object, pass the constant kATSUFromTextBeginning in the
+ *    iLineStart parameter. Note that ATSUClearLayoutCache does not
+ *    produce a function error if lines do not have a layout cache. The
+ *    ATSUClearLayoutCache function flushes the layout cache but does
+ *    not alter previously set text layout attributes, soft line break
+ *    positions, or the text memory location. If you do not want to
+ *    retain these values, you should dispose of the text layout object
+ *    by calling the ATSUDisposeTextLayout function.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout for which to clear the layout caches.
+ *    
+ *    iLineStart:
+ *      The offset from the beginning of the text buffer to the
+ *      beginning of the line for which to discard the layout cache. If
+ *      the range of text spans multiple lines, you should call
+ *      ATSUClearLayoutCache for each line, passing the offset
+ *      corresponding to the beginning of the new line to draw with
+ *      each call. To clear the layout cache of the entire text layout
+ *      object, you can pass the constant kATSUFromTextBeginning.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearLayoutCache( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset ): OSStatus; external name '_ATSUClearLayoutCache';
+
+
+{
+ *  ATSUDisposeTextLayout()
+ *  
+ *  Summary:
+ *    Disposes of the memory associated with a text layout object.
+ *  
+ *  Discussion:
+ *    This function frees the memory associated with the specified text
+ *    layout object and its internal structures, including line and
+ *    layout control attributes, style runs, and soft line breaks.
+ *    ATSUDisposeTextLayout does not dispose of any memory that may be
+ *    allocated for the text buffer, style objects, or reference
+ *    constants associated with the text layout object. You are
+ *    responsible for doing so. For best performance, text layout
+ *    objects are readily reusable and should be cached for later use,
+ *    if possible. You can reuse a text layout object even if the text
+ *    associated with it is altered. Call the functions
+ *    ATSUSetTextPointerLocation, ATSUTextDeleted, or ATSUTextInserted
+ *    to manage the altered text, rather than disposing of the text
+ *    layout object and creating a new one.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout object to dispose of.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUDisposeTextLayout( iTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUDisposeTextLayout';
+
+
+{
+ *  ATSUSetTextLayoutRefCon()
+ *  
+ *  Summary:
+ *    Sets application-specific data for a text layout object.
+ *  
+ *  Discussion:
+ *    This function associates a reference constant (that is,
+ *    application-specific data) with a text layout object. You might
+ *    typically use ATSUSetTextLayoutRefCon to track user preferences
+ *    that can effect layout, for example. If you copy or clear a text
+ *    layout object containing a reference constant, the reference
+ *    constant is not copied or removed. When you dispose of a text
+ *    layout object that contains a reference constant, you are
+ *    responsible for freeing any memory allocated for the reference
+ *    constant. Calling the function ATSUDisposeTextLayout does not do
+ *    so.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout for which you wish to set a reference constant.
+ *    
+ *    iRefCon:
+ *      Any arbitrary 32-bit value you wish to store in association
+ *      with iTextLayout.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetTextLayoutRefCon( iTextLayout: ATSUTextLayout; iRefCon: UInt32 ): OSStatus; external name '_ATSUSetTextLayoutRefCon';
+
+
+{
+ *  ATSUGetTextLayoutRefCon()
+ *  
+ *  Summary:
+ *    Obtains application-specific data for a text layout object.
+ *  
+ *  Discussion:
+ *    This function obtains a reference constant (that is,
+ *    application-specific data) associated with a text layout object.
+ *    To associate a reference constant with a text layout object, call
+ *    the function ATSUSetTextLayoutRefCon.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout for which you wish to retreive the reference constant.
+ *    
+ *    oRefCon:
+ *      On return, the reference constant associated with iTextLayout.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetTextLayoutRefCon( iTextLayout: ATSUTextLayout; var oRefCon: UInt32 ): OSStatus; external name '_ATSUGetTextLayoutRefCon';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI text buffer manipulation                                              }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUSetTextPointerLocation()
+ *  
+ *  Summary:
+ *    Associates a text buffer with a text layout object or updates
+ *    previously associated text.
+ *  
+ *  Discussion:
+ *    For ATSUI to render your text, you must associate the text with
+ *    both a text layout object and style information. Some functions,
+ *    such as ATSUCreateTextLayoutWithTextPtr, create a text layout
+ *    object and associate text with it concurrently. However, if you
+ *    use the function ATSUCreateTextLayout to create a text layout
+ *    object, you must assign text to the object prior to attempting
+ *    most ATSUI operations. You can use the function
+ *    ATSUSetTextPointerLocation to associate text with a layout
+ *    object. When you call this function, you are both assigning a
+ *    text buffer to a text layout object and specifying the current
+ *    text subrange within the buffer to include in the layout. If
+ *    there is already text associated with a text layout object,
+ *    calling ATSUSetTextPointerLocation overrides the previously
+ *    associated text, as well as clearing the object's layout caches.
+ *    You would typically only call this function for a text layout
+ *    object with existing associated text if either (a) both the
+ *    buffer itself is relocated and a subrange of the buffer's text is
+ *    deleted or inserted or (b) when associating an entirely different
+ *    buffer with a text layout object. Note that, because ATSUI
+ *    objects retain state, doing superfluous calling can degrade
+ *    performance. For example, you could call
+ *    ATSUSetTextPointerLocation rather than ATSUTextInserted when the
+ *    user simply inserts a subrange of text within a text buffer, but
+ *    there would be a performance penalty, as all the layout caches
+ *    are flushed by ATSUSetTextPointerLocation, rather than just the
+ *    affected ones. Similarly, you should not call
+ *    ATSUSetTextPointerLocation, when an entire text buffer associated
+ *    with a text layout object is relocated, but no other changes have
+ *    occurred that would affect the buffer's current subrange.
+ *    Instead, you should call ATSUTextMoved, which is a more focused
+ *    function and therefore more efficient. After associating text
+ *    with a text layout object, use ATSUSetRunStyle to associate style
+ *    information with the text. You can then call the function
+ *    ATSUDrawText to display the text or a subrange of the text.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout object for which you wish to associate a text buffer.
+ *    
+ *    iText:
+ *      A pointer to a buffer of Unicode text in UTF-16 format. This is
+ *      the text that will be associated with iTextLayout.
+ *    
+ *    iTextOffset:
+ *      The starting offset of the subrange of the text buffer you wish
+ *      to associate with iTextLayout. To indicate that the specified
+ *      text range starts at the beginning of the text buffer, you can
+ *      pass the constant kATSUFromTextBeginning . To specify the
+ *      entire text buffer, pass kATSUFromTextBeginning in this
+ *      parameter and kATSUToTextEnd in the iTextLength parameter.
+ *    
+ *    iTextLength:
+ *      The length of the subrage of the text buffer you wish to
+ *      associate with iTextLayout. Note that the sum of iTextOffset
+ *      and iTextLength must be less than or equal to the value of the
+ *      iTextTotalLength parameter. If you want the range of text to
+ *      extend to the end of the text buffer, you can pass the constant
+ *      kATSUToTextEnd.
+ *    
+ *    iTextTotalLength:
+ *      The length of the entire text buffer. This value should be
+ *      greater than or equal to the range of text defined by the
+ *      iTextLength parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetTextPointerLocation( iTextLayout: ATSUTextLayout; iText: ConstUniCharArrayPtr; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount ): OSStatus; external name '_ATSUSetTextPointerLocation';
+
+
+{
+ *  ATSUGetTextLocation()
+ *  
+ *  Summary:
+ *    Returns information about the Unicode text buffer associated with
+ *    a layout.
+ *  
+ *  Discussion:
+ *    For a given layout, ATSUGetTextLocation will return information
+ *    about the Unicode text buffer associated with it, including its
+ *    memory location, its size, and whether it is stored in a handle.
+ *    Note that since a layout may refer to a subrange within a text
+ *    buffer, parameters defining this subrange are included. oOffset
+ *    and oTextLength give information about the subrange, while oText
+ *    and oTextTotalLength give information about the entire text
+ *    buffer. You may pass NULL for any parameters you are not
+ *    interested in. Only iTextLayout is required.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A text layout whose text buffer you want information regarding.
+ *    
+ *    oText:
+ *      A pointer to data of any type. On return, the pointer is set to
+ *      either a pointer or a handle that refers to the text buffer for
+ *      the specified text layout object. can be NULL
+ *    
+ *    oTextIsStoredInHandle:
+ *      On return, the value is set to true if the text buffer referred
+ *      to by the oText parameter is accessed by a handle; if false, a
+ *      pointer. can be NULL
+ *    
+ *    oOffset:
+ *      On return, the offset from the beginning of the text buffer to
+ *      the first character of the layout's current text range. can be NULL
+ *    
+ *    oTextLength:
+ *      On return, the value specifies the length of the layout's
+ *      current text range. can be NULL
+ *    
+ *    oTextTotalLength:
+ *      On return, the total length of the text buffer. Note this is
+ *      not necessarily the same as the length of the layout's current
+ *      range. (A layout may refer to only a subrange within a text
+ *      buffer.) can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetTextLocation( iTextLayout: ATSUTextLayout; oText: PtrPtr; oTextIsStoredInHandle: BooleanPtr; oOffset: UniCharArrayOffsetPtr; oTextLength: UniCharCountPtr; oTextTotalLength: UniCharCountPtr ): OSStatus; external name '_ATSUGetTextLocation';
+
+
+{
+ *  ATSUTextDeleted()
+ *  
+ *  Summary:
+ *    Informs ATSUI of the location and length of a text deletion.
+ *  
+ *  Discussion:
+ *    When you call the ATSUTextDeleted function to inform ATSUI of a
+ *    text deletion, it shortens the style run(s) containing the
+ *    deleted text by the amount of the deletion. If a style run
+ *    corresponds entirely to a range of deleted text, that style run
+ *    is removed. If the deletion point is between two style runs, the
+ *    first style run is shortened (or removed). The ATSUTextDeleted
+ *    function also shortens the total length of the text buffer
+ *    containing the deleted text by the amount of the deletion. That
+ *    is, it shifts the memory location of the text following the
+ *    deleted text by iDeletedRangeLength .ATSUTextDeleted also removes
+ *    any soft line breaks that fall within the deleted text and
+ *    updates affected drawing caches. The ATSUTextDeleted function
+ *    does not change the actual memory location of the affected text.
+ *    You are responsible for deleting the corresponding text is from
+ *    the text buffer. You are also responsible for calling the
+ *    function ATSUDisposeStyle to dispose of the memory associated
+ *    with any style runs that have been removed. Note that calling the
+ *    function ATSUTextDeleted automatically removes previously-set
+ *    soft line breaks if the line breaks are within the range of text
+ *    that is deleted.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout containing the deleted text.
+ *    
+ *    iDeletedRangeStart:
+ *      The starting location of the deleted text. To specify a
+ *      deletion point at the beginning of the text buffer, you can
+ *      pass the constant kATSUFromTextBeginning. To specify that the
+ *      entire text buffer has been deleted, pass
+ *      kATSUFromTextBeginning in this parameter and kATSUToTextEnd in
+ *      the iDeletedRangeLength parameter.
+ *    
+ *    iDeletedRangeLength:
+ *      The length of the deleted text. To specify a deletion length
+ *      extending to the end of the text buffer, you can pass the
+ *      constant kATSUToTextEnd.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUTextDeleted( iTextLayout: ATSUTextLayout; iDeletedRangeStart: UniCharArrayOffset; iDeletedRangeLength: UniCharCount ): OSStatus; external name '_ATSUTextDeleted';
+
+
+{
+ *  ATSUTextInserted()
+ *  
+ *  Summary:
+ *    Informs ATSUI of the location and length of a text insertion.
+ *  
+ *  Discussion:
+ *    When you call the ATSUTextInserted function to inform ATSUI of a
+ *    text insertion, it extends the style run containing the insertion
+ *    point by the amount of the inserted text. If the insertion point
+ *    is between two style runs, the first style run is extended to
+ *    include the new text. The ATSUTextInserted function also extends
+ *    the total length of the text buffer containing the inserted text
+ *    by the amount of the inserted text. That is, it shifts the memory
+ *    location of the text following the inserted text by
+ *    iInsertionLength. ATSUTextInserted then updates drawing caches.
+ *    Note that the ATSUTextInserted function does not change the
+ *    actual memory location of the inserted text. You are responsible
+ *    for placing the inserted text into the text buffer at the
+ *    appropriate location. The ATSUTextInserted function does not
+ *    insert style runs or line breaks; to do so, call the functions
+ *    ATSUSetRunStyle and ATSUSetSoftLineBreak, respectively. Break
+ *    line operations should be redone after you call ATSUTextInserted.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout in which the text insertion is taking place.
+ *    
+ *    iInsertionLocation:
+ *      The offset corresponding to the beginning of the inserted text.
+ *    
+ *    iInsertionLength:
+ *      The length of the inserted text.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUTextInserted( iTextLayout: ATSUTextLayout; iInsertionLocation: UniCharArrayOffset; iInsertionLength: UniCharCount ): OSStatus; external name '_ATSUTextInserted';
+
+
+{
+ *  ATSUTextMoved()
+ *  
+ *  Summary:
+ *    Informs ATSUI of the new memory location of relocated text.
+ *  
+ *  Discussion:
+ *    You should call the ATSUTextMoved function when a range of text
+ *    consisting of less than an entire text buffer has been moved. The
+ *    ATSUTextMoved function informs ATSUI of the new memory location
+ *    of the text. You are responsible for moving the text. The text
+ *    buffer should remain otherwise unchanged.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout containing the moved text.
+ *    
+ *    iNewLocation:
+ *      The new memory location of the moved text.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUTextMoved( iTextLayout: ATSUTextLayout; iNewLocation: ConstUniCharArrayPtr ): OSStatus; external name '_ATSUTextMoved';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI layout controls                                                       }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCopyLayoutControls()
+ *  
+ *  Summary:
+ *    Copies all layout control attribute settings from a source text
+ *    layout object to a destination text layout object.
+ *  
+ *  Discussion:
+ *    This function copies all layout control attribute values to a
+ *    destination text layout object from a source text layout object,
+ *    including any default (unset) values in the source object. For a
+ *    list of tags and their default values, see the definition of
+ *    ATSUAttributeTag. Reference constants and the contents of memory
+ *    referenced by pointers within custom layout attributes are not
+ *    copied. You are responsible for ensuring that this memory remains
+ *    valid until both the source and destination text layout objects
+ *    are disposed. To copy line control attribute values from one text
+ *    layout object to another, call the function ATSUCopyLineControls.
+ *  
+ *  Parameters:
+ *    
+ *    iSourceTextLayout:
+ *      The text layout to copy layout controls from.
+ *    
+ *    iDestTextLayout:
+ *      The text layout to copy layout controls to.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCopyLayoutControls( iSourceTextLayout: ATSUTextLayout; iDestTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCopyLayoutControls';
+
+
+{
+ *  ATSUSetLayoutControls()
+ *  
+ *  Summary:
+ *    Sets layout control attribute values in a text layout object.
+ *  
+ *  Discussion:
+ *    When you use ATSUI to image your text, you can control the text's
+ *    display and formatting at a number of different levels: layout,
+ *    line, and run. The level affected by this function is the layout
+ *    level, which is that of the entire text range associated with
+ *    your text layout object. Attributes at this level affect the
+ *    width of the text area from margin to margin, the alignment of
+ *    the text, its justification, rotation, and direction, as well as
+ *    other layout options. See ATSUSetLineControls for information
+ *    about controling text and the line level. Similar to style
+ *    attributes, you use a "triple" to specify a line or layout
+ *    control attribute. That is, (1) an attribute tag, (2) the size
+ *    (in bytes) of the attribute value, and (3) the value of the
+ *    attribute it sets. Attribute tags are constants supplied by
+ *    ATSUI. Attribute values may be a scalar, a structure, or a
+ *    pointer. And as with style attributes, you can also create a
+ *    custom attribute for a line or layout attribute for which ATSUI
+ *    does not provide a tag. For a list of layout control tags defined
+ *    by ATSUI and their default values, see the definition of
+ *    ATSUAttributeTag.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout in which to set layout-level controls.
+ *    
+ *    iAttributeCount:
+ *      The number of attributes to set. This value should correspond
+ *      to the number of elements in the iTag, iValueSize, and iValue
+ *      arrays.
+ *    
+ *    iTag:
+ *      An array of attribute tags to set. For a list of layout control
+ *      tags defined by ATSUI and their default values, see the
+ *      definition of ATSUAttributeTag.
+ *    
+ *    iValueSize:
+ *      An array of values indicating the sizes of the values pointed
+ *      to by the elements in the iValue array.
+ *    
+ *    iValue:
+ *      An array of attribute value pointers. Each value in the array
+ *      must correspond to a tag in the iTag array and be a legal value
+ *      for that tag.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetLayoutControls( iTextLayout: ATSUTextLayout; iAttributeCount: ItemCount; iTag: ATSUAttributeTagPtr; iValueSize: ByteCountPtr; iValue: ATSUAttributeValuePtrPtr ): OSStatus; external name '_ATSUSetLayoutControls';
+
+
+{
+ *  ATSUGetLayoutControl()
+ *  
+ *  Summary:
+ *    Obtains a single layout control attribute value for a text layout
+ *    object.
+ *  
+ *  Discussion:
+ *    Before calling ATSUGetLayoutControl, you should call the function
+ *    ATSUGetAllLayoutControls to obtain an array of nondefault layout
+ *    control attribute tags and value sizes for the text layout
+ *    object. You can then pass the tag and value size for the
+ *    attribute value to obtain to ATSUGetLayoutControl. Typically you
+ *    use the function ATSUGetLayoutControl by calling it twice, as
+ *    follows: (1) Pass a reference to the text layout object to
+ *    examine in the iTextLayout parameter, NULL for the oValue
+ *    parameter, 0 for the iExpectedValueSize parameter.
+ *    ATSUGetLayoutControl returns the actual size of the attribute
+ *    value in the oActualValueSize parameter. (2) Allocate enough
+ *    space for an array of the returned size, then call the
+ *    ATSUGetLayoutControl function again, passing a valid pointer in
+ *    the oValue parameter. On return, the pointer refers to the actual
+ *    attribute value contained in the text layout object. For a list
+ *    of layout control tags defined by ATSUI and their default values,
+ *    see the definition of ATSUAttributeTag.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout for which you wish to obtain a single layout
+ *      control value.
+ *    
+ *    iTag:
+ *      An attribute tag specifying the layout control value you wish
+ *      to obtain. For a list of layout control tags defined by ATSUI
+ *      and their default values, see the definition of
+ *      ATSUAttributeTag.
+ *    
+ *    iExpectedValueSize:
+ *      The size in bytes of the buffer you have allocated for the
+ *      oValue parameter.
+ *    
+ *    oValue:
+ *      On return, the value assocaited with the layout tag specified
+ *      by the iTag parameter. can be NULL
+ *    
+ *    oActualValueSize:
+ *      On return, the value contains the actual size (in bytes) of the
+ *      attribute value. You should examine this parameter if you are
+ *      unsure of the size of the attribute value being obtained, as in
+ *      the case of custom layout control attributes. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetLayoutControl( iTextLayout: ATSUTextLayout; iTag: ATSUAttributeTag; iExpectedValueSize: ByteCount; oValue: ATSUAttributeValuePtr; oActualValueSize: ByteCountPtr ): OSStatus; external name '_ATSUGetLayoutControl';
+
+
+{
+ *  ATSUGetAllLayoutControls()
+ *  
+ *  Summary:
+ *    Obtains an array of non-default layout control attribute tags and
+ *    value sizes for a text layout object.
+ *  
+ *  Discussion:
+ *    This function function obtains all nondefault layout control
+ *    attribute tags and their values sizes for a text layout object.
+ *    You can pass a tag and value size pair obtained from
+ *    ATSUGetAllLayoutControls to the function ATSUGetLayoutControl to
+ *    determine the corresponding attribute value. Typically you use
+ *    the function ATSUGetAllLayoutControls by calling it twice, as
+ *    follows: (1) Pass a reference to the text layout object to
+ *    examine in the iTextLayout parameter, NULL for the
+ *    oAttributeInfoArray parameter, a pointer to an ItemCount value in
+ *    the oTagValuePairCount parameter, and 0 for the
+ *    iTagValuePairArraySize parameter. ATSUGetAllLayoutControls
+ *    returns the size of the tag and value size arrays in the
+ *    oTagValuePairCount parameter. (2) Allocate enough space for an
+ *    array of the returned size, then call the
+ *    ATSUGetAllLayoutControls function again, passing a valid pointer
+ *    in the oAttributeInfoArray parameter. On return, the pointer
+ *    refers to an array of the layout control attribute tag and value
+ *    size pairs contained in the text layout object.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout for which you wish to obtain the set of non-default
+ *      layout tags.
+ *    
+ *    oAttributeInfoArray:
+ *      On return, this array contains pairs of tags and value sizes
+ *      for the object's layout control attributes that are not at
+ *      default values. If you are uncertain of how much memory to
+ *      allocate for this parameter, see the Discussion.
+ *    
+ *    iTagValuePairArraySize:
+ *      A value specifying the maximum number of tag and value size
+ *      pairs to obtain for the text layout object. Typically, this is
+ *      equivalent to the number of ATSUAttributeInfo structures for
+ *      which you have allocated memory in the oAttributeInfoArray
+ *      parameter. To determine this value, see the Discussion.
+ *    
+ *    oTagValuePairCount:
+ *      On return, the value specifies the actual number of
+ *      ATSUAttributeInfo structures in the text layout object. This
+ *      may be greater than the value you specified in the
+ *      iTagValuePairArraySize parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetAllLayoutControls( iTextLayout: ATSUTextLayout; oAttributeInfoArray: ATSUAttributeInfoPtr; iTagValuePairArraySize: ItemCount; var oTagValuePairCount: ItemCount ): OSStatus; external name '_ATSUGetAllLayoutControls';
+
+
+{
+ *  ATSUClearLayoutControls()
+ *  
+ *  Summary:
+ *    Restores default values to the specified layout control
+ *    attributes of a text layout object.
+ *  
+ *  Discussion:
+ *    This function removes those layout control attribute values
+ *    identified by the tag constants in the iTag array and replaces
+ *    them with the default values. If you specify that any currently
+ *    unset attribute values be removed, the function does not return
+ *    an error. For a list of layout control tags defined by ATSUI and
+ *    their default values, see the definition of ATSUAttributeTag.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout in which you wish to clear layout controls.
+ *    
+ *    iTagCount:
+ *      The number of tags you wish to clear. This value should
+ *      correspond to the nuumber of elements in the iTag array. Pass
+ *      kATSUClearAll for this parameter if you wish to clear all
+ *      layout controls.
+ *    
+ *    iTag:
+ *      An array of layout control tags to be cleared. For a list of
+ *      layout control tags defined by ATSUI and their default values,
+ *      see the definition of ATSUAttributeTag. You may pass NULL for
+ *      this parameter if you are passing kATSUClearAll for the
+ *      iTagCount parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearLayoutControls( iTextLayout: ATSUTextLayout; iTagCount: ItemCount; iTag: ATSUAttributeTagPtr ): OSStatus; external name '_ATSUClearLayoutControls';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI line controls                                                         }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCopyLineControls()
+ *  
+ *  Summary:
+ *    Copies line control attribute settings from a line in a source
+ *    text layout object to a line in a destination text layout object.
+ *  
+ *  Discussion:
+ *    This function copies all line control attribute values to a line
+ *    in a destination text layout object from a line in a source text
+ *    layout object, including any default (unset) values in the source
+ *    line. Unset line control attributes are assigned the default
+ *    values. ATSUCopyLineControls does not copy the contents of memory
+ *    referenced by pointers within custom line attributes or within
+ *    reference constants. You are responsible for ensuring that this
+ *    memory remains valid until the source text layout object is
+ *    disposed.
+ *  
+ *  Parameters:
+ *    
+ *    iSourceTextLayout:
+ *      The text layout object from which to copy line control
+ *      attributes.
+ *    
+ *    iSourceLineStart:
+ *      The start of the line from which to copy line control
+ *      attributes.
+ *    
+ *    iDestTextLayout:
+ *      The text layout object for which to set line control
+ *      attributes. This can be the same text layout object passed in
+ *      the iSourceTextLayout parameter if you want to copy line
+ *      control attributes from one line to another within a text
+ *      layout object.
+ *    
+ *    iDestLineStart:
+ *      The start of the line to which to copy line control attributes.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCopyLineControls( iSourceTextLayout: ATSUTextLayout; iSourceLineStart: UniCharArrayOffset; iDestTextLayout: ATSUTextLayout; iDestLineStart: UniCharArrayOffset ): OSStatus; external name '_ATSUCopyLineControls';
+
+
+{
+ *  ATSUSetLineControls()
+ *  
+ *  Summary:
+ *    Sets one or more line control values for a specified line in a
+ *    text layout.
+ *  
+ *  Discussion:
+ *    When you use ATSUI to image your text, you can control the text's
+ *    display and formatting at a number of different levels: layout,
+ *    line, and run. The level affected by this function is the line
+ *    level. These attributes are similar to those that you can apply
+ *    on a full-layout basis, but each affects only an individual text
+ *    line. Note that setting line control attributes overrides the
+ *    corresponding layout-level settings. Also, from a performance
+ *    standpoint, it is preferable to work from the layout level and
+ *    not specify such controls line by line unless necessary. Lines
+ *    are determined by soft breaks that may be set in your layout. You
+ *    can specify a line by giving a starting offset into the text
+ *    buffer. Attributes at this level affect the width of the text
+ *    area from margin to margin, the alignment of the text, its
+ *    justification, rotation, and direction, as well as other layout
+ *    options. Similar to style attributes, you use a "triple" to
+ *    specify a line or layout control attribute. That is, (1) an
+ *    attribute tag, (2) the size (in bytes) of the attribute value,
+ *    and (3) the value of the attribute it sets. Attribute tags are
+ *    constants supplied by ATSUI. Attribute values may be a scalar, a
+ *    structure, or a pointer. And as with style attributes, you can
+ *    also create a custom attribute for a line or layout attribute for
+ *    which ATSUI does not provide a tag. For a list of line control
+ *    tags defined by ATSUI and their default values, see the
+ *    definition of ATSUAttributeTag.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which you wish to set line controls.
+ *    
+ *    iLineStart:
+ *      The starting offset of the line for which you wish to set
+ *      controls.
+ *    
+ *    iAttributeCount:
+ *      The number of attributes to set. This value should correspond
+ *      to the number of elements in the iTag, iValueSize, and iValue
+ *      arrays.
+ *    
+ *    iTag:
+ *      An array of attribute tags to set. For a list of line control
+ *      tags defined by ATSUI and their default values, see the
+ *      definition of ATSUAttributeTag.
+ *    
+ *    iValueSize:
+ *      An array of values indicating the sizes of the values pointed
+ *      to by the elements in the iValue array.
+ *    
+ *    iValue:
+ *      An array of attribute value pointers. Each value in the array
+ *      must correspond to a tag in the iTag array and be a legal value
+ *      for that tag.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetLineControls( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iAttributeCount: ItemCount; iTag: ATSUAttributeTagPtr; iValueSize: ByteCountPtr; iValue: ATSUAttributeValuePtrPtr ): OSStatus; external name '_ATSUSetLineControls';
+
+
+{
+ *  ATSUGetLineControl()
+ *  
+ *  Summary:
+ *    Obtains a single line control attribute value for a line in a
+ *    text layout object.
+ *  
+ *  Discussion:
+ *    Before calling ATSUGetLineControl, you should call the function
+ *    ATSUGetAllLineControls to obtain an array of nondefault line
+ *    control attribute tags and value sizes for the line. You can then
+ *    pass the tag and value size for the attribute value to obtain to
+ *    ATSUGetLineControl. Typically you use the function
+ *    ATSUGetLineControl by calling it twice, as follows: (1) Pass a
+ *    reference to the text layout object to examine in the iTextLayout
+ *    parameter, NULL for the oValue parameter, 0 for the
+ *    iExpectedValueSize parameter. ATSUGetLineControl returns the
+ *    actual size of the attribute value in the oActualValueSize
+ *    parameter. (2) Allocate enough space for an array of the returned
+ *    size, then call the ATSUGetLineControl function again, passing a
+ *    valid pointer in the oValue parameter. On return, the pointer
+ *    refers to the actual attribute value contained for the line in
+ *    the text layout object.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout for which to obtain a line control value.
+ *    
+ *    iLineStart:
+ *      The start of the line for which to obtain a line control value.
+ *    
+ *    iTag:
+ *      A tag specifying the line control value to be obtained. For a
+ *      list of line control tags defined by ATSUI and their default
+ *      values, see the definition of ATSUAttributeTag.
+ *    
+ *    iExpectedValueSize:
+ *      The expected size (in bytes) of the value to obtain.
+ *    
+ *    oValue:
+ *      On return, the actual attribute value. If you are uncertain of
+ *      how much memory to allocate, see the Discussion. can be NULL
+ *    
+ *    oActualValueSize:
+ *      On return, the value contains the actual size (in bytes) of the
+ *      attribute value. You should examine this parameter if you are
+ *      unsure of the size of the attribute value being obtained, as in
+ *      the case of custom line control attributes. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetLineControl( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iTag: ATSUAttributeTag; iExpectedValueSize: ByteCount; oValue: ATSUAttributeValuePtr; oActualValueSize: ByteCountPtr ): OSStatus; external name '_ATSUGetLineControl';
+
+
+{
+ *  ATSUGetAllLineControls()
+ *  
+ *  Summary:
+ *    Obtains an array of line control attribute tags and value sizes
+ *    for a line in a text layout object.
+ *  
+ *  Discussion:
+ *    This function obtains all nondefault line control attribute tags
+ *    and their values sizes for a line in a text layout object. You
+ *    can pass a tag and value size pair obtained from
+ *    ATSUGetAllLineControls to the function ATSUGetLineControl to
+ *    determine the corresponding attribute value. Typically you use
+ *    the function ATSUGetAllLineControls by calling it twice, as
+ *    follows: (1) Pass a reference to the text layout object to
+ *    examine in the iTextLayout parameter, the appropriate
+ *    UniCharArrayOffset value in the iLineStart parameter, NULL for
+ *    the oAttributeInfoArray parameter, a pointer to an ItemCount
+ *    value in the oTagValuePairCount parameter, and 0 for the
+ *    iTagValuePairArraySize parameter. ATSUGetAllLineControls returns
+ *    the size of the tag and value size arrays in the
+ *    oTagValuePairCount parameter. (2) Allocate enough space for an
+ *    array of the returned size, then call the ATSUGetAllLineControls
+ *    function again, passing a valid pointer in the
+ *    oAttributeInfoArray parameter. On return, the pointer refers to
+ *    an array of the line control attribute tag and value size pairs
+ *    contained in the specified line. To obtain the nondefault layout
+ *    control attribute tags and value sizes for a text layout object,
+ *    call the function ATSUGetAllLayoutControls.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout for which you wish to obtain line control
+ *      information.
+ *    
+ *    iLineStart:
+ *      The beginning of the line for which you wish to obtain line
+ *      control information.
+ *    
+ *    oAttributeInfoArray:
+ *      On return, this array contains pairs of tags and value sizes
+ *      for the object's line control attributes that are not at
+ *      default values. If you are uncertain of how much memory to
+ *      allocate for this array, see the Discussion. can be NULL 
+ *    
+ *    iTagValuePairArraySize:
+ *      The size of of the array you allocated for the
+ *      oAttributeInfoArray parameter.
+ *    
+ *    oTagValuePairCount:
+ *      On return, the value specifies the actual number of
+ *      ATSUAttributeInfo structures in the line. This may be greater
+ *      than the value you specified in the iTagValuePairArraySize
+ *      parameter. can be NULL 
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetAllLineControls( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; oAttributeInfoArray: ATSUAttributeInfoPtr; iTagValuePairArraySize: ItemCount; oTagValuePairCount: ItemCountPtr ): OSStatus; external name '_ATSUGetAllLineControls';
+
+
+{
+ *  ATSUClearLineControls()
+ *  
+ *  Summary:
+ *    Restores default values to the specified line control attributes
+ *    of a text layout object.
+ *  
+ *  Discussion:
+ *    This function removes those line control attribute values
+ *    identified by the tag constants in the iTag array and replaces
+ *    them with the default values. If you specify that any currently
+ *    unset attribute values be removed, the function does not return
+ *    an error. For a list of line control tags defined by ATSUI and
+ *    their default values, see the definition of ATSUAttributeTag.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout in which you wish to clear line controls.
+ *    
+ *    iLineStart:
+ *      The start of the line in which to clear line controls.
+ *    
+ *    iTagCount:
+ *      The number of tags you wish to clear. This value should
+ *      correspond to the nuumber of elements in the iTag array. Pass
+ *      kATSUClearAll to clear all line controls.
+ *    
+ *    iTag:
+ *      An array of line control tags to be cleared. For a list of line
+ *      control tags defined by ATSUI and their default values, see the
+ *      definition of ATSUAttributeTag. You may pass NULL for this
+ *      parameter if you are passing kATSUClearAll for the iTagCount
+ *      parameter. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUClearLineControls( iTextLayout: ATSUTextLayout; iLineStart: UniCharArrayOffset; iTagCount: ItemCount; iTag: ATSUAttributeTagPtr ): OSStatus; external name '_ATSUClearLineControls';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI style run processing                                                  }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUSetRunStyle()
+ *  
+ *  Summary:
+ *    Defines a style run by associating style information with a run
+ *    of text.
+ *  
+ *  Discussion:
+ *    A text run consists of one or more characters that are contiguous
+ *    in memory. If you associate these characters with a distinct
+ *    style, you define a style run. You can use the ATSUSetRunStyle
+ *    function to define a style run, by associating a style object
+ *    with a run of text in a text layout object. Each text run must be
+ *    assigned a style object, which may or may not differ from other
+ *    style objects assigned to other text runs in a given text layout
+ *    object. After calling ATSUSetRunStyle, you can call the function
+ *    ATSUDrawText to display the styled text. When you call
+ *    ATSUDrawText, if you have not previously assigned styles to all
+ *    the characters you request to be drawn, ATSUI automatically does
+ *    so. Specifically, ATSUI extends the first style it locates
+ *    immediately prior (in storage order) to the unstyled characters
+ *    to include those unassigned characters. If the unstyled
+ *    characters are at the beginning of the text stream, ATSUI finds
+ *    the first style run in the stream and extends it backward to the
+ *    first character. You should call ATSUSetRunStyle whenever you
+ *    create a new text layout object without any associated styles, as
+ *    by using the function ATSUCreateTextLayout. You should also call
+ *    ATSUSetRunStyle to assign a style to a text run in response to a
+ *    user action, such as when the user selects a run of text and
+ *    changes the font. You do not need to call ATSUSetRunStyle when
+ *    you change style attributes or text layout attributes. In such
+ *    cases, ATSUI automatically updates the layout of the text as
+ *    appropriate.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which you wish to set the style run.
+ *    
+ *    iStyle:
+ *      The style to be assigned to the run of characters.
+ *    
+ *    iRunStart:
+ *      The start of the run of characters. To specify the beginning of
+ *      the text buffer, pass kATSUFromTextBeginning for this parameter.
+ *    
+ *    iRunLength:
+ *      The end of the run of characters. To specify a run that
+ *      continues to the end of the text buffer, pass kATSUToTextEnd
+ *      for this parameter.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetRunStyle( iTextLayout: ATSUTextLayout; iStyle: ATSUStyle; iRunStart: UniCharArrayOffset; iRunLength: UniCharCount ): OSStatus; external name '_ATSUSetRunStyle';
+
+
+{
+ *  ATSUGetRunStyle()
+ *  
+ *  Summary:
+ *    Obtains style run information for a character offset in a run of
+ *    text.
+ *  
+ *  Discussion:
+ *    You can use the ATSUGetRunStyle function to obtain the style
+ *    object assigned to a given text offset. ATSUGetRunStyle also
+ *    produces the encompassing text range that shares the style object
+ *    with the offset. Note that the style object contains those
+ *    previously set style attributes, font features, and font
+ *    variations that are continuous for the range of text that
+ *    includes the specified text offset. If you want to obtain all
+ *    shared style information for a style run, including any unset
+ *    attributes, call the function ATSUGetContinuousAttributes
+ *    instead. If only one style run is set in the text layout object,
+ *    and it does not cover the entire text layout object,
+ *    ATSUGetRunStyle uses the style run information for the iOffset
+ *    parameter to set the style run information for the remaining text.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout for which to obtain style run information.
+ *    
+ *    iOffset:
+ *      The beginning character for which you want to obtain style run
+ *      information.
+ *    
+ *    oStyle:
+ *      On return, the style object assigned to the range of text
+ *      containing the character at iOffset. Note that if you pass an
+ *      offset in the iOffset parameter that is at a style run
+ *      boundary, ATSUGetRunStyle produces style run information for
+ *      the following, not preceding, style run.
+ *    
+ *    oRunStart:
+ *      On return, the offset from the beginning of the text buffer to
+ *      the first character of the style run containing the character
+ *      at iOffset. Note that the entire style run does not necessarily
+ *      share the same unset attribute values as the character at
+ *      iOffset.
+ *    
+ *    oRunLength:
+ *      On return, the length of the style run containing the character
+ *      at iOffset.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetRunStyle( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; var oStyle: ATSUStyle; var oRunStart: UniCharArrayOffset; var oRunLength: UniCharCount ): OSStatus; external name '_ATSUGetRunStyle';
+
+
+{
+ *  ATSUGetContinuousAttributes()
+ *  
+ *  Summary:
+ *    Obtains the style attribute values that are continuous over a
+ *    given text range.
+ *  
+ *  Discussion:
+ *    This function examines the specified text range to obtain the
+ *    style attribute values (including those at default values) that
+ *    remain consistent for the entire text range. You should call
+ *    ATSUGetContinuousAttributes to determine the style information
+ *    that remains constant over text that has been selected by the
+ *    user.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout for which you wish to obtain style run information.
+ *    
+ *    iOffset:
+ *      The starting character for which to examine style run
+ *      attributes. To specify the beginning of the text buffer, pass
+ *      kATSUFromTextBeginning for this parameter.
+ *    
+ *    iLength:
+ *      The length of the range of characters to examine. To specify a
+ *      range that continues to the end of the text buffer, pass
+ *      kATSUToTextEnd for this parameter.
+ *    
+ *    oStyle:
+ *      On return, a style object containing those attributes which are
+ *      the same for the entire text range specified by the iOffset and
+ *      iLength parameters.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetContinuousAttributes( iTextLayout: ATSUTextLayout; iOffset: UniCharArrayOffset; iLength: UniCharCount; oStyle: ATSUStyle ): OSStatus; external name '_ATSUGetContinuousAttributes';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI tab support                                                           }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUSetTabArray()
+ *  
+ *  Summary:
+ *    Sets a tab ruler for a text layout object.
+ *  
+ *  Discussion:
+ *    When a tab ruler is set for a text layout object, ATSUI
+ *    automatically aligns text such that any tabs characters in the
+ *    text are laid out to follow the tab ruler's specifications. If
+ *    you want to use tabs in your text and you also want to use the
+ *    function ATSUBatchBreakLines, then you must set tabs by calling
+ *    the function ATSUSetTabArray. See the definition of ATSUTab for
+ *    more information about setting up a tab ruler.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The layout in which to set the tab array.
+ *    
+ *    iTabs:
+ *      An array of tabstops. See the definition of ATSUTab for more
+ *      inforamation about specifying tabs.
+ *    
+ *    iTabCount:
+ *      The number of tab stops in the iTabs array.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUSetTabArray( iTextLayout: ATSUTextLayout; iTabs: ATSUTabPtr; iTabCount: ItemCount ): OSStatus; external name '_ATSUSetTabArray';
+
+
+{
+ *  ATSUGetTabArray()
+ *  
+ *  Summary:
+ *    Retrieves the tab ruler associated with a text layout object.
+ *  
+ *  Discussion:
+ *    This function can be used to retrieve all the tabs that were
+ *    previously set for a text layout object, using the function
+ *    ATSUSetTabArray . All the returned tabs will be in order of
+ *    position along the line.Typically you use the ATSUGetTabArray
+ *    function by calling it twice, as follows: (1) Pass NULL for the
+ *    oTabs parameter, 0 for the iMaxTabCount parameter, and valid
+ *    values for the other parameters. The ATSUGetTabArray function
+ *    returns the actual number of tabs in the oTabCount parameter. (2)
+ *    Allocate enough space for a buffer of the returned size, then
+ *    call the function again, passing a valid pointer to the buffer in
+ *    the oTabs parameter. On return, the buffer contains the tab
+ *    values in order of position along the line from left to right.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout for which to retrieve the tab ruler.
+ *    
+ *    iMaxTabCount:
+ *      The size of the array you have allocated for the oTabs
+ *      parameter. If you are unsure what to pass for this parameter,
+ *      see the Discussion.
+ *    
+ *    oTabs:
+ *      On return, an array of ATSUTab structures specifying the
+ *      currently set tab ruler for this layout. can be NULL
+ *    
+ *    oTabCount:
+ *      On return, the number of tabs currently set in this layout.
+ *      Note that this may be greater than the value you have passed
+ *      for iMaxTabCount. can be NULL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function ATSUGetTabArray( iTextLayout: ATSUTextLayout; iMaxTabCount: ItemCount; oTabs: ATSUTabPtr; oTabCount: ItemCountPtr ): OSStatus; external name '_ATSUGetTabArray';
+
+
+{ ---------------------------------------------------------------------------- }
+{ ATSUI font fallback object functions                                         }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCreateFontFallbacks()
+ *  
+ *  Summary:
+ *    Creates an opaque object that can be set to contain a font list
+ *    and a font-search method.
+ *  
+ *  Discussion:
+ *    After using this fucntion to create an ATSUFontFallbacks object,
+ *    you can then use ATSUSetObjFontFallbacks to set the fallback
+ *    method for this object, and then use the
+ *    kATSULineFontFallbacksTag to apply the object to a layout. You
+ *    may then either call ATSUMatchFontsToText to manually perform
+ *    font substitution, or call ATSUSetTransientFontMatching to
+ *    perform automatic font subtitution.
+ *  
+ *  Parameters:
+ *    
+ *    oFontFallback:
+ *      On return, a reference to a newly created ATSUFontFallbacks
+ *      object. You are responsible for freeing this object with
+ *      ATSUDisposeFontFallbacks.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function ATSUCreateFontFallbacks( var oFontFallback: ATSUFontFallbacks ): OSStatus; external name '_ATSUCreateFontFallbacks';
+
+
+{
+ *  ATSUDisposeFontFallbacks()
+ *  
+ *  Summary:
+ *    Disposes of an ATSUDisposeFontFallbacks object.
+ *  
+ *  Discussion:
+ *    This function will only dispose of the ATSUDisposeFontFallbacks
+ *    itself. If you have allocated an array of ATSUFontIDs for use
+ *    with this ATSUFontFallbacks object, you are responsible for
+ *    freeing it separately.
+ *  
+ *  Parameters:
+ *    
+ *    iFontFallbacks:
+ *      The ATSUFontFallbacks object to be disposed of.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function ATSUDisposeFontFallbacks( iFontFallbacks: ATSUFontFallbacks ): OSStatus; external name '_ATSUDisposeFontFallbacks';
+
+
+{
+ *  ATSUSetObjFontFallbacks()
+ *  
+ *  Summary:
+ *    Assigns a font-search method and a font list to a font fallback
+ *    object.
+ *  
+ *  Discussion:
+ *    This function allows you to define the settings for a font
+ *    fallback object. These settings determine the method ATSUI uses
+ *    to perform font fallbacks, as well as the font search list, if
+ *    one is needed. Not all fallback methods require a search list.
+ *    See the definition of ATSUFontFallbackMethod for more infomation
+ *    about the different font fallback methods. Once you have called
+ *    this function, you typically will want to associate the font
+ *    fallback object with a text layout using ATSUSetLayoutControls
+ *    and the kATSULineFontFallbacksTag attribute.
+ *  
+ *  Parameters:
+ *    
+ *    iFontFallbacks:
+ *      The fallback object for which you wish to set or change
+ *      settings.
+ *    
+ *    iFontFallbacksCount:
+ *      The number of fonts contained in the iFonts array. Some font
+ *      fallbacks methods do not require such a list. In such cases,
+ *      you may pass zero for this paramter.
+ *    
+ *    iFonts:
+ *      A list of fonts for ATSUI to search through when performing
+ *      fallbacks. Some font fallbacks methods do not require such a
+ *      list. In such cases, you may pass NULL for this parameter. can be NUL
+ *    
+ *    iFontFallbackMethod:
+ *      The font fallback method for ATSUI to use. See the definition
+ *      of ATSUFontFallbackMethod for a list of possible constants to
+ *      pass in for this paramater. Note that some fallback modes
+ *      require a list of fonts for ATSUI to search. In such cases, use
+ *      the iFonts and iFontFallbacksCount parameters to specify this
+ *      list.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function ATSUSetObjFontFallbacks( iFontFallbacks: ATSUFontFallbacks; iFontFallbacksCount: ItemCount; iFonts: ATSUFontIDPtr; iFontFallbackMethod: ATSUFontFallbackMethod ): OSStatus; external name '_ATSUSetObjFontFallbacks';
+
+
+{
+ *  ATSUGetObjFontFallbacks()
+ *  
+ *  Summary:
+ *    Returns information about the current settings in an
+ *    ATSUFontFallbacks object.
+ *  
+ *  Discussion:
+ *    Information returned includes the font-search method, and the
+ *    font search list, if one is set. Note that some font fallback
+ *    modes do not have a client-specified search list. You must
+ *    allocate space for this list.
+ *  
+ *  Parameters:
+ *    
+ *    iFontFallbacks:
+ *      The font fallback object you want to know the current settings
+ *      of.
+ *    
+ *    iMaxFontFallbacksCount:
+ *      For this parameter, pass in the size of the array you are
+ *      passing in for the oFonts parameter.
+ *    
+ *    oFonts:
+ *      On input, a buffer you have allocated for storing the font
+ *      search list. On return, ATSUGetObjFontFallbacks will populate
+ *      the list up to iMaxFontFallbacksCount items. can be NUL
+ *    
+ *    oFontFallbackMethod:
+ *      On return, the font fallback method currently set for this
+ *      object. See the definition of ATSUFontFallbackMethod for more
+ *      information regarding the different font fallback modes.
+ *    
+ *    oActualFallbacksCount:
+ *      On return, the size of the font search list. You can use this
+ *      parameter to determine how much space to allocate for the
+ *      oFonts parameter. can be NUL
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function ATSUGetObjFontFallbacks( iFontFallbacks: ATSUFontFallbacks; iMaxFontFallbacksCount: ItemCount; oFonts: ATSUFontIDPtr; var oFontFallbackMethod: ATSUFontFallbackMethod; oActualFallbacksCount: ItemCountPtr ): OSStatus; external name '_ATSUGetObjFontFallbacks';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI font matching                                                         }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUSetFontFallbacks()
+ *  
+ *  Summary:
+ *    Sets font fallback behavior on a global basis.
+ *  
+ *  Discussion:
+ *    Control of font fallback behavior on a global basis is no longer
+ *    recommended. Object based font fallbacks are preferred. See the
+ *    functions ATSUCreateFontFallbacks, ATSUDisposeFontFallbacks,
+ *    ATSUSetObjFontFallbacks, and ATSUGetObjFontFallbacks, as well as
+ *    the kATSULineFontFallbacksTag attribute for more information
+ *    about object based font fallbacks.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetFontFallbacks( iFontFallbacksCount: ItemCount; iFontIDs: ATSUFontIDPtr; iFontFallbackMethod: ATSUFontFallbackMethod ): OSStatus; external name '_ATSUSetFontFallbacks';
+
+
+{
+ *  ATSUGetFontFallbacks()
+ *  
+ *  Summary:
+ *    Gets the current global font fallback behavior.
+ *  
+ *  Discussion:
+ *    Control of font fallback behavior on a global basis is no longer
+ *    recommended. Object based font fallbacks are preferred. See the
+ *    functions ATSUCreateFontFallbacks, ATSUDisposeFontFallbacks,
+ *    ATSUSetObjFontFallbacks, and ATSUGetObjFontFallbacks, as well as
+ *    the kATSULineFontFallbacksTag attribute for more information
+ *    about object based font fallbacks.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetFontFallbacks( iMaxFontFallbacksCount: ItemCount; oFontIDs: ATSUFontIDPtr; var oFontFallbackMethod: ATSUFontFallbackMethod; var oActualFallbacksCount: ItemCount ): OSStatus; external name '_ATSUGetFontFallbacks';
+
+
+{
+ *  ATSUMatchFontsToText()
+ *  
+ *  Summary:
+ *    Examines a text range for characters that cannot be drawn with
+ *    the current font and suggests a substitute font, if necessary.
+ *  
+ *  Discussion:
+ *    When you call the ATSUMatchFontsToText function, ATSUI scans the
+ *    given range of text for characters that cannot be drawn with the
+ *    currently assigned font. When ATSUI finds such a character, it
+ *    identifies a substitute font for drawing the character. ATSUI
+ *    then continues scanning the text range for subsequent characters
+ *    that cannot be drawn, stopping when it finds a character that can
+ *    be drawn with the currently assigned font, or finds a character
+ *    that cannot be drawn with either the currently assigned font or
+ *    the substitute font, or reaches the end of the text range you
+ *    have specified. ATSUI's default behavior for finding a substitute
+ *    font is to recommend the first valid font that it finds when
+ *    scanning the fonts in the user's system. ATSUI first searches in
+ *    the standard application fonts for various languages. If that
+ *    fails, ATSUI searches through the remaining fonts on the system
+ *    in the order in which the Font Manager returns the fonts. After
+ *    ATSUI has searched all the fonts in the system, any unmatched
+ *    text is drawn using the last-resort font. That is, missing glyphs
+ *    are represented by and empty box to indicate to the user that a
+ *    valid font for that character is not installed on their system.
+ *    You can alter ATSUI's default search behavior by calling the
+ *    function ATSUCreateFontFallbacks and defining your own font
+ *    fallback settings for the text layout object. Because ATSUI does
+ *    not necessarily completely scan the text range you specify with
+ *    each call to ATSUMatchFontsToText, if ATSUI does find any
+ *    characters that cannot be rendered with their current font, you
+ *    should call ATSUMatchFontsToText again and update the input range
+ *    to check that all the subsequent characters in the range can be
+ *    drawn. For that reason, you should call ATSUMatchFontsToText from
+ *    within a loop to assure that the entire range of text is checked.
+ *    Note that calling ATSUMatchFontsToText does not cause the
+ *    suggested font substitution to be performed. If you want ATSUI to
+ *    perform font substitution automatically, you can call the
+ *    function ATSUSetTransientFontMatching.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      The text layout object to examine.
+ *    
+ *    iTextStart:
+ *      The first character of the range to examine. To start at the
+ *      beginning of the text buffer, pass the constant
+ *      kATSUFromTextBeginning.
+ *    
+ *    iTextLength:
+ *      The length of the text range to examine. If you want the range
+ *      of text to extend to the end of the text buffer, you can pass
+ *      the constant kATSUToTextEnd.
+ *    
+ *    oFontID:
+ *      On return, the value provides a font ID for the suggested
+ *      substitute font or kATSUInvalidFontID, if no substitute font is
+ *      available.
+ *    
+ *    oChangedOffset:
+ *      On return, this value specifies the offset from the beginning
+ *      of the text buffer to the first character that cannot be drawn
+ *      with the current font.
+ *    
+ *    oChangedLength:
+ *      On return, this value specifies the length of the text range
+ *      that cannot be drawn with the current font.
+ *  
+ *  Result:
+ *    The result code noErr indicates that all the characters in the
+ *    given range can be rendered with their current font(s) and no
+ *    font substitution is needed. If you receive either of the result
+ *    codes kATSUFontsMatched or kATSUFontsNotMatched, you should
+ *    update the input range and call ATSUMatchFontsToText again to
+ *    ensure that all the characters in the range can be drawn. See
+ *    MacErrors.h for other possible error codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUMatchFontsToText( iTextLayout: ATSUTextLayout; iTextStart: UniCharArrayOffset; iTextLength: UniCharCount; var oFontID: ATSUFontID; var oChangedOffset: UniCharArrayOffset; var oChangedLength: UniCharCount ): OSStatus; external name '_ATSUMatchFontsToText';
+
+
+{
+ *  ATSUSetTransientFontMatching()
+ *  
+ *  Summary:
+ *    Sets the current transient font matching state for a given layout.
+ *  
+ *  Discussion:
+ *    Transient font matching allows ATSUI to automatically substitute
+ *    glyphs from other fonts if the specified styles do not contain
+ *    glyphs for all the characters in the text. You can change the
+ *    behavior of this font substitution by calling the function
+ *    ATSUCreateFontFallbacks and defining your own font fallback
+ *    settings for the text layout object.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout for which to set the current transient font matching
+ *      state.
+ *    
+ *    iTransientFontMatching:
+ *      A boolean value indicating if the current transient font
+ *      matching state to set.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetTransientFontMatching( iTextLayout: ATSUTextLayout; iTransientFontMatching: Boolean ): OSStatus; external name '_ATSUSetTransientFontMatching';
+
+
+{
+ *  ATSUGetTransientFontMatching()
+ *  
+ *  Summary:
+ *    Obtains the current transient font matching state for a given
+ *    layout.
+ *  
+ *  Discussion:
+ *    Transient font matching allows ATSUI to automatically substitute
+ *    glyphs from other fonts if the specified styles do not contain
+ *    glyphs for all the characters in the text. You can change the
+ *    behavior of this font substitution by calling the function
+ *    ATSUCreateFontFallbacks and defining your own font fallback
+ *    settings for the text layout object.
+ *  
+ *  Parameters:
+ *    
+ *    iTextLayout:
+ *      A layout for which to obtain the current transient font
+ *      matching state.
+ *    
+ *    oTransientFontMatching:
+ *      On return, a boolean value indicating the current transient
+ *      font matching state.
+ *  
+ *  Result:
+ *    On success, noErr is returned. See MacErrors.h for possible error
+ *    codes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUGetTransientFontMatching( iTextLayout: ATSUTextLayout; var oTransientFontMatching: Boolean ): OSStatus; external name '_ATSUGetTransientFontMatching';
+
+
+{ Functions listed beyond this point are either deprecated or not recommended }
+
+{ ---------------------------------------------------------------------------- }
+{  Handle-based functions                                                      }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCreateTextLayoutWithTextHandle()
+ *  
+ *  Discussion:
+ *    This function is no longer recommended. Please use
+ *    ATSUCreateTextLayoutWithTextPtr instead.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUCreateTextLayoutWithTextHandle( iText: UniCharArrayHandle; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount; iNumberOfRuns: ItemCount; iRunLengths: UniCharCountPtr; iStyles: ATSUStylePtr; var oTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUCreateTextLayoutWithTextHandle';
+
+
+{
+ *  ATSUSetTextHandleLocation()
+ *  
+ *  Discussion:
+ *    This function is no longer recommended. Please use
+ *    ATSUSetTextPointerLocation instead.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUSetTextHandleLocation( iTextLayout: ATSUTextLayout; iText: UniCharArrayHandle; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iTextTotalLength: UniCharCount ): OSStatus; external name '_ATSUSetTextHandleLocation';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI idle processing (deprecated)                                          }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUIdle()
+ *  
+ *  Summary:
+ *    Performs background processing.
+ *  
+ *  Discussion:
+ *    Current versions of ATSUI do not implement background processing
+ *    for text layout objects. In Mac OS X, the function ATSUIdle does
+ *    nothing.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.5 and later
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function ATSUIdle( iTextLayout: ATSUTextLayout ): OSStatus; external name '_ATSUIdle';
+
+
+{ ---------------------------------------------------------------------------- }
+{  ATSUI Memory allocation specification functions (not in Carbon)             }
+{ ---------------------------------------------------------------------------- }
+{
+ *  ATSUCreateMemorySetting()
+ *  
+ *  Discussion:
+ *    ATSUI memory setting functions are not necessary on Mac OS X.
+ *  
+ *  Availability:
+ *    Mac OS X:         not available
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+
+
+{
+ *  ATSUSetCurrentMemorySetting()
+ *  
+ *  Discussion:
+ *    ATSUI memory setting functions are not necessary on Mac OS X.
+ *  
+ *  Availability:
+ *    Mac OS X:         not available
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+
+
+{
+ *  ATSUGetCurrentMemorySetting()
+ *  
+ *  Discussion:
+ *    ATSUI memory setting functions are not necessary on Mac OS X.
+ *  
+ *  Availability:
+ *    Mac OS X:         not available
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+
+
+{
+ *  ATSUDisposeMemorySetting()
+ *  
+ *  Discussion:
+ *    ATSUI memory setting functions are not necessary on Mac OS X.
+ *  
+ *  Availability:
+ *    Mac OS X:         not available
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   in ATSUnicodeLib 8.6 and later
+ }
+
+
+end.

+ 1466 - 0
packages/extra/univint/ATSUnicodeTypes.pas

@@ -0,0 +1,1466 @@
+{
+     File:       QD/ATSUnicodeTypes.h
+ 
+     Contains:   ATSUI types and constants.
+ 
+     Version:    Quickdraw-150~1
+ 
+     Copyright:  © 2003 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit ATSUnicodeTypes;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,MacMemory,ATSLayoutTypes,Fonts,Quickdraw,SFNTTypes,SFNTLayoutTypes,ATSTypes,TextCommon;
+{$ALIGN MAC68K}
+
+{ See also ATSLayoutTypes.h for more ATSUI-related types and constants }
+{ ---------------------------------------------------------------------------- }
+{ ATSUI types and related constants                                            }
+{ ---------------------------------------------------------------------------- }
+
+{
+ *  ATSUTextLayout
+ *  
+ *  Discussion:
+ *    Text layout objects are the heart of ATSUI. These opaque objects
+ *    associate Unicode text with style runs, store information about
+ *    softbreaks, line and layout controls, and other information about
+ *    the text. Text drawing is done by passing a valid layout object
+ *    and a range of text to draw to the function ATSUDrawText, after
+ *    initial setup work on the layout has been done. See the
+ *    definitions of the functions ATSUCreateTextLayout and
+ *    ATSUCreateTextLayoutWithTextPtr for more information about
+ *    creating layouts.
+ }
+type
+	ATSUTextLayout    = ^SInt32; { an opaque 32-bit type }
+
+{
+ *  ATSUStyle
+ *  
+ *  Discussion:
+ *    Style objects retain information about text such as font, point
+ *    size, color and other attributes. Styles are associated with text
+ *    through a layout object. See the definitions of the functions
+ *    ATSUSetRunStyle and ATSUCreateTextLayoutWithTextPtr for more
+ *    information about assigning styles to runs of text in a layout
+ *    object. See the definitions of the functions ATSUCreateStyle and
+ *    ATSUSetAttributes for more information on creating and
+ *    manipulating styles.
+ }
+type
+	ATSUStyle    = ^SInt32; { an opaque 32-bit type }
+	ATSUStylePtr = ^ATSUStyle;
+
+{
+ *  ATSUFontFallbacks
+ *  
+ *  Discussion:
+ *    ATSUFontFallbacks objects are used to store the desired font
+ *    fallback mode, list, and associated cache information. See the
+ *    definitions of ATSUFontFallbackMethod and ATSUSetObjFontFallbacks
+ *    for more information about setting up font fallbacks.
+ }
+type
+	ATSUFontFallbacks    = ^SInt32; { an opaque 32-bit type }
+
+{
+ *  ATSUTextMeasurement
+ *  
+ *  Discussion:
+ *    ATSUTextMeasurement is specific to ATSUI in that measurement
+ *    quantities are in fractional Fixed format instead of shorts used
+ *    in QuickDraw Text. This provides exact outline metrics and line
+ *    specifications such as line width, ascent, descent, and so on.
+ *    See FixMath.h for conversion functions for Fixed numbers.
+ }
+type
+	ATSUTextMeasurement = Fixed;
+	ATSUTextMeasurementPtr = ^ATSUTextMeasurement;
+
+{
+ *  ATSUFontID
+ *  
+ *  Discussion:
+ *    ATSUFontID indicates a particular font family and face.
+ *    ATSUFontID's are not guaranteed to remain constant across
+ *    sessions. Clients should use the font's unique name to get a font
+ *    token to store in documents which is guaranteed to remain
+ *    constant across sessions.
+ }
+type
+	ATSUFontID = FMFont;
+	ATSUFontIDPtr = ^ATSUFontID;
+
+{
+ *  ATSUFontFeatureType
+ *  
+ *  Discussion:
+ *    Used to identify a font feature type for a particular font. See
+ *    the definitions of the functions ATSUGetAllFontFeatures and
+ *    ATSUGetFontFeature for more information about font features.
+ }
+type
+	ATSUFontFeatureType = UInt16;
+	ATSUFontFeatureTypePtr = ^ATSUFontFeatureType;
+
+{
+ *  ATSUFontFeatureSelector
+ *  
+ *  Discussion:
+ *    Used to identify a font feature selector for a particular font.
+ *    See the definitions of the functions ATSUGetAllFontFeatures and
+ *    ATSUGetFontFeature for more information about font features.
+ }
+type
+	ATSUFontFeatureSelector = UInt16;
+	ATSUFontFeatureSelectorPtr = ^ATSUFontFeatureSelector;
+
+{
+ *  ATSUFontVariationAxis
+ *  
+ *  Discussion:
+ *    Used to identify a font variation axis for a particular font. See
+ *    the definitions of the functions ATSUGetAllFontVariations and
+ *    ATSUGetFontVariation for more information about font variations.
+ }
+type
+	ATSUFontVariationAxis = FourCharCode;
+	ATSUFontVariationAxisPtr = ^ATSUFontVariationAxis;
+
+{
+ *  ATSUFontVariationValue
+ *  
+ *  Discussion:
+ *    Used to identify a font variation value for a particular font.
+ *    See the definitions of the functions ATSUGetAllFontVariations and
+ *    ATSUGetFontVariation for more information about font variations.
+ }
+type
+	ATSUFontVariationValue = Fixed;
+	ATSUFontVariationValuePtr = ^ATSUFontVariationValue;
+
+{
+ *  ATSUAttributeTag
+ *  
+ *  Summary:
+ *    Constants used for style attributes, line controls, and layout
+ *    controls.
+ *  
+ *  Discussion:
+ *    The following constants are used to change settings in text
+ *    layout and style objects. Use the functions ATSUSetLineControls,
+ *    ATSUSetLayoutControls, and ATSUSetAttributes to set these values
+ *    in lines, layouts, and styles, respectively. Apple reserves tag
+ *    values 0 to 65535 (0 to 0x0000FFFF). ATSUI clients may create
+ *    their own tags with any other value.
+ }
+type
+	ATSUAttributeTag = UInt32;
+	ATSUAttributeTagPtr = ^ATSUAttributeTag;
+const
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: 0) Must not be less
+   * than zero. May be set as a line or layout control.
+   }
+  kATSULineWidthTag             = 1;
+
+  {
+   * (Type: Fixed) (Default value: 0) Angle is specified in degrees in
+   * right-handed coordinate system. May be set as a line control.
+   }
+  kATSULineRotationTag          = 2;
+
+  {
+   * (Type: Boolean) (Default value: GetSysDirection()) Must be 0 or 1.
+   * See below for convenience constants. May be set as a line or
+   * layout control.
+   }
+  kATSULineDirectionTag         = 3;
+
+  {
+   * (Type: Fract) (Default value: kATSUNoJustification) May be set as
+   * a line or layout control.
+   }
+  kATSULineJustificationFactorTag = 4;
+
+  {
+   * (Type: Fract) (Default value: kATSUStartAlignment) May be set as a
+   * line or layout control.
+   }
+  kATSULineFlushFactorTag       = 5;
+
+  {
+   * (Type: BslnBaselineRecord) (Default value: all zeros) Calculated
+   * from other style attributes (e.g., font and point size). May be
+   * set as a line or layout control.
+   }
+  kATSULineBaselineValuesTag    = 6;
+
+  {
+   * (Type: ATSLineLayoutOptions) (Default value: all zeros) See
+   * ATSLayoutTypes.h for a definition of the ATSLineLayoutOptions type
+   * and a list of possible values. May be set as a line or layout
+   * control.
+   }
+  kATSULineLayoutOptionsTag     = 7;
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: determined by font(s))
+   * Must not be less than zero. Starting in Mac OS X 10.2, you can
+   * retrieve this value as a line or layout control, even if you have
+   * not explicitly set it. This makes it easy to calculate line
+   * height. May be set as a line or layout control.
+   }
+  kATSULineAscentTag            = 8;
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: determined by font(s))
+   * Must not be less than zero. Starting in Mac OS X, you can retrieve
+   * this value as a line or layout control, even if you have not
+   * explicitly set it. This makes it easy to calculate line height.
+   * May be set as a line or layout control.
+   }
+  kATSULineDescentTag           = 9;
+
+  {
+   * (Type: RegionCode) (Default value: kTextRegionDontCare) See
+   * Script.h for possible values. May be set as a line or layout
+   * control.
+   }
+  kATSULineLangRegionTag        = 10;
+
+  {
+   * (Type: TextBreakLocatorRef) (Default value: NULL) See
+   * UnicodeUtilities.h for more information on creating a
+   * TextBreakLocator. May be set as a line or layout control.
+   }
+  kATSULineTextLocatorTag       = 11;
+
+  {
+   * (Type: ATSULineTruncation) (Default value: kATSUTruncateNone) See
+   * the definition of ATSULineTruncation for possible values. May be
+   * set as a line or layout control.
+   }
+  kATSULineTruncationTag        = 12;
+
+  {
+   * (Type: ATSUFontFallbacks) (Default value: current global fallback
+   * state) The current global fallback state is determined using the
+   * ATSUSetFontFallbacks function. The use of this function is not
+   * recommended. Instead, use the functions ATSUCreateFontFallbacks
+   * and ATSUSetObjFontFallbacks to create a ATSUFontFallbacks object,
+   * and then use the kATSULineFontFallbacksTag attribute to set the
+   * font fallbacks object as a layout control. See the definition of
+   * ATSUFontFallbacks for more information. May be set as a layout
+   * control.
+   }
+  kATSULineFontFallbacksTag     = 13;
+
+  {
+   * (Type: CFStringRef) (Default value: user setting in System
+   * Preferences) Indicates current setting for the decimal separator.
+   * This affects the behavior of decimal tabs. May be set as a line or
+   * layout control.
+   }
+  kATSULineDecimalTabCharacterTag = 14;
+
+  {
+   * (Type: ATSULayoutOperationOverrideSpecifier) (Default value: NULL)
+   * See ATSUnicodeDirectAccess.h for a definition of the
+   * ATSULayoutOperationOverrideSpecifier type. May be set as a layout
+   * control.
+   }
+  kATSULayoutOperationOverrideTag = 15;
+
+  {
+   * (Type: CGColorRef) (Default value: user setting in System
+   * Preferences) Indicates current setting for the highlight color.
+   * May be set as a line or layout control.
+   }
+  kATSULineHighlightCGColorTag  = 17;
+
+  {
+   * This is just for convenience. It is the upper limit of the line
+   * and layout tags.
+   }
+  kATSUMaxLineTag               = 18;
+
+  {
+   * This tag is obsolete. Please use kATSULineLangRegionTag instead.
+   }
+  kATSULineLanguageTag          = 10;
+
+  {
+   * (Type: CGContextRef) (Default value: NULL) Use this tag to produce
+   * Quartz rendering with ATSUI. See the definitions of the functions
+   * QDBeginCGContext and QDEndCGContext in Quickdraw.h for more
+   * information about creating a CGContext from a graphics port. May
+   * be set as a layout control.
+   }
+  kATSUCGContextTag             = 32767;
+
+  {
+   * (Type: Boolean) (Default value: false) For compatability purposes
+   * only. Choosing typographic styles from font families is preferred.
+   * Note this tag will produce a synthetic style for fonts that do not
+   * have a typographic style. May be set as a style attribute.
+   }
+  kATSUQDBoldfaceTag            = 256;
+
+  {
+   * (Type: Boolean) (Default value: false) For compatability purposes
+   * only. Choosing typographic styles from font families is preferred.
+   * Note this tag will produce a synthetic style for fonts that do not
+   * have a typographic style. May be set as a style attribute.
+   }
+  kATSUQDItalicTag              = 257;
+
+  {
+   * (Type: Boolean) (Default value: false) For compatability purposes
+   * only. May be set as a style attribute.
+   }
+  kATSUQDUnderlineTag           = 258;
+
+  {
+   * (Type: Boolean) (Default value: false) For compatability purposes
+   * only. May be set as a style attribute.
+   }
+  kATSUQDCondensedTag           = 259;
+
+  {
+   * (Type: Boolean) (Default value: false) For compatability purposes
+   * only. May be set as a style attribute.
+   }
+  kATSUQDExtendedTag            = 260;
+
+  {
+   * (Type: ATSUFontID) (Default value: LMGetApFontID() or if not
+   * valid, LMGetSysFontFam()) May be set as a style attribute.
+   }
+  kATSUFontTag                  = 261;
+
+  {
+   * (Type: Fixed) (Default value: Long2Fix(LMGetSysFontSize())) May be
+   * set as a style attribute.
+   }
+  kATSUSizeTag                  = 262;
+
+  {
+   * (Type: RGBColor) (Default value: (0, 0, 0)) May be set as a style
+   * attribute.
+   }
+  kATSUColorTag                 = 263;
+
+  {
+   * (Type: RegionCode) (Default value:
+   * GetScriptManagerVariable(smRegionCode)) See Script.h for a list of
+   * possible values. May be set as a style attribute.
+   }
+  kATSULangRegionTag            = 264;
+
+  {
+   * (Type: ATSUVerticalCharacterType) (Default value:
+   * kATSUStronglyHorizontal) See the definition of
+   * ATSUVerticalCharacterType for a list of possible values. May be
+   * set as a style attribute.
+   }
+  kATSUVerticalCharacterTag     = 265;
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: kATSUseGlyphAdvance)
+   * Must not be less than zero. May be set as a style attribute.
+   }
+  kATSUImposeWidthTag           = 266;
+
+  {
+   * (Type: Fixed) (Default value: 0) May be set as a style attribute.
+   }
+  kATSUBeforeWithStreamShiftTag = 267;
+
+  {
+   * (Type: Fixed) (Default value: 0) May be set as a style attribute.
+   }
+  kATSUAfterWithStreamShiftTag  = 268;
+
+  {
+   * (Type: Fixed) (Default value: 0) May be set as a style attribute.
+   }
+  kATSUCrossStreamShiftTag      = 269;
+
+  {
+   * (Type: Fixed) (Default value: kATSNoTracking) May be set as a
+   * style attribute.
+   }
+  kATSUTrackingTag              = 270;
+
+  {
+   * (Type: Fract) (Default value: 0) May be set as a style attribute.
+   }
+  kATSUHangingInhibitFactorTag  = 271;
+
+  {
+   * (Type: Fract) (Default value: 0) May be set as a style attribute.
+   }
+  kATSUKerningInhibitFactorTag  = 272;
+
+  {
+   * (Type: Fixed) (Default value: 0) Must be between -1.0 and 1.0. May
+   * be set as a style attribute.
+   }
+  kATSUDecompositionFactorTag   = 273;
+
+  {
+   * (Type: BslnBaselineClass) (Default value: kBSLNRomanBaseline) See
+   * SFNTLayoutTypes.h for more information. Use the constant
+   * kBSLNNoBaselineOverride to use intrinsic baselines. May be set as
+   * a style attribute.
+   }
+  kATSUBaselineClassTag         = 274;
+
+  {
+   * (Type: ATSJustPriorityWidthDeltaOverrides) (Default value: all
+   * zeros) See ATSLayoutTypes.h for more information. May be set as a
+   * style attribute.
+   }
+  kATSUPriorityJustOverrideTag  = 275;
+
+  {
+   * (Type: Boolean) (Default value: false) When set to true, ligatures
+   * and compound characters will not have divisable components. May be
+   * set as a style attribute.
+   }
+  kATSUNoLigatureSplitTag       = 276;
+
+  {
+   * (Type: Boolean) (Default value: false) When set to true, ATSUI
+   * will not use a glyph's angularity to determine its boundaries. May
+   * be set as a style attribute.
+   }
+  kATSUNoCaretAngleTag          = 277;
+
+  {
+   * (Type: Boolean) (Default value: false) When set to true, ATSUI
+   * will suppress automatic cross kerning (defined by font). May be
+   * set as a style attribute.
+   }
+  kATSUSuppressCrossKerningTag  = 278;
+
+  {
+   * (Type: Boolean) (Default value: false) When set to true, ATSUI
+   * will suppress glyphs' automatic optical positional alignment. May
+   * be set as a style attribute.
+   }
+  kATSUNoOpticalAlignmentTag    = 279;
+
+  {
+   * (Type: Boolean) (Default value: false) When set to true, ATSUI
+   * will force glyphs to hang beyond the line boundaries. May be set
+   * as a style attribute.
+   }
+  kATSUForceHangingTag          = 280;
+
+  {
+   * (Type: Boolean) (Default value: false) When set to true, ATSUI
+   * will not perform post-compensation justification if needed. May be
+   * set as a style attribute.
+   }
+  kATSUNoSpecialJustificationTag = 281;
+
+  {
+   * (Type: TextBreakLocatorRef) (Default value: NULL) See
+   * UnicodeUtilities.h for more information about creating a
+   * TextBreakLocator. May be set as a style attribute.
+   }
+  kATSUStyleTextLocatorTag      = 282;
+
+  {
+   * (Type: ATSStyleRenderingOptions) (Default value:
+   * kATSStyleNoOptions) See ATSLayoutTypes.h for a definition of
+   * ATSStyleRenderingOptions and a list of possible values. May be set
+   * as a style attribute.
+   }
+  kATSUStyleRenderingOptionsTag = 283;
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: determined by font)
+   * Must not be less than zero. Starting in Mac OS X 10.2, you can
+   * retrieve a value for this attribute, even if you have not
+   * explicitly set it. This can make calculating line height easier.
+   * May be set as a style attribute.
+   }
+  kATSUAscentTag                = 284;
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: determined by font)
+   * Must not be less than zero. Starting in Mac OS X 10.2, you can
+   * retrieve a value for this attribute, even if you have not
+   * explicitly set it. This can make calculating line height easier.
+   * May be set as a style attribute.
+   }
+  kATSUDescentTag               = 285;
+
+  {
+   * (Type: ATSUTextMeasurement) (Default value: determined by font)
+   * Must not be less than zero. Starting in Mac OS X 10.2, you can
+   * retrieve a value for this attribute, even if you have not
+   * explicitly set it. This can make calculating line height easier.
+   * May be set as a style attribute.
+   }
+  kATSULeadingTag               = 286;
+
+  {
+   * (Type: ATSUGlyphSelector) (Default value: 0) See the definition of
+   * ATSUGlyphSelector for more information and a list of possible
+   * values. May be set as a style attribute.
+   }
+  kATSUGlyphSelectorTag         = 287;
+
+  {
+   * (Type: ATSURGBAlphaColor) (Default value: (0, 0, 0, 1)) See the
+   * definition of ATSURGBAlphaColor for more information. May be set
+   * as a style attribute.
+   }
+  kATSURGBAlphaColorTag         = 288;
+
+  {
+   * (Type: CGAffineTransform) (Default value:
+   * CGAffineTransformIdentity) See the definition of CGAffineTransform
+   * in CGAffineTransform.h for more information. May be set as a style
+   * attribute.
+   }
+  kATSUFontMatrixTag            = 289;
+
+  {
+   * (Type: ATSUStyleLineCountType) (Default value:
+   * kATSUStyleSingleLineCount) Used to specify the number of strokes
+   * to be drawn for an underline. May be set as a style attribute.
+   }
+  kATSUStyleUnderlineCountOptionTag = 290;
+
+  {
+   * (Type: CGColorRef) (Default value: NULL) Used to specify the color
+   * of the strokes to draw for an underlined run of text. If NULL, the
+   * text color is used. May be set as a style attribute.
+   }
+  kATSUStyleUnderlineColorOptionTag = 291;
+
+  {
+   * (Type: Boolean) (Default value: false) Used to specify
+   * strikethrough style. May be set as a style attribute.
+   }
+  kATSUStyleStrikeThroughTag    = 292;
+
+  {
+   * (Type: ATSUStyleLineCountType) (Default value:
+   * kATSUStyleSingleLineCount) Used to specify the number of strokes
+   * to be drawn for a strikethrough. May be set as a style attribute.
+   }
+  kATSUStyleStrikeThroughCountOptionTag = 293;
+
+  {
+   * (Type: CGColorRef) (Default value: NULL) Used to specify the color
+   * of the strokes to draw for a strikethrough style. If NULL, the
+   * text color is used. May be set as a style attribute.
+   }
+  kATSUStyleStrikeThroughColorOptionTag = 294;
+
+  {
+   * (Type: Boolean) (Default value: false) Used to specify if text
+   * should be drawn with a drop shadow. Only takes effect if a
+   * CGContext is used for drawing. May be set as a style attribute.
+   }
+  kATSUStyleDropShadowTag       = 295;
+
+  {
+   * (Type: float) (Default value: 0.0) Used to specify the amount of
+   * blur for a dropshadow. May be set as a style attribute.
+   }
+  kATSUStyleDropShadowBlurOptionTag = 296;
+
+  {
+   * (Type: CGSize) (Default value: (3.0, -3.0)) Used to specify the
+   * amount of offset from the text to be used when drawing a
+   * dropshadow. May be set as a style attribute.
+   }
+  kATSUStyleDropShadowOffsetOptionTag = 297;
+
+  {
+   * (Type: CGColorRef) (Default value: NULL) Used to specify the color
+   * of the dropshadow. May be set as a style attribute.
+   }
+  kATSUStyleDropShadowColorOptionTag = 298;
+
+  {
+   * This is just for convenience. It is the upper limit of the style
+   * tags.
+   }
+  kATSUMaxStyleTag              = 299;
+
+  {
+   * This tag is obsolete. Please use kATSULangRegionTag instead. This
+   * is the maximum Apple ATSUI reserved tag value.  Client defined
+   * tags must be larger.
+   }
+  kATSULanguageTag              = 264;
+  kATSUMaxATSUITagValue         = 65535;
+
+
+{
+ *  ATSUAttributeValuePtr
+ *  
+ *  Summary:
+ *    Used to provide generic access for storage of attribute values,
+ *    which vary in size.
+ }
+type
+	ATSUAttributeValuePtr = Ptr;
+	ConstATSUAttributeValuePtr = Ptr;
+	ATSUAttributeValuePtrPtr = ^ATSUAttributeValuePtr;
+
+{
+ *  ATSUAttributeInfo
+ *  
+ *  Discussion:
+ *    ATSUAttributeInfo is used to provide a tag/size pairing. This
+ *    makes it possible to provide the client information about all the
+ *    attributes for a given range of text.  This structure is only
+ *    used to return to the client information about a complete set of
+ *    attributes.  An array of ATSUAttributeInfos is passed as a
+ *    parameter so that the client can find out what attributes are set
+ *    and what their individual sizes are; with that information, they
+ *    can then query about the values of the attributes they're
+ *    interested in. Because arrays of ATSUAttributeInfos are used as
+ *    parameters to functions, they have to be of a fixed size, hence
+ *    the value is not included in the structure.
+ }
+type
+	ATSUAttributeInfo = record
+		fTag: ATSUAttributeTag;
+		fValueSize: ByteCount;
+	end;
+	ATSUAttributeInfoPtr = ^ATSUAttributeInfo;
+
+{
+ *  ATSUCaret
+ *  
+ *  Discussion:
+ *    Contains the complete information needed to render a caret.  fX
+ *    and fY is the position of one of the caret's ends relative to the
+ *    origin position of the line the caret belongs. fDeltaX and
+ *    fDeltaY is the position of the caret's other end. Hence, to draw
+ *    a caret, simply call MoveTo(fX, fY) followed by LineTo(fDeltaX,
+ *    fDeltaY) or equivalent.  The ATSUCaret will contain the positions
+ *    needed to draw carets on angled lines and reflect angled carets
+ *    and leading/trailing split caret appearances.
+ }
+type
+	ATSUCaret = record
+		fX: Fixed;
+		fY: Fixed;
+		fDeltaX: Fixed;
+		fDeltaY: Fixed;
+	end;
+	ATSUCaretPtr = ^ATSUCaret;
+
+{
+ *  ATSUCursorMovementType
+ *  
+ *  Discussion:
+ *    Used to indicate how much to move the cursor when using the ATSUI
+ *    cusor movement routines. Note that kATSUByCharacterCluster is
+ *    only available in Mac OS X and in CarbonLib versions 1.3 and
+ *    later.
+ }
+type ATSUCursorMovementType = UInt16;
+const
+
+  {
+   * Cursor movement based on individual characters. The cursor will
+   * step through individual characters within ligatures.
+   }
+  kATSUByCharacter              = 0;
+
+  {
+   * Like kATSUByCharacter, but the cursor will treat ligatures as
+   * single entities.
+   }
+  kATSUByTypographicCluster     = 1;
+
+  {
+   * Cursor movement by whole words.
+   }
+  kATSUByWord                   = 2;
+
+  {
+   * Cursor movement by clusters based on characters only.
+   }
+  kATSUByCharacterCluster       = 3;
+
+  {
+   * Obsolete name for kATSUByTypographicCluster; do not use.
+   }
+  kATSUByCluster                = 1;
+
+
+{
+ *  ATSULineTruncation
+ *  
+ *  Summary:
+ *    Constants used with the kATSULineTruncationTag layout and line
+ *    control.
+ *  
+ *  Discussion:
+ *    The constants kATSUTruncateNone, kATSUTruncateStart,
+ *    kATSUTruncateEnd, and kATSUTruncateMiddle represent different
+ *    places in the text where glyphs should be replaced with an
+ *    elipsis should the text not fit within the width set by the
+ *    kATSULineWidthTag line and layout control. The constant
+ *    kATSUTruncFeatNoSquishing is special and can be bitwise OR'd with
+ *    any of the other constants. It indicates that ATSUI should not
+ *    perform negative justification to make the text fit. This can be
+ *    desirable for situations such as live resize, to prevent the text
+ *    from "wiggling".
+ }
+type ATSULineTruncation = UInt32;
+const
+  kATSUTruncateNone             = 0;
+  kATSUTruncateStart            = 1;
+  kATSUTruncateEnd              = 2;
+  kATSUTruncateMiddle           = 3;
+  kATSUTruncateSpecificationMask = $00000007;
+  kATSUTruncFeatNoSquishing     = $00000008;
+
+
+{
+ *  ATSUStyleLineCountType
+ *  
+ *  Discussion:
+ *    ATSUStyleLineCountType is used to designate how many lines will
+ *    be drawn for a given style type.  Currently only the underline
+ *    and strikethrough styles support this type.
+ }
+type ATSUStyleLineCountType = UInt16;
+const
+  kATSUStyleSingleLineCount     = 1;
+  kATSUStyleDoubleLineCount     = 2;
+
+
+{
+ *  ATSUVerticalCharacterType
+ *  
+ *  Discussion:
+ *    Use these constants along with the kATSUVerticalCharacterTag
+ *    layout control to determine whether the vertical or horizontal
+ *    forms of glyphs should be used. Note that this is independent of
+ *    line rotation.
+ }
+type ATSUVerticalCharacterType = UInt16;
+const
+  kATSUStronglyHorizontal       = 0;
+  kATSUStronglyVertical         = 1;
+
+
+{
+ *  ATSUStyleComparison
+ *  
+ *  Discussion:
+ *    ATSUStyleComparison is an enumeration with four values, and is
+ *    used by ATSUCompareStyles() to indicate if the first style
+ *    parameter contains as a proper subset, is equal to, or is
+ *    contained by the second style parameter.
+ }
+type ATSUStyleComparison = UInt16;
+const
+  kATSUStyleUnequal             = 0;
+  kATSUStyleContains            = 1;
+  kATSUStyleEquals              = 2;
+  kATSUStyleContainedBy         = 3;
+
+
+{
+ *  ATSUFontFallbackMethod
+ *  
+ *  Discussion:
+ *    ATSUFontFallbackMethod type defines the method by which ATSUI
+ *    will try to find an appropriate font for a character if the
+ *    assigned font does not contain the needed glyph(s) to represent
+ *    it.  This affects ATSUMatchFontsToText and font selection during
+ *    layout and drawing when ATSUSetTransientFontMatching is set ON.
+ }
+type ATSUFontFallbackMethod = UInt16;
+const
+
+  {
+   * When this constant is specified, all fonts on the system are
+   * searched for substitute glyphs.
+   }
+  kATSUDefaultFontFallbacks     = 0;
+
+  {
+   * This constant specifies that only the special last resort font be
+   * used for substitute glyphs.
+   }
+  kATSULastResortOnlyFallback   = 1;
+
+  {
+   * This constant specifies that a font list you provide should be
+   * sequentially searched for substitute glyphs before the ATSUI
+   * searches through all available fonts on the system. You specify
+   * this list through the iFonts parameter to the
+   * ATSUSetObjFontFallbacks function.
+   }
+  kATSUSequentialFallbacksPreferred = 2;
+
+  {
+   * This constants specifies that only the font list you provide
+   * should be sequentially searched for substitute glyphs. All other
+   * fonts on the system are ignored, except for the special last
+   * resort font. You specify the list of fonts you want ATSUI to use
+   * by passing it to the iFonts parameter of the
+   * ATSUSetObjFontFallbacks function.
+   }
+  kATSUSequentialFallbacksExclusive = 3;
+
+
+{
+ *  ATSUTabType
+ *  
+ *  Discussion:
+ *    ATSUTabType type defines the characteristic of ATSUI tabs. A Left
+ *    tab type specifies that the left side of affected text is to be
+ *    maintained flush against the tab stop.  A Right tab type
+ *    specifies that the right side of affected text is to be
+ *    maintained flush against the tab stop.  A Center tab type
+ *    specifies that the affected text centered about the tab stop. A
+ *    Decimal tab type specifies that the affected text will be aligned
+ *    such that the decimal character will by flush against the tab
+ *    stop.  The default decimal character is defined in System
+ *    Preferences.  A different decimal character can be defined by
+ *    using the ATSUAttributeTag kATSULineDecimalTabCharacterTag.
+ }
+
+type ATSUTabType = UInt16;
+const
+  kATSULeftTab                  = 0;
+  kATSUCenterTab                = 1;
+  kATSURightTab                 = 2;
+  kATSUDecimalTab               = 3;
+  kATSUNumberTabTypes           = 4;
+
+
+{
+ *  ATSUTab
+ *  
+ *  Discussion:
+ *    ATSUTab specifies the position and type of tab stop to be applied
+ *    to a ATSUTextLayout set through the ATSUI routine ATSUSetTabArray
+ *    and returned through ATSUGetTabArray.
+ }
+type 
+	ATSUTab = record
+  	tabPosition: ATSUTextMeasurement;
+	  tabType: ATSUTabType;
+	end;
+	ATSUTabPtr = ^ATSUTab;
+
+{
+ *  ATSURGBAlphaColor
+ *  
+ *  Discussion:
+ *    Use this structure with the kATSURGBAlphaColorTag attribute to
+ *    specify color for your text in an ATSUStyle. All values range
+ *    from 0.0 to 1.0.
+ }
+type
+	ATSURGBAlphaColor = record
+		red: Float32;
+		green: Float32;
+		blue: Float32;
+		alpha: Float32;
+	end;
+	ATSURGBAlphaColorPtr = ^ATSURGBAlphaColor;
+
+{
+ *  GlyphCollection
+ *  
+ *  Discussion:
+ *    GlyphCollection types represent the specific character
+ *    collection.  If the value is zero, kGlyphCollectionGID, then this
+ *    indicates that the glyph value represents the actual glyphID of a
+ *    specific font. Adobe collections are based on CID, rather than
+ *    glyph ID.
+ }
+
+type GlyphCollection = UInt16;
+const
+  kGlyphCollectionGID           = 0;
+  kGlyphCollectionAdobeCNS1     = 1;
+  kGlyphCollectionAdobeGB1      = 2;
+  kGlyphCollectionAdobeJapan1   = 3;
+  kGlyphCollectionAdobeJapan2   = 4;
+  kGlyphCollectionAdobeKorea1   = 5;
+  kGlyphCollectionUnspecified   = $FF;
+
+
+{
+ *  ATSUGlyphSelector
+ *  
+ *  Discussion:
+ *    ATSUGlyphSelector can direct ATSUI to use a specific glyph
+ *    instead of the one that ATSUI normally derives.  The glyph can be
+ *    specified either as a glyphID (specific to the font used) or CID
+ *    from a specfic collection defined by the collection entry.
+ }
+type
+	ATSUGlyphSelector = record
+
+  {
+   * A glyph collection constant. See the definition of GlyphCollection
+   * for possible values for this field.
+   }
+		collection: GlyphCollection;
+
+  {
+   * The glyph ID of the glyph (when collection is
+   * kGlyphCollectionGID). For Adobe glyph collections, this value
+   * represents a CID
+   }
+		glyphID: GlyphID;
+	end;
+	ATSUGlyphSelectorPtr = ^ATSUGlyphSelector;
+
+type ATSUCustomAllocFunc = function( refCon: UnivPtr; howMuch: ByteCount ): Ptr;
+type ATSUCustomFreeFunc = procedure( refCon: UnivPtr; doomedBlock: UnivPtr );
+type ATSUCustomGrowFunc = function( refCon: UnivPtr; oldBlock: UnivPtr; oldSize: ByteCount; newSize: ByteCount ): Ptr;
+
+{
+ *  ATSUMemoryCallbacks
+ *  
+ *  Discussion:
+ *    ATSUMemoryCallbacks is a union struct that allows the ATSUI
+ *    client to specify a specific heap for ATSUI use or allocation
+ *    callbacks of which ATSUI is to use each time ATSUI performs a
+ *    memory operation (alloc, grow, free).
+ }
+type
+	ATSUMemoryCallbacks = record
+		case SInt16 of
+			1: (
+				callbacks: record
+					Alloc: ATSUCustomAllocFunc;
+					Free: ATSUCustomFreeFunc;
+					Grow: ATSUCustomGrowFunc;
+					memoryRefCon: Ptr;
+				end;
+			);
+			2: (
+				heapToUse: THz;
+			);
+	end;
+	ATSUMemoryCallbacksPtr = ^ATSUMemoryCallbacks;
+
+{
+ *  ATSUHeapSpec
+ *  
+ *  Discussion:
+ *    ATSUHeapSpec provides the ATSUI client a means of specifying the
+ *    heap from which ATSUI should allocate its dynamic memory or
+ *    specifying that ATSUI should use the memory callback provided by
+ *    the client.
+ }
+type ATSUHeapSpec = UInt16;
+const
+  kATSUUseCurrentHeap           = 0;
+  kATSUUseAppHeap               = 1;
+  kATSUUseSpecificHeap          = 2;
+  kATSUUseCallbacks             = 3;
+
+
+{
+ *  ATSUMemorySetting
+ *  
+ *  Discussion:
+ *    ATSUMemorySetting is used to store the results from a
+ *    ATSUSetMemoryAlloc or a ATSUGetCurrentMemorySetting call.  It can
+ *    also be used to change the current ATSUMemorySetting by passing
+ *    it into the ATSUSetCurrentMemorySetting call.
+ }
+type
+	ATSUMemorySetting    = ^SInt32; { an opaque 32-bit type }
+
+
+{
+ *  ATSUGlyphInfo
+ *  
+ *  Summary:
+ *    Structure returned by ATSUGetGlyphInfo
+ *  
+ *  Discussion:
+ *    ATSUGetGlyphInfo will return an array of these structs, one for
+ *    each glyph in the specified range. You can then make changes to
+ *    the data before drawing it with ATSUDrawGlyphInfo. These
+ *    functions are no longer recommended; see ATSUnicodeDirectAccess.h
+ *    for replacement functions.
+ }
+type
+	ATSUGlyphInfo = record
+		glyphID: GlyphID;
+		reserved: UInt16;
+		layoutFlags: UInt32;
+		charIndex: UniCharArrayOffset;
+		style: ATSUStyle;
+		deltaY: Float32;
+		idealX: Float32;
+		screenX: SInt16;
+		caretX: SInt16;
+	end;
+	ATSUGlyphInfoPtr = ^ATSUGlyphInfo;
+
+{
+ *  ATSUGlyphInfoArray
+ *  
+ *  Summary:
+ *    Structure returned by ATSUGetGlyphInfo
+ *  
+ *  Discussion:
+ *    This data structure is returned by ATSUGetGlyphInfo. layout is
+ *    the same layout you pass in to ATSUGetGlyphInfo, numGlyphs is the
+ *    number of glyphs stored in the array glyphs. See the definition
+ *    of ATSUGlyphInfo for more information about the data structures
+ *    contained in the glyphs array. The ATSUGetGlyphInfo function is
+ *    no longer recommended; see ATSUnicodeDirectAccess.h for
+ *    replacement functions.
+ }
+type
+	ATSUGlyphInfoArray = record
+		layout: ATSUTextLayout;
+		numGlyphs: ItemCount;
+  	glyphs: array[0..0] of ATSUGlyphInfo;
+	end;
+	ATSUGlyphInfoArrayPtr = ^ATSUGlyphInfoArray;
+{*******************************************************************************}
+{  ATSUI highlighting method constants and typedefs                             }
+{*******************************************************************************}
+
+{
+ *  ATSUHighlightMethod
+ *  
+ *  Discussion:
+ *    Use the constants with the function ATSUSetHighlightingMethod to
+ *    determine the method of highlighting to use. kInvertHighlighting
+ *    will cause ATSUI to perform a simple color inversion on the area
+ *    around the text. Although this method requires the least work, it
+ *    does not produce the best visual results. kRedrawHighlighting
+ *    will cause ATSUI to redraw the text whenever highlighting or
+ *    unhighlighting it. This method produces the best visual results,
+ *    but it does require you to specify a way for ATSUI to redraw the
+ *    background behind the text after an unhighlight operation. See
+ *    the definitions of ATSUUnhighlightData, ATSUBackgroundData,
+ *    ATSUBackgroundDataType, and RedrawBackgroundProcPtr for more
+ *    information.
+ }
+type ATSUHighlightMethod = UInt32;
+const
+  kInvertHighlighting           = 0;
+  kRedrawHighlighting           = 1;
+
+
+{
+ *  ATSUBackgroundDataType
+ *  
+ *  Discussion:
+ *    Use these constants for the dataType field in the
+ *    ATSUUnhighlightData structure. kATSUBackgroundColor refers to a
+ *    solid color background, while kATSUBackgroundCallback refers to a
+ *    redrawing callback function. Note that if you specify
+ *    kATSUBackgroundCallback, you must provide a callback function.
+ }
+type ATSUBackgroundDataType = UInt32;
+const
+  kATSUBackgroundColor          = 0;
+  kATSUBackgroundCallback       = 1;
+
+
+{
+ *  ATSUBackgroundColor
+ *  
+ *  Discussion:
+ *    A background color used by ATSUI to redraw the background after a
+ *    call to ATSUUnhighlight text when the highlighting method is set
+ *    to kRedrawHighlighting. See the definitions of ATSUBackgroundData
+ *    and ATSUUnhighlightData for more information.
+ }
+
+type ATSUBackgroundColor = ATSURGBAlphaColor;
+
+{
+ *  RedrawBackgroundProcPtr
+ *  
+ *  Discussion:
+ *    RedrawBackgroundProcPtr is a pointer to a client-supplied
+ *    callback function (e.g. MyRedrawBackgroundProc) for redrawing
+ *    complex backgrounds (and optionally the text as well) that can be
+ *    called by ATSUI for highlighting if the client has called
+ *    ATSUSetHighlightingMethod with kRedrawHighlighting for the
+ *    iMethod parameter. In order for ATSUI to call the client
+ *    function, the client must (1) pass a pointer to the client
+ *    function to NewRedrawBackgroundUPP() in order to obtain a
+ *    RedrawBackgroundUPP, and (2) pass the RedrawBackgroundUPP in the
+ *    unhighlightData.backgroundUPP field of the iUnhighlightData
+ *    parameter for the ATSUSetHighlightingMethod call. When finished,
+ *    the client should call DisposeRedrawBackgroundUPP with the
+ *    RedrawBackgroundUPP.
+ *  
+ *  Parameters:
+ *    
+ *    iLayout:
+ *      The layout to which the highlighting is being applied. The
+ *      client function can use this to redraw the text.
+ *    
+ *    iTextOffset:
+ *      The offset of the text that is being highlighted; can be used
+ *      by the client function to redraaw the text.
+ *    
+ *    iTextLength:
+ *      The length of the text that is being highlighted; can be used
+ *      by the client function to redraaw the text.
+ *    
+ *    iUnhighlightArea:
+ *      An array of ATSTrapezoids that describes the highlight area.
+ *      The ATSTrapezoid array is ALWAYS in QD coordinates.
+ *    
+ *    iTrapezoidCount:
+ *      The count of ATSTrapezoids in iUnhighlightArea.
+ *  
+ *  Result:
+ *    A Boolean result indicating whether ATSUI should redraw the text.
+ *    If the client function redraws the text, it should return false,
+ *    otherwise it should return true to have ATSUI redraw any text
+ *    that needs to be redrawn.
+ }
+type RedrawBackgroundProcPtr = function( iLayout: ATSUTextLayout; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iUnhighlightArea: ATSTrapezoidPtr; iTrapezoidCount: ItemCount ): Boolean;
+// typedef STACK_UPP_TYPE(RedrawBackgroundProcPtr)                 RedrawBackgroundUPP;
+// Beats me what this translates to.  If someone finds out they can tell me and we'll update it
+type RedrawBackgroundUPP = Ptr;
+
+{
+ *  NewRedrawBackgroundUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function NewRedrawBackgroundUPP( userRoutine: RedrawBackgroundProcPtr ): RedrawBackgroundUPP; external name '_NewRedrawBackgroundUPP';
+
+{
+ *  DisposeRedrawBackgroundUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+procedure DisposeRedrawBackgroundUPP( userUPP: RedrawBackgroundUPP ); external name '_DisposeRedrawBackgroundUPP';
+
+{
+ *  InvokeRedrawBackgroundUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in ApplicationServices.framework
+ *    CarbonLib:        not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+function InvokeRedrawBackgroundUPP( iLayout: ATSUTextLayout; iTextOffset: UniCharArrayOffset; iTextLength: UniCharCount; iUnhighlightArea: ATSTrapezoidPtr; iTrapezoidCount: ItemCount; userUPP: RedrawBackgroundUPP ): Boolean; external name '_InvokeRedrawBackgroundUPP';
+
+
+{
+ *  ATSUBackgroundData
+ *  
+ *  Summary:
+ *    Data describing one of two methods for ATSUI to unhighlight text.
+ *  
+ *  Discussion:
+ *    When you call ATSUUnhighlightText and the highlighting method
+ *    used is kRedrawHighlighting, ATSUI must redraw the text,
+ *    including the background, when unhighlighting. The two ways of
+ *    doing this are by telling ATSUI to (1) use a solid color to
+ *    repaint the background (2) use a callback function to repaint the
+ *    background. This union provides that information to ATSUI. See
+ *    the definitions of ATSUUnhighlightData, RedrawBackgroundProcPtr,
+ *    and ATSUSetHighlightingMethod for more information.
+ }
+type
+	ATSUBackgroundData = record
+		case SInt16 of
+			1: (
+				{
+				 * Specifies a color for ATSUI to repaint the background.
+				 }
+					backgroundColor: ATSUBackgroundColor;
+			);
+			2: (
+				{
+				 * Specifies a Universal Procedure Pointer for ATSUI to call to
+				 * redraw the background.
+				 }
+					backgroundUPP: RedrawBackgroundUPP;
+			);
+	end;
+	ATSUBackgroundDataPtr = ^ATSUBackgroundData;
+
+{
+ *  ATSUUnhighlightData
+ *  
+ *  Summary:
+ *    Struct for defining a method for ATSUI to unhighlight text.
+ *  
+ *  Discussion:
+ *    There are two methods of highlighting available on Mac OS X:
+ *    invert and redraw. For the invert method, no unhighlight method
+ *    needs to be specified. ATSUI will simply higlight text by
+ *    performing a color inversion on the area surrounding the test.
+ *    However, for best results, the redraw method is perferred. With
+ *    this method, ATSUI will redraw text with a new background when
+ *    highlighting, and redraw it again when unhighlighting. When using
+ *    the redraw method, ATSUI needs to know how to restore the
+ *    backround when unhighlighting text. That is where the unhighlight
+ *    data comes in. This struct tells ATSUI how to restore the
+ *    background after a highlight. There are two methods for
+ *    specifying this information to ATSUI. One is by specifying a
+ *    solid color, the other by providing a callback for redrawing part
+ *    of the background.
+ }
+type
+	ATSUUnhighlightData = record
+
+  {
+   * Determines which method to use for restoring the background after
+   * a highlight; solid color (kATSUBackgroundColor), or drawing
+   * callback (kATSUBackgroundCallback). See also the definition of
+   * ATSUBackgroundDataType.
+   }
+		dataType: ATSUBackgroundDataType;
+
+  {
+   * This union provides the actual data for ATSUI to use when
+   * redrawing the background. See the definition of ATSUBackgroundData
+   * for more information.
+   }
+		unhighlightData: ATSUBackgroundData;
+	end;
+	ATSUUnhighlightDataPtr = ^ATSUUnhighlightData;
+{******************************************************************************}
+{ Other ATSUI constants                                                        }
+{******************************************************************************}
+
+{
+ *  Summary:
+ *    Line direction types
+ *  
+ *  Discussion:
+ *    These constants are used with the kATSULineDirectionTag control
+ *    to determine overall line direction.
+ }
+const
+  {
+   * Imposes left-to-right or top-to-bottom dominant direction.
+   }
+  kATSULeftToRightBaseDirection = 0;
+
+  {
+   * Impose right-to-left or bottom-to-top dominant direction.
+   }
+  kATSURightToLeftBaseDirection = 1;
+
+const
+	kATSUStartAlignment    = Fract($00000000);
+	kATSUEndAlignment      = Fract($40000000);
+	kATSUCenterAlignment   = Fract($20000000);
+	kATSUNoJustification   = Fract($00000000);
+	kATSUFullJustification = Fract($40000000);
+
+{
+ *  Summary:
+ *    This constant will be returned from ATSUFindFontFromName if no
+ *    valid font can be found. If you pass this constant to
+ *    ATSUSetAttributes, it will produce an error.
+ }
+const
+  kATSUInvalidFontID            = 0;
+
+
+{
+ *  Summary:
+ *    Pass this constant to line breaking functions (i.e.,
+ *    ATSUBreakLine, ATSUBatchBreakLines) if you have already set a
+ *    line width as a layout control via the kATSULineWidthTag
+ *    attribute.
+ }
+const
+  kATSUUseLineControlWidth      = $7FFFFFFF;
+
+
+{
+ *  Summary:
+ *    Pass this constant to the iSelector parameter of the
+ *    ATSUGetFontFeatureNameCode function if you wish to obtain the
+ *    name code for a feature type rather than a feature selector.
+ }
+const
+  kATSUNoSelector               = $0000FFFF;
+
+
+{
+ *  Summary:
+ *    Text buffer convenience constants.
+ *  
+ *  Discussion:
+ *    These constants refer to the beginning and end of a text buffer.
+ *    Functions which accept these constants are marked below. Do not
+ *    pass these constants to functions which do not explicity state
+ *    they will accept them.
+ }
+const
+
+  {
+   * Refers to the beginning of a text buffer.
+   }
+  kATSUFromTextBeginning        = $FFFFFFFF;
+
+  {
+   * Refers to the end of a text buffer.
+   }
+  kATSUToTextEnd                = $FFFFFFFF;
+
+  {
+   * Used for bidi cursor movement between paragraphs.
+   }
+  kATSUFromPreviousLayout       = $FFFFFFFE;
+
+  {
+   * Used for bidi cursor movement between paragraphs.
+   }
+  kATSUFromFollowingLayout      = $FFFFFFFD;
+
+
+{
+ *  Summary:
+ *    Other convenience constants.
+ }
+const
+
+  {
+   * Pass this constant to functions that require a set of coordinates
+   * (i.e., ATSUDrawText, ATSUHighlightText) if you want ATSUI to use
+   * the current Quickdraw graphics port pen location.
+   }
+  kATSUUseGrafPortPenLoc        = $FFFFFFFF;
+
+  {
+   * Pass this constant to functions such as ATSUClearAttributes and
+   * ATSUClearLayoutControls if you wish to clear all settings instead
+   * of a specific array of settings.
+   }
+  kATSUClearAll                 = $FFFFFFFF;
+
+end.

+ 545 - 0
packages/extra/univint/AVLTree.pas

@@ -0,0 +1,545 @@
+{
+     File:       AVLTree.p
+ 
+     Contains:   Prototypes for routines which create, destroy, allow for
+ 
+     Version:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1999-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AVLTree;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,MixedMode;
+
+
+{$ALIGN MAC68K}
+
+
+type
+	AVLFlags 					= UInt32;
+const
+	kAVLFlagUseHandleForDataStorageMask = $00000001;
+
+	{	 The visit stage for AVLWalk() walkProcs 	}
+
+type
+	AVLVisitStage 				= UInt16;
+const
+	kAVLPreOrder				= 0;
+	kAVLInOrder					= 1;
+	kAVLPostOrder				= 2;
+
+	{	 The order the tree is walked or disposed of. 	}
+
+type
+	AVLOrder 					= UInt16;
+const
+	kAVLLeftToRight				= 0;
+	kAVLRightToLeft				= 1;
+
+	{	 The type of the node being passed to a callback proc. 	}
+
+type
+	AVLNodeType 				= UInt16;
+const
+	kAVLIsTree					= 0;
+	kAVLIsLeftBranch			= 1;
+	kAVLIsRightBranch			= 2;
+	kAVLIsLeaf					= 3;
+	kAVLNullNode				= 4;
+
+	errItemAlreadyInTree		= -960;
+	errNotValidTree				= -961;
+	errItemNotFoundInTree		= -962;
+	errCanNotInsertWhileWalkProcInProgress = -963;
+	errTreeIsLocked				= -964;
+	errTreeIsCorrupt			= -965;
+
+	{   The structure of a tree.  It's opaque; don't assume it's 52 bytes in size. }
+
+type
+	AVLTreeStructPtr = ^AVLTreeStruct;
+	AVLTreeStruct = record
+		signature:				OSType;
+		privateStuff:			array [0..11] of UInt32;
+	end;
+
+	AVLTreePtr							= ^AVLTreeStruct;
+	{
+	    Every tree must have a function which compares the data for two items and returns < 0, 0, or >0
+	    for the items - < 0 if the first item is 'before' the second item according to some criteria,
+	    == 0 if the two items are identical according to the criteria, or > 0 if the first item is
+	    'after' the second item according to the criteria.  The comparison function is also passed the
+	    node type, but most of the time this can be ignored.
+	}
+{$ifc TYPED_FUNCTION_POINTERS}
+	AVLCompareItemsProcPtr = function(tree: AVLTreePtr; i1: UnivPtr; i2: UnivPtr; nd_typ: AVLNodeType): SInt32;
+{$elsec}
+	AVLCompareItemsProcPtr = ProcPtr;
+{$endc}
+
+	{
+	    Every tree must have a itemSizeProc; this routine gets passed a pointer to the item's data and
+	    returns the size of the data.  If a tree contains records of a fixed size, this function can
+	    just return sizeof( that-struct ); otherwise it should calculate the size of the item based on
+	    the data for the item.
+	}
+{$ifc TYPED_FUNCTION_POINTERS}
+	AVLItemSizeProcPtr = function(tree: AVLTreePtr; itemPtr: UnivPtr): UInt32;
+{$elsec}
+	AVLItemSizeProcPtr = ProcPtr;
+{$endc}
+
+	{
+	    A tree may have an optional disposeItemProc, which gets called whenever an item is removed
+	    from the tree ( via AVLRemove() or when AVLDispose() deletes all of the items in the tree ).
+	    This might be useful if the nodes in the tree own 'resources'  ( like, open files ) which
+	    should be released before the item is removed.
+	}
+{$ifc TYPED_FUNCTION_POINTERS}
+	AVLDisposeItemProcPtr = procedure(tree: AVLTreePtr; dataP: UnivPtr);
+{$elsec}
+	AVLDisposeItemProcPtr = ProcPtr;
+{$endc}
+
+	{
+	    The common way to iterate across all of the items in a tree is via AVLWalk(), which takes
+	    a walkProcPtr.  This function will get called for every item in the tree three times, as
+	    the tree is being walked across.  First, the walkProc will get called with visitStage ==
+	    kAVLPreOrder, at which point internally the node of the tree for the given data has just
+	    been reached.  Later, this function will get called with visitStage == kAVLInOrder, and
+	    lastly this function will get called with visitStage == kAVLPostOrder.
+	    The 'minimum' item in the tree will get called with visitStage == kInOrder first, followed
+	    by the 'next' item in the tree, up until the last item in the tree structure is called.
+	    In general, you'll only care about calls to this function when visitStage == kAVLInOrder.
+	}
+{$ifc TYPED_FUNCTION_POINTERS}
+	AVLWalkProcPtr = function(tree: AVLTreePtr; dataP: UnivPtr; visitStage: AVLVisitStage; node: AVLNodeType; level: UInt32; balance: SInt32; refCon: UnivPtr): OSErr;
+{$elsec}
+	AVLWalkProcPtr = ProcPtr;
+{$endc}
+
+{$ifc OPAQUE_UPP_TYPES}
+	AVLCompareItemsUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AVLCompareItemsUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	AVLItemSizeUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AVLItemSizeUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	AVLDisposeItemUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AVLDisposeItemUPP = UniversalProcPtr;
+{$endc}	
+{$ifc OPAQUE_UPP_TYPES}
+	AVLWalkUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AVLWalkUPP = UniversalProcPtr;
+{$endc}	
+
+const
+	uppAVLCompareItemsProcInfo = $00002FF0;
+	uppAVLItemSizeProcInfo = $000003F0;
+	uppAVLDisposeItemProcInfo = $000003C0;
+	uppAVLWalkProcInfo = $000FEBE0;
+	{
+	 *  NewAVLCompareItemsUPP()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   available as macro/inline
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewAVLCompareItemsUPP(userRoutine: AVLCompareItemsProcPtr): AVLCompareItemsUPP; external name '_NewAVLCompareItemsUPP'; { old name was NewAVLCompareItemsProc }
+{
+ *  NewAVLItemSizeUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewAVLItemSizeUPP(userRoutine: AVLItemSizeProcPtr): AVLItemSizeUPP; external name '_NewAVLItemSizeUPP'; { old name was NewAVLItemSizeProc }
+{
+ *  NewAVLDisposeItemUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewAVLDisposeItemUPP(userRoutine: AVLDisposeItemProcPtr): AVLDisposeItemUPP; external name '_NewAVLDisposeItemUPP'; { old name was NewAVLDisposeItemProc }
+{
+ *  NewAVLWalkUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewAVLWalkUPP(userRoutine: AVLWalkProcPtr): AVLWalkUPP; external name '_NewAVLWalkUPP'; { old name was NewAVLWalkProc }
+{
+ *  DisposeAVLCompareItemsUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAVLCompareItemsUPP(userUPP: AVLCompareItemsUPP); external name '_DisposeAVLCompareItemsUPP';
+{
+ *  DisposeAVLItemSizeUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAVLItemSizeUPP(userUPP: AVLItemSizeUPP); external name '_DisposeAVLItemSizeUPP';
+{
+ *  DisposeAVLDisposeItemUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAVLDisposeItemUPP(userUPP: AVLDisposeItemUPP); external name '_DisposeAVLDisposeItemUPP';
+{
+ *  DisposeAVLWalkUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAVLWalkUPP(userUPP: AVLWalkUPP); external name '_DisposeAVLWalkUPP';
+{
+ *  InvokeAVLCompareItemsUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAVLCompareItemsUPP(tree: AVLTreePtr; i1: UnivPtr; i2: UnivPtr; nd_typ: AVLNodeType; userRoutine: AVLCompareItemsUPP): SInt32; external name '_InvokeAVLCompareItemsUPP'; { old name was CallAVLCompareItemsProc }
+{
+ *  InvokeAVLItemSizeUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAVLItemSizeUPP(tree: AVLTreePtr; itemPtr: UnivPtr; userRoutine: AVLItemSizeUPP): UInt32; external name '_InvokeAVLItemSizeUPP'; { old name was CallAVLItemSizeProc }
+{
+ *  InvokeAVLDisposeItemUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure InvokeAVLDisposeItemUPP(tree: AVLTreePtr; dataP: UnivPtr; userRoutine: AVLDisposeItemUPP); external name '_InvokeAVLDisposeItemUPP'; { old name was CallAVLDisposeItemProc }
+{
+ *  InvokeAVLWalkUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAVLWalkUPP(tree: AVLTreePtr; dataP: UnivPtr; visitStage: AVLVisitStage; node: AVLNodeType; level: UInt32; balance: SInt32; refCon: UnivPtr; userRoutine: AVLWalkUPP): OSErr; external name '_InvokeAVLWalkUPP'; { old name was CallAVLWalkProc }
+{
+    Create an AVL tree.  The compareItemsProc and the sizeItemProc are required; disposeItemProc is
+    optional and can be nil.  The refCon is stored with the list, and is passed back to the
+    compareItemsProc, sizeItemProc, and disposeItemsProc calls.  The allocation of the tree ( and all
+    nodes later added to the list with AVLInsert ) will be created in what is the current zone at the
+    time AVLInit() is called.  Always call AVLDispose() to dispose of a list created with AVLInit().
+}
+{
+ *  AVLInit()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLInit(flags: UInt32; compareItemsProc: AVLCompareItemsUPP; sizeItemProc: AVLItemSizeUPP; disposeItemProc: AVLDisposeItemUPP; refCon: UnivPtr; var tree: AVLTreePtr): OSErr; external name '_AVLInit';
+{
+    Dispose of an AVL tree.  This will dispose of each item in the tree in the order specified,
+    call the tree's disposeProc proc for each item, and then dispose of the space allocated for
+    the tree itself.
+}
+{
+ *  AVLDispose()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLDispose(var tree: AVLTreePtr; order: AVLOrder): OSErr; external name '_AVLDispose';
+{
+    Iterate across all of the items in the tree, in the order specified.  kLeftToRight is
+    basically lowest-to-highest order, kRightToLeft is highest-to-lowest order.  For each
+    node in the tree, it will call the walkProc with three messages ( at the appropriate 
+    time ).  First, with kAVLPreOrder when the walking gets to this node in the tree,
+    before handling either the left or right subtree, secondly, with kAVLInOrder after
+    handling one subtree but before handling the other, and lastly with kAVLPostOrder after
+    handling both subtrees.  If you want to handle items in order, then only do something
+    if the visit stage is kAVLInOrder.  You can only call AVLRemove() from inside a walkProc
+    if visit stage is kAVLPostOrder ( because if you remove a node during the pre or in order
+    stages you will corrupt the list ) OR if you return a non-zero result from the walkProc
+    call which called AVLRemove() to immediately terminate the walkProc.  Do not call AVLInsert()
+    to insert a node into the tree from inside a walkProc.
+    The walkProc function gets called with the AVLTreePtr, a pointer to the data for the
+    current node ( which you can change in place as long as you do not affect the order within
+    the tree ), the visit stage, the type of the current node ( leaf node, right or left branch,
+    or full tree ), the level within the tree ( the root is level 1 ), the balance for the
+    current node, and the refCon passed to AVLWalk().  This refCon is different from the one passed
+    into AVLInit(); use AVLGetRefCon() to get that refCon if you want it inside a walkProc.
+    ( Most walkProcs will not care about the values for node type, level, or balance. )
+}
+{
+ *  AVLWalk()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLWalk(tree: AVLTreePtr; walkProc: AVLWalkUPP; order: AVLOrder; walkRefCon: UnivPtr): OSErr; external name '_AVLWalk';
+{   Return  the number of items in the given tree. }
+{
+ *  AVLCount()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLCount(tree: AVLTreePtr; var count: UInt32): OSErr; external name '_AVLCount';
+{
+    Return the one-based index-th item from the tree by putting it's data at dataPtr
+    if dataPtr is non-nil, and it's size into *itemSize if itemSize is non-nil.
+    If index is out of range, return errItemNotFoundInTree.  ( Internally, this does
+    an AVLWalk(), so the tree can not be modified while this call is in progress ).
+}
+{
+ *  AVLGetIndItem()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLGetIndItem(tree: AVLTreePtr; index: UInt32; dataPtr: UnivPtr; var itemSize: UInt32): OSErr; external name '_AVLGetIndItem';
+{
+    Insert the given item into the tree.  This will call the tree's sizeItemProc
+    to determine how big the item at data is, and then will make a copy of the
+    item and insert it into the tree in the appropriate place.  If an item already
+    exists in the tree with the same key ( so that the compareItemsUPP returns 0
+    when asked to compare this item to an existing one ), then it will return
+    errItemNotFoundInTree.
+}
+{
+ *  AVLInsert()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLInsert(tree: AVLTreePtr; data: UnivPtr): OSErr; external name '_AVLInsert';
+{
+    Remove any item from the tree with the given key.  If dataPtr != nil, then
+    copy the item's data to dataPtr before removing it from the tree.  Before
+    removing the item, call the tree's disposeItemProc to let it release anything
+    used by the data in the tree.  It is not necessary to fill in a complete
+    record for key, only that the compareItemsProc return 0 when asked to compare
+    the data at key with the node in the tree to be deleted.  If the item cannot
+    be found in the tree, this will return errItemNotFoundInTree.
+}
+{
+ *  AVLRemove()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLRemove(tree: AVLTreePtr; key: UnivPtr; dataPtr: UnivPtr; var itemSize: UInt32): OSErr; external name '_AVLRemove';
+{
+    Find the item in the tree with the given key, and return it's data in
+    dataPtr ( if dataPtr != nil ), and it's size in *itemSize ( if itemSize
+    != nil ).  It is not necessary to fill in a complete record for key,
+    only that the compareItemsProc return 0 when asked to compare the data
+    at key with the node in the tree to be deleted.  If the item cannot
+    be found in the tree, this will return errItemNotFoundInTree.
+}
+{
+ *  AVLFind()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLFind(tree: AVLTreePtr; key: UnivPtr; dataPtr: UnivPtr; var itemSize: UInt32): OSErr; external name '_AVLFind';
+{
+    Get the refCon for the given tree ( set in AVLInit ) and return it.
+    If the given tree is invalid, then return nil.
+}
+{
+ *  AVLGetRefcon()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.0 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AVLGetRefcon(tree: AVLTreePtr; var refCon: UnivPtr): OSErr; external name '_AVLGetRefcon';
+{
+    Get the refCon for the given tree ( set in AVLInit ) and return it.
+    If the given tree is invalid, then return nil.
+}
+{$ifc CALL_NOT_IN_CARBON}
+{
+ *  AVLLockTree()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.2.1 and later
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AVLLockTree(tree: AVLTreePtr): OSErr; external name '_AVLLockTree';
+{
+    Get the refCon for the given tree ( set in AVLInit ) and return it.
+    If the given tree is invalid, then return nil.
+}
+{
+ *  AVLUnlockTree()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.2.1 and later
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AVLUnlockTree(tree: AVLTreePtr): OSErr; external name '_AVLUnlockTree';
+{
+    Get the refCon for the given tree ( set in AVLInit ) and return it.
+    If the given tree is invalid, then return nil.
+}
+{
+ *  AVLCheckTree()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.2.1 and later
+ *    CarbonLib:        not available
+ *    Mac OS X:         not available
+ }
+function AVLCheckTree(tree: AVLTreePtr): OSErr; external name '_AVLCheckTree';
+{$endc}  {CALL_NOT_IN_CARBON}
+
+{$ALIGN MAC68K}
+
+
+end.

+ 717 - 0
packages/extra/univint/AXConstants.pas

@@ -0,0 +1,717 @@
+{
+ *  AXConstants.h
+ *
+ *  Created by John Louch on Tue Mar 26 2002.
+ *  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AXConstants;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+{$ALIGN MAC68K}
+// standard attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRoleAttribute CFSTRP('AXRole')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRoleDescriptionAttribute CFSTRP('AXRoleDescription')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSubroleAttribute CFSTRP('AXSubrole')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXHelpAttribute CFSTRP('AXHelp')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTitleAttribute CFSTRP('AXTitle')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXValueAttribute CFSTRP('AXValue')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMinValueAttribute CFSTRP('AXMinValue')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMaxValueAttribute CFSTRP('AXMaxValue')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXEnabledAttribute CFSTRP('AXEnabled')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFocusedAttribute CFSTRP('AXFocused')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXParentAttribute CFSTRP('AXParent')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXChildrenAttribute CFSTRP('AXChildren')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSelectedChildrenAttribute CFSTRP('AXSelectedChildren')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVisibleChildrenAttribute CFSTRP('AXVisibleChildren')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowAttribute CFSTRP('AXWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXPositionAttribute CFSTRP('AXPosition')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSizeAttribute CFSTRP('AXSize')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXOrientationAttribute CFSTRP('AXOrientation')}
+{$endc}
+
+// text-specific attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTextAttribute CFSTRP('AXText')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSelectedTextAttribute CFSTRP('AXSelectedText')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSelectedTextRangeAttribute CFSTRP('AXSelectedTextRange')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVisibleTextAttribute CFSTRP('AXVisibleText')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVisibleCharacterRangeAttribute CFSTRP('AXVisibleCharacterRange')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXNumberOfCharactersAttribute CFSTRP('AXNumberOfCharacters')}
+{$endc}
+
+// window-specific attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMainAttribute CFSTRP('AXMain')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMinimizedAttribute CFSTRP('AXMinimized')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXCloseButtonAttribute CFSTRP('AXCloseButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXZoomButtonAttribute CFSTRP('AXZoomButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMinimizeButtonAttribute CFSTRP('AXMinimizeButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXToolbarButtonAttribute CFSTRP('AXToolbarButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXProxyAttribute CFSTRP('AXProxy')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXGrowAreaAttribute CFSTRP('AXGrowArea')}
+{$endc}
+
+// new window-specific attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXModalAttribute CFSTRP('AXModal')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDefaultButtonAttribute CFSTRP('AXDefaultButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXCancelButtonAttribute CFSTRP('AXCancelButton')}
+{$endc}
+
+// menu-specific attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemCmdCharAttribute CFSTRP('AXMenuItemCmdChar')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemCmdVirtualKeyAttribute CFSTRP('AXMenuItemCmdVirtualKey')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemCmdGlyphAttribute CFSTRP('AXMenuItemCmdGlyph')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemCmdModifiersAttribute CFSTRP('AXMenuItemCmdModifiers')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemMarkCharAttribute CFSTRP('AXMenuItemMarkChar')}
+{$endc}
+
+// application-specific attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuBarAttribute CFSTRP('AXMenuBar')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowsAttribute CFSTRP('AXWindows')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFrontmostAttribute CFSTRP('AXFrontmost')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXHiddenAttribute CFSTRP('AXHidden')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMainWindowAttribute CFSTRP('AXMainWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFocusedWindowAttribute CFSTRP('AXFocusedWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFocusedUIElementAttribute CFSTRP('AXFocusedUIElement')}
+{$endc} 
+
+// misc attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXHeaderAttribute CFSTRP('AXHeader')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXEditedAttribute CFSTRP('AXEdited')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXValueIncrementAttribute CFSTRP('AXValueIncrement')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXValueWrapsAttribute CFSTRP('AXValueWraps')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTabsAttribute CFSTRP('AXTabs')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTitleUIElementAttribute CFSTRP('AXTitleUIElement')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXHorizontalScrollBarAttribute CFSTRP('AXHorizontalScrollBar')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVerticalScrollBarAttribute CFSTRP('AXVerticalScrollBar')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXOverflowButtonAttribute CFSTRP('AXOverflowButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFilenameAttribute CFSTRP('AXFilename')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXExpandedAttribute CFSTRP('AXExpanded')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSelectedAttribute CFSTRP('AXSelected')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSplittersAttribute CFSTRP('AXSplitters')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXNextContentsAttribute CFSTRP('AXNextContents')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDocumentAttribute CFSTRP('AXDocument')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDecrementButtonAttribute CFSTRP('AXDecrementButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIncrementButtonAttribute CFSTRP('AXIncrementButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXPreviousContentsAttribute CFSTRP('AXPreviousContents')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXContentsAttribute CFSTRP('AXContents')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIncrementorAttribute CFSTRP('AXIncrementor')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXHourFieldAttribute CFSTRP('AXHourField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMinuteFieldAttribute CFSTRP('AXMinuteField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSecondFieldAttribute CFSTRP('AXSecondField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXAMPMFieldAttribute CFSTRP('AXAMPMField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDayFieldAttribute CFSTRP('AXDayField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMonthFieldAttribute CFSTRP('AXMonthField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXYearFieldAttribute CFSTRP('AXYearField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXColumnTitlesAttribute CFSTRP('AXColumnTitles')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXURLAttribute CFSTRP('AXURL')}
+{$endc}
+
+// table/outline view attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRowsAttribute CFSTRP('AXRows')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVisibleRowsAttribute CFSTRP('AXVisibleRows')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSelectedRowsAttribute CFSTRP('AXSelectedRows')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXColumnsAttribute CFSTRP('AXColumns')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVisibleColumnsAttribute CFSTRP('AXVisibleColumns')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSelectedColumnsAttribute CFSTRP('AXSelectedColumns')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSortDirectionAttribute CFSTRP('AXSortDirection')}
+{$endc}
+
+// outline attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDisclosingAttribute CFSTRP('AXDisclosing')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDisclosedRowsAttribute CFSTRP('AXDisclosedRows')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDisclosedByRowAttribute CFSTRP('AXDisclosedByRow')}
+{$endc}
+
+// system-wide attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFocusedApplicationAttribute CFSTRP('AXFocusedApplication')}
+{$endc}
+
+//
+// Parameterized Attributes
+//
+
+// Text Suite Parameterized Attributes
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXLineForIndexParameterizedAttribute CFSTRP('AXLineForIndex')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRangeForLineParameterizedAttribute CFSTRP('AXRangeForLine')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXStringForRangeParameterizedAttribute CFSTRP('AXStringForRange')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRangeForPositionParameterizedAttribute CFSTRP('AXRangeForPosition')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRangeForIndexParameterizedAttribute CFSTRP('AXRangeForIndex')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXBoundsForRangeParameterizedAttribute CFSTRP('AXBoundsForRange')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRTFForRangeParameterizedAttribute CFSTRP('AXRTFForRange')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXStyleRangeForIndexParameterizedAttribute CFSTRP('AXStyleRangeForIndex')}
+{$endc}
+
+//
+// standard values
+//
+
+// orientations (see kAXOrientationAttribute)
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXHorizontalOrientationValue CFSTRP('AXHorizontalOrientation')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXVerticalOrientationValue CFSTRP('AXVerticalOrientation')}
+{$endc}
+
+// standard actions
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXPressAction CFSTRP('AXPress')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIncrementAction CFSTRP('AXIncrement')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDecrementAction CFSTRP('AXDecrement')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXConfirmAction CFSTRP('AXConfirm')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXPickAction CFSTRP('AXPick')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXCancelAction CFSTRP('AXCancel')}
+{$endc}
+
+// new actions
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRaiseAction CFSTRP('AXRaise')}
+{$endc}
+
+// standard roles
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXApplicationRole CFSTRP('AXApplication')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSystemWideRole CFSTRP('AXSystemWide')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowRole CFSTRP('AXWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSheetRole CFSTRP('AXSheet')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDrawerRole CFSTRP('AXDrawer')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXGrowAreaRole CFSTRP('AXGrowArea')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXImageRole CFSTRP('AXImage')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXUnknownRole CFSTRP('AXUnknown')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXButtonRole CFSTRP('AXButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRadioButtonRole CFSTRP('AXRadioButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXCheckBoxRole CFSTRP('AXCheckBox')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXPopUpButtonRole CFSTRP('AXPopUpButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuButtonRole CFSTRP('AXMenuButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTabGroupRole CFSTRP('AXTabGroup')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTableRole CFSTRP('AXTable')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXColumnRole CFSTRP('AXColumn')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRowRole CFSTRP('AXRow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXOutlineRole CFSTRP('AXOutline')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXBrowserRole CFSTRP('AXBrowser')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXScrollAreaRole CFSTRP('AXScrollArea')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXScrollBarRole CFSTRP('AXScrollBar')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRadioGroupRole CFSTRP('AXRadioGroup')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXListRole CFSTRP('AXList')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXGroupRole CFSTRP('AXGroup')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXValueIndicatorRole CFSTRP('AXValueIndicator')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXComboBoxRole CFSTRP('AXComboBox')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSliderRole CFSTRP('AXSlider')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIncrementorRole CFSTRP('AXIncrementor')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXBusyIndicatorRole CFSTRP('AXBusyIndicator')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXProgressIndicatorRole CFSTRP('AXProgressIndicator')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXToolbarRole CFSTRP('AXToolbar')}
+{$endc}
+
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTextFieldRole CFSTRP('AXTextField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTextAreaRole CFSTRP('AXTextArea')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXStaticTextRole CFSTRP('AXStaticText')}
+{$endc}
+
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuBarRole CFSTRP('AXMenuBar')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuBarItemRole CFSTRP('AXMenuBarItem')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuRole CFSTRP('AXMenu')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemRole CFSTRP('AXMenuItem')}
+{$endc}
+
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSplitGroupRole CFSTRP('AXSplitGroup')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSplitterRole CFSTRP('AXSplitter')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXColorWellRole CFSTRP('AXColorWell')}
+{$endc}
+
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTimeFieldRole CFSTRP('AXTimeField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDateFieldRole CFSTRP('AXDateField')}
+{$endc}
+
+// standard subroles
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXCloseButtonSubrole CFSTRP('AXCloseButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMinimizeButtonSubrole CFSTRP('AXMinimizeButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXZoomButtonSubrole CFSTRP('AXZoomButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXToolbarButtonSubrole CFSTRP('AXToolbarButton')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSecureTextFieldSubrole CFSTRP('AXSecureTextField')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXTableRowSubrole CFSTRP('AXTableRow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXOutlineRowSubrole CFSTRP('AXOutlineRow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXUnknownSubrole CFSTRP('AXUnknown')}
+{$endc}
+
+// new subroles
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXStandardWindowSubrole CFSTRP('AXStandardWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDialogSubrole CFSTRP('AXDialog')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSystemDialogSubrole CFSTRP('AXSystemDialog')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFloatingWindowSubrole CFSTRP('AXFloatingWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSystemFloatingWindowSubrole CFSTRP('AXSystemFloatingWindow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIncrementArrowSubrole CFSTRP('AXIncrementArrow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDecrementArrowSubrole CFSTRP('AXDecrementArrow')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIncrementPageSubrole CFSTRP('AXIncrementPage')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDecrementPageSubrole CFSTRP('AXDecrementPage')}
+{$endc}
+
+// focus notifications
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMainWindowChangedNotification CFSTRP('AXMainWindowChanged')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFocusedWindowChangedNotification CFSTRP('AXFocusedWindowChanged')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXFocusedUIElementChangedNotification CFSTRP('AXFocusedUIElementChanged')}
+{$endc}
+
+// application notifications
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXApplicationActivatedNotification CFSTRP('AXApplicationActivated')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXApplicationDeactivatedNotification CFSTRP('AXApplicationDeactivated')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXApplicationHiddenNotification CFSTRP('AXApplicationHidden')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXApplicationShownNotification CFSTRP('AXApplicationShown')}
+{$endc}
+
+// window notifications
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowCreatedNotification CFSTRP('AXWindowCreated')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowMovedNotification CFSTRP('AXWindowMoved')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowResizedNotification CFSTRP('AXWindowResized')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowMiniaturizedNotification CFSTRP('AXWindowMiniaturized')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXWindowDeminiaturizedNotification CFSTRP('AXWindowDeminiaturized')}
+{$endc}
+
+// new drawer & sheet notifications
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXDrawerCreatedNotification CFSTRP('AXDrawerCreated')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXSheetCreatedNotification CFSTRP('AXSheetCreated')}
+{$endc}
+
+// element notifications
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXValueChangedNotification CFSTRP('AXValueChanged')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXUIElementDestroyedNotification CFSTRP('AXUIElementDestroyed')}
+{$endc}
+
+// menu notifications
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuOpenedNotification CFSTRP('AXMenuOpened')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuClosedNotification CFSTRP('AXMenuClosed')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXMenuItemSelectedNotification CFSTRP('AXMenuItemSelected')}
+{$endc}
+
+
+// obsolete constants will be removed soon
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXRelevanceIndicatorRole CFSTRP('AXRelevanceIndicator')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kAXIsEditableAttribute CFSTRP('AXIsEditable')}
+{$endc}
+
+end.

+ 121 - 0
packages/extra/univint/AXErrors.pas

@@ -0,0 +1,121 @@
+{
+ *  AXError.h
+ *
+ *  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Unit name changed to AXErrors to avoid conflict with AXError type }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AXErrors;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+{$ALIGN MAC68K}
+const
+    kAXErrorSuccess 				= 0;
+    kAXErrorFailure				= -25200;
+    kAXErrorIllegalArgument			= -25201;
+    kAXErrorInvalidUIElement			= -25202;
+    kAXErrorInvalidUIElementObserver		= -25203;
+    kAXErrorCannotComplete			= -25204;
+    kAXErrorAttributeUnsupported		= -25205;
+    kAXErrorActionUnsupported			= -25206;
+    kAXErrorNotificationUnsupported		= -25207;
+    kAXErrorNotImplemented			= -25208;
+    kAXErrorNotificationAlreadyRegistered	= -25209;
+    kAXErrorNotificationNotRegistered		= -25210;
+    kAXErrorAPIDisabled				= -25211;
+    kAXErrorNoValue				= -25212;
+    kAXErrorParameterizedAttributeUnsupported	= -25213;
+
+type
+  AXError = SInt32;
+
+end.

+ 149 - 0
packages/extra/univint/AXUIElement.pas

@@ -0,0 +1,149 @@
+{
+ *  AXUIElement.h
+ *
+ *  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AXUIElement;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,AXErrors,CFRunLoop,CGRemoteOperation,MacOSXPosix;
+{$ALIGN MAC68K}
+
+function AXAPIEnabled: Boolean; external name '_AXAPIEnabled';
+
+type
+	AXUIElementRef    = ^SInt32; { an opaque 32-bit type }
+
+function AXUIElementGetTypeID: CFTypeID; external name '_AXUIElementGetTypeID';
+
+function AXUIElementCopyAttributeNames( element: AXUIElementRef; var names: CFArrayRef ): AXError; external name '_AXUIElementCopyAttributeNames';
+function AXUIElementCopyAttributeValue( element: AXUIElementRef; attribute: CFStringRef; var value: CFTypeRef ): AXError; external name '_AXUIElementCopyAttributeValue';
+function AXUIElementGetAttributeValueCount( element: AXUIElementRef; attribute: CFStringRef; var count: CFIndex ): AXError; external name '_AXUIElementGetAttributeValueCount';
+function AXUIElementCopyAttributeValues( element: AXUIElementRef; attribute: CFStringRef; index: CFIndex; maxValues: CFIndex; var values: CFArrayRef ): AXError; external name '_AXUIElementCopyAttributeValues';
+function AXUIElementIsAttributeSettable( element: AXUIElementRef; attribute: CFStringRef; var settable: Boolean ): AXError; external name '_AXUIElementIsAttributeSettable';
+function AXUIElementSetAttributeValue( element: AXUIElementRef; attribute: CFStringRef; value: CFTypeRef ): AXError; external name '_AXUIElementSetAttributeValue';
+
+function AXUIElementCopyParameterizedAttributeNames( element: AXUIElementRef; var names: CFArrayRef ): AXError; external name '_AXUIElementCopyParameterizedAttributeNames';
+function AXUIElementCopyParameterizedAttributeValue( element: AXUIElementRef; parameterizedAttribute: CFStringRef; parameter: CFTypeRef; var result: CFTypeRef ): AXError; external name '_AXUIElementCopyParameterizedAttributeValue';
+
+function AXUIElementCopyActionNames( element: AXUIElementRef; var names: CFArrayRef ): AXError; external name '_AXUIElementCopyActionNames';
+function AXUIElementCopyActionDescription( element: AXUIElementRef; action: CFStringRef; var description: CFStringRef ): AXError; external name '_AXUIElementCopyActionDescription';
+function AXUIElementPerformAction( element: AXUIElementRef; action: CFStringRef ): AXError; external name '_AXUIElementPerformAction';
+
+function AXUIElementCopyElementAtPosition( application: AXUIElementRef; x: Float32; y: Float32; var element: AXUIElementRef ): AXError; external name '_AXUIElementCopyElementAtPosition';
+
+function AXUIElementCreateApplication( pid: pid_t ): AXUIElementRef; external name '_AXUIElementCreateApplication';
+function AXUIElementCreateSystemWide: AXUIElementRef; external name '_AXUIElementCreateSystemWide';
+
+function AXUIElementGetPid( element: AXUIElementRef; var pid: pid_t ): AXError; external name '_AXUIElementGetPid';
+
+// see CGRemoteOperation.h for documentation of parameters
+// you can only pass the root or application uielement
+function AXUIElementPostKeyboardEvent( application: AXUIElementRef; keyChar: CGCharCode; virtualKey: CGKeyCode; keyDown: Boolean ): AXError; external name '_AXUIElementPostKeyboardEvent';
+
+
+// Notification APIs
+type
+	AXObserverRef    = ^SInt32; { an opaque 32-bit type }
+
+type AXObserverCallback = procedure( observer: AXObserverRef; element: AXUIElementRef; notification: CFStringRef; refcon: UnivPtr );
+
+function AXObserverGetTypeID: CFTypeID; external name '_AXObserverGetTypeID';
+
+function AXObserverCreate( application: pid_t; callback: AXObserverCallback; var outObserver: AXObserverRef ): AXError; external name '_AXObserverCreate';
+
+function AXObserverAddNotification( observer: AXObserverRef; element: AXUIElementRef; notification: CFStringRef; refcon: UnivPtr ): AXError; external name '_AXObserverAddNotification';
+function AXObserverRemoveNotification( observer: AXObserverRef; element: AXUIElementRef; notification: CFStringRef ): AXError; external name '_AXObserverRemoveNotification';
+
+function AXObserverGetRunLoopSource( observer: AXObserverRef ): CFRunLoopSourceRef; external name '_AXObserverGetRunLoopSource';
+
+end.

+ 125 - 0
packages/extra/univint/AXValue.pas

@@ -0,0 +1,125 @@
+{
+ *  AXValue.h
+ *  Accessibility
+ *
+ *  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AXValue;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN MAC68K}
+type AXValueType = UInt32;
+const
+    { Types from CoreGraphics.h }
+    kAXValueCGPointType = 1;
+    kAXValueCGSizeType = 2;
+    kAXValueCGRectType = 3;
+
+    { Types from CFBase.h }
+    kAXValueCFRangeType = 4;
+
+    { Other }
+    kAXValueIllegalType = 0;
+
+type AXValueRef = ^UInt32;
+
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function AXValueGetTypeID: CFTypeID; external name '_AXValueGetTypeID';
+
+
+function AXValueCreate( theType: AXValueType;  valuePtr: UnivPtr ): AXValueRef; external name '_AXValueCreate';
+function AXValueGetType( value: AXValueRef ): AXValueType; external name '_AXValueGetType';
+
+function AXValueGetValue( value: AXValueRef; theType: AXValueType;  valuePtr: UnivPtr ): Boolean; external name '_AXValueGetValue';
+
+end.

+ 447 - 0
packages/extra/univint/Aliases.pas

@@ -0,0 +1,447 @@
+{
+     File:       Aliases.p
+ 
+     Contains:   Alias Manager Interfaces.
+ 
+     Version:    Technology: Mac OS 8.1
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1989-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit Aliases;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,Files;
+
+
+{$ALIGN MAC68K}
+
+
+const
+	rAliasType					= $616C6973 (* 'alis' *);						{  Aliases are stored as resources of this type  }
+
+																{  define alias resolution action rules mask  }
+	kARMMountVol				= $00000001;					{  mount the volume automatically  }
+	kARMNoUI					= $00000002;					{  no user interface allowed during resolution  }
+	kARMMultVols				= $00000008;					{  search on multiple volumes  }
+	kARMSearch					= $00000100;					{  search quickly  }
+	kARMSearchMore				= $00000200;					{  search further  }
+	kARMSearchRelFirst			= $00000400;					{  search target on a relative path first  }
+
+																{  define alias record information types  }
+	asiZoneName					= -3;							{  get zone name  }
+	asiServerName				= -2;							{  get server name  }
+	asiVolumeName				= -1;							{  get volume name  }
+	asiAliasName				= 0;							{  get aliased file/folder/volume name  }
+	asiParentName				= 1;							{  get parent folder name  }
+
+	{	 ResolveAliasFileWithMountFlags options 	}
+	kResolveAliasFileNoUI		= $00000001;					{  no user interaction during resolution  }
+
+	{	 define the alias record that will be the blackbox for the caller 	}
+
+type
+	AliasRecordPtr = ^AliasRecord;
+	AliasRecord = record
+		userType:				OSType;									{  appl stored type like creator type  }
+		aliasSize:				UInt16;									{  alias record size in bytes, for appl usage  }
+	end;
+
+	AliasPtr							= ^AliasRecord;
+	AliasHandle							= ^AliasPtr;
+	{	 alias record information type 	}
+	AliasInfoType						= SInt16;
+	{
+	 *  NewAlias()
+	 *  
+	 *  Summary:
+	 *    create a new alias between fromFile and target, returns alias
+	 *    record handle
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewAlias(fromFile: {Const}FSSpecPtr; const (*var*) target: FSSpec; var alias: AliasHandle): OSErr; external name '_NewAlias';
+{
+ *  NewAliasMinimal()
+ *  
+ *  Summary:
+ *    create a minimal new alias for a target and return alias record
+ *    handle
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewAliasMinimal(const (*var*) target: FSSpec; var alias: AliasHandle): OSErr; external name '_NewAliasMinimal';
+{
+ *  NewAliasMinimalFromFullPath()
+ *  
+ *  Summary:
+ *    create a minimal new alias from a target fullpath (optional zone
+ *    and server name) and return alias record handle
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function NewAliasMinimalFromFullPath(fullPathLength: SInt16; fullPath: UnivPtr; const (*var*) zoneName: Str32; const (*var*) serverName: Str31; var alias: AliasHandle): OSErr; external name '_NewAliasMinimalFromFullPath';
+{
+ *  ResolveAlias()
+ *  
+ *  Summary:
+ *    given an alias handle and fromFile, resolve the alias, update the
+ *    alias record and return aliased filename and wasChanged flag.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ResolveAlias(fromFile: {Const}FSSpecPtr; alias: AliasHandle; var target: FSSpec; var wasChanged: boolean): OSErr; external name '_ResolveAlias';
+{
+ *  GetAliasInfo()
+ *  
+ *  Summary:
+ *    given an alias handle and an index specifying requested alias
+ *    information type, return the information from alias record as a
+ *    string.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function GetAliasInfo(alias: AliasHandle; index: AliasInfoType; var theString: Str63): OSErr; external name '_GetAliasInfo';
+{
+ *  IsAliasFile()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function IsAliasFile(const (*var*) fileFSSpec: FSSpec; var aliasFileFlag: boolean; var folderFlag: boolean): OSErr; external name '_IsAliasFile';
+{
+ *  ResolveAliasWithMountFlags()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 8.5 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ResolveAliasWithMountFlags(fromFile: {Const}FSSpecPtr; alias: AliasHandle; var target: FSSpec; var wasChanged: boolean; mountFlags: UInt32): OSErr; external name '_ResolveAliasWithMountFlags';
+{
+ *  ResolveAliasFile()
+ *  
+ *  Summary:
+ *    Given a file spec, return target file spec if input file spec is
+ *    an alias. It resolves the entire alias chain or one step of the
+ *    chain.  It returns info about whether the target is a folder or
+ *    file; and whether the input file spec was an alias or not.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ResolveAliasFile(var theSpec: FSSpec; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean): OSErr; external name '_ResolveAliasFile';
+{
+ *  ResolveAliasFileWithMountFlags()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ResolveAliasFileWithMountFlags(var theSpec: FSSpec; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean; mountFlags: UInt32): OSErr; external name '_ResolveAliasFileWithMountFlags';
+{
+ *  FollowFinderAlias()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FollowFinderAlias(fromFile: {Const}FSSpecPtr; alias: AliasHandle; logon: boolean; var target: FSSpec; var wasChanged: boolean): OSErr; external name '_FollowFinderAlias';
+{ 
+   Low Level Routines 
+}
+{
+ *  UpdateAlias()
+ *  
+ *  Summary:
+ *    given a fromFile-target pair and an alias handle, update the
+ *    alias record pointed to by alias handle to represent target as
+ *    the new alias.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function UpdateAlias(fromFile: {Const}FSSpecPtr; const (*var*) target: FSSpec; alias: AliasHandle; var wasChanged: boolean): OSErr; external name '_UpdateAlias';
+type
+{$ifc TYPED_FUNCTION_POINTERS}
+	AliasFilterProcPtr = function(cpbPtr: CInfoPBPtr; var quitFlag: boolean; myDataPtr: Ptr): boolean;
+{$elsec}
+	AliasFilterProcPtr = ProcPtr;
+{$endc}
+
+{$ifc OPAQUE_UPP_TYPES}
+	AliasFilterUPP = ^SInt32; { an opaque UPP }
+{$elsec}
+	AliasFilterUPP = UniversalProcPtr;
+{$endc}	
+
+const
+	uppAliasFilterProcInfo = $00000FD0;
+	{
+	 *  NewAliasFilterUPP()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   available as macro/inline
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function NewAliasFilterUPP(userRoutine: AliasFilterProcPtr): AliasFilterUPP; external name '_NewAliasFilterUPP'; { old name was NewAliasFilterProc }
+{
+ *  DisposeAliasFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+procedure DisposeAliasFilterUPP(userUPP: AliasFilterUPP); external name '_DisposeAliasFilterUPP';
+{
+ *  InvokeAliasFilterUPP()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   available as macro/inline
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function InvokeAliasFilterUPP(cpbPtr: CInfoPBPtr; var quitFlag: boolean; myDataPtr: Ptr; userRoutine: AliasFilterUPP): boolean; external name '_InvokeAliasFilterUPP'; { old name was CallAliasFilterProc }
+{
+ *  MatchAlias()
+ *  
+ *  Summary:
+ *    Given an alias handle and fromFile, match the alias and return
+ *    aliased filename(s) and needsUpdate flag
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function MatchAlias(fromFile: {Const}FSSpecPtr; rulesMask: UInt32; alias: AliasHandle; var aliasCount: SInt16; aliasList: FSSpecArrayPtr; var needsUpdate: boolean; aliasFilter: AliasFilterUPP; yourDataPtr: UnivPtr): OSErr; external name '_MatchAlias';
+{
+ *  ResolveAliasFileWithMountFlagsNoUI()
+ *  
+ *  Summary:
+ *    variation on ResolveAliasFile that does not prompt user with a
+ *    dialog
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ResolveAliasFileWithMountFlagsNoUI(var theSpec: FSSpec; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean; mountFlags: UInt32): OSErr; external name '_ResolveAliasFileWithMountFlagsNoUI';
+
+{
+ *  MatchAliasNoUI()
+ *  
+ *  Summary:
+ *    variation on MatchAlias that does not prompt user with a dialog
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function MatchAliasNoUI(fromFile: {Const}FSSpecPtr; rulesMask: UInt32; alias: AliasHandle; var aliasCount: SInt16; aliasList: FSSpecArrayPtr; var needsUpdate: boolean; aliasFilter: AliasFilterUPP; yourDataPtr: UnivPtr): OSErr; external name '_MatchAliasNoUI';
+
+{
+ *  FSNewAlias()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSNewAlias(fromFile: {Const}FSRefPtr; const (*var*) target: FSRef; var inAlias: AliasHandle): OSErr; external name '_FSNewAlias';
+{
+ *  FSNewAliasMinimal()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSNewAliasMinimal(const (*var*) target: FSRef; var inAlias: AliasHandle): OSErr; external name '_FSNewAliasMinimal';
+{
+ *  FSIsAliasFile()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSIsAliasFile(const (*var*) fileRef: FSRef; var aliasFileFlag: boolean; var folderFlag: boolean): OSErr; external name '_FSIsAliasFile';
+{
+ *  FSResolveAliasWithMountFlags()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSResolveAliasWithMountFlags(fromFile: {Const}FSRefPtr; inAlias: AliasHandle; var target: FSRef; var wasChanged: boolean; mountFlags: UInt32): OSErr; external name '_FSResolveAliasWithMountFlags';
+{
+ *  FSResolveAlias()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSResolveAlias(fromFile: {Const}FSRefPtr; alias: AliasHandle; var target: FSRef; var wasChanged: boolean): OSErr; external name '_FSResolveAlias';
+{
+ *  FSResolveAliasFileWithMountFlags()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSResolveAliasFileWithMountFlags(var theRef: FSRef; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean; mountFlags: UInt32): OSErr; external name '_FSResolveAliasFileWithMountFlags';
+{
+ *  FSResolveAliasFile()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSResolveAliasFile(var theRef: FSRef; resolveAliasChains: boolean; var targetIsFolder: boolean; var wasAliased: boolean): OSErr; external name '_FSResolveAliasFile';
+{
+ *  FSFollowFinderAlias()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSFollowFinderAlias(fromFile: FSRefPtr; alias: AliasHandle; logon: boolean; var target: FSRef; var wasChanged: boolean): OSErr; external name '_FSFollowFinderAlias';
+{
+ *  FSUpdateAlias()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 9.1 and later
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function FSUpdateAlias(fromFile: {Const}FSRefPtr; const (*var*) target: FSRef; alias: AliasHandle; var wasChanged: boolean): OSErr; external name '_FSUpdateAlias';
+{$ALIGN MAC68K}
+
+
+end.

+ 4683 - 0
packages/extra/univint/Appearance.pas

@@ -0,0 +1,4683 @@
+{
+     File:       HIToolbox/Appearance.h
+ 
+     Contains:   Appearance Manager Interfaces.
+ 
+     Version:    HIToolbox-219.4.81~2
+ 
+     Copyright:  © 1994-2005 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit Appearance;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CGContext,Collections,Processes,QuickdrawText,TextCommon,Quickdraw,TextEdit,QDOffscreen,MacErrors,TextUtils,CFString;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Appearance Manager constants, etc.                                               }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Appearance Manager Apple Events (1.1 and later)              }
+
+
+{$ALIGN MAC68K}
+
+const
+	kAppearanceEventClass = $61707072 (* 'appr' *); { Event Class }
+	kAEAppearanceChanged = $74686D65 (* 'thme' *); { Appearance changed (e.g. platinum to hi-tech) }
+	kAESystemFontChanged = $73797366 (* 'sysf' *); { system font changed }
+	kAESmallSystemFontChanged = $7373666E (* 'ssfn' *); { small system font changed }
+	kAEViewsFontChanged = $76666E74 (* 'vfnt' *); { views font changed }
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Appearance Manager file types                                                    }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeDataFileType = $74686D65 (* 'thme' *); { file type for theme files }
+	kThemePlatinumFileType = $706C746E (* 'pltn' *); { file type for platinum appearance }
+	kThemeCustomThemesFileType = $7363656E (* 'scen' *); { file type for user themes }
+	kThemeSoundTrackFileType = $74736E64 (* 'tsnd' *);
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Appearance Manager Supported Themes                                              }
+{ Use CopyThemeIdentifier to get the current theme ID                              }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kThemeAppearancePlatinum CFSTRP('com.apple.theme.appearance.platinum')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kThemeAppearanceAqua CFSTRP('com.apple.theme.appearance.aqua')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kThemeAppearanceAquaBlue CFSTRP('com.apple.theme.appearance.aqua.blue')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kThemeAppearanceAquaGraphite CFSTRP('com.apple.theme.appearance.aqua.graphite')}
+{$endc}
+
+
+{
+ *  AppearancePartCode
+ *  
+ *  Summary:
+ *    These are part codes returned by a few of the hit testing
+ *    Appearance APIs. Many of the Control Manager's ControlPartCodes
+ *    are based on these part codes.
+ }
+type
+	AppearancePartCode = SInt16;
+const
+{
+   * This represents the lack of a part. It will be returned when the
+   * Appearance Manager's hit testing logic determines that the input
+   * point is not in any part of the widget.
+   }
+	kAppearancePartMetaNone = 0;
+
+  {
+   * This represents a widget which is not currently clickable because
+   * it is disabled.
+   }
+	kAppearancePartMetaDisabled = 254;
+
+  {
+   * This represents a widget which is inactive, presumably because it
+   * is in a window that is inactive.
+   }
+	kAppearancePartMetaInactive = 255;
+
+  {
+   * The part of a widget which indicates the widget's value. Scroll
+   * bar thumbs and slider thumbs are the two main examples.
+   }
+	kAppearancePartIndicator = 129;
+
+  {
+   * The part of a widget which moves its value visually upward. Scroll
+   * bar up arrows are the main example.
+   }
+	kAppearancePartUpButton = 20;
+
+  {
+   * The part of a widget which moves its value visually downward.
+   * Scroll bar down arrows are the main example.
+   }
+	kAppearancePartDownButton = 21;
+
+  {
+   * The part of a widget which moves its value visually leftward.
+   * Scroll bar left arrows are the main example.
+   }
+	kAppearancePartLeftButton = kAppearancePartUpButton;
+
+  {
+   * The part of a widget which moves its value visually rightward.
+   * Scroll bar right arrows are the main example.
+   }
+	kAppearancePartRightButton = kAppearancePartDownButton;
+
+  {
+   * The part of a widget which moves its value visually upward one
+   * whole page. Scroll bar page up areas are the main example.
+   }
+	kAppearancePartPageUpArea = 22;
+
+  {
+   * The part of a widget which moves its value visually downward one
+   * whole page. Scroll bar page down areas are the main example.
+   }
+	kAppearancePartPageDownArea = 23;
+
+  {
+   * The part of a widget which moves its value visually leftward one
+   * whole page. Scroll bar page left areas are the main example.
+   }
+	kAppearancePartPageLeftArea = kAppearancePartPageUpArea;
+
+  {
+   * The part of a widget which moves its value visually rightward one
+   * whole page. Scroll bar page right areas are the main example.
+   }
+	kAppearancePartPageRightArea = kAppearancePartPageDownArea;
+
+
+{
+ *  AppearanceRegionCode
+ *  
+ *  Summary:
+ *    These are region codes used by a few of window-related Appearance
+ *    APIs. Many of the Window Manager's WindowRegionCodes are based on
+ *    these region codes.
+ }
+type
+	AppearanceRegionCode = UInt16;
+const
+	kAppearanceRegionTitleBar = 0;
+	kAppearanceRegionTitleText = 1;
+	kAppearanceRegionCloseBox = 2;
+	kAppearanceRegionZoomBox = 3;
+	kAppearanceRegionDrag = 5;
+	kAppearanceRegionGrow = 6;
+	kAppearanceRegionCollapseBox = 7;
+	kAppearanceRegionTitleProxyIcon = 8;  { Mac OS 8.5 forward}
+	kAppearanceRegionStructure = 32;
+	kAppearanceRegionContent = 33;    { Content area of the window; empty when the window is collapsed}
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes
+ }
+const
+{
+   * Use with kModalWindowClass.
+   }
+	kThemeBrushDialogBackgroundActive = 1;
+
+  {
+   * Use with kModalWindowClass.
+   }
+	kThemeBrushDialogBackgroundInactive = 2;
+
+  {
+   * Use with kAlertWindowClass and kMovableAlertWindowClass.
+   }
+	kThemeBrushAlertBackgroundActive = 3;
+
+  {
+   * Use with kAlertWindowClass and kMovableAlertWindowClass.
+   }
+	kThemeBrushAlertBackgroundInactive = 4;
+
+  {
+   * Use with kDocumentWindowClass.
+   }
+	kThemeBrushModelessDialogBackgroundActive = 5;
+
+  {
+   * Use with kDocumentWindowClass.
+   }
+	kThemeBrushModelessDialogBackgroundInactive = 6;
+
+  {
+   * Use with kFloatingWindowClass and kUtilityWindowClass.
+   }
+	kThemeBrushUtilityWindowBackgroundActive = 7;
+
+  {
+   * Use with kFloatingWindowClass and kUtilityWindowClass.
+   }
+	kThemeBrushUtilityWindowBackgroundInactive = 8;
+
+  {
+   * The background used for Finder list views.
+   }
+	kThemeBrushListViewSortColumnBackground = 9;
+	kThemeBrushListViewBackground = 10;
+	kThemeBrushIconLabelBackground = 11;
+	kThemeBrushListViewSeparator = 12;
+	kThemeBrushChasingArrows = 13;
+	kThemeBrushDragHilite = 14;
+
+  {
+   * Use with kDocumentWindowClass.
+   }
+	kThemeBrushDocumentWindowBackground = 15;
+	kThemeBrushFinderWindowBackground = 16;
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes introduced in Appearance 1.1 (Mac OS 8.5) and later
+ }
+const
+	kThemeBrushScrollBarDelimiterActive = 17;
+	kThemeBrushScrollBarDelimiterInactive = 18;
+	kThemeBrushFocusHighlight = 19;
+	kThemeBrushPopupArrowActive = 20;
+	kThemeBrushPopupArrowPressed = 21;
+	kThemeBrushPopupArrowInactive = 22;
+	kThemeBrushAppleGuideCoachmark = 23;
+	kThemeBrushIconLabelBackgroundSelected = 24;
+	kThemeBrushStaticAreaFill = 25;
+	kThemeBrushActiveAreaFill = 26;
+	kThemeBrushButtonFrameActive = 27;
+	kThemeBrushButtonFrameInactive = 28;
+	kThemeBrushButtonFaceActive = 29;
+	kThemeBrushButtonFaceInactive = 30;
+	kThemeBrushButtonFacePressed = 31;
+	kThemeBrushButtonActiveDarkShadow = 32;
+	kThemeBrushButtonActiveDarkHighlight = 33;
+	kThemeBrushButtonActiveLightShadow = 34;
+	kThemeBrushButtonActiveLightHighlight = 35;
+	kThemeBrushButtonInactiveDarkShadow = 36;
+	kThemeBrushButtonInactiveDarkHighlight = 37;
+	kThemeBrushButtonInactiveLightShadow = 38;
+	kThemeBrushButtonInactiveLightHighlight = 39;
+	kThemeBrushButtonPressedDarkShadow = 40;
+	kThemeBrushButtonPressedDarkHighlight = 41;
+	kThemeBrushButtonPressedLightShadow = 42;
+	kThemeBrushButtonPressedLightHighlight = 43;
+	kThemeBrushBevelActiveLight = 44;
+	kThemeBrushBevelActiveDark = 45;
+	kThemeBrushBevelInactiveLight = 46;
+	kThemeBrushBevelInactiveDark = 47;
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes introduced in Appearance 1.1.1 (Mac OS 9.0) and
+ *    later.
+ }
+const
+	kThemeBrushNotificationWindowBackground = 48;
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes introduced in Carbon. Available in Mac OS X, and
+ *    Carbon Lib 1.3 and later.
+ }
+const
+{
+   * Use with kMovableModalWindowClass windows. Available in Mac OS X,
+   * and CarbonLib 1.3 and later.
+   }
+	kThemeBrushMovableModalBackground = 49;
+
+  {
+   * Use with kSheetWindowClass and kSheetAlertWindowClass. This is the
+   * backwardly compatible sheet background.
+   * kThemeBrushSheetBackgroundTransparent is preferred. Available in
+   * Mac OS X, and CarbonLib 1.3 and later.
+   }
+	kThemeBrushSheetBackgroundOpaque = 50;
+
+  {
+   * Use with kDrawerWindowClass. Available in Mac OS X, and CarbonLib
+   * 1.3 and later.
+   }
+	kThemeBrushDrawerBackground = 51;
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes introduced in Carbon. Available in Mac OS X, and
+ *    Carbon Lib 1.6 and later.
+ }
+const
+{
+   * Use with kToolbarWindowClass.
+   }
+	kThemeBrushToolbarBackground = 52;
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes introduced in Mac OS X 10.1. Available in Mac OS X
+ *    10.1 and CarbonLib 1.6, and later.
+ }
+const
+{
+   * Use with kSheetWindowClass and kSheetAlertWindowClass. Not fully
+   * transparent -- this brush is the semi-transparent background seen
+   * with modern sheets. Available in Mac OS X 10.1 and CarbonLib 1.6,
+   * and later.
+   }
+	kThemeBrushSheetBackgroundTransparent = 53;
+
+  {
+   * Available in Mac OS X 10.1 and CarbonLib 1.6, and later.
+   }
+	kThemeBrushMenuBackground = 54;
+
+  {
+   * Available in Mac OS X 10.1 and CarbonLib 1.6, and later.
+   }
+	kThemeBrushMenuBackgroundSelected = 55;
+
+
+{
+ *  Discussion:
+ *    ThemeBrushes introduced in Mac OS X 10.3.
+ }
+const
+{
+   * For lists that use different colors as the background for odd and
+   * even rows (like iTunes), this brush is the background for the odd
+   * numbered rows. Available in Mac OS X 10.4 and later.
+   }
+	kThemeBrushListViewOddRowBackground = 56;
+
+  {
+   * For lists that use different colors as the background for odd and
+   * even rows (like iTunes), this brush is the background for the even
+   * numbered rows. Available in Mac OS X 10.4 and later.
+   }
+	kThemeBrushListViewEvenRowBackground = 57;
+
+  {
+   * The color for the divider lines drawn between columns in some list
+   * views. This brush may have an alpha value associated with it.
+   * Drawing this brush with QuickDraw or fetching it as an RGBColor
+   * will not necessarily yield satisfactory results.
+   }
+	kThemeBrushListViewColumnDivider = 58;
+
+
+{
+ *  Discussion:
+ *    ThemeBrush compatibility synonyms. The newer names are preferred.
+ }
+const
+	kThemeBrushSheetBackground = kThemeBrushSheetBackgroundOpaque;
+
+
+{
+ *  Discussion:
+ *    Theme meta-brushes. They are specific colors that do not change
+ *    from theme to theme. Use them instead of using direct RGB values.
+ }
+const
+	kThemeBrushBlack = -1;
+	kThemeBrushWhite = -2;
+
+  {
+   * Available in Mac OS 10.1 and CarbonLib 1.6, and later.
+   }
+	kThemeBrushPrimaryHighlightColor = -3;
+
+  {
+   * Available in Mac OS 10.1 and CarbonLib 1.6, and later.
+   }
+	kThemeBrushSecondaryHighlightColor = -4;
+
+  {
+   * Available in Mac OS 10.1 and CarbonLib 1.6, and later.
+   }
+	kThemeBrushAlternatePrimaryHighlightColor = -5;
+
+type
+	ThemeBrush = SInt16;
+const
+	kThemeTextColorDialogActive = 1;
+	kThemeTextColorDialogInactive = 2;
+	kThemeTextColorAlertActive = 3;
+	kThemeTextColorAlertInactive = 4;
+	kThemeTextColorModelessDialogActive = 5;
+	kThemeTextColorModelessDialogInactive = 6;
+	kThemeTextColorWindowHeaderActive = 7;
+	kThemeTextColorWindowHeaderInactive = 8;
+	kThemeTextColorPlacardActive = 9;
+	kThemeTextColorPlacardInactive = 10;
+	kThemeTextColorPlacardPressed = 11;
+	kThemeTextColorPushButtonActive = 12;
+	kThemeTextColorPushButtonInactive = 13;
+	kThemeTextColorPushButtonPressed = 14;
+	kThemeTextColorBevelButtonActive = 15;
+	kThemeTextColorBevelButtonInactive = 16;
+	kThemeTextColorBevelButtonPressed = 17;
+	kThemeTextColorPopupButtonActive = 18;
+	kThemeTextColorPopupButtonInactive = 19;
+	kThemeTextColorPopupButtonPressed = 20;
+	kThemeTextColorIconLabel = 21;
+	kThemeTextColorListView = 22;
+
+{ Text Colors available in Appearance 1.0.1 or later }
+const
+	kThemeTextColorDocumentWindowTitleActive = 23;
+	kThemeTextColorDocumentWindowTitleInactive = 24;
+	kThemeTextColorMovableModalWindowTitleActive = 25;
+	kThemeTextColorMovableModalWindowTitleInactive = 26;
+	kThemeTextColorUtilityWindowTitleActive = 27;
+	kThemeTextColorUtilityWindowTitleInactive = 28;
+	kThemeTextColorPopupWindowTitleActive = 29;
+	kThemeTextColorPopupWindowTitleInactive = 30;
+	kThemeTextColorRootMenuActive = 31;
+	kThemeTextColorRootMenuSelected = 32;
+	kThemeTextColorRootMenuDisabled = 33;
+	kThemeTextColorMenuItemActive = 34;
+	kThemeTextColorMenuItemSelected = 35;
+	kThemeTextColorMenuItemDisabled = 36;
+	kThemeTextColorPopupLabelActive = 37;
+	kThemeTextColorPopupLabelInactive = 38;
+
+
+{ Text colors available in Appearance 1.1 or later }
+const
+	kThemeTextColorTabFrontActive = 39;
+	kThemeTextColorTabNonFrontActive = 40;
+	kThemeTextColorTabNonFrontPressed = 41;
+	kThemeTextColorTabFrontInactive = 42;
+	kThemeTextColorTabNonFrontInactive = 43;
+	kThemeTextColorIconLabelSelected = 44;
+	kThemeTextColorBevelButtonStickyActive = 45;
+	kThemeTextColorBevelButtonStickyInactive = 46;
+
+{ Text colors available in Appearance 1.1.1 or later }
+const
+	kThemeTextColorNotification = 47;
+
+
+{ Text colors only available later than OS X 10.1.3 }
+const
+	kThemeTextColorSystemDetail = 48;
+
+{ These values are specific colors that do not change from             }
+{ theme to theme. You can use them instead of using direct RGB values. }
+const
+	kThemeTextColorBlack = -1;
+	kThemeTextColorWhite = -2;
+
+type
+	ThemeTextColor = SInt16;
+{ States to draw primitives: disabled, active, and pressed (hilited) }
+const
+	kThemeStateInactive = 0;
+	kThemeStateActive = 1;
+	kThemeStatePressed = 2;
+	kThemeStateRollover = 6;
+	kThemeStateUnavailable = 7;
+	kThemeStateUnavailableInactive = 8;
+
+{ obsolete name }
+const
+	kThemeStateDisabled = 0;
+
+const
+	kThemeStatePressedUp = 2;    { draw with up pressed     (increment/decrement buttons) }
+	kThemeStatePressedDown = 3;     { draw with down pressed (increment/decrement buttons) }
+
+type
+	ThemeDrawState = UInt32;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Theme cursor selectors available in Appearance 1.1 or later                      }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+
+const
+	kThemeArrowCursor = 0;
+	kThemeCopyArrowCursor = 1;
+	kThemeAliasArrowCursor = 2;
+	kThemeContextualMenuArrowCursor = 3;
+	kThemeIBeamCursor = 4;
+	kThemeCrossCursor = 5;
+	kThemePlusCursor = 6;
+	kThemeWatchCursor = 7;    { Can Animate }
+	kThemeClosedHandCursor = 8;
+	kThemeOpenHandCursor = 9;
+	kThemePointingHandCursor = 10;
+	kThemeCountingUpHandCursor = 11;   { Can Animate }
+	kThemeCountingDownHandCursor = 12;   { Can Animate }
+	kThemeCountingUpAndDownHandCursor = 13; { Can Animate }
+	kThemeSpinningCursor = 14;   { Can Animate }
+	kThemeResizeLeftCursor = 15;
+	kThemeResizeRightCursor = 16;
+	kThemeResizeLeftRightCursor = 17;
+	kThemeNotAllowedCursor = 18;   { available on Mac OS X 10.2 and later }
+
+  {
+   * Available in Mac OS X 10.3 or later.
+   }
+	kThemeResizeUpCursor = 19;
+
+  {
+   * Available in Mac OS X 10.3 or later.
+   }
+	kThemeResizeDownCursor = 20;
+
+  {
+   * Available in Mac OS X 10.3 or later.
+   }
+	kThemeResizeUpDownCursor = 21;
+
+  {
+   * A special cursor to indicate that letting up the mouse will cause
+   * a dragged item to go away. When the item goes away, a poof cloud
+   * animation should occur. This cursor should be updated dynamically
+   * dependeding on whether the mouse up action will remove the item.
+   * Available in Mac OS X 10.3 or later.
+   }
+	kThemePoofCursor = 22;
+
+type
+	ThemeCursor = UInt32;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Theme menu bar drawing states                                                    }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeMenuBarNormal = 0;
+	kThemeMenuBarSelected = 1;
+
+type
+	ThemeMenuBarState = UInt16;
+{ attributes }
+const
+	kThemeMenuSquareMenuBar = 1 shl 0;
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Theme menu drawing states                                                        }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeMenuActive = 0;
+	kThemeMenuSelected = 1;
+	kThemeMenuDisabled = 3;
+
+type
+	ThemeMenuState = UInt16;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ MenuType: add kThemeMenuTypeInactive to menu type for DrawThemeMenuBackground if entire  }
+{ menu is inactive                                                                         }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeMenuTypePullDown = 0;
+	kThemeMenuTypePopUp = 1;
+	kThemeMenuTypeHierarchical = 2;
+	kThemeMenuTypeInactive = $0100;
+
+type
+	ThemeMenuType = UInt16;
+const
+	kThemeMenuItemPlain = 0;
+	kThemeMenuItemHierarchical = 1;    { item has hierarchical arrow}
+	kThemeMenuItemScrollUpArrow = 2;    { for scrollable menus, indicates item is scroller}
+	kThemeMenuItemScrollDownArrow = 3;
+	kThemeMenuItemAtTop = $0100; { indicates item is being drawn at top of menu}
+	kThemeMenuItemAtBottom = $0200; { indicates item is being drawn at bottom of menu}
+	kThemeMenuItemHierBackground = $0400; { item is within a hierarchical menu}
+	kThemeMenuItemPopUpBackground = $0800; { item is within a popped up menu}
+	kThemeMenuItemHasIcon = $8000; { add into non-arrow type when icon present}
+	kThemeMenuItemNoBackground = $4000; { don't draw the menu background while drawing this item (Mac OS X only)}
+
+type
+	ThemeMenuItemType = UInt16;
+
+{
+ *  Discussion:
+ *    ThemeBackgroundKinds
+ }
+const
+{
+   * The theme background used to draw the fill of a tab pane.
+   }
+	kThemeBackgroundTabPane = 1;
+
+  {
+   * The theme background used to draw the fill of a window placard.
+   }
+	kThemeBackgroundPlacard = 2;
+
+  {
+   * The theme background used to draw the window header of a window of
+   * a window that does not contain content that has a hard-lined top
+   * edge. An example of this would be icon view in the non side panel
+   * Finder.
+   }
+	kThemeBackgroundWindowHeader = 3;
+
+  {
+   * The theme background used to draw the window header of a window of
+   * a window that does contain content that has a hard-lined top edge.
+   * An example of this would be list view in the non side panel Finder.
+   }
+	kThemeBackgroundListViewWindowHeader = 4;
+
+  {
+   * The theme background used to draw the fill of a secondary group
+   * box.
+   }
+	kThemeBackgroundSecondaryGroupBox = 5;
+
+  {
+   * A special theme brush for drawing metal backgrounds. Currently,
+   * this brush only works with HIThemeDrawBackground.
+   }
+	kThemeBackgroundMetal = 6;
+
+type
+	ThemeBackgroundKind = UInt32;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Theme Collection tags for Get/SetTheme                                                   }
+{  X ALERT: Please note that Get/SetTheme are severely neutered under Mac OS X at present. }
+{           The first group of tags below are available to get under both 9 and X. The     }
+{           second group is 9 only. None of the tags can be used in SetTheme on X, as it   }
+{           is completely inert on X, and will return unimpErr.                            }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeNameTag = $6E616D65 (* 'name' *); { Str255}
+	kThemeVariantNameTag = $7661726E (* 'varn' *); { Str255}
+	kThemeVariantBaseTintTag = $74696E74 (* 'tint' *); { RGBColor (10.1 and later)}
+	kThemeHighlightColorTag = $68636F6C (* 'hcol' *); { RGBColor}
+	kThemeScrollBarArrowStyleTag = $73626172 (* 'sbar' *); { ThemeScrollBarArrowStyle}
+	kThemeScrollBarThumbStyleTag = $73627468 (* 'sbth' *); { ThemeScrollBarThumbStyle}
+	kThemeSoundsEnabledTag = $736E6473 (* 'snds' *); { Boolean}
+	kThemeDblClickCollapseTag = $636F6C6C (* 'coll' *); { Boolean}
+
+const
+	kThemeAppearanceFileNameTag = $74686D65 (* 'thme' *); { Str255}
+	kThemeSystemFontTag = $6C677366 (* 'lgsf' *); { Str255}
+	kThemeSmallSystemFontTag = $736D7366 (* 'smsf' *); { Str255}
+	kThemeViewsFontTag = $76666E74 (* 'vfnt' *); { Str255}
+	kThemeViewsFontSizeTag = $7666737A (* 'vfsz' *); { SInt16}
+	kThemeDesktopPatternNameTag = $7061746E (* 'patn' *); { Str255}
+	kThemeDesktopPatternTag = $70617474 (* 'patt' *); { <variable-length data> (flattened pattern)}
+	kThemeDesktopPictureNameTag = $64706E6D (* 'dpnm' *); { Str255}
+	kThemeDesktopPictureAliasTag = $6470616C (* 'dpal' *); { <alias handle>}
+	kThemeDesktopPictureAlignmentTag = $6470616E (* 'dpan' *); { UInt32 (see the Picture Alignments below)}
+	kThemeHighlightColorNameTag = $68636E6D (* 'hcnm' *); { Str255}
+	kThemeExamplePictureIDTag = $65706963 (* 'epic' *); { SInt16}
+	kThemeSoundTrackNameTag = $736E6474 (* 'sndt' *); { Str255}
+	kThemeSoundMaskTag = $736D736B (* 'smsk' *); { UInt32}
+	kThemeUserDefinedTag = $75736572 (* 'user' *); { Boolean (this should _always_ be true if present - used by Control Panel).}
+	kThemeSmoothFontEnabledTag = $736D6F6F (* 'smoo' *); { Boolean}
+	kThemeSmoothFontMinSizeTag = $736D6F73 (* 'smos' *); { UInt16 (must be >= 12 and <= 24)}
+
+{ Picture Aligmnents that might be reported in the data for kThemeDesktopPictureAlignmentTag}
+const
+	kTiledOnScreen = 1;    { draws picture repeatedly}
+	kCenterOnScreen = 2;    { "actual size", shows pattern on sides or clips picture if necessary}
+	kFitToScreen = 3;    { shrinks if necessary}
+	kFillScreen = 4;    { messes up aspect ratio if necessary}
+	kUseBestGuess = 5;     { heuristically determines the best way to display the picture based on picture and monitor sizes}
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Theme Control Settings                                                                   }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeCheckBoxClassicX = 0;    { check box with an 'X'}
+	kThemeCheckBoxCheckMark = 1;     { check box with a real check mark}
+
+type
+	ThemeCheckBoxStyle = UInt16;
+const
+	kThemeScrollBarArrowsSingle = 0;    { single arrow on each end}
+	kThemeScrollBarArrowsLowerRight = 1;   { double arrows only on right or bottom}
+
+type
+	ThemeScrollBarArrowStyle = UInt16;
+const
+	kThemeScrollBarThumbNormal = 0;    { normal, classic thumb size}
+	kThemeScrollBarThumbProportional = 1;  { proportional thumbs}
+
+type
+	ThemeScrollBarThumbStyle = UInt16;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Font constants                                                                           }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+
+{
+ *  Summary:
+ *    A ThemeFontID value is a virtual font ID which can be passed to
+ *    one of the Appearance Manager's text-related routines. Within
+ *    those routines, the ThemeFontID is mapped into the appropriate
+ *    real font (or fonts), size, and style based on the system
+ *    appearance (Platinum on Mac OS 9, Aqua on Mac OS X), the string
+ *    to be rendered (if any), the language/ script that the app is
+ *    running in, and possibly other factors. The ThemeFontIDs allow
+ *    you to get the correct text appearance for the platform your app
+ *    is currently running on.
+ }
+const
+{
+   * The font used to draw most interface elements. If you can't find a
+   * more appropriate font from the list below, you should use this
+   * one. This font is suitable for drawing titles on most custom
+   * widgets/buttons, as well as most static text in dialogs and
+   * windows.
+   }
+	kThemeSystemFont = 0;
+
+  {
+   * The font used to draw interface elements when space is at a
+   * premium. It draws a slightly smaller font compared to
+   * kThemeSystemFont.
+   }
+	kThemeSmallSystemFont = 1;
+
+  {
+   * Identical to kThemeSmallSystemFont, except it draws bolded (or
+   * otherwise emphasized in some fashion appropriate to your
+   * application's language/script).
+   }
+	kThemeSmallEmphasizedSystemFont = 2;
+
+  {
+   * The font used to draw file and folder names in Finder windows or
+   * other browsable lists.
+   }
+	kThemeViewsFont = 3;    { The following ID's are only available with MacOS X or CarbonLib 1.3 and later}
+
+  {
+   * Identical to kThemeSystemFont, except it draws bolded (or
+   * otherwise emphasized in some fashion appropriate to your
+   * application's language/script). Only available on Mac OS X or
+   * CarbonLib 1.3 or later.
+   }
+	kThemeEmphasizedSystemFont = 4;
+
+  {
+   * An analog to the Script Manager's notion of the Application Font.
+   * This font is a suitable default choice for your application's
+   * document-style text editing areas. Only available on Mac OS X or
+   * CarbonLib 1.3 or later.
+   }
+	kThemeApplicationFont = 5;
+
+  {
+   * Generally smaller than kThemeSmallSystemFont, this font is
+   * appropriate for drawing text labels next to image content that
+   * reinforces the text's meaning (such as on a bevel button). Only
+   * available on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeLabelFont = 6;
+
+  {
+   * The font used to draw menu titles in the menu bar. Only available
+   * on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeMenuTitleFont = 100;
+
+  {
+   * The font used to draw menu items in the menus. Only available on
+   * Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeMenuItemFont = 101;
+
+  {
+   * The font used to draw menu item marks in the menus. Only available
+   * on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeMenuItemMarkFont = 102;
+
+  {
+   * The font used to draw menu item command key equivalents in the
+   * menus. Only available on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeMenuItemCmdKeyFont = 103;
+
+  {
+   * The font used to draw text in most window title bars. Only
+   * available on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeWindowTitleFont = 104;
+
+  {
+   * The font used to draw text labels on push buttons. Only available
+   * on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemePushButtonFont = 105;
+
+  {
+   * The font used to draw text in utility window title bars. Only
+   * available on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeUtilityWindowTitleFont = 106;
+
+  {
+   * The font used to draw the first (and most important) message of an
+   * alert window. Only available on Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeAlertHeaderFont = 107;
+	kThemeSystemFontDetail = 7;
+	kThemeSystemFontDetailEmphasized = 8;
+
+  {
+   * Unlike the other ThemeFontIDs, this one doesn't map to a font
+   * appropriate to your application's language or script. It maps
+   * directly to the font, size, and style of the current Quickdraw
+   * port. This allows you to get somewhat customized behavior out of
+   * the APIs which take ThemeFontIDs. Note, however, that
+   * kThemeCurrentPortFont does not (and will never) support all
+   * Quickdraw styles on all platforms; in particular, outline and
+   * shadow style are not supported on Mac OS X. Additionally,
+   * kThemeCurrentPortFont is not (and will never be) completely
+   * unicode savvy; use of kThemeCurrentPortFont may result in errors
+   * having to do with the current port's font not being appropriate
+   * for rendering or measuring all glyphs in a given unicode string.
+   * Because of overhead associated with gathering Quickdraw font
+   * information and converting it to the native font format on Mac OS
+   * X, use of kThemeCurrentPortFont may slow down your text drawing
+   * and measuring significantly compared to other ThemeFontIDs.
+   * Instead of using kThemeCurrentPortFont, your application will
+   * probably be better served by using one of the other ThemeFontIDs;
+   * use kThemeCurrentPortFont only as a last resort. Only available on
+   * Mac OS X or CarbonLib 1.3 or later.
+   }
+	kThemeCurrentPortFont = 200;
+
+  {
+   * The font used to draw the label of a toolbar item. Available in
+   * Mac OS X 10.2 or later.
+   }
+	kThemeToolbarFont = 108;
+
+  {
+   * The appropriate system font for mini-sized controls. Available in
+   * Mac OS X 10.3 or later.
+   }
+	kThemeMiniSystemFont = 109;
+
+{ This is the total of the PUBLIC ThemeFontIDs!}
+const
+	kPublicThemeFontCount = 20;
+
+type
+	ThemeFontID = UInt16;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Tab constants                                                                            }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeTabNonFront = 0;
+	kThemeTabNonFrontPressed = 1;
+	kThemeTabNonFrontInactive = 2;
+	kThemeTabFront = 3;
+	kThemeTabFrontInactive = 4;
+	kThemeTabNonFrontUnavailable = 5;
+	kThemeTabFrontUnavailable = 6;
+
+type
+	ThemeTabStyle = UInt16;
+const
+	kThemeTabNorth = 0;
+	kThemeTabSouth = 1;
+	kThemeTabEast = 2;
+	kThemeTabWest = 3;
+
+type
+	ThemeTabDirection = UInt16;
+
+{
+ *  Summary:
+ *    Deprecated tab height and overlap constants.
+ *  
+ *  Discussion:
+ *    These constants have been deprecated in favor of theme metrics.
+ *    Please do not use them anymore. These constants will be removed
+ *    in the next major release of OS X.
+ }
+const
+{
+   * Deprecated. Use kThemeMetricSmallTabHeight.
+   }
+	kThemeSmallTabHeight = 16;
+
+  {
+   * Deprecated. Use kThemeMetricLargeTabHeight.
+   }
+	kThemeLargeTabHeight = 21;
+
+  {
+   * Deprecated. Use kThemeMetricTabFrameOverlap.
+   }
+	kThemeTabPaneOverlap = 3;
+
+  {
+   * Deprecated. Use kThemeMetricSmallTabHeight and
+   * kThemeMetricSmallTabFrameOverlap.
+   }
+	kThemeSmallTabHeightMax = 19;
+
+  {
+   * Deprecated. Use metric kThemeMetricLargeTabHeight and
+   * kThemeMetricTabFrameOverlap.
+   }
+	kThemeLargeTabHeightMax = 24;
+
+
+{
+ *  Discussion:
+ *    ThemeTrackKinds
+ }
+const
+{
+   * This is the primitive used to draw the normal variant of the
+   * scroll bar control.
+   }
+	kThemeScrollBarMedium = 0;
+
+  {
+   * This is the primitive used to draw the small variant of the scroll
+   * bar control.
+   }
+	kThemeScrollBarSmall = 1;
+
+  {
+   * This is the primitive used to draw the normal variant of the
+   * slider control.
+   }
+	kThemeSliderMedium = 2;
+
+  {
+   * This is the primitive used to draw the normal variant of the
+   * progress bar control.
+   }
+	kThemeProgressBarMedium = 3;
+
+  {
+   * This is the primitive used to draw the normal variant of the
+   * indeterminate progress bar control.
+   }
+	kThemeIndeterminateBarMedium = 4;
+
+  {
+   * This is the primitive used to draw the normal variant of the
+   * relevance bar control.
+   }
+	kThemeRelevanceBar = 5;
+
+  {
+   * This is the primitive used to draw the small variant of the slider
+   * control.
+   }
+	kThemeSliderSmall = 6;
+
+  {
+   * This is the primitive used to draw the large variant of the
+   * progress bar control.
+   }
+	kThemeProgressBarLarge = 7;
+
+  {
+   * This is the primitive used to draw the large variant of the
+   * indeterminate progress bar control.
+   }
+	kThemeIndeterminateBarLarge = 8;
+
+
+{
+ *  Discussion:
+ *    New ThemeTrackKinds on Mac OS X 10.3 and later. Not all of them
+ *    are implemented.
+ }
+const
+{
+   * Not implemented. Will return paramErr if used.
+   }
+	kThemeScrollBarMini = 9;
+
+  {
+   * A miniature version of the slider.
+   }
+	kThemeSliderMini = 10;
+
+  {
+   * Not implemented. Will return paramErr if used.
+   }
+	kThemeProgressBarMini = 11;
+
+  {
+   * Not implemented. Will return paramErr if used.
+   }
+	kThemeIndeterminateBarMini = 12;
+
+
+{
+ *  Discussion:
+ *    These are legacy synonyms for previously defined ThemeTrackKinds.
+ *    Please use the modern constant names.
+ }
+const
+	kThemeMediumScrollBar = kThemeScrollBarMedium;
+	kThemeSmallScrollBar = kThemeScrollBarSmall;
+	kThemeMediumSlider = kThemeSliderMedium;
+	kThemeMediumProgressBar = kThemeProgressBarMedium;
+	kThemeMediumIndeterminateBar = kThemeIndeterminateBarMedium;
+	kThemeSmallSlider = kThemeSliderSmall;
+	kThemeLargeProgressBar = kThemeProgressBarLarge;
+	kThemeLargeIndeterminateBar = kThemeIndeterminateBarLarge;
+	kThemeMiniScrollBar = kThemeScrollBarMini;
+	kThemeMiniSlider = kThemeSliderMini;
+	kThemeMiniProgressBar = kThemeProgressBarMini;
+	kThemeMiniIndeterminateBar = kThemeIndeterminateBarMini;
+
+type
+	ThemeTrackKind = UInt16;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Track enable states                                                                      }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+{ track states }
+	kThemeTrackActive = 0;
+	kThemeTrackDisabled = 1;
+	kThemeTrackNothingToScroll = 2;
+	kThemeTrackInactive = 3;
+
+type
+	ThemeTrackEnableState = UInt8;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Track pressed states                                                                     }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+{ press states (ignored unless track is active) }
+	kThemeLeftOutsideArrowPressed = $01;
+	kThemeLeftInsideArrowPressed = $02;
+	kThemeLeftTrackPressed = $04;
+	kThemeThumbPressed = $08;
+	kThemeRightTrackPressed = $10;
+	kThemeRightInsideArrowPressed = $20;
+	kThemeRightOutsideArrowPressed = $40;
+	kThemeTopOutsideArrowPressed = kThemeLeftOutsideArrowPressed;
+	kThemeTopInsideArrowPressed = kThemeLeftInsideArrowPressed;
+	kThemeTopTrackPressed = kThemeLeftTrackPressed;
+	kThemeBottomTrackPressed = kThemeRightTrackPressed;
+	kThemeBottomInsideArrowPressed = kThemeRightInsideArrowPressed;
+	kThemeBottomOutsideArrowPressed = kThemeRightOutsideArrowPressed;
+
+type
+	ThemeTrackPressState = UInt8;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Thumb directions                                                                         }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+{ thumb direction }
+	kThemeThumbPlain = 0;
+	kThemeThumbUpward = 1;
+	kThemeThumbDownward = 2;
+
+type
+	ThemeThumbDirection = UInt8;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Track attributes                                                                         }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+
+{
+ *  Discussion:
+ *    Theme track attributes control the look of the track elements as
+ *    drawn by the DrawThemeTrackFoo as well as the region returned by
+ *    GetThemeTrackFoo.
+ }
+const
+{
+   * The track is drawn horizontally.
+   }
+	kThemeTrackHorizontal = 1 shl 0;
+
+  {
+   * The track progresses from right to left.
+   }
+	kThemeTrackRightToLeft = 1 shl 1;
+
+  {
+   * The track's thumb should be drawn.
+   }
+	kThemeTrackShowThumb = 1 shl 2;
+
+  {
+   * The provided thumbRgn should be drawn opaque, not as a ghost.
+   }
+	kThemeTrackThumbRgnIsNotGhost = 1 shl 3;
+
+  {
+   * The track scroll bar doesn't have arrows.  This attribute
+   * currently has no effect
+   }
+	kThemeTrackNoScrollBarArrows = 1 shl 4;
+
+  {
+   * The thumb has focus.  This attribute currently has effect only on
+   * sliders.  Available only in Mac OS X after 10.1.
+   }
+	kThemeTrackHasFocus = 1 shl 5;
+
+type
+	ThemeTrackAttributes = UInt16;
+
+{
+ *  ScrollBarTrackInfo
+ *  
+ *  Summary:
+ *    Drawing parameters passed to scroll bar drawing and measuring
+ *    theme APIs.
+ *  
+ *  Discussion:
+ *    Used in both the old theme APIs and the newer HITheme APIs.
+ }
+type
+	ScrollBarTrackInfoPtr = ^ScrollBarTrackInfo;
+	ScrollBarTrackInfo = record
+{
+   * The current view range size.
+   }
+		viewsize: SInt32;               { current view range size }
+
+  {
+   * ThemeTrackPressState bits that indicate the pressed parts state.
+   }
+		pressState: SInt8 {ThemeTrackPressState};           { pressed parts state }
+		pad: SInt8
+	end;
+
+{
+ *  SliderTrackInfo
+ *  
+ *  Summary:
+ *    Drawing parameters passed to slider drawing and measuring theme
+ *    APIs.
+ *  
+ *  Discussion:
+ *    Used in both the old theme APIs and the newer HITheme APIs.
+ }
+type
+	SliderTrackInfoPtr = ^SliderTrackInfo;
+	SliderTrackInfo = record
+{
+   * A ThemeThumbDirection indicating the thumb direction.
+   }
+		thumbDir: SInt8 {ThemeThumbDirection};              { thumb direction }
+
+  {
+   * ThemeTrackPressState bits that indicate the pressed parts state.
+   }
+		pressState: SInt8 {ThemeTrackPressState};           { pressed parts state }
+	end;
+
+{
+ *  ProgressTrackInfo
+ *  
+ *  Summary:
+ *    Drawing parameters passed to (indeterminate) progress bar drawing
+ *    and measuring theme APIs.
+ *  
+ *  Discussion:
+ *    Used in both the old theme APIs and the newer HITheme APIs.
+ }
+type
+	ProgressTrackInfoPtr = ^ProgressTrackInfo;
+	ProgressTrackInfo = record
+{
+   * A UInt8 indicating the current phase of the track fill.
+   }
+		phase: SInt8;                  { phase for indeterminate progress }
+		pad: SInt8
+	end;
+
+{
+ *  ThemeTrackDrawInfo
+ *  
+ *  Summary:
+ *    Drawing parameters passed to track drawing and measuring theme
+ *    APIs.
+ *  
+ *  Discussion:
+ *    Use the newer HITheme APIs.
+ }
+type
+	ThemeTrackDrawInfoPtr = ^ThemeTrackDrawInfo;
+	ThemeTrackDrawInfo = record
+{
+   * The ThemeTrackKind of the track being drawn or measured.
+   }
+		kind: ThemeTrackKind;
+
+  {
+   * The bounds of the track is being drawn or measured.
+   }
+		bounds: Rect;
+
+  {
+   * The minimum allowable value for the track being drawn or measured.
+   }
+		min: SInt32;
+
+  {
+   * The maximum allowable value for the track being drawn or measured.
+   }
+		max: SInt32;
+
+  {
+   * The value for the track being drawn or measured.
+   }
+		value: SInt32;
+
+  {
+   * Leave this reserved field set to 0.
+   }
+		reserved: UInt32;
+
+
+  {
+   * A set of ThemeTrackAttributes for the track to be drawn or
+   * measured.
+   }
+		attributes: ThemeTrackAttributes;
+
+  {
+   * A ThemeTrackEnableState describing the state of the track to be
+   * drawn or measured.
+   }
+		enableState: SInt8 {ThemeTrackEnableState};
+
+  {
+   * Leave this reserved field set to 0.
+   }
+		filler1: SInt8;
+		case SInt16 of
+		0: (
+			scrollbar:			ScrollBarTrackInfo;
+			);
+		1: (
+			slider:				SliderTrackInfo;
+			);
+		2: (
+			progress:			ProgressTrackInfo;
+			);
+	end;
+
+{
+ *  Summary:
+ *    ThemeWindowAttributes
+ *  
+ *  Discussion:
+ *    Theme window attributes control the look of the window elements
+ *    as drawn by the DrawThemeWindowFrame.
+ }
+const
+{
+   * This bit means that the size of the window can be changed by the
+   * user. The window is drawn with a grow box.
+   }
+	kThemeWindowHasGrow = 1 shl 0;
+
+  {
+   * This bit means that the window can be zoomed horizontally. The
+   * window is drawn with a zoom box.
+   }
+	kThemeWindowHasHorizontalZoom = 1 shl 3;
+
+  {
+   * This bit means that the window can be zoomed vertically. The
+   * window is drawn with a zoom box.
+   }
+	kThemeWindowHasVerticalZoom = 1 shl 4;
+
+  {
+   * This bit means that the window can be zoomed horizontally and
+   * vertically. The window is drawn with a zoom box.
+   }
+	kThemeWindowHasFullZoom = kThemeWindowHasHorizontalZoom + kThemeWindowHasVerticalZoom;
+
+  {
+   * This bit means that the window can be closed. The window is drawn
+   * with a close box.
+   }
+	kThemeWindowHasCloseBox = 1 shl 5;
+
+  {
+   * This bit means that the window can be collapsed. The window is
+   * drawn with a collapse box.
+   }
+	kThemeWindowHasCollapseBox = 1 shl 6;
+
+  {
+   * This bit means that the window has title text and/or a title icon.
+   }
+	kThemeWindowHasTitleText = 1 shl 7;
+
+  {
+   * This bit means that the window has been collapsed.
+   }
+	kThemeWindowIsCollapsed = 1 shl 8;
+
+  {
+   * This bit means that the window has dirty content. Get your mind
+   * out of the gutter. That means that the content of the window has
+   * changed and needs to be saved. If the window is drawing a close
+   * box, it will be drawn dirty.
+   }
+	kThemeWindowHasDirty = 1 shl 9;
+
+  {
+   * This bit means that the window has a toolbar toggling button.
+   }
+	kThemeWindowHasToolbarButton = 1 shl 11;
+
+
+type
+	ThemeWindowAttributes = UInt32;
+
+{
+ *  Summary:
+ *    ThemeWindowTypes
+ *  
+ *  Discussion:
+ *    Window Types Supported by the Appearance Manager.
+ }
+const
+	kThemeDocumentWindow = 0;
+	kThemeDialogWindow = 1;
+	kThemeMovableDialogWindow = 2;
+	kThemeAlertWindow = 3;
+	kThemeMovableAlertWindow = 4;
+	kThemePlainDialogWindow = 5;
+	kThemeShadowDialogWindow = 6;
+	kThemePopupWindow = 7;
+	kThemeUtilityWindow = 8;
+	kThemeUtilitySideWindow = 9;
+	kThemeSheetWindow = 10;
+	kThemeDrawerWindow = 11;
+
+type
+	ThemeWindowType = UInt16;
+
+{
+ *  Summary:
+ *    ThemeTitleBarWidgets
+ *  
+ *  Discussion:
+ *    Window Widgets Supported by the Appearance Manager.
+ }
+const
+	kThemeWidgetCloseBox = 0;
+	kThemeWidgetZoomBox = 1;
+	kThemeWidgetCollapseBox = 2;
+	kThemeWidgetDirtyCloseBox = 6;
+
+const
+{ Old/Obsolete name to be removed}
+	kThemeWidgetABox = 3;
+	kThemeWidgetBBox = 4;
+	kThemeWidgetBOffBox = 5;
+
+type
+	ThemeTitleBarWidget = UInt16;
+
+{
+ *  Summary:
+ *    ThemeArrowOrientation
+ *  
+ *  Discussion:
+ *    Popup arrow orientations.
+ }
+const
+	kThemeArrowLeft = 0;
+	kThemeArrowDown = 1;
+	kThemeArrowRight = 2;
+	kThemeArrowUp = 3;
+
+type
+	ThemeArrowOrientation = UInt16;
+
+{
+ *  Summary:
+ *    ThemePopupArrowSizes
+ *  
+ *  Discussion:
+ *    Popup arrow sizes.
+ }
+const
+	kThemeArrow3pt = 0;
+	kThemeArrow5pt = 1;
+	kThemeArrow7pt = 2;
+	kThemeArrow9pt = 3;
+
+type
+	ThemePopupArrowSize = UInt16;
+
+{
+ *  Summary:
+ *    ThemeGrowDirections
+ *  
+ *  Discussion:
+ *    Grow box directions.
+ }
+const
+	kThemeGrowLeft = 1 shl 0; { can grow to the left }
+	kThemeGrowRight = 1 shl 1; { can grow to the right }
+	kThemeGrowUp = 1 shl 2; { can grow up }
+	kThemeGrowDown = 1 shl 3; { can grow down }
+
+type
+	ThemeGrowDirection = UInt16;
+
+{
+ *  Discussion:
+ *    ThemeButtonKinds
+ }
+const
+{
+   * Dynamically-sized push button kind. Prior to Mac OS X 10.3 all
+   * push button sizes could be determined dynamically: either they
+   * were smaller than normal size and therefore small or they were
+   * normal size. This constant will never describe a mini push button,
+   * regardless of associated bounds. Please use the explicitly-sized
+   * kThemePushButton(Normal,Small,Mini) constants.
+   }
+	kThemePushButton = 0;
+	kThemeCheckBox = 1;
+	kThemeRadioButton = 2;
+
+  {
+   * Bevel button (obsolete)
+   }
+	kThemeBevelButton = 3;
+
+  {
+   * Popup button without text (no label). See ThemeButtonAdornment for
+   * glyphs. The arrow button theme name is somewhat confusing. This is
+   * the primitive used to draw the control known as the disclosure
+   * button.
+   }
+	kThemeArrowButton = 4;
+
+  {
+   * Dynamically-sized popup button kind. Prior to Mac OS X 10.3 all
+   * popup button sizes could be determined dynamically: either they
+   * were smaller than normal size and therefore small or they were
+   * normal size. This constant will never describe a mini popup
+   * button, regardless of associated bounds. Please use the
+   * explicitly-sized kThemePopupButton(Normal,Small,Mini) constants.
+   }
+	kThemePopupButton = 5;
+
+  {
+   * This is a disclosure triangle with a label beside it. Used to be
+   * confusingly named kThemeDisclosureTriangle.
+   }
+	kThemeDisclosureTriangle = 6;
+
+  {
+   * Increment/decrement buttons (no label). This is the primitive used
+   * to draw the LittleArrows control.
+   }
+	kThemeIncDecButton = 7;
+
+  {
+   * Small-shadow bevel button
+   }
+	kThemeBevelButtonSmall = 8;
+
+  {
+   * Med-shadow bevel button
+   }
+	kThemeBevelButtonMedium = 3;
+
+  {
+   * Large-shadow bevel button
+   }
+	kThemeBevelButtonLarge = 9;
+
+  {
+   * Sort button for top of a list. This is the theme primitive used to
+   * draw the top of the columns in the data browser.
+   }
+	kThemeListHeaderButton = 10;
+
+  {
+   * This is the primitive used to draw the normal variant of the round
+   * button control.
+   }
+	kThemeRoundButton = 11;
+
+  {
+   * This is the primitive used to draw the large variant of the round
+   * button control.
+   }
+	kThemeRoundButtonLarge = 12;
+
+  {
+   * This is the primitive used to draw the small variant of the check
+   * box control.
+   }
+	kThemeCheckBoxSmall = 13;
+
+  {
+   * This is the primitive used to draw the small variant of the radio
+   * button control.
+   }
+	kThemeRadioButtonSmall = 14;
+
+  {
+   * This is the primitive used to draw the rounded-corner variant of
+   * the bevel button control.
+   }
+	kThemeRoundedBevelButton = 15;
+
+  {
+   * This is the primitive used to draw the normal variant of the combo
+   * box control.
+   }
+	kThemeComboBox = 16;
+
+  {
+   * This is the primitive used to draw the small variant of the combo
+   * box control.
+   }
+	kThemeComboBoxSmall = 17;
+
+
+{
+ *  Discussion:
+ *    New ThemeButtonKinds available on Mac OS X 10.3 and later.
+ }
+const
+{
+   * This is the primitive used to draw the mini variant of the combo
+   * box control.
+   }
+	kThemeComboBoxMini = 18;
+
+  {
+   * This is the primitive used to draw the mini variant of the check
+   * box control.
+   }
+	kThemeCheckBoxMini = 19;
+
+  {
+   * This is the primitive used to draw the mini variant of the radio
+   * button control.
+   }
+	kThemeRadioButtonMini = 20;
+
+  {
+   * This is the primitive used to draw the small variant of the
+   * LittleArrows control.
+   }
+	kThemeIncDecButtonSmall = 21;
+
+  {
+   * This is the primitive used to draw the mini variant of the
+   * LittleArrows control.
+   }
+	kThemeIncDecButtonMini = 22;
+
+  {
+   * The arrow button theme name is somewhat confusing. This is the
+   * primitive used to draw the small variant of the control known as
+   * the disclosure button.
+   }
+	kThemeArrowButtonSmall = 23;
+
+  {
+   * The arrow button theme name is somewhat confusing. This is the
+   * primitive used to draw the mini variant of the control known as
+   * the disclosure button.
+   }
+	kThemeArrowButtonMini = 24;
+
+  {
+   * Explicitly-sized normal push button kind. Prior to Mac OS X 10.3
+   * all push button sizes could be determined dynamically: either they
+   * were smaller than normal size and therefore small or they were
+   * normal size. Using this constant, an explicitly-sized normal push
+   * button can be specified.
+   }
+	kThemePushButtonNormal = 25;
+
+  {
+   * Explicitly-sized small push button kind. Prior to Mac OS X 10.3
+   * all push button sizes could be determined dynamically: either they
+   * were smaller than normal size and therefore small or they were
+   * normal size. Using this constant, an explicitly-sized small push
+   * button can be specified.
+   }
+	kThemePushButtonSmall = 26;
+
+  {
+   * Explicitly-sized mini push button kind. Prior to Mac OS X 10.3 all
+   * push button sizes could be determined dynamically: either they
+   * were smaller than normal size and therefore small or they were
+   * normal size. Since a mini variant was introduced in Mac OS X 10.3,
+   * smaller than normal size is can also mean mini. To avoid confusion
+   * with existing code, the mini variant will never be implicitly
+   * determined and must be explicity requested with the
+   * kThemePushButtonMini constant.
+   }
+	kThemePushButtonMini = 27;
+
+  {
+   * Explicitly-sized normal popup button kind. Prior to Mac OS X 10.3
+   * all popup button sizes could be determined dynamically: either
+   * they were smaller than normal size and therefore small or they
+   * were normal size. Using this constant, an explicitly-sized normal
+   * popup button can be specified.
+   }
+	kThemePopupButtonNormal = 28;
+
+  {
+   * Explicitly-sized small popup button kind. Prior to Mac OS X 10.3
+   * all popup button sizes could be determined dynamically: either
+   * they were smaller than normal size and therefore small or they
+   * were normal size. Using this constant, an explicitly-sized small
+   * popup button can be specified.
+   }
+	kThemePopupButtonSmall = 29;
+
+  {
+   * Explicitly-sized mini popup button kind. Prior to Mac OS X 10.3
+   * all popup button sizes could be determined dynamically: either
+   * they were smaller than normal size and therefore small or they
+   * were normal size. Since a mini variant was introduced in Mac OS X
+   * 10.3, smaller than normal size is can also mean mini. To avoid
+   * confusion with existing code, the mini variant will never be
+   * implicitly determined and must be explicity requested with the
+   * kThemePopupButtonMini constant.
+   }
+	kThemePopupButtonMini = 30;
+
+
+{
+ *  Discussion:
+ *    New ThemeButtonKinds available on Mac OS X 10.4 and later.
+ }
+const
+{
+   * This is the primitive used to draw the inset variant of the bevel
+   * button control.
+   }
+	kThemeBevelButtonInset = 31;
+
+  {
+   * This is the primitive used to draw the inset variant of the push
+   * button. Similar to kThemePushButtonNormal, but inset.
+   }
+	kThemePushButtonInset = 32;
+
+  {
+   * This is the primitive used to draw the small, inset variant of the
+   * push button. Similar to kThemePushButtonSmall, but inset.
+   }
+	kThemePushButtonInsetSmall = 33;
+
+  {
+   * This is the primitive used to draw the help variant of the round
+   * button.
+   }
+	kThemeRoundButtonHelp = 34;
+
+
+{
+ *  Discussion:
+ *    These are legacy synonyms for previously defined
+ *    ThemeButtonKinds. Please use the modern constant names.
+ }
+const
+	kThemeNormalCheckBox = kThemeCheckBox;
+	kThemeNormalRadioButton = kThemeRadioButton;
+	kThemeLargeBevelButton = kThemeBevelButtonLarge;
+	kThemeMediumBevelButton = kThemeBevelButtonMedium;
+	kThemeMiniCheckBox = kThemeCheckBoxMini;
+	kThemeMiniRadioButton = kThemeRadioButtonMini;
+	kThemeSmallBevelButton = kThemeBevelButtonSmall;
+	kThemeSmallCheckBox = kThemeCheckBoxSmall;
+	kThemeSmallRadioButton = kThemeRadioButtonSmall;
+	kThemeLargeRoundButton = kThemeRoundButtonLarge;
+	kThemeDisclosureButton = kThemeDisclosureTriangle;
+
+type
+	ThemeButtonKind = UInt16;
+
+{
+ *  Summary:
+ *    ThemeButtonValues
+ *  
+ *  Discussion:
+ *    Common button values
+ }
+const
+	kThemeButtonOff = 0;
+	kThemeButtonOn = 1;
+	kThemeButtonMixed = 2;
+	kThemeDisclosureRight = 0;
+	kThemeDisclosureDown = 1;
+	kThemeDisclosureLeft = 2;
+
+type
+	ThemeButtonValue = UInt16;
+
+
+{
+ *  Summary:
+ *    ThemeButtonAdornments
+ *  
+ *  Discussion:
+ *    Use these adornments when drawing buttons using the theme
+ *    primitive. Note that the bits starting at (1 << 6) are recycled
+ *    and have different meanings depending on ThemeButtonKind.
+ }
+const
+{
+   * No adornments.
+   }
+	kThemeAdornmentNone = 0;
+
+  {
+   * Draw default ornamentation (for push button and generic well).
+   }
+	kThemeAdornmentDefault = 1 shl 0;
+
+  {
+   * Draw focus.
+   }
+	kThemeAdornmentFocus = 1 shl 2;
+
+  {
+   * Draw right to left label.
+   }
+	kThemeAdornmentRightToLeft = 1 shl 4;
+
+  {
+   * Don't draw or erase label (radio, check, disclosure).
+   }
+	kThemeAdornmentDrawIndicatorOnly = 1 shl 5;
+
+  {
+   * Draw the left border of the button as selected (list header button
+   * only).
+   }
+	kThemeAdornmentHeaderButtonLeftNeighborSelected = 1 shl 6;
+
+  {
+   * Draw the right border of the button (list header button only).
+   }
+	kThemeAdornmentHeaderButtonRightNeighborSelected = 1 shl 7;
+
+  {
+   * Draw the sort indicator pointing upward (list header button only).
+   }
+	kThemeAdornmentHeaderButtonSortUp = 1 shl 8;
+
+  {
+   * Draw as a header menu button (list header button only).
+   }
+	kThemeAdornmentHeaderMenuButton = 1 shl 9;
+
+  {
+   * Draw the non-shadow area of the button (list header button only).
+   }
+	kThemeAdornmentHeaderButtonNoShadow = 1 shl 10;
+
+  {
+   * Draw the only the shadow area of the button (list header button
+   * only).
+   }
+	kThemeAdornmentHeaderButtonShadowOnly = 1 shl 11;
+
+  {
+   * When drawn selected, do not draw the sort direction arrow (list
+   * header button only). Mac OS X 10.4 and later.
+   }
+	kThemeAdornmentHeaderButtonNoSortArrow = 1 shl 12;
+
+  {
+   * Draw a left arrow on the arrow button or draw left disclosure
+   * triangle. Can be combined with kThemeAdornmentArrowDownArrow to
+   * draw an intermediate disclosure triangle.
+   }
+	kThemeAdornmentArrowLeftArrow = 1 shl 6;
+
+  {
+   * Draw a down arrow on the arrow button or draw right disclosure
+   * triangle. Can be combined with kThemeAdornmentArrowLeftArrow to
+   * draw an intermediate disclosure triangle.
+   }
+	kThemeAdornmentArrowDownArrow = 1 shl 7;
+
+  {
+   * Draw a double arrow on the arrow button.
+   }
+	kThemeAdornmentArrowDoubleArrow = 1 shl 8;
+
+  {
+   * Draw a up arrow on the arrow button.
+   }
+	kThemeAdornmentArrowUpArrow = 1 shl 9;
+
+
+{
+ *  Discussion:
+ *    These are legacy synonyms for previously defined
+ *    ThemeButtonAdornments. Please use the modern constant names.
+ }
+const
+	kThemeAdornmentNoShadow = kThemeAdornmentHeaderButtonNoShadow;
+	kThemeAdornmentShadowOnly = kThemeAdornmentHeaderButtonShadowOnly;
+
+type
+	ThemeButtonAdornment = UInt16;
+
+{
+ *  ThemeButtonDrawInfo
+ *  
+ *  Summary:
+ *    Drawing parameters passed to button drawing and measuring theme
+ *    APIs.
+ *  
+ *  Discussion:
+ *    Use the newer HITheme APIs.
+ }
+type
+	ThemeButtonDrawInfo = record
+{
+   * The ThemeDrawState of the button being drawn or measured.
+   }
+		state: ThemeDrawState;
+
+  {
+   * The ThemeButtonValue of the button being drawn or measured.
+   }
+		value: ThemeButtonValue;
+
+  {
+   * The ThemeButtonAdornment(s) with which the button is being drawn
+   * or measured.
+   }
+		adornment: ThemeButtonAdornment;
+	end;
+	ThemeButtonDrawInfoPtr = ^ThemeButtonDrawInfo;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Sound Support                                                                            }
+{  X ALERT: Please note that none of the theme sound APIs currently function on X.         }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Sound classes                                                                            }
+{ You can use the constants below to set what sounds are active using the SetTheme API.    }
+{ Use these with the kThemeSoundMask tag.                                                  }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeNoSounds = 0;
+	kThemeWindowSoundsMask = 1 shl 0;
+	kThemeMenuSoundsMask = 1 shl 1;
+	kThemeControlSoundsMask = 1 shl 2;
+	kThemeFinderSoundsMask = 1 shl 3;
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Drag Sounds                                                                              }
+{ Drag sounds are looped for the duration of the drag.                                     }
+{ Call BeginThemeDragSound at the start of the drag.                                       }
+{ Call EndThemeDragSound when the drag has finished.                                       }
+{ Note that in order to maintain a consistent user experience, only one drag sound may     }
+{ occur at a time.  The sound should be attached to a mouse action, start after the        }
+{ mouse goes down and stop when the mouse is released.                                     }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeDragSoundNone = 0;
+	kThemeDragSoundMoveWindow = $776D6F76 (* 'wmov' *);
+	kThemeDragSoundGrowWindow = $7767726F (* 'wgro' *);
+	kThemeDragSoundMoveUtilWindow = $756D6F76 (* 'umov' *);
+	kThemeDragSoundGrowUtilWindow = $7567726F (* 'ugro' *);
+	kThemeDragSoundMoveDialog = $646D6F76 (* 'dmov' *);
+	kThemeDragSoundMoveAlert = $616D6F76 (* 'amov' *);
+	kThemeDragSoundMoveIcon = $696D6F76 (* 'imov' *);
+	kThemeDragSoundSliderThumb = $736C7468 (* 'slth' *);
+	kThemeDragSoundSliderGhost = $736C6768 (* 'slgh' *);
+	kThemeDragSoundScrollBarThumb = $73627468 (* 'sbth' *);
+	kThemeDragSoundScrollBarGhost = $73626768 (* 'sbgh' *);
+	kThemeDragSoundScrollBarArrowDecreasing = $73626164 (* 'sbad' *);
+	kThemeDragSoundScrollBarArrowIncreasing = $73626169 (* 'sbai' *);
+	kThemeDragSoundDragging = $64726167 (* 'drag' *);
+
+type
+	ThemeDragSoundKind = OSType;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ State-change sounds                                                      }
+{ State-change sounds are played asynchonously as a one-shot.              }
+{ Call PlayThemeSound to play the sound.  The sound will play              }
+{ asynchronously until complete, then stop automatically.                  }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+const
+	kThemeSoundNone = 0;
+	kThemeSoundMenuOpen = $6D6E756F (* 'mnuo' *); { menu sounds }
+	kThemeSoundMenuClose = $6D6E7563 (* 'mnuc' *);
+	kThemeSoundMenuItemHilite = $6D6E7569 (* 'mnui' *);
+	kThemeSoundMenuItemRelease = $6D6E7573 (* 'mnus' *);
+	kThemeSoundWindowClosePress = $77636C70 (* 'wclp' *); { window sounds }
+	kThemeSoundWindowCloseEnter = $77636C65 (* 'wcle' *);
+	kThemeSoundWindowCloseExit = $77636C78 (* 'wclx' *);
+	kThemeSoundWindowCloseRelease = $77636C72 (* 'wclr' *);
+	kThemeSoundWindowZoomPress = $777A6D70 (* 'wzmp' *);
+	kThemeSoundWindowZoomEnter = $777A6D65 (* 'wzme' *);
+	kThemeSoundWindowZoomExit = $777A6D78 (* 'wzmx' *);
+	kThemeSoundWindowZoomRelease = $777A6D72 (* 'wzmr' *);
+	kThemeSoundWindowCollapsePress = $77636F70 (* 'wcop' *);
+	kThemeSoundWindowCollapseEnter = $77636F65 (* 'wcoe' *);
+	kThemeSoundWindowCollapseExit = $77636F78 (* 'wcox' *);
+	kThemeSoundWindowCollapseRelease = $77636F72 (* 'wcor' *);
+	kThemeSoundWindowDragBoundary = $77646264 (* 'wdbd' *);
+	kThemeSoundUtilWinClosePress = $75636C70 (* 'uclp' *); { utility window sounds }
+	kThemeSoundUtilWinCloseEnter = $75636C65 (* 'ucle' *);
+	kThemeSoundUtilWinCloseExit = $75636C78 (* 'uclx' *);
+	kThemeSoundUtilWinCloseRelease = $75636C72 (* 'uclr' *);
+	kThemeSoundUtilWinZoomPress = $757A6D70 (* 'uzmp' *);
+	kThemeSoundUtilWinZoomEnter = $757A6D65 (* 'uzme' *);
+	kThemeSoundUtilWinZoomExit = $757A6D78 (* 'uzmx' *);
+	kThemeSoundUtilWinZoomRelease = $757A6D72 (* 'uzmr' *);
+	kThemeSoundUtilWinCollapsePress = $75636F70 (* 'ucop' *);
+	kThemeSoundUtilWinCollapseEnter = $75636F65 (* 'ucoe' *);
+	kThemeSoundUtilWinCollapseExit = $75636F78 (* 'ucox' *);
+	kThemeSoundUtilWinCollapseRelease = $75636F72 (* 'ucor' *);
+	kThemeSoundUtilWinDragBoundary = $75646264 (* 'udbd' *);
+	kThemeSoundWindowOpen = $776F706E (* 'wopn' *); { window close and zoom action }
+	kThemeSoundWindowClose = $77636C73 (* 'wcls' *);
+	kThemeSoundWindowZoomIn = $777A6D69 (* 'wzmi' *);
+	kThemeSoundWindowZoomOut = $777A6D6F (* 'wzmo' *);
+	kThemeSoundWindowCollapseUp = $77636F6C (* 'wcol' *);
+	kThemeSoundWindowCollapseDown = $77657870 (* 'wexp' *);
+	kThemeSoundWindowActivate = $77616374 (* 'wact' *);
+	kThemeSoundUtilWindowOpen = $756F706E (* 'uopn' *);
+	kThemeSoundUtilWindowClose = $75636C73 (* 'ucls' *);
+	kThemeSoundUtilWindowZoomIn = $757A6D69 (* 'uzmi' *);
+	kThemeSoundUtilWindowZoomOut = $757A6D6F (* 'uzmo' *);
+	kThemeSoundUtilWindowCollapseUp = $75636F6C (* 'ucol' *);
+	kThemeSoundUtilWindowCollapseDown = $75657870 (* 'uexp' *);
+	kThemeSoundUtilWindowActivate = $75616374 (* 'uact' *);
+	kThemeSoundDialogOpen = $646F706E (* 'dopn' *);
+	kThemeSoundDialogClose = $646C6763 (* 'dlgc' *);
+	kThemeSoundAlertOpen = $616F706E (* 'aopn' *);
+	kThemeSoundAlertClose = $616C7463 (* 'altc' *);
+	kThemeSoundPopupWindowOpen = $70776F70 (* 'pwop' *);
+	kThemeSoundPopupWindowClose = $7077636C (* 'pwcl' *);
+	kThemeSoundButtonPress = $62746E70 (* 'btnp' *); { button }
+	kThemeSoundButtonEnter = $62746E65 (* 'btne' *);
+	kThemeSoundButtonExit = $62746E78 (* 'btnx' *);
+	kThemeSoundButtonRelease = $62746E72 (* 'btnr' *);
+	kThemeSoundDefaultButtonPress = $64627470 (* 'dbtp' *); { default button }
+	kThemeSoundDefaultButtonEnter = $64627465 (* 'dbte' *);
+	kThemeSoundDefaultButtonExit = $64627478 (* 'dbtx' *);
+	kThemeSoundDefaultButtonRelease = $64627472 (* 'dbtr' *);
+	kThemeSoundCancelButtonPress = $63627470 (* 'cbtp' *); { cancel button }
+	kThemeSoundCancelButtonEnter = $63627465 (* 'cbte' *);
+	kThemeSoundCancelButtonExit = $63627478 (* 'cbtx' *);
+	kThemeSoundCancelButtonRelease = $63627472 (* 'cbtr' *);
+	kThemeSoundCheckboxPress = $63686B70 (* 'chkp' *); { checkboxes }
+	kThemeSoundCheckboxEnter = $63686B65 (* 'chke' *);
+	kThemeSoundCheckboxExit = $63686B78 (* 'chkx' *);
+	kThemeSoundCheckboxRelease = $63686B72 (* 'chkr' *);
+	kThemeSoundRadioPress = $72616470 (* 'radp' *); { radio buttons }
+	kThemeSoundRadioEnter = $72616465 (* 'rade' *);
+	kThemeSoundRadioExit = $72616478 (* 'radx' *);
+	kThemeSoundRadioRelease = $72616472 (* 'radr' *);
+	kThemeSoundScrollArrowPress = $73626170 (* 'sbap' *); { scroll bars }
+	kThemeSoundScrollArrowEnter = $73626165 (* 'sbae' *);
+	kThemeSoundScrollArrowExit = $73626178 (* 'sbax' *);
+	kThemeSoundScrollArrowRelease = $73626172 (* 'sbar' *);
+	kThemeSoundScrollEndOfTrack = $73627465 (* 'sbte' *);
+	kThemeSoundScrollTrackPress = $73627470 (* 'sbtp' *);
+	kThemeSoundSliderEndOfTrack = $736C7465 (* 'slte' *); { sliders }
+	kThemeSoundSliderTrackPress = $736C7470 (* 'sltp' *);
+	kThemeSoundBalloonOpen = $626C6E6F (* 'blno' *); { help balloons }
+	kThemeSoundBalloonClose = $626C6E63 (* 'blnc' *);
+	kThemeSoundBevelPress = $62657670 (* 'bevp' *); { Bevel buttons }
+	kThemeSoundBevelEnter = $62657665 (* 'beve' *);
+	kThemeSoundBevelExit = $62657678 (* 'bevx' *);
+	kThemeSoundBevelRelease = $62657672 (* 'bevr' *);
+	kThemeSoundLittleArrowUpPress = $6C617570 (* 'laup' *); { Little Arrows }
+	kThemeSoundLittleArrowDnPress = $6C616470 (* 'ladp' *);
+	kThemeSoundLittleArrowEnter = $6C617265 (* 'lare' *);
+	kThemeSoundLittleArrowExit = $6C617278 (* 'larx' *);
+	kThemeSoundLittleArrowUpRelease = $6C617572 (* 'laur' *);
+	kThemeSoundLittleArrowDnRelease = $6C616472 (* 'ladr' *);
+	kThemeSoundPopupPress = $706F7070 (* 'popp' *); { Popup Buttons }
+	kThemeSoundPopupEnter = $706F7065 (* 'pope' *);
+	kThemeSoundPopupExit = $706F7078 (* 'popx' *);
+	kThemeSoundPopupRelease = $706F7072 (* 'popr' *);
+	kThemeSoundDisclosurePress = $64736370 (* 'dscp' *); { Disclosure Buttons }
+	kThemeSoundDisclosureEnter = $64736365 (* 'dsce' *);
+	kThemeSoundDisclosureExit = $64736378 (* 'dscx' *);
+	kThemeSoundDisclosureRelease = $64736372 (* 'dscr' *);
+	kThemeSoundTabPressed = $74616270 (* 'tabp' *); { Tabs }
+	kThemeSoundTabEnter = $74616265 (* 'tabe' *);
+	kThemeSoundTabExit = $74616278 (* 'tabx' *);
+	kThemeSoundTabRelease = $74616272 (* 'tabr' *);
+	kThemeSoundDragTargetHilite = $64746869 (* 'dthi' *); { drag manager }
+	kThemeSoundDragTargetUnhilite = $64747568 (* 'dtuh' *);
+	kThemeSoundDragTargetDrop = $64746472 (* 'dtdr' *);
+	kThemeSoundEmptyTrash = $66747273 (* 'ftrs' *); { finder }
+	kThemeSoundSelectItem = $6673656C (* 'fsel' *);
+	kThemeSoundNewItem = $666E6577 (* 'fnew' *);
+	kThemeSoundReceiveDrop = $66647270 (* 'fdrp' *);
+	kThemeSoundCopyDone = $66637064 (* 'fcpd' *);
+	kThemeSoundResolveAlias = $6672616C (* 'fral' *);
+	kThemeSoundLaunchApp = $666C6170 (* 'flap' *);
+	kThemeSoundDiskInsert = $64736B69 (* 'dski' *);
+	kThemeSoundDiskEject = $64736B65 (* 'dske' *);
+	kThemeSoundFinderDragOnIcon = $66646F6E (* 'fdon' *);
+	kThemeSoundFinderDragOffIcon = $66646F66 (* 'fdof' *);
+
+type
+	ThemeSoundKind = OSType;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Window Metrics                                                                           }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{  Window metrics are used by the Appearance manager to fill in the blanks necessary to    }
+{  draw windows. If a value is not appropriate for the type of window, be sure to fill in  }
+{  the slot in the structure with zero.    For the popupTabOffset parameter, you can pass a}
+{  real value based on the left edge of the window. This value might be interpreted in a   }
+{  different manner when depending on the value of the popupTabPosition field. The values  }
+{  you can pass into popupTabPosition are:                                                 }
+{  kThemePopupTabNormalPosition                                                            }
+{      Starts the tab left edge at the position indicated by the popupTabOffset field.     }
+{  kThemePopupTabCenterOnWindow                                                            }
+{      tells us to ignore the offset field and instead simply center the width of the      }
+{      handle on the window.                                                               }
+{  kThemePopupTabCenterOnOffset                                                            }
+{      tells us to center the width of the handle around the value passed in offset.       }
+{  The Appearance Manager will try its best to accomodate the requested placement, but may }
+{  move the handle slightly to make it fit correctly.                                      }
+const
+	kThemePopupTabNormalPosition = 0;
+	kThemePopupTabCenterOnWindow = 1;
+	kThemePopupTabCenterOnOffset = 2;
+
+type
+	ThemeWindowMetrics = record
+		metricSize: UInt16;             { should be always be sizeof( ThemeWindowMetrics )}
+		titleHeight: SInt16;
+		titleWidth: SInt16;
+		popupTabOffset: SInt16;
+		popupTabWidth: SInt16;
+		popupTabPosition: UInt16;
+	end;
+type
+	ThemeWindowMetricsPtr = ^ThemeWindowMetrics;
+
+{
+ *  Summary:
+ *    Theme metrics allow you to find out sizes of things in the
+ *    current environment, such as how wide a scroll bar is, etc.
+ *  
+ *  Discussion:
+ *    ThemeMetrics
+ }
+const
+{
+   * The width (or height if horizontal) of a scroll bar.
+   }
+	kThemeMetricScrollBarWidth = 0;
+
+  {
+   * The width (or height if horizontal) of a small scroll bar.
+   }
+	kThemeMetricSmallScrollBarWidth = 1;
+
+  {
+   * The height of the non-label part of a check box control.
+   }
+	kThemeMetricCheckBoxHeight = 2;
+
+  {
+   * The height of the non-label part of a radio button control.
+   }
+	kThemeMetricRadioButtonHeight = 3;
+
+  {
+   * The amount of white space surrounding the text Rect of the text
+   * inside of an Edit Text control.  If you select all of the text in
+   * an Edit Text control, you can see the white space. The metric is
+   * the number of pixels, per side, that the text Rect is outset to
+   * create the whitespace Rect.
+   }
+	kThemeMetricEditTextWhitespace = 4;
+
+  {
+   * The thickness of the Edit Text frame that surrounds the whitespace
+   * Rect (that is surrounding the text Rect). The metric is the number
+   * of pixels, per side, that the frame Rect is outset from the
+   * whitespace Rect.
+   }
+	kThemeMetricEditTextFrameOutset = 5;
+
+  {
+   * The number of pixels that the list box frame is outset from the
+   * content of the list box.
+   }
+	kThemeMetricListBoxFrameOutset = 6;
+
+  {
+   * This is a deprecated metric.  Don't use it.  It used to describe
+   * how far the focus rect used to draw from a control, but control
+   * focus drawing no longer uses this information to draw its focus.
+   }
+	kThemeMetricFocusRectOutset = 7;
+
+  {
+   * The thickness of the frame drawn by DrawThemeGenericWell.
+   }
+	kThemeMetricImageWellThickness = 8;
+
+  {
+   * The number of pixels a scrollbar should overlap (actually
+   * underlap) any bounding box which surrounds it and scrollable
+   * content. This also includes the window frame when a scrolbar is
+   * along an edge of the window.
+   }
+	kThemeMetricScrollBarOverlap = 9;
+
+  {
+   * The height of the large tab of a tab control.
+   }
+	kThemeMetricLargeTabHeight = 10;
+
+  {
+   * The width of the caps (end pieces) of the large tabs of a tab
+   * control.
+   }
+	kThemeMetricLargeTabCapsWidth = 11;
+
+  {
+   * The amount to add to the tab height (kThemeMetricLargeTabHeight)
+   * to find out the rectangle height to use with the various Tab
+   * drawing primitives. This amount is also the amount that each tab
+   * overlaps the tab pane.
+   }
+	kThemeMetricTabFrameOverlap = 12;
+
+  {
+   * If less than zero, this indicates that the text should be centered
+   * on each tab. If greater than zero, the text should be justified
+   * (according to the system script direction) and the amount is the
+   * offset from the appropriate edge at which the text should start
+   * drawing.
+   }
+	kThemeMetricTabIndentOrStyle = 13;
+
+  {
+   * The amount of space that every tab's drawing rectangle overlaps
+   * the one on either side of it.
+   }
+	kThemeMetricTabOverlap = 14;
+
+  {
+   * The height of the small tab of a tab control.  This includes the
+   * pixels that overlap the tab pane and/or tab pane bar.
+   }
+	kThemeMetricSmallTabHeight = 15;
+
+  {
+   * The width of the caps (end pieces) of the small tabs of a tab
+   * control.
+   }
+	kThemeMetricSmallTabCapsWidth = 16;
+
+  {
+   * The height and the width of the push button control.
+   }
+	kThemeMetricPushButtonHeight = 19;
+
+  {
+   * The height of the list header field of the data browser control.
+   }
+	kThemeMetricListHeaderHeight = 20;
+
+  {
+   * The height of a disclosure triangle control.  This triangle is the
+   * not the center of the disclosure button, but its own control.
+   }
+	kThemeMetricDisclosureTriangleHeight = 25;
+
+  {
+   * The width of a disclosure triangle control.
+   }
+	kThemeMetricDisclosureTriangleWidth = 26;
+
+  {
+   * The height of a little arrows control.
+   }
+	kThemeMetricLittleArrowsHeight = 27;
+
+  {
+   * The width of a little arrows control.
+   }
+	kThemeMetricLittleArrowsWidth = 28;
+
+  {
+   * The height of a popup button control.
+   }
+	kThemeMetricPopupButtonHeight = 30;
+
+  {
+   * The height of a small popup button control.
+   }
+	kThemeMetricSmallPopupButtonHeight = 31;
+
+  {
+   * The height of the large progress bar, not including its shadow.
+   }
+	kThemeMetricLargeProgressBarThickness = 32;
+
+  {
+   * This metric is not used.
+   }
+	kThemeMetricPullDownHeight = 33;
+
+  {
+   * This metric is not used.
+   }
+	kThemeMetricSmallPullDownHeight = 34;
+
+  {
+   * The height of the window grow box control.
+   }
+	kThemeMetricResizeControlHeight = 38;
+
+  {
+   * The width of the window grow box control.
+   }
+	kThemeMetricSmallResizeControlHeight = 39;
+
+  {
+   * The height of the horizontal slider control.
+   }
+	kThemeMetricHSliderHeight = 41;
+
+  {
+   * The height of the tick marks for a horizontal slider control.
+   }
+	kThemeMetricHSliderTickHeight = 42;
+
+  {
+   * The width of the vertical slider control.
+   }
+	kThemeMetricVSliderWidth = 45;
+
+  {
+   * The width of the tick marks for a vertical slider control.
+   }
+	kThemeMetricVSliderTickWidth = 46;
+
+  {
+   * The height of the title bar widgets (grow, close, and zoom boxes)
+   * for a document window.
+   }
+	kThemeMetricTitleBarControlsHeight = 49;
+
+  {
+   * The width of the non-label part of a check box control.
+   }
+	kThemeMetricCheckBoxWidth = 50;
+
+  {
+   * The width of the non-label part of a radio button control.
+   }
+	kThemeMetricRadioButtonWidth = 52;
+
+  {
+   * The height of the normal bar, not including its shadow.
+   }
+	kThemeMetricNormalProgressBarThickness = 58;
+
+  {
+   * The number of pixels of shadow depth drawn below the progress bar.
+   }
+	kThemeMetricProgressBarShadowOutset = 59;
+
+  {
+   * The number of pixels of shadow depth drawn below the small
+   * progress bar.
+   }
+	kThemeMetricSmallProgressBarShadowOutset = 60;
+
+  {
+   * The number of pixels that the content of a primary group box is
+   * from the bounds of the control.
+   }
+	kThemeMetricPrimaryGroupBoxContentInset = 61;
+
+  {
+   * The number of pixels that the content of a secondary group box is
+   * from the bounds of the control.
+   }
+	kThemeMetricSecondaryGroupBoxContentInset = 62;
+
+  {
+   * Width allocated to draw the mark character in a menu.
+   }
+	kThemeMetricMenuMarkColumnWidth = 63;
+
+  {
+   * Width allocated for the mark character in a menu item when the
+   * menu has kMenuAttrExcludesMarkColumn.
+   }
+	kThemeMetricMenuExcludedMarkColumnWidth = 64;
+
+  {
+   * Indent into the interior of the mark column at which the mark
+   * character is drawn.
+   }
+	kThemeMetricMenuMarkIndent = 65;
+
+  {
+   * Whitespace at the leading edge of menu item text.
+   }
+	kThemeMetricMenuTextLeadingEdgeMargin = 66;
+
+  {
+   * Whitespace at the trailing edge of menu item text.
+   }
+	kThemeMetricMenuTextTrailingEdgeMargin = 67;
+
+  {
+   * Width per indent level (set by SetMenuItemIndent) of a menu item.
+   }
+	kThemeMetricMenuIndentWidth = 68;
+
+  {
+   * Whitespace at the trailing edge of a menu icon (if the item also
+   * has text).
+   }
+	kThemeMetricMenuIconTrailingEdgeMargin = 69;
+
+
+{
+ *  Discussion:
+ *    The following metrics are only available in OS X.
+ }
+const
+{
+   * The height of a disclosure button.
+   }
+	kThemeMetricDisclosureButtonHeight = 17;
+
+  {
+   * The height and the width of the round button control.
+   }
+	kThemeMetricRoundButtonSize = 18;
+
+  {
+   * The height of the non-label part of a small check box control.
+   }
+	kThemeMetricSmallCheckBoxHeight = 21;
+
+  {
+   * The width of a disclosure button.
+   }
+	kThemeMetricDisclosureButtonWidth = 22;
+
+  {
+   * The height of a small disclosure button.
+   }
+	kThemeMetricSmallDisclosureButtonHeight = 23;
+
+  {
+   * The width of a small disclosure button.
+   }
+	kThemeMetricSmallDisclosureButtonWidth = 24;
+
+  {
+   * The height (or width if vertical) of a pane splitter.
+   }
+	kThemeMetricPaneSplitterHeight = 29;
+
+  {
+   * The height of the small push button control.
+   }
+	kThemeMetricSmallPushButtonHeight = 35;
+
+  {
+   * The height of the non-label part of a small radio button control.
+   }
+	kThemeMetricSmallRadioButtonHeight = 36;
+
+  {
+   * The height of the relevance indicator control.
+   }
+	kThemeMetricRelevanceIndicatorHeight = 37;
+
+  {
+   * The height and the width of the large round button control.
+   }
+	kThemeMetricLargeRoundButtonSize = 40;
+
+  {
+   * The height of the small, horizontal slider control.
+   }
+	kThemeMetricSmallHSliderHeight = 43;
+
+  {
+   * The height of the tick marks for a small, horizontal slider
+   * control.
+   }
+	kThemeMetricSmallHSliderTickHeight = 44;
+
+  {
+   * The width of the small, vertical slider control.
+   }
+	kThemeMetricSmallVSliderWidth = 47;
+
+  {
+   * The width of the tick marks for a small, vertical slider control.
+   }
+	kThemeMetricSmallVSliderTickWidth = 48;
+
+  {
+   * The width of the non-label part of a small check box control.
+   }
+	kThemeMetricSmallCheckBoxWidth = 51;
+
+  {
+   * The width of the non-label part of a small radio button control.
+   }
+	kThemeMetricSmallRadioButtonWidth = 53;
+
+  {
+   * The minimum width of the thumb of a small, horizontal slider
+   * control.
+   }
+	kThemeMetricSmallHSliderMinThumbWidth = 54;
+
+  {
+   * The minimum width of the thumb of a small, vertical slider control.
+   }
+	kThemeMetricSmallVSliderMinThumbHeight = 55;
+
+  {
+   * The offset of the tick marks from the appropriate side of a small
+   * horizontal slider control.
+   }
+	kThemeMetricSmallHSliderTickOffset = 56;
+
+  {
+   * The offset of the tick marks from the appropriate side of a small
+   * vertical slider control.
+   }
+	kThemeMetricSmallVSliderTickOffset = 57;
+
+
+{
+ *  Discussion:
+ *    The following metrics are only available in Mac OS X 10.3 and
+ *    later.
+ }
+const
+	kThemeMetricComboBoxLargeBottomShadowOffset = 70;
+	kThemeMetricComboBoxLargeRightShadowOffset = 71;
+	kThemeMetricComboBoxSmallBottomShadowOffset = 72;
+	kThemeMetricComboBoxSmallRightShadowOffset = 73;
+	kThemeMetricComboBoxLargeDisclosureWidth = 74;
+	kThemeMetricComboBoxSmallDisclosureWidth = 75;
+	kThemeMetricRoundTextFieldContentInsetLeft = 76;
+	kThemeMetricRoundTextFieldContentInsetRight = 77;
+	kThemeMetricRoundTextFieldContentInsetBottom = 78;
+	kThemeMetricRoundTextFieldContentInsetTop = 79;
+	kThemeMetricRoundTextFieldContentHeight = 80;
+	kThemeMetricComboBoxMiniBottomShadowOffset = 81;
+	kThemeMetricComboBoxMiniDisclosureWidth = 82;
+	kThemeMetricComboBoxMiniRightShadowOffset = 83;
+	kThemeMetricLittleArrowsMiniHeight = 84;
+	kThemeMetricLittleArrowsMiniWidth = 85;
+	kThemeMetricLittleArrowsSmallHeight = 86;
+	kThemeMetricLittleArrowsSmallWidth = 87;
+	kThemeMetricMiniCheckBoxHeight = 88;
+	kThemeMetricMiniCheckBoxWidth = 89;
+	kThemeMetricMiniDisclosureButtonHeight = 90;
+	kThemeMetricMiniDisclosureButtonWidth = 91;
+	kThemeMetricMiniHSliderHeight = 92;
+	kThemeMetricMiniHSliderMinThumbWidth = 93;
+	kThemeMetricMiniHSliderTickHeight = 94;
+	kThemeMetricMiniHSliderTickOffset = 95;
+	kThemeMetricMiniPopupButtonHeight = 96;
+	kThemeMetricMiniPullDownHeight = 97;
+	kThemeMetricMiniPushButtonHeight = 98;
+	kThemeMetricMiniRadioButtonHeight = 99;
+	kThemeMetricMiniRadioButtonWidth = 100;
+	kThemeMetricMiniTabCapsWidth = 101;
+	kThemeMetricMiniTabFrameOverlap = 102;
+	kThemeMetricMiniTabHeight = 103;
+	kThemeMetricMiniTabOverlap = 104;
+	kThemeMetricMiniVSliderMinThumbHeight = 105;
+	kThemeMetricMiniVSliderTickOffset = 106;
+	kThemeMetricMiniVSliderTickWidth = 107;
+	kThemeMetricMiniVSliderWidth = 108;
+	kThemeMetricRoundTextFieldContentInsetWithIconLeft = 109;
+	kThemeMetricRoundTextFieldContentInsetWithIconRight = 110;
+	kThemeMetricRoundTextFieldMiniContentHeight = 111;
+	kThemeMetricRoundTextFieldMiniContentInsetBottom = 112;
+	kThemeMetricRoundTextFieldMiniContentInsetLeft = 113;
+	kThemeMetricRoundTextFieldMiniContentInsetRight = 114;
+	kThemeMetricRoundTextFieldMiniContentInsetTop = 115;
+	kThemeMetricRoundTextFieldMiniContentInsetWithIconLeft = 116;
+	kThemeMetricRoundTextFieldMiniContentInsetWithIconRight = 117;
+	kThemeMetricRoundTextFieldSmallContentHeight = 118;
+	kThemeMetricRoundTextFieldSmallContentInsetBottom = 119;
+	kThemeMetricRoundTextFieldSmallContentInsetLeft = 120;
+	kThemeMetricRoundTextFieldSmallContentInsetRight = 121;
+	kThemeMetricRoundTextFieldSmallContentInsetTop = 122;
+	kThemeMetricRoundTextFieldSmallContentInsetWithIconLeft = 123;
+	kThemeMetricRoundTextFieldSmallContentInsetWithIconRight = 124;
+	kThemeMetricSmallTabFrameOverlap = 125;
+	kThemeMetricSmallTabOverlap = 126;
+
+  {
+   * The height of a small pane splitter. Should only be used in a
+   * window with thick borders, like a metal window.
+   }
+	kThemeMetricSmallPaneSplitterHeight = 127;
+
+
+{
+ *  Discussion:
+ *    The following metrics are only available in Mac OS X 10.4 and
+ *    later.
+ }
+const
+{
+   * The horizontal start offset for the first tick mark on a
+   * horizontal slider.
+   }
+	kThemeMetricHSliderTickOffset = 128;
+
+  {
+   * The vertical start offset for the first tick mark on a vertical
+   * slider.
+   }
+	kThemeMetricVSliderTickOffset = 129;
+
+  {
+   * The minimum thumb height for a thumb on a slider.
+   }
+	kThemeMetricSliderMinThumbHeight = 130;
+	kThemeMetricSliderMinThumbWidth = 131;
+
+  {
+   * The minimum thumb height for a thumb on a scroll bar.
+   }
+	kThemeMetricScrollBarMinThumbHeight = 132;
+
+  {
+   * The minimum thumb width for a thumb on a scroll bar.
+   }
+	kThemeMetricScrollBarMinThumbWidth = 133;
+
+  {
+   * The minimum thumb height for a thumb on a small scroll bar.
+   }
+	kThemeMetricSmallScrollBarMinThumbHeight = 134;
+
+  {
+   * The minimum thumb width for a thumb on a small scroll bar.
+   }
+	kThemeMetricSmallScrollBarMinThumbWidth = 135;
+
+
+type
+	ThemeMetric = UInt32;
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Drawing State                                                                            }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+type
+	ThemeDrawingState = ^SInt32; { an opaque 32-bit type }
+	ThemeDrawingStatePtr = ^ThemeDrawingState;  { when a var xx:ThemeDrawingState parameter can be nil, it is changed to xx: ThemeDrawingStatePtr }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Callback procs                                                                           }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+type
+	ThemeTabTitleDrawProcPtr = procedure( const (*var*) bounds: Rect; style: ThemeTabStyle; direction: ThemeTabDirection; depth: SInt16; isColorDev: Boolean; userData: UInt32 );
+type
+	ThemeEraseProcPtr = procedure( const (*var*) bounds: Rect; eraseData: UInt32; depth: SInt16; isColorDev: Boolean );
+type
+	ThemeButtonDrawProcPtr = procedure( const (*var*) bounds: Rect; kind: ThemeButtonKind; const (*var*) info: ThemeButtonDrawInfo; userData: UInt32; depth: SInt16; isColorDev: Boolean );
+type
+	WindowTitleDrawingProcPtr = procedure( const (*var*) bounds: Rect; depth: SInt16; colorDevice: Boolean; userData: UInt32 );
+type
+	ThemeIteratorProcPtr = function( const (*var*) inFileName: Str255; resID: SInt16; inThemeSettings: Collection; inUserData: UnivPtr ): Boolean;
+type
+	ThemeTabTitleDrawUPP = ThemeTabTitleDrawProcPtr;
+type
+	ThemeEraseUPP = ThemeEraseProcPtr;
+type
+	ThemeButtonDrawUPP = ThemeButtonDrawProcPtr;
+type
+	WindowTitleDrawingUPP = WindowTitleDrawingProcPtr;
+type
+	ThemeIteratorUPP = ThemeIteratorProcPtr;
+{
+ *  NewThemeTabTitleDrawUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewThemeTabTitleDrawUPP( userRoutine: ThemeTabTitleDrawProcPtr ): ThemeTabTitleDrawUPP; external name '_NewThemeTabTitleDrawUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  NewThemeEraseUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewThemeEraseUPP( userRoutine: ThemeEraseProcPtr ): ThemeEraseUPP; external name '_NewThemeEraseUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  NewThemeButtonDrawUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewThemeButtonDrawUPP( userRoutine: ThemeButtonDrawProcPtr ): ThemeButtonDrawUPP; external name '_NewThemeButtonDrawUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  NewWindowTitleDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewWindowTitleDrawingUPP( userRoutine: WindowTitleDrawingProcPtr ): WindowTitleDrawingUPP; external name '_NewWindowTitleDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  NewThemeIteratorUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewThemeIteratorUPP( userRoutine: ThemeIteratorProcPtr ): ThemeIteratorUPP; external name '_NewThemeIteratorUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeThemeTabTitleDrawUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeThemeTabTitleDrawUPP( userUPP: ThemeTabTitleDrawUPP ); external name '_DisposeThemeTabTitleDrawUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeThemeEraseUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeThemeEraseUPP( userUPP: ThemeEraseUPP ); external name '_DisposeThemeEraseUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeThemeButtonDrawUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeThemeButtonDrawUPP( userUPP: ThemeButtonDrawUPP ); external name '_DisposeThemeButtonDrawUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeWindowTitleDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeWindowTitleDrawingUPP( userUPP: WindowTitleDrawingUPP ); external name '_DisposeWindowTitleDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeThemeIteratorUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeThemeIteratorUPP( userUPP: ThemeIteratorUPP ); external name '_DisposeThemeIteratorUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeThemeTabTitleDrawUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure InvokeThemeTabTitleDrawUPP( const (*var*) bounds: Rect; style: ThemeTabStyle; direction: ThemeTabDirection; depth: SInt16; isColorDev: Boolean; userData: UInt32; userUPP: ThemeTabTitleDrawUPP ); external name '_InvokeThemeTabTitleDrawUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeThemeEraseUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure InvokeThemeEraseUPP( const (*var*) bounds: Rect; eraseData: UInt32; depth: SInt16; isColorDev: Boolean; userUPP: ThemeEraseUPP ); external name '_InvokeThemeEraseUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeThemeButtonDrawUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure InvokeThemeButtonDrawUPP( const (*var*) bounds: Rect; kind: ThemeButtonKind; const (*var*) info: ThemeButtonDrawInfo; userData: UInt32; depth: SInt16; isColorDev: Boolean; userUPP: ThemeButtonDrawUPP ); external name '_InvokeThemeButtonDrawUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeWindowTitleDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure InvokeWindowTitleDrawingUPP( const (*var*) bounds: Rect; depth: SInt16; colorDevice: Boolean; userData: UInt32; userUPP: WindowTitleDrawingUPP ); external name '_InvokeWindowTitleDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeThemeIteratorUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function InvokeThemeIteratorUPP( const (*var*) inFileName: Str255; resID: SInt16; inThemeSettings: Collection; inUserData: UnivPtr; userUPP: ThemeIteratorUPP ): Boolean; external name '_InvokeThemeIteratorUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Menu Drawing callbacks                                                           }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+type
+	MenuTitleDrawingProcPtr = procedure( const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: Boolean; inUserData: SInt32 );
+type
+	MenuItemDrawingProcPtr = procedure( const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: Boolean; inUserData: SInt32 );
+type
+	MenuTitleDrawingUPP = MenuTitleDrawingProcPtr;
+type
+	MenuItemDrawingUPP = MenuItemDrawingProcPtr;
+{
+ *  NewMenuTitleDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewMenuTitleDrawingUPP( userRoutine: MenuTitleDrawingProcPtr ): MenuTitleDrawingUPP; external name '_NewMenuTitleDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  NewMenuItemDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+function NewMenuItemDrawingUPP( userRoutine: MenuItemDrawingProcPtr ): MenuItemDrawingUPP; external name '_NewMenuItemDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeMenuTitleDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeMenuTitleDrawingUPP( userUPP: MenuTitleDrawingUPP ); external name '_DisposeMenuTitleDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  DisposeMenuItemDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure DisposeMenuItemDrawingUPP( userUPP: MenuItemDrawingUPP ); external name '_DisposeMenuItemDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeMenuTitleDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure InvokeMenuTitleDrawingUPP( const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: Boolean; inUserData: SInt32; userUPP: MenuTitleDrawingUPP ); external name '_InvokeMenuTitleDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{
+ *  InvokeMenuItemDrawingUPP()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   available as macro/inline
+ }
+procedure InvokeMenuItemDrawingUPP( const (*var*) inBounds: Rect; inDepth: SInt16; inIsColorDevice: Boolean; inUserData: SInt32; userUPP: MenuItemDrawingUPP ); external name '_InvokeMenuItemDrawingUPP';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{  Appearance Manager APIs                                                         }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Registering Appearance-Savvy Applications }
+{
+ *  RegisterAppearanceClient()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function RegisterAppearanceClient: OSStatus; external name '_RegisterAppearanceClient';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  UnregisterAppearanceClient()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function UnregisterAppearanceClient: OSStatus; external name '_UnregisterAppearanceClient';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  IsAppearanceClient()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function IsAppearanceClient( const (*var*) process: ProcessSerialNumber ): Boolean; external name '_IsAppearanceClient';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{****************************************************************************
+    NOTES ON THEME BRUSHES
+    Theme brushes can be either colors or patterns, depending on the theme.
+    Because of this, you should be prepared to handle the case where a brush
+    is a pattern and save and restore the pnPixPat and bkPixPat fields of
+    your GrafPorts when saving the fore and back colors. Also, since patterns
+    in bkPixPat override the background color of the window, you should use
+    BackPat to set your background pattern to a normal white pattern. This
+    will ensure that you can use RGBBackColor to set your back color to white,
+    call EraseRect and get the expected results.
+****************************************************************************}
+
+{
+ *  SetThemePen()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function SetThemePen( inBrush: ThemeBrush; inDepth: SInt16; inIsColorDevice: Boolean ): OSStatus; external name '_SetThemePen';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetThemeBackground()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function SetThemeBackground( inBrush: ThemeBrush; inDepth: SInt16; inIsColorDevice: Boolean ): OSStatus; external name '_SetThemeBackground';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetThemeTextColor()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function SetThemeTextColor( inColor: ThemeTextColor; inDepth: SInt16; inIsColorDevice: Boolean ): OSStatus; external name '_SetThemeTextColor';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetThemeWindowBackground() has moved to MacWindows.h
+ }
+{ Window Placards, Headers and Frames }
+{
+ *  DrawThemeWindowHeader()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeWindowHeader( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeWindowHeader';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeWindowListViewHeader()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeWindowListViewHeader( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeWindowListViewHeader';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemePlacard()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemePlacard( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemePlacard';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeEditTextFrame()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeEditTextFrame( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeEditTextFrame';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeListBoxFrame()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeListBoxFrame( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeListBoxFrame';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ Keyboard Focus Drawing }
+{
+ *  DrawThemeFocusRect()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeFocusRect( const (*var*) inRect: Rect; inHasFocus: Boolean ): OSStatus; external name '_DrawThemeFocusRect';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ Dialog Group Boxes and Separators }
+{
+ *  DrawThemePrimaryGroup()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemePrimaryGroup( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemePrimaryGroup';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeSecondaryGroup()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeSecondaryGroup( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeSecondaryGroup';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeSeparator()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeSeparator( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeSeparator';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BEGIN APPEARANCE 1.0.1 ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ The following Appearance Manager APIs are only available }
+{ in Appearance 1.0.1 or later                             }
+{
+ *  DrawThemeModelessDialogFrame()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeModelessDialogFrame( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeModelessDialogFrame';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeGenericWell()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeGenericWell( const (*var*) inRect: Rect; inState: ThemeDrawState; inFillCenter: Boolean ): OSStatus; external name '_DrawThemeGenericWell';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeFocusRegion()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeFocusRegion( inRegion: RgnHandle; inHasFocus: Boolean ): OSStatus; external name '_DrawThemeFocusRegion';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  IsThemeInColor()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function IsThemeInColor( inDepth: SInt16; inIsColorDevice: Boolean ): Boolean; external name '_IsThemeInColor';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ IMPORTANT: GetThemeAccentColors will only work in the platinum theme. Any other theme will }
+{ most likely return an error }
+{
+ *  GetThemeAccentColors()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function GetThemeAccentColors( var outColors: CTabHandle ): OSStatus; external name '_GetThemeAccentColors';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeMenuBarBackground()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeMenuBarBackground( const (*var*) inBounds: Rect; inState: ThemeMenuBarState; inAttributes: UInt32 ): OSStatus; external name '_DrawThemeMenuBarBackground';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeMenuTitle()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeMenuTitle( const (*var*) inMenuBarRect: Rect; const (*var*) inTitleRect: Rect; inState: ThemeMenuState; inAttributes: UInt32; inTitleProc: MenuTitleDrawingUPP { can be NULL }; inTitleData: UInt32 ): OSStatus; external name '_DrawThemeMenuTitle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeMenuBarHeight()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function GetThemeMenuBarHeight( var outHeight: SInt16 ): OSStatus; external name '_GetThemeMenuBarHeight';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeMenuBackground()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeMenuBackground( const (*var*) inMenuRect: Rect; inMenuType: ThemeMenuType ): OSStatus; external name '_DrawThemeMenuBackground';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeMenuBackgroundRegion()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function GetThemeMenuBackgroundRegion( const (*var*) inMenuRect: Rect; menuType: ThemeMenuType; region: RgnHandle ): OSStatus; external name '_GetThemeMenuBackgroundRegion';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeMenuItem()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeMenuItem( const (*var*) inMenuRect: Rect; const (*var*) inItemRect: Rect; inVirtualMenuTop: SInt16; inVirtualMenuBottom: SInt16; inState: ThemeMenuState; inItemType: ThemeMenuItemType; inDrawProc: MenuItemDrawingUPP { can be NULL }; inUserData: UInt32 ): OSStatus; external name '_DrawThemeMenuItem';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeMenuSeparator()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function DrawThemeMenuSeparator( const (*var*) inItemRect: Rect ): OSStatus; external name '_DrawThemeMenuSeparator';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeMenuSeparatorHeight()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function GetThemeMenuSeparatorHeight( var outHeight: SInt16 ): OSStatus; external name '_GetThemeMenuSeparatorHeight';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeMenuItemExtra()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function GetThemeMenuItemExtra( inItemType: ThemeMenuItemType; var outHeight: SInt16; var outWidth: SInt16 ): OSStatus; external name '_GetThemeMenuItemExtra';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeMenuTitleExtra()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.0 and later
+ }
+function GetThemeMenuTitleExtra( var outWidth: SInt16; inIsSquished: Boolean ): OSStatus; external name '_GetThemeMenuTitleExtra';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BEGIN APPEARANCE 1.1 ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ THEME SWITCHING ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{  X ALERT: Please note that Get/SetTheme are severely neutered under Mac OS X at present.         }
+{           See the note above regarding what collection tags are supported under X.               }
+
+{
+ *  GetTheme()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetTheme( ioCollection: Collection ): OSStatus; external name '_GetTheme';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetTheme()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function SetTheme( ioCollection: Collection ): OSStatus; external name '_SetTheme';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  IterateThemes()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function IterateThemes( inProc: ThemeIteratorUPP; inUserData: UnivPtr { can be NULL } ): OSStatus; external name '_IterateThemes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ TABS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  DrawThemeTabPane()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeTabPane( const (*var*) inRect: Rect; inState: ThemeDrawState ): OSStatus; external name '_DrawThemeTabPane';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeTab()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeTab( const (*var*) inRect: Rect; inStyle: ThemeTabStyle; inDirection: ThemeTabDirection; labelProc: ThemeTabTitleDrawUPP { can be NULL }; userData: UInt32 ): OSStatus; external name '_DrawThemeTab';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTabRegion()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTabRegion( const (*var*) inRect: Rect; inStyle: ThemeTabStyle; inDirection: ThemeTabDirection; ioRgn: RgnHandle ): OSStatus; external name '_GetThemeTabRegion';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ CURSORS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  SetThemeCursor()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function SetThemeCursor( inCursor: ThemeCursor ): OSStatus; external name '_SetThemeCursor';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetAnimatedThemeCursor()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function SetAnimatedThemeCursor( inCursor: ThemeCursor; inAnimationStep: UInt32 ): OSStatus; external name '_SetAnimatedThemeCursor';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ CONTROL STYLE SETTINGS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  GetThemeScrollBarThumbStyle()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeScrollBarThumbStyle( var outStyle: ThemeScrollBarThumbStyle ): OSStatus; external name '_GetThemeScrollBarThumbStyle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeScrollBarArrowStyle()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeScrollBarArrowStyle( var outStyle: ThemeScrollBarArrowStyle ): OSStatus; external name '_GetThemeScrollBarArrowStyle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeCheckBoxStyle()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeCheckBoxStyle( var outStyle: ThemeCheckBoxStyle ): OSStatus; external name '_GetThemeCheckBoxStyle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ FONTS/TEXT ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  UseThemeFont()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function UseThemeFont( inFontID: ThemeFontID; inScript: ScriptCode ): OSStatus; external name '_UseThemeFont';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeFont()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeFont( inFontID: ThemeFontID; inScript: ScriptCode; outFontName: StringPtr { can be NULL }; var outFontSize: SInt16; var outStyle: Style ): OSStatus; external name '_GetThemeFont';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeTextBox()
+ *  
+ *  Summary:
+ *    Draws text into the area you specify.
+ *  
+ *  Discussion:
+ *    DrawThemeTextBox allows you to draw theme-savvy (ie. Aqua-savvy
+ *    on Mac OS X) text. It is unicode savvy (although only partially
+ *    so under CarbonLib), and allows you to customize certain text
+ *    rendering characteristics such as the font, wrapping behavior,
+ *    and justification. The text is drawn into the CGContextRef you
+ *    provide, or into the current Quickdraw port if no CGContextRef is
+ *    provided. None of DrawThemeTextBox's parameters imply a color, so
+ *    you must set up the desired text color separately before calling
+ *    DrawThemeTextBox. If you provide a CGContextRef, its fill color
+ *    will be used to draw the text. If you do not provide a
+ *    CGContextRef, a color based on the current Quickdraw port's
+ *    foreground color and the grayishTextOr mode (if set) will be used
+ *    to draw the text.
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Parameters:
+ *    
+ *    inString:
+ *      A CFStringRef containing the unicode characters you wish to
+ *      render. You MUST NOT pass in a CFStringRef that was allocated
+ *      with any of the "NoCopy" CFString creation APIs; a string
+ *      created with a "NoCopy" API has transient storage which is
+ *      incompatible with DrawThemeTextBox's caches.
+ *    
+ *    inFontID:
+ *      The ThemeFontID describing the font you'd like to render the
+ *      text with. See the discussion of ThemeFontIDs elsewhere in this
+ *      header.
+ *    
+ *    inState:
+ *      The ThemeDrawState describing the the state of the interface
+ *      element you are drawing the text for. If, for example, you are
+ *      drawing text for an inactive window, you would pass
+ *      kThemeStateInactive. The ThemeDrawState is generally only used
+ *      to determine the shadow characteristics for the text on Mac OS
+ *      X. Note that the ThemeDrawState does NOT imply a color. It is
+ *      NOT used as a mechanism for graying the text. If you wish to
+ *      draw grayed text, you must set up the desired gray color and
+ *      apply it to either the current Quickdraw port or the
+ *      CGContextRef as appropriate.
+ *    
+ *    inWrapToWidth:
+ *      A Boolean indicating whether you want to draw multiple lines of
+ *      text wrapped to a bounding box. False indicates that only one
+ *      line of text should be drawn without any sort of wrapping.
+ *    
+ *    inBoundingBox:
+ *      The rectangle (in coordinates relative to the current Quickdraw
+ *      port) describing the area to draw the text within. The first
+ *      line of text will be top-justified to this rectangle. Wrapping
+ *      (if desired) will happen at the horizontal extent of this
+ *      rectangle. Regardless of the amount of text in your
+ *      CFStringRef, all drawn text will be clipped to this rectangle.
+ *    
+ *    inJust:
+ *      The horizontal justification you would like for your text. You
+ *      can use one of the standard justification constants from
+ *      TextEdit.h.
+ *    
+ *    inContext:
+ *      The CGContextRef into which you would like to draw the text. On
+ *      Mac OS X, all text drawing happens in CGContextRefs; if you
+ *      pass NULL, a transient CGContextRef will be allocated and
+ *      deallocated for use within the single API call. Relying on the
+ *      system behavior if transiently creating CGContextRefs may
+ *      result in performance problems. On Mac OS 9, the CGContextRef
+ *      parameter is ignored.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.3 and later
+ *    Non-Carbon CFM:   not available
+ }
+function DrawThemeTextBox( inString: CFStringRef; inFontID: ThemeFontID; inState: ThemeDrawState; inWrapToWidth: Boolean; const (*var*) inBoundingBox: Rect; inJust: SInt16; inContext: UnivPtr ): OSStatus; external name '_DrawThemeTextBox';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  TruncateThemeText()
+ *  
+ *  Summary:
+ *    Truncates text to fit within the width you specify.
+ *  
+ *  Discussion:
+ *    TruncateThemeText alters a unicode string to fit within a width
+ *    that you specify. It is unicode savvy (although only partially so
+ *    under CarbonLib), and makes its calculations (and any subsequent
+ *    string alteration) based on the font and state you specify. If
+ *    the string needs to be truncated, it will be reduced to the
+ *    maximum number of characters which (with the addition of an
+ *    ellipsis character) fits within the specified width.
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Parameters:
+ *    
+ *    inString:
+ *      A CFMutableStringRef containing the unicode characters you wish
+ *      to truncate. On output, inString may have been altered to fit
+ *      within the specified width. You MUST NOT pass in a CFStringRef
+ *      that was allocated with any of the "NoCopy" CFString creation
+ *      APIs (see note in DrawThemeTextBox above).
+ *    
+ *    inFontID:
+ *      The ThemeFontID to use for text measurements. See the
+ *      discussion of ThemeFontIDs elsewhere in this header.
+ *    
+ *    inState:
+ *      The ThemeDrawState which matches the state you will ultimately
+ *      render the string width. This may affect text measurement
+ *      during truncation, so you should be sure the value you pass to
+ *      TruncateThemeText matches the value you will eventually use for
+ *      drawing.
+ *    
+ *    inPixelWidthLimit:
+ *      The maximum width (in pixels) that the resulting truncated
+ *      string may have.
+ *    
+ *    inTruncWhere:
+ *      A TruncCode indicating where you would like truncation to occur.
+ *    
+ *    outTruncated:
+ *      On output, this Boolean value indicates whether the string was
+ *      truncated. True means the string was truncated. False means the
+ *      string was not (and did not need to be) truncated.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.3 and later
+ *    Non-Carbon CFM:   not available
+ }
+function TruncateThemeText( inString: CFMutableStringRef; inFontID: ThemeFontID; inState: ThemeDrawState; inPixelWidthLimit: SInt16; inTruncWhere: TruncCode; outTruncated: BooleanPtr { can be NULL } ): OSStatus; external name '_TruncateThemeText';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTextDimensions()
+ *  
+ *  Summary:
+ *    Tells you the height, width, and baseline for a string.
+ *  
+ *  Discussion:
+ *    GetThemeTextDimensions measures the given string using a font and
+ *    state you specify. It always reports the actual height and
+ *    baseline. It sometimes reports the actual width (see below). It
+ *    can measure a string that wraps. It is unicode savvy (although
+ *    only partially so under CarbonLib).
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Parameters:
+ *    
+ *    inString:
+ *      A CFStringRef containing the unicode characters you wish to
+ *      measure. You MUST NOT pass in a CFStringRef that was allocated
+ *      with any of the "NoCopy" CFString creation APIs (see note in
+ *      DrawThemeTextBox above).
+ *    
+ *    inFontID:
+ *      The ThemeFontID describing the font you'd like to measure the
+ *      text with. See the discussion of ThemeFontIDs elsewhere in this
+ *      header.
+ *    
+ *    inState:
+ *      The ThemeDrawState which matches the state you will ultimately
+ *      render the string width. This may affect text measurement, so
+ *      you should be sure the value you pass to TruncateThemeText
+ *      matches the value you will eventually use for drawing.
+ *    
+ *    inWrapToWidth:
+ *      A Boolean indicating whether you want the measurements based on
+ *      wrapping the text to a specific width. If you pass true, you
+ *      must specify the desired width in ioBounds->h.
+ *    
+ *    ioBounds:
+ *      On output, ioBounds->v contains the height of the text. If you
+ *      pass false to inWrapToWidth, ioBounds->h will contain the width
+ *      of the text on output. If you pass true to inWrapToWidth,
+ *      ioBounds->h must (on input) contain the desired width for
+ *      wrapping; on output, ioBounds->h contains the same value you
+ *      specified on input.
+ *    
+ *    outBaseline:
+ *      On output, outBaseline contains the offset (in Quickdraw space)
+ *      from the bottom edge of the last line of text to the baseline
+ *      of the first line of text. outBaseline will generally be a
+ *      negative value. On Mac OS X 10.2 and later, you may pass NULL
+ *      if you don't want this information.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.3 and later
+ *    Non-Carbon CFM:   not available
+ }
+function GetThemeTextDimensions( inString: CFStringRef; inFontID: ThemeFontID; inState: ThemeDrawState; inWrapToWidth: Boolean; var ioBounds: Point; outBaseline: SInt16Ptr { can be NULL } ): OSStatus; external name '_GetThemeTextDimensions';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTextShadowOutset()
+ *  
+ *  Summary:
+ *    Tells you the amount of space taken up by the shadow for a given
+ *    font/state combination.
+ *  
+ *  Discussion:
+ *    GetThemeTextShadowOutset passes back the maximum amount of space
+ *    the shadow will take up for text drawn in the specified font and
+ *    state. While GetThemeTextDimensions tells you how much space is
+ *    taken up by the character glyphs themselves, it does not
+ *    incorporate the font/state shadow into its calculations. If you
+ *    need to know how much total space including the shadow will be
+ *    taken up, call GetThemeTextDimensions followed by
+ *    GetThemeTextShadowOutset.
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Parameters:
+ *    
+ *    inFontID:
+ *      The ThemeFontID describing the font you'd like the shadow
+ *      characteristics of. Font and state both determine the amount of
+ *      shadow that will be used on rendered text. See the discussion
+ *      of ThemeFontIDs elsewhere in this header.
+ *    
+ *    inState:
+ *      The ThemeDrawState which matches the state you'd like the
+ *      shadow characteristics of. Font and state both determine the
+ *      amount of shadow that will be used on rendered text.
+ *    
+ *    outOutset:
+ *      On output, outOutset contains the amount of space the shadow
+ *      will take up beyond each edge of the text bounding rectangle
+ *      returned by GetThemeTextDimensions. The fields of outOutset
+ *      will either be positive values or zero.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.3 and later
+ *    Non-Carbon CFM:   not available
+ }
+function GetThemeTextShadowOutset( inFontID: ThemeFontID; inState: ThemeDrawState; var outOutset: Rect ): OSStatus; external name '_GetThemeTextShadowOutset';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ TRACKS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  DrawThemeTrack()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeTrack( const (*var*) drawInfo: ThemeTrackDrawInfo; rgnGhost: RgnHandle { can be NULL }; eraseProc: ThemeEraseUPP { can be NULL }; eraseData: UInt32 ): OSStatus; external name '_DrawThemeTrack';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  HitTestThemeTrack()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function HitTestThemeTrack( const (*var*) drawInfo: ThemeTrackDrawInfo; mousePoint: Point; var partHit: AppearancePartCode ): Boolean; external name '_HitTestThemeTrack';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTrackBounds()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTrackBounds( const (*var*) drawInfo: ThemeTrackDrawInfo; var bounds: Rect ): OSStatus; external name '_GetThemeTrackBounds';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTrackThumbRgn()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTrackThumbRgn( const (*var*) drawInfo: ThemeTrackDrawInfo; thumbRgn: RgnHandle ): OSStatus; external name '_GetThemeTrackThumbRgn';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTrackDragRect()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTrackDragRect( const (*var*) drawInfo: ThemeTrackDrawInfo; var dragRect: Rect ): OSStatus; external name '_GetThemeTrackDragRect';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeTrackTickMarks()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeTrackTickMarks( const (*var*) drawInfo: ThemeTrackDrawInfo; numTicks: ItemCount; eraseProc: ThemeEraseUPP { can be NULL }; eraseData: UInt32 ): OSStatus; external name '_DrawThemeTrackTickMarks';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTrackThumbPositionFromOffset()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTrackThumbPositionFromOffset( const (*var*) drawInfo: ThemeTrackDrawInfo; thumbOffset: Point; var relativePosition: SInt32 ): OSStatus; external name '_GetThemeTrackThumbPositionFromOffset';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTrackThumbPositionFromRegion()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTrackThumbPositionFromRegion( const (*var*) drawInfo: ThemeTrackDrawInfo; thumbRgn: RgnHandle; var relativePosition: SInt32 ): OSStatus; external name '_GetThemeTrackThumbPositionFromRegion';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTrackLiveValue()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTrackLiveValue( const (*var*) drawInfo: ThemeTrackDrawInfo; relativePosition: SInt32; var value: SInt32 ): OSStatus; external name '_GetThemeTrackLiveValue';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ SCROLLBAR ARROWS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  DrawThemeScrollBarArrows()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeScrollBarArrows( const (*var*) bounds: Rect; enableState: ThemeTrackEnableState; pressState: ThemeTrackPressState; isHoriz: Boolean; var trackBounds: Rect ): OSStatus; external name '_DrawThemeScrollBarArrows';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeScrollBarTrackRect()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeScrollBarTrackRect( const (*var*) bounds: Rect; enableState: ThemeTrackEnableState; pressState: ThemeTrackPressState; isHoriz: Boolean; var trackBounds: Rect ): OSStatus; external name '_GetThemeScrollBarTrackRect';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  HitTestThemeScrollBarArrows()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function HitTestThemeScrollBarArrows( const (*var*) scrollBarBounds: Rect; enableState: ThemeTrackEnableState; pressState: ThemeTrackPressState; isHoriz: Boolean; ptHit: Point; var trackBounds: Rect; var partcode: AppearancePartCode ): Boolean; external name '_HitTestThemeScrollBarArrows';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ WINDOWS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  GetThemeWindowRegion()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeWindowRegion( flavor: ThemeWindowType; const (*var*) contRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; attributes: ThemeWindowAttributes; winRegion: AppearanceRegionCode; rgn: RgnHandle ): OSStatus; external name '_GetThemeWindowRegion';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeWindowFrame()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeWindowFrame( flavor: ThemeWindowType; const (*var*) contRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; attributes: ThemeWindowAttributes; titleProc: WindowTitleDrawingUPP { can be NULL }; titleData: UInt32 ): OSStatus; external name '_DrawThemeWindowFrame';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeTitleBarWidget()
+ *  
+ *  Summary:
+ *    Draws the requested theme title bar widget.
+ *  
+ *  Discussion:
+ *    DrawThemeTitleBarWidget renders the requested theme title bar
+ *    widget in the proper location of a window.  A common
+ *    misconception when using this API is that the client must specify
+ *    the exact location of the widget in the window. The widget will
+ *    locate itself in the window based relative to the content rect
+ *    passed in content rectangle -- the contRect parameter.  Another
+ *    common problem is to ignore the window's attributes.  The
+ *    attributes must be set up properly to describe the window for
+ *    which the widget is to be drawn.
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Parameters:
+ *    
+ *    flavor:
+ *      A valid ThemeWindowtype describing the type of theme window for
+ *      which you would like to draw a widget.
+ *    
+ *    contRect:
+ *      A rectangle describing the window's content area.  The widget
+ *      is drawn relative to the content rectangle of the window, so
+ *      this parameter does not describe the actual widget bounds, it
+ *      describes the window's content rectangle.
+ *    
+ *    state:
+ *      A valid ThemeDrawState which describes the state of the window
+ *      for which the widget is to be drawn.
+ *    
+ *    metrics:
+ *      A pointer to a set of valid ThemeWindowMetrics.  At this time,
+ *      none of the fields of the metrics are pertinent to the widgets,
+ *      so the only important field is the metricSize field to mark the
+ *      structure as valid.
+ *    
+ *    attributes:
+ *      A valid ThemeWindowAttributes set which describes the window
+ *      for which the widget is to be drawn.
+ *    
+ *    widget:
+ *      A valid ThemeTitleBarWidget set which describes which widget to
+ *      draw.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeTitleBarWidget( flavor: ThemeWindowType; const (*var*) contRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; attributes: ThemeWindowAttributes; widget: ThemeTitleBarWidget ): OSStatus; external name '_DrawThemeTitleBarWidget';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeWindowRegionHit()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeWindowRegionHit( flavor: ThemeWindowType; const (*var*) inContRect: Rect; state: ThemeDrawState; const (*var*) metrics: ThemeWindowMetrics; inAttributes: ThemeWindowAttributes; inPoint: Point; var outRegionHit: AppearanceRegionCode ): Boolean; external name '_GetThemeWindowRegionHit';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeScrollBarDelimiters()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeScrollBarDelimiters( flavor: ThemeWindowType; const (*var*) inContRect: Rect; state: ThemeDrawState; attributes: ThemeWindowAttributes ): OSStatus; external name '_DrawThemeScrollBarDelimiters';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BUTTONS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  DrawThemeButton()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeButton( const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inNewInfo: ThemeButtonDrawInfo; {const} inPrevInfo: ThemeButtonDrawInfoPtr { can be NULL }; inEraseProc: ThemeEraseUPP { can be NULL }; inLabelProc: ThemeButtonDrawUPP { can be NULL }; inUserData: UInt32 ): OSStatus; external name '_DrawThemeButton';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeButtonRegion()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeButtonRegion( const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inNewInfo: ThemeButtonDrawInfo; outRegion: RgnHandle ): OSStatus; external name '_GetThemeButtonRegion';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeButtonContentBounds()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeButtonContentBounds( const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inDrawInfo: ThemeButtonDrawInfo; var outBounds: Rect ): OSStatus; external name '_GetThemeButtonContentBounds';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeButtonBackgroundBounds()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeButtonBackgroundBounds( const (*var*) inBounds: Rect; inKind: ThemeButtonKind; const (*var*) inDrawInfo: ThemeButtonDrawInfo; var outBounds: Rect ): OSStatus; external name '_GetThemeButtonBackgroundBounds';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ INTERFACE SOUNDS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{  X ALERT: Please note that the sound APIs do not work on Mac OS X at present.                    }
+{
+ *  PlayThemeSound()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function PlayThemeSound( kind: ThemeSoundKind ): OSStatus; external name '_PlayThemeSound';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  BeginThemeDragSound()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function BeginThemeDragSound( kind: ThemeDragSoundKind ): OSStatus; external name '_BeginThemeDragSound';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  EndThemeDragSound()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function EndThemeDragSound: OSStatus; external name '_EndThemeDragSound';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ PRIMITIVES ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  DrawThemeTickMark()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeTickMark( const (*var*) bounds: Rect; state: ThemeDrawState ): OSStatus; external name '_DrawThemeTickMark';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeChasingArrows()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeChasingArrows( const (*var*) bounds: Rect; index: UInt32; state: ThemeDrawState; eraseProc: ThemeEraseUPP { can be NULL }; eraseData: UInt32 ): OSStatus; external name '_DrawThemeChasingArrows';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemePopupArrow()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemePopupArrow( const (*var*) bounds: Rect; orientation: ThemeArrowOrientation; size: ThemePopupArrowSize; state: ThemeDrawState; eraseProc: ThemeEraseUPP { can be NULL }; eraseData: UInt32 ): OSStatus; external name '_DrawThemePopupArrow';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeStandaloneGrowBox()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeStandaloneGrowBox( origin: Point; growDirection: ThemeGrowDirection; isSmall: Boolean; state: ThemeDrawState ): OSStatus; external name '_DrawThemeStandaloneGrowBox';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DrawThemeStandaloneNoGrowBox()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DrawThemeStandaloneNoGrowBox( origin: Point; growDirection: ThemeGrowDirection; isSmall: Boolean; state: ThemeDrawState ): OSStatus; external name '_DrawThemeStandaloneNoGrowBox';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeStandaloneGrowBoxBounds()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeStandaloneGrowBoxBounds( origin: Point; growDirection: ThemeGrowDirection; isSmall: Boolean; var bounds: Rect ): OSStatus; external name '_GetThemeStandaloneGrowBoxBounds';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ DRAWING STATE ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ The following routines help you save and restore the drawing state in a theme-savvy manner. With }
+{ these weapons in your arsenal, there is no grafport you cannot tame. Use ThemeGetDrawingState to }
+{ get the current drawing settings for the current port. It will return an opaque object for you   }
+{ to pass into SetThemeDrawingState later on. When you are finished with the state, call the       }
+{ DisposeThemeDrawingState routine. You can alternatively pass true into the inDisposeNow          }
+{ parameter of the SetThemeDrawingState routine.  You can use this routine to copy the drawing     }
+{ state from one port to another as well.                                                          }
+{ As of this writing (Mac OS 9.1 and Mac OS X), Get/SetThemeDrawingState will save and restore     }
+{ this data in the port:                                                                           }
+{      pen size                                                                                    }
+{      pen location                                                                                }
+{      pen mode                                                                                    }
+{      pen Pattern and PixPat                                                                      }
+{      background Pattern and PixPat                                                               }
+{      RGB foreground and background colors                                                        }
+{      text mode                                                                                   }
+{      pattern origin                                                                              }
+{ Get/SetThemeDrawingState may save and restore additional port state in the future, but you can   }
+{ rely on them to always save at least this port state.                                            }
+{
+ *  NormalizeThemeDrawingState()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function NormalizeThemeDrawingState: OSStatus; external name '_NormalizeThemeDrawingState';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeDrawingState()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeDrawingState( var outState: ThemeDrawingState ): OSStatus; external name '_GetThemeDrawingState';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetThemeDrawingState()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function SetThemeDrawingState( inState: ThemeDrawingState; inDisposeNow: Boolean ): OSStatus; external name '_SetThemeDrawingState';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  DisposeThemeDrawingState()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function DisposeThemeDrawingState( inState: ThemeDrawingState ): OSStatus; external name '_DisposeThemeDrawingState';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ MISCELLANEOUS ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ ApplyThemeBackground is used to set up the background for embedded controls  }
+{ It is normally called by controls that are embedders. The standard controls  }
+{ call this API to ensure a correct background for the current theme. You pass }
+{ in the same rectangle you would if you were calling the drawing primitive.   }
+{
+ *  ApplyThemeBackground()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function ApplyThemeBackground( inKind: ThemeBackgroundKind; const (*var*) bounds: Rect; inState: ThemeDrawState; inDepth: SInt16; inColorDev: Boolean ): OSStatus; external name '_ApplyThemeBackground';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  SetThemeTextColorForWindow() has moved to MacWindows.h
+ }
+{
+ *  IsValidAppearanceFileType()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function IsValidAppearanceFileType( fileType: OSType ): Boolean; external name '_IsValidAppearanceFileType';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeBrushAsColor()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeBrushAsColor( inBrush: ThemeBrush; inDepth: SInt16; inColorDev: Boolean; var outColor: RGBColor ): OSStatus; external name '_GetThemeBrushAsColor';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  GetThemeTextColor()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   in AppearanceLib 1.1 and later
+ }
+function GetThemeTextColor( inColor: ThemeTextColor; inDepth: SInt16; inColorDev: Boolean; var outColor: RGBColor ): OSStatus; external name '_GetThemeTextColor';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ BEGIN CARBON ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{
+ *  GetThemeMetric()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.0 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Non-Carbon CFM:   not available
+ }
+function GetThemeMetric( inMetric: ThemeMetric; var outMetric: SInt32 ): OSStatus; external name '_GetThemeMetric';
+(* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
+
+
+{
+ *  CopyThemeIdentifier()
+ *  
+ *  Mac OS X threading:
+ *    Not thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in Carbon.framework
+ *    CarbonLib:        in CarbonLib 1.4 and later
+ *    Non-Carbon CFM:   not available
+ }
+function CopyThemeIdentifier( var outIdentifier: CFStringRef ): OSStatus; external name '_CopyThemeIdentifier';
+(* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
+
+
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Obsolete symbolic names                                                                          }
+{ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
+{ Obsolete error codes - use the new ones, s'il vous plait / kudasai }
+const
+	appearanceBadBrushIndexErr = themeInvalidBrushErr; { pattern index invalid }
+	appearanceProcessRegisteredErr = themeProcessRegisteredErr;
+	appearanceProcessNotRegisteredErr = themeProcessNotRegisteredErr;
+	appearanceBadTextColorIndexErr = themeBadTextColorErr;
+	appearanceThemeHasNoAccents = themeHasNoAccentsErr;
+	appearanceBadCursorIndexErr = themeBadCursorIndexErr;
+
+const
+	kThemeActiveDialogBackgroundBrush = kThemeBrushDialogBackgroundActive;
+	kThemeInactiveDialogBackgroundBrush = kThemeBrushDialogBackgroundInactive;
+	kThemeActiveAlertBackgroundBrush = kThemeBrushAlertBackgroundActive;
+	kThemeInactiveAlertBackgroundBrush = kThemeBrushAlertBackgroundInactive;
+	kThemeActiveModelessDialogBackgroundBrush = kThemeBrushModelessDialogBackgroundActive;
+	kThemeInactiveModelessDialogBackgroundBrush = kThemeBrushModelessDialogBackgroundInactive;
+	kThemeActiveUtilityWindowBackgroundBrush = kThemeBrushUtilityWindowBackgroundActive;
+	kThemeInactiveUtilityWindowBackgroundBrush = kThemeBrushUtilityWindowBackgroundInactive;
+	kThemeListViewSortColumnBackgroundBrush = kThemeBrushListViewSortColumnBackground;
+	kThemeListViewBackgroundBrush = kThemeBrushListViewBackground;
+	kThemeIconLabelBackgroundBrush = kThemeBrushIconLabelBackground;
+	kThemeListViewSeparatorBrush = kThemeBrushListViewSeparator;
+	kThemeChasingArrowsBrush = kThemeBrushChasingArrows;
+	kThemeDragHiliteBrush = kThemeBrushDragHilite;
+	kThemeDocumentWindowBackgroundBrush = kThemeBrushDocumentWindowBackground;
+	kThemeFinderWindowBackgroundBrush = kThemeBrushFinderWindowBackground;
+
+const
+	kThemeActiveScrollBarDelimiterBrush = kThemeBrushScrollBarDelimiterActive;
+	kThemeInactiveScrollBarDelimiterBrush = kThemeBrushScrollBarDelimiterInactive;
+	kThemeFocusHighlightBrush = kThemeBrushFocusHighlight;
+	kThemeActivePopupArrowBrush = kThemeBrushPopupArrowActive;
+	kThemePressedPopupArrowBrush = kThemeBrushPopupArrowPressed;
+	kThemeInactivePopupArrowBrush = kThemeBrushPopupArrowInactive;
+	kThemeAppleGuideCoachmarkBrush = kThemeBrushAppleGuideCoachmark;
+
+const
+	kThemeActiveDialogTextColor = kThemeTextColorDialogActive;
+	kThemeInactiveDialogTextColor = kThemeTextColorDialogInactive;
+	kThemeActiveAlertTextColor = kThemeTextColorAlertActive;
+	kThemeInactiveAlertTextColor = kThemeTextColorAlertInactive;
+	kThemeActiveModelessDialogTextColor = kThemeTextColorModelessDialogActive;
+	kThemeInactiveModelessDialogTextColor = kThemeTextColorModelessDialogInactive;
+	kThemeActiveWindowHeaderTextColor = kThemeTextColorWindowHeaderActive;
+	kThemeInactiveWindowHeaderTextColor = kThemeTextColorWindowHeaderInactive;
+	kThemeActivePlacardTextColor = kThemeTextColorPlacardActive;
+	kThemeInactivePlacardTextColor = kThemeTextColorPlacardInactive;
+	kThemePressedPlacardTextColor = kThemeTextColorPlacardPressed;
+	kThemeActivePushButtonTextColor = kThemeTextColorPushButtonActive;
+	kThemeInactivePushButtonTextColor = kThemeTextColorPushButtonInactive;
+	kThemePressedPushButtonTextColor = kThemeTextColorPushButtonPressed;
+	kThemeActiveBevelButtonTextColor = kThemeTextColorBevelButtonActive;
+	kThemeInactiveBevelButtonTextColor = kThemeTextColorBevelButtonInactive;
+	kThemePressedBevelButtonTextColor = kThemeTextColorBevelButtonPressed;
+	kThemeActivePopupButtonTextColor = kThemeTextColorPopupButtonActive;
+	kThemeInactivePopupButtonTextColor = kThemeTextColorPopupButtonInactive;
+	kThemePressedPopupButtonTextColor = kThemeTextColorPopupButtonPressed;
+	kThemeIconLabelTextColor = kThemeTextColorIconLabel;
+	kThemeListViewTextColor = kThemeTextColorListView;
+
+const
+	kThemeActiveDocumentWindowTitleTextColor = kThemeTextColorDocumentWindowTitleActive;
+	kThemeInactiveDocumentWindowTitleTextColor = kThemeTextColorDocumentWindowTitleInactive;
+	kThemeActiveMovableModalWindowTitleTextColor = kThemeTextColorMovableModalWindowTitleActive;
+	kThemeInactiveMovableModalWindowTitleTextColor = kThemeTextColorMovableModalWindowTitleInactive;
+	kThemeActiveUtilityWindowTitleTextColor = kThemeTextColorUtilityWindowTitleActive;
+	kThemeInactiveUtilityWindowTitleTextColor = kThemeTextColorUtilityWindowTitleInactive;
+	kThemeActivePopupWindowTitleColor = kThemeTextColorPopupWindowTitleActive;
+	kThemeInactivePopupWindowTitleColor = kThemeTextColorPopupWindowTitleInactive;
+	kThemeActiveRootMenuTextColor = kThemeTextColorRootMenuActive;
+	kThemeSelectedRootMenuTextColor = kThemeTextColorRootMenuSelected;
+	kThemeDisabledRootMenuTextColor = kThemeTextColorRootMenuDisabled;
+	kThemeActiveMenuItemTextColor = kThemeTextColorMenuItemActive;
+	kThemeSelectedMenuItemTextColor = kThemeTextColorMenuItemSelected;
+	kThemeDisabledMenuItemTextColor = kThemeTextColorMenuItemDisabled;
+	kThemeActivePopupLabelTextColor = kThemeTextColorPopupLabelActive;
+	kThemeInactivePopupLabelTextColor = kThemeTextColorPopupLabelInactive;
+
+const
+	kAEThemeSwitch = kAEAppearanceChanged; { Event ID's: Theme Switched }
+
+const
+	kThemeNoAdornment = kThemeAdornmentNone;
+	kThemeDefaultAdornment = kThemeAdornmentDefault;
+	kThemeFocusAdornment = kThemeAdornmentFocus;
+	kThemeRightToLeftAdornment = kThemeAdornmentRightToLeft;
+	kThemeDrawIndicatorOnly = kThemeAdornmentDrawIndicatorOnly;
+
+const
+	kThemeBrushPassiveAreaFill = kThemeBrushStaticAreaFill;
+
+const
+	kThemeMetricCheckBoxGlyphHeight = kThemeMetricCheckBoxHeight;
+	kThemeMetricRadioButtonGlyphHeight = kThemeMetricRadioButtonHeight;
+	kThemeMetricDisclosureButtonSize = kThemeMetricDisclosureButtonHeight;
+	kThemeMetricBestListHeaderHeight = kThemeMetricListHeaderHeight;
+	kThemeMetricSmallProgressBarThickness = kThemeMetricNormalProgressBarThickness; { obsolete }
+	kThemeMetricProgressBarThickness = kThemeMetricLargeProgressBarThickness; { obsolete }
+
+const
+	kThemeScrollBar = kThemeMediumScrollBar;
+	kThemeSlider = kThemeMediumSlider;
+	kThemeProgressBar = kThemeMediumProgressBar;
+	kThemeIndeterminateBar = kThemeMediumIndeterminateBar;
+
+
+
+
+end.

+ 216 - 0
packages/extra/univint/AppleDiskPartitions.pas

@@ -0,0 +1,216 @@
+{
+     File:       AppleDiskPartitions.p
+ 
+     Contains:   The Apple disk partition scheme as defined in Inside Macintosh: Volume V.
+ 
+     Version:    Technology: Mac OS 9
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 2000-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AppleDiskPartitions;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+
+
+{$ALIGN MAC68K}
+
+{ Block 0 Definitions }
+
+const
+	sbSIGWord					= $4552;						{  signature word for Block 0 ('ER')  }
+	sbMac						= 1;							{  system type for Mac  }
+
+	{	 Partition Map Signatures 	}
+	pMapSIG						= $504D;						{  partition map signature ('PM')  }
+	pdSigWord					= $5453;						{  partition map signature ('TS')  }
+	oldPMSigWord				= $5453;
+	newPMSigWord				= $504D;
+
+
+	{	 Driver Descriptor Map 	}
+
+type
+	Block0Ptr = ^Block0;
+	Block0 = packed record
+		sbSig:					UInt16;									{  unique value for SCSI block 0  }
+		sbBlkSize:				UInt16;									{  block size of device  }
+		sbBlkCount:				UInt32;									{  number of blocks on device  }
+		sbDevType:				UInt16;									{  device type  }
+		sbDevId:				UInt16;									{  device id  }
+		sbData:					UInt32;									{  not used  }
+		sbDrvrCount:			UInt16;									{  driver descriptor count  }
+		ddBlock:				UInt32;									{  1st driver's starting block  }
+		ddSize:					UInt16;									{  size of 1st driver (512-byte blks)  }
+		ddType:					UInt16;									{  system type (1 for Mac+)  }
+		ddPad:					array [0..242] of UInt16;				{  array[0..242] of SInt16; not used  }
+	end;
+
+	{	 Driver descriptor 	}
+	DDMapPtr = ^DDMap;
+	DDMap = record
+		ddBlock:				UInt32;									{  1st driver's starting block  }
+		ddSize:					UInt16;									{  size of 1st driver (512-byte blks)  }
+		ddType:					UInt16;									{  system type (1 for Mac+)  }
+	end;
+
+	{	 Constants for the ddType field of the DDMap structure. 	}
+
+const
+	kDriverTypeMacSCSI			= $0001;
+	kDriverTypeMacATA			= $0701;
+	kDriverTypeMacSCSIChained	= $FFFF;
+	kDriverTypeMacATAChained	= $F8FF;
+
+	{	 Partition Map Entry 	}
+
+type
+	PartitionPtr = ^Partition;
+	Partition = packed record
+		pmSig:					UInt16;									{  unique value for map entry blk  }
+		pmSigPad:				UInt16;									{  currently unused  }
+		pmMapBlkCnt:			UInt32;									{  # of blks in partition map  }
+		pmPyPartStart:			UInt32;									{  physical start blk of partition  }
+		pmPartBlkCnt:			UInt32;									{  # of blks in this partition  }
+		pmPartName:				packed array [0..31] of UInt8;			{  ASCII partition name  }
+		pmParType:				packed array [0..31] of UInt8;			{  ASCII partition type  }
+		pmLgDataStart:			UInt32;									{  log. # of partition's 1st data blk  }
+		pmDataCnt:				UInt32;									{  # of blks in partition's data area  }
+		pmPartStatus:			UInt32;									{  bit field for partition status  }
+		pmLgBootStart:			UInt32;									{  log. blk of partition's boot code  }
+		pmBootSize:				UInt32;									{  number of bytes in boot code  }
+		pmBootAddr:				UInt32;									{  memory load address of boot code  }
+		pmBootAddr2:			UInt32;									{  currently unused  }
+		pmBootEntry:			UInt32;									{  entry point of boot code  }
+		pmBootEntry2:			UInt32;									{  currently unused  }
+		pmBootCksum:			UInt32;									{  checksum of boot code  }
+		pmProcessor:			packed array [0..15] of UInt8;			{  ASCII for the processor type  }
+		pmPad:					array [0..187] of UInt16;				{  array[0..187] of SInt16; not used  }
+	end;
+
+
+	{	 Flags for the pmPartStatus field of the Partition data structure. 	}
+
+const
+	kPartitionAUXIsValid		= $00000001;
+	kPartitionAUXIsAllocated	= $00000002;
+	kPartitionAUXIsInUse		= $00000004;
+	kPartitionAUXIsBootValid	= $00000008;
+	kPartitionAUXIsReadable		= $00000010;
+	kPartitionAUXIsWriteable	= $00000020;
+	kPartitionAUXIsBootCodePositionIndependent = $00000040;
+	kPartitionIsWriteable		= $00000020;
+	kPartitionIsMountedAtStartup = $40000000;
+	kPartitionIsStartup			= $80000000;
+	kPartitionIsChainCompatible	= $00000100;
+	kPartitionIsRealDeviceDriver = $00000200;
+	kPartitionCanChainToNext	= $00000400;
+
+
+	{	 Well known driver signatures, stored in the first four byte of pmPad. 	}
+	kPatchDriverSignature		= $70744452 (* 'ptDR' *);						{  SCSI and ATA[PI] patch driver     }
+	kSCSIDriverSignature		= $00010600;					{  SCSI  hard disk driver            }
+	kATADriverSignature			= $77696B69 (* 'wiki' *);						{  ATA   hard disk driver            }
+	kSCSICDDriverSignature		= $43447672 (* 'CDvr' *);						{  SCSI  CD-ROM    driver            }
+	kATAPIDriverSignature		= $41545049 (* 'ATPI' *);						{  ATAPI CD-ROM    driver            }
+	kDriveSetupHFSSignature		= $44535531 (* 'DSU1' *);						{  Drive Setup HFS partition         }
+
+
+{$ALIGN MAC68K}
+
+
+end.

+ 248 - 0
packages/extra/univint/AppleEvents.pas

@@ -0,0 +1,248 @@
+{
+     File:       AppleEvents.p
+ 
+     Contains:   AppleEvent Package Interfaces.
+ 
+     Version:    Technology: System 7.5
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1989-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AppleEvents;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,MixedMode,AEDataModel,AEInteraction;
+{
+    Note:   The functions and types for the building and parsing AppleEvent  
+            messages has moved to AEDataModel.h
+}
+
+{
+    Note:   The functions for interacting with events has moved to AEInteraction.h
+}
+
+{$ALIGN MAC68K}
+
+
+const
+																{  Keywords for Apple event parameters  }
+	keyDirectObject				= $2D2D2D2D (* '----' *);
+	keyErrorNumber				= $6572726E (* 'errn' *);
+	keyErrorString				= $65727273 (* 'errs' *);
+	keyProcessSerialNumber		= $70736E20 (* 'psn ' *);						{  Keywords for special handlers  }
+	keyPreDispatch				= $70686163 (* 'phac' *);						{  preHandler accessor call  }
+	keySelectProc				= $73656C68 (* 'selh' *);						{  more selector call  }
+																{  Keyword for recording  }
+	keyAERecorderCount			= $72656372 (* 'recr' *);						{  available only in vers 1.0.1 and greater  }
+																{  Keyword for version information  }
+	keyAEVersion				= $76657273 (* 'vers' *);						{  available only in vers 1.0.1 and greater  }
+
+	{	 Event Class 	}
+	kCoreEventClass				= $61657674 (* 'aevt' *);
+
+	{	 Event IDÕs 	}
+	kAEOpenApplication			= $6F617070 (* 'oapp' *);
+	kAEOpenDocuments			= $6F646F63 (* 'odoc' *);
+	kAEPrintDocuments			= $70646F63 (* 'pdoc' *);
+	kAEQuitApplication			= $71756974 (* 'quit' *);
+	kAEAnswer					= $616E7372 (* 'ansr' *);
+	kAEApplicationDied			= $6F626974 (* 'obit' *);
+	kAEShowPreferences			= $70726566 (* 'pref' *);						{  sent by Mac OS X when the user chooses the Preferences item  }
+
+	{	 Constants for recording 	}
+	kAEStartRecording			= $72656361 (* 'reca' *);						{  available only in vers 1.0.1 and greater  }
+	kAEStopRecording			= $72656363 (* 'recc' *);						{  available only in vers 1.0.1 and greater  }
+	kAENotifyStartRecording		= $72656331 (* 'rec1' *);						{  available only in vers 1.0.1 and greater  }
+	kAENotifyStopRecording		= $72656330 (* 'rec0' *);						{  available only in vers 1.0.1 and greater  }
+	kAENotifyRecording			= $72656372 (* 'recr' *);						{  available only in vers 1.0.1 and greater  }
+
+
+	{	
+	 * AEEventSource is defined as an SInt8 for compatability with pascal.
+	 * Important note: keyEventSourceAttr is returned by AttributePtr as a typeShortInteger.
+	 * Be sure to pass at least two bytes of storage to AEGetAttributePtr - the result can be
+	 * compared directly against the following enums.
+	 	}
+
+type
+	AEEventSource 				= SInt8;
+const
+	kAEUnknownSource			= 0;
+	kAEDirectCall				= 1;
+	kAESameProcess				= 2;
+	kAELocalProcess				= 3;
+	kAERemoteProcess			= 4;
+
+	{	*************************************************************************
+	  These calls are used to set up and modify the event dispatch table.
+	*************************************************************************	}
+	{
+	 *  AEInstallEventHandler()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function AEInstallEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; handlerRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEInstallEventHandler';
+{
+ *  AERemoveEventHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AERemoveEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveEventHandler';
+{
+ *  AEGetEventHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetEventHandler(theAEEventClass: AEEventClass; theAEEventID: AEEventID; var handler: AEEventHandlerUPP; var handlerRefcon: SInt32; isSysHandler: boolean): OSErr; external name '_AEGetEventHandler';
+{*************************************************************************
+  These calls are used to set up and modify special hooks into the
+  AppleEvent manager.
+*************************************************************************}
+{
+ *  AEInstallSpecialHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEInstallSpecialHandler(functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AEInstallSpecialHandler';
+{
+ *  AERemoveSpecialHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AERemoveSpecialHandler(functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AERemoveSpecialHandler';
+{
+ *  AEGetSpecialHandler()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEGetSpecialHandler(functionClass: AEKeyword; var handler: AEEventHandlerUPP; isSysHandler: boolean): OSErr; external name '_AEGetSpecialHandler';
+{*************************************************************************
+  This call was added in version 1.0.1. If called with the keyword
+  keyAERecorderCount ('recr'), the number of recorders that are
+  currently active is returned in 'result'
+  (available only in vers 1.0.1 and greater).
+*************************************************************************}
+{
+ *  AEManagerInfo()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AEManagerInfo(keyWord: AEKeyword; var result: SInt32): OSErr; external name '_AEManagerInfo';
+{$ALIGN MAC68K}
+
+
+end.

+ 284 - 0
packages/extra/univint/AppleHelp.pas

@@ -0,0 +1,284 @@
+{
+     File:       AppleHelp.p
+ 
+     Contains:   Apple Help
+ 
+     Version:    Technology: Mac OS X/CarbonLib 1.1
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 2000-2002 by Apple Computer, Inc., all rights reserved.
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AppleHelp;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,Files,CFString;
+
+
+{$ALIGN MAC68K}
+
+{ AppleHelp Error Codes }
+
+const
+	kAHInternalErr				= -10790;
+	kAHInternetConfigPrefErr	= -10791;
+
+
+type
+	AHTOCType 					= SInt16;
+const
+	kAHTOCTypeUser				= 0;
+	kAHTOCTypeDeveloper			= 1;
+
+	{
+	 *  AHSearch()
+	 *  
+	 *  Discussion:
+	 *    Delivers a request to perform the specified search to the Help
+	 *    Viewer application.
+	 *  
+	 *  Parameters:
+	 *    
+	 *    bookname:
+	 *      Optionally, the AppleTitle of the Help book to be searched. If
+	 *      NULL, all installed Help books are searched.
+	 *    
+	 *    query:
+	 *      The query to be made. This string can, if desired, have boolean
+	 *      operators or be a natural language phrase.
+	 *  
+	 *  Result:
+	 *    An operating system result code that indicates whether the
+	 *    request was successfully sent to the Help Viewer application.
+	 *    Possible values: noErr, paramErr, kAHInternalErr,
+	 *    kAHInternetConfigPrefErr.
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   not available
+	 *    CarbonLib:        in CarbonLib 1.1 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function AHSearch(bookname: CFStringRef; query: CFStringRef): OSStatus; external name '_AHSearch';
+
+{
+ *  AHGotoMainTOC()
+ *  
+ *  Discussion:
+ *    Delivers a request to load the main table of contents of
+ *    installed help books to the Help Viewer application.
+ *  
+ *  Parameters:
+ *    
+ *    toctype:
+ *      The type of table of contents to be loaded: user or developer.
+ *  
+ *  Result:
+ *    An operating system result code that indicates whether the
+ *    request was successfully sent to the Help Viewer application.
+ *    Possible values: noErr, paramErr, kAHInternalErr,
+ *    kAHInternetConfigPrefErr.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AHGotoMainTOC(toctype: AHTOCType): OSStatus; external name '_AHGotoMainTOC';
+
+{
+ *  AHGotoPage()
+ *  
+ *  Discussion:
+ *    Delivers a request to load a specific text/html file to the Help
+ *    Viewer application.
+ *  
+ *  Parameters:
+ *    
+ *    bookname:
+ *      Optionally, the AppleTitle of an installed Help book. If NULL,
+ *      the path parameter must be a full file: URL to the file to be
+ *      opened.
+ *    
+ *    path:
+ *      Optionally, one of two types of paths: 1) a URL-style path to a
+ *      file that is relative to the main folder of the book supplied
+ *      in the bookname parameter, or 2) if bookname is NULL, a full
+ *      file: URL to the file to be opened. If this parameter is NULL,
+ *      then bookname must not be NULL, and is used to open the Help
+ *      Viewer to the main page of Help content for the specified book.
+ *    
+ *    anchor:
+ *      Optionally, the name of anchor tag to scroll to in the newly
+ *      opened file. Can be NULL.
+ *  
+ *  Result:
+ *    An operating system result code that indicates whether the
+ *    request was successfully sent to the Help Viewer application.
+ *    Possible values: noErr, paramErr, kAHInternalErr,
+ *    kAHInternetConfigPrefErr.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AHGotoPage(bookname: CFStringRef; path: CFStringRef; anchor: CFStringRef): OSStatus; external name '_AHGotoPage';
+
+{
+ *  AHLookupAnchor()
+ *  
+ *  Discussion:
+ *    Delivers a request to perform an anchor lookup to the Help Viewer
+ *    application. Note: anchor lookups will fail unless you have
+ *    indexed your help content with anchor indexing turned on in the
+ *    indexing tool's preferences panel.
+ *  
+ *  Parameters:
+ *    
+ *    bookname:
+ *      Optionally, the AppleTitle of the Help book to searched. If
+ *      NULL, the anchor lookup is performed using all installed Help
+ *      books.
+ *    
+ *    anchor:
+ *      The name of the anchor tag to look up.
+ *  
+ *  Result:
+ *    An operating system result code that indicates whether the
+ *    request was successfully sent to the Help Viewer application.
+ *    Possible values: noErr, paramErr, kAHInternalErr,
+ *    kAHInternetConfigPrefErr.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AHLookupAnchor(bookname: CFStringRef; anchor: CFStringRef): OSStatus; external name '_AHLookupAnchor';
+
+
+{
+ *  AHRegisterHelpBook()
+ *  
+ *  Discussion:
+ *    Registers a book of Help content such that the book will appear
+ *    in the current user's main table of contents (Help Center) in the
+ *    Help Viewer application. To be used when help books reside
+ *    outside of the known help folders (i.e. help books that are kept
+ *    inside of application bundles).
+ *  
+ *  Parameters:
+ *    
+ *    appBundleRef:
+ *      An FSRef pointer to the bundle within which one or more Help
+ *      books is stored. This is likely an FSRef to your application's
+ *      main bundle.
+ *  
+ *  Result:
+ *    An operating system result code that indicates whether all help
+ *    books contained within the specified bundle were registered.
+ *    Possible values: noErr, paramErr, kAHInternalErr, dirNFErr.
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   not available
+ *    CarbonLib:        in CarbonLib 1.1 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function AHRegisterHelpBook(const (*var*) appBundleRef: FSRef): OSStatus; external name '_AHRegisterHelpBook';
+
+{$ALIGN MAC68K}
+
+
+end.

+ 253 - 0
packages/extra/univint/AppleScript.pas

@@ -0,0 +1,253 @@
+{
+     File:       AppleScript.p
+ 
+     Contains:   AppleScript Specific Interfaces.
+ 
+     Version:    Technology: AppleScript 1.1
+                 Release:    Universal Interfaces 3.4.2
+ 
+     Copyright:  © 1992-2002 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AppleScript;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,AEDataModel,Components,MacErrors,AppleEvents,OSA,TextEdit;
+
+
+{$ALIGN MAC68K}
+
+{*************************************************************************
+    Types and Constants
+*************************************************************************}
+{
+    The specific type for the AppleScript instance of the
+    Open Scripting Architecture type.
+}
+
+const
+	typeAppleScript				= $61736372 (* 'ascr' *);
+	kAppleScriptSubtype			= $61736372 (* 'ascr' *);
+	typeASStorage				= $61736372 (* 'ascr' *);
+
+	{	*************************************************************************
+	    Component Selectors
+	*************************************************************************	}
+
+	kASSelectInit				= $1001;
+	kASSelectSetSourceStyles	= $1002;
+	kASSelectGetSourceStyles	= $1003;
+	kASSelectGetSourceStyleNames = $1004;
+
+
+	{	*************************************************************************
+	    OSAGetScriptInfo Selectors
+	*************************************************************************	}
+	kASHasOpenHandler			= $68736F64 (* 'hsod' *);
+
+	{	
+	        This selector is used to query a context as to whether it contains
+	        a handler for the kAEOpenDocuments event. This allows "applets" to be 
+	        distinguished from "droplets."  OSAGetScriptInfo returns false if
+	        there is no kAEOpenDocuments handler, and returns the error value 
+	        errOSAInvalidAccess if the input is not a context.
+	    	}
+	{	*************************************************************************
+	    Initialization
+	*************************************************************************	}
+	{
+	 *  ASInit()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function ASInit(scriptingComponent: ComponentInstance; modeFlags: SInt32; minStackSize: SInt32; preferredStackSize: SInt32; maxStackSize: SInt32; minHeapSize: SInt32; preferredHeapSize: SInt32; maxHeapSize: SInt32): OSAError; external name '_ASInit';
+{
+        ComponentCallNow(kASSelectInit, 28);
+        This call can be used to explicitly initialize AppleScript.  If it is
+        not called, the a scripting size resource is looked for and used. If
+        there is no scripting size resource, then the constants listed below
+        are used.  If at any stage (the init call, the size resource, the 
+        defaults) any of these parameters are zero, then parameters from the
+        next stage are used.  ModeFlags are not currently used.
+        Errors:
+        errOSASystemError       initialization failed
+    }
+{
+    These values will be used if ASInit is not called explicitly, or if any
+    of ASInit's parameters are zero:
+}
+
+const
+	kASDefaultMinStackSize		= 4096;
+	kASDefaultPreferredStackSize = 16384;
+	kASDefaultMaxStackSize		= 16384;
+	kASDefaultMinHeapSize		= 4096;
+	kASDefaultPreferredHeapSize	= 16384;
+	kASDefaultMaxHeapSize		= 33554432;
+
+	{	*************************************************************************
+	    Source Styles
+	*************************************************************************	}
+	{
+	 *  ASSetSourceStyles()
+	 *  
+	 *  Availability:
+	 *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+	 *    CarbonLib:        in CarbonLib 1.0 and later
+	 *    Mac OS X:         in version 10.0 and later
+	 	}
+function ASSetSourceStyles(scriptingComponent: ComponentInstance; sourceStyles: STHandle): OSAError; external name '_ASSetSourceStyles';
+{
+        ComponentCallNow(kASSelectSetSourceStyles, 4);
+        Errors:
+        errOSASystemError       operation failed
+    }
+{
+ *  ASGetSourceStyles()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASGetSourceStyles(scriptingComponent: ComponentInstance; var resultingSourceStyles: STHandle): OSAError; external name '_ASGetSourceStyles';
+{
+        ComponentCallNow(kASSelectGetSourceStyles, 4);
+        Errors:
+        errOSASystemError       operation failed
+    }
+{
+ *  ASGetSourceStyleNames()
+ *  
+ *  Availability:
+ *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
+ *    CarbonLib:        in CarbonLib 1.0 and later
+ *    Mac OS X:         in version 10.0 and later
+ }
+function ASGetSourceStyleNames(scriptingComponent: ComponentInstance; modeFlags: SInt32; var resultingSourceStyleNamesList: AEDescList): OSAError; external name '_ASGetSourceStyleNames';
+{
+        ComponentCallNow(kASSelectGetSourceStyleNames, 8);
+        This call returns an AEList of styled text descriptors the names of the
+        source styles in the current dialect.  The order of the names corresponds
+        to the order of the source style constants, below.  The style of each
+        name is the same as the styles returned by ASGetSourceStyles.
+        
+        Errors:
+        errOSASystemError       operation failed
+    }
+{
+    Elements of STHandle correspond to following categories of tokens, and
+    accessed through following index constants:
+}
+
+const
+	kASSourceStyleUncompiledText = 0;
+	kASSourceStyleNormalText	= 1;
+	kASSourceStyleLanguageKeyword = 2;
+	kASSourceStyleApplicationKeyword = 3;
+	kASSourceStyleComment		= 4;
+	kASSourceStyleLiteral		= 5;
+	kASSourceStyleUserSymbol	= 6;
+	kASSourceStyleObjectSpecifier = 7;
+	kASNumberOfSourceStyles		= 8;
+
+
+{$ALIGN MAC68K}
+
+
+end.

+ 265 - 0
packages/extra/univint/AuthSession.pas

@@ -0,0 +1,265 @@
+{
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All Rights Reserved.
+ * 
+ * The contents of this file constitute Original Code as defined in and are
+ * subject to the Apple Public Source License Version 1.2 (the 'License').
+ * You may not use this file except in compliance with the License. Please obtain
+ * a copy of the License at http://www.apple.com/publicsource and read it before
+ * using this file.
+ * 
+ * This Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY of ANY KIND, EITHER EXPRESS
+ * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
+ * LIMITATION, ANY WARRANTIES of MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
+ * specific language governing rights and limitations under the License.
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+ *  AuthSession.h
+ *  AuthSession - APIs for managing login, authorization, and security Sessions.
+ }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AuthSession;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,Authorization;
+{$ALIGN MAC68K}
+{!
+	@header AuthSession
+
+	The Session API provides specialized applications access to Session management and inquiry
+    functions. This is a specialized API that should not be of interest to most people.
+	
+	The Security subsystem separates all processes into Security "sessions". Each process is in
+	exactly one session, and session membership inherits across fork/exec. Sessions form boundaries
+	for security-related state such as authorizations, keychain lock status, and the like.
+	Typically, each successful login (whether graphical or through ssh & friends) creates
+	a separate session. System daemons (started at system startup) belong to the "root session"
+	which has no user nor graphics access.
+    
+	Sessions are identified with SecuritySessionIds. A session has a set of attributes
+	that are set on creation and can be retrieved with SessionGetInfo().
+	
+	There are similar session concepts in the system, related but not necessarily
+	completely congruous. In particular, graphics sessions track security sessions
+	(but only for graphic logins).
+}
+
+
+{!
+	@typedef SecuritySessionId
+	These are externally visible identifiers for authorization sessions.
+        Different sessions have different identifiers; beyond that, you can't
+        tell anything from these values.
+    SessionIds can be compared for equality as you'd expect, but you should be careful
+        to use attribute bits wherever appropriate.
+}
+type
+	SecuritySessionId = UInt32;
+	SecuritySessionIdPtr = ^SecuritySessionId;
+
+
+{!
+    @enum SecuritySessionId
+    Here are some special values for SecuritySessionId. You may specify those
+        on input to SessionAPI functions. They will never be returned from such
+        functions.
+}
+const
+	noSecuritySession                      = 0;     { definitely not a valid SecuritySessionId }
+	callerSecuritySession = -1;     { the Session I (the caller) am in }
+
+
+{!
+    @enum SessionAttributeBits
+    Each Session has a set of attribute bits. You can get those from the
+        SessionGetInfo API function.
+ }
+type
+	SessionAttributeBits = UInt32;
+	SessionAttributeBitsPtr = ^SessionAttributeBits;
+ 
+const
+    sessionIsRoot                          = $0001; { is the root session (startup/system programs) }
+    sessionHasGraphicAccess                = $0010; { graphic subsystem (CoreGraphics et al) available }
+    sessionHasTTY                          = $0020; { /dev/tty is available }
+    sessionIsRemote                        = $1000; { session was established over the network }
+
+	// the following bits are used internally; do not try to set them
+    sessionWasInitialized                  = $8000;  { session has been set up by its leader }
+
+
+{!
+    @enum SessionCreationFlags
+    These flags control how a new session is created by SessionCreate.
+        They have no permanent meaning beyond that.
+ }
+type
+	SessionCreationFlags = UInt32;
+	SessionCreationFlagsPtr = ^SessionCreationFlags;
+ 
+const
+    sessionKeepCurrentBootstrap             = $8000; { caller has allocated sub-bootstrap (expert use only) }
+ 
+ 
+{!
+	@enum SessionStatus
+	Error codes returned by AuthSession API.
+    Note that the AuthSession APIs can also return Authorization API error codes.
+}
+const
+	errSessionSuccess                       = 0;      { all is well }
+	errSessionInvalidId                     = -60500; { invalid session id specified }
+	errSessionInvalidAttributes             = -60501; { invalid set of requested attribute bits }
+	errSessionAuthorizationDenied           = -60502; { you are not allowed to do this }
+
+	errSessionInternal                      = errAuthorizationInternal;	{ internal error }
+	errSessionInvalidFlags                  = errAuthorizationInvalidFlags; { invalid flags/options }
+
+
+{!
+    @function SessionGetInfo
+    Obtain information about a session. You can ask about any session whose
+	identifier you know. Use the callerSecuritySession constant to ask about
+	your own session (the one your process is in).
+
+    @param session (input) The Session you are asking about. Can be one of the
+        special constants defined above.
+	
+	@param sessionId (output/optional) The actual SecuritySessionId for the session you asked about.
+        Will never be one of those constants.
+        
+    @param attributes (output/optional) Receives the attribute bits for the session.
+
+    @result An OSStatus indicating success (noErr) or an error cause.
+    
+    errSessionInvalidId -60500 Invalid session id specified
+
+}
+function SessionGetInfo( session: SecuritySessionId; sessionId: SecuritySessionIdPtr; attributes: SessionAttributeBitsPtr ): OSStatus; external name '_SessionGetInfo';
+    
+
+{!
+    @function SessionCreate
+    This (very specialized) function creates a security session.
+	Upon completion, the new session contains the calling process (and none other).
+	You cannot create a session for someone else, and cannot avoid being placed
+	into the new session. This is (currently) the only call that changes a process's
+	session membership.
+    By default, a new bootstrap subset port is created for the calling process. The process
+    acquires this new port as its bootstrap port, which all its children will inherit.
+    If you happen to have created the subset port on your own, you can pass the
+    sessionKeepCurrentBootstrap flag, and SessionCreate will use it. Note however that
+    you cannot supersede a prior SessionCreate call that way; only a single SessionCreate
+    call is allowed for each Session (however made).
+	This call will discard any security information established for the calling process.
+	In particular, any authorization handles acquired will become invalid, and so will any
+	keychain related information. We recommend that you call SessionCreate before
+	making any other security-related calls that establish rights of any kind, to the
+	extent this is practical. Also, we strongly recommend that you do not perform
+	security-related calls in any other threads while calling SessionCreate.
+    
+    @param flags Flags controlling how the session is created.
+    
+    @param attributes The set of attribute bits to set for the new session.
+        Not all bits can be set this way.
+    
+    @result An OSStatus indicating success (noErr) or an error cause.
+    
+    errSessionInvalidAttributes -60501 Attempt to set invalid attribute bits	
+    errSessionAuthorizationDenied -60502 Attempt to re-initialize a session
+    errSessionInvalidFlags -60011 Attempt to specify unsupported flag bits
+    
+}
+function SessionCreate( flags: SessionCreationFlags; attributes: SessionAttributeBits ): OSStatus; external name '_SessionCreate';
+
+end.

+ 481 - 0
packages/extra/univint/Authorization.pas

@@ -0,0 +1,481 @@
+{
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
+ * 
+ * The contents of this file constitute Original Code as defined in and are
+ * subject to the Apple Public Source License Version 1.2 (the 'License').
+ * You may not use this file except in compliance with the License. Please obtain
+ * a copy of the License at http://www.apple.com/publicsource and read it before
+ * using this file.
+ * 
+ * This Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY of ANY KIND, EITHER EXPRESS
+ * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
+ * LIMITATION, ANY WARRANTIES of MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
+ * specific language governing rights and limitations under the License.
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+ *  Authorization.h -- APIs for implementing access control in applications
+ *  and daemons.
+ }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit Authorization;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+{$ALIGN MAC68K}
+{!
+	@header Authorization
+	Version 1.0 10/16/2000
+
+	The Authorization API contains all the APIs that a application or tool that need pre-authorization or need an authorization desision made.
+	
+	A typical use cases are a preference panel that would start off calling AuthorizationCreate() (without UI) to get an authorization object.  Then call AuthorizationCopyRights() to figure out what is currently allowed.
+	
+	If any of the operations that the preference panel wishes to perform are currently not allowed the lock icon in the window would show up in the locked state.  Otherwise it would show up unlocked.
+	
+	When the user locks the lock AuthorizationFree() is called with the kAuthorizationFlagDestroyRights to destroy any authorization rights that have been aquired.
+	
+	When the user unlocks the lock AuthorizationCreate() is called with the kAuthorizationFlagInteractionAllowed and kAuthorizationFlagExtendRights flags to obtain all required rights.  The old authorization object can be freed by calling AuthorizationFree() with no flags.
+
+}
+
+
+{!
+	@defined kAuthorizationEmptyEnvironment
+	Parameter to specify to AuthorizationCreate when no environment is being provided.
+}
+const kAuthorizationEmptyEnvironment = nil;
+
+
+{!
+	@enum AuthorizationStatus
+	Error codes returned by Authorization API.
+}
+
+{
+    Note: the comments that appear after these errors are used to create SecErrorMessages.strings.
+    The comments must not be multi-line, and should be in a form meaningful to an end user. If
+    a different or additional comment is needed, it can be put in the header doc format, or on a
+    line that does not start with errZZZ.
+}
+
+const
+	errAuthorizationSuccess					= 0;      { The operation completed successfully. }
+	errAuthorizationInvalidSet				= -60001; { The set parameter is invalid. }
+	errAuthorizationInvalidRef				= -60002; { The authorization parameter is invalid. }
+	errAuthorizationInvalidTag				= -60003; { The tag parameter is invalid. }
+	errAuthorizationInvalidPointer			= -60004; { The authorizedRights parameter is invalid. }
+	errAuthorizationDenied					= -60005; { The authorization was denied. }
+	errAuthorizationCanceled				= -60006; { The authorization was cancelled by the user. }
+	errAuthorizationInteractionNotAllowed	= -60007; { The authorization was denied since no user interaction was possible. }
+	errAuthorizationInternal                = -60008; { something else went wrong }
+	errAuthorizationExternalizeNotAllowed	= -60009; { authorization externalization denied }
+	errAuthorizationInternalizeNotAllowed	= -60010; { authorization internalization denied }
+	errAuthorizationInvalidFlags            = -60011; { invalid option flag(s) }
+	errAuthorizationToolExecuteFailure      = -60031; { cannot execute privileged tool }
+	errAuthorizationToolEnvironmentError    = -60032; { privileged tool environment error }
+	errAuthorizationBadAddress				= -60033; { invalid socket address requested }
+
+
+{!
+	@enum AuthorizationFlags
+	Optional flags passed in to serveral Authorization APIs. See the description of AuthorizationCreate, AuthorizationCopyRights and AuthorizationFree for a description of how they affect those calls.
+}
+const
+	kAuthorizationFlagDefaults              = 0;
+	kAuthorizationFlagInteractionAllowed	= (1 shl 0);
+	kAuthorizationFlagExtendRights			= (1 shl 1);
+	kAuthorizationFlagPartialRights			= (1 shl 2);
+	kAuthorizationFlagDestroyRights			= (1 shl 3);
+	kAuthorizationFlagPreAuthorize			= (1 shl 4);
+	
+	// private bits (do not use)
+	kAuthorizationFlagNoData                = (1 shl 20);
+
+
+{!
+	@typedef AuthorizationFlags
+	Optional flags passed in to AuthorizationCreate.
+}
+type AuthorizationFlags = UInt32;
+
+
+{!
+	@enum AuthorizationRightFlags
+	Flags returned in the flags field of ItemSet Items when calling AuthorizationCopyRights().
+}
+const
+	kAuthorizationFlagCanNotPreAuthorize = (1 shl 0);
+
+
+{!
+	@typedef AuthorizationRef
+	Opaque reference to an authorization object.
+}
+type
+	AuthorizationRef							= ^SInt32;
+
+
+{!
+	@typedef AuthorizationString
+	A zero terminated string in UTF-8 encoding.
+}
+type AuthorizationString = CStringPtr;
+
+
+{!
+	@struct AuthorizationItem
+	Each AuthorizationItem describes a single string-named item with optional
+	parameter value. The value must be contiguous memory of valueLength bytes;
+	internal structure is defined separately for each name.
+
+	@field name name of the item, as an AuthorizationString. Mandatory.
+	@field valueLength Number of bytes in parameter value. Must be 0 if no parameter value.
+	@field value Pointer to the optional parameter value associated with name.
+	Must be NULL if no parameter value.
+	@field flags Reserved field. Must be set to 0 on creation. Do not modify after that.
+}
+type
+	AuthorizationItem = record
+		name: AuthorizationString;
+		valueLength: UInt32;
+		value: Ptr;
+		flags: UInt32;
+	end;
+	AuthorizationItemPtr = ^AuthorizationItem;
+
+
+{!
+	@struct AuthorizationItemSet
+	An AuthorizationItemSet structure represents a set of zero or more AuthorizationItems.  Since it is a set it should not contain any identical AuthorizationItems.
+
+	@field count Number of items identified by items.
+	@field items Pointer to an array of items.
+}
+type
+	AuthorizationItemSet = record
+		count: UInt32;
+		items: AuthorizationItemPtr;
+	end;
+	AuthorizationItemSetPtr = ^AuthorizationItemSet;
+
+{!
+	@struct AuthorizationExternalForm
+	An AuthorizationExternalForm structure can hold the externalized form of
+	an AuthorizationRef. As such, it can be transmitted across IPC channels
+	to other processes, which can re-internalize it to recover a valid AuthorizationRef
+	handle.
+	The data contained in an AuthorizationExternalForm should be considered opaque.
+
+	SECURITY NOTE: Applications should take care to not disclose the AuthorizationExternalForm to
+	potential attackers since it would authorize rights to them.
+}
+const kAuthorizationExternalFormLength = 32;
+
+type
+	AuthorizationExternalForm = record
+		bytes: packed array[0..(kAuthorizationExternalFormLength)-1] of char;
+	end;
+
+
+{!
+	@typedef AuthorizationRights
+	An AuthorizationItemSet representing a set of rights each with an associated argument (value).
+	Each argument value is as defined for the specific right they belong to.  Argument values may not contain pointers as the should be copyable to different address spaces.
+}
+type AuthorizationRights = AuthorizationItemSet;
+type AuthorizationRightsPtr = ^AuthorizationRights;
+type AuthorizationRightsPtrPtr = ^AuthorizationRightsPtr;
+
+
+{!
+	@typedef AuthorizationEnvironment
+	An AuthorizationItemSet representing environmental information of potential use
+	to authorization decisions.
+}
+type AuthorizationEnvironment = AuthorizationItemSet;
+type AuthorizationEnvironmentPtr = ^AuthorizationEnvironment;
+
+
+{!
+    @function AuthorizationCreate
+    Create a new autorization object which can be used in other authorization calls.  When the authorization is no longer needed AuthorizationFree should be called.
+
+	When the kAuthorizationFlagInteractionAllowed flag is set, user interaction will happen when required.  Failing to set this flag will result in this call failing with a errAuthorizationInteractionNotAllowed status when interaction is required.
+
+	Setting the kAuthorizationFlagExtendRights flag will extend the currently available rights. If this flag is set the returned AuthorizationRef will grant all the rights requested when errAuthorizationSuccess is returned. If this flag is not set the operation will almost certainly succeed, but no attempt will be made to make the requested rights availible.
+		Call AuthorizationCopyRights to figure out which of the requested rights are granted by the returned AuthorizationRef.
+
+	Setting the kAuthorizationFlagPartialRights flag will cause this call to succeed if only some of the requested rights are being granted by the returned AuthorizationRef. Unless this flag is set this API will fail if not all the requested rights could be obtained.
+
+	Setting the kAuthorizationFlagDestroyRights flag will prevent any rights obtained during this call from being preserved after returning from this API (This is most useful when the authorization parameter is NULL and the caller doesn't want to affect the session state in any way).
+
+	Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling AuthorizationMakeExternalForm() follow by AuthorizationCreateFromExternalForm() -- the obtained rights can be used in a different process.  Rights that can't be preauthorized will be treated as if they were authorized for the sake of returning an error (in other words if all rights are either authorized or could not be preauthorized this call will still succeed).
+		The rights which could not be preauthorized are not currently authorized and may fail to authorize when a later call to AuthorizationCopyRights() is made, unless the kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set.  Even then they might still fail if the user does not supply the correct credentials.
+		The reason for passing in this flag is to provide correct audit trail information and to avoid unnecessary user interaction.
+
+    @param rights (input/optional) An AuthorizationItemSet containing rights for which authorization is being requested.  If none are specified the resulting AuthorizationRef will authorize nothing at all.
+    @param environment (input/optional) An AuthorizationItemSet containing enviroment state used when making the autorization decision.  See the AuthorizationEnvironment type for details.
+    @param flags (input) options specified by the AuthorizationFlags enum.  set all unused bits to zero to allow for future expansion.
+    @param authorization (output optional) A pointer to an AuthorizationRef to be returned.  When the returned AuthorizationRef is no longer needed AuthorizationFree should be called to prevent anyone from using the aquired rights.  If NULL is specified no new rights are returned, but the system will attempt to authorize all the requested rights and return the appropriate status.
+
+    @result errAuthorizationSuccess 0 authorization or all requested rights succeeded.
+
+	errAuthorizationDenied -60005 The authorization for one or more of the requested rights was denied.
+
+	errAuthorizationCanceled -60006 The authorization was cancelled by the user.
+
+	errAuthorizationInteractionNotAllowed -60007 The authorization was denied since no interaction with the user was allowed.
+}
+function AuthorizationCreate(rights: AuthorizationRightsPtr; environment: AuthorizationEnvironmentPtr; flags: AuthorizationFlags; var authorization: AuthorizationRef): OSStatus; external name '_AuthorizationCreate';
+
+
+{!
+    @function AuthorizationFree
+    Destroy an AutorizationRef object. If the kAuthorizationFlagDestroyRights flag is passed,
+	any rights associated with the authorization are lost. Otherwise, only local resources
+	are released, and the rights may still be available to other clients.
+
+	Setting the kAuthorizationFlagDestroyRights flag will prevent any rights that were obtained by the specified authorization object to be preserved after returning from this API.  This effectivaly locks down all potentially shared authorizations.
+
+    @param authorization (input) The authorization object on which this operation is performed.
+	
+	@param flags (input) Bit mask of option flags to this call.
+
+    @result errAuthorizationSuccess 0 No error.
+
+    errAuthorizationInvalidRef -60002 The authorization parameter is invalid.
+}
+function AuthorizationFree(authorization: AuthorizationRef;flags: AuthorizationFlags): OSStatus; external name '_AuthorizationFree';
+
+{!
+	@function AuthorizationCopyRights
+    Given a set of rights, return the subset that is currently authorized
+    by the AuthorizationRef given.
+
+	When the kAuthorizationFlagInteractionAllowed flag is set, user interaction will happen when required.  Failing to set this flag will result in this call failing with a errAuthorizationInteractionNotAllowed status when interaction is required.
+
+	Setting the kAuthorizationFlagExtendRights flag will extend the currently available rights.
+
+	Setting the kAuthorizationFlagPartialRights flag will cause this call to succeed if only some of the requested rights are being granted by the returned AuthorizationRef.  Unless this flag is set this API will fail if not all the requested rights could be obtained.
+
+	Setting the kAuthorizationFlagDestroyRights flag will prevent any additional rights obtained during this call from being preserved after returning from this API.
+
+	Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling AuthorizationMakeExternalForm() follow by AuthorizationCreateFromExternalForm() -- the obtained rights can be used in a different process.  Rights that can't be preauthorized will be treated as if they were authorized for the sake of returning an error (in other words if all rights are either authorized or could not be preauthorized this call will still succeed), and they will be returned in authorizedRights with their kAuthorizationFlagCanNotPreAuthorize bit in the flags field set to 1.
+		The rights which could not be preauthorized are not currently authorized and may fail to authorize when a later call to AuthorizationCopyRights() is made, unless the kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set.  Even then they might still fail if the user does not supply the correct credentials.
+		The reason for passing in this flag is to provide correct audit trail information and to avoid unnecessary user interaction.
+
+	Setting the kAuthorizationFlagPreAuthorize flag will pre authorize the requested rights so that at a later time -- by calling AuthorizationMakeExternalForm() follow by AuthorizationCreateFromExternalForm() -- the obtained rights can be used in a different process.  When this flags is specified rights that can't be preauthorized will be returned as if they were authorized with their kAuthorizationFlagCanNotPreAuthorize bit in the flags field set to 1.  These rights are not currently authorized and may fail to authorize later unless kAuthorizationFlagExtendRights and kAuthorizationFlagInteractionAllowed flags are set when the actual authorization is done.  And even then they might still fail if the user does not supply the correct credentials.
+
+    @param authorization (input) The authorization object on which this operation is performed.
+    @param rights (input) A rights set (see AuthorizationCreate).
+    @param environment (input/optional) An AuthorizationItemSet containing enviroment state used when making the autorization decision.  See the AuthorizationEnvironment type for details.
+    @param flags (input) options specified by the AuthorizationFlags enum.  set all unused bits to zero to allow for future expansion.
+    @param authorizedRights (output/optional) A pointer to a newly allocated AuthorizationInfoSet in which the authorized subset of rights are returned (authorizedRights should be deallocated by calling AuthorizationFreeItemSet() when it is no longer needed).  If NULL the only information returned is the status.  Note that if the kAuthorizationFlagPreAuthorize flag was specified rights that could not be preauthorized are returned in authorizedRights, but their flags contains the kAuthorizationFlagCanNotPreAuthorize bit.
+
+    @result errAuthorizationSuccess 0 No error.
+
+	errAuthorizationInvalidRef -60002 The authorization parameter is invalid.
+
+    errAuthorizationInvalidSet -60001 The rights parameter is invalid.
+
+    errAuthorizationInvalidPointer -60004 The authorizedRights parameter is invalid.
+}
+function AuthorizationCopyRights(authorization: AuthorizationRef; const (*var*) rights: AuthorizationRights; environment: AuthorizationEnvironmentPtr; flags: AuthorizationFlags; authorizedRights: AuthorizationRightsPtrPtr): OSStatus; external name '_AuthorizationCopyRights';
+
+{!
+	@function AuthorizationCopyInfo
+	Returns sideband information (e.g. access credentials) obtained from a call to AuthorizationCreate.  The format of this data depends of the tag specified.
+	
+    @param authorization (input) The authorization object on which this operation is performed.
+    @param tag (input/optional) An optional string tag specifing which sideband information should be returned.  When NULL is specified all available information is returned.
+    @param flags (input) options specified by the AuthorizationFlags enum.  set all unused bits to zero to allow for future expansion.
+    @param info (output) A pointer to a newly allocated AuthorizationInfoSet in which the requested sideband infomation is returned (info should be deallocated by calling AuthorizationFreeItemSet() when it is no longer needed).
+
+    @result errAuthorizationSuccess 0 No error.
+
+    errAuthorizationInvalidRef -60002 The authorization parameter is invalid.
+
+    errAuthorizationInvalidTag -60003 The tag parameter is invalid.
+
+    errAuthorizationInvalidPointer -60004 The info parameter is invalid.
+}
+function AuthorizationCopyInfo(authorization: AuthorizationRef; tag: AuthorizationString; var info: AuthorizationItemSetPtr): OSStatus; external name '_AuthorizationCopyInfo';
+
+{!
+	@function AuthorizationMakeExternalForm
+	Turn an Authorization into an external "byte blob" form so it can be
+	transmitted to another process.
+	Note that *storing* the external form somewhere will probably not do what
+	you want, since authorizations are bounded by sessions, processes, and possibly
+	time limits. This is for online transmission of authorizations.
+	
+	@param authorization The (valid) authorization reference to externalize
+	@param extForm Pointer to an AuthorizationExternalForm variable to fill.
+	
+        @result errAuthorizationSuccess 0 No error.
+
+        errAuthorizationExternalizeNotAllowed -60009 Externalizing this authorization is not allowed.
+
+        errAuthorizationInvalidRef -60002 The authorization parameter is invalid.
+
+
+}
+function AuthorizationMakeExternalForm(authorization: AuthorizationRef; var extForm: AuthorizationExternalForm): OSStatus; external name '_AuthorizationMakeExternalForm';
+
+
+{!
+	@function AuthorizationCreateFromExternalForm
+	Turn an Authorization into an external "byte blob" form so it can be
+	transmitted to another process.
+	Note that *storing* the external form somewhere will probably not do what
+	you want, since authorizations are bounded by sessions, processes, and possibly
+	time limits. This is for online transmission of authorizations.
+	
+	@param extForm Pointer to an AuthorizationExternalForm value.
+	@param authorization Will be filled with a valid AuthorizationRef on success.
+	
+	@result errAuthorizationInternalizeNotAllowed -60010 Internalizing this authorization is not allowed.
+}
+function AuthorizationCreateFromExternalForm(const (*var*) extForm: AuthorizationExternalForm; var authorization: AuthorizationRef): OSStatus; external name '_AuthorizationCreateFromExternalForm';
+
+
+{!
+	@function AuthorizationFreeItemSet
+	Release the memory allocated for an AuthorizationItemSet that was allocated
+	by an API call.
+	
+    @param set The AuthorizationItemSet to deallocate.
+
+    @result errAuthorizationSuccess 0 No error.
+
+    errAuthorizationInvalidSet -60001 The set parameter is invalid.
+}
+function AuthorizationFreeItemSet(var setx: AuthorizationItemSet): OSStatus; external name '_AuthorizationFreeItemSet';
+
+
+{!
+	@function AuthorizationExecuteWithPrivileges
+	Run an executable tool with enhanced privileges after passing
+	suitable authorization procedures.
+	
+	@param authorization An authorization reference that is used to authorize
+	access to the enhanced privileges. It is also passed to the tool for
+	further access control.
+	@param pathToTool Full pathname to the tool that should be executed
+	with enhanced privileges.
+	@param options Option bits (reserved). Must be zero.
+	@param arguments An argv-style vector of strings to be passed to the tool.
+	@param communicationsPipe Assigned a UNIX stdio FILE pointer for
+	a bidirectional pipe to communicate with the tool. The tool will have
+	this pipe as its standard I/O channels (stdin/stdout). If NULL, do not
+	establish a communications pipe.
+ }
+type
+  Arg10000Type = array[0..10000] of CStringPtr;
+  Arg10000TypePtr = ^Arg10000Type;
+function AuthorizationExecuteWithPrivileges(authorization: AuthorizationRef; pathToTool: CStringPtr; options: AuthorizationFlags; arguments: Arg10000TypePtr; communicationsPipe: UnivPtr): OSStatus; external name '_AuthorizationExecuteWithPrivileges';
+// communicationsPipe not yet supported
+
+
+{!
+	@function AuthorizationCopyPrivilegedReference
+	From within a tool launched via the AuthorizationExecuteWithPrivileges function
+	ONLY, retrieve the AuthorizationRef originally passed to that function.
+	While AuthorizationExecuteWithPrivileges already verified the authorization to
+	launch your tool, the tool may want to avail itself of any additional pre-authorizations
+	the caller may have obtained through that reference.
+ }
+function AuthorizationCopyPrivilegedReference(var authorization: AuthorizationRef; flags: AuthorizationFlags): OSStatus; external name '_AuthorizationCopyPrivilegedReference';
+
+end.

+ 223 - 0
packages/extra/univint/AuthorizationDB.pas

@@ -0,0 +1,223 @@
+{
+ * Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved.
+ * 
+ * The contents of this file constitute Original Code as defined in and are
+ * subject to the Apple Public Source License Version 1.2 (the 'License').
+ * You may not use this file except in compliance with the License. Please obtain
+ * a copy of the License at http://www.apple.com/publicsource and read it before
+ * using this file.
+ * 
+ * This Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY of ANY KIND, EITHER EXPRESS
+ * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
+ * LIMITATION, ANY WARRANTIES of MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
+ * specific language governing rights and limitations under the License.
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+{
+ *  AuthorizationDB.h -- APIs for managing the authorization policy database
+ *  and daemons.
+ }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AuthorizationDB;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,Authorization,CFBase,CFDictionary,CFString,CFBundle;
+{$ALIGN MAC68K}
+{!
+	@header AuthorizationDB
+	Version 1.0
+
+	This API allows for any programs to get, modify, delete and add new right definitions to the policy database.  Meta-rights specify whether and what authorization is required to make these modifications.
+	
+	AuthorizationRightSet(NULL, "com.ifoo.ifax.send", CFSTR(kRuleIsAdmin), CFSTR("You must authenticate to send a fax."), NULL, NULL)
+
+	add a rule for letting admins send faxes using a canned rule, delegating to a pre-specified rule that authorizes everyone who is an admin.
+	
+	AuthorizationRightSet(NULL, "com.ifoo.ifax.send", [[CFSTR(kRightRule), CFSTR(kRuleIsAdmin)], [CFSTR(kRightComment), CFSTR("authorizes sending of 1 fax message")]], CFSTR("Authorize sending of a fax"), NULL, NULL)
+
+	add identical rule, but specify additional attributes this time.
+
+	Keep in mind while specifying a comment to be specific about what you need to authorize for (1 fax), in terms of a general message for user.  The means of proof required for kRuleIsAdmin (enter username/password for example) should not be included here, since it could be configured differently.
+
+}
+
+{!	@define kRightRule
+	rule delegation key.  Instead of specifying exact behavior some canned rules
+   are shipped that may be switched by configurable security.
+}
+const kAuthorizationRightRule					= 'rule';
+
+{! @defined kRuleIsAdmin
+	canned rule values for use with rule delegation definitions: require user to be an admin.
+}
+const kAuthorizationRuleIsAdmin				= 'is-admin';
+
+{! @defined kRuleAuthenticateAsSessionUser
+	canned rule value for use with rule delegation definitions: require user to authenticate as the session owner (logged-in user).
+}
+const kAuthorizationRuleAuthenticateAsSessionUser= 'authenticate-session-user';
+
+{! @defined kRuleAuthenticateAsAdmin
+	Canned rule value for use with rule delegation definitions: require user to authenticate as admin.
+}
+const kAuthorizationRuleAuthenticateAsAdmin	= 'authenticate-admin';
+
+{! @defined kAuthorizationRuleClassAllow
+	Class that allows anything.
+}
+const kAuthorizationRuleClassAllow		= 'allow';
+
+{! @defined kAuthorizationRuleClassDeny
+	Class that denies anything. 
+}
+const kAuthorizationRuleClassDeny			= 'deny';
+
+{! @defined kAuthorizationComment
+    comments for the administrator on what is being customized here;
+   as opposed to (localized) descriptions presented to the user.
+}
+const kAuthorizationComment = 'comment';
+
+
+{!
+	@function AuthorizationRightGet 
+	
+	Retrieves a right definition as a dictionary.  There are no restrictions to keep anyone from retrieving these definitions.  
+
+	@param rightName (input) the rightname (ASCII).  Wildcard rightname definitions are okay.
+	@param rightDefinition (output/optional) the dictionary with all keys defining the right.  See documented keys.  Passing in NULL will just check if there is a definition.  The caller is responsible for releasing the returned dictionary.
+
+	@result errAuthorizationSuccess 0 No error.
+
+	errAuthorizationDenied -60005 No definition found.
+
+}
+function AuthorizationRightGet( rightName: ConstCStringPtr; rightDefinition: CFDictionaryRefPtr ): OSStatus; external name '_AuthorizationRightGet';
+// attribute(weak_import);
+
+{!
+	@function AuthorizationRightSet
+	
+	Create or update a right entry.  Only normal rights can be registered (wildcard rights are denied); wildcard rights are considered to be put in by an administrator putting together a site configuration.
+
+	@param authRef (input) authRef to authorize modifications.
+	@param rightName (input) the rightname (ASCII).  Wildcard rightnames are not okay.
+	@param rightDefinition (input) a CFString of the name of a rule to use (delegate) or CFDictionary containing keys defining one.
+	@param descriptionKey (input/optional) a CFString to use as a key for looking up localized descriptions.  If no localization is found this will be the description itself.
+	@param bundle (input/optional) a bundle to get localizations from if not the main bundle.
+	@param localeTableName (input/optional) stringtable name to get localizations from.
+	
+	@result errAuthorizationSuccess 0 added right definition successfully.
+
+	errAuthorizationDenied -60005 Unable to create or update right definition.
+
+	errAuthorizationCanceled -60006 Authorization was canceled by user.
+
+	errAuthorizationInteractionNotAllowed -60007 Interaction was required but not possible.
+
+}
+function AuthorizationRightSet(authRef: AuthorizationRef; rightName: ConstCStringPtr; rightDefinition: CFTypeRef; descriptionKey: CFStringRef; bundle: CFBundleRef; localeTableName: CFStringRef): OSStatus; external name '_AuthorizationRightSet';
+// attribute(weak_import);
+
+
+{!
+	@function AuthorizationRightRemove
+
+	Request to remove a right from the policy database.
+
+	@param authRef (input) authRef, to be used to authorize this action.
+	@param rightName (input) the rightname (ASCII).  Wildcard rightnames are not okay.
+	
+}
+function AuthorizationRightRemove(authRef: AuthorizationRef; rightName: ConstCStringPtr): OSStatus; external name '_AuthorizationRightRemove';
+
+end.

+ 162 - 0
packages/extra/univint/AuthorizationTags.pas

@@ -0,0 +1,162 @@
+{
+ * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
+ * 
+ * The contents of this file constitute Original Code as defined in and are
+ * subject to the Apple Public Source License Version 1.2 (the 'License').
+ * You may not use this file except in compliance with the License. Please obtain
+ * a copy of the License at http://www.apple.com/publicsource and read it before
+ * using this file.
+ * 
+ * This Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY of ANY KIND, EITHER EXPRESS
+ * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
+ * LIMITATION, ANY WARRANTIES of MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
+ * specific language governing rights and limitations under the License.
+ }
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+ *  AuthorizationTags.h -- Right tags for implementing access control in
+ *  applications and daemons
+ }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit AuthorizationTags;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+{$ALIGN MAC68K}
+{!
+	@header AuthorizationTags
+	Draft version 2 01/23/2001
+
+	This header defines some of the supported rights tags to be used in the Authorization API.
+}
+
+
+{!
+	@define kAuthorizationEnvironmentUsername
+	The name of the AuthorizationItem that should be passed into the environment when specifying a username.  The value and valueLength should contain the username itself.
+}
+const kAuthorizationEnvironmentUsername = 'username';
+
+{!
+	@define kAuthorizationEnvironmentPassword
+	The name of the AuthorizationItem that should be passed into the environment when specifying a password for a given username.  The value and valueLength should contain the actual password data.
+}
+const kAuthorizationEnvironmentPassword = 'password';
+
+{!
+	@define kAuthorizationEnvironmentShared
+	The name of the AuthorizationItem that should be passed into the environment when specifying a username and password.  Adding this entry to the environment will cause the username/password to be added to the shared credential pool of the calling applications session.  This means that further calls by other applications in this session will automatically have this credential availible to them.  The value is ignored.
+}
+const kAuthorizationEnvironmentShared = 'shared';
+
+{!
+	@define kAuthorizationRightExecute
+	The name of the AuthorizationItem that should be passed into the rights when preauthorizing for a call to AuthorizationExecuteWithPrivileges().
+	
+	You need to aquire this right to be able to perform a AuthorizationExecuteWithPrivileges() operation.  In addtion to this right you should obtain whatever rights the tool you are executing with privileges need to perform it's operation on your behalf.  Currently no options are supported but you should pass in the full path of the tool you wish to execute in the value and valueLength fields.  In the future we will limit the right to only execute the requested path, and we will display this information to the user.
+}
+const kAuthorizationRightExecute= 'system.privilege.admin';
+
+{!
+	@define kAuthorizationEnvironmentPrompt
+	The name of the AuthorizationItem that should be passed into the environment when specifying a invocation specific additional text.  The value should be a localized UTF8 string.
+}
+const kAuthorizationEnvironmentPrompt = 'prompt';
+
+{!
+	@define kAuthorizationEnvironmentIcon
+	The name of the AuthorizationItem that should be passed into the environment when specifying an alternate icon to be used.  The value should be a full path to and image NSImage can deal with.
+}
+const kAuthorizationEnvironmentIcon = 'icon';
+
+end.

+ 751 - 0
packages/extra/univint/CFArray.pas

@@ -0,0 +1,751 @@
+{	CFArray.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFArray;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+{!
+	@header CFArray
+	CFArray implements an ordered, compact container of pointer-sized
+	values. Values are accessed via integer keys (indices), from the
+	range 0 to N-1, where N is the number of values in the array when
+	an operation is performed. The array is said to be "compact" because
+	deleted or inserted values do not leave a gap in the key space --
+	the values with higher-numbered indices have their indices
+	renumbered lower (or higher, in the case of insertion) so that the
+	set of valid indices is always in the integer range [0, N-1]. Thus,
+	the index to access a particular value in the array may change over
+	time as other values are inserted into or deleted from the array.
+
+	Arrays come in two flavors, immutable, which cannot have values
+	added to them or removed from them after the array is created, and
+	mutable, to which you can add values or from which remove values.
+	Mutable arrays have two subflavors, fixed-capacity, for which there
+	is a maximum number set at creation time of values which can be put
+	into the array, and variable capacity, which can have an unlimited
+	number of values (or rather, limited only by constraints external
+	to CFArray, like the amount of available memory). Fixed-capacity
+	arrays can be somewhat higher performing, if you can put a definite
+	upper limit on the number of values that might be put into the
+	array.
+
+	As with all CoreFoundation collection types, arrays maintain hard
+	references on the values you put in them, but the retaining and
+	releasing functions are user-defined callbacks that can actually do
+	whatever the user wants (for example, nothing).
+
+	Computational Complexity
+	The access time for a value in the array is guaranteed to be at
+	worst O(lg N) for any implementation, current and future, but will
+	often be O(1) (constant time). Linear search operations similarly
+	have a worst case complexity of O(N*lg N), though typically the
+	bounds will be tighter, and so on. Insertion or deletion operations
+	will typically be linear in the number of values in the array, but
+	may be O(N*lg N) clearly in the worst case in some implementations.
+	There are no favored positions within the array for performance;
+	that is, it is not necessarily faster to access values with low
+	indices, or to insert or delete values with high indices, or
+	whatever.
+}
+
+
+{!
+	@typedef CFArrayCallBacks
+	Structure containing the callbacks of a CFArray.
+	@field version The version number of the structure type being passed
+		in as a parameter to the CFArray creation functions. This
+		structure is version 0.
+	@field retain The callback used to add a retain for the array on
+		values as they are put into the array. This callback returns
+		the value to store in the array, which is usually the value
+		parameter passed to this callback, but may be a different
+		value if a different value should be stored in the array.
+		The array's allocator is passed as the first argument.
+	@field release The callback used to remove a retain previously added
+		for the array from values as they are removed from the
+		array. The array's allocator is passed as the first
+		argument.
+	@field copyDescription The callback used to create a descriptive
+		string representation of each value in the array. This is
+		used by the CFCopyDescription() function.
+	@field equal The callback used to compare values in the array for
+		equality for some operations.
+}
+type
+	CFArrayRetainCallBack = function( allocator: CFAllocatorRef; value: {const} UnivPtr ): UnivPtr;
+	CFArrayReleaseCallBack = procedure( allocator: CFAllocatorRef; value: {const} UnivPtr );
+	CFArrayCopyDescriptionCallBack = function( value: {const} UnivPtr ): CFStringRef;
+	CFArrayEqualCallBack = function( value1: {const} UnivPtr; value2: {const} UnivPtr ): Boolean;
+	CFArrayCallBacks = record
+		version: CFIndex;
+		retain: CFArrayRetainCallBack;
+		release: CFArrayReleaseCallBack;
+		copyDescription: CFArrayCopyDescriptionCallBack;
+		equal: CFArrayEqualCallBack;
+	end;
+	CFArrayCallBacksPtr = ^CFArrayCallBacks;
+
+{!
+	@constant kCFTypeArrayCallBacks
+	Predefined CFArrayCallBacks structure containing a set of callbacks
+	appropriate for use when the values in a CFArray are all CFTypes.
+}
+var kCFTypeArrayCallBacks: CFArrayCallBacks; external name '_kCFTypeArrayCallBacks'; (* attribute const *)
+
+{!
+	@typedef CFArrayApplierFunction
+	Type of the callback function used by the apply functions of
+		CFArrays.
+	@param value The current value from the array.
+	@param context The user-defined context parameter given to the apply
+		function.
+}
+type
+	CFArrayApplierFunction = procedure( value: {const} UnivPtr; context: UnivPtr );
+
+{!
+	@typedef CFArrayRef
+	This is the type of a reference to immutable CFArrays.
+}
+type
+	CFArrayRef = ^SInt32; { an opaque 32-bit type }
+	CFArrayRefPtr = ^CFArrayRef;
+
+{!
+	@typedef CFMutableArrayRef
+	This is the type of a reference to mutable CFArrays.
+}
+type
+	CFMutableArrayRef = CFArrayRef;
+	CFMutableArrayRefPtr = ^CFMutableArrayRef;
+
+{!
+	@function CFArrayGetTypeID
+	Returns the type identifier of all CFArray instances.
+}
+function CFArrayGetTypeID: CFTypeID; external name '_CFArrayGetTypeID';
+
+{!
+	@function CFArrayCreate
+	Creates a new immutable array with the given values.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param values A C array of the pointer-sized values to be in the
+		array. The values in the array are ordered in the same order
+		in which they appear in this C array. This parameter may be
+		NULL if the numValues parameter is 0. This C array is not
+		changed or freed by this function. If this parameter is not
+		a valid pointer to a C array of at least numValues pointers,
+		the behavior is undefined.
+	@param numValues The number of values to copy from the values C
+		array into the CFArray. This number will be the count of the
+		array.
+		If this parameter is negative, or greater than the number of
+		values actually in the value's C array, the behavior is
+		undefined.
+	@param callBacks A pointer to a CFArrayCallBacks structure
+		initialized with the callbacks for the array to use on each
+		value in the array. The retain callback will be used within
+		this function, for example, to retain all of the new values
+		from the values C array. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a
+		structure on the stack can be passed in, or can be reused
+		for multiple array creations. If the version field of this
+		callbacks structure is not one of the defined ones for
+		CFArray, the behavior is undefined. The retain field may be
+		NULL, in which case the CFArray will do nothing to add a
+		retain to the contained values for the array. The release
+		field may be NULL, in which case the CFArray will do nothing
+		to remove the array's retain (if any) on the values when the
+		array is destroyed. If the copyDescription field is NULL,
+		the array will create a simple description for the value. If
+		the equal field is NULL, the array will use pointer equality
+		to test for equality of values. This callbacks parameter
+		itself may be NULL, which is treated as if a valid structure
+		of version 0 with all fields NULL had been passed in.
+		Otherwise, if any of the fields are not valid pointers to
+		functions of the correct type, or this parameter is not a
+		valid pointer to a  CFArrayCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		array is not one understood by one of the callback functions
+		the behavior when that callback function is used is
+		undefined.
+	@result A reference to the new immutable CFArray.
+}
+function CFArrayCreate( allocator: CFAllocatorRef; {const} values: {variable-size-array} UnivPtrPtr; numValues: CFIndex; {const} callBacks: CFArrayCallBacksPtr { can be NULL } ): CFArrayRef; external name '_CFArrayCreate';
+
+{!
+	@function CFArrayCreateCopy
+	Creates a new immutable array with the values from the given array.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theArray The array which is to be copied. The values from the
+		array are copied as pointers into the new array (that is,
+		the values themselves are copied, not that which the values
+		point to, if anything). However, the values are also
+		retained by the new array. The count of the new array will
+		be the same as the given array. The new array uses the same
+		callbacks as the array to be copied. If this parameter is
+		not a valid CFArray, the behavior is undefined.
+	@result A reference to the new immutable CFArray.
+}
+function CFArrayCreateCopy( allocator: CFAllocatorRef; theArray: CFArrayRef ): CFArrayRef; external name '_CFArrayCreateCopy';
+
+{!
+	@function CFArrayCreateMutable
+	Creates a new empty mutable array.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFArray. The array starts empty, and can grow to this
+		number of values (and it can have less). If this parameter
+		is 0, the array's maximum capacity is unlimited (or rather,
+		only limited by address space and available memory
+		constraints). If this parameter is negative, the behavior is
+		undefined.
+	@param callBacks A pointer to a CFArrayCallBacks structure
+		initialized with the callbacks for the array to use on each
+		value in the array. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a
+		structure on the stack can be passed in, or can be reused
+		for multiple array creations. If the version field of this
+		callbacks structure is not one of the defined ones for
+		CFArray, the behavior is undefined. The retain field may be
+		NULL, in which case the CFArray will do nothing to add a
+		retain to the contained values for the array. The release
+		field may be NULL, in which case the CFArray will do nothing
+		to remove the arrays retain (if any) on the values when the
+		array is destroyed. If the copyDescription field is NULL,
+		the array will create a simple description for the value. If
+		the equal field is NULL, the array will use pointer equality
+		to test for equality of values. This callbacks parameter
+		itself may be NULL, which is treated as if a valid structure
+		of version 0 with all fields NULL had been passed in.
+		Otherwise, if any of the fields are not valid pointers to
+		functions of the correct type, or this parameter is not a
+		valid pointer to a  CFArrayCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		array is not one understood by one of the callback functions
+		the behavior when that callback function is used is
+		undefined.
+	@result A reference to the new mutable CFArray.
+}
+function CFArrayCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex; {const} callBacks: CFArrayCallBacksPtr { can be NULL } ): CFMutableArrayRef; external name '_CFArrayCreateMutable';
+
+{!
+	@function CFArrayCreateMutableCopy
+	Creates a new mutable array with the values from the given array.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFArray. The array starts empty, and can grow to this
+		number of values (and it can have less). If this parameter
+		is 0, the array's maximum capacity is unlimited (or rather,
+		only limited by address space and available memory
+		constraints). This parameter must be greater than or equal
+		to the count of the array which is to be copied, or the
+		behavior is undefined. If this parameter is negative, the
+		behavior is undefined.
+	@param theArray The array which is to be copied. The values from the
+		array are copied as pointers into the new array (that is,
+		the values themselves are copied, not that which the values
+		point to, if anything). However, the values are also
+		retained by the new array. The count of the new array will
+		be the same as the given array. The new array uses the same
+		callbacks as the array to be copied. If this parameter is
+		not a valid CFArray, the behavior is undefined.
+	@result A reference to the new mutable CFArray.
+}
+function CFArrayCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theArray: CFArrayRef ): CFMutableArrayRef; external name '_CFArrayCreateMutableCopy';
+
+{!
+	@function CFArrayGetCount
+	Returns the number of values currently in the array.
+	@param theArray The array to be queried. If this parameter is not a valid
+		CFArray, the behavior is undefined.
+	@result The number of values in the array.
+}
+function CFArrayGetCount( theArray: CFArrayRef ): CFIndex; external name '_CFArrayGetCount';
+
+{!
+	@function CFArrayGetCountOfValue
+	Counts the number of times the given value occurs in the array.
+	@param theArray The array to be searched. If this parameter is not a
+		valid CFArray, the behavior is undefined.
+	@param range The range within the array to search. If the range
+		location or end point (defined by the location plus length
+		minus 1) is outside the index space of the array (0 to
+		N-1 inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0).
+	@param value The value for which to find matches in the array. The
+		equal() callback provided when the array was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the array, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result The number of times the given value occurs in the array,
+		within the specified range.
+}
+function CFArrayGetCountOfValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): CFIndex; external name '_CFArrayGetCountOfValue';
+
+{!
+	@function CFArrayContainsValue
+	Reports whether or not the value is in the array.
+	@param theArray The array to be searched. If this parameter is not a
+		valid CFArray, the behavior is undefined.
+	@param range The range within the array to search. If the range
+		location or end point (defined by the location plus length
+		minus 1) is outside the index space of the array (0 to
+		N-1 inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0).
+	@param value The value for which to find matches in the array. The
+		equal() callback provided when the array was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the array, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result true, if the value is in the specified range of the array,
+		otherwise false.
+}
+function CFArrayContainsValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): Boolean; external name '_CFArrayContainsValue';
+
+{!
+	@function CFArrayGetValueAtIndex
+	Retrieves the value at the given index.
+	@param theArray The array to be queried. If this parameter is not a
+		valid CFArray, the behavior is undefined.
+	@param idx The index of the value to retrieve. If the index is
+		outside the index space of the array (0 to N-1 inclusive,
+		where N is the count of the array), the behavior is
+		undefined.
+	@result The value with the given index in the array.
+}
+function CFArrayGetValueAtIndex( theArray: CFArrayRef; idx: CFIndex ): UnivPtr; external name '_CFArrayGetValueAtIndex';
+
+{!
+	@function CFArrayGetValues
+	Fills the buffer with values from the array.
+	@param theArray The array to be queried. If this parameter is not a
+		valid CFArray, the behavior is undefined.
+	@param range The range of values within the array to retrieve. If
+		the range location or end point (defined by the location
+		plus length minus 1) is outside the index space of the
+		array (0 to N-1 inclusive, where N is the count of the
+		array), the behavior is undefined. If the range length is
+		negative, the behavior is undefined. The range may be empty
+		(length 0), in which case no values are put into the buffer.
+	@param values A C array of pointer-sized values to be filled with
+		values from the array. The values in the C array are ordered
+		in the same order in which they appear in the array. If this
+		parameter is not a valid pointer to a C array of at least
+		range.length pointers, the behavior is undefined.
+}
+procedure CFArrayGetValues( theArray: CFArrayRef; range: CFRange; {const} values: {variable-size-array} UnivPtrPtr ); external name '_CFArrayGetValues';
+
+{!
+	@function CFArrayApplyFunction
+	Calls a function once for each value in the array.
+	@param theArray The array to be operated upon. If this parameter is not
+		a valid CFArray, the behavior is undefined.
+	@param range The range of values within the array to which to apply
+		the function. If the range location or end point (defined by
+		the location plus length minus 1) is outside the index
+		space of the array (0 to N-1 inclusive, where N is the count
+		of the array), the behavior is undefined. If the range
+		length is negative, the behavior is undefined. The range may
+		be empty (length 0).
+	@param applier The callback function to call once for each value in
+		the given range in the array. If this parameter is not a
+		pointer to a function of the correct prototype, the behavior
+		is undefined. If there are values in the range which the
+		applier function does not expect or cannot properly apply
+		to, the behavior is undefined. 
+	@param context A pointer-sized user-defined value, which is passed
+		as the second parameter to the applier function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the applier function, the behavior is
+		undefined.
+}
+procedure CFArrayApplyFunction( theArray: CFArrayRef; range: CFRange; applier: CFArrayApplierFunction; context: UnivPtr ); external name '_CFArrayApplyFunction';
+
+{!
+	@function CFArrayGetFirstIndexOfValue
+	Searches the array for the value.
+	@param theArray The array to be searched. If this parameter is not a
+		valid CFArray, the behavior is undefined.
+	@param range The range within the array to search. If the range
+		location or end point (defined by the location plus length
+		minus 1) is outside the index space of the array (0 to
+		N-1 inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0).
+		The search progresses from the smallest index defined by
+		the range to the largest.
+	@param value The value for which to find a match in the array. The
+		equal() callback provided when the array was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the array, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result The lowest index of the matching values in the range, or
+		kCFNotFound if no value in the range matched.
+}
+function CFArrayGetFirstIndexOfValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): CFIndex; external name '_CFArrayGetFirstIndexOfValue';
+
+{!
+	@function CFArrayGetLastIndexOfValue
+	Searches the array for the value.
+	@param theArray The array to be searched. If this parameter is not a
+		valid CFArray, the behavior is undefined.
+	@param range The range within the array to search. If the range
+		location or end point (defined by the location plus length
+		minus 1) is outside the index space of the array (0 to
+		N-1 inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0).
+		The search progresses from the largest index defined by the
+		range to the smallest.
+	@param value The value for which to find a match in the array. The
+		equal() callback provided when the array was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the array, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result The highest index of the matching values in the range, or
+		kCFNotFound if no value in the range matched.
+}
+function CFArrayGetLastIndexOfValue( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr ): CFIndex; external name '_CFArrayGetLastIndexOfValue';
+
+{!
+	@function CFArrayBSearchValues
+	Searches the array for the value using a binary search algorithm.
+	@param theArray The array to be searched. If this parameter is not a
+		valid CFArray, the behavior is undefined. If the array is
+		not sorted from least to greatest according to the
+		comparator function, the behavior is undefined.
+	@param range The range within the array to search. If the range
+		location or end point (defined by the location plus length
+		minus 1) is outside the index space of the array (0 to
+		N-1 inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0).
+	@param value The value for which to find a match in the array. If
+		value, or any of the values in the array, are not understood
+		by the comparator callback, the behavior is undefined.
+	@param comparator The function with the comparator function type
+		signature which is used in the binary search operation to
+		compare values in the array with the given value. If this
+		parameter is not a pointer to a function of the correct
+		prototype, the behavior is undefined. If there are values
+		in the range which the comparator function does not expect
+		or cannot properly compare, the behavior is undefined.
+	@param context A pointer-sized user-defined value, which is passed
+		as the third parameter to the comparator function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the comparator function, the behavior is
+		undefined.
+	@result The return value is either 1) the index of a value that
+		matched, if the target value matches one or more in the
+		range, 2) greater than or equal to the end point of the
+		range, if the value is greater than all the values in the
+		range, or 3) the index of the value greater than the target
+		value, if the value lies between two of (or less than all
+		of) the values in the range.
+}
+function CFArrayBSearchValues( theArray: CFArrayRef; range: CFRange; value: {const} UnivPtr; comparator: CFComparatorFunction; context: UnivPtr ): CFIndex; external name '_CFArrayBSearchValues';
+
+{!
+	@function CFArrayAppendValue
+	Adds the value to the array giving it a new largest index.
+	@param theArray The array to which the value is to be added. If this
+		parameter is not a valid mutable CFArray, the behavior is
+		undefined. If the array is a fixed-capacity array and it
+		is full before this operation, the behavior is undefined.
+	@param value The value to add to the array. The value is retained by
+		the array using the retain callback provided when the array
+		was created. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined. The value is
+		assigned to the index one larger than the previous largest
+		index, and the count of the array is increased by one.
+}
+procedure CFArrayAppendValue( theArray: CFMutableArrayRef; value: {const} UnivPtr ); external name '_CFArrayAppendValue';
+
+{!
+	@function CFArrayInsertValueAtIndex
+	Adds the value to the array, giving it the given index.
+	@param theArray The array to which the value is to be added. If this
+		parameter is not a valid mutable CFArray, the behavior is
+		undefined. If the array is a fixed-capacity array and it
+		is full before this operation, the behavior is undefined.
+	@param idx The index to which to add the new value. If the index is
+		outside the index space of the array (0 to N inclusive,
+		where N is the count of the array before the operation), the
+		behavior is undefined. If the index is the same as N, this
+		function has the same effect as CFArrayAppendValue().
+	@param value The value to add to the array. The value is retained by
+		the array using the retain callback provided when the array
+		was created. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined. The value is
+		assigned to the given index, and all values with equal and
+		larger indices have their indexes increased by one.
+}
+procedure CFArrayInsertValueAtIndex( theArray: CFMutableArrayRef; idx: CFIndex; value: {const} UnivPtr ); external name '_CFArrayInsertValueAtIndex';
+
+{!
+	@function CFArraySetValueAtIndex
+	Changes the value with the given index in the array.
+	@param theArray The array in which the value is to be changed. If this
+		parameter is not a valid mutable CFArray, the behavior is
+		undefined. If the array is a fixed-capacity array and it
+		is full before this operation and the index is the same as
+		N, the behavior is undefined.
+	@param idx The index to which to set the new value. If the index is
+		outside the index space of the array (0 to N inclusive,
+		where N is the count of the array before the operation), the
+		behavior is undefined. If the index is the same as N, this
+		function has the same effect as CFArrayAppendValue().
+	@param value The value to set in the array. The value is retained by
+		the array using the retain callback provided when the array
+		was created, and the previous value with that index is
+		released. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined. The indices of
+		other values is not affected.
+}
+procedure CFArraySetValueAtIndex( theArray: CFMutableArrayRef; idx: CFIndex; value: {const} UnivPtr ); external name '_CFArraySetValueAtIndex';
+
+{!
+	@function CFArrayRemoveValueAtIndex
+	Removes the value with the given index from the array.
+	@param theArray The array from which the value is to be removed. If
+		this parameter is not a valid mutable CFArray, the behavior
+		is undefined.
+	@param idx The index from which to remove the value. If the index is
+		outside the index space of the array (0 to N-1 inclusive,
+		where N is the count of the array before the operation), the
+		behavior is undefined.
+}
+procedure CFArrayRemoveValueAtIndex( theArray: CFMutableArrayRef; idx: CFIndex ); external name '_CFArrayRemoveValueAtIndex';
+
+{!
+	@function CFArrayRemoveAllValues
+	Removes all the values from the array, making it empty.
+	@param theArray The array from which all of the values are to be
+		removed. If this parameter is not a valid mutable CFArray,
+		the behavior is undefined.
+}
+procedure CFArrayRemoveAllValues( theArray: CFMutableArrayRef ); external name '_CFArrayRemoveAllValues';
+
+{!
+	@function CFArrayReplaceValues
+	Replaces a range of values in the array.
+	@param theArray The array from which all of the values are to be
+		removed. If this parameter is not a valid mutable CFArray,
+		the behavior is undefined.
+	@param range The range of values within the array to replace. If the
+		range location or end point (defined by the location plus
+		length minus 1) is outside the index space of the array (0
+		to N inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0),
+		in which case the new values are merely inserted at the
+		range location.
+	@param newValues A C array of the pointer-sized values to be placed
+		into the array. The new values in the array are ordered in
+		the same order in which they appear in this C array. This
+		parameter may be NULL if the newCount parameter is 0. This
+		C array is not changed or freed by this function. If this
+		parameter is not a valid pointer to a C array of at least
+		newCount pointers, the behavior is undefined.
+	@param newCount The number of values to copy from the values C
+		array into the CFArray. If this parameter is different than
+		the range length, the excess newCount values will be
+		inserted after the range, or the excess range values will be
+		deleted. This parameter may be 0, in which case no new
+		values are replaced into the array and the values in the
+		range are simply removed. If this parameter is negative, or
+		greater than the number of values actually in the newValues
+		C array, the behavior is undefined.
+}
+procedure CFArrayReplaceValues( theArray: CFMutableArrayRef; range: CFRange; {const} newValues: {variable-size-array} UnivPtrPtr; newCount: CFIndex ); external name '_CFArrayReplaceValues';
+
+{!
+	@function CFArrayExchangeValuesAtIndices
+	Exchanges the values at two indices of the array.
+	@param theArray The array of which the values are to be swapped. If
+		this parameter is not a valid mutable CFArray, the behavior
+		is undefined.
+	@param idx1 The first index whose values should be swapped. If the
+		index is outside the index space of the array (0 to N-1
+		inclusive, where N is the count of the array before the
+		operation), the behavior is undefined.
+	@param idx2 The second index whose values should be swapped. If the
+		index is outside the index space of the array (0 to N-1
+		inclusive, where N is the count of the array before the
+		operation), the behavior is undefined.
+}
+procedure CFArrayExchangeValuesAtIndices( theArray: CFMutableArrayRef; idx1: CFIndex; idx2: CFIndex ); external name '_CFArrayExchangeValuesAtIndices';
+
+{!
+	@function CFArraySortValues
+	Sorts the values in the array using the given comparison function.
+	@param theArray The array whose values are to be sorted. If this
+		parameter is not a valid mutable CFArray, the behavior is
+		undefined.
+	@param range The range of values within the array to sort. If the
+		range location or end point (defined by the location plus
+		length minus 1) is outside the index space of the array (0
+		to N-1 inclusive, where N is the count of the array), the
+		behavior is undefined. If the range length is negative, the
+		behavior is undefined. The range may be empty (length 0).
+	@param comparator The function with the comparator function type
+		signature which is used in the sort operation to compare
+		values in the array with the given value. If this parameter
+		is not a pointer to a function of the correct prototype, the
+		the behavior is undefined. If there are values in the array
+		which the comparator function does not expect or cannot
+		properly compare, the behavior is undefined. The values in
+		the range are sorted from least to greatest according to
+		this function.
+	@param context A pointer-sized user-defined value, which is passed
+		as the third parameter to the comparator function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the comparator function, the behavior is
+		undefined.
+}
+procedure CFArraySortValues( theArray: CFMutableArrayRef; range: CFRange; comparator: CFComparatorFunction; context: UnivPtr ); external name '_CFArraySortValues';
+
+{!
+	@function CFArrayAppendArray
+	Adds the values from an array to another array.
+	@param theArray The array to which values from the otherArray are to
+		be added. If this parameter is not a valid mutable CFArray,
+		the behavior is undefined. If the array is a fixed-capacity
+		array and adding range.length values from the otherArray
+		exceeds the capacity of the array, the behavior is
+		undefined.
+	@param otherArray The array providing the values to be added to the
+		array. If this parameter is not a valid CFArray, the
+		behavior is undefined.
+	@param otherRange The range within the otherArray from which to add
+		the values to the array. If the range location or end point
+		(defined by the location plus length minus 1) is outside
+		the index space of the otherArray (0 to N-1 inclusive, where
+		N is the count of the otherArray), the behavior is
+		undefined. The new values are retained by the array using
+		the retain callback provided when the array was created. If
+		the values are not of the sort expected by the retain
+		callback, the behavior is undefined. The values are assigned
+		to the indices one larger than the previous largest index
+		in the array, and beyond, and the count of the array is
+		increased by range.length. The values are assigned new
+		indices in the array from smallest to largest index in the
+		order in which they appear in the otherArray.
+}
+procedure CFArrayAppendArray( theArray: CFMutableArrayRef; otherArray: CFArrayRef; otherRange: CFRange ); external name '_CFArrayAppendArray';
+
+
+end.

+ 245 - 0
packages/extra/univint/CFAttributedString.pas

@@ -0,0 +1,245 @@
+{	CFAttributedString.h
+	Copyright (c) 2004-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFAttributedString;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFString,CFDictionary;
+{$ALIGN POWER}
+
+
+{! @header CFAttributedString
+Instance of CFAttributedString manage character strings and associated sets of attributes (for example, font and kerning) that apply to individual characters or ranges of characters in the string. CFAttributedString as defined in CoreFoundation provides the basic container functionality, while higher levels provide definitions for standard attributes, their values, and additional behaviors involving these. 
+
+CFAttributedString is not a "subclass" of CFString; that is, it does not respond to CFString function calls. CFAttributedString conceptually contains a CFString to which it applies attributes. This protects users of attributed strings from ambiguities caused by the semantic differences between simple and attributed string.
+
+Attributes are identified by key/value pairs stored in CFDictionaryRefs. Keys must be CFStrings, while the values are arbitrary CFTypeRefs.
+}
+
+
+{ CFAttributedString comes in immutable and mutable flavors.
+}
+type
+	CFAttributedStringRef = ^SInt32; { an opaque 32-bit type }
+	CFMutableAttributedStringRef = ^SInt32; { an opaque 32-bit type }
+
+{! @function CFAttributedStringGetTypeID
+Returns the type identifier of all CFAttributedString instances.
+}
+function CFAttributedStringGetTypeID: CFTypeID; external name '_CFAttributedStringGetTypeID';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+{** CFAttributedString **}
+
+{! @function CFAttributedStringCreate
+Creates an attributed string with the specified string and attributes (both copied).
+}
+function CFAttributedStringCreate( alloc: CFAllocatorRef; str: CFStringRef; attributes: CFDictionaryRef ): CFAttributedStringRef; external name '_CFAttributedStringCreate';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringCreateWithSubstring
+Creates a sub-attributed string from the specified range. It's a programming error for range to specify characters outside the bounds of aStr.
+}
+function CFAttributedStringCreateWithSubstring( alloc: CFAllocatorRef; aStr: CFAttributedStringRef; range: CFRange ): CFAttributedStringRef; external name '_CFAttributedStringCreateWithSubstring';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringCreateCopy
+Creates an immutable attributed string copy.
+}
+function CFAttributedStringCreateCopy( alloc: CFAllocatorRef; aStr: CFAttributedStringRef ): CFAttributedStringRef; external name '_CFAttributedStringCreateCopy';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetString
+Returns the string for the attributed string. For performance reasons, this will often point at the backing store of the attributed string, and it might change if the attributed string is edited.  However, this is an implementation detail, and definitely not something that should be counted on.
+}
+function CFAttributedStringGetString( aStr: CFAttributedStringRef ): CFStringRef; external name '_CFAttributedStringGetString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetLength
+Returns the length of the attributed string in characters; same as CFStringGetLength(CFAttributedStringGetString(aStr))
+}
+function CFAttributedStringGetLength( aStr: CFAttributedStringRef ): CFIndex; external name '_CFAttributedStringGetLength';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetAttributes
+Returns the attributes at the specified location. If effectiveRange is not NULL, upon return *effectiveRange contains a range over which the exact same set of attributes apply. Note that for performance reasons, the returned effectiveRange is not necessarily the maximal range - for that, use CFAttributedStringGetAttributesAndLongestEffectiveRange().  It's a programming error for loc to specify a location outside the bounds of the attributed string.
+
+Note that the returned attribute dictionary might change in unpredicatable ways from under the caller if the attributed string is edited after this call. If you wish to hang on to the dictionary long-term, you should make an actual copy of it rather than just retaining it.  Also, no assumptions should be made about the relationship of the actual CFDictionaryRef returned by this call and the dictionary originally used to set the attributes, other than the fact that the values stored in the dictionary will be identical (that is, ==) to those originally specified.
+}
+function CFAttributedStringGetAttributes( aStr: CFAttributedStringRef; loc: CFIndex; effectiveRange: CFRangePtr ): CFDictionaryRef; external name '_CFAttributedStringGetAttributes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetAttribute
+Returns the value of a single attribute at the specified location. If the specified attribute doesn't exist at the location, returns NULL. If effectiveRange is not NULL, upon return *effectiveRange contains a range over which the exact same attribute value applies. Note that for performance reasons, the returned effectiveRange is not necessarily the maximal range - for that, use CFAttributedStringGetAttributeAndLongestEffectiveRange(). It's a programming error for loc to specify a location outside the bounds of the attributed string.
+}
+function CFAttributedStringGetAttribute( aStr: CFAttributedStringRef; loc: CFIndex; attrName: CFStringRef; effectiveRange: CFRangePtr ): CFTypeRef; external name '_CFAttributedStringGetAttribute';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetAttributesAndLongestEffectiveRange
+Returns the attributes at the specified location. If longestEffectiveRange is not NULL, upon return *longestEffectiveRange contains the maximal range within inRange over which the exact same set of attributes apply. The returned range is clipped to inRange. It's a programming error for loc or inRange to specify locations outside the bounds of the attributed string.
+}
+function CFAttributedStringGetAttributesAndLongestEffectiveRange( aStr: CFAttributedStringRef; loc: CFIndex; inRange: CFRange; longestEffectiveRange: CFRangePtr ): CFDictionaryRef; external name '_CFAttributedStringGetAttributesAndLongestEffectiveRange';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetAttributeAndLongestEffectiveRange
+Returns the value of a single attribute at the specified location. If longestEffectiveRange is not NULL, upon return *longestEffectiveRange contains the maximal range within inRange over which the exact same attribute value applies. The returned range is clipped to inRange. It's a programming error for loc or inRange to specify locations outside the bounds of the attributed string.
+}
+function CFAttributedStringGetAttributeAndLongestEffectiveRange( aStr: CFAttributedStringRef; loc: CFIndex; attrName: CFStringRef; inRange: CFRange; longestEffectiveRange: CFRangePtr ): CFTypeRef; external name '_CFAttributedStringGetAttributeAndLongestEffectiveRange';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+{** CFMutableAttributedString **}
+
+{! @function CFAttributedStringCreateMutableCopy
+Creates a mutable attributed string copy. maxLength, if not 0, is a hard bound on the length of the attributed string; exceeding this size limit during any editing operation is a programming error. If 0, there is no limit on the length.
+}
+function CFAttributedStringCreateMutableCopy( alloc: CFAllocatorRef; maxLength: CFIndex; aStr: CFAttributedStringRef ): CFMutableAttributedStringRef; external name '_CFAttributedStringCreateMutableCopy';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringCreateMutable
+Creates a mutable empty attributed string. maxLength, if not 0, is a hard bound on the length of the attributed string; exceeding this size limit during any editing operation is a programming error. If 0, there is no limit on the length.
+}
+function CFAttributedStringCreateMutable( alloc: CFAllocatorRef; maxLength: CFIndex ): CFMutableAttributedStringRef; external name '_CFAttributedStringCreateMutable';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringReplaceString
+Modifies the string for the attributed string, much like CFStringReplace().  It's an error for range to specify characters outside the bounds of aStr. 
+
+(Note: This function is a convenience on CFAttributedStringGetMutableString(); however, until CFAttributedStringGetMutableString() is implemented, it remains the only way to edit the string of the attributed string.)
+}
+procedure CFAttributedStringReplaceString( aStr: CFMutableAttributedStringRef; range: CFRange; replacement: CFStringRef ); external name '_CFAttributedStringReplaceString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringGetMutableString
+Gets the string for the attributed string as a mutable string, allowing editing the character contents of the string as if it were an CFMutableString. Attributes corresponding to the edited range are appropriately modified. If, as a result of the edit, new characters are introduced into the string, they inherit the attributes of the first replaced character from range. If no existing characters are replaced by the edit, the new characters inherit the attributes of the character preceding range if it has any, otherwise of the character following range. If the initial string is empty, the attributes for the new characters are also empty.
+
+(Note: This function is not yet implemented and will return NULL except for toll-free bridged instances.)
+}
+function CFAttributedStringGetMutableString( aStr: CFMutableAttributedStringRef ): CFMutableStringRef; external name '_CFAttributedStringGetMutableString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringSetAttributes
+Sets the value of multiple attributes over the specified range, which should be valid. If clearOtherAttributes is false, existing attributes (which aren't being replaced) are left alone; otherwise they are cleared. The dictionary should be setup for "usual" CF type usage --- CFString keys, and arbitrary CFType values. Note that after this call, further mutations to the replacement dictionary argument by the caller will not affect the contents of the attributed string.
+}
+procedure CFAttributedStringSetAttributes( aStr: CFMutableAttributedStringRef; range: CFRange; replacement: CFDictionaryRef; clearOtherAttributes: Boolean ); external name '_CFAttributedStringSetAttributes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringSetAttribute
+Sets the value of a single attribute over the specified range, which should be valid. value should not be NULL. 
+}
+procedure CFAttributedStringSetAttribute( aStr: CFMutableAttributedStringRef; range: CFRange; attrName: CFStringRef; value: CFTypeRef ); external name '_CFAttributedStringSetAttribute';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringRemoveAttribute
+Removes the value of a single attribute over the specified range, which should be valid. It's OK for the attribute not the exist over the specified range.
+}
+procedure CFAttributedStringRemoveAttribute( aStr: CFMutableAttributedStringRef; range: CFRange; attrName: CFStringRef ); external name '_CFAttributedStringRemoveAttribute';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringReplaceAttributedString
+Replaces the attributed substring over the specified range with the attributed string specified in replacement. range should be valid. To delete a range of the attributed string, call CFAttributedStringReplaceString() with empty string and specified range. 
+}
+procedure CFAttributedStringReplaceAttributedString( aStr: CFMutableAttributedStringRef; range: CFRange; replacement: CFAttributedStringRef ); external name '_CFAttributedStringReplaceAttributedString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringBeginEditing
+In cases where attributed string might do a bunch of work to assure self-consistency, CFAttributedStringBeginEditing/CFAttributedStringEndEditing allow disabling that to allow deferring and coalescing any work. It's a good idea to call these around a set of related mutation calls which don't require the string to be in consistent state in between. These calls can be nested. 
+}
+procedure CFAttributedStringBeginEditing( aStr: CFMutableAttributedStringRef ); external name '_CFAttributedStringBeginEditing';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{! @function CFAttributedStringEndEditing
+In cases where attributed string might do a bunch of work to assure self-consistency, CFAttributedStringBeginEditing/CFAttributedStringEndEditing allow disabling that to allow deferring and coalescing any work. It's a good idea to call these around a set of related mutation calls which don't require the string to be in consistent state in between. These calls can be nested. 
+}
+procedure CFAttributedStringEndEditing( aStr: CFMutableAttributedStringRef ); external name '_CFAttributedStringEndEditing';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+end.

+ 160 - 0
packages/extra/univint/CFBag.pas

@@ -0,0 +1,160 @@
+{	CFBag.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFBag;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+type
+	CFBagRetainCallBack = function( allocator: CFAllocatorRef; value: {const} UnivPtr ): UnivPtr;
+	CFBagReleaseCallBack = procedure( allocator: CFAllocatorRef; value: {const} UnivPtr );
+	CFBagCopyDescriptionCallBack = function( value: {const} UnivPtr ): CFStringRef;
+	CFBagEqualCallBack = function( value1: {const} UnivPtr; value2: {const} UnivPtr ): Boolean;
+	CFBagHashCallBack = function( value: {const} UnivPtr ): CFHashCode;
+	CFBagCallBacksPtr = ^CFBagCallBacks;
+	CFBagCallBacks = record
+		version: CFIndex;
+		retain: CFBagRetainCallBack;
+		release: CFBagReleaseCallBack;
+		copyDescription: CFBagCopyDescriptionCallBack;
+		equal: CFBagEqualCallBack;
+		hash: CFBagHashCallBack;
+	end;
+
+var kCFTypeBagCallBacks: CFBagCallBacks; external name '_kCFTypeBagCallBacks'; (* attribute const *)
+var kCFCopyStringBagCallBacks: CFBagCallBacks; external name '_kCFCopyStringBagCallBacks'; (* attribute const *)
+
+type
+	CFBagApplierFunction = procedure( value: {const} UnivPtr; context: UnivPtr );
+
+type
+	CFBagRef = ^SInt32; { an opaque 32-bit type }
+	CFBagRefPtr = ^CFBagRef;
+	CFMutableBagRef = CFBagRef;
+	CFMutableBagRefPtr = ^CFMutableBagRef;
+
+function CFBagGetTypeID: CFTypeID; external name '_CFBagGetTypeID';
+
+function CFBagCreate( allocator: CFAllocatorRef; {const} values: {variable-size-array} UnivPtrPtr; numValues: CFIndex; {const} callBacks: CFBagCallBacksPtr { can be NULL } ): CFBagRef; external name '_CFBagCreate';
+
+function CFBagCreateCopy( allocator: CFAllocatorRef; theBag: CFBagRef ): CFBagRef; external name '_CFBagCreateCopy';
+
+function CFBagCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex; callBacks: CFBagCallBacksPtr ): CFMutableBagRef; external name '_CFBagCreateMutable';
+
+function CFBagCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theBag: CFBagRef ): CFMutableBagRef; external name '_CFBagCreateMutableCopy';
+
+function CFBagGetCount( theBag: CFBagRef ): CFIndex; external name '_CFBagGetCount';
+
+function CFBagGetCountOfValue( theBag: CFBagRef; value: {const} UnivPtr ): CFIndex; external name '_CFBagGetCountOfValue';
+
+function CFBagContainsValue( theBag: CFBagRef; value: {const} UnivPtr ): Boolean; external name '_CFBagContainsValue';
+
+function CFBagGetValue( theBag: CFBagRef; value: {const} UnivPtr ): UnivPtr; external name '_CFBagGetValue';
+
+function CFBagGetValueIfPresent( theBag: CFBagRef; candidate: {const} UnivPtr; var value: UnivPtr ): Boolean; external name '_CFBagGetValueIfPresent';
+
+procedure CFBagGetValues( theBag: CFBagRef; {const} values: {variable-size-array} UnivPtrPtr ); external name '_CFBagGetValues';
+
+procedure CFBagApplyFunction( theBag: CFBagRef; applier: CFBagApplierFunction; context: UnivPtr ); external name '_CFBagApplyFunction';
+
+procedure CFBagAddValue( theBag: CFMutableBagRef; value: {const} UnivPtr ); external name '_CFBagAddValue';
+
+procedure CFBagReplaceValue( theBag: CFMutableBagRef; value: {const} UnivPtr ); external name '_CFBagReplaceValue';
+
+procedure CFBagSetValue( theBag: CFMutableBagRef; value: {const} UnivPtr ); external name '_CFBagSetValue';
+
+procedure CFBagRemoveValue( theBag: CFMutableBagRef; value: {const} UnivPtr ); external name '_CFBagRemoveValue';
+
+procedure CFBagRemoveAllValues( theBag: CFMutableBagRef ); external name '_CFBagRemoveAllValues';
+
+
+end.

+ 330 - 0
packages/extra/univint/CFBase.pas

@@ -0,0 +1,330 @@
+{	CFBase.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFBase;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes;
+{$ALIGN POWER}
+
+
+var kCFCoreFoundationVersionNumber: Float64; external name '_kCFCoreFoundationVersionNumber'; (* attribute const *)
+
+const
+	kCFCoreFoundationVersionNumber10_0 = 196.4;
+const
+	kCFCoreFoundationVersionNumber10_0_3 = 196.5;
+const
+	kCFCoreFoundationVersionNumber10_1 = 226.0;
+{ Note the next two do not follow the usual numbering policy from the base release }
+const
+	kCFCoreFoundationVersionNumber10_1_2 = 227.2;
+const
+	kCFCoreFoundationVersionNumber10_1_4 = 227.3;
+const
+	kCFCoreFoundationVersionNumber10_2 = 263.0;
+const
+	kCFCoreFoundationVersionNumber10_3 = 299.0;
+const
+	kCFCoreFoundationVersionNumber10_3_3 = 299.3;
+const
+	kCFCoreFoundationVersionNumber10_3_4 = 299.31;
+
+{$ifc TARGET_CPU_PPC_64}
+type
+	CFTypeID = UInt32;
+	CFOptionFlags = UInt64;
+	CFHashCode = UInt32;
+	CFIndex = SInt64;
+	CFIndexPtr = ^CFIndex;
+{$elsec}
+type
+	CFTypeID = UInt32;
+	CFOptionFlags = UInt32;
+	CFHashCode = UInt32;
+	CFIndex = SInt32;
+	CFIndexPtr = ^CFIndex;
+{$endc}
+
+{ Base "type" of all "CF objects", and polymorphic functions on them }
+type
+	CFTypeRef = ^SInt32; { an opaque 32-bit type }
+
+type
+	CFStringRef = ^SInt32; { an opaque 32-bit type }
+	CFStringRefPtr = ^CFStringRef;
+	CFMutableStringRef = ^SInt32; { an opaque 32-bit type }
+	CFMutableStringRefPtr = ^CFMutableStringRef;
+
+{
+        Type to mean any instance of a property list type;
+        currently, CFString, CFData, CFNumber, CFBoolean, CFDate,
+        CFArray, and CFDictionary.
+}
+type
+	CFPropertyListRef = CFTypeRef;
+
+{ Values returned from comparison functions }
+	CFComparisonResult = SInt32;
+const
+	kCFCompareLessThan = -1;
+	kCFCompareEqualTo = 0;
+	kCFCompareGreaterThan = 1;
+
+{ A standard comparison function }
+type
+	CFComparatorFunction = function( val1: {const} UnivPtr; val2: {const} UnivPtr; context: UnivPtr ): CFComparisonResult;
+
+{ Constant used by some functions to indicate failed searches. }
+{ This is of type CFIndex. }
+const
+	kCFNotFound = -1;
+
+
+{ Range type }
+type
+	CFRangePtr = ^CFRange;
+	CFRange = record
+		location: CFIndex;
+		length: CFIndex;
+	end;
+
+function CFRangeMake( loc: CFIndex; len: CFIndex ): CFRange; external name '___CFRangeMake';
+
+{ Private; do not use }
+function __CFRangeMake( loc: CFIndex; len: CFIndex ): CFRange; external name '___CFRangeMake';
+
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ Null representant }
+
+type
+	CFNullRef = ^SInt32; { an opaque 32-bit type }
+
+function CFNullGetTypeID: CFTypeID; external name '_CFNullGetTypeID';
+
+var kCFNull: CFNullRef; external name '_kCFNull'; (* attribute const *)	// the singleton null instance
+
+{#endif}
+
+
+{ Allocator API
+
+   Most of the time when specifying an allocator to Create functions, the NULL
+   argument indicates "use the default"; this is the same as using kCFAllocatorDefault
+   or the return value from CFAllocatorGetDefault().  This assures that you will use
+   the allocator in effect at that time.
+
+   You should rarely use kCFAllocatorSystemDefault, the default default allocator.
+}
+type
+	CFAllocatorRef = ^SInt32; { an opaque 32-bit type }
+	CFAllocatorRefPtr = ^CFAllocatorRef;
+
+{ This is a synonym for NULL, if you'd rather use a named constant. }
+var kCFAllocatorDefault: CFAllocatorRef; external name '_kCFAllocatorDefault'; (* attribute const *)
+
+{ Default system allocator; you rarely need to use this. }
+var kCFAllocatorSystemDefault: CFAllocatorRef; external name '_kCFAllocatorSystemDefault'; (* attribute const *)
+
+{ This allocator uses malloc(), realloc(), and free(). This should not be
+   generally used; stick to kCFAllocatorDefault whenever possible. This
+   allocator is useful as the "bytesDeallocator" in CFData or
+   "contentsDeallocator" in CFString where the memory was obtained as a
+   result of malloc() type functions.
+}
+var kCFAllocatorMalloc: CFAllocatorRef; external name '_kCFAllocatorMalloc'; (* attribute const *)
+
+{ This allocator explicitly uses the default malloc zone, returned by
+   malloc_default_zone(). It should only be used when an object is
+   safe to be allocated in non-scanned memory.
+ }
+var kCFAllocatorMallocZone: CFAllocatorRef; external name '_kCFAllocatorMallocZone'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Null allocator which does nothing and allocates no memory. This allocator
+   is useful as the "bytesDeallocator" in CFData or "contentsDeallocator"
+   in CFString where the memory should not be freed. 
+}
+var kCFAllocatorNull: CFAllocatorRef; external name '_kCFAllocatorNull'; (* attribute const *)
+
+{ Special allocator argument to CFAllocatorCreate() which means
+   "use the functions given in the context to allocate the allocator
+   itself as well". 
+}
+var kCFAllocatorUseContext: CFAllocatorRef; external name '_kCFAllocatorUseContext'; (* attribute const *)
+
+type
+	CFAllocatorRetainCallBack = function( info: {const} UnivPtr ): UnivPtr;
+	CFAllocatorReleaseCallBack = procedure( info: {const} UnivPtr );
+	CFAllocatorCopyDescriptionCallBack = function( info: {const} UnivPtr ): CFStringRef;
+	CFAllocatorAllocateCallBack = function( allocSize: CFIndex; hint: CFOptionFlags; info: UnivPtr ): UnivPtr;
+	CFAllocatorReallocateCallBack = function( ptr: UnivPtr; newsize: CFIndex; hint: CFOptionFlags; info: UnivPtr ): UnivPtr;
+	CFAllocatorDeallocateCallBack = procedure( ptr: UnivPtr; info: UnivPtr );
+	CFAllocatorPreferredSizeCallBack = function( size: CFIndex; hint: CFOptionFlags; info: UnivPtr ): CFIndex;
+	CFAllocatorContextPtr = ^CFAllocatorContext;
+	CFAllocatorContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: CFAllocatorRetainCallBack;
+		release: CFAllocatorReleaseCallBack;        
+		copyDescription: CFAllocatorCopyDescriptionCallBack;
+		allocate: CFAllocatorAllocateCallBack;
+		reallocate: CFAllocatorReallocateCallBack;
+		deallocate: CFAllocatorDeallocateCallBack;
+		preferredSize: CFAllocatorPreferredSizeCallBack;
+	end;
+
+function CFAllocatorGetTypeID: CFTypeID; external name '_CFAllocatorGetTypeID';
+
+{
+	CFAllocatorSetDefault() sets the allocator that is used in the current
+	thread whenever NULL is specified as an allocator argument. This means
+	that most, if not all allocations will go through this allocator. It
+	also means that any allocator set as the default needs to be ready to
+	deal with arbitrary memory allocation requests; in addition, the size
+	and number of requests will change between releases.
+
+	An allocator set as the default will never be released, even if later
+	another allocator replaces it as the default. Not only is it impractical
+	for it to be released (as there might be caches created under the covers
+	that refer to the allocator), in general it's also safer and more
+	efficient to keep it around.
+
+	If you wish to use a custom allocator in a context, it's best to provide
+	it as the argument to the various creation functions rather than setting
+	it as the default. Setting the default allocator is not encouraged.
+
+	If you do set an allocator as the default, either do it for all time in
+	your app, or do it in a nested fashion (by restoring the previous allocator
+	when you exit your context). The latter might be appropriate for plug-ins
+	or libraries that wish to set the default allocator.
+}
+procedure CFAllocatorSetDefault( allocator: CFAllocatorRef ); external name '_CFAllocatorSetDefault';
+
+function CFAllocatorGetDefault: CFAllocatorRef; external name '_CFAllocatorGetDefault';
+
+function CFAllocatorCreate( allocator: CFAllocatorRef; var context: CFAllocatorContext ): CFAllocatorRef; external name '_CFAllocatorCreate';
+
+function CFAllocatorAllocate( allocator: CFAllocatorRef; size: CFIndex; hint: CFOptionFlags ): UnivPtr; external name '_CFAllocatorAllocate';
+
+function CFAllocatorReallocate( allocator: CFAllocatorRef; ptr: UnivPtr; newsize: CFIndex; hint: CFOptionFlags ): UnivPtr; external name '_CFAllocatorReallocate';
+
+procedure CFAllocatorDeallocate( allocator: CFAllocatorRef; ptr: UnivPtr ); external name '_CFAllocatorDeallocate';
+
+function CFAllocatorGetPreferredSizeForSize( allocator: CFAllocatorRef; size: CFIndex; hint: CFOptionFlags ): CFIndex; external name '_CFAllocatorGetPreferredSizeForSize';
+
+procedure CFAllocatorGetContext( allocator: CFAllocatorRef; var context: CFAllocatorContext ); external name '_CFAllocatorGetContext';
+
+
+{ Polymorphic CF functions }
+
+function CFGetTypeID( cf: CFTypeRef ): CFTypeID; external name '_CFGetTypeID';
+
+function CFCopyTypeIDDescription( type_id: CFTypeID ): CFStringRef; external name '_CFCopyTypeIDDescription';
+
+function CFRetain( cf: CFTypeRef ): CFTypeRef; external name '_CFRetain';
+
+procedure CFRelease( cf: CFTypeRef ); external name '_CFRelease';
+
+function CFGetRetainCount( cf: CFTypeRef ): CFIndex; external name '_CFGetRetainCount';
+
+function CFMakeCollectable( cf: CFTypeRef ): CFTypeRef; external name '_CFMakeCollectable';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFEqual( cf1: CFTypeRef; cf2: CFTypeRef ): Boolean; external name '_CFEqual';
+
+function CFHash( cf: CFTypeRef ): CFHashCode; external name '_CFHash';
+
+function CFCopyDescription( cf: CFTypeRef ): CFStringRef; external name '_CFCopyDescription';
+
+function CFGetAllocator( cf: CFTypeRef ): CFAllocatorRef; external name '_CFGetAllocator';
+
+
+end.

+ 381 - 0
packages/extra/univint/CFBinaryHeap.pas

@@ -0,0 +1,381 @@
+{	CFBinaryHeap.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFBinaryHeap;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+{!
+        @header CFBinaryHeap
+        CFBinaryHeap implements a container which stores values sorted using
+        a binary search algorithm.  CFBinaryHeaps can be useful as priority
+	queues.
+}
+
+
+type
+	CFBinaryHeapCompareContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+	CFBinaryHeapCompareContextPtr = ^CFBinaryHeapCompareContext;
+
+{!
+        @typedef CFBinaryHeapCallBacks
+	Structure containing the callbacks for values of a CFBinaryHeap.
+        @field version The version number of the structure type being passed
+                in as a parameter to the CFBinaryHeap creation functions.
+                This structure is version 0.
+	@field retain The callback used to add a retain for the binary heap
+		on values as they are put into the binary heap.
+		This callback returns the value to use as the value in the
+		binary heap, which is usually the value parameter passed to
+		this callback, but may be a different value if a different
+		value should be added to the binary heap. The binary heap's
+		allocator is passed as the first argument.
+	@field release The callback used to remove a retain previously added
+		for the binary heap from values as they are removed from
+		the binary heap. The binary heap's allocator is passed as the
+		first argument.
+	@field copyDescription The callback used to create a descriptive
+		string representation of each value in the binary heap. This
+		is used by the CFCopyDescription() function.
+	@field compare The callback used to compare values in the binary heap for
+		equality in some operations.
+}
+type
+	CFBinaryHeapCallBacks = record
+	    version: CFIndex;
+		retain: function( allocator: CFAllocatorRef; info: {const} UnivPtr ): UnivPtr;
+		release: procedure( allocator: CFAllocatorRef; info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+		compare: function( info1, info2: {const} UnivPtr; context: UnivPtr ): CFComparisonResult;
+	end;
+	CFBinaryHeapCallBacksPtr = ^CFBinaryHeapCallBacks;
+
+{!
+	@constant kCFStringBinaryHeapCallBacks
+	Predefined CFBinaryHeapCallBacks structure containing a set
+	of callbacks appropriate for use when the values in a CFBinaryHeap
+	are all CFString types.
+}
+var kCFStringBinaryHeapCallBacks: CFBinaryHeapCallBacks; external name '_kCFStringBinaryHeapCallBacks'; (* attribute const *)
+
+{!
+	@typedef CFBinaryHeapApplierFunction
+	Type of the callback function used by the apply functions of
+		CFBinaryHeap.
+	@param value The current value from the binary heap.
+	@param context The user-defined context parameter given to the apply
+		function.
+}
+type
+	CFBinaryHeapApplierFunction = procedure( val: {const} UnivPtr; context: UnivPtr );
+
+{!
+	@typedef CFBinaryHeapRef
+	This is the type of a reference to CFBinaryHeaps.
+}
+type
+	CFBinaryHeapRef = ^SInt32; { an opaque 32-bit type }
+
+{!
+	@function CFBinaryHeapGetTypeID
+	Returns the type identifier of all CFBinaryHeap instances.
+}
+function CFBinaryHeapGetTypeID: CFTypeID; external name '_CFBinaryHeapGetTypeID';
+
+{!
+	@function CFBinaryHeapCreate
+	Creates a new mutable or fixed-mutable binary heap with the given values.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the binary heap and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFBinaryHeap. The binary heap starts empty, and can grow to this
+		number of values (and it can have less). If this parameter
+		is 0, the binary heap's maximum capacity is unlimited (or rather,
+		only limited by address space and available memory
+		constraints). If this parameter is negative, the behavior is
+		undefined.
+	@param callBacks A pointer to a CFBinaryHeapCallBacks structure
+		initialized with the callbacks for the binary heap to use on
+		each value in the binary heap. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a structure
+		on the stack can be passed in, or can be reused for multiple
+		binary heap creations. If the version field of this callbacks
+		structure is not one of the defined ones for CFBinaryHeap, the
+		behavior is undefined. The retain field may be NULL, in which
+		case the CFBinaryHeap will do nothing to add a retain to values
+		as they are put into the binary heap. The release field may be
+		NULL, in which case the CFBinaryHeap will do nothing to remove
+		the binary heap's retain (if any) on the values when the
+		heap is destroyed or a key-value pair is removed. If the
+		copyDescription field is NULL, the binary heap will create a
+		simple description for a value. If the equal field is NULL, the
+		binary heap will use pointer equality to test for equality of
+		values. This callbacks parameter itself may be NULL, which is
+		treated as if a valid structure of version 0 with all fields
+		NULL had been passed in. Otherwise,
+		if any of the fields are not valid pointers to functions
+		of the correct type, or this parameter is not a valid
+		pointer to a CFBinaryHeapCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		binary heap is not one understood by one of the callback functions
+		the behavior when that callback function is used is undefined.
+        @param compareContext A pointer to a CFBinaryHeapCompareContext structure.
+	@result A reference to the new CFBinaryHeap.
+}
+function CFBinaryHeapCreate( allocator: CFAllocatorRef; capacity: CFIndex; callBacks: CFBinaryHeapCallBacksPtr; const (*var*) compareContext: CFBinaryHeapCompareContext ): CFBinaryHeapRef; external name '_CFBinaryHeapCreate';
+
+{!
+	@function CFBinaryHeapCreateCopy
+	Creates a new mutable or fixed-mutable binary heap with the values from the given binary heap.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the binary heap and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFBinaryHeap. The binary heap starts empty, and can grow to this
+		number of values (and it can have less). If this parameter
+		is 0, the binary heap's maximum capacity is unlimited (or rather,
+		only limited by address space and available memory
+		constraints). If this parameter is negative, or less than the number of
+                values in the given binary heap, the behavior is undefined.
+	@param heap The binary heap which is to be copied. The values from the
+		binary heap are copied as pointers into the new binary heap (that is,
+		the values themselves are copied, not that which the values
+		point to, if anything). However, the values are also
+		retained by the new binary heap. The count of the new binary will
+		be the same as the given binary heap. The new binary heap uses the same
+		callbacks as the binary heap to be copied. If this parameter is
+		not a valid CFBinaryHeap, the behavior is undefined.
+	@result A reference to the new mutable or fixed-mutable binary heap.
+}
+function CFBinaryHeapCreateCopy( allocator: CFAllocatorRef; capacity: CFIndex; heap: CFBinaryHeapRef ): CFBinaryHeapRef; external name '_CFBinaryHeapCreateCopy';
+
+{!
+	@function CFBinaryHeapGetCount
+	Returns the number of values currently in the binary heap.
+	@param heap The binary heap to be queried. If this parameter is not a valid
+		CFBinaryHeap, the behavior is undefined.
+	@result The number of values in the binary heap.
+}
+function CFBinaryHeapGetCount( heap: CFBinaryHeapRef ): CFIndex; external name '_CFBinaryHeapGetCount';
+
+{!
+	@function CFBinaryHeapGetCountOfValue
+	Counts the number of times the given value occurs in the binary heap.
+	@param heap The binary heap to be searched. If this parameter is not a
+		valid CFBinaryHeap, the behavior is undefined.
+	@param value The value for which to find matches in the binary heap. The
+		compare() callback provided when the binary heap was created is
+		used to compare. If the compare() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the binary heap, are not understood by the compare() callback,
+		the behavior is undefined.
+	@result The number of times the given value occurs in the binary heap.
+}
+function CFBinaryHeapGetCountOfValue( heap: CFBinaryHeapRef; value: {const} UnivPtr ): CFIndex; external name '_CFBinaryHeapGetCountOfValue';
+
+{!
+	@function CFBinaryHeapContainsValue
+	Reports whether or not the value is in the binary heap.
+	@param heap The binary heap to be searched. If this parameter is not a
+		valid CFBinaryHeap, the behavior is undefined.
+	@param value The value for which to find matches in the binary heap. The
+		compare() callback provided when the binary heap was created is
+		used to compare. If the compare() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the binary heap, are not understood by the compare() callback,
+		the behavior is undefined.
+	@result true, if the value is in the specified binary heap, otherwise false.
+}
+function CFBinaryHeapContainsValue( heap: CFBinaryHeapRef; value: {const} UnivPtr ): Boolean; external name '_CFBinaryHeapContainsValue';
+
+{!
+	@function CFBinaryHeapGetMinimum
+	Returns the minimum value is in the binary heap.  If the heap contains several equal
+                minimum values, any one may be returned.
+	@param heap The binary heap to be searched. If this parameter is not a
+		valid CFBinaryHeap, the behavior is undefined.
+	@result A reference to the minimum value in the binary heap, or NULL if the
+                binary heap contains no values.
+}
+function CFBinaryHeapGetMinimum( heap: CFBinaryHeapRef ): UnivPtr; external name '_CFBinaryHeapGetMinimum';
+
+{!
+	@function CFBinaryHeapGetMinimumIfPresent
+	Returns the minimum value is in the binary heap, if present.  If the heap contains several equal
+                minimum values, any one may be returned.
+	@param heap The binary heap to be searched. If this parameter is not a
+		valid CFBinaryHeap, the behavior is undefined.
+        @param value A C pointer to pointer-sized storage to be filled with the minimum value in 
+                the binary heap.  If this value is not a valid C pointer to a pointer-sized block
+                of storage, the result is undefined.  If the result of the function is false, the value
+                stored at this address is undefined.
+	@result true, if a minimum value was found in the specified binary heap, otherwise false.
+}
+function CFBinaryHeapGetMinimumIfPresent( heap: CFBinaryHeapRef; {const} value: {variable-size-array} UnivPtrPtr ): Boolean; external name '_CFBinaryHeapGetMinimumIfPresent';
+
+{!
+	@function CFBinaryHeapGetValues
+	Fills the buffer with values from the binary heap.
+	@param heap The binary heap to be queried. If this parameter is not a
+		valid CFBinaryHeap, the behavior is undefined.
+	@param values A C array of pointer-sized values to be filled with
+		values from the binary heap. The values in the C array are ordered
+		from least to greatest. If this parameter is not a valid pointer to a 
+                C array of at least CFBinaryHeapGetCount() pointers, the behavior is undefined.
+}
+type 
+	CFBinaryHeapValues = array[0..($7F000000 div SizeOf(Ptr))] of Ptr;
+	CFBinaryHeapValuesPtr = ^CFBinaryHeapValues;
+procedure CFBinaryHeapGetValues( heap: CFBinaryHeapRef; {const} values: {variable-size-array} CFBinaryHeapValuesPtr ); external name '_CFBinaryHeapGetValues';
+
+{!
+	@function CFBinaryHeapApplyFunction
+	Calls a function once for each value in the binary heap.
+	@param heap The binary heap to be operated upon. If this parameter is not a
+		valid CFBinaryHeap, the behavior is undefined.
+	@param applier The callback function to call once for each value in
+		the given binary heap. If this parameter is not a
+		pointer to a function of the correct prototype, the behavior
+		is undefined. If there are values in the binary heap which the
+		applier function does not expect or cannot properly apply
+		to, the behavior is undefined. 
+	@param context A pointer-sized user-defined value, which is passed
+		as the second parameter to the applier function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the applier function, the behavior is
+		undefined.
+}
+procedure CFBinaryHeapApplyFunction( heap: CFBinaryHeapRef; applier: CFBinaryHeapApplierFunction; context: UnivPtr ); external name '_CFBinaryHeapApplyFunction';
+
+{!
+	@function CFBinaryHeapAddValue
+	Adds the value to the binary heap.
+	@param heap The binary heap to which the value is to be added. If this parameter is not a
+		valid mutable CFBinaryHeap, the behavior is undefined.
+                If the binary heap is a fixed-capacity binary heap and it
+		is full before this operation, the behavior is undefined.
+	@param value The value to add to the binary heap. The value is retained by
+		the binary heap using the retain callback provided when the binary heap
+		was created. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined.
+}
+procedure CFBinaryHeapAddValue( heap: CFBinaryHeapRef; value: {const} UnivPtr ); external name '_CFBinaryHeapAddValue';
+
+{!
+	@function CFBinaryHeapRemoveMinimumValue
+	Removes the minimum value from the binary heap.
+	@param heap The binary heap from which the minimum value is to be removed. If this 
+                parameter is not a valid mutable CFBinaryHeap, the behavior is undefined.
+}
+procedure CFBinaryHeapRemoveMinimumValue( heap: CFBinaryHeapRef ); external name '_CFBinaryHeapRemoveMinimumValue';
+
+{!
+	@function CFBinaryHeapRemoveAllValues
+	Removes all the values from the binary heap, making it empty.
+	@param heap The binary heap from which all of the values are to be
+		removed. If this parameter is not a valid mutable CFBinaryHeap,
+		the behavior is undefined.
+}
+procedure CFBinaryHeapRemoveAllValues( heap: CFBinaryHeapRef ); external name '_CFBinaryHeapRemoveAllValues';
+
+
+end.

+ 128 - 0
packages/extra/univint/CFBitVector.pas

@@ -0,0 +1,128 @@
+{	CFBitVector.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFBitVector;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+type
+	CFBit = UInt32;
+
+type
+	CFBitVectorRef = ^SInt32; { an opaque 32-bit type }
+	CFMutableBitVectorRef = ^SInt32; { an opaque 32-bit type }
+
+function CFBitVectorGetTypeID: CFTypeID; external name '_CFBitVectorGetTypeID';
+
+function CFBitVectorCreate( allocator: CFAllocatorRef; bytes: UnivPtr; numBits: CFIndex ): CFBitVectorRef; external name '_CFBitVectorCreate';
+function CFBitVectorCreateCopy( allocator: CFAllocatorRef; bv: CFBitVectorRef ): CFBitVectorRef; external name '_CFBitVectorCreateCopy';
+function CFBitVectorCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex ): CFMutableBitVectorRef; external name '_CFBitVectorCreateMutable';
+function CFBitVectorCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; bv: CFBitVectorRef ): CFMutableBitVectorRef; external name '_CFBitVectorCreateMutableCopy';
+
+function CFBitVectorGetCount( bv: CFBitVectorRef ): CFIndex; external name '_CFBitVectorGetCount';
+function CFBitVectorGetCountOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetCountOfBit';
+function CFBitVectorContainsBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): Boolean; external name '_CFBitVectorContainsBit';
+function CFBitVectorGetBitAtIndex( bv: CFBitVectorRef; idx: CFIndex ): CFBit; external name '_CFBitVectorGetBitAtIndex';
+procedure CFBitVectorGetBits( bv: CFBitVectorRef; range: CFRange; bytes: UnivPtr ); external name '_CFBitVectorGetBits';
+function CFBitVectorGetFirstIndexOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetFirstIndexOfBit';
+function CFBitVectorGetLastIndexOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetLastIndexOfBit';
+
+procedure CFBitVectorSetCount( bv: CFMutableBitVectorRef; count: CFIndex ); external name '_CFBitVectorSetCount';
+procedure CFBitVectorFlipBitAtIndex( bv: CFMutableBitVectorRef; idx: CFIndex ); external name '_CFBitVectorFlipBitAtIndex';
+procedure CFBitVectorFlipBits( bv: CFMutableBitVectorRef; range: CFRange ); external name '_CFBitVectorFlipBits';
+procedure CFBitVectorSetBitAtIndex( bv: CFMutableBitVectorRef; idx: CFIndex; value: CFBit ); external name '_CFBitVectorSetBitAtIndex';
+procedure CFBitVectorSetBits( bv: CFMutableBitVectorRef; range: CFRange; value: CFBit ); external name '_CFBitVectorSetBits';
+procedure CFBitVectorSetAllBits( bv: CFMutableBitVectorRef; value: CFBit ); external name '_CFBitVectorSetAllBits';
+
+
+end.

+ 342 - 0
packages/extra/univint/CFBundle.pas

@@ -0,0 +1,342 @@
+{	CFBundle.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFBundle;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFDictionary,CFString,CFURL;
+{$ALIGN POWER}
+
+
+type
+	CFBundleRef = ^SInt32; { an opaque 32-bit type }
+	CFBundleRefPtr = ^CFBundleRef;
+	CFPlugInRef = ^SInt32; { an opaque 32-bit type }
+	CFPlugInRefPtr = ^CFPlugInRef;
+
+{ ===================== Standard Info.plist keys ===================== }
+var kCFBundleInfoDictionaryVersionKey: CFStringRef; external name '_kCFBundleInfoDictionaryVersionKey'; (* attribute const *)
+    { The version of the Info.plist format }
+var kCFBundleExecutableKey: CFStringRef; external name '_kCFBundleExecutableKey'; (* attribute const *)
+    { The name of the executable in this bundle (if any) }
+var kCFBundleIdentifierKey: CFStringRef; external name '_kCFBundleIdentifierKey'; (* attribute const *)
+    { The bundle identifier (for CFBundleGetBundleWithIdentifier()) }
+var kCFBundleVersionKey: CFStringRef; external name '_kCFBundleVersionKey'; (* attribute const *)
+    { The version number of the bundle.  For Mac OS 9 style version numbers (for example "2.5.3d5"), clients can use CFBundleGetVersionNumber() instead of accessing this key directly since that function will properly convert the version string into its compact integer representation. }
+var kCFBundleDevelopmentRegionKey: CFStringRef; external name '_kCFBundleDevelopmentRegionKey'; (* attribute const *)
+    { The name of the development language of the bundle. }
+var kCFBundleNameKey: CFStringRef; external name '_kCFBundleNameKey'; (* attribute const *)
+    { The human-readable name of the bundle.  This key is often found in the InfoPlist.strings since it is usually localized. }
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+var kCFBundleLocalizationsKey: CFStringRef; external name '_kCFBundleLocalizationsKey'; (* attribute const *)
+    { Allows an unbundled application that handles localization itself to specify which localizations it has available. }
+{#endif}
+
+{ ===================== Finding Bundles ===================== }
+
+function CFBundleGetMainBundle: CFBundleRef; external name '_CFBundleGetMainBundle';
+
+function CFBundleGetBundleWithIdentifier( bundleID: CFStringRef ): CFBundleRef; external name '_CFBundleGetBundleWithIdentifier';
+    { A bundle can name itself by providing a key in the info dictionary. }
+    { This facility is meant to allow bundle-writers to get hold of their }
+    { bundle from their code without having to know where it was on the disk. }
+    { This is meant to be a replacement mechanism for +bundleForClass: users. }
+    { Note that this does not search for bundles on the disk; it will locate }
+    { only bundles already loaded or otherwise known to the current process. }
+
+function CFBundleGetAllBundles: CFArrayRef; external name '_CFBundleGetAllBundles';
+    { This is potentially expensive.  Use with care. }
+
+{ ===================== Creating Bundles ===================== }
+
+function CFBundleGetTypeID: UInt32; external name '_CFBundleGetTypeID';
+
+function CFBundleCreate( allocator: CFAllocatorRef; bundleURL: CFURLRef ): CFBundleRef; external name '_CFBundleCreate';
+    { Might return an existing instance with the ref-count bumped. }
+
+function CFBundleCreateBundlesFromDirectory( allocator: CFAllocatorRef; directoryURL: CFURLRef; bundleType: CFStringRef ): CFArrayRef; external name '_CFBundleCreateBundlesFromDirectory';
+    { Create instances for all bundles in the given directory matching the given }
+    { type (or all of them if bundleType is NULL) }
+
+{ ==================== Basic Bundle Info ==================== }
+
+function CFBundleCopyBundleURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyBundleURL';
+
+function CFBundleGetValueForInfoDictionaryKey( bundle: CFBundleRef; key: CFStringRef ): CFTypeRef; external name '_CFBundleGetValueForInfoDictionaryKey';
+    { Returns a localized value if available, otherwise the global value. }
+    { This is the recommended function for examining the info dictionary. }
+
+function CFBundleGetInfoDictionary( bundle: CFBundleRef ): CFDictionaryRef; external name '_CFBundleGetInfoDictionary';
+    { This is the global info dictionary.  Note that CFBundle may add }
+    { extra keys to the dictionary for its own use. }
+
+function CFBundleGetLocalInfoDictionary( bundle: CFBundleRef ): CFDictionaryRef; external name '_CFBundleGetLocalInfoDictionary';
+    { This is the localized info dictionary. }
+
+procedure CFBundleGetPackageInfo( bundle: CFBundleRef; var packageType: OSType; var packageCreator: OSType ); external name '_CFBundleGetPackageInfo';
+
+function CFBundleGetIdentifier( bundle: CFBundleRef ): CFStringRef; external name '_CFBundleGetIdentifier';
+
+function CFBundleGetVersionNumber( bundle: CFBundleRef ): UInt32; external name '_CFBundleGetVersionNumber';
+
+function CFBundleGetDevelopmentRegion( bundle: CFBundleRef ): CFStringRef; external name '_CFBundleGetDevelopmentRegion';
+
+function CFBundleCopySupportFilesDirectoryURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopySupportFilesDirectoryURL';
+
+function CFBundleCopyResourcesDirectoryURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyResourcesDirectoryURL';
+
+function CFBundleCopyPrivateFrameworksURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyPrivateFrameworksURL';
+
+function CFBundleCopySharedFrameworksURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopySharedFrameworksURL';
+
+function CFBundleCopySharedSupportURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopySharedSupportURL';
+
+function CFBundleCopyBuiltInPlugInsURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyBuiltInPlugInsURL';
+
+{ ------------- Basic Bundle Info without a CFBundle instance ------------- }
+{ This API is provided to enable developers to retrieve basic information }
+{ about a bundle without having to create an instance of CFBundle. }
+{ Because of caching behavior when a CFBundle instance exists, it will be faster }
+{ to actually create a CFBundle if you need to retrieve multiple pieces of info. }
+function CFBundleCopyInfoDictionaryInDirectory( bundleURL: CFURLRef ): CFDictionaryRef; external name '_CFBundleCopyInfoDictionaryInDirectory';
+
+function CFBundleGetPackageInfoInDirectory( url: CFURLRef; var packageType: UInt32; var packageCreator: UInt32 ): Boolean; external name '_CFBundleGetPackageInfoInDirectory';
+    
+{ ==================== Resource Handling API ==================== }
+
+function CFBundleCopyResourceURL( bundle: CFBundleRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFURLRef; external name '_CFBundleCopyResourceURL';
+
+function CFBundleCopyResourceURLsOfType( bundle: CFBundleRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFArrayRef; external name '_CFBundleCopyResourceURLsOfType';
+
+function CFBundleCopyLocalizedString( bundle: CFBundleRef; key: CFStringRef; value: CFStringRef; tableName: CFStringRef ): CFStringRef; external name '_CFBundleCopyLocalizedString';
+
+function CFCopyLocalizedString( key: CFStringRef; comment: PChar ): CFStringRef; inline;
+function CFCopyLocalizedStringFromTable( key: CFStringRef; tableName: CFStringRef; comment: PChar ): CFStringRef; inline;
+function CFCopyLocalizedStringFromTableInBundle( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; comment: PChar ): CFStringRef; inline;
+function CFCopyLocalizedStringWithDefaultValue( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; value: CFStringRef; comment: PChar ): CFStringRef; inline;
+
+{ ------------- Resource Handling without a CFBundle instance ------------- }
+{ This API is provided to enable developers to use the CFBundle resource }
+{ searching policy without having to create an instance of CFBundle. }
+{ Because of caching behavior when a CFBundle instance exists, it will be faster }
+{ to actually create a CFBundle if you need to access several resources. }
+
+function CFBundleCopyResourceURLInDirectory( bundleURL: CFURLRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFURLRef; external name '_CFBundleCopyResourceURLInDirectory';
+
+function CFBundleCopyResourceURLsOfTypeInDirectory( bundleURL: CFURLRef; resourceType: CFStringRef; subDirName: CFStringRef ): CFArrayRef; external name '_CFBundleCopyResourceURLsOfTypeInDirectory';
+
+{ =========== Localization-specific Resource Handling API =========== }
+{ This API allows finer-grained control over specific localizations,  }
+{ as distinguished from the above API, which always uses the user's   }
+{ preferred localizations for the bundle in the current app context.  }
+
+function CFBundleCopyBundleLocalizations( bundle: CFBundleRef ): CFArrayRef; external name '_CFBundleCopyBundleLocalizations';
+    { Lists the localizations that a bundle contains.  }
+
+function CFBundleCopyPreferredLocalizationsFromArray( locArray: CFArrayRef ): CFArrayRef; external name '_CFBundleCopyPreferredLocalizationsFromArray';
+    { Given an array of possible localizations, returns the one or more }
+    { of them that CFBundle would use in the current application context. }
+    { To determine the localizations that would be used for a particular }
+    { bundle in the current application context, apply this function to the }
+    { result of CFBundleCopyBundleLocalizations.  }
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+function CFBundleCopyLocalizationsForPreferences( locArray: CFArrayRef; prefArray: CFArrayRef ): CFArrayRef; external name '_CFBundleCopyLocalizationsForPreferences';
+    { Given an array of possible localizations, returns the one or more of }
+    { them that CFBundle would use, without reference to the current application }
+    { context, if the user's preferred localizations were given by prefArray. }
+    { If prefArray is NULL, the current user's actual preferred localizations will }
+    { be used. This is not the same as CFBundleCopyPreferredLocalizationsFromArray, }
+    { because that function takes the current application context into account. }
+    { To determine the localizations that another application would use, apply }
+    { this function to the result of CFBundleCopyBundleLocalizations.  }
+{#endif}
+
+function CFBundleCopyResourceURLForLocalization( bundle: CFBundleRef; resourceName: CFStringRef; resourceType: CFStringRef; subDirName: CFStringRef; localizationName: CFStringRef ): CFURLRef; external name '_CFBundleCopyResourceURLForLocalization';
+
+function CFBundleCopyResourceURLsOfTypeForLocalization( bundle: CFBundleRef; resourceType: CFStringRef; subDirName: CFStringRef; localizationName: CFStringRef ): CFArrayRef; external name '_CFBundleCopyResourceURLsOfTypeForLocalization';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ =================== Unbundled application info ===================== }
+{ This API is provided to enable developers to retrieve bundle-related }
+{ information about an application that may be bundled or unbundled.   }
+function CFBundleCopyInfoDictionaryForURL( url: CFURLRef ): CFDictionaryRef; external name '_CFBundleCopyInfoDictionaryForURL';
+    { For a directory URL, this is equivalent to CFBundleCopyInfoDictionaryInDirectory. }
+    { For a plain file URL representing an unbundled application, this will attempt to read }
+    { an info dictionary either from the (__TEXT, __info_plist) section (for a Mach-o file) }
+    { or from a 'plst' resource.  }
+
+function CFBundleCopyLocalizationsForURL( url: CFURLRef ): CFArrayRef; external name '_CFBundleCopyLocalizationsForURL';
+    { For a directory URL, this is equivalent to calling CFBundleCopyBundleLocalizations }
+    { on the corresponding bundle.  For a plain file URL representing an unbundled application, }
+    { this will attempt to determine its localizations using the CFBundleLocalizations and }
+    { CFBundleDevelopmentRegion keys in the dictionary returned by CFBundleCopyInfoDictionaryForURL,}
+    { or a 'vers' resource if those are not present.  }
+{#endif}
+
+{ ==================== Primitive Code Loading API ==================== }
+{ This API abstracts the various different executable formats supported on }
+{ various platforms.  It can load DYLD, CFM, or DLL shared libraries (on their }
+{ appropriate platforms) and gives a uniform API for looking up functions. }
+{ Note that Cocoa-based bundles containing Objective-C or Java code must }
+{ be loaded with NSBundle, not CFBundle.  Once they are loaded, however, }
+{ either CFBundle or NSBundle can be used. }
+
+function CFBundleCopyExecutableURL( bundle: CFBundleRef ): CFURLRef; external name '_CFBundleCopyExecutableURL';
+
+function CFBundleIsExecutableLoaded( bundle: CFBundleRef ): Boolean; external name '_CFBundleIsExecutableLoaded';
+
+function CFBundleLoadExecutable( bundle: CFBundleRef ): Boolean; external name '_CFBundleLoadExecutable';
+
+procedure CFBundleUnloadExecutable( bundle: CFBundleRef ); external name '_CFBundleUnloadExecutable';
+
+function CFBundleGetFunctionPointerForName( bundle: CFBundleRef; functionName: CFStringRef ): UnivPtr; external name '_CFBundleGetFunctionPointerForName';
+
+procedure CFBundleGetFunctionPointersForNames( bundle: CFBundleRef; functionNames: CFArrayRef; ftbl: {variable-size-array} UnivPtrPtr ); external name '_CFBundleGetFunctionPointersForNames';
+
+function CFBundleGetDataPointerForName( bundle: CFBundleRef; symbolName: CFStringRef ): UnivPtr; external name '_CFBundleGetDataPointerForName';
+
+procedure CFBundleGetDataPointersForNames( bundle: CFBundleRef; symbolNames: CFArrayRef; stbl: {variable-size-array} UnivPtrPtr ); external name '_CFBundleGetDataPointersForNames';
+
+function CFBundleCopyAuxiliaryExecutableURL( bundle: CFBundleRef; executableName: CFStringRef ): CFURLRef; external name '_CFBundleCopyAuxiliaryExecutableURL';
+    { This function can be used to find executables other than your main }
+    { executable.  This is useful, for instance, for applications that have }
+    { some command line tool that is packaged with and used by the application. }
+    { The tool can be packaged in the various platform executable directories }
+    { in the bundle and can be located with this function.  This allows an }
+    { app to ship versions of the tool for each platform as it does for the }
+    { main app executable. }
+
+{ ==================== Getting a bundle's plugIn ==================== }
+
+function CFBundleGetPlugIn( bundle: CFBundleRef ): CFPlugInRef; external name '_CFBundleGetPlugIn';
+
+{ ==================== Resource Manager-Related API ==================== }
+
+function CFBundleOpenBundleResourceMap( bundle: CFBundleRef ): SInt16; external name '_CFBundleOpenBundleResourceMap';
+   { This function opens the non-localized and the localized resource files }
+   { (if any) for the bundle, creates and makes current a single read-only }
+   { resource map combining both, and returns a reference number for it. }
+   { If it is called multiple times, it opens the files multiple times, }
+   { and returns distinct reference numbers.  }
+
+function CFBundleOpenBundleResourceFiles( bundle: CFBundleRef; var refNum: SInt16; var localizedRefNum: SInt16 ): SInt32; external name '_CFBundleOpenBundleResourceFiles';
+   { Similar to CFBundleOpenBundleResourceMap, except that it creates two }
+   { separate resource maps and returns reference numbers for both. }
+
+procedure CFBundleCloseBundleResourceMap( bundle: CFBundleRef; refNum: SInt16 ); external name '_CFBundleCloseBundleResourceMap';
+
+
+implementation
+
+
+{$R-}
+
+function CFCopyLocalizedString( key: CFStringRef; comment: PChar ): CFStringRef; inline;
+begin
+	CFCopyLocalizedString := CFBundleCopyLocalizedString( CFBundleGetMainBundle, key, key, nil );
+end;
+
+function CFCopyLocalizedStringFromTable( key: CFStringRef; tableName: CFStringRef; comment: PChar ): CFStringRef; inline;
+begin
+	CFCopyLocalizedStringFromTable := CFBundleCopyLocalizedString( CFBundleGetMainBundle, key, key, tableName );
+end;
+
+function CFCopyLocalizedStringFromTableInBundle( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; comment: PChar ): CFStringRef; inline;
+begin
+	CFCopyLocalizedStringFromTableInBundle := CFBundleCopyLocalizedString( bundle, key, key, tableName );
+end;
+
+function CFCopyLocalizedStringWithDefaultValue( key: CFStringRef; tableName: CFStringRef; bundle: CFBundleRef; value: CFStringRef; comment: PChar ): CFStringRef; inline;
+begin
+	CFCopyLocalizedStringWithDefaultValue := CFBundleCopyLocalizedString( bundle, key, value, tableName );
+end;
+
+
+end.

+ 401 - 0
packages/extra/univint/CFByteOrders.pas

@@ -0,0 +1,401 @@
+{	CFByteOrder.h
+	Copyright (c) 1995-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation:  Peter N Lewis, <[email protected]>, August 2005 }
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{   Pascal Translation Updated:  Jonas Maebe, <[email protected]>, April 2006 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFByteOrders;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+type
+	CFByteOrder = SInt32;
+const
+	CFByteOrderUnknown = 0;
+	CFByteOrderLittleEndian = 1;
+	CFByteOrderBigEndian = 2;
+
+function CFByteOrderGetCurrent: CFByteOrder; inline;
+function CFSwapInt16( arg: UInt16 ): UInt16; inline;
+function CFSwapInt32( arg: UInt32 ): UInt32; inline;
+function CFSwapInt64( arg: UInt64 ): UInt64; inline;
+
+function CFSwapInt16BigToHost( arg: UInt16 ): UInt16; inline;
+function CFSwapInt32BigToHost( arg: UInt32 ): UInt32; inline;
+function CFSwapInt64BigToHost( arg: UInt64 ): UInt64; inline;
+function CFSwapInt16HostToBig( arg: UInt16 ): UInt16; inline;
+function CFSwapInt32HostToBig( arg: UInt32 ): UInt32; inline;
+function CFSwapInt64HostToBig( arg: UInt64 ): UInt64; inline;
+
+{$ifc TARGET_RT_BIG_ENDIAN}
+
+
+{$elsec}
+
+
+
+{$endc}
+
+function CFSwapInt16LittleToHost( arg: UInt16 ): UInt16; inline;
+function CFSwapInt32LittleToHost( arg: UInt32 ): UInt32; inline;
+function CFSwapInt64LittleToHost( arg: UInt64 ): UInt64; inline;
+function CFSwapInt16HostToLittle( arg: UInt16 ): UInt16; inline;
+function CFSwapInt32HostToLittle( arg: UInt32 ): UInt32; inline;
+function CFSwapInt64HostToLittle( arg: UInt64 ): UInt64; inline;
+
+{$ifc TARGET_RT_LITTLE_ENDIAN}
+
+
+{$elsec}
+
+
+
+{$endc}
+
+type
+	CFSwappedFloat32 = record
+		v: UInt32;
+	end;
+type
+	CFSwappedFloat64 = record
+		v: UInt64;
+	end;
+
+function CFConvertFloat32HostToSwapped( arg: Float32 ): CFSwappedFloat32; inline;
+function CFConvertFloat32SwappedToHost( arg: Float32 ): CFSwappedFloat32; inline;
+function CFConvertFloat64HostToSwapped( arg: Float64 ): CFSwappedFloat64; inline;
+function CFConvertFloat64SwappedToHost( arg: Float64 ): CFSwappedFloat64; inline;
+function CFConvertFloatHostToSwapped( arg: Float32 ): CFSwappedFloat32; inline;
+function CFConvertFloatSwappedToHost( arg: Float32 ): CFSwappedFloat32; inline;
+function CFConvertDoubleHostToSwapped( arg: Float64 ): CFSwappedFloat64; inline;
+function CFConvertDoubleSwappedToHost( arg: Float64 ): CFSwappedFloat64; inline;
+
+{$ifc TARGET_RT_LITTLE_ENDIAN}
+
+
+
+{$elsec}
+
+
+{$endc}
+
+implementation
+
+{$R-}
+
+function CFByteOrderGetCurrent: CFByteOrder; inline;
+	var
+		x: UInt32 = (CFByteOrderBigEndian shl 24) or CFByteOrderLittleEndian;
+begin
+	CFByteOrderGetCurrent := CFByteOrder(UInt8Ptr(@x)^);
+end;
+
+function CFSwapInt16( arg: UInt16 ): UInt16; inline;
+begin
+	CFSwapInt16 := (( arg shl 8) and $0FF00) or (( arg shr 8) and $00FF);
+end;
+
+function CFSwapInt32( arg: UInt32 ): UInt32; inline;
+begin
+    CFSwapInt32 := ((arg and $FF) shl 24) or ((arg and $0FF00) shl 8) or ((arg shr 8) and $0FF00) or ((arg shr 24) and $FF);
+end;
+
+function CFSwapInt64( arg: UInt64 ): UInt64; inline;
+begin
+	CFSwapInt64 := (CFSwapInt32( arg and $FFFFFFFF ) shl 32) or CFSwapInt32( (arg shr 32) and $FFFFFFFF );
+end;
+
+{$ifc TARGET_RT_BIG_ENDIAN}
+function CFSwapInt16BigToHost( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16BigToHost := arg;
+end;
+
+function CFSwapInt32BigToHost( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32BigToHost := arg;
+end;
+
+function CFSwapInt64BigToHost( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64BigToHost := arg;
+end;
+
+function CFSwapInt16HostToBig( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16HostToBig := arg;
+end;
+
+function CFSwapInt32HostToBig( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32HostToBig := arg;
+end;
+
+function CFSwapInt64HostToBig( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64HostToBig := arg;
+end;
+
+function CFSwapInt16LittleToHost( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16LittleToHost := CFSwapInt16(arg);
+end;
+
+function CFSwapInt32LittleToHost( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32LittleToHost := CFSwapInt32(arg);
+end;
+
+function CFSwapInt64LittleToHost( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64LittleToHost := CFSwapInt64(arg);
+end;
+
+function CFSwapInt16HostToLittle( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16HostToLittle := CFSwapInt16(arg);
+end;
+
+function CFSwapInt32HostToLittle( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32HostToLittle := CFSwapInt32(arg);
+end;
+
+function CFSwapInt64HostToLittle( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64HostToLittle := CFSwapInt64(arg);
+end;
+
+function CFConvertFloat32HostToSwapped( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloat32HostToSwapped := CFSwappedFloat32(arg);
+end;
+
+function CFConvertFloat32SwappedToHost( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloat32SwappedToHost := CFSwappedFloat32(arg);
+end;
+
+function CFConvertFloat64HostToSwapped( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertFloat64HostToSwapped := CFSwappedFloat64(arg);
+end;
+
+function CFConvertFloat64SwappedToHost( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertFloat64SwappedToHost := CFSwappedFloat64(arg);
+end;
+
+function CFConvertFloatHostToSwapped( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloatHostToSwapped := CFSwappedFloat32(arg);
+end;
+
+function CFConvertFloatSwappedToHost( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloatSwappedToHost := CFSwappedFloat32(arg);
+end;
+
+function CFConvertDoubleHostToSwapped( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertDoubleHostToSwapped := CFSwappedFloat64(arg);
+end;
+
+function CFConvertDoubleSwappedToHost( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertDoubleSwappedToHost := CFSwappedFloat64(arg);
+end;
+
+{$elsec}
+
+function CFSwapInt16LittleToHost( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16LittleToHost := arg;
+end;
+
+function CFSwapInt32LittleToHost( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32LittleToHost := arg;
+end;
+
+function CFSwapInt64LittleToHost( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64LittleToHost := arg;
+end;
+
+function CFSwapInt16HostToLittle( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16HostToLittle := arg;
+end;
+
+function CFSwapInt32HostToLittle( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32HostToLittle := arg;
+end;
+
+function CFSwapInt64HostToLittle( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64HostToLittle := arg;
+end;
+
+function CFSwapInt16BigToHost( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16BigToHost := CFSwapInt16(arg);
+end;
+
+function CFSwapInt32BigToHost( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32BigToHost := CFSwapInt32(arg);
+end;
+
+function CFSwapInt64BigToHost( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64BigToHost := CFSwapInt64(arg);
+end;
+
+function CFSwapInt16HostToBig( arg: UInt16 ): UInt16; inline;
+begin
+  CFSwapInt16HostToBig := CFSwapInt16(arg);
+end;
+
+function CFSwapInt32HostToBig( arg: UInt32 ): UInt32; inline;
+begin
+  CFSwapInt32HostToBig := CFSwapInt32(arg);
+end;
+
+function CFSwapInt64HostToBig( arg: UInt64 ): UInt64; inline;
+begin
+  CFSwapInt64HostToBig := CFSwapInt64(arg);
+end;
+
+function CFConvertFloat32HostToSwapped( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloat32HostToSwapped.v := CFSwapInt32(CFSwappedFloat32(arg).v);
+end;
+
+function CFConvertFloat32SwappedToHost( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloat32SwappedToHost.v := CFSwapInt32(CFSwappedFloat32(arg).v);
+end;
+
+function CFConvertFloat64HostToSwapped( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertFloat64HostToSwapped.v := CFSwapInt64(CFSwappedFloat64(arg).v);
+end;
+
+function CFConvertFloat64SwappedToHost( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertFloat64SwappedToHost.v := CFSwapInt64(CFSwappedFloat64(arg).v);
+end;
+
+function CFConvertFloatHostToSwapped( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloatHostToSwapped.v := CFSwapInt32(CFSwappedFloat32(arg).v);
+end;
+
+function CFConvertFloatSwappedToHost( arg: Float32 ): CFSwappedFloat32; inline;
+begin
+  CFConvertFloatSwappedToHost.v := CFSwapInt32(CFSwappedFloat32(arg).v);
+end;
+
+function CFConvertDoubleHostToSwapped( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertDoubleHostToSwapped.v := CFSwapInt64(CFSwappedFloat64(arg).v);
+end;
+
+function CFConvertDoubleSwappedToHost( arg: Float64 ): CFSwappedFloat64; inline;
+begin
+  CFConvertDoubleSwappedToHost.v := CFSwapInt64(CFSwappedFloat64(arg).v);
+end;
+{$endc}
+
+
+end.

+ 191 - 0
packages/extra/univint/CFCalendar.pas

@@ -0,0 +1,191 @@
+{	CFCalendar.h
+	Copyright (c) 2004-2005, Apple, Inc. All rights reserved.
+}
+{       Pascal Translation:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFCalendar;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFLocale,CFDate,CFTimeZone;
+{$ALIGN POWER}
+
+
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+
+
+type
+	CFCalendarRef = ^SInt32; { an opaque 32-bit type }
+
+function CFCalendarGetTypeID: CFTypeID; external name '_CFCalendarGetTypeID';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarCopyCurrent: CFCalendarRef; external name '_CFCalendarCopyCurrent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarCreateWithIdentifier( allocator: CFAllocatorRef; identifier: CFStringRef ): CFCalendarRef; external name '_CFCalendarCreateWithIdentifier';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Create a calendar.  The identifiers are the kCF*Calendar
+	// constants in CFLocale.h.
+
+function CFCalendarGetIdentifier( calendar: CFCalendarRef ): CFStringRef; external name '_CFCalendarGetIdentifier';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Returns the calendar's identifier.
+
+function CFCalendarCopyLocale( calendar: CFCalendarRef ): CFLocaleRef; external name '_CFCalendarCopyLocale';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+procedure CFCalendarSetLocale( calendar: CFCalendarRef; locale: CFLocaleRef ); external name '_CFCalendarSetLocale';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarCopyTimeZone( calendar: CFCalendarRef ): CFTimeZoneRef; external name '_CFCalendarCopyTimeZone';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+procedure CFCalendarSetTimeZone( calendar: CFCalendarRef; tz: CFTimeZoneRef ); external name '_CFCalendarSetTimeZone';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarGetFirstWeekday( calendar: CFCalendarRef ): CFIndex; external name '_CFCalendarGetFirstWeekday';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+procedure CFCalendarSetFirstWeekday( calendar: CFCalendarRef; wkdy: CFIndex ); external name '_CFCalendarSetFirstWeekday';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarGetMinimumDaysInFirstWeek( calendar: CFCalendarRef ): CFIndex; external name '_CFCalendarGetMinimumDaysInFirstWeek';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+procedure CFCalendarSetMinimumDaysInFirstWeek( calendar: CFCalendarRef; mwd: CFIndex ); external name '_CFCalendarSetMinimumDaysInFirstWeek';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+type
+	CFCalendarUnit = SInt32;
+const
+	kCFCalendarUnitEra = 1 shl 1;
+	kCFCalendarUnitYear = 1 shl 2;
+	kCFCalendarUnitMonth = 1 shl 3;
+	kCFCalendarUnitDay = 1 shl 4;
+	kCFCalendarUnitHour = 1 shl 5;
+	kCFCalendarUnitMinute = 1 shl 6;
+	kCFCalendarUnitSecond = 1 shl 7;
+	kCFCalendarUnitWeek = 1 shl 8;
+	kCFCalendarUnitWeekday = 1 shl 9;
+	kCFCalendarUnitWeekdayOrdinal = 1 shl 10;
+
+function CFCalendarGetMinimumRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit ): CFRange; external name '_CFCalendarGetMinimumRangeOfUnit';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarGetMaximumRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit ): CFRange; external name '_CFCalendarGetMaximumRangeOfUnit';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarGetRangeOfUnit( calendar: CFCalendarRef; smallerUnit: CFCalendarUnit; biggerUnit: CFCalendarUnit; at: CFAbsoluteTime ): CFRange; external name '_CFCalendarGetRangeOfUnit';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarGetOrdinalityOfUnit( calendar: CFCalendarRef; smallerUnit: CFCalendarUnit; biggerUnit: CFCalendarUnit; at: CFAbsoluteTime ): CFIndex; external name '_CFCalendarGetOrdinalityOfUnit';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+function CFCalendarComposeAbsoluteTime( calendar: CFCalendarRef; var at: { out } CFAbsoluteTime; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarComposeAbsoluteTime';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarDecomposeAbsoluteTime( calendar: CFCalendarRef; at: CFAbsoluteTime; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarDecomposeAbsoluteTime';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+const
+	kCFCalendarComponentsWrap = 1 shl 0;  // option for adding
+
+function CFCalendarAddComponents( calendar: CFCalendarRef; var at: { out } CFAbsoluteTime; options: CFOptionFlags; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarAddComponents';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFCalendarGetComponentDifference( calendar: CFCalendarRef; startingAT: CFAbsoluteTime; resultAT: CFAbsoluteTime; options: CFOptionFlags; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarGetComponentDifference';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+
+{#endif}
+
+
+end.

+ 460 - 0
packages/extra/univint/CFCharacterSet.pas

@@ -0,0 +1,460 @@
+{	CFCharacterSet.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFCharacterSet;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData;
+{$ALIGN POWER}
+
+
+{!
+	@header CFCharacterSet
+        CFCharacterSet represents a set, or a bag, of Unicode characters.
+        The API consists of 3 groups:
+        1) creation/manipulation of CFCharacterSet instances,
+        2) query of a single Unicode character membership,
+        and 3) bitmap representation related (reading/writing).
+        Conceptually, CFCharacterSet is a 136K byte bitmap array of
+        which each bit represents a Unicode code point.  It could
+        contain the Unicode characters in ISO 10646 Basic Multilingual
+        Plane (BMP) and characters in Plane 1 through Plane 16
+        accessible via surrogate paris in the Unicode Transformation
+        Format, 16-bit encoding form (UTF-16).  In other words, it can
+        store values from 0x00000 to 0x10FFFF in the Unicode
+        Transformation Format, 32-bit encoding form (UTF-32).  However,
+        in general, how CFCharacterSet stores the information is an
+        implementation detail.  Note even CFData used for the external
+        bitmap representation rarely has 136K byte.  For detailed
+        discussion of the external bitmap representation, refer to the
+        comments for CFCharacterSetCreateWithBitmapRepresentation below.
+        Note that the existance of non-BMP characters in a character set
+        does not imply the membership of the corresponding surrogate
+        characters.  For example, a character set with U+10000 does not
+        match with U+D800.
+}
+
+
+{!
+	@typedef CFCharacterSetRef
+	This is the type of a reference to immutable CFCharacterSets.
+}
+type
+	CFCharacterSetRef = ^SInt32; { an opaque 32-bit type }
+	CFCharacterSetRefPtr = ^CFCharacterSetRef;
+
+{!
+	@typedef CFMutableCharacterSetRef
+	This is the type of a reference to mutable CFMutableCharacterSets.
+}
+type
+	CFMutableCharacterSetRef = CFCharacterSetRef;
+	CFMutableCharacterSetRefPtr = ^CFMutableCharacterSetRef;
+
+{!
+	@typedef CFCharacterSetPredefinedSet
+        Type of the predefined CFCharacterSet selector values.
+}
+type
+	CFCharacterSetPredefinedSet = SInt32;
+const
+	kCFCharacterSetControl = 1; { Control character set (Unicode General Category Cc and Cf) }
+	kCFCharacterSetWhitespace = 2; { Whitespace character set (Unicode General Category Zs and U0009 CHARACTER TABULATION) }
+	kCFCharacterSetWhitespaceAndNewline = 3;  { Whitespace and Newline character set (Unicode General Category Z*, U000A ~ U000D, and U0085) }
+	kCFCharacterSetDecimalDigit = 4; { Decimal digit character set }
+	kCFCharacterSetLetter = 5; { Letter character set (Unicode General Category L* & M*) }
+	kCFCharacterSetLowercaseLetter = 6; { Lowercase character set (Unicode General Category Ll) }
+	kCFCharacterSetUppercaseLetter = 7; { Uppercase character set (Unicode General Category Lu and Lt) }
+	kCFCharacterSetNonBase = 8; { Non-base character set (Unicode General Category M*) }
+	kCFCharacterSetDecomposable = 9; { Canonically decomposable character set }
+	kCFCharacterSetAlphaNumeric = 10; { Alpha Numeric character set (Unicode General Category L*, M*, & N*) }
+	kCFCharacterSetPunctuation = 11; { Punctuation character set (Unicode General Category P*) }
+	kCFCharacterSetIllegal = 12; { Illegal character set }
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+    kCFCharacterSetCapitalizedLetter = 13; { Titlecase character set (Unicode General Category Lt) }
+{#endif}
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+    kCFCharacterSetSymbol = 14; { Symbol character set (Unicode General Category S*) }
+{#endif}
+
+{!
+	@function CFCharacterSetGetTypeID
+	Returns the type identifier of all CFCharacterSet instances.
+}
+function CFCharacterSetGetTypeID: CFTypeID; external name '_CFCharacterSetGetTypeID';
+
+{!
+	@function CFCharacterSetGetPredefined
+	Returns a predefined CFCharacterSet instance.
+	@param theSetIdentifier The CFCharacterSetPredefinedSet selector
+                which specifies the predefined character set.  If the
+                value is not in CFCharacterSetPredefinedSet, the behavior
+                is undefined.
+	@result A reference to the predefined immutable CFCharacterSet.
+                This instance is owned by CF.
+}
+function CFCharacterSetGetPredefined( theSetIdentifier: CFCharacterSetPredefinedSet ): CFCharacterSetRef; external name '_CFCharacterSetGetPredefined';
+
+{!
+	@function CFCharacterSetCreateWithCharactersInRange
+	Creates a new immutable character set with the values from the given range.
+	@param alloc The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theRange The CFRange which should be used to specify the
+                Unicode range the character set is filled with.  It
+                accepts the range in 32-bit in the UTF-32 format.  The
+                valid character point range is from 0x00000 to 0x10FFFF.
+                If the range is outside of the valid Unicode character
+                point, the behavior is undefined.
+	@result A reference to the new immutable CFCharacterSet.
+}
+function CFCharacterSetCreateWithCharactersInRange( alloc: CFAllocatorRef; theRange: CFRange ): CFCharacterSetRef; external name '_CFCharacterSetCreateWithCharactersInRange';
+
+{!
+	@function CFCharacterSetCreateWithCharactersInString
+	Creates a new immutable character set with the values in the given string.
+	@param alloc The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theString The CFString which should be used to specify
+                the Unicode characters the character set is filled with.
+                If this parameter is not a valid CFString, the behavior
+                is undefined.
+        @result A reference to the new immutable CFCharacterSet.
+}
+function CFCharacterSetCreateWithCharactersInString( alloc: CFAllocatorRef; theString: CFStringRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateWithCharactersInString';
+
+{!
+	@function CFCharacterSetCreateWithBitmapRepresentation
+	Creates a new immutable character set with the bitmap representtion in the given data.
+	@param alloc The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theData The CFData which should be used to specify the
+                bitmap representation of the Unicode character points
+                the character set is filled with.  The bitmap
+                representation could contain all the Unicode character
+                range starting from BMP to Plane 16.  The first 8K bytes
+                of the data represents the BMP range.  The BMP range 8K
+                bytes can be followed by zero to sixteen 8K byte
+                bitmaps, each one with the plane index byte prepended.
+                For example, the bitmap representing the BMP and Plane 2
+                has the size of 16385 bytes (8K bytes for BMP, 1 byte
+                index + 8K bytes bitmap for Plane 2).  The plane index
+                byte, in this case, contains the integer value two.  If
+                this parameter is not a valid CFData or it contains a
+                Plane index byte outside of the valid Plane range
+                (1 to 16), the behavior is undefined.
+        @result A reference to the new immutable CFCharacterSet.
+}
+function CFCharacterSetCreateWithBitmapRepresentation( alloc: CFAllocatorRef; theData: CFDataRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateWithBitmapRepresentation';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{!
+	@function CFCharacterSetCreateInvertedSet
+	Creates a new immutable character set that is the invert of the specified character set.
+	@param alloc The CFAllocator which should be used to allocate
+			memory for the array and its storage for values. This
+			parameter may be NULL in which case the current default
+			CFAllocator is used. If this reference is not a valid
+			CFAllocator, the behavior is undefined.
+	@param theSet The CFCharacterSet which is to be inverted.  If this
+                		parameter is not a valid CFCharacterSet, the behavior is
+              		undefined.
+	@result A reference to the new immutable CFCharacterSet.
+}
+function CFCharacterSetCreateInvertedSet( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateInvertedSet';
+
+{!
+	@function CFCharacterSetIsSupersetOfSet
+	Reports whether or not the character set is a superset of the character set specified as the second parameter.
+	@param theSet  The character set to be checked for the membership of theOtherSet.
+		If this parameter is not a valid CFCharacterSet, the behavior is undefined.
+	@param theOtherset  The character set to be checked whether or not it is a subset of theSet.
+		If this parameter is not a valid CFCharacterSet, the behavior is undefined.
+}
+function CFCharacterSetIsSupersetOfSet( theSet: CFCharacterSetRef; theOtherset: CFCharacterSetRef ): Boolean; external name '_CFCharacterSetIsSupersetOfSet';
+
+{!
+	@function CFCharacterSetHasMemberInPlane
+	Reports whether or not the character set contains at least one member character in the specified plane.
+	@param theSet  The character set to be checked for the membership.  If this
+		parameter is not a valid CFCharacterSet, the behavior is undefined.
+	@param thePlane  The plane number to be checked for the membership.
+		The valid value range is from 0 to 16.  If the value is outside of the valid
+		plane number range, the behavior is undefined.
+}
+function CFCharacterSetHasMemberInPlane( theSet: CFCharacterSetRef; thePlane: CFIndex ): Boolean; external name '_CFCharacterSetHasMemberInPlane';
+{#endif}
+
+{!
+	@function CFCharacterSetCreateMutable
+	Creates a new empty mutable character set.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@result A reference to the new mutable CFCharacterSet.
+}
+function CFCharacterSetCreateMutable( alloc: CFAllocatorRef ): CFMutableCharacterSetRef; external name '_CFCharacterSetCreateMutable';
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{!
+	@function CFCharacterSetCreateCopy
+	Creates a new character set with the values from the given character set.  This function tries to compact the backing store where applicable.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theSet The CFCharacterSet which is to be copied.  If this
+                parameter is not a valid CFCharacterSet, the behavior is
+                undefined.
+	@result A reference to the new CFCharacterSet.
+}
+function CFCharacterSetCreateCopy( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateCopy';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+{#endif} { MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED }
+
+{!
+	@function CFCharacterSetCreateMutableCopy
+	Creates a new mutable character set with the values from the given character set.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theSet The CFCharacterSet which is to be copied.  If this
+                parameter is not a valid CFCharacterSet, the behavior is
+                undefined.
+	@result A reference to the new mutable CFCharacterSet.
+}
+function CFCharacterSetCreateMutableCopy( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFMutableCharacterSetRef; external name '_CFCharacterSetCreateMutableCopy';
+
+{!
+	@function CFCharacterSetIsCharacterMember
+	Reports whether or not the Unicode character is in the character set.
+	@param theSet The character set to be searched. If this parameter
+                is not a valid CFCharacterSet, the behavior is undefined.
+	@param theChar The Unicode character for which to test against the
+                character set.  Note that this function takes 16-bit Unicode
+                character value; hence, it does not support access to the
+                non-BMP planes.  
+        @result true, if the value is in the character set, otherwise false.
+}
+function CFCharacterSetIsCharacterMember( theSet: CFCharacterSetRef; theChar: UniChar ): Boolean; external name '_CFCharacterSetIsCharacterMember';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{!
+	@function CFCharacterSetIsLongCharacterMember
+	Reports whether or not the UTF-32 character is in the character set.
+	@param theSet The character set to be searched. If this parameter
+               		 is not a valid CFCharacterSet, the behavior is undefined.
+	@param theChar The UTF-32 character for which to test against the
+			character set.
+        @result true, if the value is in the character set, otherwise false.
+}
+function CFCharacterSetIsLongCharacterMember( theSet: CFCharacterSetRef; theChar: UTF32Char ): Boolean; external name '_CFCharacterSetIsLongCharacterMember';
+{#endif}
+
+{!
+	@function CFCharacterSetCreateBitmapRepresentation
+	Creates a new immutable data with the bitmap representation from the given character set.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theSet The CFCharacterSet which is to be used create the
+                bitmap representation from.  Refer to the comments for
+                CFCharacterSetCreateWithBitmapRepresentation for the
+                detailed discussion of the bitmap representation format.
+                If this parameter is not a valid CFCharacterSet, the
+                behavior is undefined.
+	@result A reference to the new immutable CFData.
+}
+function CFCharacterSetCreateBitmapRepresentation( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFDataRef; external name '_CFCharacterSetCreateBitmapRepresentation';
+
+{!
+	@function CFCharacterSetAddCharactersInRange
+	Adds the given range to the charaacter set.
+	@param theSet The character set to which the range is to be added.
+                If this parameter is not a valid mutable CFCharacterSet,
+                the behavior is undefined.
+        @param theRange The range to add to the character set.  It accepts
+                the range in 32-bit in the UTF-32 format.  The valid
+                character point range is from 0x00000 to 0x10FFFF.  If the
+                range is outside of the valid Unicode character point,
+                the behavior is undefined.
+}
+procedure CFCharacterSetAddCharactersInRange( theSet: CFMutableCharacterSetRef; theRange: CFRange ); external name '_CFCharacterSetAddCharactersInRange';
+
+{!
+	@function CFCharacterSetRemoveCharactersInRange
+	Removes the given range from the charaacter set.
+	@param theSet The character set from which the range is to be
+                removed.  If this parameter is not a valid mutable
+                CFCharacterSet, the behavior is undefined.
+        @param theRange The range to remove from the character set.
+                It accepts the range in 32-bit in the UTF-32 format.
+                The valid character point range is from 0x00000 to 0x10FFFF.
+                If the range is outside of the valid Unicode character point,
+                the behavior is undefined.
+}
+procedure CFCharacterSetRemoveCharactersInRange( theSet: CFMutableCharacterSetRef; theRange: CFRange ); external name '_CFCharacterSetRemoveCharactersInRange';
+
+{!
+	@function CFCharacterSetAddCharactersInString
+	Adds the characters in the given string to the charaacter set.
+	@param theSet The character set to which the characters in the
+                string are to be added.  If this parameter is not a
+                valid mutable CFCharacterSet, the behavior is undefined.
+        @param theString The string to add to the character set.
+                If this parameter is not a valid CFString, the behavior
+                is undefined.
+}
+procedure CFCharacterSetAddCharactersInString( theSet: CFMutableCharacterSetRef; theString: CFStringRef ); external name '_CFCharacterSetAddCharactersInString';
+
+{!
+	@function CFCharacterSetRemoveCharactersInString
+	Removes the characters in the given string from the charaacter set.
+	@param theSet The character set from which the characters in the
+                string are to be remove.  If this parameter is not a
+                valid mutable CFCharacterSet, the behavior is undefined.
+        @param theString The string to remove from the character set.
+                If this parameter is not a valid CFString, the behavior
+                is undefined.
+}
+procedure CFCharacterSetRemoveCharactersInString( theSet: CFMutableCharacterSetRef; theString: CFStringRef ); external name '_CFCharacterSetRemoveCharactersInString';
+
+{!
+	@function CFCharacterSetUnion
+	Forms the union with the given character set.
+	@param theSet The destination character set into which the
+                union of the two character sets is stored.  If this
+                parameter is not a valid mutable CFCharacterSet, the
+                behavior is undefined.
+	@param theOtherSet The character set with which the union is
+                formed.  If this parameter is not a valid CFCharacterSet,
+                the behavior is undefined.
+}
+procedure CFCharacterSetUnion( theSet: CFMutableCharacterSetRef; theOtherSet: CFCharacterSetRef ); external name '_CFCharacterSetUnion';
+
+{!
+	@function CFCharacterSetIntersect
+	Forms the intersection with the given character set.
+	@param theSet The destination character set into which the
+                intersection of the two character sets is stored.
+                If this parameter is not a valid mutable CFCharacterSet,
+                the behavior is undefined.
+	@param theOtherSet The character set with which the intersection
+                is formed.  If this parameter is not a valid CFCharacterSet,
+                the behavior is undefined.
+}
+procedure CFCharacterSetIntersect( theSet: CFMutableCharacterSetRef; theOtherSet: CFCharacterSetRef ); external name '_CFCharacterSetIntersect';
+
+{!
+	@function CFCharacterSetInvert
+	Inverts the content of the given character set.
+	@param theSet The character set to be inverted.
+                If this parameter is not a valid mutable CFCharacterSet,
+                the behavior is undefined.
+}
+procedure CFCharacterSetInvert( theSet: CFMutableCharacterSetRef ); external name '_CFCharacterSetInvert';
+
+
+end.

+ 136 - 0
packages/extra/univint/CFData.pas

@@ -0,0 +1,136 @@
+{	CFData.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFData;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+    
+type
+	CFDataRef = ^SInt32; { an opaque 32-bit type }
+	CFDataRefPtr = ^CFDataRef;
+	CFMutableDataRef = CFDataRef;
+	CFMutableDataRefPtr = ^CFMutableDataRef;
+
+function CFDataGetTypeID: CFTypeID; external name '_CFDataGetTypeID';
+
+function CFDataCreate( allocator: CFAllocatorRef; bytes: UnivPtr; length: CFIndex ): CFDataRef; external name '_CFDataCreate';
+
+function CFDataCreateWithBytesNoCopy( allocator: CFAllocatorRef; bytes: UnivPtr; length: CFIndex; bytesDeallocator: CFAllocatorRef ): CFDataRef; external name '_CFDataCreateWithBytesNoCopy';
+    { Pass kCFAllocatorNull as bytesDeallocator to assure the bytes aren't freed }
+
+function CFDataCreateCopy( allocator: CFAllocatorRef; theData: CFDataRef ): CFDataRef; external name '_CFDataCreateCopy';
+
+function CFDataCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex ): CFMutableDataRef; external name '_CFDataCreateMutable';
+
+function CFDataCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theData: CFDataRef ): CFMutableDataRef; external name '_CFDataCreateMutableCopy';
+
+function CFDataGetLength( theData: CFDataRef ): CFIndex; external name '_CFDataGetLength';
+
+function CFDataGetBytePtr( theData: CFDataRef ): UnivPtr; external name '_CFDataGetBytePtr';
+
+function CFDataGetMutableBytePtr( theData: CFMutableDataRef ): UnivPtr; external name '_CFDataGetMutableBytePtr';
+
+procedure CFDataGetBytes( theData: CFDataRef; range: CFRange; buffer: UnivPtr ); external name '_CFDataGetBytes';
+
+procedure CFDataSetLength( theData: CFMutableDataRef; length: CFIndex ); external name '_CFDataSetLength';
+
+procedure CFDataIncreaseLength( theData: CFMutableDataRef; extraLength: CFIndex ); external name '_CFDataIncreaseLength';
+
+procedure CFDataAppendBytes( theData: CFMutableDataRef; bytes: UnivPtr; length: CFIndex ); external name '_CFDataAppendBytes';
+
+procedure CFDataReplaceBytes( theData: CFMutableDataRef; range: CFRange; newBytes: UnivPtr; newLength: CFIndex ); external name '_CFDataReplaceBytes';
+
+procedure CFDataDeleteBytes( theData: CFMutableDataRef; range: CFRange ); external name '_CFDataDeleteBytes';
+
+
+end.

+ 177 - 0
packages/extra/univint/CFDate.pas

@@ -0,0 +1,177 @@
+{	CFDate.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFDate;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+type
+	CFTimeInterval = Float64;
+	CFAbsoluteTime = CFTimeInterval;
+	CFAbsoluteTimePtr = ^CFAbsoluteTime;
+{ absolute time is the time interval since the reference date }
+{ the reference date (epoch) is 00:00:00 1 January 2001. }
+
+function CFAbsoluteTimeGetCurrent: CFAbsoluteTime; external name '_CFAbsoluteTimeGetCurrent';
+
+var kCFAbsoluteTimeIntervalSince1970: CFTimeInterval; external name '_kCFAbsoluteTimeIntervalSince1970'; (* attribute const *)
+var kCFAbsoluteTimeIntervalSince1904: CFTimeInterval; external name '_kCFAbsoluteTimeIntervalSince1904'; (* attribute const *)
+
+type
+	CFDateRef = ^SInt32; { an opaque 32-bit type }
+	CFDateRefPtr = ^CFDateRef;
+
+function CFDateGetTypeID: CFTypeID; external name '_CFDateGetTypeID';
+
+function CFDateCreate( allocator: CFAllocatorRef; at: CFAbsoluteTime ): CFDateRef; external name '_CFDateCreate';
+
+function CFDateGetAbsoluteTime( theDate: CFDateRef ): CFAbsoluteTime; external name '_CFDateGetAbsoluteTime';
+
+function CFDateGetTimeIntervalSinceDate( theDate: CFDateRef; otherDate: CFDateRef ): CFTimeInterval; external name '_CFDateGetTimeIntervalSinceDate';
+
+function CFDateCompare( theDate: CFDateRef; otherDate: CFDateRef; context: UnivPtr ): CFComparisonResult; external name '_CFDateCompare';
+
+type
+	CFTimeZoneRef = ^SInt32; { an opaque 32-bit type }
+	CFTimeZoneRefPtr = ^CFTimeZoneRef;
+
+type
+	CFGregorianDate = record
+		year: SInt32;
+		month: SInt8;
+		day: SInt8;
+		hour: SInt8;
+		minute: SInt8;
+		second: Float64;
+	end;
+	CFGregorianDatePtr = ^CFGregorianDate;
+
+type
+	CFGregorianUnits = record
+		years: SInt32;
+		months: SInt32;
+		days: SInt32;
+		hours: SInt32;
+		minutes: SInt32;
+		seconds: Float64;
+	end;
+	CFGregorianUnitsPtr = ^CFGregorianUnits;
+
+type
+	CFGregorianUnitFlags = SInt32;
+const
+	kCFGregorianUnitsYears = 1 shl 0;
+	kCFGregorianUnitsMonths = 1 shl 1;
+	kCFGregorianUnitsDays = 1 shl 2;
+	kCFGregorianUnitsHours = 1 shl 3;
+	kCFGregorianUnitsMinutes = 1 shl 4;
+	kCFGregorianUnitsSeconds = 1 shl 5;
+	kCFGregorianAllUnits = $00FFFFFF;
+
+function CFGregorianDateIsValid( gdate: CFGregorianDate; unitFlags: CFOptionFlags ): Boolean; external name '_CFGregorianDateIsValid';
+
+function CFGregorianDateGetAbsoluteTime( gdate: CFGregorianDate; tz: CFTimeZoneRef ): CFAbsoluteTime; external name '_CFGregorianDateGetAbsoluteTime';
+
+function CFAbsoluteTimeGetGregorianDate( at: CFAbsoluteTime; tz: CFTimeZoneRef ): CFGregorianDate; external name '_CFAbsoluteTimeGetGregorianDate';
+
+function CFAbsoluteTimeAddGregorianUnits( at: CFAbsoluteTime; tz: CFTimeZoneRef; units: CFGregorianUnits ): CFAbsoluteTime; external name '_CFAbsoluteTimeAddGregorianUnits';
+
+function CFAbsoluteTimeGetDifferenceAsGregorianUnits( at1: CFAbsoluteTime; at2: CFAbsoluteTime; tz: CFTimeZoneRef; unitFlags: CFOptionFlags ): CFGregorianUnits; external name '_CFAbsoluteTimeGetDifferenceAsGregorianUnits';
+
+function CFAbsoluteTimeGetDayOfWeek( at: CFAbsoluteTime; tz: CFTimeZoneRef ): SInt32; external name '_CFAbsoluteTimeGetDayOfWeek';
+
+function CFAbsoluteTimeGetDayOfYear( at: CFAbsoluteTime; tz: CFTimeZoneRef ): SInt32; external name '_CFAbsoluteTimeGetDayOfYear';
+
+function CFAbsoluteTimeGetWeekOfYear( at: CFAbsoluteTime; tz: CFTimeZoneRef ): SInt32; external name '_CFAbsoluteTimeGetWeekOfYear';
+
+
+end.

+ 230 - 0
packages/extra/univint/CFDateFormatter.pas

@@ -0,0 +1,230 @@
+{	CFDateFormatter.h
+	Copyright (c) 2003-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFDateFormatter;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFDate,CFLocale;
+{$ALIGN POWER}
+
+
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
+
+type
+	CFDateFormatterRef = ^SInt32; { an opaque 32-bit type }
+
+// CFDateFormatters are not thread-safe.  Do not use one from multiple threads!
+
+function CFDateFormatterGetTypeID: CFTypeID; external name '_CFDateFormatterGetTypeID';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+// date and time format styles
+type
+	CFDateFormatterStyle = SInt32;
+const
+	kCFDateFormatterNoStyle = 0;
+	kCFDateFormatterShortStyle = 1;
+	kCFDateFormatterMediumStyle = 2;
+	kCFDateFormatterLongStyle = 3;
+	kCFDateFormatterFullStyle = 4;
+
+// The exact formatted result for these date and time styles depends on the
+// locale, but generally:
+//     Short is completely numeric, such as "12/13/52" or "3:30pm"
+//     Medium is longer, such as "Jan 12, 1952"
+//     Long is longer, such as "January 12, 1952" or "3:30:32pm"
+//     Full is pretty complete; e.g. "Tuesday, April 12, 1952 AD" or "3:30:42pm PST"
+// The specifications though are left fuzzy, in part simply because a user's
+// preference choices may affect the output, and also the results may change
+// from one OS release to another.  To produce an exactly formatted date you
+// should not rely on styles and localization, but set the format string and
+// use nothing but numbers.
+
+function CFDateFormatterCreate( allocator: CFAllocatorRef; locale: CFLocaleRef; dateStyle: CFDateFormatterStyle; timeStyle: CFDateFormatterStyle ): CFDateFormatterRef; external name '_CFDateFormatterCreate';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns a CFDateFormatter, localized to the given locale, which
+	// will format dates to the given date and time styles.
+
+function CFDateFormatterGetLocale( formatter: CFDateFormatterRef ): CFLocaleRef; external name '_CFDateFormatterGetLocale';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFDateFormatterGetDateStyle( formatter: CFDateFormatterRef ): CFDateFormatterStyle; external name '_CFDateFormatterGetDateStyle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFDateFormatterGetTimeStyle( formatter: CFDateFormatterRef ): CFDateFormatterStyle; external name '_CFDateFormatterGetTimeStyle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Get the properties with which the date formatter was created.
+
+function CFDateFormatterGetFormat( formatter: CFDateFormatterRef ): CFStringRef; external name '_CFDateFormatterGetFormat';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+procedure CFDateFormatterSetFormat( formatter: CFDateFormatterRef; formatString: CFStringRef ); external name '_CFDateFormatterSetFormat';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Set the format description string of the date formatter.  This
+	// overrides the style settings.  The format of the format string
+	// is as defined by the ICU library.  The date formatter starts with a
+	// default format string defined by the style arguments with
+	// which it was created.
+
+
+function CFDateFormatterCreateStringWithDate( allocator: CFAllocatorRef; formatter: CFDateFormatterRef; date: CFDateRef ): CFStringRef; external name '_CFDateFormatterCreateStringWithDate';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFDateFormatterCreateStringWithAbsoluteTime( allocator: CFAllocatorRef; formatter: CFDateFormatterRef; at: CFAbsoluteTime ): CFStringRef; external name '_CFDateFormatterCreateStringWithAbsoluteTime';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Create a string representation of the given date or CFAbsoluteTime
+	// using the current state of the date formatter.
+
+
+function CFDateFormatterCreateDateFromString( allocator: CFAllocatorRef; formatter: CFDateFormatterRef; strng: CFStringRef; rangep: CFRangePtr ): CFDateRef; external name '_CFDateFormatterCreateDateFromString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFDateFormatterGetAbsoluteTimeFromString( formatter: CFDateFormatterRef; strng: CFStringRef; rangep: CFRangePtr; atp: CFAbsoluteTimePtr ): Boolean; external name '_CFDateFormatterGetAbsoluteTimeFromString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Parse a string representation of a date using the current state
+	// of the date formatter.  The range parameter specifies the range
+	// of the string in which the parsing should occur in input, and on
+	// output indicates the extent that was used; this parameter can
+	// be NULL, in which case the whole string may be used.  The
+	// return value indicates whether some date was computed and
+	// (if atp is not NULL) stored at the location specified by atp.
+
+
+procedure CFDateFormatterSetProperty( formatter: CFDateFormatterRef; key: CFStringRef; value: CFTypeRef ); external name '_CFDateFormatterSetProperty';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFDateFormatterCopyProperty( formatter: CFDateFormatterRef; key: CFStringRef ): CFTypeRef; external name '_CFDateFormatterCopyProperty';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Set and get various properties of the date formatter, the set of
+	// which may be expanded in the future.
+
+var kCFDateFormatterIsLenient: CFStringRef; external name '_kCFDateFormatterIsLenient'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFBoolean
+var kCFDateFormatterTimeZone: CFStringRef; external name '_kCFDateFormatterTimeZone'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFTimeZone
+var kCFDateFormatterCalendarName: CFStringRef; external name '_kCFDateFormatterCalendarName'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFString
+var kCFDateFormatterDefaultFormat: CFStringRef; external name '_kCFDateFormatterDefaultFormat'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFString
+var kCFDateFormatterTwoDigitStartDate: CFStringRef; external name '_kCFDateFormatterTwoDigitStartDate'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFDate
+var kCFDateFormatterDefaultDate: CFStringRef; external name '_kCFDateFormatterDefaultDate'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)	// CFDate
+var kCFDateFormatterCalendar: CFStringRef; external name '_kCFDateFormatterCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFCalendar
+var kCFDateFormatterEraSymbols: CFStringRef; external name '_kCFDateFormatterEraSymbols'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)	// CFArray of CFString
+var kCFDateFormatterMonthSymbols: CFStringRef; external name '_kCFDateFormatterMonthSymbols'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)	// CFArray of CFString
+var kCFDateFormatterShortMonthSymbols: CFStringRef; external name '_kCFDateFormatterShortMonthSymbols'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFArray of CFString
+var kCFDateFormatterWeekdaySymbols: CFStringRef; external name '_kCFDateFormatterWeekdaySymbols'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)	// CFArray of CFString
+var kCFDateFormatterShortWeekdaySymbols: CFStringRef; external name '_kCFDateFormatterShortWeekdaySymbols'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFArray of CFString
+var kCFDateFormatterAMSymbol: CFStringRef; external name '_kCFDateFormatterAMSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+var kCFDateFormatterPMSymbol: CFStringRef; external name '_kCFDateFormatterPMSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+
+// See CFLocale.h for these calendar constants:
+//	const CFStringRef kCFGregorianCalendar;
+//	const CFStringRef kCFBuddhistCalendar;
+//	const CFStringRef kCFJapaneseCalendar;
+//	const CFStringRef kCFIslamicCalendar;
+//	const CFStringRef kCFIslamicCivilCalendar;
+//	const CFStringRef kCFHebrewCalendar;
+//	const CFStringRef kCFChineseCalendar;
+
+
+{#endif}
+
+
+end.

+ 747 - 0
packages/extra/univint/CFDictionary.pas

@@ -0,0 +1,747 @@
+{	CFDictionary.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFDictionary;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+{!
+	@header CFDictionary
+	CFDictionary implements a container which pairs pointer-sized keys
+	with pointer-sized values. Values are accessed via arbitrary
+	user-defined keys. A CFDictionary differs from a CFArray in that
+	the key used to access a particular value in the dictionary remains
+	the same as values are added to or removed from the dictionary,
+	unless a value associated with its particular key is replaced or
+	removed. In a CFArray, the key (or index) used to retrieve a
+	particular value can change over time as values are added to or
+	deleted from the array. Also unlike an array, there is no ordering
+	among values in a dictionary. To enable later retrieval of a value,
+	the key of the key-value pair should be constant (or treated as
+	constant); if the key changes after being used to put a value in
+	the dictionary, the value may not be retrievable. The keys of a
+	dictionary form a set; that is, no two keys which are equal to
+	one another are present in the dictionary at any time.
+
+	Dictionaries come in two flavors, immutable, which cannot have
+	values added to them or removed from them after the dictionary is
+	created, and mutable, to which you can add values or from which
+	remove values. Mutable dictionaries have two subflavors,
+	fixed-capacity, for which there is a maximum number set at creation
+	time of values which can be put into the dictionary, and variable
+	capacity, which can have an unlimited number of values (or rather,
+	limited only by constraints external to CFDictionary, like the
+	amount of available memory). Fixed-capacity dictionaries can be
+	somewhat higher performing, if you can put a definate upper limit
+	on the number of values that might be put into the dictionary.
+
+	As with all CoreFoundation collection types, dictionaries maintain
+	hard references on the values you put in them, but the retaining and
+	releasing functions are user-defined callbacks that can actually do
+	whatever the user wants (for example, nothing).
+
+	Although a particular implementation of CFDictionary may not use
+	hashing and a hash table for storage of the values, the keys have
+	a hash-code generating function defined for them, and a function
+	to test for equality of two keys. These two functions together
+	must maintain the invariant that if equal(X, Y), then hash(X) ==
+	hash(Y). Note that the converse will not generally be true (but
+	the contrapositive, if hash(X) != hash(Y), then !equal(X, Y),
+	will be as required by Boolean logic). If the hash() and equal()
+	key callbacks are NULL, the key is used as a pointer-sized integer,
+	and pointer equality is used. Care should be taken to provide a
+	hash() callback which will compute sufficiently dispersed hash
+	codes for the key set for best performance.
+
+	Computational Complexity
+	The access time for a value in the dictionary is guaranteed to be at
+	worst O(lg N) for any implementation, current and future, but will
+	often be O(1) (constant time). Insertion or deletion operations
+	will typically be constant time as well, but are O(N*lg N) in the
+	worst case in some implementations. Access of values through a key
+	is faster than accessing values directly (if there are any such
+	operations). Dictionaries will tend to use significantly more memory
+	than a array with the same number of values.
+}
+
+
+{!
+	@typedef CFDictionaryKeyCallBacks
+	Structure containing the callbacks for keys of a CFDictionary.
+	@field version The version number of the structure type being passed
+		in as a parameter to the CFDictionary creation functions.
+		This structure is version 0.
+	@field retain The callback used to add a retain for the dictionary
+		on keys as they are used to put values into the dictionary.
+		This callback returns the value to use as the key in the
+		dictionary, which is usually the value parameter passed to
+		this callback, but may be a different value if a different
+		value should be used as the key. The dictionary's allocator
+		is passed as the first argument.
+	@field release The callback used to remove a retain previously added
+		for the dictionary from keys as their values are removed from
+		the dictionary. The dictionary's allocator is passed as the
+		first argument.
+	@field copyDescription The callback used to create a descriptive
+		string representation of each key in the dictionary. This
+		is used by the CFCopyDescription() function.
+	@field equal The callback used to compare keys in the dictionary for
+		equality.
+	@field hash The callback used to compute a hash code for keys as they
+		are used to access, add, or remove values in the dictionary.
+}
+type
+	CFDictionaryRetainCallBack = function( allocator: CFAllocatorRef; value: {const} UnivPtr ): UnivPtr;
+	CFDictionaryReleaseCallBack = procedure( allocator: CFAllocatorRef; value: {const} UnivPtr );
+	CFDictionaryCopyDescriptionCallBack = function( value: {const} UnivPtr ): CFStringRef;
+	CFDictionaryEqualCallBack = function( value1: {const} UnivPtr; value2: {const} UnivPtr ): Boolean;
+	CFDictionaryHashCallBack = function( value: {const} UnivPtr ): CFHashCode;
+	CFDictionaryKeyCallBacks = record
+		version: CFIndex;
+		retain: CFDictionaryRetainCallBack;
+		release: CFDictionaryReleaseCallBack;
+		copyDescription: CFDictionaryCopyDescriptionCallBack;
+		equal: CFDictionaryEqualCallBack;
+		hash: CFDictionaryHashCallBack;
+	end;
+	CFDictionaryKeyCallBacksPtr = ^CFDictionaryKeyCallBacks;
+
+{!
+	@constant kCFTypeDictionaryKeyCallBacks
+	Predefined CFDictionaryKeyCallBacks structure containing a
+	set of callbacks appropriate for use when the keys of a
+	CFDictionary are all CFTypes.
+}
+var kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; external name '_kCFTypeDictionaryKeyCallBacks'; (* attribute const *)
+
+{!
+	@constant kCFCopyStringDictionaryKeyCallBacks
+	Predefined CFDictionaryKeyCallBacks structure containing a
+	set of callbacks appropriate for use when the keys of a
+	CFDictionary are all CFStrings, which may be mutable and
+	need to be copied in order to serve as constant keys for
+	the values in the dictionary.
+}
+var kCFCopyStringDictionaryKeyCallBacks: CFDictionaryKeyCallBacks; external name '_kCFCopyStringDictionaryKeyCallBacks'; (* attribute const *)
+
+{!
+	@typedef CFDictionaryValueCallBacks
+	Structure containing the callbacks for values of a CFDictionary.
+	@field version The version number of the structure type being passed
+		in as a parameter to the CFDictionary creation functions.
+		This structure is version 0.
+	@field retain The callback used to add a retain for the dictionary
+		on values as they are put into the dictionary.
+		This callback returns the value to use as the value in the
+		dictionary, which is usually the value parameter passed to
+		this callback, but may be a different value if a different
+		value should be added to the dictionary. The dictionary's
+		allocator is passed as the first argument.
+	@field release The callback used to remove a retain previously added
+		for the dictionary from values as they are removed from
+		the dictionary. The dictionary's allocator is passed as the
+		first argument.
+	@field copyDescription The callback used to create a descriptive
+		string representation of each value in the dictionary. This
+		is used by the CFCopyDescription() function.
+	@field equal The callback used to compare values in the dictionary for
+		equality in some operations.
+}
+type
+	CFDictionaryValueCallBacks = record
+		version: CFIndex;
+		retain: CFDictionaryRetainCallBack;
+		release: CFDictionaryReleaseCallBack;
+		copyDescription: CFDictionaryCopyDescriptionCallBack;
+		equal: CFDictionaryEqualCallBack;
+	end;
+	CFDictionaryValueCallBacksPtr = ^CFDictionaryValueCallBacks;
+
+{!
+	@constant kCFTypeDictionaryValueCallBacks
+	Predefined CFDictionaryValueCallBacks structure containing a set
+	of callbacks appropriate for use when the values in a CFDictionary
+	are all CFTypes.
+}
+var kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks; external name '_kCFTypeDictionaryValueCallBacks'; (* attribute const *)
+
+{!
+	@typedef CFDictionaryApplierFunction
+	Type of the callback function used by the apply functions of
+		CFDictionarys.
+	@param key The current key for the value.
+	@param value The current value from the dictionary.
+	@param context The user-defined context parameter given to the apply
+		function.
+}
+type
+	CFDictionaryApplierFunction = procedure( key: {const} UnivPtr; value: {const} UnivPtr; context: UnivPtr );
+
+{!
+	@typedef CFDictionaryRef
+	This is the type of a reference to immutable CFDictionarys.
+}
+type
+	CFDictionaryRef = ^SInt32; { an opaque 32-bit type }
+	CFDictionaryRefPtr = ^CFDictionaryRef;
+
+{!
+	@typedef CFMutableDictionaryRef
+	This is the type of a reference to mutable CFDictionarys.
+}
+type
+	CFMutableDictionaryRef = CFDictionaryRef;
+	CFMutableDictionaryRefPtr = ^CFMutableDictionaryRef;
+
+{!
+	@function CFDictionaryGetTypeID
+	Returns the type identifier of all CFDictionary instances.
+}
+function CFDictionaryGetTypeID: CFTypeID; external name '_CFDictionaryGetTypeID';
+
+{!
+	@function CFDictionaryCreate
+	Creates a new immutable dictionary with the given values.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the dictionary and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param keys A C array of the pointer-sized keys to be used for
+		the parallel C array of values to be put into the dictionary.
+		This parameter may be NULL if the numValues parameter is 0.
+		This C array is not changed or freed by this function. If
+		this parameter is not a valid pointer to a C array of at
+		least numValues pointers, the behavior is undefined.
+	@param values A C array of the pointer-sized values to be in the
+		dictionary. This parameter may be NULL if the numValues
+		parameter is 0. This C array is not changed or freed by
+		this function. If this parameter is not a valid pointer to
+		a C array of at least numValues pointers, the behavior is
+		undefined.
+	@param numValues The number of values to copy from the keys and
+		values C arrays into the CFDictionary. This number will be
+		the count of the dictionary. If this parameter is
+		negative, or greater than the number of values actually
+		in the keys or values C arrays, the behavior is undefined.
+	@param keyCallBacks A pointer to a CFDictionaryKeyCallBacks structure
+		initialized with the callbacks for the dictionary to use on
+		each key in the dictionary. The retain callback will be used
+		within this function, for example, to retain all of the new
+		keys from the keys C array. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a structure
+		on the stack can be passed in, or can be reused for multiple
+		dictionary creations. If the version field of this
+		callbacks structure is not one of the defined ones for
+		CFDictionary, the behavior is undefined. The retain field may
+		be NULL, in which case the CFDictionary will do nothing to add
+		a retain to the keys of the contained values. The release field
+		may be NULL, in which case the CFDictionary will do nothing
+		to remove the dictionary's retain (if any) on the keys when the
+		dictionary is destroyed or a key-value pair is removed. If the
+		copyDescription field is NULL, the dictionary will create a
+		simple description for a key. If the equal field is NULL, the
+		dictionary will use pointer equality to test for equality of
+		keys. If the hash field is NULL, a key will be converted from
+		a pointer to an integer to compute the hash code. This callbacks
+		parameter itself may be NULL, which is treated as if a valid
+		structure of version 0 with all fields NULL had been passed in.
+		Otherwise, if any of the fields are not valid pointers to
+		functions of the correct type, or this parameter is not a
+		valid pointer to a CFDictionaryKeyCallBacks callbacks structure,
+		the behavior is undefined. If any of the keys put into the
+		dictionary is not one understood by one of the callback functions
+		the behavior when that callback function is used is undefined.
+	@param valueCallBacks A pointer to a CFDictionaryValueCallBacks structure
+		initialized with the callbacks for the dictionary to use on
+		each value in the dictionary. The retain callback will be used
+		within this function, for example, to retain all of the new
+		values from the values C array. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a structure
+		on the stack can be passed in, or can be reused for multiple
+		dictionary creations. If the version field of this callbacks
+		structure is not one of the defined ones for CFDictionary, the
+		behavior is undefined. The retain field may be NULL, in which
+		case the CFDictionary will do nothing to add a retain to values
+		as they are put into the dictionary. The release field may be
+		NULL, in which case the CFDictionary will do nothing to remove
+		the dictionary's retain (if any) on the values when the
+		dictionary is destroyed or a key-value pair is removed. If the
+		copyDescription field is NULL, the dictionary will create a
+		simple description for a value. If the equal field is NULL, the
+		dictionary will use pointer equality to test for equality of
+		values. This callbacks parameter itself may be NULL, which is
+		treated as if a valid structure of version 0 with all fields
+		NULL had been passed in. Otherwise,
+		if any of the fields are not valid pointers to functions
+		of the correct type, or this parameter is not a valid
+		pointer to a CFDictionaryValueCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		dictionary is not one understood by one of the callback functions
+		the behavior when that callback function is used is undefined.
+	@result A reference to the new immutable CFDictionary.
+}
+function CFDictionaryCreate( allocator: CFAllocatorRef; {const} keys: UnivPtrPtr; {const} values: UnivPtrPtr; numValues: CFIndex; {const} keyCallBacks: CFDictionaryKeyCallBacksPtr { can be NULL }; {const} valueCallBacks: CFDictionaryValueCallBacksPtr { can be NULL } ): CFDictionaryRef; external name '_CFDictionaryCreate';
+
+{!
+	@function CFDictionaryCreateCopy
+	Creates a new immutable dictionary with the key-value pairs from
+		the given dictionary.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the dictionary and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theDict The dictionary which is to be copied. The keys and values
+		from the dictionary are copied as pointers into the new
+		dictionary (that is, the values themselves are copied, not
+		that which the values point to, if anything). However, the
+		keys and values are also retained by the new dictionary using
+		the retain function of the original dictionary.
+		The count of the new dictionary will be the same as the
+		given dictionary. The new dictionary uses the same callbacks
+		as the dictionary to be copied. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@result A reference to the new immutable CFDictionary.
+}
+function CFDictionaryCreateCopy( allocator: CFAllocatorRef; theDict: CFDictionaryRef ): CFDictionaryRef; external name '_CFDictionaryCreateCopy';
+
+{!
+	@function CFDictionaryCreateMutable
+	Creates a new mutable dictionary.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the dictionary and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained by
+		the CFDictionary. The dictionary starts empty, and can grow
+		to this number of values (and it can have less). If this
+		parameter is 0, the dictionary's maximum capacity is unlimited
+		(or rather, only limited by address space and available memory
+		constraints). If this parameter is negative, the behavior is
+		undefined.
+	@param keyCallBacks A pointer to a CFDictionaryKeyCallBacks structure
+		initialized with the callbacks for the dictionary to use on
+		each key in the dictionary. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a structure
+		on the stack can be passed in, or can be reused for multiple
+		dictionary creations. If the version field of this
+		callbacks structure is not one of the defined ones for
+		CFDictionary, the behavior is undefined. The retain field may
+		be NULL, in which case the CFDictionary will do nothing to add
+		a retain to the keys of the contained values. The release field
+		may be NULL, in which case the CFDictionary will do nothing
+		to remove the dictionary's retain (if any) on the keys when the
+		dictionary is destroyed or a key-value pair is removed. If the
+		copyDescription field is NULL, the dictionary will create a
+		simple description for a key. If the equal field is NULL, the
+		dictionary will use pointer equality to test for equality of
+		keys. If the hash field is NULL, a key will be converted from
+		a pointer to an integer to compute the hash code. This callbacks
+		parameter itself may be NULL, which is treated as if a valid
+		structure of version 0 with all fields NULL had been passed in.
+		Otherwise, if any of the fields are not valid pointers to
+		functions of the correct type, or this parameter is not a
+		valid pointer to a CFDictionaryKeyCallBacks callbacks structure,
+		the behavior is undefined. If any of the keys put into the
+		dictionary is not one understood by one of the callback functions
+		the behavior when that callback function is used is undefined.
+	@param valueCallBacks A pointer to a CFDictionaryValueCallBacks structure
+		initialized with the callbacks for the dictionary to use on
+		each value in the dictionary. The retain callback will be used
+		within this function, for example, to retain all of the new
+		values from the values C array. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a structure
+		on the stack can be passed in, or can be reused for multiple
+		dictionary creations. If the version field of this callbacks
+		structure is not one of the defined ones for CFDictionary, the
+		behavior is undefined. The retain field may be NULL, in which
+		case the CFDictionary will do nothing to add a retain to values
+		as they are put into the dictionary. The release field may be
+		NULL, in which case the CFDictionary will do nothing to remove
+		the dictionary's retain (if any) on the values when the
+		dictionary is destroyed or a key-value pair is removed. If the
+		copyDescription field is NULL, the dictionary will create a
+		simple description for a value. If the equal field is NULL, the
+		dictionary will use pointer equality to test for equality of
+		values. This callbacks parameter itself may be NULL, which is
+		treated as if a valid structure of version 0 with all fields
+		NULL had been passed in. Otherwise,
+		if any of the fields are not valid pointers to functions
+		of the correct type, or this parameter is not a valid
+		pointer to a CFDictionaryValueCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		dictionary is not one understood by one of the callback functions
+		the behavior when that callback function is used is undefined.
+	@result A reference to the new mutable CFDictionary.
+}
+function CFDictionaryCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex; {const} keyCallBacks: CFDictionaryKeyCallBacksPtr { can be NULL }; {const} valueCallBacks: CFDictionaryValueCallBacksPtr { can be NULL } ): CFMutableDictionaryRef; external name '_CFDictionaryCreateMutable';
+
+{!
+	@function CFDictionaryCreateMutableCopy
+	Creates a new mutable dictionary with the key-value pairs from
+		the given dictionary.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the dictionary and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFDictionary. The dictionary starts empty, and can grow
+		to this number of values (and it can have less). If this
+		parameter is 0, the dictionary's maximum capacity is unlimited
+		(or rather, only limited by address space and available memory
+		constraints). This parameter must be greater than or equal
+		to the count of the dictionary which is to be copied, or the
+		behavior is undefined. If this parameter is negative, the
+		behavior is undefined.
+	@param theDict The dictionary which is to be copied. The keys and values
+		from the dictionary are copied as pointers into the new
+		dictionary (that is, the values themselves are copied, not
+		that which the values point to, if anything). However, the
+		keys and values are also retained by the new dictionary using
+		the retain function of the original dictionary.
+		The count of the new dictionary will be the same as the
+		given dictionary. The new dictionary uses the same callbacks
+		as the dictionary to be copied. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@result A reference to the new mutable CFDictionary.
+}
+function CFDictionaryCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theDict: CFDictionaryRef ): CFMutableDictionaryRef; external name '_CFDictionaryCreateMutableCopy';
+
+{!
+	@function CFDictionaryGetCount
+	Returns the number of values currently in the dictionary.
+	@param theDict The dictionary to be queried. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@result The number of values in the dictionary.
+}
+function CFDictionaryGetCount( theDict: CFDictionaryRef ): CFIndex; external name '_CFDictionaryGetCount';
+
+{!
+	@function CFDictionaryGetCountOfKey
+	Counts the number of times the given key occurs in the dictionary.
+	@param theDict The dictionary to be searched. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param key The key for which to find matches in the dictionary. The
+		hash() and equal() key callbacks provided when the dictionary
+		was created are used to compare. If the hash() key callback
+		was NULL, the key is treated as a pointer and converted to
+		an integer. If the equal() key callback was NULL, pointer
+		equality (in C, ==) is used. If key, or any of the keys in
+		the dictionary, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result Returns 1 if a matching key is used by the dictionary,
+		0 otherwise.
+}
+function CFDictionaryGetCountOfKey( theDict: CFDictionaryRef; key: {const} UnivPtr ): CFIndex; external name '_CFDictionaryGetCountOfKey';
+
+{!
+	@function CFDictionaryGetCountOfValue
+	Counts the number of times the given value occurs in the dictionary.
+	@param theDict The dictionary to be searched. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param value The value for which to find matches in the dictionary. The
+		equal() callback provided when the dictionary was created is
+		used to compare. If the equal() value callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values in
+		the dictionary, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result The number of times the given value occurs in the dictionary.
+}
+function CFDictionaryGetCountOfValue( theDict: CFDictionaryRef; value: {const} UnivPtr ): CFIndex; external name '_CFDictionaryGetCountOfValue';
+
+{!
+	@function CFDictionaryContainsKey
+	Reports whether or not the key is in the dictionary.
+	@param theDict The dictionary to be searched. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param key The key for which to find matches in the dictionary. The
+		hash() and equal() key callbacks provided when the dictionary
+		was created are used to compare. If the hash() key callback
+		was NULL, the key is treated as a pointer and converted to
+		an integer. If the equal() key callback was NULL, pointer
+		equality (in C, ==) is used. If key, or any of the keys in
+		the dictionary, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result true, if the key is in the dictionary, otherwise false.
+}
+function CFDictionaryContainsKey( theDict: CFDictionaryRef; key: {const} UnivPtr ): Boolean; external name '_CFDictionaryContainsKey';
+
+{!
+	@function CFDictionaryContainsValue
+	Reports whether or not the value is in the dictionary.
+	@param theDict The dictionary to be searched. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param value The value for which to find matches in the dictionary. The
+		equal() callback provided when the dictionary was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the dictionary, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result true, if the value is in the dictionary, otherwise false.
+}
+function CFDictionaryContainsValue( theDict: CFDictionaryRef; value: {const} UnivPtr ): Boolean; external name '_CFDictionaryContainsValue';
+
+{!
+	@function CFDictionaryGetValue
+	Retrieves the value associated with the given key.
+	@param theDict The dictionary to be queried. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param key The key for which to find a match in the dictionary. The
+		hash() and equal() key callbacks provided when the dictionary
+		was created are used to compare. If the hash() key callback
+		was NULL, the key is treated as a pointer and converted to
+		an integer. If the equal() key callback was NULL, pointer
+		equality (in C, ==) is used. If key, or any of the keys in
+		the dictionary, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result The value with the given key in the dictionary, or NULL if
+		no key-value pair with a matching key exists. Since NULL
+		can be a valid value in some dictionaries, the function
+		CFDictionaryGetValueIfPresent() must be used to distinguish
+		NULL-no-found from NULL-is-the-value.
+}
+function CFDictionaryGetValue( theDict: CFDictionaryRef; key: {const} UnivPtr ): UnivPtr; external name '_CFDictionaryGetValue';
+
+{!
+	@function CFDictionaryGetValueIfPresent
+	Retrieves the value associated with the given key.
+	@param theDict The dictionary to be queried. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param key The key for which to find a match in the dictionary. The
+		hash() and equal() key callbacks provided when the dictionary
+		was created are used to compare. If the hash() key callback
+		was NULL, the key is treated as a pointer and converted to
+		an integer. If the equal() key callback was NULL, pointer
+		equality (in C, ==) is used. If key, or any of the keys in
+		the dictionary, are not understood by the equal() callback,
+		the behavior is undefined.
+	@param value A pointer to memory which should be filled with the
+		pointer-sized value if a matching key is found. If no key
+		match is found, the contents of the storage pointed to by
+		this parameter are undefined. This parameter may be NULL,
+		in which case the value from the dictionary is not returned
+		(but the return value of this function still indicates
+		whether or not the key-value pair was present).
+	@result true, if a matching key was found, false otherwise.
+}
+function CFDictionaryGetValueIfPresent( theDict: CFDictionaryRef; key: {const} UnivPtr; {const} value: UnivPtrPtr ): Boolean; external name '_CFDictionaryGetValueIfPresent';
+
+{!
+	@function CFDictionaryGetKeysAndValues
+	Fills the two buffers with the keys and values from the dictionary.
+	@param theDict The dictionary to be queried. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param keys A C array of pointer-sized values to be filled with keys
+		from the dictionary. The keys and values C arrays are parallel
+		to each other (that is, the items at the same indices form a
+		key-value pair from the dictionary). This parameter may be NULL
+		if the keys are not desired. If this parameter is not a valid
+		pointer to a C array of at least CFDictionaryGetCount() pointers,
+		or NULL, the behavior is undefined.
+	@param values A C array of pointer-sized values to be filled with values
+		from the dictionary. The keys and values C arrays are parallel
+		to each other (that is, the items at the same indices form a
+		key-value pair from the dictionary). This parameter may be NULL
+		if the values are not desired. If this parameter is not a valid
+		pointer to a C array of at least CFDictionaryGetCount() pointers,
+		or NULL, the behavior is undefined.
+}
+procedure CFDictionaryGetKeysAndValues( theDict: CFDictionaryRef; {const} keys: UnivPtrPtr; {const} values: UnivPtrPtr ); external name '_CFDictionaryGetKeysAndValues';
+
+{!
+	@function CFDictionaryApplyFunction
+	Calls a function once for each value in the dictionary.
+	@param theDict The dictionary to be queried. If this parameter is
+		not a valid CFDictionary, the behavior is undefined.
+	@param applier The callback function to call once for each value in
+		the dictionary. If this parameter is not a
+		pointer to a function of the correct prototype, the behavior
+		is undefined. If there are keys or values which the
+		applier function does not expect or cannot properly apply
+		to, the behavior is undefined. 
+	@param context A pointer-sized user-defined value, which is passed
+		as the third parameter to the applier function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the applier function, the behavior is
+		undefined.
+}
+procedure CFDictionaryApplyFunction( theDict: CFDictionaryRef; applier: CFDictionaryApplierFunction; context: UnivPtr ); external name '_CFDictionaryApplyFunction';
+
+{!
+	@function CFDictionaryAddValue
+	Adds the key-value pair to the dictionary if no such key already exists.
+	@param theDict The dictionary to which the value is to be added. If this
+		parameter is not a valid mutable CFDictionary, the behavior is
+		undefined. If the dictionary is a fixed-capacity dictionary and
+		it is full before this operation, the behavior is undefined.
+	@param key The key of the value to add to the dictionary. The key is
+		retained by the dictionary using the retain callback provided
+		when the dictionary was created. If the key is not of the sort
+		expected by the retain callback, the behavior is undefined. If
+		a key which matches this key is already present in the dictionary,
+		this function does nothing ("add if absent").
+	@param value The value to add to the dictionary. The value is retained
+		by the dictionary using the retain callback provided when the
+		dictionary was created. If the value is not of the sort expected
+		by the retain callback, the behavior is undefined.
+}
+procedure CFDictionaryAddValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr; value: {const} UnivPtr ); external name '_CFDictionaryAddValue';
+
+{!
+	@function CFDictionarySetValue
+	Sets the value of the key in the dictionary.
+	@param theDict The dictionary to which the value is to be set. If this
+		parameter is not a valid mutable CFDictionary, the behavior is
+		undefined. If the dictionary is a fixed-capacity dictionary and
+		it is full before this operation, and the key does not exist in
+		the dictionary, the behavior is undefined.
+	@param key The key of the value to set into the dictionary. If a key 
+		which matches this key is already present in the dictionary, only
+		the value is changed ("add if absent, replace if present"). If
+		no key matches the given key, the key-value pair is added to the
+		dictionary. If added, the key is retained by the dictionary,
+		using the retain callback provided
+		when the dictionary was created. If the key is not of the sort
+		expected by the key retain callback, the behavior is undefined.
+	@param value The value to add to or replace into the dictionary. The value
+		is retained by the dictionary using the retain callback provided
+		when the dictionary was created, and the previous value if any is
+		released. If the value is not of the sort expected by the
+		retain or release callbacks, the behavior is undefined.
+}
+procedure CFDictionarySetValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr; value: {const} UnivPtr ); external name '_CFDictionarySetValue';
+
+{!
+	@function CFDictionaryReplaceValue
+	Replaces the value of the key in the dictionary.
+	@param theDict The dictionary to which the value is to be replaced. If this
+		parameter is not a valid mutable CFDictionary, the behavior is
+		undefined.
+	@param key The key of the value to replace in the dictionary. If a key 
+		which matches this key is present in the dictionary, the value
+		is changed to the given value, otherwise this function does
+		nothing ("replace if present").
+	@param value The value to replace into the dictionary. The value
+		is retained by the dictionary using the retain callback provided
+		when the dictionary was created, and the previous value is
+		released. If the value is not of the sort expected by the
+		retain or release callbacks, the behavior is undefined.
+}
+procedure CFDictionaryReplaceValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr; value: {const} UnivPtr ); external name '_CFDictionaryReplaceValue';
+
+{!
+	@function CFDictionaryRemoveValue
+	Removes the value of the key from the dictionary.
+	@param theDict The dictionary from which the value is to be removed. If this
+		parameter is not a valid mutable CFDictionary, the behavior is
+		undefined.
+	@param key The key of the value to remove from the dictionary. If a key 
+		which matches this key is present in the dictionary, the key-value
+		pair is removed from the dictionary, otherwise this function does
+		nothing ("remove if present").
+}
+procedure CFDictionaryRemoveValue( theDict: CFMutableDictionaryRef; key: {const} UnivPtr ); external name '_CFDictionaryRemoveValue';
+
+{!
+	@function CFDictionaryRemoveAllValues
+	Removes all the values from the dictionary, making it empty.
+	@param theDict The dictionary from which all of the values are to be
+		removed. If this parameter is not a valid mutable
+		CFDictionary, the behavior is undefined.
+}
+procedure CFDictionaryRemoveAllValues( theDict: CFMutableDictionaryRef ); external name '_CFDictionaryRemoveAllValues';
+
+
+end.

+ 589 - 0
packages/extra/univint/CFFTPStream.pas

@@ -0,0 +1,589 @@
+{
+     File:       CFNetwork/CFFTPStream.h
+ 
+     Contains:   CoreFoundation FTP stream header
+ 
+     Version:    CFNetwork-71.2~1
+ 
+     Copyright:  © 2001-2003 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFFTPStream;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFStream,CFURL,CFDictionary;
+{$ALIGN MAC68K}
+
+{
+ *  kCFStreamErrorDomainFTP
+ *  
+ *  Discussion:
+ *    Result code returned by FTP server
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamErrorDomainFTP: SInt32; external name '_kCFStreamErrorDomainFTP'; (* attribute const *)
+
+
+{
+FTP Stream Property keys.  These keys can be passed to the stream
+property "set/get" functions, such as CFReadStreamSetProperty/
+CFReadStreamCopyProperty, or to a CFDictionary creator or an item
+accessor/mutator.  The comment before each key declaration (treated
+as definition) indicates the value type of the property.
+}
+
+
+{
+ *  kCFStreamPropertyFTPUserName
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations.  CFString
+ *    type to hold login user name.  Don't set this property if you
+ *    want anonymous FTP.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPUserName: CFStringRef; external name '_kCFStreamPropertyFTPUserName'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPPassword
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations. CFString
+ *    type to hold login password.  Don't set this property if you want
+ *    anonymous FTP.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPPassword: CFStringRef; external name '_kCFStreamPropertyFTPPassword'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPUsePassiveMode
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations. CFBoolean
+ *    type. kCFBooleanTrue means use passive mode, kCFBooleanFalse
+ *    otherwise
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPUsePassiveMode: CFStringRef; external name '_kCFStreamPropertyFTPUsePassiveMode'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPResourceSize
+ *  
+ *  Discussion:
+ *    Stream property key, for read stream copy operations.  CFNumber
+ *    of kCFNumberLongLongType to hold resource size in bytes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPResourceSize: CFStringRef; external name '_kCFStreamPropertyFTPResourceSize'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPFetchResourceInfo
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations.  CFBoolean
+ *    type.  TRUE means that resource info, such as size, must be
+ *    provided before download starts at higher cost.  Don't set if
+ *    resource size/other info is unnecessary.  Initially, only
+ *    resource size is implemented.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPFetchResourceInfo: CFStringRef; external name '_kCFStreamPropertyFTPFetchResourceInfo'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPFileTransferOffset
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations.  CFNumber
+ *    of kCFNumberLongLongType for the file offset to start transfer at.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPFileTransferOffset: CFStringRef; external name '_kCFStreamPropertyFTPFileTransferOffset'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPAttemptPersistentConnection
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations.  CFBoolean
+ *    type.  TRUE by default, set to FALSE to avoid reusing existing
+ *    server connections.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPAttemptPersistentConnection: CFStringRef; external name '_kCFStreamPropertyFTPAttemptPersistentConnection'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPProxy
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations. 
+ *    CFDictionary type that holds key-value pairs of proxy dictionary.
+ *     The dictionary returned by SystemConfiguration can also be
+ *    passed directly as the value.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPProxy: CFStringRef; external name '_kCFStreamPropertyFTPProxy'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPProxyHost
+ *  
+ *  Discussion:
+ *    Stream property key or FTP Proxy dictionary key, for both set and
+ *    copy operations.  It matches kSCPropNetProxiesFTPProxy defined in
+ *    SCSchemaDefinitions.h.  CFString for proxy server host name. 
+ *    This property can be set and copied individually or via a
+ *    CFDictionary.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPProxyHost: CFStringRef; external name '_kCFStreamPropertyFTPProxyHost'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyFTPProxyPort
+ *  
+ *  Discussion:
+ *    Stream property key or FTP Proxy dictionary key, for both set and
+ *    copy operations.  It matches kSCPropNetProxiesFTPPort defined in
+ *    SCSchemaDefinitions.h.  CFNumber of kCFNumberIntType for proxy
+ *    server port number.  This property can be set and copied
+ *    individually or via a CFDictionary.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPProxyPort: CFStringRef; external name '_kCFStreamPropertyFTPProxyPort'; (* attribute const *)
+
+{
+ *  kCFStreamPropertyFTPProxyUser
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPProxyUser: CFStringRef; external name '_kCFStreamPropertyFTPProxyUser'; (* attribute const *)
+{
+ *  kCFStreamPropertyFTPProxyPassword
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyFTPProxyPassword: CFStringRef; external name '_kCFStreamPropertyFTPProxyPassword'; (* attribute const *)
+
+
+{
+CFDictionary keys for resource information.  The information is
+extracted from a line of the directory list by function
+CFFTPCreateParsedResourceListing.
+}
+
+
+{
+ *  kCFFTPResourceMode
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFNumber to hold the
+ *    resource access permission defined in sys/types.h.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceMode: CFStringRef; external name '_kCFFTPResourceMode'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceName
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFString that holds
+ *    the resource name.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceName: CFStringRef; external name '_kCFFTPResourceName'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceOwner
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFString that holds
+ *    the resource owner's name.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceOwner: CFStringRef; external name '_kCFFTPResourceOwner'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceGroup
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFString to hold the
+ *    name of the group that shares the resource.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceGroup: CFStringRef; external name '_kCFFTPResourceGroup'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceLink
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFString to hold
+ *    symbolic link information.  If the item is a symbolic link the
+ *    string will contain the path to the item the link references.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceLink: CFStringRef; external name '_kCFFTPResourceLink'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceSize
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFNumber of
+ *    kCFNumberLongLongType to hold the resource length in bytes.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceSize: CFStringRef; external name '_kCFFTPResourceSize'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceType
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFNumber to hold the
+ *    resource type as defined in sys/dirent.h.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceType: CFStringRef; external name '_kCFFTPResourceType'; (* attribute const *)
+
+
+{
+ *  kCFFTPResourceModDate
+ *  
+ *  Discussion:
+ *    CFDictinary key, for get value operation.  CFDate to hold the
+ *    last modification date and time information.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFFTPResourceModDate: CFStringRef; external name '_kCFFTPResourceModDate'; (* attribute const *)
+
+
+{
+ *  CFReadStreamCreateWithFTPURL()
+ *  
+ *  Discussion:
+ *    Create an FTP read stream for downloading operation from an FTP
+ *    URL. If the URL refers to a directory, the stream is a filtered
+ *    line-at-a-time read stream corresponding to the listing results
+ *    provided by the server. If it's a file, then the stream is a
+ *    regular read stream providing the data for that file.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      A pointer to the CFAllocator which should be used to allocate
+ *      memory for the CF read stream and its storage for values. If
+ *      this reference is not a valid CFAllocator, the behavior is
+ *      undefined.
+ *    
+ *    ftpURL:
+ *      A pointer to a CFURL structure created by CFURLCreateWithString
+ *      function.  If this parameter is not a pointer to a valid CFURL
+ *      structure, the behavior is undefined.
+ *  
+ *  Result:
+ *    A pointer to the CF read stream created, or NULL if failed. It is
+ *    caller's responsibilty to release the memory allocated for the
+ *    read stream.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFReadStreamCreateWithFTPURL( alloc: CFAllocatorRef; ftpURL: CFURLRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithFTPURL';
+
+
+{
+ *  CFFTPCreateParsedResourceListing()
+ *  
+ *  Discussion:
+ *    Parse a line of file or folder listing of Unix format, and store
+ *    the extracted result in a CFDictionary.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      A pointer to the CFAllocator which should be used to allocate
+ *      memory for the CFDictionary to hold resource info.  If this
+ *      reference is not a valid CFAllocator, the behavior is undefined.
+ *    
+ *    buffer:
+ *      A pointer to a buffer that may hold lines of resource listing,
+ *      but only the first line starting from buffer[0] will be parsed
+ *      each call.
+ *    
+ *    bufferLength:
+ *      The maximum buffer size in bytes started from the location
+ *      pointed by "buffer."
+ *    
+ *    parsed:
+ *      A pointer to a CFDictionary pointer.  The dictionary holds the
+ *      extracted resource information.  When parsing fails, a NULL
+ *      pointer will be returned.  It is caller's responsibilty to
+ *      release the memory allocated for the dictionary.
+ *  
+ *  Result:
+ *    The number of bytes consumed from buffer, 0 if there are not
+ *    enough bytes, or -1 if a parse failure occurs.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFFTPCreateParsedResourceListing( alloc: CFAllocatorRef; buffer: UnivPtr; bufferLength: CFIndex; var parsed: CFDictionaryRef ): CFIndex; external name '_CFFTPCreateParsedResourceListing';
+
+
+{
+ *  CFWriteStreamCreateWithFTPURL()
+ *  
+ *  Discussion:
+ *    Create an FTP write stream for uploading operation to a FTP URL.
+ *    If the URL specifies a directory, the open will be followed by a
+ *    close event/state and the directory will have been created. 
+ *    Intermediary directory structure is not created.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      A pointer to the CFAllocator which should be used to allocate
+ *      memory for the CF read stream and its storage for values. If
+ *      this reference is not a valid CFAllocator, the behavior is
+ *      undefined.
+ *    
+ *    ftpURL:
+ *      A pointer to a CFURL structure created by CFURLCreateWithString
+ *      function.  If this parameter is not a pointer to a valid CFURL
+ *      structure, the behavior is undefined.
+ *  
+ *  Result:
+ *    A pointer to the CF write stream created, or NULL if failed. It
+ *    is caller's responsibilty to release the memory allocated for the
+ *    write stream.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFWriteStreamCreateWithFTPURL( alloc: CFAllocatorRef; ftpURL: CFURLRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithFTPURL';
+
+end.

+ 408 - 0
packages/extra/univint/CFHTTPMessage.pas

@@ -0,0 +1,408 @@
+{
+     File:       CFNetwork/CFHTTPMessage.h
+ 
+     Contains:   CoreFoundation Network socket streams header
+ 
+     Version:    CFNetwork-71.2~1
+ 
+     Copyright:  © 2001-2003 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFHTTPMessage;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFString,CFURL,CFBase,CFData,CFDictionary;
+{$ALIGN MAC68K}
+
+{
+ *  kCFHTTPVersion1_0
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+var kCFHTTPVersion1_0: CFStringRef; external name '_kCFHTTPVersion1_0'; (* attribute const *)
+{
+ *  kCFHTTPVersion1_1
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+var kCFHTTPVersion1_1: CFStringRef; external name '_kCFHTTPVersion1_1'; (* attribute const *)
+{
+ *  kCFHTTPAuthenticationSchemeBasic
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFHTTPAuthenticationSchemeBasic: CFStringRef; external name '_kCFHTTPAuthenticationSchemeBasic'; (* attribute const *)
+{
+ *  kCFHTTPAuthenticationSchemeDigest
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFHTTPAuthenticationSchemeDigest: CFStringRef; external name '_kCFHTTPAuthenticationSchemeDigest'; (* attribute const *)
+{ Currently unsupported }
+type
+	CFHTTPMessageRef    = ^SInt32; { an opaque 32-bit type }
+{
+ *  CFHTTPMessageGetTypeID()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageGetTypeID: CFTypeID; external name '_CFHTTPMessageGetTypeID';
+
+
+{
+ *  CFHTTPMessageCreateRequest()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCreateRequest( allocator: CFAllocatorRef; requestMethod: CFStringRef; url: CFURLRef; httpVersion: CFStringRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateRequest';
+
+
+{ Pass NULL to use the standard description for the given status code, as found in RFC 2616}
+{
+ *  CFHTTPMessageCreateResponse()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCreateResponse( allocator: CFAllocatorRef; statusCode: SInt32; statusDescription: CFStringRef; httpVersion: CFStringRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateResponse';
+
+
+{ Creates an empty request or response, which you can then append bytes to via CFHTTPMessageAppendBytes().  The HTTP header information will be parsed out as the bytes are appended.}
+{
+ *  CFHTTPMessageCreateEmpty()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCreateEmpty( allocator: CFAllocatorRef; isRequest: Boolean ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateEmpty';
+
+
+{
+ *  CFHTTPMessageCreateCopy()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCreateCopy( allocator: CFAllocatorRef; message: CFHTTPMessageRef ): CFHTTPMessageRef; external name '_CFHTTPMessageCreateCopy';
+
+
+{ Whether the message is a response or a request}
+{
+ *  CFHTTPMessageIsRequest()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageIsRequest( message: CFHTTPMessageRef ): Boolean; external name '_CFHTTPMessageIsRequest';
+
+
+{
+ *  CFHTTPMessageCopyVersion()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyVersion( message: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyVersion';
+
+
+{
+ *  CFHTTPMessageCopyBody()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyBody( message: CFHTTPMessageRef ): CFDataRef; external name '_CFHTTPMessageCopyBody';
+
+
+{
+ *  CFHTTPMessageSetBody()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+procedure CFHTTPMessageSetBody( message: CFHTTPMessageRef; bodyData: CFDataRef ); external name '_CFHTTPMessageSetBody';
+
+
+{
+ *  CFHTTPMessageCopyHeaderFieldValue()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyHeaderFieldValue( message: CFHTTPMessageRef; headerField: CFStringRef ): CFStringRef; external name '_CFHTTPMessageCopyHeaderFieldValue';
+
+
+{
+ *  CFHTTPMessageCopyAllHeaderFields()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyAllHeaderFields( message: CFHTTPMessageRef ): CFDictionaryRef; external name '_CFHTTPMessageCopyAllHeaderFields';
+
+
+{
+ *  CFHTTPMessageSetHeaderFieldValue()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+procedure CFHTTPMessageSetHeaderFieldValue( message: CFHTTPMessageRef; headerField: CFStringRef; value: CFStringRef ); external name '_CFHTTPMessageSetHeaderFieldValue';
+
+
+{ The following function appends the given bytes to the message given (parsing out any control information if appropriate).  Returns FALSE if a parsing error occurs while processing the new data.}
+{
+ *  CFHTTPMessageAppendBytes()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageAppendBytes( message: CFHTTPMessageRef; newBytes: UnivPtr; numBytes: CFIndex ): Boolean; external name '_CFHTTPMessageAppendBytes';
+
+
+{ Whether further header data is expected by the message}
+{
+ *  CFHTTPMessageIsHeaderComplete()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageIsHeaderComplete( message: CFHTTPMessageRef ): Boolean; external name '_CFHTTPMessageIsHeaderComplete';
+
+
+{
+ *  CFHTTPMessageCopySerializedMessage()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopySerializedMessage( request: CFHTTPMessageRef ): CFDataRef; external name '_CFHTTPMessageCopySerializedMessage';
+
+
+{*******************}
+{ Request functions }
+{*******************}
+{
+ *  CFHTTPMessageCopyRequestURL()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyRequestURL( request: CFHTTPMessageRef ): CFURLRef; external name '_CFHTTPMessageCopyRequestURL';
+
+
+{
+ *  CFHTTPMessageCopyRequestMethod()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyRequestMethod( request: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyRequestMethod';
+
+
+{ Tries to modify request to contain the authentication information 
+   requested by authenticationFailureResponse (which presumably is a 
+   401 or 407 response).  Returns TRUE if successful; FALSE otherwise 
+   (leaving request unmodified).  If authenticationScheme is NULL, the 
+   strongest supported scheme listed in failedResponse will be used. }
+{
+ *  CFHTTPMessageAddAuthentication()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageAddAuthentication( request: CFHTTPMessageRef; authenticationFailureResponse: CFHTTPMessageRef; username: CFStringRef; password: CFStringRef; authenticationScheme: CFStringRef; forProxy: Boolean ): Boolean; external name '_CFHTTPMessageAddAuthentication';
+
+
+{********************}
+{ Response functions }
+{********************}
+{
+ *  CFHTTPMessageGetResponseStatusCode()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageGetResponseStatusCode( response: CFHTTPMessageRef ): UInt32; external name '_CFHTTPMessageGetResponseStatusCode';
+
+
+{
+ *  CFHTTPMessageCopyResponseStatusLine()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFHTTPMessageCopyResponseStatusLine( response: CFHTTPMessageRef ): CFStringRef; external name '_CFHTTPMessageCopyResponseStatusLine';
+
+end.

+ 307 - 0
packages/extra/univint/CFHTTPStream.pas

@@ -0,0 +1,307 @@
+{
+     File:       CFNetwork/CFHTTPStream.h
+ 
+     Contains:   CoreFoundation Network HTTP streams header
+ 
+     Version:    CFNetwork-71.2~1
+ 
+     Copyright:  © 2001-2003 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFHTTPStream;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFStream,CFBase,CFHTTPMessage;
+{$ALIGN MAC68K}
+
+{
+ *  kCFStreamErrorDomainHTTP
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+var kCFStreamErrorDomainHTTP: SInt32; external name '_kCFStreamErrorDomainHTTP'; (* attribute const *)
+type
+	CFStreamErrorHTTP = SInt32;
+const
+  kCFStreamErrorHTTPParseFailure = -1;
+  kCFStreamErrorHTTPRedirectionLoop = -2;
+  kCFStreamErrorHTTPBadURL      = -3;
+
+{ Value is a CFHTTPMessage with 0 bytes data. }
+{
+ *  kCFStreamPropertyHTTPResponseHeader
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+var kCFStreamPropertyHTTPResponseHeader: CFStringRef; external name '_kCFStreamPropertyHTTPResponseHeader'; (* attribute const *)
+{ Value is the CFURL from the final request; will only differ from the URL in the original request if an autoredirection has occurred. }
+{
+ *  kCFStreamPropertyHTTPFinalURL
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPFinalURL: CFStringRef; external name '_kCFStreamPropertyHTTPFinalURL'; (* attribute const *)
+{************************************}
+{Set-able properties on HTTP streams }
+{************************************}
+{ HTTP proxy information is set the same way as SOCKS proxies (see CFSocketStream.h).
+   Call CFReadStreamSetProperty() passing an HTTP stream and the property kCFStreamPropertyHTTPProxy.  
+   The value should be a CFDictionary that includes at least one Host/Port pair from the keys below.  
+   The dictionary returned by SystemConfiguration.framework can also be passed directly as the value }
+{
+ *  kCFStreamPropertyHTTPProxy
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPProxy: CFStringRef; external name '_kCFStreamPropertyHTTPProxy'; (* attribute const *)
+{
+ *  kCFStreamPropertyHTTPProxyHost
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPProxyHost'; (* attribute const *)
+{ matches kSCPropNetProxiesHTTPProxy; value should be a CFString}
+{
+ *  kCFStreamPropertyHTTPProxyPort
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPProxyPort'; (* attribute const *)
+{ matches kSCPropNetProxiesHTTPPort; value should be a CFNumber }
+{
+ *  kCFStreamPropertyHTTPSProxyHost
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPSProxyHost: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyHost'; (* attribute const *)
+{ matches kSCPropNetProxiesHTTPSProxy; value should be a CFString }
+{
+ *  kCFStreamPropertyHTTPSProxyPort
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPSProxyPort: CFStringRef; external name '_kCFStreamPropertyHTTPSProxyPort'; (* attribute const *)
+{ matches kSCPropNetProxiesHTTPSPort; value should be a CFNumber }
+{ Value should be a CFBoolean }
+{
+ *  kCFStreamPropertyHTTPShouldAutoredirect
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPShouldAutoredirect: CFStringRef; external name '_kCFStreamPropertyHTTPShouldAutoredirect'; (* attribute const *)
+{ Value should be a CFBoolean.  If this property is set to true, an HTTP stream will look for an appropriate extant persistent connection to use, and if it finds none, will try to create one.  }
+{
+ *  kCFStreamPropertyHTTPAttemptPersistentConnection
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamPropertyHTTPAttemptPersistentConnection: CFStringRef; external name '_kCFStreamPropertyHTTPAttemptPersistentConnection'; (* attribute const *)
+{ Value is a CFNumber; this property can only be retrieved, not set.  The number returned is the number of bytes from the body of the request that have been written to the underlying socket }
+{
+ *  kCFStreamPropertyHTTPRequestBytesWrittenCount
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertyHTTPRequestBytesWrittenCount: CFStringRef; external name '_kCFStreamPropertyHTTPRequestBytesWrittenCount'; (* attribute const *)
+{*******************}
+{ Creation routines }
+{*******************}
+{ Creates a read stream for the response to the given request; when the stream is opened,
+  it will begin transmitting the request.  The bytes returned are the pure body bytes; the response header has been parsed off.
+  To retrieve the response header, ask for kCFStreamPropertyHTTPResponseHeader, above, any time after the first bytes arrive on 
+  the stream (or when stream end is reported, if there are no data bytes).
+}
+{
+ *  CFReadStreamCreateForHTTPRequest()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+function CFReadStreamCreateForHTTPRequest( alloc: CFAllocatorRef; request: CFHTTPMessageRef ): CFReadStreamRef; external name '_CFReadStreamCreateForHTTPRequest';
+
+
+{ Creates a read stream for the response to the given requestHeaders plus requestBody.  Use in preference to
+  CFReadStreamCreateForHTTPRequest() when the body of the request is larger than you wish to be resident in memory.  Note that 
+  because streams cannot be reset, read streams created this way cannot have autoredirection enabled.  If the Content-Length 
+  header is set in requestHeaders, it is assumed that the caller got the length right and that requestBody will report 
+  end-of-stream after precisely Content-Length bytes have been read from it.  If the Content-Length header is not set, the 
+  chunked transfer-encoding will be added to requestHeaders, and bytes read from requestBody will be transmitted chunked.
+  The body of requestHeaders is ignored.
+}
+{
+ *  CFReadStreamCreateForStreamedHTTPRequest()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFReadStreamCreateForStreamedHTTPRequest( alloc: CFAllocatorRef; requestHeaders: CFHTTPMessageRef; requestBody: CFReadStreamRef ): CFReadStreamRef; external name '_CFReadStreamCreateForStreamedHTTPRequest';
+
+
+{ Deprecated - Use the properties kCFStreamPropertyHTTPShouldAutoredirect and kCFStreamPropertyHTTPProxy above instead }
+{
+ *  CFHTTPReadStreamSetRedirectsAutomatically()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+procedure CFHTTPReadStreamSetRedirectsAutomatically( httpStream: CFReadStreamRef; shouldAutoRedirect: Boolean ); external name '_CFHTTPReadStreamSetRedirectsAutomatically';
+
+
+{
+ *  CFHTTPReadStreamSetProxy()
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+procedure CFHTTPReadStreamSetProxy( httpStream: CFReadStreamRef; proxyHost: CFStringRef; proxyPort: CFIndex ); external name '_CFHTTPReadStreamSetProxy';
+
+end.

+ 667 - 0
packages/extra/univint/CFHost.pas

@@ -0,0 +1,667 @@
+{
+     File:       CFNetwork/CFHost.h
+ 
+     Contains:   CoreFoundation CFHost header
+ 
+     Version:    CFNetwork-71.2~1
+ 
+     Copyright:  © 2001-2003 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFHost;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData,CFArray,CFRunLoop,CFStream;
+{$ALIGN MAC68K}
+
+{
+ *  CFHostRef
+ *  
+ *  Discussion:
+ *    This is the type of a reference to a host name or address lookup.
+ }
+type
+	CFHostRef    = ^SInt32; { an opaque 32-bit type }
+
+{
+ *  kCFStreamErrorDomainNetDB
+ *  
+ *  Discussion:
+ *    Errors listed in netdb.h
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamErrorDomainNetDB: SInt32; external name '_kCFStreamErrorDomainNetDB'; (* attribute const *)
+
+
+{
+ *  kCFStreamErrorDomainSystemConfiguration
+ *  
+ *  Discussion:
+ *    Errors listed in SystemConfiguration/SystemConfiguration.h
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamErrorDomainSystemConfiguration: SInt32; external name '_kCFStreamErrorDomainSystemConfiguration'; (* attribute const *)
+
+
+{
+ *  CFHostInfoType
+ *  
+ *  Discussion:
+ *    Host information types to be resolved.
+ }
+type
+	CFHostInfoType = SInt32;
+const
+  {
+   * Results value is a CFArray of CFData's (each being a struct
+   * sockaddr)
+   }
+  kCFHostAddresses              = 0;
+
+  {
+   * Results value is a CFArray of CFString's
+   }
+  kCFHostNames                  = 1;
+
+  {
+   * Results value is a CFData wrapping SCNetworkConnectionFlags
+   * (defined in SystemConfiguration/SCNetwork.h)
+   }
+  kCFHostReachability           = 2;
+
+
+{
+ *  CFHostClientContext
+ *  
+ *  Discussion:
+ *    Structure containing the user-defined data and callbacks for
+ *    CFHost objects.
+ }
+type
+	CFHostClientContext = record
+		{
+		 * The version number of the structure type being passed in as a
+		 * parameter to the CFHost client function. Valid version number is
+		 * currently 0.
+		 }
+		version: CFIndex;
+	
+		{
+		 * An arbitrary pointer to client-defined data, which can be
+		 * associated with the host and is passed to the callbacks.
+		 }
+		info: Ptr;
+	
+		{
+		 * The callback used to add a retain for the host on the info pointer
+		 * for the life of the host, and may be used for temporary references
+		 * the host needs to take. This callback returns the actual info
+		 * pointer to store in the host, almost always just the pointer
+		 * passed as the parameter.
+		 }
+		retain: CFAllocatorRetainCallBack;
+	
+		{
+		 * The callback used to remove a retain previously added for the host
+		 * on the info pointer.
+		 }
+		release: CFAllocatorReleaseCallBack;
+	
+		{
+		 * The callback used to create a descriptive string representation of
+		 * the info pointer (or the data pointed to by the info pointer) for
+		 * debugging purposes. This is used by the CFCopyDescription()
+		 * function.
+		 }
+		copyDescription: CFAllocatorCopyDescriptionCallBack;
+	end;
+	CFHostClientContextPtr = ^CFHostClientContext;
+
+{
+ *  CFHostClientCallBack
+ *  
+ *  Discussion:
+ *    Callback function which is called upon error or completion of an
+ *    asynchronous resolve.
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      Host whose resolution is complete.
+ *    
+ *    typeInfo:
+ *      Enum representing which info resolution is complete.
+ *    
+ *    error:
+ *      Reference to an error structure if the resolution failed.
+ *    
+ *    info:
+ *      Client's info reference which was passed into the client
+ *      context.
+ }
+type CFHostClientCallBack = procedure( theHost: CFHostRef; typeInfo: CFHostInfoType; const (*var*) error: CFStreamError; info: UnivPtr );
+
+
+{
+ *  CFHostGetTypeID()
+ *  
+ *  Discussion:
+ *    Returns the type identifier of all CFHost instances.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostGetTypeID: CFTypeID; external name '_CFHostGetTypeID';
+
+
+{
+ *  CFHostCreateWithName()
+ *  
+ *  Discussion:
+ *    Creates a new host object with the given name.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    allocator:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      host. If this reference is not a valid CFAllocator, the
+ *      behavior is undefined.
+ *    
+ *    hostname:
+ *      A CFStringRef representing the name of the host. Must be
+ *      non-NULL.  If this If this reference is not a valid
+ *      CFStringRef, the behavior is undefined.
+ *  
+ *  Result:
+ *    A valid CFHostRef which may now be resolved, or NULL if
+ *    unsuccessful.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostCreateWithName( allocator: CFAllocatorRef; hostname: CFStringRef ): CFHostRef; external name '_CFHostCreateWithName';
+
+
+{
+ *  CFHostCreateWithAddress()
+ *  
+ *  Discussion:
+ *    Creates a new host object with the given address.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    allocator:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      host. If this reference is not a valid CFAllocator, the
+ *      behavior is undefined.
+ *    
+ *    addr:
+ *      A CFDataRef containing a struct sockaddr which is the address
+ *      of the host. Must be non-NULL.  If this If this reference is
+ *      not a valid CFDataRef, the behavior is undefined.
+ *  
+ *  Result:
+ *    A valid CFHostRef which may now be resolved, or NULL if
+ *    unsuccessful.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostCreateWithAddress( allocator: CFAllocatorRef; addr: CFDataRef ): CFHostRef; external name '_CFHostCreateWithAddress';
+
+
+{
+ *  CFHostCreateCopy()
+ *  
+ *  Discussion:
+ *    Creates a new host object as a copy of host argument.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      new host. If this reference is not a valid CFAllocator, the
+ *      behavior is undefined.
+ *    
+ *    host:
+ *      A CFHostRef representing the original host. Must be non-NULL. 
+ *      If this If this reference is not a valid CFHostRef, the
+ *      behavior is undefined.
+ *  
+ *  Result:
+ *    A valid CFHostRef which contains a copy of all previously
+ *    resolved data from the original.  NULL is returned in the case of
+ *    failure.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostCreateCopy( alloc: CFAllocatorRef; host: CFHostRef ): CFHostRef; external name '_CFHostCreateCopy';
+
+
+{
+ *  CFHostStartInfoResolution()
+ *  
+ *  Discussion:
+ *    Performs a lookup for the given host.  It will search for the
+ *    requested information if there is no other active request. 
+ *    Previously cached information of the given type will be released.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which should be resolved. Must be non-NULL. If
+ *      this reference is not a valid CFHostRef, the behavior is
+ *      undefined.
+ *    
+ *    info:
+ *      The enum representing the type of information to be retrieved. 
+ *      If the value is not a valid type, the behavior is undefined.
+ *    
+ *    error:
+ *      A reference to a CFStreamError structure which will be filled
+ *      with any error information should an error occur.  May be set
+ *      to NULL if error information is not wanted.
+ *  
+ *  Result:
+ *    Returns TRUE on success and FALSE on failure.  In asynchronous
+ *    mode, this function will return immediately.  In synchronous
+ *    mode, it will block until the resolve has completed or until the
+ *    resolve is cancelled.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostStartInfoResolution( theHost: CFHostRef; info: CFHostInfoType; error: CFStreamErrorPtr ): Boolean; external name '_CFHostStartInfoResolution';
+
+
+{
+ *  CFHostGetAddressing()
+ *  
+ *  Discussion:
+ *    Tries to retrieve the known addresses from the given host.
+ *    Returns a CFArrayRef of addresses if known and there were some.
+ *    NULL is returned otherwise.  Each address is a CFDataRef wrapping
+ *    a struct sockaddr.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the host is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which contains the relevant information. Must be
+ *      non-NULL. If this reference is not a valid CFHostRef, the
+ *      behavior is undefined.
+ *    
+ *    hasBeenResolved:
+ *      A reference to a Boolean which returns FALSE if the information
+ *      was not available (e.g. CFHostStartInfoResolution has not been
+ *      called), otherwise TRUE will be returned.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostGetAddressing( theHost: CFHostRef; var hasBeenResolved: Boolean ): CFArrayRef; external name '_CFHostGetAddressing';
+
+
+{
+ *  CFHostGetNames()
+ *  
+ *  Discussion:
+ *    Tries to retrieve the names/aliases from the given host. Returns
+ *    a CFArrayRef of names for the given host.  NULL is returned
+ *    otherwise.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the host is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which contains the relevant information. Must be
+ *      non-NULL. If this reference is not a valid CFHostRef, the
+ *      behavior is undefined.
+ *    
+ *    hasBeenResolved:
+ *      A reference to a Boolean which returns FALSE if the information
+ *      was not available (e.g. CFHostStartInfoResolution has not been
+ *      called), otherwise TRUE will be returned.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostGetNames( theHost: CFHostRef; var hasBeenResolved: Boolean ): CFArrayRef; external name '_CFHostGetNames';
+
+
+{
+ *  CFHostGetReachability()
+ *  
+ *  Discussion:
+ *    Tries to retrieve the reachability of the given host. Returns a
+ *    CFDataRef which wraps the reachability flags. NULL will be
+ *    returned if the value has not been resolved. The possible values
+ *    of these flags is declared in SystemConfiguration/SCNetwork.h.
+ *    Returns FALSE if the information was not available, otherwise
+ *    TRUE will be returned with the results containing the requested
+ *    information.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the host is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which contains the relevant information. Must be
+ *      non-NULL. If this reference is not a valid CFHostRef, the
+ *      behavior is undefined.
+ *    
+ *    hasBeenResolved:
+ *      A reference to a Boolean which returns FALSE if the information
+ *      was not available (e.g. CFHostStartInfoResolution has not been
+ *      called), otherwise TRUE will be returned.  can be NULL
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostGetReachability( theHost: CFHostRef; hasBeenResolved: BooleanPtr ): CFDataRef; external name '_CFHostGetReachability';
+
+
+{
+ *  CFHostCancelInfoResolution()
+ *  
+ *  Discussion:
+ *    Cancels an outstanding asynchronous or synchronous resolve.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which is currently resolving.  Must be non-NULL.
+ *      If this reference is not a valid CFHostRef, the behavior is
+ *      undefined.
+ *    
+ *    info:
+ *      The enum representing which resolution to be canceled.  If the
+ *      value is not a valid type, the behavior is undefined.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure CFHostCancelInfoResolution( theHost: CFHostRef; info: CFHostInfoType ); external name '_CFHostCancelInfoResolution';
+
+
+{
+ *  CFHostSetClient()
+ *  
+ *  Discussion:
+ *    Associates a client context and callback function with a
+ *    CFHostRef.  This is required for asynchronous usage.  If not set,
+ *    resolve will take place synchronously.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which is getting a client.  Must be non-NULL. If
+ *      this reference is not a valid CFHostRef, the behavior is
+ *      undefined.
+ *    
+ *    clientCB:
+ *      A CFHostClientCallBack which will be called when the resolve
+ *      completes or is cancelled.  Use NULL to remove the client
+ *      association with a host object.
+ *    
+ *    clientContext:
+ *      A CFHostClientContext which is used to set the contextual
+ *      information associated with the host object.  The info pointer
+ *      from the struct will be passed to the callback function. If
+ *      setting a client, this value must be non-NULL.
+ *  
+ *  Result:
+ *    Returns TRUE if the procedure was a success, otherwise it returns
+ *    FALSE.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFHostSetClient( theHost: CFHostRef; clientCB: CFHostClientCallBack; clientContext: CFHostClientContextPtr ): Boolean; external name '_CFHostSetClient';
+
+
+{
+ *  CFHostScheduleWithRunLoop()
+ *  
+ *  Discussion:
+ *    Schedules the given host on a run loop and mode so the client
+ *    will receive its callbacks on that loop and mode.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which is being scheduled.  Must be non-NULL. If
+ *      this reference is not a valid CFHostRef, the behavior is
+ *      undefined.
+ *    
+ *    runLoop:
+ *      A CFRunLoopRef on which the host should be scheduled. Must be
+ *      non-NULL.  If this reference is not a valid CFRunLoopRef, the
+ *      behavior is undefined.
+ *    
+ *    runLoopMode:
+ *      A CFStringRef which is the mode in which the run loop will be
+ *      running when notification occurs.  Must be non-NULL. If this
+ *      reference is not a valid CFStringRef, the behavior is undefined.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure CFHostScheduleWithRunLoop( theHost: CFHostRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFHostScheduleWithRunLoop';
+
+
+{
+ *  CFHostUnscheduleFromRunLoop()
+ *  
+ *  Discussion:
+ *    Unschedules the given host from a run loop and mode so the client
+ *    will not receive its callbacks on that loop and mode.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theHost:
+ *      The CFHostRef which is being unscheduled.  Must be non-NULL. If
+ *      this reference is not a valid CFHostRef, the behavior is
+ *      undefined.
+ *    
+ *    runLoop:
+ *      A CFRunLoopRef on which the host is scheduled and should now be
+ *      unscheduled.  Must be non-NULL.  If this reference is not a
+ *      valid CFRunLoopRef, the behavior is undefined.
+ *    
+ *    runLoopMode:
+ *      A CFStringRef which is the mode in which the host is scheduled
+ *      and should be unscheduled.  Must be non-NULL. If this reference
+ *      is not a valid CFStringRef, the behavior is undefined.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure CFHostUnscheduleFromRunLoop( theHost: CFHostRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFHostUnscheduleFromRunLoop';
+
+
+end.

+ 259 - 0
packages/extra/univint/CFLocale.pas

@@ -0,0 +1,259 @@
+{	CFLocale.h
+	Copyright (c) 2002-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFLocale;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFDictionary;
+{$ALIGN POWER}
+
+
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
+
+
+type
+	CFLocaleRef = ^SInt32; { an opaque 32-bit type }
+
+function CFLocaleGetTypeID: CFTypeID; external name '_CFLocaleGetTypeID';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFLocaleGetSystem: CFLocaleRef; external name '_CFLocaleGetSystem';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns the "root", canonical locale.  Contains fixed "backstop" settings.
+
+function CFLocaleCopyCurrent: CFLocaleRef; external name '_CFLocaleCopyCurrent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns the logical "user" locale for the current user.
+	// [This is Copy in the sense that you get a retain you have to release,
+	// but we may return the same cached object over and over.]  Settings
+	// you get from this locale do not change under you as CFPreferences
+	// are changed (for safety and correctness).  Generally you would not
+	// grab this and hold onto it forever, but use it to do the operations
+	// you need to do at the moment, then throw it away.  (The non-changing
+	// ensures that all the results of your operations are consistent.)
+
+function CFLocaleCopyAvailableLocaleIdentifiers: CFArrayRef; external name '_CFLocaleCopyAvailableLocaleIdentifiers';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Returns an array of CFStrings that represents all locales for
+	// which locale data is available.
+
+function CFLocaleCopyISOLanguageCodes: CFArrayRef; external name '_CFLocaleCopyISOLanguageCodes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Returns an array of CFStrings that represents all known legal ISO
+	// language codes.  Note: many of these will not have any supporting
+	// locale data in Mac OS X.
+
+function CFLocaleCopyISOCountryCodes: CFArrayRef; external name '_CFLocaleCopyISOCountryCodes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Returns an array of CFStrings that represents all known legal ISO
+	// country codes.  Note: many of these will not have any supporting
+	// locale data in Mac OS X.
+
+function CFLocaleCopyISOCurrencyCodes: CFArrayRef; external name '_CFLocaleCopyISOCurrencyCodes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Returns an array of CFStrings that represents all known legal ISO
+	// currency codes.  Note: some of these may not have any supporting
+	// locale data in Mac OS X.
+
+function CFLocaleCreateCanonicalLanguageIdentifierFromString( allocator: CFAllocatorRef; localeIdentifier: CFStringRef ): CFStringRef; external name '_CFLocaleCreateCanonicalLanguageIdentifierFromString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Map an arbitrary locale identification string (something close at
+	// least) to a canonical language-only identifier.
+
+function CFLocaleCreateCanonicalLocaleIdentifierFromString( allocator: CFAllocatorRef; localeIdentifier: CFStringRef ): CFStringRef; external name '_CFLocaleCreateCanonicalLocaleIdentifierFromString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Map an arbitrary locale identification string (something close at
+	// least) to the canonical identifier.
+
+function CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes( allocator: CFAllocatorRef; lcode: LangCode; rcode: RegionCode ): CFStringRef; external name '_CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Map a Mac OS LangCode and RegionCode to the canonical locale identifier.
+
+function CFLocaleCreateComponentsFromLocaleIdentifier( allocator: CFAllocatorRef; localeID: CFStringRef ): CFDictionaryRef; external name '_CFLocaleCreateComponentsFromLocaleIdentifier';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Parses a locale ID consisting of language, script, country, variant,
+	// and keyword/value pairs into a dictionary. The keys are the constant
+	// CFStrings corresponding to the locale ID components, and the values
+	// will correspond to constants where available.
+	// Example: "en_US@calendar=japanese" yields a dictionary with three
+	// entries: kCFLocaleLanguageCode=en, kCFLocaleCountryCode=US, and
+	// kCFLocaleCalendarIdentifier=kCFJapaneseCalendar.
+
+function CFLocaleCreateLocaleIdentifierFromComponents( allocator: CFAllocatorRef; dictionary: CFDictionaryRef ): CFStringRef; external name '_CFLocaleCreateLocaleIdentifierFromComponents';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Reverses the actions of CFLocaleCreateDictionaryFromLocaleIdentifier,
+	// creating a single string from the data in the dictionary. The
+	// dictionary {kCFLocaleLanguageCode=en, kCFLocaleCountryCode=US,
+	// kCFLocaleCalendarIdentifier=kCFJapaneseCalendar} becomes
+	// "en_US@calendar=japanese".
+
+function CFLocaleCreate( allocator: CFAllocatorRef; localeIdentifier: CFStringRef ): CFLocaleRef; external name '_CFLocaleCreate';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns a CFLocaleRef for the locale named by the "arbitrary" locale identifier.
+
+function CFLocaleCreateCopy( allocator: CFAllocatorRef; locale: CFLocaleRef ): CFLocaleRef; external name '_CFLocaleCreateCopy';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Having gotten a CFLocale from somebody, code should make a copy
+	// if it is going to use it for several operations
+	// or hold onto it.  In the future, there may be mutable locales.
+
+function CFLocaleGetIdentifier( locale: CFLocaleRef ): CFStringRef; external name '_CFLocaleGetIdentifier';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns the locale's identifier.  This may not be the same string
+	// that the locale was created with (CFLocale may canonicalize it).
+
+function CFLocaleGetValue( locale: CFLocaleRef; key: CFStringRef ): CFTypeRef; external name '_CFLocaleGetValue';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns the value for the given key.  This is how settings and state
+	// are accessed via a CFLocale.  Values might be of any CF type.
+
+function CFLocaleCopyDisplayNameForPropertyValue( displayLocale: CFLocaleRef; key: CFStringRef; value: CFStringRef ): CFStringRef; external name '_CFLocaleCopyDisplayNameForPropertyValue';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+	// Returns the display name for the given value.  The key tells what
+	// the value is, and is one of the usual locale property keys, though
+	// not all locale property keys have values with display name values.
+
+
+// Locale Keys
+var kCFLocaleIdentifier: CFStringRef; external name '_kCFLocaleIdentifier'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleLanguageCode: CFStringRef; external name '_kCFLocaleLanguageCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleCountryCode: CFStringRef; external name '_kCFLocaleCountryCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleScriptCode: CFStringRef; external name '_kCFLocaleScriptCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleVariantCode: CFStringRef; external name '_kCFLocaleVariantCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+var kCFLocaleExemplarCharacterSet: CFStringRef; external name '_kCFLocaleExemplarCharacterSet'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleCalendarIdentifier: CFStringRef; external name '_kCFLocaleCalendarIdentifier'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleCalendar: CFStringRef; external name '_kCFLocaleCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleCollationIdentifier: CFStringRef; external name '_kCFLocaleCollationIdentifier'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleUsesMetricSystem: CFStringRef; external name '_kCFLocaleUsesMetricSystem'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFLocaleMeasurementSystem: CFStringRef; external name '_kCFLocaleMeasurementSystem'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) // "Metric" or "U.S."
+var kCFLocaleDecimalSeparator: CFStringRef; external name '_kCFLocaleDecimalSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kCFLocaleGroupingSeparator: CFStringRef; external name '_kCFLocaleGroupingSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kCFLocaleCurrencySymbol: CFStringRef; external name '_kCFLocaleCurrencySymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kCFLocaleCurrencyCode: CFStringRef; external name '_kCFLocaleCurrencyCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) // ISO 3-letter currency code
+
+// Values for kCFLocaleCalendarIdentifier
+var kCFGregorianCalendar: CFStringRef; external name '_kCFGregorianCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+var kCFBuddhistCalendar: CFStringRef; external name '_kCFBuddhistCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFChineseCalendar: CFStringRef; external name '_kCFChineseCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFHebrewCalendar: CFStringRef; external name '_kCFHebrewCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFIslamicCalendar: CFStringRef; external name '_kCFIslamicCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFIslamicCivilCalendar: CFStringRef; external name '_kCFIslamicCivilCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFJapaneseCalendar: CFStringRef; external name '_kCFJapaneseCalendar'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+
+
+{#endif}
+
+
+end.

+ 130 - 0
packages/extra/univint/CFMachPort.pas

@@ -0,0 +1,130 @@
+{	CFMachPort.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFMachPort;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFRunLoop,MacOSXPosix;
+{$ALIGN POWER}
+
+
+type
+	CFMachPortRef = ^SInt32; { an opaque 32-bit type }
+
+type
+	CFMachPortContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+	CFMachPortContextPtr = ^CFMachPortContext;
+
+type
+	CFMachPortCallBack = procedure( port: CFMachPortRef; msg: UnivPtr; size: CFIndex; info: UnivPtr );
+	CFMachPortInvalidationCallBack = procedure( port: CFMachPortRef; info: UnivPtr );
+
+function CFMachPortGetTypeID: CFTypeID; external name '_CFMachPortGetTypeID';
+
+function CFMachPortCreate( allocator: CFAllocatorRef; callout: CFMachPortCallBack; var context: CFMachPortContext; var shouldFreeInfo: Boolean ): CFMachPortRef; external name '_CFMachPortCreate';
+function CFMachPortCreateWithPort( allocator: CFAllocatorRef; portNum: mach_port_t; callout: CFMachPortCallBack; var context: CFMachPortContext; var shouldFreeInfo: Boolean ): CFMachPortRef; external name '_CFMachPortCreateWithPort';
+
+function CFMachPortGetPort( port: CFMachPortRef ): mach_port_t; external name '_CFMachPortGetPort';
+procedure CFMachPortGetContext( port: CFMachPortRef; var context: CFMachPortContext ); external name '_CFMachPortGetContext';
+procedure CFMachPortInvalidate( port: CFMachPortRef ); external name '_CFMachPortInvalidate';
+function CFMachPortIsValid( port: CFMachPortRef ): Boolean; external name '_CFMachPortIsValid';
+function CFMachPortGetInvalidationCallBack( port: CFMachPortRef ): CFMachPortInvalidationCallBack; external name '_CFMachPortGetInvalidationCallBack';
+procedure CFMachPortSetInvalidationCallBack( port: CFMachPortRef; callout: CFMachPortInvalidationCallBack ); external name '_CFMachPortSetInvalidationCallBack';
+
+function CFMachPortCreateRunLoopSource( allocator: CFAllocatorRef; port: CFMachPortRef; order: CFIndex ): CFRunLoopSourceRef; external name '_CFMachPortCreateRunLoopSource';
+
+
+end.

+ 144 - 0
packages/extra/univint/CFMessagePort.pas

@@ -0,0 +1,144 @@
+{	CFMessagePort.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFMessagePort;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFString,CFRunLoop,CFData,CFDate;
+{$ALIGN POWER}
+
+
+type
+	CFMessagePortRef = ^SInt32; { an opaque 32-bit type }
+
+const
+	kCFMessagePortSuccess = 0;
+	kCFMessagePortSendTimeout = -1;
+	kCFMessagePortReceiveTimeout = -2;
+	kCFMessagePortIsInvalid = -3;
+	kCFMessagePortTransportError = -4;
+
+type
+	CFMessagePortContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+	CFMessagePortContextPtr = ^CFMessagePortContext;
+
+type
+	CFMessagePortCallBack = function( local: CFMessagePortRef; msgid: SInt32; data: CFDataRef; info: UnivPtr ): CFDataRef;
+{ If callout wants to keep a hold of the data past the return of the callout, it must COPY the data. This includes the case where the data is given to some routine which _might_ keep a hold of it; System will release returned CFData. }
+type
+	CFMessagePortInvalidationCallBack = procedure( ms: CFMessagePortRef; info: UnivPtr );
+
+function CFMessagePortGetTypeID: CFTypeID; external name '_CFMessagePortGetTypeID';
+
+function CFMessagePortCreateLocal( allocator: CFAllocatorRef; name: CFStringRef; callout: CFMessagePortCallBack; var context: CFMessagePortContext; var shouldFreeInfo: Boolean ): CFMessagePortRef; external name '_CFMessagePortCreateLocal';
+function CFMessagePortCreateRemote( allocator: CFAllocatorRef; name: CFStringRef ): CFMessagePortRef; external name '_CFMessagePortCreateRemote';
+
+function CFMessagePortIsRemote( ms: CFMessagePortRef ): Boolean; external name '_CFMessagePortIsRemote';
+function CFMessagePortGetName( ms: CFMessagePortRef ): CFStringRef; external name '_CFMessagePortGetName';
+function CFMessagePortSetName( ms: CFMessagePortRef; newName: CFStringRef ): Boolean; external name '_CFMessagePortSetName';
+procedure CFMessagePortGetContext( ms: CFMessagePortRef; var context: CFMessagePortContext ); external name '_CFMessagePortGetContext';
+procedure CFMessagePortInvalidate( ms: CFMessagePortRef ); external name '_CFMessagePortInvalidate';
+function CFMessagePortIsValid( ms: CFMessagePortRef ): Boolean; external name '_CFMessagePortIsValid';
+function CFMessagePortGetInvalidationCallBack( ms: CFMessagePortRef ): CFMessagePortInvalidationCallBack; external name '_CFMessagePortGetInvalidationCallBack';
+procedure CFMessagePortSetInvalidationCallBack( ms: CFMessagePortRef; callout: CFMessagePortInvalidationCallBack ); external name '_CFMessagePortSetInvalidationCallBack';
+
+{ NULL replyMode argument means no return value expected, dont wait for it }
+function CFMessagePortSendRequest( remote: CFMessagePortRef; msgid: SInt32; data: CFDataRef; sendTimeout: CFTimeInterval; rcvTimeout: CFTimeInterval; replyMode: CFStringRef; returnData: CFDataRefPtr ): SInt32; external name '_CFMessagePortSendRequest';
+
+function CFMessagePortCreateRunLoopSource( allocator: CFAllocatorRef; local: CFMessagePortRef; order: CFIndex ): CFRunLoopSourceRef; external name '_CFMessagePortCreateRunLoopSource';
+
+
+end.

+ 1112 - 0
packages/extra/univint/CFNetServices.pas

@@ -0,0 +1,1112 @@
+{
+     File:       CFNetwork/CFNetServices.h
+ 
+     Contains:   CoreFoundation Network Net Services header
+ 
+     Version:    CFNetwork-71.2~1
+ 
+     Copyright:  © 2001-2003 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFNetServices;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFStream,CFArray,CFRunLoop;
+{$ALIGN MAC68K}
+{
+CFNetServices
+Network Services is composed of two objects, a Network Service and
+a Network Service Browser.  A Network Service represents a single
+point service on the network.  Associated with a service is its name,
+type of service, domain, port, and possibly protocol specific information
+(for legacy protocols).  Services can be registered and resolved.
+Registering a service advertises the service on the network, so other
+computers can use the service.  Resolving a service performs a network
+lookup in order to find the computer which has registered the service.
+Lookup is contained by the services name, type of service, and the domain.
+The port and address of the registered service will be returned.  Services
+can be created or discovered.
+
+Discovery of services takes place through the use of the Network Service
+Browser.  Given a domain and a service type, the browser will search out
+those services on the network.  The returned services can then be resolved
+and then used.
+
+Service type values are keywords as registered with IANA.  A list of values
+may be retrieved from their web site at
+<http://www.iana.org/assignments/port-numbers>.
+}
+
+{
+ *  CFNetServiceRef
+ *  
+ *  Discussion:
+ *    This is the type of a reference to a service.  It may be used for
+ *    registering or for resolving.
+ }
+type
+	CFNetServiceRef							= ^SInt32;
+
+{
+ *  CFNetServiceBrowserRef
+ *  
+ *  Discussion:
+ *    This is the type of a reference to a service or domain browser.
+ *    It may be used for discovering services or domains.
+ }
+type
+	CFNetServiceBrowserRef							= ^SInt32;
+
+{
+ *  kCFStreamErrorDomainMach
+ *  
+ *  Discussion:
+ *    Errors reported by mach.  See <mach/error.h>
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamErrorDomainMach: SInt32; external name '_kCFStreamErrorDomainMach'; (* attribute const *)
+
+
+{
+ *  kCFStreamErrorDomainNetServices
+ *  
+ *  Discussion:
+ *    Errors listed below
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+var kCFStreamErrorDomainNetServices: SInt32; external name '_kCFStreamErrorDomainNetServices'; (* attribute const *)
+
+
+{
+ *  CFNetServicesError
+ *  
+ *  Discussion:
+ *    Errors from the kCFStreamErrorDomainNetServices domain.
+ }
+type CFNetServicesError = SInt32;
+const
+  {
+   * An error of unknown type has occured.
+   }
+  kCFNetServicesErrorUnknown    = -72000;
+
+  {
+   * The given registration has had a name collision.  Registration
+   * should be cancelled and should try again probably with a different
+   * name.
+   }
+  kCFNetServicesErrorCollision  = -72001;
+
+  {
+   * Not used
+   }
+  kCFNetServicesErrorNotFound   = -72002;
+
+  {
+   * There is already a register, resolve, or browse invoke on the
+   * given object.
+   }
+  kCFNetServicesErrorInProgress = -72003;
+
+  {
+   * Not used
+   }
+  kCFNetServicesErrorBadArgument = -72004;
+
+  {
+   * The register, resolve, or browse on the object has been cancelled.
+   }
+  kCFNetServicesErrorCancel     = -72005;
+
+  {
+   * The given CFNetServiceBrowser has already been invalidated and can
+   * no longer be used for browsing.
+   }
+  kCFNetServicesErrorInvalid    = -72006;
+
+
+{
+ *  CFNetServiceBrowser flags
+ *  
+ *  Discussion:
+ *    Result bit flags passed to CFNetServiceBrowserClientCallBack.
+ }
+const
+	kCFNetServiceFlagMoreComing   = 1;    { Client will get another callback briefly and shouldn't do costly screen updates (or such). }
+  kCFNetServiceFlagIsDomain     = 2;    { If off, the result is a service. }
+  kCFNetServiceFlagIsRegistrationDomain = 4; { The result domain is the default registration domain. }
+  kCFNetServiceFlagRemove       = 8;     { The result item should be removed and not added. }
+
+
+{
+ *  CFNetServiceClientContext
+ *  
+ *  Discussion:
+ *    Structure containing the user-defined data and callbacks for
+ *    CFNetService and CFNetServiceBrowser objects.
+ }
+type CFNetServiceClientContext = record
+
+  {
+   * The version number of the structure type being passed in as a
+   * parameter to the CFNetService(Browser) client function. Valid
+   * version number is currently 0.
+   }
+  version: CFIndex;
+
+  {
+   * An arbitrary pointer to client-defined data, which can be
+   * associated with the service/browser and is passed to the callbacks.
+   }
+  info: Ptr;
+
+  {
+   * The callback used to add a retain for the service/browser on the
+   * info pointer for the life of the service/browser, and may be used
+   * for temporary references the service/browser needs to take. This
+   * callback returns the actual info pointer to store in the
+   * service/browser, almost always just the pointer passed as the
+   * parameter.
+   }
+  retain: CFAllocatorRetainCallBack;
+
+  {
+   * The callback used to remove a retain previously added for the
+   * service/browser on the info pointer.
+   }
+  release: CFAllocatorReleaseCallBack;
+
+  {
+   * The callback used to create a descriptive string representation of
+   * the info pointer (or the data pointed to by the info pointer) for
+   * debugging purposes. This is used by the CFCopyDescription()
+   * function.
+   }
+  copyDescription: CFAllocatorCopyDescriptionCallBack;
+end;
+CFNetServiceClientContextPtr = ^CFNetServiceClientContext;
+
+{
+ *  CFNetServiceClientCallBack
+ *  
+ *  Discussion:
+ *    Callback function which is called upon error or completion of
+ *    resolve or register.  If resolving, the callback may be called
+ *    multiple times, once for each resolved address.
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      Service receiving the event.
+ *    
+ *    error:
+ *      Reference to an error structure if the event is a failure.
+ *    
+ *    info:
+ *      Client's info reference which was passed into the client
+ *      context.
+ }
+	type
+		CFNetServiceClientCallBack = procedure( service: CFNetServiceRef; var error: CFStreamError; info: Ptr );
+
+{
+ *  CFNetServiceBrowserClientCallBack
+ *  
+ *  Discussion:
+ *    Callback function which is called upon error or upon successful
+ *    discovery of services or domains.
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      CFNetServiceBrowser receiving the event.
+ *    
+ *    flags:
+ *      Bitwise flags indicating the event or further information about
+ *      the event.
+ *    
+ *    domainOrService:
+ *      If searching for domains, a CFStringRef indicating the domain
+ *      which was found or is going away.  If searching for services,
+ *      the service which was found or is going away.
+ *    
+ *    error:
+ *      Reference to an error structure if the event is a failure.
+ *    
+ *    info:
+ *      Client's info reference which was passed into the client
+ *      context.
+ }
+	type
+		CFNetServiceBrowserClientCallBack = procedure( browser: CFNetServiceBrowserRef; flags: CFOptionFlags; domainOrService: CFTypeRef; var error: CFStreamError; info: Ptr );
+
+
+{
+ *  CFNetServiceGetTypeID()
+ *  
+ *  Discussion:
+ *    Returns the type identifier of all CFNetService instances.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceGetTypeID: CFTypeID; external name '_CFNetServiceGetTypeID';
+
+
+{
+ *  CFNetServiceBrowserGetTypeID()
+ *  
+ *  Discussion:
+ *    Returns the type identifier of all CFNetServiceBrowser instances.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceBrowserGetTypeID: CFTypeID; external name '_CFNetServiceBrowserGetTypeID';
+
+
+{
+ *  CFNetServiceCreate()
+ *  
+ *  Discussion:
+ *    Creates an instance of a Network Service.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      service and its storage for values. If this reference is not a
+ *      valid CFAllocator, the behavior is undefined.
+ *    
+ *    domain:
+ *      The network domain in which it is registered or will be
+ *      registered. This value must be non-NULL.
+ *    
+ *    serviceType:
+ *      The type of service being registered or resolved on the
+ *      network. This value must be non-NULL.
+ *    
+ *    name:
+ *      The name of the machine or application advertising the service.
+ *       If this value is not unique, registering will eventually fail.
+ *       This value must be non-NULL.  This value is usually displayed
+ *      in a browser for the user.
+ *    
+ *    port:
+ *      The port on which the service is listening.  This must be
+ *      non-zero for services which are to be registered.
+ *  
+ *  Result:
+ *    A valid CFNetService which may now be registered or resolved, or
+ *    NULL if unsuccessful.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceCreate(alloc: CFAllocatorRef; domain: CFStringRef; typ: CFStringRef; name: CFStringRef; port: UInt32): CFNetServiceRef; external name '_CFNetServiceCreate';
+
+
+{
+ *  CFNetServiceCreateCopy()
+ *  
+ *  Discussion:
+ *    Creates a new CFNetService object as a copy of service argument.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      new service. If this reference is not a valid CFAllocator, the
+ *      behavior is undefined.
+ *    
+ *    service:
+ *      A CFNetServiceRef representing the original service. Must be
+ *      non-NULL.  If this If this reference is not a valid
+ *      CFNetServiceRef, the behavior is undefined.
+ *  
+ *  Result:
+ *    Returns a valid CFNetServiceRef which contains a copy of all
+ *    previously resolved data from the original.  NULL is returned in
+ *    the case of failure.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+function CFNetServiceCreateCopy( alloc: CFAllocatorRef; service: CFNetServiceRef ): CFNetServiceRef; external name '_CFNetServiceCreateCopy';
+
+
+{
+ *  CFNetServiceGetDomain()
+ *  
+ *  Discussion:
+ *    Query a Network Service for its domain.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the service is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to be queried.  Must be non-NULL.
+ *  
+ *  Result:
+ *    CFStringRef which is the service's domain.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceGetDomain(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetDomain';
+
+
+{
+ *  CFNetServiceGetType()
+ *  
+ *  Discussion:
+ *    Query a Network Service for its type.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the service is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to be queried.  Must be non-NULL.
+ *  
+ *  Result:
+ *    CFStringRef which is the service's service type.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceGetType(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetType';
+
+
+{
+ *  CFNetServiceGetName()
+ *  
+ *  Discussion:
+ *    Query a Network Service for its name.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the service is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to be queried.  Must be non-NULL.
+ *  
+ *  Result:
+ *    CFStringRef which is the service's name.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceGetName(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetName';
+
+
+{
+ *  CFNetServiceGetAddressing()
+ *  
+ *  Discussion:
+ *    Query a Network Service for its addressing.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the service is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to be queried.  Must be non-NULL.
+ *  
+ *  Result:
+ *    Returns NULL if the entity's addressing is not known (has not
+ *    been resolved).  The array will contain a CFDataRef for each
+ *    address resolved.  Each CFDataRef contains a struct sockaddr
+ *    representing the address of the service.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceGetAddressing(theService: CFNetServiceRef): CFArrayRef; external name '_CFNetServiceGetAddressing';
+
+
+{
+ *  CFNetServiceGetProtocolSpecificInformation()
+ *  
+ *  Discussion:
+ *    Query a Network Service for its protocol specific information.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *    The function gets the data in a thread-safe manner, but the
+ *    resulting data is not safe.  Since it is returned as a matter of
+ *    a get opposed to a copy, the data is not safe if the service is
+ *    being altered from another thread.
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to be queried.  Must be non-NULL.
+ *  
+ *  Result:
+ *    Returns NULL if a resolve has not been performed or if
+ *    CFNetServiceSetProtocolSpecificInformation has not been called. 
+ *    It will return a CFStringRef containing the specific information
+ *    if there is some.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceGetProtocolSpecificInformation(theService: CFNetServiceRef): CFStringRef; external name '_CFNetServiceGetProtocolSpecificInformation';
+
+
+{
+ *  CFNetServiceSetProtocolSpecificInformation()
+ *  
+ *  Discussion:
+ *    Set a Network Service's protocol specific information.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to be queried.  Must be non-NULL.
+ *    
+ *    theInfo:
+ *      The protocol specific information to be added.  Pass NULL to
+ *      remove the information from the service.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceSetProtocolSpecificInformation(theService: CFNetServiceRef;theInfo: CFStringRef); external name '_CFNetServiceSetProtocolSpecificInformation';
+
+
+{
+ *  CFNetServiceRegister()
+ *  
+ *  Discussion:
+ *    Registers the entity on the network.  This requires that the
+ *    service has a domain, a type, a name, and a port.  The service is
+ *    registered on the network until this function returns or is
+ *    cancelled by calling CFNetServiceCancel.  In synchronous mode,
+ *    this function will block until there is an error or it is
+ *    cancelled from another thread.  In asynchronous mode, this
+ *    function returns immediately and the underlying network
+ *    registration process will start.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to register on the network.  Must be
+ *      non-NULL.
+ *    
+ *    error:
+ *      A reference to an error struct which will be set to the error
+ *      and domain of the error should one occur.  If the value of
+ *      error is not desired, set to NULL.
+ *  
+ *  Result:
+ *    Returns FALSE if domain, type, name or port is NULL.  In
+ *    synchronous mode, it will always return FALSE as a result of the
+ *    error or the cancellation.  In asynchronous mode, it will return
+ *    TRUE if the registration process could start.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceRegister(theService: CFNetServiceRef;error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceRegister';
+
+
+{
+ *  CFNetServiceResolve()
+ *  
+ *  Discussion:
+ *    Resolves the addressing for the given service.  This requires
+ *    that the service has a domain, a type, and a name.  The service
+ *    is  resolved on the network until this function returns or is
+ *    cancelled by calling CFNetServiceCancel. In synchronous mode,
+ *    this function will block until there is an error or it is
+ *    cancelled from another thread.  In asynchronous mode, this
+ *    function returns immediately and the underlying network
+ *    resolution process will start.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service to resolve on the network.  Must be
+ *      non-NULL.
+ *    
+ *    error:
+ *      A reference to an error struct which will be set to the error
+ *      and domain of the error should one occur.  If the value of
+ *      error is not desired, set to NULL.
+ *  
+ *  Result:
+ *    Returns FALSE if domain, type, or name is NULL.  In synchronous
+ *    mode, it will return FALSE as a result of an error or a
+ *    cancellation.  It will return TRUE if the resolution does
+ *    succeed.  In asynchronous mode, it will return TRUE if the
+ *    resolution process could start.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceResolve(theService: CFNetServiceRef;error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceResolve';
+
+
+{
+ *  CFNetServiceCancel()
+ *  
+ *  Discussion:
+ *    Cancels an outstanding request for registration or resolution.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The Network Service which is active.  Must be non-NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceCancel(theService: CFNetServiceRef); external name '_CFNetServiceCancel';
+
+
+{
+ *  CFNetServiceSetClient()
+ *  
+ *  Discussion:
+ *    Sets up the service to be used in asynchronous mode. 
+ *    Notification of registration failure or resolution completion
+ *    will occur through the given callback.  Once the client is set,
+ *    the service must be scheduled on a runloop. The client callback
+ *    will be triggered via one of the scheduled run loops; It is the
+ *    caller's responsibility to ensure that at least one of the
+ *    scheduled run loops is being run.  This call must be performed
+ *    before calling CFNetServiceRegister or CFNetServiceResolve,
+ *    otherwise it will return FALSE.  TRUE will be returned if the
+ *    client could be set.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The service to set up for asynchronous mode.  Must be non-NULL.
+ *    
+ *    clientCB:
+ *      Function pointer will be called upon registration failure or
+ *      upon resolution completion.  In the case of resolution, this
+ *      callback may be called multiple times if there is more than one
+ *      address for a service.  Passing NULL will remove the client
+ *      from the entity and cancel any outstanding activity.
+ *    
+ *    clientContext:
+ *      Client contextual information to be used when calling clientCB.
+ *      Passing NULL will remove the client from the entity and cancel
+ *      any outstanding activity.
+ *  
+ *  Result:
+ *    Returns FALSE if the client could not be set, TRUE otherwise.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceSetClient(theService: CFNetServiceRef; clientCB: CFNetServiceClientCallBack; clientContext: CFNetServiceClientContextPtr): Boolean; external name '_CFNetServiceSetClient';
+
+
+{
+ *  CFNetServiceScheduleWithRunLoop()
+ *  
+ *  Discussion:
+ *    Schedule the given service on the given run loop and mode.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The service which is set up for asynchronous mode. Must be
+ *      non-NULL.
+ *    
+ *    runLoop:
+ *      A reference to a runloop on which the service should be
+ *      scheduled. Must be non-NULL.
+ *    
+ *    runLoopMode:
+ *      The mode on which to schedule the service.  Must be non-NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceScheduleWithRunLoop(theService: CFNetServiceRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceScheduleWithRunLoop';
+
+
+{
+ *  CFNetServiceUnscheduleFromRunLoop()
+ *  
+ *  Discussion:
+ *    Unschedule the given service from the given run loop and mode.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    theService:
+ *      The service which is set up for asynchronous mode.  Must be
+ *      non-NULL.
+ *    
+ *    runLoop:
+ *      A reference to a runloop from which the service should be
+ *      unscheduled.  Must be non-NULL.
+ *    
+ *    runLoopMode:
+ *      The mode from which to unschedule the service.  Must be
+ *      non-NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceUnscheduleFromRunLoop(theService: CFNetServiceRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceUnscheduleFromRunLoop';
+
+
+{
+ *  CFNetServiceBrowserCreate()
+ *  
+ *  Discussion:
+ *    Creates an instance of a browser object.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      browser and its storage for values. If this reference is not a
+ *      valid CFAllocator, the behavior is undefined.
+ *    
+ *    clientCB:
+ *      Function pointer that will be called as domains or services are
+ *      found on the network.  Must be non-NULL.
+ *    
+ *    clientContext:
+ *      Client ontextual information to be used when calling clientCB.
+ *      Must be non-NULL.
+ *  
+ *  Result:
+ *    Returns a new instance of a browser, or NULL if the instance
+ *    could not be created.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceBrowserCreate(alloc: CFAllocatorRef; clientCB: CFNetServiceBrowserClientCallBack; var clientContext: CFNetServiceClientContext): CFNetServiceBrowserRef; external name '_CFNetServiceBrowserCreate';
+
+
+{
+ *  CFNetServiceBrowserInvalidate()
+ *  
+ *  Discussion:
+ *    Invalidates the given browser object so that it may no longer be
+ *    scheduled and callback never be called.  This will also stop any
+ *    searches currently in progress.
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      Network Service Browser to invalidate.  Must be non-NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceBrowserInvalidate(browser: CFNetServiceBrowserRef); external name '_CFNetServiceBrowserInvalidate';
+
+
+{
+ *  CFNetServiceBrowserSearchForDomains()
+ *  
+ *  Discussion:
+ *    Starts a search for domains.  The browser will either try to find
+ *    "Browse" domains or will search for "Registration" domains.  If
+ *    there is already an outstanding search, it will return FALSE.  In
+ *    syncronous mode, this call blocks until the search is stopped. 
+ *    It will return FALSE if there is an error performing the search.
+ *    It will return TRUE otherwise.  In asynchronous mode, this call
+ *    will return TRUE or FALSE depending if the underlying network
+ *    search could be started.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      Network Service Browser to perform the search.  Must be
+ *      non-NULL.
+ *    
+ *    registrationDomains:
+ *      FALSE if "Browse" domains are to be discovered. TRUE if only
+ *      "Registration" domains are to be discovered.
+ *    
+ *    error:
+ *      A reference to an error struct which will be set to the error
+ *      and domain of the error should one occur.  If the value of
+ *      error is not desired, set to NULL.
+ *  
+ *  Result:
+ *    Returns FALSE if an error occurs during a synchronous search or
+ *    if the search could not start.  It returns TRUE otherwise.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceBrowserSearchForDomains(browser: CFNetServiceBrowserRef; registrationDomains: Boolean; error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceBrowserSearchForDomains';
+
+
+{
+ *  CFNetServiceBrowserSearchForServices()
+ *  
+ *  Discussion:
+ *    Starts a search for a service type on the given domain.  If there
+ *    is already an outstanding search, it will return FALSE.  In
+ *    syncronous mode, this call blocks until the search is stopped. 
+ *    It will return FALSE if there is an error performing the search
+ *    or if there is some other error.  It will return TRUE otherwise.
+ *    In asynchronous mode, this call will return TRUE or FALSE
+ *    depending if the underlying network search could be instantiated.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      Network Service Browser to perform the search.  Must be
+ *      non-NULL.
+ *    
+ *    domain:
+ *      Network domain to search in order to find the service.  Must be
+ *      non-NULL.
+ *    
+ *    serviceType:
+ *      Service type for which to search.  Must be non-NULL.
+ *    
+ *    error:
+ *      A reference to an error struct which will be set to the error
+ *      and domain of the error should one occur.  If the value of
+ *      error is not desired, set to NULL.
+ *  
+ *  Result:
+ *    Returns FALSE if an error occurs during a synchronous search or
+ *    if the search could not start.  It returns TRUE otherwise.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+function CFNetServiceBrowserSearchForServices(browser: CFNetServiceBrowserRef; domain: CFStringRef; typ: CFStringRef; error: CFStreamErrorPtr): Boolean; external name '_CFNetServiceBrowserSearchForServices';
+
+
+{
+ *  CFNetServiceBrowserStopSearch()
+ *  
+ *  Discussion:
+ *    Stops an outstanding browser search.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      Network Service Browser performing the search.  Must be
+ *      non-NULL.
+ *    
+ *    error:
+ *      Error value to be returned in "error" in
+ *      CFNetServiceBrowserStartServiceSearch if search is being
+ *      performed in synchronous mode.  In this case, a non-zero of the
+ *      error field of the struct will cause
+ *      CFNetServiceBrowserStartServiceSearch to return FALSE. In
+ *      asynchronous mode, the client call back will be called with
+ *      this error.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceBrowserStopSearch(browser: CFNetServiceBrowserRef;var error: CFStreamError); external name '_CFNetServiceBrowserStopSearch';
+
+
+{
+ *  CFNetServiceBrowserScheduleWithRunLoop()
+ *  
+ *  Discussion:
+ *    Schedules the browser on a run loop and mode.  Use this to place
+ *    the given browser into asynchronous mode.  The client callback
+ *    will be triggered via one of the scheduled run loops; It is the
+ *    caller's responsibility to ensure that at least one of the
+ *    scheduled run loops is being run.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      Network Service Browser to schedule.  Must be non-NULL.
+ *    
+ *    runLoop:
+ *      A reference to a runloop on which the browser should be
+ *      scheduled.  Must be non-NULL.
+ *    
+ *    runLoopMode:
+ *      The mode on which to schedule the browser.  Must be non-NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceBrowserScheduleWithRunLoop(browser: CFNetServiceBrowserRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceBrowserScheduleWithRunLoop';
+
+
+{
+ *  CFNetServiceBrowserUnscheduleFromRunLoop()
+ *  
+ *  Discussion:
+ *    Unschedules the browser from a run loop and mode.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    browser:
+ *      Network Service Browser to unschedule.  Must be non-NULL.
+ *    
+ *    runLoop:
+ *      A reference to a runloop from which the browser should be
+ *      unscheduled. Must be non-NULL.
+ *    
+ *    runLoopMode:
+ *      The mode from which to unschedule the browser.  Must be
+ *      non-NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+procedure CFNetServiceBrowserUnscheduleFromRunLoop(browser: CFNetServiceBrowserRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef); external name '_CFNetServiceBrowserUnscheduleFromRunLoop';
+
+end.

+ 161 - 0
packages/extra/univint/CFNotificationCenter.pas

@@ -0,0 +1,161 @@
+{	CFNotificationCenter.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFNotificationCenter;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFDictionary;
+{$ALIGN POWER}
+
+
+type
+	CFNotificationCenterRef = ^SInt32; { an opaque 32-bit type }
+
+type
+	CFNotificationCallback = procedure( center: CFNotificationCenterRef; observer: UnivPtr; name: CFStringRef; objct: {const} UnivPtr; userInfo: CFDictionaryRef );
+
+type
+	CFNotificationSuspensionBehavior = SInt32;
+const
+    CFNotificationSuspensionBehaviorDrop = 1;
+        // The server will not queue any notifications with this name and object while the process/app is in the background.
+    CFNotificationSuspensionBehaviorCoalesce = 2;
+        // The server will only queue the last notification of the specified name and object; earlier notifications are dropped. 
+    CFNotificationSuspensionBehaviorHold = 3;
+        // The server will hold all matching notifications until the queue has been filled (queue size determined by the server) at which point the server may flush queued notifications.
+    CFNotificationSuspensionBehaviorDeliverImmediately = 4;
+        // The server will deliver notifications matching this registration whether or not the process is in the background.  When a notification with this suspension behavior is matched, it has the effect of first flushing any queued notifications.
+
+function CFNotificationCenterGetTypeID: CFTypeID; external name '_CFNotificationCenterGetTypeID';
+
+function CFNotificationCenterGetLocalCenter: CFNotificationCenterRef; external name '_CFNotificationCenterGetLocalCenter';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+function CFNotificationCenterGetDistributedCenter: CFNotificationCenterRef; external name '_CFNotificationCenterGetDistributedCenter';
+
+function CFNotificationCenterGetDarwinNotifyCenter: CFNotificationCenterRef; external name '_CFNotificationCenterGetDarwinNotifyCenter';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+// The Darwin Notify Center is based on the <notify.h> API.
+// For this center, there are limitations in the API. There are no notification "objects",
+// "userInfo" cannot be passed in the notification, and there are no suspension behaviors
+// (always "deliver immediately"). Other limitations in the <notify.h> API as described in
+// that header will also apply.
+// - In the CFNotificationCallback, the 'object' and 'userInfo' parameters must be ignored.
+// - CFNotificationCenterAddObserver(): the 'object' and 'suspensionBehavior' arguments are ignored.
+// - CFNotificationCenterAddObserver(): the 'name' argument may not be NULL (for this center).
+// - CFNotificationCenterRemoveObserver(): the 'object' argument is ignored.
+// - CFNotificationCenterPostNotification(): the 'object', 'userInfo', and 'deliverImmediately' arguments are ignored.
+// - CFNotificationCenterPostNotificationWithOptions(): the 'object', 'userInfo', and 'options' arguments are ignored.
+// The Darwin Notify Center has no notion of per-user sessions, all notifications are system-wide.
+// As with distributed notifications, the main thread's run loop must be running in one of the
+// common modes (usually kCFRunLoopDefaultMode) for Darwin-style notifications to be delivered.
+// NOTE: NULL or 0 should be passed for all ignored arguments to ensure future compatibility.
+
+
+procedure CFNotificationCenterAddObserver( center: CFNotificationCenterRef; observer: {const} UnivPtr; callBack: CFNotificationCallback; name: CFStringRef; objct: {const} UnivPtr; suspensionBehavior: CFNotificationSuspensionBehavior ); external name '_CFNotificationCenterAddObserver';
+
+procedure CFNotificationCenterRemoveObserver( center: CFNotificationCenterRef; observer: {const} UnivPtr; name: CFStringRef; objct: {const} UnivPtr ); external name '_CFNotificationCenterRemoveObserver';
+procedure CFNotificationCenterRemoveEveryObserver( center: CFNotificationCenterRef; observer: {const} UnivPtr ); external name '_CFNotificationCenterRemoveEveryObserver';
+
+procedure CFNotificationCenterPostNotification( center: CFNotificationCenterRef; name: CFStringRef; objct: {const} UnivPtr; userInfo: CFDictionaryRef; deliverImmediately: Boolean ); external name '_CFNotificationCenterPostNotification';
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+
+const
+	kCFNotificationDeliverImmediately = 1 shl 0;
+	kCFNotificationPostToAllSessions = 1 shl 1;
+
+procedure CFNotificationCenterPostNotificationWithOptions( center: CFNotificationCenterRef; name: CFStringRef; objct: {const} UnivPtr; userInfo: CFDictionaryRef; options: CFOptionFlags ); external name '_CFNotificationCenterPostNotificationWithOptions';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{#endif}
+
+
+end.

+ 193 - 0
packages/extra/univint/CFNumber.pas

@@ -0,0 +1,193 @@
+{	CFNumber.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFNumber;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+type
+	CFBooleanRef = ^SInt32; { an opaque 32-bit type }
+	CFBooleanRefPtr = ^CFBooleanRef;
+
+var kCFBooleanTrue: CFBooleanRef; external name '_kCFBooleanTrue'; (* attribute const *)
+var kCFBooleanFalse: CFBooleanRef; external name '_kCFBooleanFalse'; (* attribute const *)
+
+function CFBooleanGetTypeID: CFTypeID; external name '_CFBooleanGetTypeID';
+
+function CFBooleanGetValue( value: CFBooleanRef ): Boolean; external name '_CFBooleanGetValue';
+
+type
+	CFNumberType = SInt32;
+const
+																{  Types from MacTypes.h  }
+	kCFNumberSInt8Type = 1;
+	kCFNumberSInt16Type = 2;
+	kCFNumberSInt32Type = 3;
+	kCFNumberSInt64Type = 4;
+	kCFNumberFloat32Type = 5;
+	kCFNumberFloat64Type = 6;							{  64-bit IEEE 754  }
+																{  Basic C types  }
+	kCFNumberCharType = 7;
+	kCFNumberShortType = 8;
+	kCFNumberIntType = 9;
+	kCFNumberLongType = 10;
+	kCFNumberLongLongType = 11;
+	kCFNumberFloatType = 12;
+	kCFNumberDoubleType = 13;							{  Other  }
+	kCFNumberCFIndexType = 14;
+	kCFNumberMaxType = 14;
+
+type
+	CFNumberRef = ^SInt32; { an opaque 32-bit type }
+	CFNumberRefPtr = ^CFNumberRef;
+
+var kCFNumberPositiveInfinity: CFNumberRef; external name '_kCFNumberPositiveInfinity'; (* attribute const *)
+var kCFNumberNegativeInfinity: CFNumberRef; external name '_kCFNumberNegativeInfinity'; (* attribute const *)
+var kCFNumberNaN: CFNumberRef; external name '_kCFNumberNaN'; (* attribute const *)
+
+function CFNumberGetTypeID: CFTypeID; external name '_CFNumberGetTypeID';
+
+{
+	Creates a CFNumber with the given value. The type of number pointed
+	to by the valuePtr is specified by type. If type is a floating point
+	type and the value represents one of the infinities or NaN, the
+	well-defined CFNumber for that value is returned. If either of
+	valuePtr or type is an invalid value, the result is undefined.
+}
+function CFNumberCreate( allocator: CFAllocatorRef; theType: CFNumberType; valuePtr: {const} UnivPtr ): CFNumberRef; external name '_CFNumberCreate';
+
+{
+	Returns the storage format of the CFNumber's value.  Note that
+	this is not necessarily the type provided in CFNumberCreate().
+}
+function CFNumberGetType( number: CFNumberRef ): CFNumberType; external name '_CFNumberGetType';
+
+{
+	Returns the size in bytes of the type of the number.
+}
+function CFNumberGetByteSize( number: CFNumberRef ): CFIndex; external name '_CFNumberGetByteSize';
+
+{
+	Returns true if the type of the CFNumber's value is one of
+	the defined floating point types.
+}
+function CFNumberIsFloatType( number: CFNumberRef ): Boolean; external name '_CFNumberIsFloatType';
+
+{
+	Copies the CFNumber's value into the space pointed to by
+	valuePtr, as the specified type. If conversion needs to take
+	place, the conversion rules follow human expectation and not
+	C's promotion and truncation rules. If the conversion is
+	lossy, or the value is out of range, false is returned. Best
+	attempt at conversion will still be in *valuePtr.
+}
+function CFNumberGetValue( number: CFNumberRef; theType: CFNumberType; valuePtr: UnivPtr ): Boolean; external name '_CFNumberGetValue';
+
+{
+	Compares the two CFNumber instances. If conversion of the
+	types of the values is needed, the conversion and comparison
+	follow human expectations and not C's promotion and comparison
+	rules. Negative zero compares less than positive zero.
+	Positive infinity compares greater than everything except
+	itself, to which it compares equal. Negative infinity compares
+	less than everything except itself, to which it compares equal.
+	Unlike standard practice, if both numbers are NaN, then they
+	compare equal; if only one of the numbers is NaN, then the NaN
+	compares greater than the other number if it is negative, and
+	smaller than the other number if it is positive. (Note that in
+	CFEqual() with two CFNumbers, if either or both of the numbers
+	is NaN, true is returned.)
+}
+function CFNumberCompare( number: CFNumberRef; otherNumber: CFNumberRef; context: UnivPtr ): CFComparisonResult; external name '_CFNumberCompare';
+
+
+end.

+ 283 - 0
packages/extra/univint/CFNumberFormatter.pas

@@ -0,0 +1,283 @@
+{	CFNumberFormatter.h
+	Copyright (c) 2003-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFNumberFormatter;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFNumber,CFLocale;
+{$ALIGN POWER}
+
+
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
+
+
+type
+	CFNumberFormatterRef = ^SInt32; { an opaque 32-bit type }
+
+// CFNumberFormatters are not thread-safe.  Do not use one from multiple threads!
+
+function CFNumberFormatterGetTypeID: CFTypeID; external name '_CFNumberFormatterGetTypeID';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+// number format styles
+type
+	CFNumberFormatterStyle = SInt32;
+const
+	kCFNumberFormatterNoStyle = 0;
+	kCFNumberFormatterDecimalStyle = 1;
+	kCFNumberFormatterCurrencyStyle = 2;
+	kCFNumberFormatterPercentStyle = 3;
+	kCFNumberFormatterScientificStyle = 4;
+	kCFNumberFormatterSpellOutStyle = 5;
+
+
+function CFNumberFormatterCreate( allocator: CFAllocatorRef; locale: CFLocaleRef; style: CFNumberFormatterStyle ): CFNumberFormatterRef; external name '_CFNumberFormatterCreate';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns a CFNumberFormatter, localized to the given locale, which
+	// will format numbers to the given style.
+
+function CFNumberFormatterGetLocale( formatter: CFNumberFormatterRef ): CFLocaleRef; external name '_CFNumberFormatterGetLocale';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFNumberFormatterGetStyle( formatter: CFNumberFormatterRef ): CFNumberFormatterStyle; external name '_CFNumberFormatterGetStyle';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Get the properties with which the number formatter was created.
+
+function CFNumberFormatterGetFormat( formatter: CFNumberFormatterRef ): CFStringRef; external name '_CFNumberFormatterGetFormat';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+procedure CFNumberFormatterSetFormat( formatter: CFNumberFormatterRef; formatString: CFStringRef ); external name '_CFNumberFormatterSetFormat';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Set the format description string of the number formatter.  This
+	// overrides the style settings.  The format of the format string
+	// is as defined by the ICU library, and is similar to that found
+	// in Microsoft Excel and NSNumberFormatter (and Java I believe).
+	// The number formatter starts with a default format string defined
+	// by the style argument with which it was created.
+
+
+function CFNumberFormatterCreateStringWithNumber( allocator: CFAllocatorRef; formatter: CFNumberFormatterRef; number: CFNumberRef ): CFStringRef; external name '_CFNumberFormatterCreateStringWithNumber';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFNumberFormatterCreateStringWithValue( allocator: CFAllocatorRef; formatter: CFNumberFormatterRef; numberType: CFNumberType; valuePtr: {const} UnivPtr ): CFStringRef; external name '_CFNumberFormatterCreateStringWithValue';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Create a string representation of the given number or value
+	// using the current state of the number formatter.
+
+
+type
+	CFNumberFormatterOptionFlags = SInt32;
+const
+	kCFNumberFormatterParseIntegersOnly = 1;	{ only parse integers }
+
+function CFNumberFormatterCreateNumberFromString( allocator: CFAllocatorRef; formatter: CFNumberFormatterRef; strng: CFStringRef; rangep: CFRangePtr; options: CFOptionFlags ): CFNumberRef; external name '_CFNumberFormatterCreateNumberFromString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFNumberFormatterGetValueFromString( formatter: CFNumberFormatterRef; strng: CFStringRef; rangep: CFRangePtr; numberType: CFNumberType; valuePtr: UnivPtr ): Boolean; external name '_CFNumberFormatterGetValueFromString';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Parse a string representation of a number using the current state
+	// of the number formatter.  The range parameter specifies the range
+	// of the string in which the parsing should occur in input, and on
+	// output indicates the extent that was used; this parameter can
+	// be NULL, in which case the whole string may be used.  The
+	// return value indicates whether some number was computed and
+	// (if valuePtr is not NULL) stored at the location specified by
+	// valuePtr.  The numberType indicates the type of value pointed
+	// to by valuePtr.
+
+
+procedure CFNumberFormatterSetProperty( formatter: CFNumberFormatterRef; key: CFStringRef; value: CFTypeRef ); external name '_CFNumberFormatterSetProperty';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFNumberFormatterCopyProperty( formatter: CFNumberFormatterRef; key: CFStringRef ): CFTypeRef; external name '_CFNumberFormatterCopyProperty';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Set and get various properties of the number formatter, the set of
+	// which may be expanded in the future.
+
+var kCFNumberFormatterCurrencyCode: CFStringRef; external name '_kCFNumberFormatterCurrencyCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterDecimalSeparator: CFStringRef; external name '_kCFNumberFormatterDecimalSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFString
+var kCFNumberFormatterCurrencyDecimalSeparator: CFStringRef; external name '_kCFNumberFormatterCurrencyDecimalSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) // CFString
+var kCFNumberFormatterAlwaysShowDecimalSeparator: CFStringRef; external name '_kCFNumberFormatterAlwaysShowDecimalSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *) // CFBoolean
+var kCFNumberFormatterGroupingSeparator: CFStringRef; external name '_kCFNumberFormatterGroupingSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFString
+var kCFNumberFormatterUseGroupingSeparator: CFStringRef; external name '_kCFNumberFormatterUseGroupingSeparator'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFBoolean
+var kCFNumberFormatterPercentSymbol: CFStringRef; external name '_kCFNumberFormatterPercentSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterZeroSymbol: CFStringRef; external name '_kCFNumberFormatterZeroSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterNaNSymbol: CFStringRef; external name '_kCFNumberFormatterNaNSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterInfinitySymbol: CFStringRef; external name '_kCFNumberFormatterInfinitySymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterMinusSign: CFStringRef; external name '_kCFNumberFormatterMinusSign'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterPlusSign: CFStringRef; external name '_kCFNumberFormatterPlusSign'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterCurrencySymbol: CFStringRef; external name '_kCFNumberFormatterCurrencySymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterExponentSymbol: CFStringRef; external name '_kCFNumberFormatterExponentSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterMinIntegerDigits: CFStringRef; external name '_kCFNumberFormatterMinIntegerDigits'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterMaxIntegerDigits: CFStringRef; external name '_kCFNumberFormatterMaxIntegerDigits'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterMinFractionDigits: CFStringRef; external name '_kCFNumberFormatterMinFractionDigits'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterMaxFractionDigits: CFStringRef; external name '_kCFNumberFormatterMaxFractionDigits'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterGroupingSize: CFStringRef; external name '_kCFNumberFormatterGroupingSize'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFNumber
+var kCFNumberFormatterSecondaryGroupingSize: CFStringRef; external name '_kCFNumberFormatterSecondaryGroupingSize'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterRoundingMode: CFStringRef; external name '_kCFNumberFormatterRoundingMode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFNumber
+var kCFNumberFormatterRoundingIncrement: CFStringRef; external name '_kCFNumberFormatterRoundingIncrement'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterFormatWidth: CFStringRef; external name '_kCFNumberFormatterFormatWidth'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFNumber
+var kCFNumberFormatterPaddingPosition: CFStringRef; external name '_kCFNumberFormatterPaddingPosition'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFNumber
+var kCFNumberFormatterPaddingCharacter: CFStringRef; external name '_kCFNumberFormatterPaddingCharacter'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)	// CFString
+var kCFNumberFormatterDefaultFormat: CFStringRef; external name '_kCFNumberFormatterDefaultFormat'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)		// CFString
+var kCFNumberFormatterMultiplier: CFStringRef; external name '_kCFNumberFormatterMultiplier'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFNumber
+var kCFNumberFormatterPositivePrefix: CFStringRef; external name '_kCFNumberFormatterPositivePrefix'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+var kCFNumberFormatterPositiveSuffix: CFStringRef; external name '_kCFNumberFormatterPositiveSuffix'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+var kCFNumberFormatterNegativePrefix: CFStringRef; external name '_kCFNumberFormatterNegativePrefix'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+var kCFNumberFormatterNegativeSuffix: CFStringRef; external name '_kCFNumberFormatterNegativeSuffix'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+var kCFNumberFormatterPerMillSymbol: CFStringRef; external name '_kCFNumberFormatterPerMillSymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)		// CFString
+var kCFNumberFormatterInternationalCurrencySymbol: CFStringRef; external name '_kCFNumberFormatterInternationalCurrencySymbol'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // CFString
+
+type
+	CFNumberFormatterRoundingMode = SInt32;
+const
+    kCFNumberFormatterRoundCeiling = 0;
+    kCFNumberFormatterRoundFloor = 1;
+    kCFNumberFormatterRoundDown = 2;
+    kCFNumberFormatterRoundUp = 3;
+    kCFNumberFormatterRoundHalfEven = 4;
+    kCFNumberFormatterRoundHalfDown = 5;
+    kCFNumberFormatterRoundHalfUp = 6;
+
+type
+	CFNumberFormatterPadPosition = SInt32;
+const
+    kCFNumberFormatterPadBeforePrefix = 0;
+    kCFNumberFormatterPadAfterPrefix = 1;
+    kCFNumberFormatterPadBeforeSuffix = 2;
+    kCFNumberFormatterPadAfterSuffix = 3;
+
+
+function CFNumberFormatterGetDecimalInfoForCurrencyCode( currencyCode: CFStringRef; defaultFractionDigits: SInt32Ptr; roundingIncrement: Float64Ptr ): Boolean; external name '_CFNumberFormatterGetDecimalInfoForCurrencyCode';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+	// Returns the number of fraction digits that should be displayed, and
+	// the rounding increment (or 0.0 if no rounding is done by the currency)
+	// for the given currency.  Returns false if the currency code is unknown
+	// or the information is not available.
+	// Not localized because these are properties of the currency.
+
+
+{#endif}
+
+
+end.

+ 193 - 0
packages/extra/univint/CFPlugIn.pas

@@ -0,0 +1,193 @@
+{	CFPlugIn.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFPlugIn;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFBundle,CFString,CFURL,CFUUID;
+{$ALIGN POWER}
+
+{
+# if !defined(COREFOUNDATION_CFPLUGINCOM_SEPARATE)
+const
+	COREFOUNDATION_CFPLUGINCOM_SEPARATE = 1;
+# endif
+}
+
+{ ================ Standard Info.plist keys for plugIns ================ }
+
+var kCFPlugInDynamicRegistrationKey: CFStringRef; external name '_kCFPlugInDynamicRegistrationKey'; (* attribute const *)
+var kCFPlugInDynamicRegisterFunctionKey: CFStringRef; external name '_kCFPlugInDynamicRegisterFunctionKey'; (* attribute const *)
+var kCFPlugInUnloadFunctionKey: CFStringRef; external name '_kCFPlugInUnloadFunctionKey'; (* attribute const *)
+var kCFPlugInFactoriesKey: CFStringRef; external name '_kCFPlugInFactoriesKey'; (* attribute const *)
+var kCFPlugInTypesKey: CFStringRef; external name '_kCFPlugInTypesKey'; (* attribute const *)
+
+{ ================= Function prototypes for various callbacks ================= }
+{ Function types that plugIn authors can implement for various purposes. }
+
+type
+	CFPlugInDynamicRegisterFunction = procedure( plugIn: CFPlugInRef );
+	CFPlugInUnloadFunction = procedure( plugIn: CFPlugInRef );
+	CFPlugInFactoryFunction = function( allocator: CFAllocatorRef; typeUUID: CFUUIDRef ): UnivPtr;
+
+{ ================= Creating PlugIns ================= }
+
+function CFPlugInGetTypeID: UInt32; external name '_CFPlugInGetTypeID';
+
+function CFPlugInCreate( allocator: CFAllocatorRef; plugInURL: CFURLRef ): CFPlugInRef; external name '_CFPlugInCreate';
+    { Might return an existing instance with the ref-count bumped. }
+
+function CFPlugInGetBundle( plugIn: CFPlugInRef ): CFBundleRef; external name '_CFPlugInGetBundle';
+
+{ ================= Controlling load on demand ================= }
+{ For plugIns. }
+{ PlugIns that do static registration are load on demand by default. }
+{ PlugIns that do dynamic registration are not load on demand by default. }
+{ A dynamic registration function can call CFPlugInSetLoadOnDemand(). }
+
+procedure CFPlugInSetLoadOnDemand( plugIn: CFPlugInRef; flag: Boolean ); external name '_CFPlugInSetLoadOnDemand';
+
+function CFPlugInIsLoadOnDemand( plugIn: CFPlugInRef ): Boolean; external name '_CFPlugInIsLoadOnDemand';
+
+{ ================= Finding factories and creating instances ================= }
+{ For plugIn hosts. }
+{ Functions for finding factories to create specific types and actually creating instances of a type. }
+
+function CFPlugInFindFactoriesForPlugInType( typeUUID: CFUUIDRef ): CFArrayRef; external name '_CFPlugInFindFactoriesForPlugInType';
+    { This function finds all the factories from any plugin for the given type.  Returns an array that the caller must release. }
+    
+function CFPlugInFindFactoriesForPlugInTypeInPlugIn( typeUUID: CFUUIDRef; plugIn: CFPlugInRef ): CFArrayRef; external name '_CFPlugInFindFactoriesForPlugInTypeInPlugIn';
+    { This function restricts the result to factories from the given plug-in that can create the given type.  Returns an array that the caller must release. }
+
+function CFPlugInInstanceCreate( allocator: CFAllocatorRef; factoryUUID: CFUUIDRef; typeUUID: CFUUIDRef ): UnivPtr; external name '_CFPlugInInstanceCreate';
+    { This function returns the IUnknown interface for the new instance. }
+
+{ ================= Registering factories and types ================= }
+{ For plugIn writers who must dynamically register things. }
+{ Functions to register factory functions and to associate factories with types. }
+
+function CFPlugInRegisterFactoryFunction( factoryUUID: CFUUIDRef; func: CFPlugInFactoryFunction ): Boolean; external name '_CFPlugInRegisterFactoryFunction';
+
+function CFPlugInRegisterFactoryFunctionByName( factoryUUID: CFUUIDRef; plugIn: CFPlugInRef; functionName: CFStringRef ): Boolean; external name '_CFPlugInRegisterFactoryFunctionByName';
+
+function CFPlugInUnregisterFactory( factoryUUID: CFUUIDRef ): Boolean; external name '_CFPlugInUnregisterFactory';
+
+function CFPlugInRegisterPlugInType( factoryUUID: CFUUIDRef; typeUUID: CFUUIDRef ): Boolean; external name '_CFPlugInRegisterPlugInType';
+
+function CFPlugInUnregisterPlugInType( factoryUUID: CFUUIDRef; typeUUID: CFUUIDRef ): Boolean; external name '_CFPlugInUnregisterPlugInType';
+
+{ ================= Registering instances ================= }
+{ When a new instance of a type is created, the instance is responsible for registering itself with the factory that created it and unregistering when it deallocates. }
+{ This means that an instance must keep track of the CFUUIDRef of the factory that created it so it can unregister when it goes away. }
+
+procedure CFPlugInAddInstanceForFactory( factoryID: CFUUIDRef ); external name '_CFPlugInAddInstanceForFactory';
+
+procedure CFPlugInRemoveInstanceForFactory( factoryID: CFUUIDRef ); external name '_CFPlugInRemoveInstanceForFactory';
+
+
+{ Obsolete API }
+
+type
+	CFPlugInInstanceRef = ^SInt32; { an opaque 32-bit type }
+	CFPlugInInstanceRefPtr = ^CFPlugInInstanceRef;
+
+type
+	CFPlugInInstanceGetInterfaceFunction = function( instance: CFPlugInInstanceRef; interfaceName: CFStringRef; var ftbl: UnivPtr ): Boolean;
+	CFPlugInInstanceDeallocateInstanceDataFunction = procedure( instanceData: UnivPtr );
+
+function CFPlugInInstanceGetInterfaceFunctionTable( instance: CFPlugInInstanceRef; interfaceName: CFStringRef; var ftbl: UnivPtr ): Boolean; external name '_CFPlugInInstanceGetInterfaceFunctionTable';
+function CFPlugInInstanceGetFactoryName( instance: CFPlugInInstanceRef ): CFStringRef; external name '_CFPlugInInstanceGetFactoryName';
+function CFPlugInInstanceGetInstanceData( instance: CFPlugInInstanceRef ): UnivPtr; external name '_CFPlugInInstanceGetInstanceData';
+function CFPlugInInstanceGetTypeID: UInt32; external name '_CFPlugInInstanceGetTypeID';
+function CFPlugInInstanceCreateWithInstanceDataSize( allocator: CFAllocatorRef; instanceDataSize: CFIndex; deallocateInstanceFunction: CFPlugInInstanceDeallocateInstanceDataFunction; factoryName: CFStringRef; getInterfaceFunction: CFPlugInInstanceGetInterfaceFunction ): CFPlugInInstanceRef; external name '_CFPlugInInstanceCreateWithInstanceDataSize';
+
+
+
+
+end.

+ 213 - 0
packages/extra/univint/CFPlugInCOM.pas

@@ -0,0 +1,213 @@
+{	CFPlugInCOM.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFPlugInCOM;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFPlugIn,CFUUID;
+{$ALIGN POWER}
+
+
+{ ================= IUnknown definition (C struct) ================= }
+
+{ All interface structs must have an IUnknownStruct at the beginning. }
+{ The _reserved field is part of the Microsoft COM binary standard on Macintosh. }
+{ You can declare new C struct interfaces by defining a new struct that includes "IUNKNOWN_C_GUTS;" before the first field of the struct. }
+
+type
+	HRESULT = SInt32;
+	ULONG = UInt32;
+	LPVOID = UnivPtr;
+	REFIID = CFUUIDBytes;
+
+{ Macros for more detailed HRESULT analysis }
+
+function SUCCEEDED( Status: HRESULT ): Boolean; inline;
+function FAILED( Status: HRESULT ): Boolean; inline;
+function IS_ERROR( Status: HRESULT ): Boolean; inline;
+function HRESULT_CODE( hr: HRESULT ): HRESULT; inline;
+function HRESULT_FACILITY( hr: HRESULT ): HRESULT; inline;
+function HRESULT_SEVERITY( hr: HRESULT ): HRESULT; inline;
+
+const
+	SEVERITY_SUCCESS = 0;
+const
+	SEVERITY_ERROR = 1;
+
+{ Creating an HRESULT from its component pieces }
+function MAKE_HRESULT( sev, fac, code: ULONG ): HRESULT; inline;
+
+{ Pre-defined success HRESULTS }
+const
+	S_OK = 0;
+const
+	S_FALSE = 1;
+
+{ Common error HRESULTS }
+const
+	E_UNEXPECTED = $8000FFFF;
+	E_NOTIMPL = $80000001;
+	E_OUTOFMEMORY = $80000002;
+	E_INVALIDARG = $80000003;
+	E_NOINTERFACE = $80000004;
+	E_POINTER = $80000005;
+	E_HANDLE = $80000006;
+	E_ABORT = $80000007;
+	E_FAIL = $80000008;
+	E_ACCESSDENIED = $80000009;
+
+{ This macro should be used when defining all interface functions (as it is for the IUnknown functions below). }
+{#define STDMETHODCALLTYPE}
+
+{ The __RPC_FAR macro is for COM source compatibility only. This macro is used a lot in COM interface definitions.  If your CFPlugIn interfaces need to be COM interfaces as well, you can use this macro to get better source compatibility.  It is not used in the IUnknown definition below, because when doing COM, you will be using the Microsoft supplied IUnknown interface anyway. }
+{#define __RPC_FAR}
+
+{ The IUnknown interface }
+function IUnknownUUID: CFUUIDRef; inline;
+
+type
+	IUnknownVTbl = record
+		_reserved: UnivPtr;
+		QueryInterface: function( thisPointer: UnivPtr; iid: REFIID; var ppv: LPVOID ): HRESULT;
+		AddRef: function( thisPointer: UnivPtr ): ULONG;
+		Release: function( thisPointer: UnivPtr ): ULONG;
+	end;
+
+{ End of extern "C" stuff }
+
+
+{ C++ specific stuff }
+
+implementation
+
+
+{$R-}
+
+function SUCCEEDED( Status: HRESULT ): Boolean; inline;
+begin
+	SUCCEEDED := Status >= 0;
+end;
+
+function FAILED( Status: HRESULT ): Boolean; inline;
+begin
+	FAILED := Status < 0;
+end;
+
+function IS_ERROR( Status: HRESULT ): Boolean; inline;
+begin
+	IS_ERROR := Status shr 31 = SEVERITY_ERROR;
+end;
+
+function HRESULT_CODE( hr: HRESULT ): HRESULT; inline;
+begin
+	HRESULT_CODE := hr and $FFFF;
+end;
+
+function HRESULT_FACILITY( hr: HRESULT ): HRESULT; inline;
+begin
+	HRESULT_FACILITY := (hr shr 16) and $1FFF;
+end;
+
+function HRESULT_SEVERITY( hr: HRESULT ): HRESULT; inline;
+begin
+	HRESULT_SEVERITY := (hr shr 31) and $01;
+end;
+
+function MAKE_HRESULT( sev, fac, code: ULONG ): HRESULT; inline;
+begin
+	MAKE_HRESULT := HRESULT((sev shl 31) or (fac shl 16) or code);
+end;
+
+function IUnknownUUID: CFUUIDRef; inline;
+begin
+	IUnknownUUID:= CFUUIDGetConstantUUIDWithBytes( nil, $00, $00, $00, $00, $00, $00, $00, $00, ByteParameter($C0), $00, $00, $00, $00, $00, $00, $46 )
+end;
+
+
+end.

+ 191 - 0
packages/extra/univint/CFPreferences.pas

@@ -0,0 +1,191 @@
+{	CFPreferences.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFPreferences;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFDictionary,CFBase,CFArray,CFPropertyList,CFString;
+{$ALIGN POWER}
+
+
+var kCFPreferencesAnyApplication: CFStringRef; external name '_kCFPreferencesAnyApplication'; (* attribute const *)
+var kCFPreferencesCurrentApplication: CFStringRef; external name '_kCFPreferencesCurrentApplication'; (* attribute const *)
+var kCFPreferencesAnyHost: CFStringRef; external name '_kCFPreferencesAnyHost'; (* attribute const *)
+var kCFPreferencesCurrentHost: CFStringRef; external name '_kCFPreferencesCurrentHost'; (* attribute const *)
+var kCFPreferencesAnyUser: CFStringRef; external name '_kCFPreferencesAnyUser'; (* attribute const *)
+var kCFPreferencesCurrentUser: CFStringRef; external name '_kCFPreferencesCurrentUser'; (* attribute const *)
+
+{ NOTE: All CFPropertyListRef values returned from
+         CFPreferences API should be assumed to be immutable.
+}
+
+{	The "App" functions search the various sources of defaults that
+	apply to the given application, and should never be called with
+	kCFPreferencesAnyApplication - only kCFPreferencesCurrentApplication
+	or an application's ID (its bundle identifier).
+}
+
+{ Searches the various sources of application defaults to find the
+value for the given key. key must not be NULL.  If a value is found,
+it returns it; otherwise returns NULL.  Caller must release the
+returned value }
+function CFPreferencesCopyAppValue( key: CFStringRef; applicationID: CFStringRef ): CFPropertyListRef; external name '_CFPreferencesCopyAppValue';
+
+{ Convenience to interpret a preferences value as a boolean directly.
+Returns false if the key doesn't exist, or has an improper format; under
+those conditions, keyExistsAndHasValidFormat (if non-NULL) is set to false }
+function CFPreferencesGetAppBooleanValue( key: CFStringRef; applicationID: CFStringRef; var keyExistsAndHasValidFormat: Boolean ): Boolean; external name '_CFPreferencesGetAppBooleanValue';
+
+{ Convenience to interpret a preferences value as an integer directly.
+Returns 0 if the key doesn't exist, or has an improper format; under
+those conditions, keyExistsAndHasValidFormat (if non-NULL) is set to false }
+function CFPreferencesGetAppIntegerValue( key: CFStringRef; applicationID: CFStringRef; var keyExistsAndHasValidFormat: Boolean ): CFIndex; external name '_CFPreferencesGetAppIntegerValue';
+
+{ Sets the given value for the given key in the "normal" place for
+application preferences.  key must not be NULL.  If value is NULL,
+key is removed instead. }
+procedure CFPreferencesSetAppValue( key: CFStringRef; value: CFPropertyListRef; applicationID: CFStringRef ); external name '_CFPreferencesSetAppValue';
+
+{ Adds the preferences for the given suite to the app preferences for
+   the specified application.  To write to the suite domain, use
+   CFPreferencesSetValue(), below, using the suiteName in place
+   of the appName }
+procedure CFPreferencesAddSuitePreferencesToApp( applicationID: CFStringRef; suiteID: CFStringRef ); external name '_CFPreferencesAddSuitePreferencesToApp';
+
+procedure CFPreferencesRemoveSuitePreferencesFromApp( applicationID: CFStringRef; suiteID: CFStringRef ); external name '_CFPreferencesRemoveSuitePreferencesFromApp';
+
+{ Writes all changes in all sources of application defaults.
+Returns success or failure. }
+function CFPreferencesAppSynchronize( applicationID: CFStringRef ): Boolean; external name '_CFPreferencesAppSynchronize';
+
+{ The primitive get mechanism; all arguments must be non-NULL
+(use the constants above for common values).  Only the exact
+location specified by app-user-host is searched.  The returned
+CFType must be released by the caller when it is finished with it. }
+function CFPreferencesCopyValue( key: CFStringRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef ): CFPropertyListRef; external name '_CFPreferencesCopyValue';
+
+{ Convenience to fetch multiple keys at once.  Keys in 
+keysToFetch that are not present in the returned dictionary
+are not present in the domain.  If keysToFetch is NULL, all
+keys are fetched. }
+function CFPreferencesCopyMultiple( keysToFetch: CFArrayRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef ): CFDictionaryRef; external name '_CFPreferencesCopyMultiple';
+
+{ The primitive set function; all arguments except value must be
+non-NULL.  If value is NULL, the given key is removed }
+procedure CFPreferencesSetValue( key: CFStringRef; value: CFPropertyListRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef ); external name '_CFPreferencesSetValue';
+
+{ Convenience to set multiple values at once.  Behavior is undefined
+if a key is in both keysToSet and keysToRemove }
+procedure CFPreferencesSetMultiple( keysToSet: CFDictionaryRef; keysToRemove: CFArrayRef; applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef ); external name '_CFPreferencesSetMultiple';
+
+function CFPreferencesSynchronize( applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef ): Boolean; external name '_CFPreferencesSynchronize';
+
+{ Constructs and returns the list of the name of all applications
+which have preferences in the scope of the given user and host.
+The returned value must be released by the caller; neither argument
+may be NULL. }
+function CFPreferencesCopyApplicationList( userName: CFStringRef; hostName: CFStringRef ): CFArrayRef; external name '_CFPreferencesCopyApplicationList';
+
+{ Constructs and returns the list of all keys set in the given
+location.  The returned value must be released by the caller;
+all arguments must be non-NULL }
+function CFPreferencesCopyKeyList( applicationID: CFStringRef; userName: CFStringRef; hostName: CFStringRef ): CFArrayRef; external name '_CFPreferencesCopyKeyList';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+
+{ Function to determine whether or not a given key has been imposed on the
+user - In cases where machines and/or users are under some kind of management,
+callers should use this function to determine whether or not to disable UI elements
+corresponding to those preference keys. }
+function CFPreferencesAppValueIsForced( key: CFStringRef; applicationID: CFStringRef ): Boolean; external name '_CFPreferencesAppValueIsForced';
+
+{#endif}
+
+
+end.

+ 177 - 0
packages/extra/univint/CFPropertyList.pas

@@ -0,0 +1,177 @@
+{	CFPropertyList.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFPropertyList;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData,CFString,CFStream;
+{$ALIGN POWER}
+
+
+type
+	CFPropertyListMutabilityOptions = SInt32;
+const
+	kCFPropertyListImmutable = 0;
+	kCFPropertyListMutableContainers = 1;
+	kCFPropertyListMutableContainersAndLeaves = 2;
+    
+{
+	Creates a property list object from its XML description; xmlData should
+	be the raw bytes of that description, possibly the contents of an XML
+	file. Returns NULL if the data cannot be parsed; if the parse fails
+	and errorString is non-NULL, a human-readable description of the failure
+	is returned in errorString. It is the caller's responsibility to release
+	either the returned object or the error string, whichever is applicable.
+}
+function CFPropertyListCreateFromXMLData( allocator: CFAllocatorRef; xmlData: CFDataRef; mutabilityOption: CFOptionFlags; errorString: CFStringRefPtr ): CFPropertyListRef; external name '_CFPropertyListCreateFromXMLData';
+
+{
+	Returns the XML description of the given object; propertyList must
+	be one of the supported property list types, and (for composite types
+	like CFArray and CFDictionary) must not contain any elements that
+	are not themselves of a property list type. If a non-property list
+	type is encountered, NULL is returned. The returned data is
+	appropriate for writing out to an XML file. Note that a data, not a
+	string, is returned because the bytes contain in them a description
+	of the string encoding used.
+}
+function CFPropertyListCreateXMLData( allocator: CFAllocatorRef; propertyList: CFPropertyListRef ): CFDataRef; external name '_CFPropertyListCreateXMLData';
+
+{
+	Recursively creates a copy of the given property list (so nested arrays
+	and dictionaries are copied as well as the top-most container). The
+	resulting property list has the mutability characteristics determined
+	by mutabilityOption.
+}
+function CFPropertyListCreateDeepCopy( allocator: CFAllocatorRef; propertyList: CFPropertyListRef; mutabilityOption: CFOptionFlags ): CFPropertyListRef; external name '_CFPropertyListCreateDeepCopy';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+
+type
+	CFPropertyListFormat = SInt32;
+const
+    kCFPropertyListOpenStepFormat = 1;
+    kCFPropertyListXMLFormat_v1_0 = 100;
+    kCFPropertyListBinaryFormat_v1_0 = 200;
+
+function CFPropertyListIsValid( plist: CFPropertyListRef; format: CFPropertyListFormat ): Boolean; external name '_CFPropertyListIsValid';
+
+{ Returns true if the object graph rooted at plist is a valid property list
+ * graph -- that is, no cycles, containing only plist objects, and dictionary
+ * keys are strings. The debugging library version spits out some messages
+ * to be helpful. The plist structure which is to be allowed is given by
+ * the format parameter. }
+
+function CFPropertyListWriteToStream( propertyList: CFPropertyListRef; stream: CFWriteStreamRef; format: CFPropertyListFormat; var errorString: CFStringRef ): CFIndex; external name '_CFPropertyListWriteToStream';
+
+{ Writes the bytes of a plist serialization out to the stream.  The
+ * stream must be opened and configured -- the function simply writes
+ * a bunch of bytes to the stream. The output plist format can be chosen.
+ * Leaves the stream open, but note that reading a plist expects the
+ * reading stream to end wherever the writing ended, so that the
+ * end of the plist data can be identified. Returns the number of bytes
+ * written, or 0 on error. Error messages are not currently localized, but
+ * may be in the future, so they are not suitable for comparison. }
+
+function CFPropertyListCreateFromStream( allocator: CFAllocatorRef; stream: CFReadStreamRef; streamLength: CFIndex; mutabilityOption: CFOptionFlags; var format: CFPropertyListFormat; var errorString: CFStringRef ): CFPropertyListRef; external name '_CFPropertyListCreateFromStream';
+
+{ Same as current function CFPropertyListCreateFromXMLData()
+ * but takes a stream instead of data, and works on any plist file format.
+ * CFPropertyListCreateFromXMLData() also works on any plist file format.
+ * The stream must be open and configured -- the function simply reads a bunch
+ * of bytes from it starting at the current location in the stream, to the END
+ * of the stream, which is expected to be the end of the plist, or up to the
+ * number of bytes given by the length parameter if it is not 0. Error messages
+ * are not currently localized, but may be in the future, so they are not
+ * suitable for comparison. }
+
+{#endif}
+
+
+end.

+ 487 - 0
packages/extra/univint/CFRunLoop.pas

@@ -0,0 +1,487 @@
+{	CFRunLoop.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFRunLoop;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFDate,CFString,MacOSXPosix;
+{$ALIGN POWER}
+
+
+{!
+	@header CFRunLoop
+	CFRunLoops monitor sources of input to a task and dispatch control
+	when sources become ready for processing. Examples of input sources
+	might include user input devices, network connections, periodic
+	or time-delayed events, and asynchronous callbacks. Input sources
+	are registered with a run loop, and when a run loop is "run",
+	callback functions associated with each source are called when
+	the sources have some activity.
+
+	There is one run loop per thread. Each run loop has different
+	sets of input sources, called modes, which are named with strings.
+	A run loop is run -- in a named mode -- to have it monitor the
+	sources that have been registered in that mode, and the run loop
+	blocks there until something happens. Examples of modes include
+	the default mode, which a process would normally spend most of
+	its time in, and a modal panel mode, which might be run when
+	a modal panel is up, to restrict the set of input sources that
+	are allowed to "fire". This is not to the granularity of, for
+	example, what type of user input events are interesting, however.
+	That sort of finer-grained granularity is given by UI-level
+	frameworks with "get next event matching mask" or similar
+	functionality.
+
+	The CFRunLoopSource type is an abstraction of input sources that
+	can be put in a run loop. An input source type would normally
+	define an API for creating and operating on instances of the type,
+	as if it were a separate entity from the run loop, then provide a
+	function to create a CFRunLoopSource for an instance. The
+	CFRunLoopSource can then be registered with the run loop,
+	represents the input source to the run loop, and acts as
+	intermediary between the run loop and the actual input source
+	type instance. Examples include CFMachPort and CFSocket.
+
+	A CFRunLoopTimer is a specialization of run loop sources, a way
+	to generate either a one-shot delayed action, or a recurrent
+	action.
+
+	While being run, a run loop goes through a cycle of activities.
+	Input sources are checked, timers which need firing are fired,
+	and then the run loop blocks, waiting for something to happen 
+	(or in the case of timers, waiting for it to be time for
+	something to happen). When something does happen, the run loop
+	wakes up, processes the activity (usually by calling a callback
+	function for an input source), checks other sources, fires timers,
+	and goes back to sleep. And so on. CFRunLoopObservers can be
+	used to do processing at special points in this cycle.
+
+
+}
+
+
+{!
+	@typedef CFRunLoopRef
+	This is the type of a reference to a run loop.
+}
+type
+	CFRunLoopRef = ^SInt32; { an opaque 32-bit type }
+
+{!
+	@typedef CFRunLoopSourceRef
+	This is the type of a reference to general run loop input sources.
+}
+type
+	CFRunLoopSourceRef = ^SInt32; { an opaque 32-bit type }
+
+{!
+	@typedef CFRunLoopObserverRef
+	This is the type of a reference to a run loop observer.
+}
+type
+	CFRunLoopObserverRef = ^SInt32; { an opaque 32-bit type }
+
+{!
+	@typedef CFRunLoopTimerRef
+	This is the type of a reference to a run loop timer.
+}
+type
+	CFRunLoopTimerRef = ^SInt32; { an opaque 32-bit type }
+
+{ Reasons for CFRunLoopRunInMode() to Return }
+const
+	kCFRunLoopRunFinished = 1;
+	kCFRunLoopRunStopped = 2;
+	kCFRunLoopRunTimedOut = 3;
+	kCFRunLoopRunHandledSource = 4;
+
+{ Run Loop Observer Activities }
+type
+	CFRunLoopActivity = UInt32;
+const
+	kCFRunLoopEntry = 1 shl 0;
+    kCFRunLoopBeforeTimers = 1 shl 1;
+    kCFRunLoopBeforeSources = 1 shl 2;
+    kCFRunLoopBeforeWaiting = 1 shl 5;
+    kCFRunLoopAfterWaiting = 1 shl 6;
+    kCFRunLoopExit = 1 shl 7;
+    kCFRunLoopAllActivities = $0FFFFFFF;
+
+var kCFRunLoopDefaultMode: CFStringRef; external name '_kCFRunLoopDefaultMode'; (* attribute const *)
+var kCFRunLoopCommonModes: CFStringRef; external name '_kCFRunLoopCommonModes'; (* attribute const *)
+
+{!
+	@function CFRunLoopGetTypeID
+	Returns the type identifier of all CFRunLoop instances.
+}
+function CFRunLoopGetTypeID: CFTypeID; external name '_CFRunLoopGetTypeID';
+
+{!
+	@function CFRunLoopGetCurrent
+	Returns the run loop for the current thread. There is exactly
+	one run loop per thread.
+}
+function CFRunLoopGetCurrent: CFRunLoopRef; external name '_CFRunLoopGetCurrent';
+
+{!
+	@function CFRunLoopCopyCurrentMode
+	Returns the name of the mode in which the run loop is running.
+	NULL is returned if the run loop is not running.
+	@param rl The run loop for which the current mode should be
+		reported.
+}
+function CFRunLoopCopyCurrentMode( rl: CFRunLoopRef ): CFStringRef; external name '_CFRunLoopCopyCurrentMode';
+
+{!
+	@function CFRunLoopCopyAllModes
+	Returns an array of all the names of the modes known to the run
+	loop.
+	@param rl The run loop for which the mode list should be returned.
+}
+function CFRunLoopCopyAllModes( rl: CFRunLoopRef ): CFArrayRef; external name '_CFRunLoopCopyAllModes';
+
+{!
+	@function CFRunLoopAddCommonMode
+	Makes the named mode a "common mode" for the run loop. The set of
+	common modes are collectively accessed with the global constant
+	kCFRunLoopCommonModes. Input sources previously added to the
+	common modes are added to the new common mode.
+	@param rl The run loop for which the mode should be made common.
+	@param mode The name of the mode to mark as a common mode.
+}
+procedure CFRunLoopAddCommonMode( rl: CFRunLoopRef; mode: CFStringRef ); external name '_CFRunLoopAddCommonMode';
+
+{!
+	@function CFRunLoopGetNextTimerFireDate
+	Returns the time at which the next timer will fire.
+	@param rl The run loop for which the next timer fire date should
+		be reported.
+	@param mode The name of the mode to query.
+}
+function CFRunLoopGetNextTimerFireDate( rl: CFRunLoopRef; mode: CFStringRef ): CFAbsoluteTime; external name '_CFRunLoopGetNextTimerFireDate';
+
+
+procedure CFRunLoopRun; external name '_CFRunLoopRun';
+function CFRunLoopRunInMode( mode: CFStringRef; seconds: CFTimeInterval; returnAfterSourceHandled: Boolean ): SInt32; external name '_CFRunLoopRunInMode';
+function CFRunLoopIsWaiting( rl: CFRunLoopRef ): Boolean; external name '_CFRunLoopIsWaiting';
+procedure CFRunLoopWakeUp( rl: CFRunLoopRef ); external name '_CFRunLoopWakeUp';
+procedure CFRunLoopStop( rl: CFRunLoopRef ); external name '_CFRunLoopStop';
+
+function CFRunLoopContainsSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsSource';
+procedure CFRunLoopAddSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ); external name '_CFRunLoopAddSource';
+procedure CFRunLoopRemoveSource( rl: CFRunLoopRef; source: CFRunLoopSourceRef; mode: CFStringRef ); external name '_CFRunLoopRemoveSource';
+
+function CFRunLoopContainsObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsObserver';
+procedure CFRunLoopAddObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ); external name '_CFRunLoopAddObserver';
+procedure CFRunLoopRemoveObserver( rl: CFRunLoopRef; observer: CFRunLoopObserverRef; mode: CFStringRef ); external name '_CFRunLoopRemoveObserver';
+
+function CFRunLoopContainsTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ): Boolean; external name '_CFRunLoopContainsTimer';
+procedure CFRunLoopAddTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ); external name '_CFRunLoopAddTimer';
+procedure CFRunLoopRemoveTimer( rl: CFRunLoopRef; timer: CFRunLoopTimerRef; mode: CFStringRef ); external name '_CFRunLoopRemoveTimer';
+
+{!
+	@typedef CFRunLoopSourceContext
+	Structure containing the callbacks of a CFRunLoopSource.
+	@field version The version number of the structure type being
+		passed in as a parameter to the CFArray creation
+		functions. Valid version numbers are currently 0 and 1.
+		Version 0 sources are fairly generic, but may require a
+		bit more implementation, or may require a separate
+		thread as part of the implementation, for a complex
+		source. Version 1 sources are available on Mach and Windows,
+		and have performance advantages when the source type can
+		be described with this style.
+	@field info An arbitrary pointer to client-defined data, which
+		can be associated with the source at creation time, and
+		is passed to the callbacks.
+	@field retain The callback used to add a retain for the source on
+		the info pointer for the life of the source, and may be
+		used for temporary references the source needs to take.
+		This callback returns the actual info pointer to store in
+		the source, almost always just the pointer passed as the
+		parameter.
+	@field release The callback used to remove a retain previously
+		added for the source on the info pointer. 
+	@field copyDescription The callback used to create a descriptive
+		string representation of the info pointer (or the data
+		pointed to by the info pointer) for debugging purposes.
+		This is used by the CFCopyDescription() function.
+	@field equal The callback used to compare the info pointers of
+		two sources, to determine equality of sources.
+	@field hash The callback used to compute a hash code for the info
+		pointer for the source. The source uses this hash code
+		information to produce its own hash code.
+	@field schedule For a version 0 source, this callback is called
+		whenever the source is added to a run loop mode. This
+		information is often needed to implement complex sources.
+	@field cancel For a version 0 source, this callback is called
+		whenever the source is removed from a run loop mode. This
+		information is often needed to implement complex sources.
+	@field getPort Defined in version 1 sources, this function returns
+		the Mach port or Windows HANDLE of a kernel object to
+		represent the source to the run loop.  This function
+		must return the same result every time it is called, for the
+                lifetime of the source, and should be quick.
+	@field perform This callback is the workhorse of a run loop source.
+		It is called when the source needs to be "handled" or
+		processing is needed for input or conditions relating to
+		the source. For version 0 sources, this function is called
+		when the source has been marked "signaled" with the
+		CFRunLoopSourceSignal() function, and should do whatever
+		handling is required for the source. For a version 1 source
+		on Mach, this function is called when a Mach message arrives
+		on the source's Mach port, with the message, its
+		length, an allocator, and the source's info pointer. A
+		version 1 source performs whatever processing is required
+		on the Mach message, then can return a pointer to a Mach
+		message (or NULL if none) to be sent (usually this is a
+		"reply" message), which should be allocated with the
+		allocator (and will be deallocated by the run loop after
+		sending).  For a version 1 source on Windows the function
+		is called when the kernel object is in the signaled state.
+}
+type
+	CFRunLoopSourceContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+		equal: function( info1: {const} UnivPtr; info2: {const} UnivPtr ): Boolean;
+		hash: function( info: {const} UnivPtr ): CFHashCode;
+		schedule: function( info: {const} UnivPtr; rl: CFRunLoopRef; mode: CFStringRef ): CFHashCode;
+		cancel: function( info: {const} UnivPtr; rl: CFRunLoopRef; mode: CFStringRef ): CFHashCode;
+		perform: procedure( info: {const} UnivPtr );
+	end;
+
+type
+	CFRunLoopSourceContext1 = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+		equal: function( info1: {const} UnivPtr; info2: {const} UnivPtr ): Boolean;
+		hash: function( info: {const} UnivPtr ): CFHashCode;
+		getPort: function( info: {const} UnivPtr ): mach_port_t;
+		perform: function( msg: UnivPtr; size: CFIndex; allocator: CFAllocatorRef; info: UnivPtr ): UnivPtr;
+	end;
+
+{!
+	@function CFRunLoopSourceGetTypeID
+	Returns the type identifier of all CFRunLoopSource instances.
+}
+function CFRunLoopSourceGetTypeID: CFTypeID; external name '_CFRunLoopSourceGetTypeID';
+
+{!
+	@function CFRunLoopSourceCreate
+	Creates a new run loop source with the given context.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the array and its storage for values. If this
+		reference is not a valid CFAllocator, the behavior is
+		undefined.
+	@param order On platforms which support it, for source versions
+		which support it, this parameter determines the order in
+		which the sources which are ready to be processed are
+		handled. A lower order number causes processing before
+		higher order number sources. It is inadvisable to depend
+		on the order number for any architectural or design aspect
+		of code. In the absence of any reason to do otherwise,
+		zero should be used.
+	@param context A pointer to the context structure for the source.
+}
+function CFRunLoopSourceCreate( allocator: CFAllocatorRef; order: CFIndex; var context: CFRunLoopSourceContext ): CFRunLoopSourceRef; external name '_CFRunLoopSourceCreate';
+
+{!
+	@function CFRunLoopSourceGetOrder
+	Returns the ordering parameter of the run loop source.
+	@param source The run loop source for which the order number
+		should be returned.
+}
+function CFRunLoopSourceGetOrder( source: CFRunLoopSourceRef ): CFIndex; external name '_CFRunLoopSourceGetOrder';
+
+{!
+	@function CFRunLoopSourceInvalidate
+	Invalidates the run loop source. The run loop source is never
+	performed again after it becomes invalid, and will automatically
+	be removed from any run loops and modes which contain it. The
+	source is not destroyed by this operation, however -- the memory
+	is still valid; only the release of all references on the source
+	through the reference counting system can do that. But note, that
+	if the only retains on the source were held by run loops, those
+	retains may all be released by the time this function returns,
+	and the source may actually be destroyed through that process.
+	@param source The run loop source which should be invalidated.
+}
+procedure CFRunLoopSourceInvalidate( source: CFRunLoopSourceRef ); external name '_CFRunLoopSourceInvalidate';
+
+{!
+	@function CFRunLoopSourceIsValid
+	Reports whether or not the source is valid.
+	@param source The run loop source for which the validity should
+		be returned.
+}
+function CFRunLoopSourceIsValid( source: CFRunLoopSourceRef ): Boolean; external name '_CFRunLoopSourceIsValid';
+
+{!
+	@function CFRunLoopSourceGetContext
+	Fills the memory pointed to by the context parameter with the
+	context structure of the source.
+	@param source The run loop source for which the context structure
+		should be returned.
+	@param context A pointer to a context structure to be filled.
+}
+procedure CFRunLoopSourceGetContext( source: CFRunLoopSourceRef; var context: CFRunLoopSourceContext ); external name '_CFRunLoopSourceGetContext';
+
+{!
+	@function CFRunLoopSourceSignal
+	Marks the source as signalled, ready for handling by the run loop.
+	Has no effect on version 1 sources, which are automatically
+	handled when Mach messages for them come in.
+	@param source The run loop source which should be signalled.
+}
+procedure CFRunLoopSourceSignal( source: CFRunLoopSourceRef ); external name '_CFRunLoopSourceSignal';
+
+type
+	CFRunLoopObserverContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+
+type
+	CFRunLoopObserverCallBack = procedure( observer: CFRunLoopObserverRef; activity: CFRunLoopActivity; info: UnivPtr );
+
+{!
+	@function CFRunLoopObserverGetTypeID
+	Returns the type identifier of all CFRunLoopObserver instances.
+}
+function CFRunLoopObserverGetTypeID: CFTypeID; external name '_CFRunLoopObserverGetTypeID';
+
+function CFRunLoopObserverCreate( allocator: CFAllocatorRef; activities: CFOptionFlags; repeats: Boolean; order: CFIndex; callout: CFRunLoopObserverCallBack; var context: CFRunLoopObserverContext ): CFRunLoopObserverRef; external name '_CFRunLoopObserverCreate';
+
+function CFRunLoopObserverGetActivities( observer: CFRunLoopObserverRef ): CFOptionFlags; external name '_CFRunLoopObserverGetActivities';
+function CFRunLoopObserverDoesRepeat( observer: CFRunLoopObserverRef ): Boolean; external name '_CFRunLoopObserverDoesRepeat';
+function CFRunLoopObserverGetOrder( observer: CFRunLoopObserverRef ): CFIndex; external name '_CFRunLoopObserverGetOrder';
+procedure CFRunLoopObserverInvalidate( observer: CFRunLoopObserverRef ); external name '_CFRunLoopObserverInvalidate';
+function CFRunLoopObserverIsValid( observer: CFRunLoopObserverRef ): Boolean; external name '_CFRunLoopObserverIsValid';
+procedure CFRunLoopObserverGetContext( observer: CFRunLoopObserverRef; var context: CFRunLoopObserverContext ); external name '_CFRunLoopObserverGetContext';
+
+type
+	CFRunLoopTimerContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+
+type
+	CFRunLoopTimerCallBack = procedure( timer: CFRunLoopTimerRef; info: UnivPtr );
+
+{!
+	@function CFRunLoopTimerGetTypeID
+	Returns the type identifier of all CFRunLoopTimer instances.
+}
+function CFRunLoopTimerGetTypeID: CFTypeID; external name '_CFRunLoopTimerGetTypeID';
+
+function CFRunLoopTimerCreate( allocator: CFAllocatorRef; fireDate: CFAbsoluteTime; interval: CFTimeInterval; flags: CFOptionFlags; order: CFIndex; callout: CFRunLoopTimerCallBack; var context: CFRunLoopTimerContext ): CFRunLoopTimerRef; external name '_CFRunLoopTimerCreate';
+function CFRunLoopTimerGetNextFireDate( timer: CFRunLoopTimerRef ): CFAbsoluteTime; external name '_CFRunLoopTimerGetNextFireDate';
+procedure CFRunLoopTimerSetNextFireDate( timer: CFRunLoopTimerRef; fireDate: CFAbsoluteTime ); external name '_CFRunLoopTimerSetNextFireDate';
+function CFRunLoopTimerGetInterval( timer: CFRunLoopTimerRef ): CFTimeInterval; external name '_CFRunLoopTimerGetInterval';
+function CFRunLoopTimerDoesRepeat( timer: CFRunLoopTimerRef ): Boolean; external name '_CFRunLoopTimerDoesRepeat';
+function CFRunLoopTimerGetOrder( timer: CFRunLoopTimerRef ): CFIndex; external name '_CFRunLoopTimerGetOrder';
+procedure CFRunLoopTimerInvalidate( timer: CFRunLoopTimerRef ); external name '_CFRunLoopTimerInvalidate';
+function CFRunLoopTimerIsValid( timer: CFRunLoopTimerRef ): Boolean; external name '_CFRunLoopTimerIsValid';
+procedure CFRunLoopTimerGetContext( timer: CFRunLoopTimerRef; var context: CFRunLoopTimerContext ); external name '_CFRunLoopTimerGetContext';
+
+
+end.

+ 562 - 0
packages/extra/univint/CFSet.pas

@@ -0,0 +1,562 @@
+{	CFSet.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFSet;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+{!
+        @header CFSet
+        CFSet implements a container which stores unique values.
+}
+
+
+{!
+	@typedef CFSetRetainCallBack
+	Type of the callback function used by CFSets for retaining values.
+        @param allocator The allocator of the CFSet.
+	@param value The value to retain.
+        @result The value to store in the set, which is usually the value
+		parameter passed to this callback, but may be a different
+		value if a different value should be stored in the set.
+}
+type
+	CFSetRetainCallBack = function( allocator: CFAllocatorRef; value: {const} UnivPtr ): UnivPtr;
+
+{!
+	@typedef CFSetReleaseCallBack
+	Type of the callback function used by CFSets for releasing a retain on values.
+        @param allocator The allocator of the CFSet.
+	@param value The value to release.
+}
+type
+	CFSetReleaseCallBack = procedure( allocator: CFAllocatorRef; value: {const} UnivPtr );
+
+{!
+	@typedef CFSetCopyDescriptionCallBack
+	Type of the callback function used by CFSets for describing values.
+	@param value The value to describe.
+        @result A description of the specified value.
+}
+type
+	CFSetCopyDescriptionCallBack = function( value: {const} UnivPtr ): CFStringRef;
+
+{!
+	@typedef CFSetEqualCallBack
+	Type of the callback function used by CFSets for comparing values.
+	@param value1 The first value to compare.
+	@param value2 The second value to compare.
+        @result True if the values are equal, otherwise false.
+}
+type
+	CFSetEqualCallBack = function( value1: {const} UnivPtr; value2: {const} UnivPtr ): Boolean;
+
+{!
+	@typedef CFSetHashCallBack
+	Type of the callback function used by CFSets for hashing values.
+	@param value The value to hash.
+        @result The hash of the value.
+}
+type
+	CFSetHashCallBack = function( value: {const} UnivPtr ): CFHashCode;
+
+{!
+	@typedef CFSetCallBacks
+	Structure containing the callbacks of a CFSet.
+	@field version The version number of the structure type being passed
+		in as a parameter to the CFSet creation functions. This
+		structure is version 0.
+	@field retain The callback used to add a retain for the set on
+		values as they are put into the set. This callback returns
+		the value to store in the set, which is usually the value
+		parameter passed to this callback, but may be a different
+		value if a different value should be stored in the set.
+		The set's allocator is passed as the first argument.
+	@field release The callback used to remove a retain previously added
+		for the set from values as they are removed from the
+		set. The set's allocator is passed as the first
+		argument.
+	@field copyDescription The callback used to create a descriptive
+		string representation of each value in the set. This is
+		used by the CFCopyDescription() function.
+	@field equal The callback used to compare values in the set for
+		equality for some operations.
+	@field hash The callback used to compare values in the set for
+		uniqueness for some operations.
+}
+type
+	CFSetCallBacks = record
+		version: CFIndex;
+		retain: CFSetRetainCallBack;
+		release: CFSetReleaseCallBack;
+		copyDescription: CFSetCopyDescriptionCallBack;
+		equal: CFSetEqualCallBack;
+		hash: CFSetHashCallBack;
+	end;
+	CFSetCallBacksPtr = ^CFSetCallBacks;
+
+{!
+	@constant kCFTypeSetCallBacks
+	Predefined CFSetCallBacks structure containing a set of callbacks
+	appropriate for use when the values in a CFSet are all CFTypes.
+}
+var kCFTypeSetCallBacks: CFSetCallBacks; external name '_kCFTypeSetCallBacks'; (* attribute const *)
+
+{!
+	@constant kCFCopyStringSetCallBacks
+	Predefined CFSetCallBacks structure containing a set of callbacks
+	appropriate for use when the values in a CFSet should be copies
+        of a CFString.
+}
+var kCFCopyStringSetCallBacks: CFSetCallBacks; external name '_kCFCopyStringSetCallBacks'; (* attribute const *)
+
+{!
+	@typedef CFSetApplierFunction
+	Type of the callback function used by the apply functions of
+		CFSets.
+	@param value The current value from the set.
+	@param context The user-defined context parameter given to the apply
+		function.
+}
+type
+	CFSetApplierFunction = procedure( value: {const} UnivPtr; context: UnivPtr );
+
+{!
+        @typedef CFSetRef
+	This is the type of a reference to immutable CFSets.
+}
+type
+	CFSetRef = ^SInt32; { an opaque 32-bit type }
+	CFSetRefPtr = ^CFSetRef;
+
+{!
+        @typedef CFMutableSetRef
+	This is the type of a reference to mutable CFSets.
+}
+type
+	CFMutableSetRef = CFSetRef;
+	CFMutableSetRefPtr = ^CFMutableSetRef;
+
+{!
+        @function CFSetGetTypeID
+        Returns the type identifier of all CFSet instances.
+}
+function CFSetGetTypeID: CFTypeID; external name '_CFSetGetTypeID';
+
+{!
+        @function CFSetCreate
+        Creates a new immutable set with the given values.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the set and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param values A C array of the pointer-sized values to be in the
+		set.  This C array is not changed or freed by this function. 
+                If this parameter is not a valid pointer to a C array of at
+                least numValues pointers, the behavior is undefined.
+	@param numValues The number of values to copy from the values C
+		array into the CFSet. This number will be the count of the
+		set.  If this parameter is zero, negative, or greater than 
+                the number of values actually in the values C array, the 
+                behavior is undefined.
+	@param callBacks A C pointer to a CFSetCallBacks structure
+		initialized with the callbacks for the set to use on each
+		value in the set. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a
+		structure on the stack can be passed in, or can be reused
+		for multiple set creations. If the version field of this
+		callbacks structure is not one of the defined ones for
+		CFSet, the behavior is undefined. The retain field may be
+		NULL, in which case the CFSet will do nothing to add a
+		retain to the contained values for the set. The release
+		field may be NULL, in which case the CFSet will do nothing
+		to remove the set's retain (if any) on the values when the
+		set is destroyed. If the copyDescription field is NULL,
+		the set will create a simple description for the value. If
+		the equal field is NULL, the set will use pointer equality
+		to test for equality of values. The hash field may be NULL,
+                in which case the CFSet will determine uniqueness by pointer
+                equality. This callbacks parameter
+		itself may be NULL, which is treated as if a valid structure
+		of version 0 with all fields NULL had been passed in.
+		Otherwise, if any of the fields are not valid pointers to
+		functions of the correct type, or this parameter is not a
+		valid pointer to a  CFSetCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		set is not one understood by one of the callback functions
+		the behavior when that callback function is used is
+		undefined.
+	@result A reference to the new immutable CFSet.
+}
+function CFSetCreate( allocator: CFAllocatorRef; {const} values: UnivPtrPtr; numValues: CFIndex; {const} callBacks: CFSetCallBacksPtr { can be NULL } ): CFSetRef; external name '_CFSetCreate';
+
+{!
+	@function CFSetCreateCopy
+	Creates a new immutable set with the values from the given set.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the set and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param theSet The set which is to be copied. The values from the
+		set are copied as pointers into the new set (that is,
+		the values themselves are copied, not that which the values
+		point to, if anything). However, the values are also
+		retained by the new set. The count of the new set will
+		be the same as the copied set. The new set uses the same
+		callbacks as the set to be copied. If this parameter is
+		not a valid CFSet, the behavior is undefined.
+	@result A reference to the new immutable CFSet.
+}
+function CFSetCreateCopy( allocator: CFAllocatorRef; theSet: CFSetRef ): CFSetRef; external name '_CFSetCreateCopy';
+
+{!
+	@function CFSetCreateMutable
+	Creates a new empty mutable set.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the set and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFSet. The set starts empty, and can grow to this
+		number of values (and it can have less). If this parameter
+		is 0, the set's maximum capacity is unlimited (or rather,
+		only limited by address space and available memory
+		constraints). If this parameter is negative, the behavior is
+		undefined.
+	@param callBacks A C pointer to a CFSetCallBacks structure
+		initialized with the callbacks for the set to use on each
+		value in the set. A copy of the contents of the
+		callbacks structure is made, so that a pointer to a
+		structure on the stack can be passed in, or can be reused
+		for multiple set creations. If the version field of this
+		callbacks structure is not one of the defined ones for
+		CFSet, the behavior is undefined. The retain field may be
+		NULL, in which case the CFSet will do nothing to add a
+		retain to the contained values for the set. The release
+		field may be NULL, in which case the CFSet will do nothing
+		to remove the set's retain (if any) on the values when the
+		set is destroyed. If the copyDescription field is NULL,
+		the set will create a simple description for the value. If
+		the equal field is NULL, the set will use pointer equality
+		to test for equality of values. The hash field may be NULL,
+                in which case the CFSet will determine uniqueness by pointer
+                equality. This callbacks parameter
+		itself may be NULL, which is treated as if a valid structure
+		of version 0 with all fields NULL had been passed in.
+		Otherwise, if any of the fields are not valid pointers to
+		functions of the correct type, or this parameter is not a
+		valid pointer to a  CFSetCallBacks callbacks structure,
+		the behavior is undefined. If any of the values put into the
+		set is not one understood by one of the callback functions
+		the behavior when that callback function is used is
+		undefined.
+	@result A reference to the new mutable CFSet.
+}
+function CFSetCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex; {const} callBacks: CFSetCallBacksPtr { can be NULL } ): CFMutableSetRef; external name '_CFSetCreateMutable';
+
+{!
+	@function CFSetCreateMutableCopy
+	Creates a new immutable set with the values from the given set.
+	@param allocator The CFAllocator which should be used to allocate
+		memory for the set and its storage for values. This
+		parameter may be NULL in which case the current default
+		CFAllocator is used. If this reference is not a valid
+		CFAllocator, the behavior is undefined.
+	@param capacity The maximum number of values that can be contained
+		by the CFSet. The set starts with the same values as the
+                set to be copied, and can grow to this number of values.
+                If this parameter is 0, the set's maximum capacity is 
+                unlimited (or rather, only limited by address space and 
+                available memory constraints). This parameter must be 
+                greater than or equal to the count of the set which is to
+                be copied, or the behavior is undefined.
+	@param theSet The set which is to be copied. The values from the
+		set are copied as pointers into the new set (that is,
+		the values themselves are copied, not that which the values
+		point to, if anything). However, the values are also
+		retained by the new set. The count of the new set will
+		be the same as the copied set. The new set uses the same
+		callbacks as the set to be copied. If this parameter is
+		not a valid CFSet, the behavior is undefined.
+	@result A reference to the new mutable CFSet.
+}
+function CFSetCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; theSet: CFSetRef ): CFMutableSetRef; external name '_CFSetCreateMutableCopy';
+
+{!
+	@function CFSetGetCount
+	Returns the number of values currently in the set.
+	@param theSet The set to be queried. If this parameter is not a valid
+		CFSet, the behavior is undefined.
+	@result The number of values in the set.
+}
+function CFSetGetCount( theSet: CFSetRef ): CFIndex; external name '_CFSetGetCount';
+
+{!
+	@function CFSetGetCountOfValue
+	Counts the number of times the given value occurs in the set. Since 
+        sets by definition contain only one instance of a value, this function
+        is synomous to SFSetContainsValue.
+	@param theSet The set to be searched. If this parameter is not a
+		valid CFSet, the behavior is undefined.
+	@param value The value for which to find matches in the set. The
+		equal() callback provided when the set was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the set, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result The number of times the given value occurs in the set.
+}
+function CFSetGetCountOfValue( theSet: CFSetRef; value: {const} UnivPtr ): CFIndex; external name '_CFSetGetCountOfValue';
+
+{!
+	@function CFSetContainsValue
+	Reports whether or not the value is in the set.
+	@param theSet The set to be searched. If this parameter is not a
+		valid CFSet, the behavior is undefined.
+	@param value The value for which to find matches in the set. The
+		equal() callback provided when the set was created is
+		used to compare. If the equal() callback was NULL, pointer
+		equality (in C, ==) is used. If value, or any of the values
+		in the set, are not understood by the equal() callback,
+		the behavior is undefined.
+	@result true, if the value is in the set, otherwise false.
+}
+function CFSetContainsValue( theSet: CFSetRef; value: {const} UnivPtr ): Boolean; external name '_CFSetContainsValue';
+
+{!
+	@function CFSetGetValue
+	Retrieves a value in the set which hashes the same as the specified value.
+	@param theSet The set to be queried. If this parameter is not a
+		valid CFSet, the behavior is undefined.
+	@param value The value to retrieve. The equal() callback provided when
+                the set was created is used to compare. If the equal() callback
+                was NULL, pointer equality (in C, ==) is used. If a value, or
+                any of the values in the set, are not understood by the equal()
+                callback, the behavior is undefined.
+        @result The value in the set with the given hash.
+}
+function CFSetGetValue( theSet: CFSetRef; value: {const} UnivPtr ): UnivPtr; external name '_CFSetGetValue';
+
+{!
+	@function CFSetGetValue
+	Retrieves a value in the set which hashes the same as the specified value,
+        if present.
+	@param theSet The set to be queried. If this parameter is not a
+		valid CFSet, the behavior is undefined.
+	@param candidate This value is hashed and compared with values in the
+                set to determine which value to retrieve. The equal() callback provided when
+                the set was created is used to compare. If the equal() callback
+                was NULL, pointer equality (in C, ==) is used. If a value, or
+                any of the values in the set, are not understood by the equal()
+                callback, the behavior is undefined.
+	@param value A pointer to memory which should be filled with the
+		pointer-sized value if a matching value is found. If no
+		match is found, the contents of the storage pointed to by
+		this parameter are undefined. This parameter may be NULL,
+		in which case the value from the dictionary is not returned
+		(but the return value of this function still indicates
+		whether or not the value was present).
+        @result True if the value was present in the set, otherwise false.
+}
+function CFSetGetValueIfPresent( theSet: CFSetRef; candidate: {const} UnivPtr; {const} value: UnivPtrPtr ): Boolean; external name '_CFSetGetValueIfPresent';
+
+{!
+	@function CFSetGetValues
+	Fills the buffer with values from the set.
+	@param theSet The set to be queried. If this parameter is not a
+		valid CFSet, the behavior is undefined.
+	@param values A C array of pointer-sized values to be filled with
+		values from the set. The values in the C array are ordered
+		in the same order in which they appear in the set. If this
+		parameter is not a valid pointer to a C array of at least
+		CFSetGetCount() pointers, the behavior is undefined.
+}
+procedure CFSetGetValues( theSet: CFSetRef; {const} values: UnivPtrPtr ); external name '_CFSetGetValues';
+
+{!
+	@function CFSetApplyFunction
+	Calls a function once for each value in the set.
+	@param theSet The set to be operated upon. If this parameter is not
+		a valid CFSet, the behavior is undefined.
+	@param applier The callback function to call once for each value in
+		the given set. If this parameter is not a
+		pointer to a function of the correct prototype, the behavior
+		is undefined. If there are values in the set which the
+		applier function does not expect or cannot properly apply
+		to, the behavior is undefined. 
+	@param context A pointer-sized user-defined value, which is passed
+		as the second parameter to the applier function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the applier function, the behavior is
+		undefined.
+}
+procedure CFSetApplyFunction( theSet: CFSetRef; applier: CFSetApplierFunction; context: UnivPtr ); external name '_CFSetApplyFunction';
+
+{!
+	@function CFSetAddValue
+	Adds the value to the set if it is not already present.
+	@param theSet The set to which the value is to be added. If this
+		parameter is not a valid mutable CFSet, the behavior is
+		undefined. If the set is a fixed-capacity set and it
+		is full before this operation, the behavior is undefined.
+	@param value The value to add to the set. The value is retained by
+		the set using the retain callback provided when the set
+		was created. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined. The count of the 
+                set is increased by one.
+}
+procedure CFSetAddValue( theSet: CFMutableSetRef; value: {const} UnivPtr ); external name '_CFSetAddValue';
+
+{!
+	@function CFSetReplaceValue
+	Replaces the value in the set if it is present.
+	@param theSet The set to which the value is to be replaced. If this
+		parameter is not a valid mutable CFSet, the behavior is
+		undefined.
+        @param value The value to replace in the set. The equal() callback provided when
+                the set was created is used to compare. If the equal() callback
+                was NULL, pointer equality (in C, ==) is used. If a value, or
+                any of the values in the set, are not understood by the equal()
+                callback, the behavior is undefined. The value is retained by
+		the set using the retain callback provided when the set
+		was created. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined. The count of the 
+                set is increased by one.
+}
+procedure CFSetReplaceValue( theSet: CFMutableSetRef; value: {const} UnivPtr ); external name '_CFSetReplaceValue';
+
+{!
+	@function CFSetSetValue
+	Replaces the value in the set if it is present, or adds the value to 
+        the set if it is absent.
+	@param theSet The set to which the value is to be replaced. If this
+		parameter is not a valid mutable CFSet, the behavior is
+		undefined.
+        @param value The value to set in the CFSet. The equal() callback provided when
+                the set was created is used to compare. If the equal() callback
+                was NULL, pointer equality (in C, ==) is used. If a value, or
+                any of the values in the set, are not understood by the equal()
+                callback, the behavior is undefined. The value is retained by
+		the set using the retain callback provided when the set
+		was created. If the value is not of the sort expected by the
+		retain callback, the behavior is undefined. The count of the 
+                set is increased by one.
+}
+procedure CFSetSetValue( theSet: CFMutableSetRef; value: {const} UnivPtr ); external name '_CFSetSetValue';
+
+{!
+	@function CFSetRemoveValue
+	Removes the specified value from the set.
+	@param theSet The set from which the value is to be removed.
+                If this parameter is not a valid mutable CFSet,
+		the behavior is undefined.
+        @param value The value to remove. The equal() callback provided when
+                the set was created is used to compare. If the equal() callback
+                was NULL, pointer equality (in C, ==) is used. If a value, or
+                any of the values in the set, are not understood by the equal()
+                callback, the behavior is undefined.
+}
+procedure CFSetRemoveValue( theSet: CFMutableSetRef; value: {const} UnivPtr ); external name '_CFSetRemoveValue';
+
+{!
+	@function CFSetRemoveAllValues
+	Removes all the values from the set, making it empty.
+	@param theSet The set from which all of the values are to be
+		removed. If this parameter is not a valid mutable CFSet,
+		the behavior is undefined.
+}
+procedure CFSetRemoveAllValues( theSet: CFMutableSetRef ); external name '_CFSetRemoveAllValues';
+
+
+end.

+ 300 - 0
packages/extra/univint/CFSocket.pas

@@ -0,0 +1,300 @@
+{	CFSocket.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{   Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{   Pascal Translation Updated:  Peter N Lewis, <[email protected]>, September 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFSocket;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData,CFString,CFRunLoop,CFDate;
+{$ALIGN POWER}
+
+
+type
+	CFSocketNativeHandle = SInt32;
+
+
+type
+	CFSocketRef = ^SInt32; { an opaque 32-bit type }
+
+{ A CFSocket contains a native socket within a structure that can 
+be used to read from the socket in the background and make the data
+thus read available using a runloop source.  The callback used for
+this may be of three types, as specified by the callBackTypes
+argument when creating the CFSocket.
+
+If kCFSocketReadCallBack is used, then data will not be
+automatically read, but the callback will be called when data
+is available to be read, or a new child socket is waiting to be
+accepted.
+    
+If kCFSocketAcceptCallBack is used, then new child sockets will be
+accepted and passed to the callback, with the data argument being
+a pointer to a CFSocketNativeHandle.  This is usable only with
+connection rendezvous sockets.
+
+If kCFSocketDataCallBack is used, then data will be read in chunks
+in the background and passed to the callback, with the data argument
+being a CFDataRef.
+
+These three types are mutually exclusive, but any one of them may
+have kCFSocketConnectCallBack added to it, if the socket will be
+used to connect in the background.  Connect in the background occurs
+if CFSocketConnectToAddress is called with a negative timeout
+value, in which case the call returns immediately, and a
+kCFSocketConnectCallBack is generated when the connect finishes.
+In this case the data argument is either NULL, or a pointer to
+an SInt32 error code if the connect failed.  kCFSocketConnectCallBack
+will never be sent more than once for a given socket.
+
+The callback types may also have kCFSocketWriteCallBack added to
+them, if large amounts of data are to be sent rapidly over the 
+socket and notification is desired when there is space in the
+kernel buffers so that the socket is writable again.  
+
+With a connection-oriented socket, if the connection is broken from the
+other end, then one final kCFSocketReadCallBack or kCFSocketDataCallBack 
+will occur.  In the case of kCFSocketReadCallBack, the underlying socket 
+will have 0 bytes available to read.  In the case of kCFSocketDataCallBack,
+the data argument will be a CFDataRef of length 0.
+
+There are socket flags that may be set to control whether callbacks of 
+a given type are automatically reenabled after they are triggered, and 
+whether the underlying native socket will be closed when the CFSocket
+is invalidated.  By default read, accept, and data callbacks are 
+automatically reenabled; write callbacks are not, and connect callbacks
+may not be, since they are sent once only.  Be careful about automatically
+reenabling read and write callbacks, since this implies that the 
+callbacks will be sent repeatedly if the socket remains readable or
+writable respectively.  Be sure to set these flags only for callbacks
+that your CFSocket actually possesses; the result of setting them for
+other callback types is undefined.
+
+Individual callbacks may also be enabled and disabled manually, whether 
+they are automatically reenabled or not.  If they are not automatically 
+reenabled, then they will need to be manually reenabled when the callback 
+is ready to be received again (and not sooner).  Even if they are 
+automatically reenabled, there may be occasions when it will be useful
+to be able to manually disable them temporarily and then reenable them.
+Be sure to enable and disable only callbacks that your CFSocket actually
+possesses; the result of enabling and disabling other callback types is
+undefined.
+
+By default the underlying native socket will be closed when the CFSocket 
+is invalidated, but it will not be if kCFSocketCloseOnInvalidate is 
+turned off.  This can be useful in order to destroy a CFSocket but 
+continue to use the underlying native socket.  The CFSocket must 
+still be invalidated when it will no longer be used.  Do not in 
+either case close the underlying native socket without invalidating 
+the CFSocket.
+
+Addresses are stored as CFDatas containing a struct sockaddr
+appropriate for the protocol family; make sure that all fields are
+filled in properly when passing in an address.  
+
+}
+
+type
+	CFSocketError = SInt32;
+const
+    kCFSocketSuccess = 0;
+    kCFSocketError = -1;
+    kCFSocketTimeout = -2;
+
+type
+	CFSocketSignature = record
+		protocolFamily: SInt32;
+		socketType: SInt32;
+		protocol: SInt32;
+		address: CFDataRef;
+	end;
+
+type
+	CFSocketCallBackType = SInt32;
+const
+    kCFSocketNoCallBack = 0;
+    kCFSocketReadCallBack = 1;
+    kCFSocketAcceptCallBack = 2;
+    kCFSocketDataCallBack = 3;
+    kCFSocketConnectCallBack = 4;
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+    kCFSocketWriteCallBack = 8;
+{#endif}
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ Socket flags }
+const
+	kCFSocketAutomaticallyReenableReadCallBack = 1;
+	kCFSocketAutomaticallyReenableAcceptCallBack = 2;
+	kCFSocketAutomaticallyReenableDataCallBack = 3;
+	kCFSocketAutomaticallyReenableWriteCallBack = 8;
+	kCFSocketCloseOnInvalidate = 128;
+{#endif}
+
+type
+	CFSocketCallBack = procedure( s: CFSocketRef; typ: CFSocketCallBackType; address: CFDataRef; data: {const} UnivPtr; info: UnivPtr );
+{ If the callback wishes to keep hold of address or data after the point that it returns, then it must copy them. }
+
+type
+	CFSocketContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+
+function CFSocketGetTypeID: CFTypeID; external name '_CFSocketGetTypeID';
+
+function CFSocketCreate( allocator: CFAllocatorRef; protocolFamily: SInt32; socketType: SInt32; protocol: SInt32; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext ): CFSocketRef; external name '_CFSocketCreate';
+function CFSocketCreateWithNative( allocator: CFAllocatorRef; sock: CFSocketNativeHandle; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext ): CFSocketRef; external name '_CFSocketCreateWithNative';
+function CFSocketCreateWithSocketSignature( allocator: CFAllocatorRef; const (*var*) signature: CFSocketSignature; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext ): CFSocketRef; external name '_CFSocketCreateWithSocketSignature';
+function CFSocketCreateConnectedToSocketSignature( allocator: CFAllocatorRef; const (*var*) signature: CFSocketSignature; callBackTypes: CFOptionFlags; callout: CFSocketCallBack; const (*var*) context: CFSocketContext; timeout: CFTimeInterval ): CFSocketRef; external name '_CFSocketCreateConnectedToSocketSignature';
+{ CFSocketCreateWithSignature creates a socket of the requested type and binds its address (using CFSocketSetAddress) to the requested address.  If this fails, it returns NULL.  CFSocketCreateConnectedToSignature creates a socket suitable for connecting to the requested type and address, and connects it (using CFSocketConnectToAddress).  If this fails, it returns NULL. }
+
+function CFSocketSetAddress( s: CFSocketRef; address: CFDataRef ): CFSocketError; external name '_CFSocketSetAddress';
+function CFSocketConnectToAddress( s: CFSocketRef; address: CFDataRef; timeout: CFTimeInterval ): CFSocketError; external name '_CFSocketConnectToAddress';
+procedure CFSocketInvalidate( s: CFSocketRef ); external name '_CFSocketInvalidate';
+
+function CFSocketIsValid( s: CFSocketRef ): Boolean; external name '_CFSocketIsValid';
+function CFSocketCopyAddress( s: CFSocketRef ): CFDataRef; external name '_CFSocketCopyAddress';
+function CFSocketCopyPeerAddress( s: CFSocketRef ): CFDataRef; external name '_CFSocketCopyPeerAddress';
+procedure CFSocketGetContext( s: CFSocketRef; var context: CFSocketContext ); external name '_CFSocketGetContext';
+function CFSocketGetNative( s: CFSocketRef ): CFSocketNativeHandle; external name '_CFSocketGetNative';
+
+function CFSocketCreateRunLoopSource( allocator: CFAllocatorRef; s: CFSocketRef; order: CFIndex ): CFRunLoopSourceRef; external name '_CFSocketCreateRunLoopSource';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+function CFSocketGetSocketFlags( s: CFSocketRef ): CFOptionFlags; external name '_CFSocketGetSocketFlags';
+procedure CFSocketSetSocketFlags( s: CFSocketRef; flags: CFOptionFlags ); external name '_CFSocketSetSocketFlags';
+procedure CFSocketDisableCallBacks( s: CFSocketRef; callBackTypes: CFOptionFlags ); external name '_CFSocketDisableCallBacks';
+procedure CFSocketEnableCallBacks( s: CFSocketRef; callBackTypes: CFOptionFlags ); external name '_CFSocketEnableCallBacks';
+{#endif}
+
+{ For convenience, a function is provided to send data using the socket with a timeout.  The timeout will be used only if the specified value is positive.  The address should be left NULL if the socket is already connected. }
+function CFSocketSendData( s: CFSocketRef; address: CFDataRef; data: CFDataRef; timeout: CFTimeInterval ): CFSocketError; external name '_CFSocketSendData';
+
+{ Generic name registry functionality (CFSocketRegisterValue, 
+CFSocketCopyRegisteredValue) allows the registration of any property
+list type.  Functions specific to CFSockets (CFSocketRegisterSocketData,
+CFSocketCopyRegisteredSocketData) register a CFData containing the
+components of a socket signature (protocol family, socket type,
+protocol, and address).  In each function the nameServerSignature
+may be NULL, or any component of it may be 0, to use default values
+(TCP, INADDR_LOOPBACK, port as set).  Name registration servers might
+not allow registration with other than TCP and INADDR_LOOPBACK.
+The actual address of the server responding to a query may be obtained
+by using the nameServerAddress argument.  This address, the address
+returned by CFSocketCopyRegisteredSocketSignature, and the value
+returned by CFSocketCopyRegisteredValue must (if non-null) be released
+by the caller.  CFSocketUnregister removes any registration associated
+with the specified name.
+}
+
+function CFSocketRegisterValue( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; value: CFPropertyListRef ): CFSocketError; external name '_CFSocketRegisterValue';
+function CFSocketCopyRegisteredValue( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; var value: CFPropertyListRef; var nameServerAddress: CFDataRef ): CFSocketError; external name '_CFSocketCopyRegisteredValue';
+
+function CFSocketRegisterSocketSignature( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; const (*var*) signature: CFSocketSignature ): CFSocketError; external name '_CFSocketRegisterSocketSignature';
+function CFSocketCopyRegisteredSocketSignature( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef; var signature: CFSocketSignature; var nameServerAddress: CFDataRef ): CFSocketError; external name '_CFSocketCopyRegisteredSocketSignature';
+
+function CFSocketUnregister( const (*var*) nameServerSignature: CFSocketSignature; timeout: CFTimeInterval; name: CFStringRef ): CFSocketError; external name '_CFSocketUnregister';
+
+procedure CFSocketSetDefaultNameRegistryPortNumber( port: UInt16 ); external name '_CFSocketSetDefaultNameRegistryPortNumber';
+function CFSocketGetDefaultNameRegistryPortNumber: UInt16; external name '_CFSocketGetDefaultNameRegistryPortNumber';
+
+{ Constants used in name registry server communications }
+var kCFSocketCommandKey: CFStringRef; external name '_kCFSocketCommandKey'; (* attribute const *)
+var kCFSocketNameKey: CFStringRef; external name '_kCFSocketNameKey'; (* attribute const *)
+var kCFSocketValueKey: CFStringRef; external name '_kCFSocketValueKey'; (* attribute const *)
+var kCFSocketResultKey: CFStringRef; external name '_kCFSocketResultKey'; (* attribute const *)
+var kCFSocketErrorKey: CFStringRef; external name '_kCFSocketErrorKey'; (* attribute const *)
+var kCFSocketRegisterCommand: CFStringRef; external name '_kCFSocketRegisterCommand'; (* attribute const *)
+var kCFSocketRetrieveCommand: CFStringRef; external name '_kCFSocketRetrieveCommand'; (* attribute const *)
+
+
+end.

+ 616 - 0
packages/extra/univint/CFSocketStream.pas

@@ -0,0 +1,616 @@
+{
+     File:       CFNetwork/CFSocketStream.h
+ 
+     Contains:   CoreFoundation Network socket streams header
+ 
+     Version:    CFNetwork-71.2~1
+ 
+     Copyright:  © 2001-2003 by Apple Computer, Inc., all rights reserved
+ 
+     Bugs?:      For bug reports, consult the following page on
+                 the World Wide Web:
+ 
+                     http://developer.apple.com/bugreporter/
+ 
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+
+
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFSocketStream;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFStream,CFBase,CFHost,CFNetServices;
+{$ALIGN MAC68K}
+
+{
+ *  kCFStreamErrorDomainSSL
+ *  
+ *  Discussion:
+ *    Errors located in Security/SecureTransport.h
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamErrorDomainSSL: SInt32; external name '_kCFStreamErrorDomainSSL'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertySocketSecurityLevel
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations. To set a
+ *    stream to be secure, call CFReadStreamSetProperty or
+ *    CFWriteStreamSetPropertywith the property name set to
+ *    kCFStreamPropertySocketSecurityLevel and the value being one of
+ *    the following values.  Streams may set a security level after
+ *    open in order to allow on-the-fly securing of a stream.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySocketSecurityLevel: CFStringRef; external name '_kCFStreamPropertySocketSecurityLevel'; (* attribute const *)
+
+
+{
+ *  kCFStreamSocketSecurityLevelNone
+ *  
+ *  Discussion:
+ *    Stream property value, for both set and copy operations.
+ *    Indicates to use no security (default setting).
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSecurityLevelNone: CFStringRef; external name '_kCFStreamSocketSecurityLevelNone'; (* attribute const *)
+
+
+{
+ *  kCFStreamSocketSecurityLevelSSLv2
+ *  
+ *  Discussion:
+ *    Stream property value, for both set and copy operations.
+ *    Indicates to use SSLv2 security.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSecurityLevelSSLv2: CFStringRef; external name '_kCFStreamSocketSecurityLevelSSLv2'; (* attribute const *)
+
+
+{
+ *  kCFStreamSocketSecurityLevelSSLv3
+ *  
+ *  Discussion:
+ *    Stream property value, for both set and copy operations.
+ *    Indicates to use SSLv3 security.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSecurityLevelSSLv3: CFStringRef; external name '_kCFStreamSocketSecurityLevelSSLv3'; (* attribute const *)
+
+
+{
+ *  kCFStreamSocketSecurityLevelTLSv1
+ *  
+ *  Discussion:
+ *    Stream property value, for both set and copy operations.
+ *    Indicates to use TLSv1 security.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSecurityLevelTLSv1: CFStringRef; external name '_kCFStreamSocketSecurityLevelTLSv1'; (* attribute const *)
+
+
+{
+ *  kCFStreamSocketSecurityLevelNegotiatedSSL
+ *  
+ *  Discussion:
+ *    Stream property value, for both set and copy operations.
+ *    Indicates to use TLS or SSL with fallback to lower versions. This
+ *    is what HTTPS does, for instance.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSecurityLevelNegotiatedSSL: CFStringRef; external name '_kCFStreamSocketSecurityLevelNegotiatedSSL'; (* attribute const *)
+
+
+{
+ *  kCFStreamErrorDomainSOCKS
+ *  
+ *  Discussion:
+ *    SOCKS proxy error domain.  Errors formulated using inlines below.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamErrorDomainSOCKS: SInt32; external name '_kCFStreamErrorDomainSOCKS'; (* attribute const *)
+
+
+{
+CF_INLINE
+SInt32 CFSocketStreamSOCKSGetErrorSubdomain(CFStreamError* error)
+    return ((error->domain >> 16) & 0x0000FFFF);
+
+CF_INLINE
+SInt32 CFSocketStreamSOCKSGetError(CFStreamError* error)
+    return (error->domain & 0x0000FFFF);
+}
+
+const
+  kCFStreamErrorSOCKSSubDomainNone = 0; { Error code is a general SOCKS error }
+  kCFStreamErrorSOCKSSubDomainVersionCode = 1; { Error code is the version of SOCKS which the server wishes to use }
+  kCFStreamErrorSOCKS4SubDomainResponse = 2; { Error code is the status code returned by the server }
+  kCFStreamErrorSOCKS5SubDomainUserPass = 3; { Error code is the status code that the server returned }
+  kCFStreamErrorSOCKS5SubDomainMethod = 4; { Error code is the server's desired negotiation method }
+  kCFStreamErrorSOCKS5SubDomainResponse = 5; { Error code is the response code that the server returned in reply to the connection request }
+
+
+{ kCFStreamErrorSOCKSSubDomainNone}
+const
+  kCFStreamErrorSOCKS5BadResponseAddr = 1;
+  kCFStreamErrorSOCKS5BadState  = 2;
+  kCFStreamErrorSOCKSUnknownClientVersion = 3;
+
+{ kCFStreamErrorSOCKS4SubDomainResponse}
+const
+  kCFStreamErrorSOCKS4RequestFailed = 91; { request rejected or failed }
+  kCFStreamErrorSOCKS4IdentdFailed = 92; { request rejected because SOCKS server cannot connect to identd on the client }
+  kCFStreamErrorSOCKS4IdConflict = 93;   { request rejected because the client program and identd report different user-ids }
+
+{ kCFStreamErrorSOCKS5SubDomainMethod}
+const
+  kSOCKS5NoAcceptableMethod     = $0FF;  { other values indicate the server's desired method }
+
+
+{
+ *  kCFStreamPropertySOCKSProxy
+ *  
+ *  Discussion:
+ *    Stream property key, for both set and copy operations.  To set a
+ *    stream to use a SOCKS proxy, call CFReadStreamSetProperty or
+ *    CFWriteStreamSetProperty with the property name set to
+ *    kCFStreamPropertySOCKSProxy and the value being a dictionary with
+ *    at least the following two keys: kCFStreamPropertySOCKSProxyHost
+ *    and kCFStreamPropertySOCKSProxyPort.  The dictionary returned by
+ *    SystemConfiguration for SOCKS proxies will work without
+ *    alteration.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySOCKSProxy: CFStringRef; external name '_kCFStreamPropertySOCKSProxy'; (* attribute const *)
+
+{
+ *  kCFStreamPropertySOCKSProxyHost
+ *  
+ *  Discussion:
+ *    CFDictinary key for SOCKS proxy information.  The key
+ *    kCFStreamPropertySOCKSProxyHost should contain a CFStringRef
+ *    value representing the SOCKS proxy host.  Defined to match
+ *    kSCPropNetProxiesSOCKSProxy
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySOCKSProxyHost: CFStringRef; external name '_kCFStreamPropertySOCKSProxyHost'; (* attribute const *)
+
+{
+ *  kCFStreamPropertySOCKSProxyPort
+ *  
+ *  Discussion:
+ *    CFDictinary key for SOCKS proxy information.  The key
+ *    kCFStreamPropertySOCKSProxyPort should contain a CFNumberRef
+ *    which itself is of type kCFNumberSInt32Type.  This value should
+ *    represent the port on which the proxy is listening.  Defined to
+ *    match kSCPropNetProxiesSOCKSPort
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySOCKSProxyPort: CFStringRef; external name '_kCFStreamPropertySOCKSProxyPort'; (* attribute const *)
+
+{
+ *  kCFStreamPropertySOCKSVersion
+ *  
+ *  Discussion:
+ *    CFDictinary key for SOCKS proxy information.  By default, SOCKS5
+ *    will be used unless there is a kCFStreamPropertySOCKSVersion key
+ *    in the dictionary.  Its value must be
+ *    kCFStreamSocketSOCKSVersion4 or kCFStreamSocketSOCKSVersion5 to
+ *    set SOCKS4 or SOCKS5, respectively.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySOCKSVersion: CFStringRef; external name '_kCFStreamPropertySOCKSVersion'; (* attribute const *)
+
+{
+ *  kCFStreamSocketSOCKSVersion4
+ *  
+ *  Discussion:
+ *    CFDictionary value for SOCKS proxy information.  Indcates that
+ *    SOCKS will or is using version 4 of the SOCKS protocol.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSOCKSVersion4: CFStringRef; external name '_kCFStreamSocketSOCKSVersion4'; (* attribute const *)
+
+{
+ *  kCFStreamSocketSOCKSVersion5
+ *  
+ *  Discussion:
+ *    CFDictionary value for SOCKS proxy information.  Indcates that
+ *    SOCKS will or is using version 5 of the SOCKS protocol.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamSocketSOCKSVersion5: CFStringRef; external name '_kCFStreamSocketSOCKSVersion5'; (* attribute const *)
+
+{
+ *  kCFStreamPropertySOCKSUser
+ *  
+ *  Discussion:
+ *    CFDictinary key for SOCKS proxy information.  To set a user name
+ *    and/or password, if required, the dictionary must contain the
+ *    key(s) kCFStreamPropertySOCKSUser and/or  
+ *    kCFStreamPropertySOCKSPassword with the value being the user's
+ *    name as a CFStringRef and/or the user's password as a
+ *    CFStringRef, respectively.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySOCKSUser: CFStringRef; external name '_kCFStreamPropertySOCKSUser'; (* attribute const *)
+
+{
+ *  kCFStreamPropertySOCKSPassword
+ *  
+ *  Discussion:
+ *    CFDictinary key for SOCKS proxy information.  To set a user name
+ *    and/or password, if required, the dictionary must contain the
+ *    key(s) kCFStreamPropertySOCKSUser and/or  
+ *    kCFStreamPropertySOCKSPassword with the value being the user's
+ *    name as a CFStringRef and/or the user's password as a
+ *    CFStringRef, respectively.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertySOCKSPassword: CFStringRef; external name '_kCFStreamPropertySOCKSPassword'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertyShouldCloseNativeSocket
+ *  
+ *  Discussion:
+ *    Set the value to kCFBooleanTrue if the stream should close and
+ *    release the underlying native socket when the stream is released.
+ *     Set the value to kCFBooleanFalse to keep the native socket from
+ *    closing and releasing when the stream is released. If the stream
+ *    was created with a native socket, the default property setting on
+ *    the stream is kCFBooleanFalse. The
+ *    kCFStreamPropertyShouldCloseNativeSocket can be set through
+ *    CFReadStreamSetProperty or CFWriteStreamSetProperty.  The
+ *    property can be copied through CFReadStreamCopyProperty or
+ *    CFWriteStreamCopyProperty.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.2 and later
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+var kCFStreamPropertyShouldCloseNativeSocket: CFStringRef; external name '_kCFStreamPropertyShouldCloseNativeSocket'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertySocketRemoteHost
+ *  
+ *  Discussion:
+ *    Stream property key for copy operations. Returns a CFHostRef if
+ *    known, otherwise NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertySocketRemoteHost: CFStringRef; external name '_kCFStreamPropertySocketRemoteHost'; (* attribute const *)
+
+
+{
+ *  kCFStreamPropertySocketRemoteNetService
+ *  
+ *  Discussion:
+ *    Stream property key for copy operations. Returns a
+ *    CFNetServiceRef if known, otherwise NULL.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+var kCFStreamPropertySocketRemoteNetService: CFStringRef; external name '_kCFStreamPropertySocketRemoteNetService'; (* attribute const *)
+
+
+{
+ *  CFStreamCreatePairWithSocketToCFHost()
+ *  
+ *  Discussion:
+ *    Given a CFHostRef, this function will create a pair of streams
+ *    suitable for connecting to the host.  If there is a failure
+ *    during creation, the stream references will be set to NULL.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      streams. If this reference is not a valid CFAllocator, the
+ *      behavior is undefined.
+ *    
+ *    host:
+ *      A reference to a CFHost to which the streams are desired.  If
+ *      unresolved, the host will be resolved prior to connecting.
+ *    
+ *    port:
+ *      The port to which the connection should be established.
+ *    
+ *    readStream:
+ *      A pointer to a CFReadStreamRef which will be set to the new
+ *      read stream instance.  Can be set to NULL if not desired.
+ *    
+ *    writeStream:
+ *      A pointer to a CFWriteStreamRef which will be set to the new
+ *      write stream instance.  Can be set to NULL if not desired.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure CFStreamCreatePairWithSocketToCFHost( alloc: CFAllocatorRef; host: CFHostRef; port: UInt32; readStream: CFReadStreamRefPtr; writeStream: CFWriteStreamRefPtr ); external name '_CFStreamCreatePairWithSocketToCFHost';
+
+
+{
+ *  CFStreamCreatePairWithSocketToNetService()
+ *  
+ *  Discussion:
+ *    Given a CFNetService, this function will create a pair of streams
+ *    suitable for connecting to the service.  If there is a failure
+ *    during creation, the stream references will be set to NULL.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    alloc:
+ *      The CFAllocator which should be used to allocate memory for the
+ *      streams. If this reference is not a valid CFAllocator, the
+ *      behavior is undefined.
+ *    
+ *    service:
+ *      A reference to a CFNetService to which the streams are desired.
+ *       If unresolved, the service will be resolved prior to
+ *      connecting.
+ *    
+ *    readStream:
+ *      A pointer to a CFReadStreamRef which will be set to the new
+ *      read stream instance.  Can be set to NULL if not desired.
+ *    
+ *    writeStream:
+ *      A pointer to a CFWriteStreamRef which will be set to the new
+ *      write stream instance.  Can be set to NULL if not desired.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.3 and later in CoreServices.framework
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+procedure CFStreamCreatePairWithSocketToNetService( alloc: CFAllocatorRef; service: CFNetServiceRef; readStream: CFReadStreamRefPtr; writeStream: CFWriteStreamRefPtr ); external name '_CFStreamCreatePairWithSocketToNetService';
+
+
+{
+ *  CFStreamSocketSecurityProtocol
+ *  
+ *  Discussion:
+ *    These enum values and CFSocketStreamPairSetSecurityProtocol have
+ *    been deprecated in favor of CFReadStreamSetProperty and
+ *    CFWriteStreamSetProperty with the previously mentioned property
+ *    and values.
+ }
+type
+	CFStreamSocketSecurityProtocol = SInt32;
+const
+  {
+   * DEPRECATED, use kCFStreamSocketSecurityLevelNone
+   }
+  kCFStreamSocketSecurityNone   = 0;
+
+  {
+   * DEPRECATED, use kCFStreamSocketSecurityLevelSSLv2
+   }
+  kCFStreamSocketSecuritySSLv2  = 1;
+
+  {
+   * DEPRECATED, use kCFStreamSocketSecurityLevelSSLv3
+   }
+  kCFStreamSocketSecuritySSLv3  = 2;
+
+  {
+   * DEPRECATED, use kCFStreamSocketSecurityLevelNegotiatedSSL
+   }
+  kCFStreamSocketSecuritySSLv23 = 3;
+
+  {
+   * DEPRECATED, use kCFStreamSocketSecurityLevelTLSv1
+   }
+  kCFStreamSocketSecurityTLSv1  = 4;
+
+{
+ *  CFSocketStreamPairSetSecurityProtocol()   *** DEPRECATED ***
+ *  
+ *  Discussion:
+ *    CFSocketStreamPairSetSecurityProtocol has been deprecated in
+ *    favor of CFReadStreamSetProperty and CFWriteStreamSetProperty
+ *    with the previously mentioned property and values.  Sets the
+ *    security level on a pair of streams.
+ *  
+ *  Mac OS X threading:
+ *    Thread safe
+ *  
+ *  Parameters:
+ *    
+ *    socketReadStream:
+ *      Read stream reference which is to have its security level
+ *      changed.
+ *    
+ *    socketWriteStream:
+ *      Write stream reference which is to have its security level
+ *      changed.
+ *    
+ *    securityProtocol:
+ *      CFStreamSocketSecurityProtocol enum indicating the security
+ *      level to be set.
+ *  
+ *  Result:
+ *    Returns TRUE if the settings were placed on the stream, FALSE
+ *    otherwise.
+ *  
+ *  Availability:
+ *    Mac OS X:         in version 10.1 and later in CoreServices.framework but deprecated in 10.2
+ *    CarbonLib:        not available
+ *    Non-Carbon CFM:   not available
+ }
+// AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_2
+function CFSocketStreamPairSetSecurityProtocol( socketReadStream: CFReadStreamRef; socketWriteStream: CFWriteStreamRef; securityProtocol: CFStreamSocketSecurityProtocol ): Boolean; external name '_CFSocketStreamPairSetSecurityProtocol';
+
+end.

+ 303 - 0
packages/extra/univint/CFStream.pas

@@ -0,0 +1,303 @@
+{	CFStream.h
+	Copyright (c) 2000-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFStream;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFString,CFDictionary,CFURL,CFRunLoop,CFSocket;
+{$ALIGN POWER}
+
+
+type
+	CFStreamStatus = SInt32;
+const
+    kCFStreamStatusNotOpen = 0;
+    kCFStreamStatusOpening = 1;  { open is in-progress }
+    kCFStreamStatusOpen = 2;
+    kCFStreamStatusReading = 3;
+    kCFStreamStatusWriting = 4;
+    kCFStreamStatusAtEnd = 5;    { no further bytes can be read/written }
+    kCFStreamStatusClosed = 6;
+    kCFStreamStatusError = 7;
+
+type
+	CFStreamErrorDomain = SInt32;
+const
+    kCFStreamErrorDomainCustom = -1;      { custom to the kind of stream in question }
+    kCFStreamErrorDomainPOSIX = 1;        { POSIX errno; interpret using <sys/errno.h> }
+    kCFStreamErrorDomainMacOSStatus = 2;      { OSStatus type from Carbon APIs; interpret using <MacTypes.h> }
+
+type
+	CFStreamError = record
+		domain: CFStreamErrorDomain;
+		error: SInt32;
+	end;
+	CFStreamErrorPtr = ^CFStreamError;
+
+type
+	CFStreamEventType = SInt32;
+const
+    kCFStreamEventNone = 0;
+    kCFStreamEventOpenCompleted = 1;
+    kCFStreamEventHasBytesAvailable = 2;
+    kCFStreamEventCanAcceptBytes = 4; 
+    kCFStreamEventErrorOccurred = 8;
+    kCFStreamEventEndEncountered = 16;
+
+type
+	CFStreamClientContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: function( info: {const} UnivPtr ): UnivPtr;
+		release: procedure( info: {const} UnivPtr );
+		copyDescription: function( info: {const} UnivPtr ): CFStringRef;
+	end;
+
+type
+	CFReadStreamRef = ^SInt32; { an opaque 32-bit type }
+	CFReadStreamRefPtr = ^CFReadStreamRef;
+	CFWriteStreamRef = ^SInt32; { an opaque 32-bit type }
+	CFWriteStreamRefPtr = ^CFWriteStreamRef;
+
+type
+	CFReadStreamClientCallBack = procedure( stream: CFReadStreamRef; typ: CFStreamEventType; clientCallBackInfo: UnivPtr );
+	CFWriteStreamClientCallBack = procedure( stream: CFWriteStreamRef; typ: CFStreamEventType; clientCallBackInfo: UnivPtr );
+
+function CFReadStreamGetTypeID: CFTypeID; external name '_CFReadStreamGetTypeID';
+function CFWriteStreamGetTypeID: CFTypeID; external name '_CFWriteStreamGetTypeID';
+
+{ Memory streams }
+
+{ Value will be a CFData containing all bytes thusfar written; used to recover the data written to a memory write stream. }
+var kCFStreamPropertyDataWritten: CFStringRef; external name '_kCFStreamPropertyDataWritten'; (* attribute const *)
+
+{ Pass kCFAllocatorNull for bytesDeallocator to prevent CFReadStream from deallocating bytes; otherwise, CFReadStream will deallocate bytes when the stream is destroyed }
+function CFReadStreamCreateWithBytesNoCopy( alloc: CFAllocatorRef; bytes: UnivPtr; length: CFIndex; bytesDeallocator: CFAllocatorRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithBytesNoCopy';
+
+{ The stream writes into the buffer given; when bufferCapacity is exhausted, the stream is exhausted (status becomes kCFStreamStatusAtEnd) }
+function CFWriteStreamCreateWithBuffer( alloc: CFAllocatorRef; buffer: UnivPtr; bufferCapacity: CFIndex ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithBuffer';
+
+{ New buffers are allocated from bufferAllocator as bytes are written to the stream.  At any point, you can recover the bytes thusfar written by asking for the property kCFStreamPropertyDataWritten, above }
+function CFWriteStreamCreateWithAllocatedBuffers( alloc: CFAllocatorRef; bufferAllocator: CFAllocatorRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithAllocatedBuffers';
+
+{ File streams }
+function CFReadStreamCreateWithFile( alloc: CFAllocatorRef; fileURL: CFURLRef ): CFReadStreamRef; external name '_CFReadStreamCreateWithFile';
+function CFWriteStreamCreateWithFile( alloc: CFAllocatorRef; fileURL: CFURLRef ): CFWriteStreamRef; external name '_CFWriteStreamCreateWithFile';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ Property for file write streams; value should be a CFBoolean.  Set to TRUE to append to a file, rather than to replace its contents }
+var kCFStreamPropertyAppendToFile: CFStringRef; external name '_kCFStreamPropertyAppendToFile'; (* attribute const *)
+{#endif}
+
+var kCFStreamPropertyFileCurrentOffset: CFStringRef; external name '_kCFStreamPropertyFileCurrentOffset'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Socket stream properties }
+
+{ Value will be a CFData containing the native handle }
+var kCFStreamPropertySocketNativeHandle: CFStringRef; external name '_kCFStreamPropertySocketNativeHandle'; (* attribute const *)
+
+{ Value will be a CFString, or NULL if unknown }
+var kCFStreamPropertySocketRemoteHostName: CFStringRef; external name '_kCFStreamPropertySocketRemoteHostName'; (* attribute const *)
+
+{ Value will be a CFNumber, or NULL if unknown }
+var kCFStreamPropertySocketRemotePortNumber: CFStringRef; external name '_kCFStreamPropertySocketRemotePortNumber'; (* attribute const *)
+
+{ Socket streams; the returned streams are paired such that they use the same socket; pass NULL if you want only the read stream or the write stream }
+procedure CFStreamCreatePairWithSocket( alloc: CFAllocatorRef; sock: CFSocketNativeHandle; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithSocket';
+procedure CFStreamCreatePairWithSocketToHost( alloc: CFAllocatorRef; host: CFStringRef; port: UInt32; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithSocketToHost';
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+procedure CFStreamCreatePairWithPeerSocketSignature( alloc: CFAllocatorRef; const (*var*) signature: CFSocketSignature; var readStream: CFReadStreamRef; var writeStream: CFWriteStreamRef ); external name '_CFStreamCreatePairWithPeerSocketSignature';
+{#endif}
+
+
+{ Returns the current state of the stream }
+function CFReadStreamGetStatus( stream: CFReadStreamRef ): CFStreamStatus; external name '_CFReadStreamGetStatus';
+function CFWriteStreamGetStatus( stream: CFWriteStreamRef ): CFStreamStatus; external name '_CFWriteStreamGetStatus';
+
+{ 0 is returned if no error has occurred.  errorDomain specifies the domain
+   in which the error code should be interpretted; pass NULL if you are not 
+   interested. }
+function CFReadStreamGetError( stream: CFReadStreamRef ): CFStreamError; external name '_CFReadStreamGetError';
+function CFWriteStreamGetError( stream: CFWriteStreamRef ): CFStreamError; external name '_CFWriteStreamGetError';
+
+{ Returns success/failure.  Opening a stream causes it to reserve all the system
+   resources it requires.  If the stream can open non-blocking, this will always 
+   return TRUE; listen to the run loop source to find out when the open completes
+   and whether it was successful, or poll using CFRead/WriteStreamGetStatus(), waiting 
+   for a status of kCFStreamStatusOpen or kCFStreamStatusError.  }
+function CFReadStreamOpen( stream: CFReadStreamRef ): Boolean; external name '_CFReadStreamOpen';
+function CFWriteStreamOpen( stream: CFWriteStreamRef ): Boolean; external name '_CFWriteStreamOpen';
+
+{ Terminates the flow of bytes; releases any system resources required by the 
+   stream.  The stream may not fail to close.  You may call CFStreamClose() to 
+   effectively abort a stream. }
+procedure CFReadStreamClose( stream: CFReadStreamRef ); external name '_CFReadStreamClose';
+procedure CFWriteStreamClose( stream: CFWriteStreamRef ); external name '_CFWriteStreamClose';
+
+{ Whether there is data currently available for reading; returns TRUE if it's 
+   impossible to tell without trying }
+function CFReadStreamHasBytesAvailable( stream: CFReadStreamRef ): Boolean; external name '_CFReadStreamHasBytesAvailable';
+
+{ Returns the number of bytes read, or -1 if an error occurs preventing any 
+   bytes from being read, or 0 if the stream's end was encountered.  
+   It is an error to try and read from a stream that hasn't been opened first.  
+   This call will block until at least one byte is available; it will NOT block
+   until the entire buffer can be filled.  To avoid blocking, either poll using
+   CFReadStreamHasBytesAvailable() or use the run loop and listen for the 
+   kCFStreamCanRead event for notification of data available. }
+function CFReadStreamRead( stream: CFReadStreamRef; buffer: UnivPtr; bufferLength: CFIndex ): CFIndex; external name '_CFReadStreamRead';
+
+{ Returns a pointer to an internal buffer if possible (setting *numBytesRead
+   to the length of the returned buffer), otherwise returns NULL; guaranteed 
+   to return in O(1).  Bytes returned in the buffer are considered read from 
+   the stream; if maxBytesToRead is greater than 0, not more than maxBytesToRead
+   will be returned.  If maxBytesToRead is less than or equal to zero, as many bytes
+   as are readily available will be returned.  The returned buffer is good only 
+   until the next stream operation called on the stream.  Caller should neither 
+   change the contents of the returned buffer nor attempt to deallocate the buffer;
+   it is still owned by the stream. }
+function CFReadStreamGetBuffer( stream: CFReadStreamRef; maxBytesToRead: CFIndex; var numBytesRead: CFIndex ): UInt8Ptr; external name '_CFReadStreamGetBuffer';
+
+{ Whether the stream can currently be written to without blocking;
+   returns TRUE if it's impossible to tell without trying }
+function CFWriteStreamCanAcceptBytes( stream: CFWriteStreamRef ): Boolean; external name '_CFWriteStreamCanAcceptBytes';
+
+{ Returns the number of bytes successfully written, -1 if an error has
+   occurred, or 0 if the stream has been filled to capacity (for fixed-length
+   streams).  If the stream is not full, this call will block until at least
+   one byte is written.  To avoid blocking, either poll via CFWriteStreamCanAcceptBytes
+   or use the run loop and listen for the kCFStreamCanWrite event. }
+function CFWriteStreamWrite( stream: CFWriteStreamRef; buffer: UnivPtr; bufferLength: CFIndex ): CFIndex; external name '_CFWriteStreamWrite';
+
+{ Particular streams can name properties and assign meanings to them; you
+   access these properties through the following calls.  A property is any interesting
+   information about the stream other than the data being transmitted itself.
+   Examples include the headers from an HTTP transmission, or the expected 
+   number of bytes, or permission information, etc.  Properties that can be set
+   configure the behavior of the stream, and may only be settable at particular times
+   (like before the stream has been opened).  See the documentation for particular 
+   properties to determine their get- and set-ability. }
+function CFReadStreamCopyProperty( stream: CFReadStreamRef; propertyName: CFStringRef ): CFTypeRef; external name '_CFReadStreamCopyProperty';
+function CFWriteStreamCopyProperty( stream: CFWriteStreamRef; propertyName: CFStringRef ): CFTypeRef; external name '_CFWriteStreamCopyProperty';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ Returns TRUE if the stream recognizes and accepts the given property-value pair; 
+   FALSE otherwise. }
+function CFReadStreamSetProperty( stream: CFReadStreamRef; propertyName: CFStringRef; propertyValue: CFTypeRef ): Boolean; external name '_CFReadStreamSetProperty';
+function CFWriteStreamSetProperty( stream: CFWriteStreamRef; propertyName: CFStringRef; propertyValue: CFTypeRef ): Boolean; external name '_CFWriteStreamSetProperty';
+{#endif}
+
+{ Asynchronous processing - If you wish to neither poll nor block, you may register 
+   a client to hear about interesting events that occur on a stream.  Only one client
+   per stream is allowed; registering a new client replaces the previous one.
+
+   Once you have set a client, you need to schedule a run loop on which that client
+   can be notified.  You may schedule multiple run loops (for instance, if you are 
+   using a thread pool).  The client callback will be triggered via one of the scheduled
+   run loops; It is the caller's responsibility to ensure that at least one of the 
+   scheduled run loops is being run.
+
+   NOTE: not all streams provide these notifications.  If a stream does not support
+   asynchronous notification, CFStreamSetClient() will return NO; typically, such
+   streams will never block for device I/O (e.g. a stream on memory)
+}
+
+function CFReadStreamSetClient( stream: CFReadStreamRef; streamEvents: CFOptionFlags; clientCB: CFReadStreamClientCallBack; var clientContext: CFStreamClientContext ): Boolean; external name '_CFReadStreamSetClient';
+function CFWriteStreamSetClient( stream: CFWriteStreamRef; streamEvents: CFOptionFlags; clientCB: CFWriteStreamClientCallBack; var clientContext: CFStreamClientContext ): Boolean; external name '_CFWriteStreamSetClient';
+
+procedure CFReadStreamScheduleWithRunLoop( stream: CFReadStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFReadStreamScheduleWithRunLoop';
+procedure CFWriteStreamScheduleWithRunLoop( stream: CFWriteStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFWriteStreamScheduleWithRunLoop';
+
+procedure CFReadStreamUnscheduleFromRunLoop( stream: CFReadStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFReadStreamUnscheduleFromRunLoop';
+procedure CFWriteStreamUnscheduleFromRunLoop( stream: CFWriteStreamRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef ); external name '_CFWriteStreamUnscheduleFromRunLoop';
+
+
+end.

+ 822 - 0
packages/extra/univint/CFString.pas

@@ -0,0 +1,822 @@
+{	CFString.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFString;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFData,CFDictionary,CFCharacterSet,CFLocale;
+{$ALIGN POWER}
+
+
+{
+Please note: CFStrings are conceptually an array of Unicode characters.
+However, in general, how a CFString stores this array is an implementation
+detail. For instance, CFString might choose to use an array of 8-bit characters;
+to store its contents; or it might use multiple blocks of memory; or whatever.
+Furthermore, the implementation might change depending on the default
+system encoding, the user's language, the OS, or even a given release.
+
+What this means is that you should use the following advanced functions with care:
+
+  CFStringGetPascalStringPtr()
+  CFStringGetCStringPtr()
+  CFStringGetCharactersPtr()
+
+These functions are provided for optimization only. They will either return the desired
+pointer quickly, in constant time, or they return NULL. They might choose to return NULL
+for many reasons; for instance it's possible that for users running in different
+languages these sometimes return NULL; or in a future OS release the first two might
+switch to always returning NULL. Never observing NULL returns in your usages of these
+functions does not mean they won't ever return NULL. (But note the CFStringGetCharactersPtr()
+exception mentioned further below.)
+
+In your usages of these functions, if you get a NULL return, use the non-Ptr version
+of the functions as shown in this example:
+
+  Str255 buffer;
+  StringPtr ptr = CFStringGetPascalStringPtr(str, encoding);
+  if (ptr == NULL) (
+      if (CFStringGetPascalString(str, buffer, 256, encoding)) ptr = buffer;
+  )
+
+Note that CFStringGetPascalString() or CFStringGetCString() calls might still fail --- but
+that will happen in two circumstances only: The conversion from the UniChar contents of CFString
+to the specified encoding fails, or the buffer is too small. If they fail, that means
+the conversion was not possible.
+
+If you need a copy of the buffer in the above example, you might consider simply
+calling CFStringGetPascalString() in all cases --- CFStringGetPascalStringPtr()
+is simply an optimization.
+
+In addition, the following functions, which create immutable CFStrings from developer
+supplied buffers without copying the buffers, might have to actually copy
+under certain circumstances (If they do copy, the buffer will be dealt with by the
+"contentsDeallocator" argument.):
+
+  CFStringCreateWithPascalStringNoCopy()
+  CFStringCreateWithCStringNoCopy()
+  CFStringCreateWithCharactersNoCopy()
+
+You should of course never depend on the backing store of these CFStrings being
+what you provided, and in other no circumstance should you change the contents
+of that buffer (given that would break the invariant about the CFString being immutable).
+
+Having said all this, there are actually ways to create a CFString where the backing store
+is external, and can be manipulated by the developer or CFString itself:
+
+  CFStringCreateMutableWithExternalCharactersNoCopy()
+  CFStringSetExternalCharactersNoCopy()
+
+A "contentsAllocator" is used to realloc or free the backing store by CFString.
+kCFAllocatorNull can be provided to assure CFString will never realloc or free the buffer.
+Developer can call CFStringSetExternalCharactersNoCopy() to update
+CFString's idea of what's going on, if the buffer is changed externally. In these
+strings, CFStringGetCharactersPtr() is guaranteed to return the external buffer.
+
+These functions are here to allow wrapping a buffer of UniChar characters in a CFString,
+allowing the buffer to passed into CFString functions and also manipulated via CFString
+mutation functions. In general, developers should not use this technique for all strings,
+as it prevents CFString from using certain optimizations.
+}
+
+{ Identifier for character encoding; the values are the same as Text Encoding Converter TextEncoding.
+}
+type
+	CFStringEncoding = UInt32;
+	CFStringEncodingPtr = ^CFStringEncoding;
+
+{ Platform-independent built-in encodings; always available on all platforms.
+   Call CFStringGetSystemEncoding() to get the default system encoding.
+}
+type
+	CFStringBuiltInEncodings = SInt32;
+const
+	kCFStringEncodingInvalidId = $FFFFFFFF;
+	kCFStringEncodingMacRoman = 0;
+	kCFStringEncodingWindowsLatin1 = $0500; {  ANSI codepage 1252  }
+	kCFStringEncodingISOLatin1 = $0201; {  ISO 8859-1  }
+	kCFStringEncodingNextStepLatin = $0B01; {  NextStep encoding }
+	kCFStringEncodingASCII = $0600; {  0..127 (in creating CFString, values greater than 0x7F are treated as corresponding Unicode value)  }
+	kCFStringEncodingUnicode = $0100; {  kTextEncodingUnicodeDefault  + kTextEncodingDefaultFormat (aka kUnicode16BitFormat)  }
+	kCFStringEncodingUTF8 = $08000100; {  kTextEncodingUnicodeDefault + kUnicodeUTF8Format  }
+	kCFStringEncodingNonLossyASCII = $0BFF; {  7bit Unicode variants used by YellowBox & Java  }
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+	kCFStringEncodingUTF16 = $0100; { kTextEncodingUnicodeDefault + kUnicodeUTF16Format (alias of kCFStringEncodingUnicode) }
+	kCFStringEncodingUTF16BE = $10000100; { kTextEncodingUnicodeDefault + kUnicodeUTF16BEFormat }
+	kCFStringEncodingUTF16LE = $14000100; { kTextEncodingUnicodeDefault + kUnicodeUTF16LEFormat }
+
+	kCFStringEncodingUTF32 = $0C000100; { kTextEncodingUnicodeDefault + kUnicodeUTF32Format }
+	kCFStringEncodingUTF32BE = $18000100; { kTextEncodingUnicodeDefault + kUnicodeUTF32BEFormat }
+	kCFStringEncodingUTF32LE = $1C000100; { kTextEncodingUnicodeDefault + kUnicodeUTF32LEFormat }
+{#endif} { MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+
+{ CFString type ID }
+function CFStringGetTypeID: CFTypeID; external name '_CFStringGetTypeID';
+
+{ Macro to allow creation of compile-time constant strings; the argument should be a constant string.
+
+CFSTR(), not being a "Copy" or "Create" function, does not return a new
+reference for you. So, you should not release the return value. This is
+much like constant C or Pascal strings --- when you use "hello world"
+in a program, you do not free it.
+
+However, strings returned from CFSTR() can be retained and released in a
+properly nested fashion, just like any other CF type. That is, if you pass
+a CFSTR() return value to a function such as SetMenuItemWithCFString(), the
+function can retain it, then later, when it's done with it, it can release it.
+
+At this point non-7 bit characters (that is, characters > 127) in CFSTR() are not 
+supported and using them will lead to unpredictable results. This includes escaped
+(\nnn) characters whose values are > 127. Even if it works for you in testing, 
+it might not work for a user with a different language preference.
+}
+{
+	*** Pascal Usage of CFSTR et al ***
+	
+	For Pascal:
+	
+		To define your own constant CFStrings, call call CFSTRP with a 
+		constant Pascal single-quoted string only, for example 
+		CFSTRP('a constant string').
+
+	For MetroWerks Pascal:
+	
+		Include the CFStringGlue file in your project (it defines the private function,
+		CFSTRP0, which you should never call directly.
+		
+		In your uses clause, use CFString and CFStringGlue and whichever PInterface files
+		defining the constant CFStrings (or define your own using CFSTRP('pascal string')).
+	
+	For GNU Pascal:
+	
+		Include the GPCMacros.inc file (for example $I GPCMacros.inc).
+		
+		In your uses clause, use CFString (and, optionally, CFStringGlue and the 
+		PInterface files defining the constant CFStrings).
+		
+		You can optionally use CFSTR with a constant double-quoted C String (for example,
+		CFSTR("a constant C string")) although it will make no difference, but will
+		result in closer  C source code similarity.
+	
+	For maximum compatibility in both GPC and MetroWerks Pascal
+	
+		Include the GPCMacros.inc file in GPC as part of your GPC prefix.
+		
+		Include the CFStringGlue file in your MW project.
+		
+		Only ever use CFSTRP with a constant Pascal string.
+		
+		In your uses clause for a unit, use the CFString, CFStringGlue and any 
+		PInterface files defining any constant CFStrings you need.
+}
+
+{
+	CFSTR Must only be called with a constant CString
+}
+function CFSTR( c: PChar ): CFStringRef; external name '___CFStringMakeConstantString';
+{
+	CFSTRP Must only be called with a constant Pascal String
+}
+function CFSTRP( c: PChar ): CFStringRef; external name '___CFStringMakeConstantString';
+
+{
+	CFSTRP0 Must only be called with a constant Pascal String terminated with a chr(0)
+}
+function CFSTRP0( c: PChar ): CFStringRef; external name '___CFStringMakeConstantString';
+
+{** Immutable string creation functions **}
+
+{ Functions to create basic immutable strings. The provided allocator is used for all memory activity in these functions.
+}
+
+{ These functions copy the provided buffer into CFString's internal storage. }
+function CFStringCreateWithPascalString( alloc: CFAllocatorRef; const (*var*) pStr: Str255; encoding: CFStringEncoding ): CFStringRef; external name '_CFStringCreateWithPascalString';
+
+function CFStringCreateWithCString( alloc: CFAllocatorRef; cStr: ConstCStringPtr; encoding: CFStringEncoding ): CFStringRef; external name '_CFStringCreateWithCString';
+
+function CFStringCreateWithCharacters( alloc: CFAllocatorRef; chars: UniCharPtr; numChars: CFIndex ): CFStringRef; external name '_CFStringCreateWithCharacters';
+
+{ These functions try not to copy the provided buffer. The buffer will be deallocated 
+with the provided contentsDeallocator when it's no longer needed; to not free
+the buffer, specify kCFAllocatorNull here. As usual, NULL means default allocator.
+
+NOTE: Do not count on these buffers as being used by the string; 
+in some cases the CFString might free the buffer and use something else
+(for instance if it decides to always use Unicode encoding internally). 
+
+NOTE: If you are not transferring ownership of the buffer to the CFString
+(for instance, you supplied contentsDeallocator = kCFAllocatorNull), it is your
+responsibility to assure the buffer does not go away during the lifetime of the string.
+If the string is retained or copied, its lifetime might extend in ways you cannot
+predict. So, for strings created with buffers whose lifetimes you cannot
+guarantee, you need to be extremely careful --- do not hand it out to any
+APIs which might retain or copy the strings.
+}
+function CFStringCreateWithPascalStringNoCopy( alloc: CFAllocatorRef; const (*var*) pStr: Str255; encoding: CFStringEncoding; contentsDeallocator: CFAllocatorRef ): CFStringRef; external name '_CFStringCreateWithPascalStringNoCopy';
+
+function CFStringCreateWithCStringNoCopy( alloc: CFAllocatorRef; cStr: ConstCStringPtr; encoding: CFStringEncoding; contentsDeallocator: CFAllocatorRef ): CFStringRef; external name '_CFStringCreateWithCStringNoCopy';
+
+function CFStringCreateWithCharactersNoCopy( alloc: CFAllocatorRef; chars: UniCharPtr; numChars: CFIndex; contentsDeallocator: CFAllocatorRef ): CFStringRef; external name '_CFStringCreateWithCharactersNoCopy';
+
+{ Create copies of part or all of the string.
+}
+function CFStringCreateWithSubstring( alloc: CFAllocatorRef; str: CFStringRef; range: CFRange ): CFStringRef; external name '_CFStringCreateWithSubstring';
+
+function CFStringCreateCopy( alloc: CFAllocatorRef; theString: CFStringRef ): CFStringRef; external name '_CFStringCreateCopy';
+
+{ These functions create a CFString from the provided printf-like format string and arguments.
+}
+function CFStringCreateWithFormat( alloc: CFAllocatorRef; formatOptions: CFDictionaryRef; format: CFStringRef; ... ): CFStringRef; external name '_CFStringCreateWithFormat';
+
+function CFStringCreateWithFormatAndArguments( alloc: CFAllocatorRef; formatOptions: CFDictionaryRef; format: CFStringRef; arguments: UnivPtr ): CFStringRef; external name '_CFStringCreateWithFormatAndArguments';
+
+{ Functions to create mutable strings. "maxLength", if not 0, is a hard bound on the length of the string. If 0, there is no limit on the length.
+}
+function CFStringCreateMutable( alloc: CFAllocatorRef; maxLength: CFIndex ): CFMutableStringRef; external name '_CFStringCreateMutable';
+
+function CFStringCreateMutableCopy( alloc: CFAllocatorRef; maxLength: CFIndex; theString: CFStringRef ): CFMutableStringRef; external name '_CFStringCreateMutableCopy';
+
+{ This function creates a mutable string that has a developer supplied and directly editable backing store.
+The string will be manipulated within the provided buffer (if any) until it outgrows capacity; then the
+externalCharactersAllocator will be consulted for more memory. When the CFString is deallocated, the
+buffer will be freed with the externalCharactersAllocator. Provide kCFAllocatorNull here to prevent the buffer
+from ever being reallocated or deallocated by CFString. See comments at top of this file for more info.
+}
+function CFStringCreateMutableWithExternalCharactersNoCopy( alloc: CFAllocatorRef; chars: UniCharPtr; numChars: CFIndex; capacity: CFIndex; externalCharactersAllocator: CFAllocatorRef ): CFMutableStringRef; external name '_CFStringCreateMutableWithExternalCharactersNoCopy';
+
+{** Basic accessors for the contents **}
+
+{ Number of 16-bit Unicode characters in the string.
+}
+function CFStringGetLength( theString: CFStringRef ): CFIndex; external name '_CFStringGetLength';
+
+{ Extracting the contents of the string. For obtaining multiple characters, calling
+CFStringGetCharacters() is more efficient than multiple calls to CFStringGetCharacterAtIndex().
+If the length of the string is not known (so you can't use a fixed size buffer for CFStringGetCharacters()),
+another method is to use is CFStringGetCharacterFromInlineBuffer() (see further below).
+}
+function CFStringGetCharacterAtIndex( theString: CFStringRef; idx: CFIndex ): UniChar; external name '_CFStringGetCharacterAtIndex';
+
+procedure CFStringGetCharacters( theString: CFStringRef; range: CFRange; buffer: UniCharPtr ); external name '_CFStringGetCharacters';
+
+
+{** Conversion to other encodings **}
+
+{ These two convert into the provided buffer; they return false if conversion isn't possible
+(due to conversion error, or not enough space in the provided buffer). 
+These functions do zero-terminate or put the length byte; the provided bufferSize should include
+space for this (so pass 256 for Str255). More sophisticated usages can go through CFStringGetBytes().
+These functions are equivalent to calling CFStringGetBytes() with 
+the range of the string; lossByte = 0; and isExternalRepresentation = false; 
+if successful, they then insert the leading length of terminating zero, as desired.
+}
+function CFStringGetPascalString( theString: CFStringRef; buffer: StringPtr; bufferSize: CFIndex; encoding: CFStringEncoding ): Boolean; external name '_CFStringGetPascalString';
+
+function CFStringGetCString( theString: CFStringRef; buffer: CStringPtr; bufferSize: CFIndex; encoding: CFStringEncoding ): Boolean; external name '_CFStringGetCString';
+
+{ These functions attempt to return in O(1) time the desired format for the string.
+Note that although this means a pointer to the internal structure is being returned,
+this can't always be counted on. Please see note at the top of the file for more
+details.
+}
+function CFStringGetPascalStringPtr( theString: CFStringRef; encoding: CFStringEncoding ): ConstStringPtr; external name '_CFStringGetPascalStringPtr'; { May return NULL at any time; be prepared for NULL }
+
+function CFStringGetCStringPtr( theString: CFStringRef; encoding: CFStringEncoding ): ConstCStringPtr; external name '_CFStringGetCStringPtr'; { May return NULL at any time; be prepared for NULL }
+
+function CFStringGetCharactersPtr( theString: CFStringRef ): UniCharPtr; external name '_CFStringGetCharactersPtr'; { May return NULL at any time; be prepared for NULL }
+
+{ The primitive conversion routine; allows you to convert a string piece at a time
+   into a fixed size buffer. Returns number of characters converted. 
+   Characters that cannot be converted to the specified encoding are represented
+   with the byte specified by lossByte; if lossByte is 0, then lossy conversion
+   is not allowed and conversion stops, returning partial results.
+   Pass buffer==NULL if you don't care about the converted string (but just the convertability,
+   or number of bytes required). 
+   maxBufLength indicates the maximum number of bytes to generate. It is ignored when buffer==NULL.
+   Does not zero-terminate. If you want to create Pascal or C string, allow one extra byte at start or end. 
+   Setting isExternalRepresentation causes any extra bytes that would allow 
+   the data to be made persistent to be included; for instance, the Unicode BOM.
+}
+function CFStringGetBytes( theString: CFStringRef; range: CFRange; encoding: CFStringEncoding; lossByte: ByteParameter; isExternalRepresentation: Boolean; buffer: UInt8Ptr; maxBufLen: CFIndex; var usedBufLen: CFIndex ): CFIndex; external name '_CFStringGetBytes';
+
+{ This one goes the other way by creating a CFString from a bag of bytes.
+This is much like CFStringCreateWithPascalString or CFStringCreateWithCString,
+except the length is supplied explicitly. In addition, you can specify whether
+the data is an external format --- that is, whether to pay attention to the
+BOM character (if any) and do byte swapping if necessary
+}
+function CFStringCreateWithBytes( alloc: CFAllocatorRef; bytes: UnivPtr; numBytes: CFIndex; encoding: CFStringEncoding; isExternalRepresentation: Boolean ): CFStringRef; external name '_CFStringCreateWithBytes';
+
+{ Convenience functions String <-> Data. These generate "external" formats, that is, formats that
+   can be written out to disk. For instance, if the encoding is Unicode, CFStringCreateFromExternalRepresentation()
+   pays attention to the BOM character (if any) and does byte swapping if necessary.
+   Similarly CFStringCreateExternalRepresentation() will always include a BOM character if the encoding is
+   Unicode. See above for description of lossByte.
+}
+function CFStringCreateFromExternalRepresentation( alloc: CFAllocatorRef; data: CFDataRef; encoding: CFStringEncoding ): CFStringRef; external name '_CFStringCreateFromExternalRepresentation'; { May return NULL on conversion error }
+
+function CFStringCreateExternalRepresentation( alloc: CFAllocatorRef; theString: CFStringRef; encoding: CFStringEncoding; lossByte: ByteParameter ): CFDataRef; external name '_CFStringCreateExternalRepresentation'; { May return NULL on conversion error }
+
+{ Hints about the contents of a string
+}
+function CFStringGetSmallestEncoding( theString: CFStringRef ): CFStringEncoding; external name '_CFStringGetSmallestEncoding'; { Result in O(n) time max }
+
+function CFStringGetFastestEncoding( theString: CFStringRef ): CFStringEncoding; external name '_CFStringGetFastestEncoding'; { Result in O(1) time max }
+
+{ General encoding info
+}
+function CFStringGetSystemEncoding: CFStringEncoding; external name '_CFStringGetSystemEncoding'; { The default encoding for the system; untagged 8-bit characters are usually in this encoding }
+
+function CFStringGetMaximumSizeForEncoding( length: CFIndex; encoding: CFStringEncoding ): CFIndex; external name '_CFStringGetMaximumSizeForEncoding'; { Max bytes a string of specified length (in UniChars) will take up if encoded }
+
+
+{** FileSystem path conversion functions **}
+
+{ Extract the contents of the string as a NULL-terminated 8-bit string appropriate for passing to POSIX APIs.  The string is zero-terminated. false will be returned if the conversion results don't fit into the buffer.  Use CFStringGetMaximumSizeOfFileSystemRepresentation() if you want to make sure the buffer is of sufficient length.
+}
+function CFStringGetFileSystemRepresentation( strng: CFStringRef; buffer: CStringPtr; maxBufLen: CFIndex ): Boolean; external name '_CFStringGetFileSystemRepresentation';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Get the upper bound on the number of bytes required to hold the file system representation for the string. This result is returned quickly as a very rough approximation, and could be much larger than the actual space required. The result includes space for the zero termination. If you are allocating a buffer for long-term keeping, it's recommended that you reallocate it smaller (to be the right size) after calling CFStringGetFileSystemRepresentation(). 
+}
+function CFStringGetMaximumSizeOfFileSystemRepresentation( strng: CFStringRef ): CFIndex; external name '_CFStringGetMaximumSizeOfFileSystemRepresentation';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Create a CFString from the specified zero-terminated POSIX file system representation.  If the conversion fails (possible due to bytes in the buffer not being a valid sequence of bytes for the appropriate character encoding), NULL is returned.
+}
+function CFStringCreateWithFileSystemRepresentation( alloc: CFAllocatorRef; buffer: ConstCStringPtr ): CFStringRef; external name '_CFStringCreateWithFileSystemRepresentation';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+{** Comparison functions. **}
+
+{ Find and compare flags; these are OR'ed together as compareOptions or searchOptions in the various functions. 
+   This typedef doesn't appear in the functions; instead the argument is CFOptionFlags. 
+}
+type
+	CFStringCompareFlags = SInt32;
+const
+																{  Flags used in all find and compare operations  }
+	kCFCompareCaseInsensitive = 1;
+	kCFCompareBackwards = 4;							{  Starting from the end of the string  }
+	kCFCompareAnchored = 8;							{  Only at the specified starting point  }
+	kCFCompareNonliteral = 16;							{  If specified, loose equivalence is performed (o-umlaut == o, umlaut)  }
+	kCFCompareLocalized = 32;							{  User's default locale is used for the comparisons  }
+	kCFCompareNumerically = 64;							{  Numeric comparison is used; that is, Foo2.txt < Foo7.txt < Foo25.txt  }
+
+{ The main comparison routine; compares specified range of the first string to (the full range of) the second string.
+   locale == NULL indicates canonical locale.
+   kCFCompareNumerically, added in 10.2, does not work if kCFCompareLocalized is specified on systems before 10.3
+   kCFCompareBackwards and kCFCompareAnchored are not applicable.
+}
+function CFStringCompareWithOptions( theString1: CFStringRef; theString2: CFStringRef; rangeToCompare: CFRange; compareOptions: CFOptionFlags ): CFComparisonResult; external name '_CFStringCompareWithOptions';
+
+{ Comparison convenience suitable for passing as sorting functions.
+   kCFCompareNumerically, added in 10.2, does not work if kCFCompareLocalized is specified on systems before 10.3
+   kCFCompareBackwards and kCFCompareAnchored are not applicable.
+}
+function CFStringCompare( theString1: CFStringRef; theString2: CFStringRef; compareOptions: CFOptionFlags ): CFComparisonResult; external name '_CFStringCompare';
+
+{ CFStringFindWithOptions() returns the found range in the CFRange * argument; you can pass NULL for simple discovery check.
+   If stringToFind is the empty string (zero length), nothing is found.
+   Ignores the kCFCompareNumerically option.
+}
+function CFStringFindWithOptions( theString: CFStringRef; stringToFind: CFStringRef; rangeToSearch: CFRange; searchOptions: CFOptionFlags; var result: CFRange ): Boolean; external name '_CFStringFindWithOptions';
+
+{ CFStringCreateArrayWithFindResults() returns an array of CFRange pointers, or NULL if there are no matches.
+   Overlapping instances are not found; so looking for "AA" in "AAA" finds just one range.
+   Post 10.1: If kCFCompareBackwards is provided, the scan is done from the end (which can give a different result), and
+      the results are stored in the array backwards (last found range in slot 0).
+   If stringToFind is the empty string (zero length), nothing is found.
+   kCFCompareAnchored causes just the consecutive instances at start (or end, if kCFCompareBackwards) to be reported. So, searching for "AB" in "ABABXAB..." you just get the first two occurrences.
+   Ignores the kCFCompareNumerically option.
+}
+function CFStringCreateArrayWithFindResults( alloc: CFAllocatorRef; theString: CFStringRef; stringToFind: CFStringRef; rangeToSearch: CFRange; compareOptions: CFOptionFlags ): CFArrayRef; external name '_CFStringCreateArrayWithFindResults';
+
+{ Find conveniences; see comments above concerning empty string and options.
+}
+function CFStringFind( theString: CFStringRef; stringToFind: CFStringRef; compareOptions: CFOptionFlags ): CFRange; external name '_CFStringFind';
+
+function CFStringHasPrefix( theString: CFStringRef; prefix: CFStringRef ): Boolean; external name '_CFStringHasPrefix';
+
+function CFStringHasSuffix( theString: CFStringRef; suffix: CFStringRef ): Boolean; external name '_CFStringHasSuffix';
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{!
+	@function CFStringGetRangeOfComposedCharactersAtIndex
+	Returns the range of the composed character sequence at the specified index.
+	@param theString The CFString which is to be searched.  If this
+                		parameter is not a valid CFString, the behavior is
+              		undefined.
+	@param theIndex The index of the character contained in the
+			composed character sequence.  If the index is
+			outside the index space of the string (0 to N-1 inclusive,
+			where N is the length of the string), the behavior is
+			undefined.
+	@result The range of the composed character sequence.
+}
+function CFStringGetRangeOfComposedCharactersAtIndex( theString: CFStringRef; theIndex: CFIndex ): CFRange; external name '_CFStringGetRangeOfComposedCharactersAtIndex';
+
+{!
+	@function CFStringFindCharacterFromSet
+	Query the range of the first character contained in the specified character set.
+	@param theString The CFString which is to be searched.  If this
+                		parameter is not a valid CFString, the behavior is
+              		undefined.
+	@param theSet The CFCharacterSet against which the membership
+			of characters is checked.  If this parameter is not a valid
+			CFCharacterSet, the behavior is undefined.
+	@param range The range of characters within the string to search. If
+			the range location or end point (defined by the location
+			plus length minus 1) are outside the index space of the
+			string (0 to N-1 inclusive, where N is the length of the
+			string), the behavior is undefined. If the range length is
+			negative, the behavior is undefined. The range may be empty
+			(length 0), in which case no search is performed.
+	@param searchOptions The bitwise-or'ed option flags to control
+			the search behavior.  The supported options are
+			kCFCompareBackwards andkCFCompareAnchored.
+			If other option flags are specified, the behavior
+                        is undefined.
+	@param result The pointer to a CFRange supplied by the caller in
+			which the search result is stored.  Note that the length
+                        of this range could be more than If a pointer to an invalid
+			memory is specified, the behavior is undefined.
+	@result true, if at least a character which is a member of the character
+			set is found and result is filled, otherwise, false.
+}
+function CFStringFindCharacterFromSet( theString: CFStringRef; theSet: CFCharacterSetRef; rangeToSearch: CFRange; searchOptions: CFOptionFlags; var result: CFRange ): Boolean; external name '_CFStringFindCharacterFromSet';
+{#endif}
+
+{ Find range of bounds of the line(s) that span the indicated range (startIndex, numChars),
+   taking into account various possible line separator sequences (CR, CRLF, LF, and Unicode LS, PS).
+   All return values are "optional" (provide NULL if you don't want them)
+     lineStartIndex: index of first character in line
+     lineEndIndex: index of first character of the next line (including terminating line separator characters)
+     contentsEndIndex: index of the first line separator character
+   Thus, lineEndIndex - lineStartIndex is the number of chars in the line, including the line separators
+         contentsEndIndex - lineStartIndex is the number of chars in the line w/out the line separators
+}
+procedure CFStringGetLineBounds( theString: CFStringRef; range: CFRange; var lineBeginIndex: CFIndex; var lineEndIndex: CFIndex; var contentsEndIndex: CFIndex ); external name '_CFStringGetLineBounds';
+
+
+{** Exploding and joining strings with a separator string **}
+
+function CFStringCreateByCombiningStrings( alloc: CFAllocatorRef; theArray: CFArrayRef; separatorString: CFStringRef ): CFStringRef; external name '_CFStringCreateByCombiningStrings'; { Empty array returns empty string; one element array returns the element }
+
+function CFStringCreateArrayBySeparatingStrings( alloc: CFAllocatorRef; theString: CFStringRef; separatorString: CFStringRef ): CFArrayRef; external name '_CFStringCreateArrayBySeparatingStrings'; { No separators in the string returns array with that string; string == sep returns two empty strings }
+
+
+{** Parsing non-localized numbers from strings **}
+
+function CFStringGetIntValue( str: CFStringRef ): SInt32; external name '_CFStringGetIntValue'; { Skips whitespace; returns 0 on error, MAX or -MAX on overflow }
+
+function CFStringGetDoubleValue( str: CFStringRef ): Float64; external name '_CFStringGetDoubleValue'; { Skips whitespace; returns 0.0 on error }
+
+
+{** MutableString functions **}
+
+{ CFStringAppend("abcdef", "xxxxx") -> "abcdefxxxxx"
+   CFStringDelete("abcdef", CFRangeMake(2, 3)) -> "abf"
+   CFStringReplace("abcdef", CFRangeMake(2, 3), "xxxxx") -> "abxxxxxf"
+   CFStringReplaceAll("abcdef", "xxxxx") -> "xxxxx"
+}
+procedure CFStringAppend( theString: CFMutableStringRef; appendedString: CFStringRef ); external name '_CFStringAppend';
+
+procedure CFStringAppendCharacters( theString: CFMutableStringRef; chars: UniCharPtr; numChars: CFIndex ); external name '_CFStringAppendCharacters';
+
+procedure CFStringAppendPascalString( theString: CFMutableStringRef; const (*var*) pStr: Str255; encoding: CFStringEncoding ); external name '_CFStringAppendPascalString';
+
+procedure CFStringAppendCString( theString: CFMutableStringRef; cStr: ConstCStringPtr; encoding: CFStringEncoding ); external name '_CFStringAppendCString';
+
+procedure CFStringAppendFormat( theString: CFMutableStringRef; formatOptions: CFDictionaryRef; format: CFStringRef; ... ); external name '_CFStringAppendFormat';
+
+procedure CFStringAppendFormatAndArguments( theString: CFMutableStringRef; formatOptions: CFDictionaryRef; format: CFStringRef; arguments: UnivPtr ); external name '_CFStringAppendFormatAndArguments';
+
+procedure CFStringInsert( str: CFMutableStringRef; idx: CFIndex; insertedStr: CFStringRef ); external name '_CFStringInsert';
+
+procedure CFStringDelete( theString: CFMutableStringRef; range: CFRange ); external name '_CFStringDelete';
+
+procedure CFStringReplace( theString: CFMutableStringRef; range: CFRange; replacement: CFStringRef ); external name '_CFStringReplace';
+
+procedure CFStringReplaceAll( theString: CFMutableStringRef; replacement: CFStringRef ); external name '_CFStringReplaceAll'; { Replaces whole string }
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ Replace all occurrences of target in rangeToSearch of theString with replacement.
+   Pays attention to kCFCompareCaseInsensitive, kCFCompareBackwards, kCFCompareNonliteral, and kCFCompareAnchored.
+   kCFCompareBackwards can be used to do the replacement starting from the end, which could give a different result.
+     ex. AAAAA, replace AA with B -> BBA or ABB; latter if kCFCompareBackwards
+   kCFCompareAnchored assures only anchored but multiple instances are found (the instances must be consecutive at start or end)
+     ex. AAXAA, replace A with B -> BBXBB or BBXAA; latter if kCFCompareAnchored
+   Returns number of replacements performed.
+}
+function CFStringFindAndReplace( theString: CFMutableStringRef; stringToFind: CFStringRef; replacementString: CFStringRef; rangeToSearch: CFRange; compareOptions: CFOptionFlags ): CFIndex; external name '_CFStringFindAndReplace';
+
+{#endif}
+
+{ This function will make the contents of a mutable CFString point directly at the specified UniChar array.
+   It works only with CFStrings created with CFStringCreateMutableWithExternalCharactersNoCopy().
+   This function does not free the previous buffer.
+   The string will be manipulated within the provided buffer (if any) until it outgrows capacity; then the
+     externalCharactersAllocator will be consulted for more memory.
+   See comments at the top of this file for more info.
+}
+procedure CFStringSetExternalCharactersNoCopy( theString: CFMutableStringRef; chars: UniCharPtr; length: CFIndex; capacity: CFIndex ); external name '_CFStringSetExternalCharactersNoCopy'; { Works only on specially created mutable strings! }
+
+{ CFStringPad() will pad or cut down a string to the specified size.
+   The pad string is used as the fill string; indexIntoPad specifies which character to start with.
+     CFStringPad("abc", " ", 9, 0) ->  "abc      "
+     CFStringPad("abc", ". ", 9, 1) -> "abc . . ."
+     CFStringPad("abcdef", ?, 3, ?) -> "abc"
+
+     CFStringTrim() will trim the specified string from both ends of the string.
+     CFStringTrimWhitespace() will do the same with white space characters (tab, newline, etc)
+     CFStringTrim("  abc ", " ") -> "abc"
+     CFStringTrim("* * * *abc * ", "* ") -> "*abc "
+}
+procedure CFStringPad( theString: CFMutableStringRef; padString: CFStringRef; length: CFIndex; indexIntoPad: CFIndex ); external name '_CFStringPad';
+
+procedure CFStringTrim( theString: CFMutableStringRef; trimString: CFStringRef ); external name '_CFStringTrim';
+
+procedure CFStringTrimWhitespace( theString: CFMutableStringRef ); external name '_CFStringTrimWhitespace';
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+procedure CFStringLowercase( theString: CFMutableStringRef; locale: CFLocaleRef ); external name '_CFStringLowercase';
+
+procedure CFStringUppercase( theString: CFMutableStringRef; locale: CFLocaleRef ); external name '_CFStringUppercase';
+
+procedure CFStringCapitalize( theString: CFMutableStringRef; locale: CFLocaleRef ); external name '_CFStringCapitalize';
+{#else}
+//procedure CFStringLowercase( theString: CFMutableStringRef; localeTBD: {const} UnivPtr ); // localeTBD must be NULL on pre-10.3
+
+//procedure CFStringUppercase( theString: CFMutableStringRef; localeTBD: {const} UnivPtr ); // localeTBD must be NULL on pre-10.3
+
+//procedure CFStringCapitalize( theString: CFMutableStringRef; localeTBD: {const} UnivPtr ); // localeTBD must be NULL on pre-10.3
+{#endif}
+
+{#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{!
+	@typedef CFStringNormalizationForm
+	This is the type of Unicode normalization forms as described in
+	Unicode Technical Report #15.
+}
+type
+	CFStringNormalizationForm = SInt32;
+const
+	kCFStringNormalizationFormD = 0; // Canonical Decomposition
+	kCFStringNormalizationFormKD = 1; // Compatibility Decomposition
+	kCFStringNormalizationFormC = 2; // Canonical Decomposition followed by Canonical Composition
+	kCFStringNormalizationFormKC = 3; // Compatibility Decomposition followed by Canonical Composition
+
+{!
+	@function CFStringNormalize
+	Normalizes the string into the specified form as described in
+	Unicode Technical Report #15.
+	@param theString  The string which is to be normalized.  If this
+		parameter is not a valid mutable CFString, the behavior is
+		undefined.
+	@param theForm  The form into which the string is to be normalized.
+		If this parameter is not a valid CFStringNormalizationForm value,
+		the behavior is undefined.
+}
+procedure CFStringNormalize( theString: CFMutableStringRef; theForm: CFStringNormalizationForm ); external name '_CFStringNormalize';
+{#endif}
+
+{ Perform string transliteration.  The transformation represented by transform (see below for the full list of transforms supported) is applied to the given range of string, modifying it in place. Only the specified range will be modified, but the transform may look at portions of the string outside that range for context. NULL range pointer causes the whole string to be transformed. On return, range is modified to reflect the new range corresponding to the original range. reverse indicates that the inverse transform should be used instead, if it exists. If the transform is successful, true is returned; if unsuccessful, false. Reasons for the transform being unsuccessful include an invalid transform identifier, or attempting to reverse an irreversible transform.
+}
+function CFStringTransform( strng: CFMutableStringRef; var range: CFRange; transform: CFStringRef; reverse: Boolean ): Boolean; external name '_CFStringTransform';
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform identifiers for CFStringTransform()
+}
+var kCFStringTransformStripCombiningMarks: CFStringRef; external name '_kCFStringTransformStripCombiningMarks'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformToLatin: CFStringRef; external name '_kCFStringTransformToLatin'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformFullwidthHalfwidth: CFStringRef; external name '_kCFStringTransformFullwidthHalfwidth'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinKatakana: CFStringRef; external name '_kCFStringTransformLatinKatakana'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinHiragana: CFStringRef; external name '_kCFStringTransformLatinHiragana'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformHiraganaKatakana: CFStringRef; external name '_kCFStringTransformHiraganaKatakana'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformMandarinLatin: CFStringRef; external name '_kCFStringTransformMandarinLatin'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinHangul: CFStringRef; external name '_kCFStringTransformLatinHangul'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinArabic: CFStringRef; external name '_kCFStringTransformLatinArabic'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinHebrew: CFStringRef; external name '_kCFStringTransformLatinHebrew'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinThai: CFStringRef; external name '_kCFStringTransformLatinThai'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinCyrillic: CFStringRef; external name '_kCFStringTransformLatinCyrillic'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformLatinGreek: CFStringRef; external name '_kCFStringTransformLatinGreek'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformToXMLHex: CFStringRef; external name '_kCFStringTransformToXMLHex'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+var kCFStringTransformToUnicodeName: CFStringRef; external name '_kCFStringTransformToUnicodeName'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+{** General encoding related functionality **}
+
+{ This returns availability of the encoding on the system
+}
+function CFStringIsEncodingAvailable( encoding: CFStringEncoding ): Boolean; external name '_CFStringIsEncodingAvailable';
+
+{ This function returns list of available encodings.  The returned list is terminated with kCFStringEncodingInvalidId and owned by the system.
+}
+function CFStringGetListOfAvailableEncodings: CFStringEncodingPtr; external name '_CFStringGetListOfAvailableEncodings';
+
+{ Returns name of the encoding; non-localized.
+}
+function CFStringGetNameOfEncoding( encoding: CFStringEncoding ): CFStringRef; external name '_CFStringGetNameOfEncoding';
+
+{ ID mapping functions from/to Cocoa NSStringEncoding.  Returns kCFStringEncodingInvalidId if no mapping exists.
+}
+function CFStringConvertEncodingToNSStringEncoding( encoding: CFStringEncoding ): UInt32; external name '_CFStringConvertEncodingToNSStringEncoding';
+
+function CFStringConvertNSStringEncodingToEncoding( encoding: UInt32 ): CFStringEncoding; external name '_CFStringConvertNSStringEncodingToEncoding';
+
+{ ID mapping functions from/to Microsoft Windows codepage (covers both OEM & ANSI).  Returns kCFStringEncodingInvalidId if no mapping exists.
+}
+function CFStringConvertEncodingToWindowsCodepage( encoding: CFStringEncoding ): UInt32; external name '_CFStringConvertEncodingToWindowsCodepage';
+
+function CFStringConvertWindowsCodepageToEncoding( codepage: UInt32 ): CFStringEncoding; external name '_CFStringConvertWindowsCodepageToEncoding';
+
+{ ID mapping functions from/to IANA registery charset names.  Returns kCFStringEncodingInvalidId if no mapping exists.
+}
+function CFStringConvertIANACharSetNameToEncoding( theString: CFStringRef ): CFStringEncoding; external name '_CFStringConvertIANACharSetNameToEncoding';
+
+function CFStringConvertEncodingToIANACharSetName( encoding: CFStringEncoding ): CFStringRef; external name '_CFStringConvertEncodingToIANACharSetName';
+
+{ Returns the most compatible MacOS script value for the input encoding }
+{ i.e. kCFStringEncodingMacRoman -> kCFStringEncodingMacRoman }
+{	kCFStringEncodingWindowsLatin1 -> kCFStringEncodingMacRoman }
+{	kCFStringEncodingISO_2022_JP -> kCFStringEncodingMacJapanese }
+function CFStringGetMostCompatibleMacStringEncoding( encoding: CFStringEncoding ): CFStringEncoding; external name '_CFStringGetMostCompatibleMacStringEncoding';
+
+
+{ The next two functions allow fast access to the contents of a string, 
+   assuming you are doing sequential or localized accesses. To use, call
+   CFStringInitInlineBuffer() with a CFStringInlineBuffer (on the stack, say),
+   and a range in the string to look at. Then call CFStringGetCharacterFromInlineBuffer()
+   as many times as you want, with a index into that range (relative to the start
+   of that range). These are INLINE functions and will end up calling CFString only 
+   once in a while, to fill a buffer.  CFStringGetCharacterFromInlineBuffer() returns 0 if
+   a location outside the original range is specified.
+}
+const
+	__kCFStringInlineBufferLength = 64;
+type
+	CFStringInlineBuffer = record
+		buffer: array[0..__kCFStringInlineBufferLength-1] of UniChar;
+		theString: CFStringRef;
+		directBuffer: UniCharPtr;
+		rangeToBuffer: CFRange;		{ Range in string to buffer }
+		bufferedRangeStart: CFIndex;		{ Start of range currently buffered (relative to rangeToBuffer.location) }
+		bufferedRangeEnd: CFIndex;		{ bufferedRangeStart + number of chars actually buffered }
+	end;
+
+// Not currently converted to Pascal
+// #if defined(CF_INLINE)
+// CF_INLINE void CFStringInitInlineBuffer(CFStringRef str, CFStringInlineBuffer *buf, CFRange range) {
+//     buf->theString = str;
+//     buf->rangeToBuffer = range;
+//     buf->directBuffer = CFStringGetCharactersPtr(str);
+//     buf->bufferedRangeStart = buf->bufferedRangeEnd = 0;
+// }
+// 
+// CF_INLINE UniChar CFStringGetCharacterFromInlineBuffer(CFStringInlineBuffer *buf, CFIndex idx) {
+//     if (buf->directBuffer) {
+// 	if (idx < 0 || idx >= buf->rangeToBuffer.length) return 0;
+//         return buf->directBuffer[idx + buf->rangeToBuffer.location];
+//     }
+//     if (idx >= buf->bufferedRangeEnd || idx < buf->bufferedRangeStart) {
+// 	if (idx < 0 || idx >= buf->rangeToBuffer.length) return 0;
+// 	if ((buf->bufferedRangeStart = idx - 4) < 0) buf->bufferedRangeStart = 0;
+// 	buf->bufferedRangeEnd = buf->bufferedRangeStart + __kCFStringInlineBufferLength;
+// 	if (buf->bufferedRangeEnd > buf->rangeToBuffer.length) buf->bufferedRangeEnd = buf->rangeToBuffer.length;
+// 	CFStringGetCharacters(buf->theString, CFRangeMake(buf->rangeToBuffer.location + buf->bufferedRangeStart, buf->bufferedRangeEnd - buf->bufferedRangeStart), buf->buffer);
+//     }
+//     return buf->buffer[idx - buf->bufferedRangeStart];
+// }
+// 
+// #else
+// { If INLINE functions are not available, we do somewhat less powerful macros that work similarly (except be aware that the buf argument is evaluated multiple times).
+// }
+// #define CFStringInitInlineBuffer(str, buf, range) \
+//     do {(buf)->theString = str; (buf)->rangeToBuffer = range; (buf)->directBuffer = CFStringGetCharactersPtr(str);} while (0)
+// 
+// #define CFStringGetCharacterFromInlineBuffer(buf, idx) \
+//     (((idx) < 0 || (idx) >= (buf)->rangeToBuffer.length) ? 0 : ((buf)->directBuffer ? (buf)->directBuffer[(idx) + (buf)->rangeToBuffer.location] : CFStringGetCharacterAtIndex((buf)->theString, (idx) + (buf)->rangeToBuffer.location)))
+// 
+// #endif { CF_INLINE }
+
+{ Rest of the stuff in this file is private and should not be used directly
+}
+{ For debugging only
+   Use CFShow() to printf the description of any CFType;
+   Use CFShowStr() to printf detailed info about a CFString
+}
+procedure CFShow( obj: CFTypeRef ); external name '_CFShow';
+
+procedure CFShowStr( str: CFStringRef ); external name '_CFShowStr';
+
+{ This function is private and should not be used directly }
+function __CFStringMakeConstantString( cStr: ConstCStringPtr ): CFStringRef; external name '___CFStringMakeConstantString';	{ Private; do not use }
+
+
+implementation
+
+
+end.

+ 265 - 0
packages/extra/univint/CFStringEncodingExt.pas

@@ -0,0 +1,265 @@
+{	CFStringEncodingExt.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFStringEncodingExt;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+
+type
+	CFStringEncodings = SInt32;
+const
+{   kCFStringEncodingMacRoman = 0L, defined in CoreFoundation/CFString.h  }
+	kCFStringEncodingMacJapanese = 1;
+	kCFStringEncodingMacChineseTrad = 2;
+	kCFStringEncodingMacKorean = 3;
+	kCFStringEncodingMacArabic = 4;
+	kCFStringEncodingMacHebrew = 5;
+	kCFStringEncodingMacGreek = 6;
+	kCFStringEncodingMacCyrillic = 7;
+	kCFStringEncodingMacDevanagari = 9;
+	kCFStringEncodingMacGurmukhi = 10;
+	kCFStringEncodingMacGujarati = 11;
+	kCFStringEncodingMacOriya = 12;
+	kCFStringEncodingMacBengali = 13;
+	kCFStringEncodingMacTamil = 14;
+	kCFStringEncodingMacTelugu = 15;
+	kCFStringEncodingMacKannada = 16;
+	kCFStringEncodingMacMalayalam = 17;
+	kCFStringEncodingMacSinhalese = 18;
+	kCFStringEncodingMacBurmese = 19;
+	kCFStringEncodingMacKhmer = 20;
+	kCFStringEncodingMacThai = 21;
+	kCFStringEncodingMacLaotian = 22;
+	kCFStringEncodingMacGeorgian = 23;
+	kCFStringEncodingMacArmenian = 24;
+	kCFStringEncodingMacChineseSimp = 25;
+	kCFStringEncodingMacTibetan = 26;
+	kCFStringEncodingMacMongolian = 27;
+	kCFStringEncodingMacEthiopic = 28;
+	kCFStringEncodingMacCentralEurRoman = 29;
+	kCFStringEncodingMacVietnamese = 30;
+	kCFStringEncodingMacExtArabic = 31;
+	{  The following use script code 0, smRoman  }
+	kCFStringEncodingMacSymbol = 33;
+	kCFStringEncodingMacDingbats = 34;
+	kCFStringEncodingMacTurkish = 35;
+	kCFStringEncodingMacCroatian = 36;
+	kCFStringEncodingMacIcelandic = 37;
+	kCFStringEncodingMacRomanian = 38;
+	kCFStringEncodingMacCeltic = 39;
+	kCFStringEncodingMacGaelic = 40;
+	{  The following use script code 4, smArabic  }
+	kCFStringEncodingMacFarsi = $8C; {  Like MacArabic but uses Farsi digits  }
+	{  The following use script code 7, smCyrillic  }
+	kCFStringEncodingMacUkrainian = $98;
+	{  The following use script code 32, smUnimplemented  }
+	kCFStringEncodingMacInuit = $EC;
+	kCFStringEncodingMacVT100 = $FC; {  VT100/102 font from Comm Toolbox: Latin-1 repertoire + box drawing etc  }
+	{  Special Mac OS encodings }
+	kCFStringEncodingMacHFS = $FF; {  Meta-value, should never appear in a table  }
+	
+	{  Unicode & ISO UCS encodings begin at 0x100  }
+	{  We don't use Unicode variations defined in TextEncoding; use the ones in CFString.h, instead.  }
+	
+	{  ISO 8-bit and 7-bit encodings begin at 0x200  }
+	{   kCFStringEncodingISOLatin1 = 0x0201, defined in CoreFoundation/CFString.h  }
+	kCFStringEncodingISOLatin2 = $0202;						{  ISO 8859-2  }
+	kCFStringEncodingISOLatin3 = $0203;						{  ISO 8859-3  }
+	kCFStringEncodingISOLatin4 = $0204;						{  ISO 8859-4  }
+	kCFStringEncodingISOLatinCyrillic = $0205;					{  ISO 8859-5  }
+	kCFStringEncodingISOLatinArabic = $0206;					{  ISO 8859-6, =ASMO 708, =DOS CP 708  }
+	kCFStringEncodingISOLatinGreek = $0207;						{  ISO 8859-7  }
+	kCFStringEncodingISOLatinHebrew = $0208;					{  ISO 8859-8  }
+	kCFStringEncodingISOLatin5 = $0209;						{  ISO 8859-9  }
+	kCFStringEncodingISOLatin6 = $020A;						{  ISO 8859-10  }
+	kCFStringEncodingISOLatinThai = $020B;						{  ISO 8859-11  }
+	kCFStringEncodingISOLatin7 = $020D;						{  ISO 8859-13  }
+	kCFStringEncodingISOLatin8 = $020E;						{  ISO 8859-14  }
+	kCFStringEncodingISOLatin9 = $020F;						{  ISO 8859-15  }
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+    kCFStringEncodingISOLatin10 = $0210;	{ ISO 8859-16 }
+{#endif} { MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+
+	{  MS-DOS & Windows encodings begin at 0x400  }
+	kCFStringEncodingDOSLatinUS = $0400;						{  code page 437  }
+	kCFStringEncodingDOSGreek = $0405;						{  code page 737 (formerly code page 437G)  }
+	kCFStringEncodingDOSBalticRim = $0406;						{  code page 775  }
+	kCFStringEncodingDOSLatin1 = $0410;						{  code page 850, "Multilingual"  }
+	kCFStringEncodingDOSGreek1 = $0411;						{  code page 851  }
+	kCFStringEncodingDOSLatin2 = $0412;						{  code page 852, Slavic  }
+	kCFStringEncodingDOSCyrillic = $0413;						{  code page 855, IBM Cyrillic  }
+	kCFStringEncodingDOSTurkish = $0414;						{  code page 857, IBM Turkish  }
+	kCFStringEncodingDOSPortuguese = $0415;						{  code page 860  }
+	kCFStringEncodingDOSIcelandic = $0416;						{  code page 861  }
+	kCFStringEncodingDOSHebrew = $0417;						{  code page 862  }
+	kCFStringEncodingDOSCanadianFrench = $0418;					{  code page 863  }
+	kCFStringEncodingDOSArabic = $0419;						{  code page 864  }
+	kCFStringEncodingDOSNordic = $041A;						{  code page 865  }
+	kCFStringEncodingDOSRussian = $041B;						{  code page 866  }
+	kCFStringEncodingDOSGreek2 = $041C;						{  code page 869, IBM Modern Greek  }
+	kCFStringEncodingDOSThai = $041D;						{  code page 874, also for Windows  }
+	kCFStringEncodingDOSJapanese = $0420;						{  code page 932, also for Windows  }
+	kCFStringEncodingDOSChineseSimplif = $0421;					{  code page 936, also for Windows  }
+	kCFStringEncodingDOSKorean = $0422;						{  code page 949, also for Windows; Unified Hangul Code  }
+	kCFStringEncodingDOSChineseTrad = $0423;					{  code page 950, also for Windows  }
+	{   kCFStringEncodingWindowsLatin1 = 0x0500, defined in CoreFoundation/CFString.h  }
+	kCFStringEncodingWindowsLatin2 = $0501;						{  code page 1250, Central Europe  }
+	kCFStringEncodingWindowsCyrillic = $0502;					{  code page 1251, Slavic Cyrillic  }
+	kCFStringEncodingWindowsGreek = $0503;						{  code page 1253  }
+	kCFStringEncodingWindowsLatin5 = $0504;						{  code page 1254, Turkish  }
+	kCFStringEncodingWindowsHebrew = $0505;						{  code page 1255  }
+	kCFStringEncodingWindowsArabic = $0506;						{  code page 1256  }
+	kCFStringEncodingWindowsBalticRim = $0507;					{  code page 1257  }
+	kCFStringEncodingWindowsVietnamese = $0508;					{  code page 1258  }
+	kCFStringEncodingWindowsKoreanJohab = $0510;				{  code page 1361, for Windows NT  }
+
+	{  Various national standards begin at 0x600  }
+	{   kCFStringEncodingASCII = 0x0600, defined in CoreFoundation/CFString.h  }
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+    kCFStringEncodingANSEL = $0601;	{ ANSEL (ANSI Z39.47) }
+{#endif} { MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+	kCFStringEncodingJIS_X0201_76 = $0620;
+	kCFStringEncodingJIS_X0208_83 = $0621;
+	kCFStringEncodingJIS_X0208_90 = $0622;
+	kCFStringEncodingJIS_X0212_90 = $0623;
+	kCFStringEncodingJIS_C6226_78 = $0624;
+	kCFStringEncodingShiftJIS_X0213_00 = $0628; { Shift-JIS format encoding of JIS X0213 planes 1 and 2}
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+    kCFStringEncodingShiftJIS_X0213_MenKuTen = $0629;	{ JIS X0213 in plane-row-column notation }
+{#endif} { MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+	kCFStringEncodingGB_2312_80 = $0630;
+	kCFStringEncodingGBK_95 = $0631;						{  annex to GB 13000-93; for Windows 95  }
+	kCFStringEncodingKSC_5601_87 = $0640;						{  same as KSC 5601-92 without Johab annex  }
+	kCFStringEncodingKSC_5601_92_Johab = $0641;					{  KSC 5601-92 Johab annex  }
+	kCFStringEncodingCNS_11643_92_P1 = $0651;					{  CNS 11643-1992 plane 1  }
+	kCFStringEncodingCNS_11643_92_P2 = $0652;					{  CNS 11643-1992 plane 2  }
+	kCFStringEncodingCNS_11643_92_P3 = $0653;					{  CNS 11643-1992 plane 3 (was plane 14 in 1986 version)  }
+
+	{  ISO 2022 collections begin at 0x800  }
+	kCFStringEncodingISO_2022_JP = $0820;
+	kCFStringEncodingISO_2022_JP_2 = $0821;
+	kCFStringEncodingISO_2022_JP_1 = $0822; { RFC 2237}
+	kCFStringEncodingISO_2022_JP_3 = $0823; { JIS X0213}
+	kCFStringEncodingISO_2022_CN = $0830;
+	kCFStringEncodingISO_2022_CN_EXT = $0831;
+	kCFStringEncodingISO_2022_KR = $0840;
+	
+	{  EUC collections begin at 0x900  }
+	kCFStringEncodingEUC_JP = $0920;						{  ISO 646, 1-byte katakana, JIS 208, JIS 212  }
+	kCFStringEncodingEUC_CN = $0930;						{  ISO 646, GB 2312-80  }
+	kCFStringEncodingEUC_TW = $0931;						{  ISO 646, CNS 11643-1992 Planes 1-16  }
+	kCFStringEncodingEUC_KR = $0940;						{  ISO 646, KS C 5601-1987  }
+
+	{  Misc standards begin at 0xA00  }
+	kCFStringEncodingShiftJIS = $0A01;						{  plain Shift-JIS  }
+	kCFStringEncodingKOI8_R = $0A02;						{  Russian internet standard  }
+	kCFStringEncodingBig5 = $0A03;						{  Big-5 (has variants)  }
+	kCFStringEncodingMacRomanLatin1 = $0A04;					{  Mac OS Roman permuted to align with ISO Latin-1  }
+	kCFStringEncodingHZ_GB_2312 = $0A05;						{  HZ (RFC 1842, for Chinese mail & news)  }
+	kCFStringEncodingBig5_HKSCS_1999 = $0A06; { Big-5 with Hong Kong special char set supplement}
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+	kCFStringEncodingVISCII = $0A07;	{ RFC 1456, Vietnamese }
+	kCFStringEncodingKOI8_U = $0A08;	{ RFC 2319, Ukrainian }
+	kCFStringEncodingBig5_E = $0A09;	{ Taiwan Big-5E standard }
+{#endif} { MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+
+	{  Other platform encodings }
+{  kCFStringEncodingNextStepLatin = 0x0B01, defined in CoreFoundation/CFString.h }
+{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
+	kCFStringEncodingNextStepJapanese = $0B02;	{ NextStep Japanese encoding }
+{#endif} { MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 }
+																{  EBCDIC & IBM host encodings begin at 0xC00  }
+	kCFStringEncodingEBCDIC_US = $0C01;						{  basic EBCDIC-US  }
+	kCFStringEncodingEBCDIC_CP037 = $0C02;						{  code page 037, extended EBCDIC (Latin-1 set) for US,Canada...  }
+
+
+end.

+ 130 - 0
packages/extra/univint/CFTimeZone.pas

@@ -0,0 +1,130 @@
+{	CFTimeZone.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFTimeZone;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFData,CFDate,CFDictionary,CFString;
+{$ALIGN POWER}
+
+
+function CFTimeZoneGetTypeID: CFTypeID; external name '_CFTimeZoneGetTypeID';
+
+function CFTimeZoneCopySystem: CFTimeZoneRef; external name '_CFTimeZoneCopySystem';
+
+procedure CFTimeZoneResetSystem; external name '_CFTimeZoneResetSystem';
+
+function CFTimeZoneCopyDefault: CFTimeZoneRef; external name '_CFTimeZoneCopyDefault';
+
+procedure CFTimeZoneSetDefault( tz: CFTimeZoneRef ); external name '_CFTimeZoneSetDefault';
+
+function CFTimeZoneCopyKnownNames: CFArrayRef; external name '_CFTimeZoneCopyKnownNames';
+
+function CFTimeZoneCopyAbbreviationDictionary: CFDictionaryRef; external name '_CFTimeZoneCopyAbbreviationDictionary';
+
+procedure CFTimeZoneSetAbbreviationDictionary( dict: CFDictionaryRef ); external name '_CFTimeZoneSetAbbreviationDictionary';
+
+function CFTimeZoneCreate( allocator: CFAllocatorRef; name: CFStringRef; data: CFDataRef ): CFTimeZoneRef; external name '_CFTimeZoneCreate';
+
+function CFTimeZoneCreateWithTimeIntervalFromGMT( allocator: CFAllocatorRef; ti: CFTimeInterval ): CFTimeZoneRef; external name '_CFTimeZoneCreateWithTimeIntervalFromGMT';
+
+function CFTimeZoneCreateWithName( allocator: CFAllocatorRef; name: CFStringRef; tryAbbrev: Boolean ): CFTimeZoneRef; external name '_CFTimeZoneCreateWithName';
+
+function CFTimeZoneGetName( tz: CFTimeZoneRef ): CFStringRef; external name '_CFTimeZoneGetName';
+
+function CFTimeZoneGetData( tz: CFTimeZoneRef ): CFDataRef; external name '_CFTimeZoneGetData';
+
+function CFTimeZoneGetSecondsFromGMT( tz: CFTimeZoneRef; at: CFAbsoluteTime ): CFTimeInterval; external name '_CFTimeZoneGetSecondsFromGMT';
+
+function CFTimeZoneCopyAbbreviation( tz: CFTimeZoneRef; at: CFAbsoluteTime ): CFStringRef; external name '_CFTimeZoneCopyAbbreviation';
+
+function CFTimeZoneIsDaylightSavingTime( tz: CFTimeZoneRef; at: CFAbsoluteTime ): Boolean; external name '_CFTimeZoneIsDaylightSavingTime';
+
+
+end.

+ 398 - 0
packages/extra/univint/CFTree.pas

@@ -0,0 +1,398 @@
+{	CFTree.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFTree;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase;
+{$ALIGN POWER}
+
+{!
+        @header CFTree
+        CFTree implements a container which stores references to other CFTrees.
+        Each tree may have a parent, and a variable number of children.
+}
+
+
+{!
+        @typedef CFTreeRetainCallBack
+        Type of the callback function used to add a retain to the user-specified
+        info parameter.  This callback may returns the value to use whenever the
+        info parameter is retained, which is usually the value parameter passed
+        to this callback, but may be a different value if a different value
+        should be used.
+        @param info A user-supplied info parameter provided in a CFTreeContext.
+        @result The retained info parameter.
+}
+type
+	CFTreeRetainCallBack = function( info: {const} UnivPtr ): UnivPtr;
+
+{!
+        @typedef CFTreeReleaseCallBack
+        Type of the callback function used to remove a retain previously
+        added to the user-specified info parameter.
+        @param info A user-supplied info parameter provided in a CFTreeContext.
+}
+type
+	CFTreeReleaseCallBack = procedure( info: {const} UnivPtr );
+
+{!
+        @typedef CFTreeCopyDescriptionCallBack
+        Type of the callback function used to provide a description of the
+        user-specified info parameter.
+        @param info A user-supplied info parameter provided in a CFTreeContext.
+        @result A description of the info parameter.
+}
+type
+	CFTreeCopyDescriptionCallBack = function( info: {const} UnivPtr ): CFStringRef;
+
+{!
+        @typedef CFTreeContext
+        Structure containing user-specified data and callbacks for a CFTree.
+        @field version The version number of the structure type being passed
+                in as a parameter to the CFTree creation function.
+                This structure is version 0.
+        @field info A C pointer to a user-specified block of data.
+        @field retain The callback used to add a retain for the info field.
+                If this parameter is not a pointer to a function of the correct
+                prototype, the behavior is undefined.  The value may be NULL.
+        @field release The calllback used to remove a retain previously added
+                for the info field.  If this parameter is not a pointer to a 
+                function of the correct prototype, the behavior is undefined.
+                The value may be NULL.
+        @field copyDescription The callback used to provide a description of
+                the info field.
+}
+type
+	CFTreeContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: CFTreeRetainCallBack;
+		release: CFTreeReleaseCallBack;	
+		copyDescription: CFTreeCopyDescriptionCallBack;
+	end;
+	CFTreeContextPtr = ^CFTreeContext;
+
+{!
+        @typedef CFTreeApplierFunction
+        Type of the callback function used by the apply functions of
+                CFTree.
+        @param value The current value from the CFTree
+        @param context The user-defined context parameter give to the apply
+                function.
+}
+type
+	CFTreeApplierFunction = procedure( value: {const} UnivPtr; context: UnivPtr );
+
+{!
+        @typedef CFTreeRef
+        This is the type of a reference to CFTrees.
+}
+type
+	CFTreeRef = ^SInt32; { an opaque 32-bit type }
+	CFTreeRefPtr = ^CFTreeRef;
+
+{!
+        @function CFTreeGetTypeID
+        Returns the type identifier of all CFTree instances.
+}
+function CFTreeGetTypeID: CFTypeID; external name '_CFTreeGetTypeID';
+
+{!
+        @function CFTreeCreate
+        Creates a new mutable tree.
+        @param allocator The CFAllocator which should be used to allocate
+                memory for the tree and storage for its children.  This
+                parameter may be NULL in which case the current default
+                CFAllocator is used.  If this reference is not a valid
+                CFAllocator, the behavior is undefined.
+        @param context A C pointer to a CFTreeContext structure to be copied 
+                and used as the context of the new tree.  The info parameter
+                will be retained by the tree if a retain function is provided.
+                If this value is not a valid C pointer to a CFTreeContext 
+                structure-sized block of storage, the result is undefined. 
+                If the version number of the storage is not a valid CFTreeContext
+                version number, the result is undefined.
+        @result A reference to the new CFTree.
+}
+function CFTreeCreate( allocator: CFAllocatorRef; const (*var*) context: CFTreeContext ): CFTreeRef; external name '_CFTreeCreate';
+
+{!
+        @function CFTreeGetParent
+        Returns the parent of the specified tree.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @result The parent of the tree.
+}
+function CFTreeGetParent( tree: CFTreeRef ): CFTreeRef; external name '_CFTreeGetParent';
+
+{!
+        @function CFTreeGetNextSibling
+        Returns the sibling after the specified tree in the parent tree's list.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @result The next sibling of the tree.
+}
+function CFTreeGetNextSibling( tree: CFTreeRef ): CFTreeRef; external name '_CFTreeGetNextSibling';
+
+{!
+        @function CFTreeGetFirstChild
+        Returns the first child of the tree.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @result The first child of the tree.
+}
+function CFTreeGetFirstChild( tree: CFTreeRef ): CFTreeRef; external name '_CFTreeGetFirstChild';
+
+{!
+        @function CFTreeGetContext
+        Returns the context of the specified tree.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @param context A C pointer to a CFTreeContext structure to be filled in with
+                the context of the specified tree.  If this value is not a valid C
+                pointer to a CFTreeContext structure-sized block of storage, the
+                result is undefined.  If the version number of the storage is not
+                a valid CFTreeContext version number, the result is undefined.
+}
+procedure CFTreeGetContext( tree: CFTreeRef; var context: CFTreeContext ); external name '_CFTreeGetContext';
+
+{!
+        @function CFTreeGetChildCount
+        Returns the number of children of the specified tree.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @result The number of children.
+}
+function CFTreeGetChildCount( tree: CFTreeRef ): CFIndex; external name '_CFTreeGetChildCount';
+
+{!
+        @function CFTreeGetChildAtIndex
+        Returns the nth child of the specified tree.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @param idx The index of the child tree to be returned.  If this parameter
+                is less than zero or greater than the number of children of the
+                tree, the result is undefined.
+        @result A reference to the specified child tree.
+}
+function CFTreeGetChildAtIndex( tree: CFTreeRef; idx: CFIndex ): CFTreeRef; external name '_CFTreeGetChildAtIndex';
+
+{!
+        @function CFTreeGetChildren
+        Fills the buffer with children from the tree.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+	@param children A C array of pointer-sized values to be filled with
+		children from the tree.  If this parameter is not a valid pointer to a 
+                C array of at least CFTreeGetChildCount() pointers, the behavior is undefined.
+        @result A reference to the specified child tree.
+}
+procedure CFTreeGetChildren( tree: CFTreeRef; var children: CFTreeRef ); external name '_CFTreeGetChildren';
+
+{!
+	@function CFTreeApplyFunctionToChildren
+	Calls a function once for each child of the tree.  Note that the applier
+        only operates one level deep, and does not operate on descendents further
+        removed than the immediate children of the tree.
+        @param heap The tree to be operated upon.  If this parameter is not a
+		valid CFTree, the behavior is undefined.
+	@param applier The callback function to call once for each child of
+		the given tree.  If this parameter is not a pointer to a 
+                function of the correct prototype, the behavior is undefined.
+                If there are values in the tree which the applier function does
+                not expect or cannot properly apply to, the behavior is undefined.
+	@param context A pointer-sized user-defined value, which is passed
+		as the second parameter to the applier function, but is
+		otherwise unused by this function.  If the context is not
+		what is expected by the applier function, the behavior is
+		undefined.
+}
+procedure CFTreeApplyFunctionToChildren( tree: CFTreeRef; applier: CFTreeApplierFunction; context: UnivPtr ); external name '_CFTreeApplyFunctionToChildren';
+
+{!
+        @function CFTreeFindRoot
+        Returns the root tree of which the specified tree is a descendent.
+        @param tree The tree to be queried.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @result A reference to the root of the tree.
+}
+function CFTreeFindRoot( tree: CFTreeRef ): CFTreeRef; external name '_CFTreeFindRoot';
+
+{!
+        @function CFTreeSetContext
+        Replaces the context of a tree.  The tree releases its retain on the
+        info of the previous context, and retains the info of the new context.
+        @param tree The tree to be operated on.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @param context A C pointer to a CFTreeContext structure to be copied 
+                and used as the context of the new tree.  The info parameter
+                will be retained by the tree if a retain function is provided.
+                If this value is not a valid C pointer to a CFTreeContext 
+                structure-sized block of storage, the result is undefined. 
+                If the version number of the storage is not a valid CFTreeContext
+                version number, the result is undefined.
+}
+procedure CFTreeSetContext( tree: CFTreeRef; const (*var*) context: CFTreeContext ); external name '_CFTreeSetContext';
+
+{!
+        @function CFTreePrependChild
+        Adds the newChild to the specified tree as the first in its list of children.
+        @param tree The tree to be operated on.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @param newChild The child to be added.
+                If this parameter is not a valid CFTree, the behavior is undefined.
+                If this parameter is a tree which is already a child of any tree,
+                the behavior is undefined.
+}
+procedure CFTreePrependChild( tree: CFTreeRef; newChild: CFTreeRef ); external name '_CFTreePrependChild';
+
+{!
+        @function CFTreeAppendChild
+        Adds the newChild to the specified tree as the last in its list of children.
+        @param tree The tree to be operated on.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+        @param newChild The child to be added.
+                If this parameter is not a valid CFTree, the behavior is undefined.
+                If this parameter is a tree which is already a child of any tree,
+                the behavior is undefined.
+}
+procedure CFTreeAppendChild( tree: CFTreeRef; newChild: CFTreeRef ); external name '_CFTreeAppendChild';
+
+{!
+        @function CFTreeInsertSibling
+        Inserts newSibling into the the parent tree's linked list of children after
+        tree.  The newSibling will have the same parent as tree.
+        @param tree The tree to insert newSibling after.  If this parameter is not a valid
+                CFTree, the behavior is undefined.  If the tree does not have a
+                parent, the behavior is undefined.
+        @param newSibling The sibling to be added.
+                If this parameter is not a valid CFTree, the behavior is undefined.
+                If this parameter is a tree which is already a child of any tree,
+                the behavior is undefined.  
+}
+procedure CFTreeInsertSibling( tree: CFTreeRef; newSibling: CFTreeRef ); external name '_CFTreeInsertSibling';
+
+{!
+        @function CFTreeRemove
+        Removes the tree from its parent.
+        @param tree The tree to be removed.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+}
+procedure CFTreeRemove( tree: CFTreeRef ); external name '_CFTreeRemove';
+
+{!
+        @function CFTreeRemoveAllChildren
+        Removes all the children of the tree.
+        @param tree The tree to remove all children from.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+}
+procedure CFTreeRemoveAllChildren( tree: CFTreeRef ); external name '_CFTreeRemoveAllChildren';
+
+{!
+        @function CFTreeSortChildren
+        Sorts the children of the specified tree using the specified comparator function.
+        @param tree The tree to be operated on.  If this parameter is not a valid
+                CFTree, the behavior is undefined.
+	@param comparator The function with the comparator function type
+		signature which is used in the sort operation to compare
+		children of the tree with the given value. If this parameter
+		is not a pointer to a function of the correct prototype, the
+		the behavior is undefined. The children of the tree are sorted 
+                from least to greatest according to this function.
+	@param context A pointer-sized user-defined value, which is passed
+		as the third parameter to the comparator function, but is
+		otherwise unused by this function. If the context is not
+		what is expected by the comparator function, the behavior is
+		undefined.
+}
+procedure CFTreeSortChildren( tree: CFTreeRef; comparator: CFComparatorFunction; context: UnivPtr ); external name '_CFTreeSortChildren';
+
+
+end.

+ 448 - 0
packages/extra/univint/CFURL.pas

@@ -0,0 +1,448 @@
+{	CFURL.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFURL;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData,CFString,Files;
+{$ALIGN POWER}
+
+
+type
+	CFURLPathStyle = SInt32;
+const
+	kCFURLPOSIXPathStyle = 0;
+	kCFURLHFSPathStyle = 1;
+	kCFURLWindowsPathStyle = 2;
+    
+type
+	CFURLRef = ^SInt32; { an opaque 32-bit type }
+	CFURLRefPtr = ^CFURLRef;
+
+{ CFURLs are composed of two fundamental pieces - their string, and a }
+{ (possibly NULL) base URL.  A relative URL is one in which the string }
+{ by itself does not fully specify the URL (for instance "myDir/image.tiff"); }
+{ an absolute URL is one in which the string does fully specify the URL }
+{ ("file://localhost/myDir/image.tiff").  Absolute URLs always have NULL }
+{ base URLs; however, it is possible for a URL to have a NULL base, and still }
+{ not be absolute.  Such a URL has only a relative string, and cannot be }
+{ resolved.  Two CFURLs are considered equal if and only if their strings }
+{ are equal and their bases are equal.  In other words, }
+{ "file://localhost/myDir/image.tiff" is NOT equal to the URL with relative }
+{ string "myDir/image.tiff" and base URL "file://localhost/".  Clients that }
+{ need these less strict form of equality should convert all URLs to their }
+{ absolute form via CFURLCopyAbsoluteURL(), then compare the absolute forms. }
+
+function CFURLGetTypeID: CFTypeID; external name '_CFURLGetTypeID';
+
+{ encoding will be used both to interpret the bytes of URLBytes, and to }
+{ interpret any percent-escapes within the bytes. }
+function CFURLCreateWithBytes( allocator: CFAllocatorRef; URLBytes: UInt8Ptr; length: CFIndex; encoding: CFStringEncoding; baseURL: CFURLRef ): CFURLRef; external name '_CFURLCreateWithBytes';
+
+{ Escapes any character that is not 7-bit ASCII with the byte-code }
+{ for the given encoding.  If escapeWhitespace is true, whitespace }
+{ characters (' ', '\t', '\r', '\n') will be escaped also (desirable }
+{ if embedding the URL into a larger text stream like HTML) }
+function CFURLCreateData( allocator: CFAllocatorRef; url: CFURLRef; encoding: CFStringEncoding; escapeWhitespace: Boolean ): CFDataRef; external name '_CFURLCreateData';
+
+{ Any escape sequences in URLString will be interpreted via UTF-8. }
+function CFURLCreateWithString( allocator: CFAllocatorRef; URLString: CFStringRef; baseURL: CFURLRef ): CFURLRef; external name '_CFURLCreateWithString';
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+
+{ Create an absolute URL directly, without requiring the extra step }
+{ of calling CFURLCopyAbsoluteURL().  If useCompatibilityMode is  }
+{ true, the rules historically used on the web are used to resolve }
+{ relativeString against baseURL - these rules are generally listed }
+{ in the RFC as optional or alternate interpretations.  Otherwise, }
+{ the strict rules from the RFC are used.  The major differences are }
+{ that in compatibility mode, we are lenient of the scheme appearing }
+{ in relative portion, leading "../" components are removed from the }
+{ final URL's path, and if the relative portion contains only }
+{ resource specifier pieces (query, parameters, and fragment), then }
+{ the last path component of the base URL will not be deleted  }
+function CFURLCreateAbsoluteURLWithBytes( alloc: CFAllocatorRef; relativeURLBytes: UInt8Ptr; length: CFIndex; encoding: CFStringEncoding; baseURL: CFURLRef; useCompatibilityMode: Boolean ): CFURLRef; external name '_CFURLCreateAbsoluteURLWithBytes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+{#endif}
+
+{ filePath should be the URL's path expressed as a path of the type }
+{ fsType.  If filePath is not absolute, the resulting URL will be }
+{ considered relative to the current working directory (evaluated }
+{ at creation time).  isDirectory determines whether filePath is }
+{ treated as a directory path when resolving against relative path }
+{ components }
+function CFURLCreateWithFileSystemPath( allocator: CFAllocatorRef; filePath: CFStringRef; pathStyle: CFURLPathStyle; isDirectory: Boolean ): CFURLRef; external name '_CFURLCreateWithFileSystemPath';
+
+function CFURLCreateFromFileSystemRepresentation( allocator: CFAllocatorRef; buffer: CStringPtr; bufLen: CFIndex; isDirectory: Boolean ): CFURLRef; external name '_CFURLCreateFromFileSystemRepresentation';
+
+function CFURLCreateWithFileSystemPathRelativeToBase( allocator: CFAllocatorRef; filePath: CFStringRef; pathStyle: CFURLPathStyle; isDirectory: Boolean; baseURL: CFURLRef ): CFURLRef; external name '_CFURLCreateWithFileSystemPathRelativeToBase';
+
+function CFURLCreateFromFileSystemRepresentationRelativeToBase( allocator: CFAllocatorRef; buffer: CStringPtr; bufLen: CFIndex; isDirectory: Boolean; baseURL: CFURLRef ): CFURLRef; external name '_CFURLCreateFromFileSystemRepresentationRelativeToBase';
+                                                                         
+{ Fills buffer with the file system's native representation of }
+{ url's path. No more than maxBufLen bytes are written to buffer. }
+{ The buffer should be at least the maximum path length for }
+{ the file system in question to avoid failures for insufficiently }
+{ large buffers.  If resolveAgainstBase is true, the url's relative }
+{ portion is resolved against its base before the path is computed. }
+{ Returns success or failure. }
+function CFURLGetFileSystemRepresentation( url: CFURLRef; resolveAgainstBase: Boolean; buffer: CStringPtr; maxBufLen: CFIndex ): Boolean; external name '_CFURLGetFileSystemRepresentation';
+
+{ Creates a new URL by resolving the relative portion of relativeURL against its base. }
+function CFURLCopyAbsoluteURL( relativeURL: CFURLRef ): CFURLRef; external name '_CFURLCopyAbsoluteURL';
+
+{ Returns the URL's string. }
+function CFURLGetString( anURL: CFURLRef ): CFStringRef; external name '_CFURLGetString';
+
+{ Returns the base URL if it exists }
+function CFURLGetBaseURL( anURL: CFURLRef ): CFURLRef; external name '_CFURLGetBaseURL';
+
+{
+All URLs can be broken into two pieces - the scheme (preceding the
+first colon) and the resource specifier (following the first colon).
+Most URLs are also "standard" URLs conforming to RFC 1808 (available
+from www.w3c.org).  This category includes URLs of the file, http,
+https, and ftp schemes, to name a few.  Standard URLs start the
+resource specifier with two slashes ("//"), and can be broken into
+four distinct pieces - the scheme, the net location, the path, and
+further resource specifiers (typically an optional parameter, query,
+and/or fragment).  The net location appears immediately following
+the two slashes and goes up to the next slash; it's format is
+scheme-specific, but is usually composed of some or all of a username,
+password, host name, and port.  The path is a series of path components
+separated by slashes; if the net location is present, the path always
+begins with a slash.  Standard URLs can be relative to another URL,
+in which case at least the scheme and possibly other pieces as well
+come from the base URL (see RFC 1808 for precise details when resolving
+a relative URL against its base).  The full URL is therefore
+
+<scheme> "://" <net location> <path, always starting with slash> <add'l resource specifiers>
+
+If a given CFURL can be decomposed (that is, conforms to RFC 1808), you
+can ask for each of the four basic pieces (scheme, net location, path,
+and resource specifer) separately, as well as for its base URL.  The
+basic pieces are returned with any percent escape sequences still in
+place (although note that the scheme may not legally include any
+percent escapes); this is to allow the caller to distinguish between
+percent sequences that may have syntactic meaning if replaced by the
+character being escaped (for instance, a '/' in a path component).
+Since only the individual schemes know which characters are
+syntactically significant, CFURL cannot safely replace any percent
+escape sequences.  However, you can use
+CFURLCreateStringByReplacingPercentEscapes() to create a new string with
+the percent escapes removed; see below.
+
+If a given CFURL can not be decomposed, you can ask for its scheme and its
+resource specifier; asking it for its net location or path will return NULL.
+
+To get more refined information about the components of a decomposable
+CFURL, you may ask for more specific pieces of the URL, expressed with
+the percent escapes removed.  The available functions are CFURLCopyHostName(),
+CFURLGetPortNumber() (returns an Int32), CFURLCopyUserName(),
+CFURLCopyPassword(), CFURLCopyQuery(), CFURLCopyParameters(), and
+CFURLCopyFragment().  Because the parameters, query, and fragment of an
+URL may contain scheme-specific syntaxes, these methods take a second
+argument, giving a list of characters which should NOT be replaced if
+percent escaped.  For instance, the ftp parameter syntax gives simple
+key-value pairs as "<key>=<value>;"  Clearly if a key or value includes
+either '=' or ';', it must be escaped to avoid corrupting the meaning of
+the parameters, so the caller may request the parameter string as
+
+CFStringRef myParams = CFURLCopyParameters(ftpURL, CFSTR("=;%"));
+
+requesting that all percent escape sequences be replaced by the represented
+characters, except for escaped '=', '%' or ';' characters.  Pass the empty
+string (CFSTR("")) to request that all percent escapes be replaced, or NULL
+to request that none be.
+}
+
+{ Returns true if anURL conforms to RFC 1808 }
+function CFURLCanBeDecomposed( anURL: CFURLRef ): Boolean; external name '_CFURLCanBeDecomposed';
+
+{ The next several methods leave any percent escape sequences intact }
+
+function CFURLCopyScheme( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyScheme';
+
+{ NULL if CFURLCanBeDecomposed(anURL) is false }
+function CFURLCopyNetLocation( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyNetLocation';
+
+{ NULL if CFURLCanBeDecomposed(anURL) is false; also does not resolve the URL }
+{ against its base.  See also CFURLCopyAbsoluteURL().  Note that, strictly }
+{ speaking, any leading '/' is not considered part of the URL's path, although }
+{ its presence or absence determines whether the path is absolute. }
+{ CFURLCopyPath()'s return value includes any leading slash (giving the path }
+{ the normal POSIX appearance); CFURLCopyStrictPath()'s return value omits any }
+{ leading slash, and uses isAbsolute to report whether the URL's path is absolute. }
+
+{ CFURLCopyFileSystemPath() returns the URL's path as a file system path for the }
+{ given path style.  All percent escape sequences are replaced.  The URL is not }
+{ resolved against its base before computing the path. }
+function CFURLCopyPath( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyPath';
+
+function CFURLCopyStrictPath( anURL: CFURLRef; var isAbsolute: Boolean ): CFStringRef; external name '_CFURLCopyStrictPath';
+
+function CFURLCopyFileSystemPath( anURL: CFURLRef; pathStyle: CFURLPathStyle ): CFStringRef; external name '_CFURLCopyFileSystemPath';
+
+{ Returns whether anURL's path represents a directory }
+{ (true returned) or a simple file (false returned) }
+function CFURLHasDirectoryPath( anURL: CFURLRef ): Boolean; external name '_CFURLHasDirectoryPath';
+
+{ Any additional resource specifiers after the path.  For URLs }
+{ that cannot be decomposed, this is everything except the scheme itself. }
+function CFURLCopyResourceSpecifier( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyResourceSpecifier';
+
+function CFURLCopyHostName( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyHostName';
+
+function CFURLGetPortNumber( anURL: CFURLRef ): SInt32; external name '_CFURLGetPortNumber'; { Returns -1 if no port number is specified }
+
+function CFURLCopyUserName( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyUserName';
+
+function CFURLCopyPassword( anURL: CFURLRef ): CFStringRef; external name '_CFURLCopyPassword';
+
+{ These remove all percent escape sequences except those for }
+{ characters in charactersToLeaveEscaped.  If charactersToLeaveEscaped }
+{ is empty (""), all percent escape sequences are replaced by their }
+{ corresponding characters.  If charactersToLeaveEscaped is NULL, }
+{ then no escape sequences are removed at all }
+function CFURLCopyParameterString( anURL: CFURLRef; charactersToLeaveEscaped: CFStringRef ): CFStringRef; external name '_CFURLCopyParameterString';
+
+function CFURLCopyQueryString( anURL: CFURLRef; charactersToLeaveEscaped: CFStringRef ): CFStringRef; external name '_CFURLCopyQueryString';
+
+function CFURLCopyFragment( anURL: CFURLRef; charactersToLeaveEscaped: CFStringRef ): CFStringRef; external name '_CFURLCopyFragment';
+
+function CFURLCopyLastPathComponent( url: CFURLRef ): CFStringRef; external name '_CFURLCopyLastPathComponent';
+
+function CFURLCopyPathExtension( url: CFURLRef ): CFStringRef; external name '_CFURLCopyPathExtension';
+
+{ These functions all treat the base URL of the supplied url as }
+{ invariant.  In other words, the URL returned will always have }
+{ the same base as the URL supplied as an argument. }
+
+function CFURLCreateCopyAppendingPathComponent( allocator: CFAllocatorRef; url: CFURLRef; pathComponent: CFStringRef; isDirectory: Boolean ): CFURLRef; external name '_CFURLCreateCopyAppendingPathComponent';
+
+function CFURLCreateCopyDeletingLastPathComponent( allocator: CFAllocatorRef; url: CFURLRef ): CFURLRef; external name '_CFURLCreateCopyDeletingLastPathComponent';
+
+function CFURLCreateCopyAppendingPathExtension( allocator: CFAllocatorRef; url: CFURLRef; extension: CFStringRef ): CFURLRef; external name '_CFURLCreateCopyAppendingPathExtension';
+
+function CFURLCreateCopyDeletingPathExtension( allocator: CFAllocatorRef; url: CFURLRef ): CFURLRef; external name '_CFURLCreateCopyDeletingPathExtension';
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ Fills buffer with the bytes for url, returning the number of bytes }
+{ filled.  If buffer is of insufficient size, returns -1 and no bytes }
+{ are placed in buffer.  If buffer is NULL, the needed length is }
+{ computed and returned.  The returned bytes are the original bytes } 
+{ from which the URL was created; if the URL was created from a }
+{ string, the bytes will be the bytes of the string encoded via UTF-8  }
+function CFURLGetBytes( url: CFURLRef; buffer: CStringPtr; bufferLength: CFIndex ): CFIndex; external name '_CFURLGetBytes';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+type
+	CFURLComponentType = SInt32;
+const
+	kCFURLComponentScheme = 1;
+	kCFURLComponentNetLocation = 2;
+	kCFURLComponentPath = 3;
+	kCFURLComponentResourceSpecifier = 4;
+	
+	kCFURLComponentUser = 5;
+	kCFURLComponentPassword = 6;
+	kCFURLComponentUserInfo = 7;
+	kCFURLComponentHost = 8;
+	kCFURLComponentPort = 9;
+	kCFURLComponentParameterString = 10;
+	kCFURLComponentQuery = 11;
+	kCFURLComponentFragment = 12;
+ 
+{ 
+Gets the  range of the requested component in the bytes of url, as
+returned by CFURLGetBytes().  This range is only good for use in the
+bytes returned by CFURLGetBytes!
+
+If non-NULL, rangeIncludingSeparators gives the range of component
+including the sequences that separate component from the previous and
+next components.  If there is no previous or next component, that end of
+rangeIncludingSeparators will match the range of the component itself.
+If url does not contain the given component type, (kCFNotFound, 0) is
+returned, and rangeIncludingSeparators is set to the location where the
+component would be inserted.  Some examples -
+
+For the URL http://www.apple.com/hotnews/
+
+Component           returned range      rangeIncludingSeparators
+scheme              (0, 4)              (0, 7)
+net location        (7, 13)             (4, 16)
+path                (20, 9)             (20, 9)    
+resource specifier  (kCFNotFound, 0)    (29, 0)
+user                (kCFNotFound, 0)    (7, 0)
+password            (kCFNotFound, 0)    (7, 0)
+user info           (kCFNotFound, 0)    (7, 0)
+host                (7, 13)             (4, 16)
+port                (kCFNotFound, 0)    (20, 0)
+parameter           (kCFNotFound, 0)    (29, 0)
+query               (kCFNotFound, 0)    (29, 0)
+fragment            (kCFNotFound, 0)    (29, 0)
+
+
+For the URL ./relPath/file.html#fragment
+
+Component           returned range      rangeIncludingSeparators
+scheme              (kCFNotFound, 0)    (0, 0)
+net location        (kCFNotFound, 0)    (0, 0)
+path                (0, 19)             (0, 20)
+resource specifier  (20, 8)             (19, 9)
+user                (kCFNotFound, 0)    (0, 0)
+password            (kCFNotFound, 0)    (0, 0)
+user info           (kCFNotFound, 0)    (0, 0)
+host                (kCFNotFound, 0)    (0, 0)
+port                (kCFNotFound, 0)    (0, 0)
+parameter           (kCFNotFound, 0)    (19, 0)
+query               (kCFNotFound, 0)    (19, 0)
+fragment            (20, 8)             (19, 9)
+
+
+For the URL scheme://user:pass@host:1/path/path2/file.html;params?query#fragment
+
+Component           returned range      rangeIncludingSeparators
+scheme              (0, 6)              (0, 9)
+net location        (9, 16)             (6, 19)
+path                (25, 21)            (25, 22) 
+resource specifier  (47, 21)            (46, 22)
+user                (9, 4)              (6, 8)
+password            (14, 4)             (13, 6)
+user info           (9, 9)              (6, 13)
+host                (19, 4)             (18, 6)
+port                (24, 1)             (23, 2)
+parameter           (47, 6)             (46, 8)
+query               (54, 5)             (53, 7)
+fragment            (60, 8)             (59, 9)
+}
+function CFURLGetByteRangeForComponent( url: CFURLRef; component: CFURLComponentType; var rangeIncludingSeparators: CFRange ): CFRange; external name '_CFURLGetByteRangeForComponent';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+{#endif}
+
+{ Returns a string with any percent escape sequences that do NOT }
+{ correspond to characters in charactersToLeaveEscaped with their }
+{ equivalent.  Returns NULL on failure (if an invalid percent sequence }
+{ is encountered), or the original string (retained) if no characters }
+{ need to be replaced. Pass NULL to request that no percent escapes be }
+{ replaced, or the empty string (CFSTR("")) to request that all percent }
+{ escapes be replaced.  Uses UTF8 to interpret percent escapes. }
+function CFURLCreateStringByReplacingPercentEscapes( allocator: CFAllocatorRef; originalString: CFStringRef; charactersToLeaveEscaped: CFStringRef ): CFStringRef; external name '_CFURLCreateStringByReplacingPercentEscapes';
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+{ As above, but allows you to specify the encoding to use when interpreting percent escapes }
+function CFURLCreateStringByReplacingPercentEscapesUsingEncoding( allocator: CFAllocatorRef; origString: CFStringRef; charsToLeaveEscaped: CFStringRef; encoding: CFStringEncoding ): CFStringRef; external name '_CFURLCreateStringByReplacingPercentEscapesUsingEncoding';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+{#endif}
+
+{ Creates a copy or originalString, replacing certain characters with }
+{ the equivalent percent escape sequence based on the encoding specified. }
+{ If the originalString does not need to be modified (no percent escape }
+{ sequences are missing), may retain and return originalString. }
+{ If you are uncertain of the correct encoding, you should use UTF-8, }
+{ which is the encoding designated by RFC 2396 as the correct encoding }
+{ for use in URLs.  The characters so escaped are all characters that }
+{ are not legal URL characters (based on RFC 2396), plus any characters }
+{ in legalURLCharactersToBeEscaped, less any characters in }
+{ charactersToLeaveUnescaped.  To simply correct any non-URL characters }
+{ in an otherwise correct URL string, do: }
+
+{ newString = CFURLCreateStringByAddingPercentEscapes(NULL, origString, NULL, NULL, kCFStringEncodingUTF8); }
+function CFURLCreateStringByAddingPercentEscapes( allocator: CFAllocatorRef; originalString: CFStringRef; charactersToLeaveUnescaped: CFStringRef; legalURLCharactersToBeEscaped: CFStringRef; encoding: CFStringEncoding ): CFStringRef; external name '_CFURLCreateStringByAddingPercentEscapes';
+
+{#ifndef CF_OPEN_SOURCE}
+
+function CFURLCreateFromFSRef( allocator: CFAllocatorRef; const (*var*) fsRef: FSRef ): CFURLRef; external name '_CFURLCreateFromFSRef';
+
+function CFURLGetFSRef( url: CFURLRef; var fsRef: FSRef ): Boolean; external name '_CFURLGetFSRef';
+
+{#endif} // !CF_OPEN_SOURCE
+
+
+end.

+ 176 - 0
packages/extra/univint/CFURLAccess.pas

@@ -0,0 +1,176 @@
+{	CFURLAccess.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFURLAccess;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFData,CFDictionary,CFString,CFURL;
+{$ALIGN POWER}
+
+
+{ Attempts to read the data and properties for the given URL.  If
+only interested in one of the resourceData and properties, pass NULL
+for the other.  If properties is non-NULL and desiredProperties is
+NULL, then all properties are fetched.  Returns success or failure;
+note that as much work as possible is done even if false is returned.
+So for instance if one property is not available, the others are
+fetched anyway. errorCode is set to 0 on success, and some other
+value on failure.  If non-NULL, it is the caller 's responsibility
+to release resourceData and properties.
+
+    Apple reserves for its use all negative error code values; these
+values represent errors common to any scheme.  Scheme-specific error
+codes should be positive, non-zero, and should be used only if one of
+the predefined Apple error codes does not apply.  Error codes should
+be publicized and documented with the scheme-specific properties.
+
+NOTE: When asking for the resource data, this call will allocate the entire
+resource in memory. This can be very expensive, depending on the size of the
+resource (file). Please use CFStream or other techniques if you are downloading
+large files.
+
+}
+function CFURLCreateDataAndPropertiesFromResource( alloc: CFAllocatorRef; url: CFURLRef; resourceData: CFDataRefPtr; properties: CFDictionaryRefPtr; desiredProperties: CFArrayRef; var errorCode: SInt32 ): Boolean; external name '_CFURLCreateDataAndPropertiesFromResource';
+
+{ Attempts to write the given data and properties to the given URL.
+If dataToWrite is NULL, only properties are written out (use
+CFURLDestroyResource() to delete a resource).  Properties not present
+in propertiesToWrite are left unchanged, hence if propertiesToWrite
+is NULL or empty, the URL's properties are not changed at all.
+Returns success or failure; errorCode is set as for
+CFURLCreateDataAndPropertiesFromResource(), above.
+}
+function CFURLWriteDataAndPropertiesToResource( url: CFURLRef; dataToWrite: CFDataRef; propertiesToWrite: CFDictionaryRef; var errorCode: SInt32 ): Boolean; external name '_CFURLWriteDataAndPropertiesToResource';
+
+{ Destroys the resource indicated by url. }
+{ Returns success or failure; errorCode set as above. }
+function CFURLDestroyResource( url: CFURLRef; var errorCode: SInt32 ): Boolean; external name '_CFURLDestroyResource';
+
+{ Convenience method which calls through to CFURLCreateDataAndPropertiesFromResource(). }
+{ Returns NULL on error and sets errorCode accordingly. }
+function CFURLCreatePropertyFromResource( alloc: CFAllocatorRef; url: CFURLRef; proprty: CFStringRef; var errorCode: SInt32 ): CFTypeRef; external name '_CFURLCreatePropertyFromResource';
+
+{ Common error codes; this list is expected to grow }
+type
+	CFURLError = SInt32;
+const
+	kCFURLUnknownError = -10;
+	kCFURLUnknownSchemeError = -11;
+	kCFURLResourceNotFoundError = -12;
+	kCFURLResourceAccessViolationError = -13;
+	kCFURLRemoteHostUnavailableError = -14;
+	kCFURLImproperArgumentsError = -15;
+	kCFURLUnknownPropertyKeyError = -16;
+	kCFURLPropertyKeyUnavailableError = -17;
+	kCFURLTimeoutError = -18;
+
+{ Property keys }
+
+var kCFURLFileExists: CFStringRef; external name '_kCFURLFileExists'; (* attribute const *)
+var kCFURLFileDirectoryContents: CFStringRef; external name '_kCFURLFileDirectoryContents'; (* attribute const *)
+var kCFURLFileLength: CFStringRef; external name '_kCFURLFileLength'; (* attribute const *)
+var kCFURLFileLastModificationTime: CFStringRef; external name '_kCFURLFileLastModificationTime'; (* attribute const *)
+var kCFURLFilePOSIXMode: CFStringRef; external name '_kCFURLFilePOSIXMode'; (* attribute const *)
+var kCFURLFileOwnerID: CFStringRef; external name '_kCFURLFileOwnerID'; (* attribute const *)
+var kCFURLHTTPStatusCode: CFStringRef; external name '_kCFURLHTTPStatusCode'; (* attribute const *)
+var kCFURLHTTPStatusLine: CFStringRef; external name '_kCFURLHTTPStatusLine'; (* attribute const *)
+
+{ The value of kCFURLFileExists is a CFBoolean }
+{ The value of kCFURLFileDirectoryContents is a CFArray containing CFURLs.  An empty array means the directory exists, but is empty }
+{ The value of kCFURLFileLength is a CFNumber giving the file's length in bytes }
+{ The value of kCFURLFileLastModificationTime is a CFDate }
+{ The value of kCFURLFilePOSIXMode is a CFNumber as given in stat.h }
+{ The value of kCFURLFileOwnerID is a CFNumber representing the owner's uid }
+
+{ Properties for the http: scheme.  Except for the common error codes, above, errorCode will be set to the HTTP response status code upon failure.  Any HTTP header name can also be used as a property }
+{ The value of kCFURLHTTPStatusCode is a CFNumber }
+{ The value of kCFURLHTTPStatusLine is a CFString }
+
+
+end.

+ 149 - 0
packages/extra/univint/CFUUID.pas

@@ -0,0 +1,149 @@
+{	CFUUID.h
+	Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFUUID;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFString;
+{$ALIGN POWER}
+
+
+type
+	CFUUIDRef = ^SInt32; { an opaque 32-bit type }
+	CFUUIDRefPtr = ^CFUUIDRef;
+
+type
+	CFUUIDBytes = record
+		byte0: SInt8;
+		byte1: SInt8;
+		byte2: SInt8;
+		byte3: SInt8;
+		byte4: SInt8;
+		byte5: SInt8;
+		byte6: SInt8;
+		byte7: SInt8;
+		byte8: SInt8;
+		byte9: SInt8;
+		byte10: SInt8;
+		byte11: SInt8;
+		byte12: SInt8;
+		byte13: SInt8;
+		byte14: SInt8;
+		byte15: SInt8;
+	end;
+	CFUUIDBytesPtr = ^CFUUIDBytes;
+{ The CFUUIDBytes struct is a 128-bit struct that contains the
+raw UUID.  A CFUUIDRef can provide such a struct from the
+CFUUIDGetUUIDBytes() function.  This struct is suitable for
+passing to APIs that expect a raw UUID.
+}
+        
+function CFUUIDGetTypeID: CFTypeID; external name '_CFUUIDGetTypeID';
+
+function CFUUIDCreate( alloc: CFAllocatorRef ): CFUUIDRef; external name '_CFUUIDCreate';
+    { Create and return a brand new unique identifier }
+
+function CFUUIDCreateWithBytes( alloc: CFAllocatorRef; byte0: ByteParameter; byte1: ByteParameter; byte2: ByteParameter; byte3: ByteParameter; byte4: ByteParameter; byte5: ByteParameter; byte6: ByteParameter; byte7: ByteParameter; byte8: ByteParameter; byte9: ByteParameter; byte10: ByteParameter; byte11: ByteParameter; byte12: ByteParameter; byte13: ByteParameter; byte14: ByteParameter; byte15: ByteParameter ): CFUUIDRef; external name '_CFUUIDCreateWithBytes';
+    { Create and return an identifier with the given contents.  This may return an existing instance with its ref count bumped because of uniquing. }
+
+function CFUUIDCreateFromString( alloc: CFAllocatorRef; uuidStr: CFStringRef ): CFUUIDRef; external name '_CFUUIDCreateFromString';
+    { Converts from a string representation to the UUID.  This may return an existing instance with its ref count bumped because of uniquing. }
+
+function CFUUIDCreateString( alloc: CFAllocatorRef; uuid: CFUUIDRef ): CFStringRef; external name '_CFUUIDCreateString';
+    { Converts from a UUID to its string representation. }
+
+function CFUUIDGetConstantUUIDWithBytes( alloc: CFAllocatorRef; byte0: ByteParameter; byte1: ByteParameter; byte2: ByteParameter; byte3: ByteParameter; byte4: ByteParameter; byte5: ByteParameter; byte6: ByteParameter; byte7: ByteParameter; byte8: ByteParameter; byte9: ByteParameter; byte10: ByteParameter; byte11: ByteParameter; byte12: ByteParameter; byte13: ByteParameter; byte14: ByteParameter; byte15: ByteParameter ): CFUUIDRef; external name '_CFUUIDGetConstantUUIDWithBytes';
+    { This returns an immortal CFUUIDRef that should not be released.  It can be used in headers to declare UUID constants with #define. }
+
+function CFUUIDGetUUIDBytes( uuid: CFUUIDRef ): CFUUIDBytes; external name '_CFUUIDGetUUIDBytes';
+
+function CFUUIDCreateFromUUIDBytes( alloc: CFAllocatorRef; bytes: CFUUIDBytes ): CFUUIDRef; external name '_CFUUIDCreateFromUUIDBytes';
+
+
+end.

+ 248 - 0
packages/extra/univint/CFUserNotification.pas

@@ -0,0 +1,248 @@
+{	CFUserNotification.h
+	Copyright (c) 2000-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation:  Peter N Lewis, <[email protected]>, 2004 }
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFUserNotification;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFDate,CFDictionary,CFString,CFURL,CFRunLoop;
+{$ALIGN POWER}
+
+
+type
+	CFUserNotificationRef = ^SInt32; { an opaque 32-bit type }
+
+{ A CFUserNotification is a notification intended to be presented to a 
+user at the console (if one is present).  This is for the use of processes
+that do not otherwise have user interfaces, but may need occasional
+interaction with a user.  There is a parallel API for this functionality
+at the System framework level, described in UNCUserNotification.h.
+
+The contents of the notification can include a header, a message, textfields,
+a popup button, radio buttons or checkboxes, a progress indicator, and up to
+three ordinary buttons.  All of these items are optional, but a default
+button will be supplied even if not specified unless the
+kCFUserNotificationNoDefaultButtonFlag is set.
+
+The contents of the notification are specified in the dictionary used to
+create the notification, whose keys should be taken from the list of constants
+below, and whose values should be either strings or arrays of strings
+(except for kCFUserNotificationProgressIndicatorValueKey, in which case the
+value should be a number between 0 and 1, for a "definite" progress indicator,
+or a boolean, for an "indefinite" progress indicator).  Additionally, URLs can
+optionally be supplied for an icon, a sound, and a bundle whose Localizable.strings
+files will be used to localize strings.
+    
+Certain request flags are specified when a notification is created.
+These specify an alert level for the notification, determine whether
+radio buttons or check boxes are to be used, specify which if any of these
+are checked by default, specify whether any of the textfields are to
+be secure textfields, and determine which popup item should be selected
+by default.  A timeout is also specified, which determines how long the
+notification should be supplied to the user (if zero, it will not timeout).
+    
+A CFUserNotification is dispatched for presentation when it is created.
+If any reply is required, it may be awaited in one of two ways:  either
+synchronously, using CFUserNotificationReceiveResponse, or asynchronously,
+using a run loop source.  CFUserNotificationReceiveResponse has a timeout
+parameter that determines how long it will block (zero meaning indefinitely)
+and it may be called as many times as necessary until a response arrives.
+If a notification has not yet received a response, it may be updated with
+new information, or it may be cancelled.  Notifications may not be reused.
+    
+When a response arrives, it carries with it response flags that describe
+which button was used to dismiss the notification, which checkboxes or
+radio buttons were checked, and what the selection of the popup was.
+It also carries a response dictionary, which describes the contents
+of the textfields.  }
+    
+type
+	CFUserNotificationCallBack = procedure( userNotification: CFUserNotificationRef; responseFlags: CFOptionFlags );
+
+function CFUserNotificationGetTypeID: CFTypeID; external name '_CFUserNotificationGetTypeID';
+
+function CFUserNotificationCreate( allocator: CFAllocatorRef; timeout: CFTimeInterval; flags: CFOptionFlags; var error: SInt32; dictionary: CFDictionaryRef ): CFUserNotificationRef; external name '_CFUserNotificationCreate';
+
+function CFUserNotificationReceiveResponse( userNotification: CFUserNotificationRef; timeout: CFTimeInterval; var responseFlags: CFOptionFlags ): SInt32; external name '_CFUserNotificationReceiveResponse';
+
+function CFUserNotificationGetResponseValue( userNotification: CFUserNotificationRef; key: CFStringRef; idx: CFIndex ): CFStringRef; external name '_CFUserNotificationGetResponseValue';
+
+function CFUserNotificationGetResponseDictionary( userNotification: CFUserNotificationRef ): CFDictionaryRef; external name '_CFUserNotificationGetResponseDictionary';
+
+function CFUserNotificationUpdate( userNotification: CFUserNotificationRef; timeout: CFTimeInterval; flags: CFOptionFlags; dictionary: CFDictionaryRef ): SInt32; external name '_CFUserNotificationUpdate';
+
+function CFUserNotificationCancel( userNotification: CFUserNotificationRef ): SInt32; external name '_CFUserNotificationCancel';
+
+function CFUserNotificationCreateRunLoopSource( allocator: CFAllocatorRef; userNotification: CFUserNotificationRef; callout: CFUserNotificationCallBack; order: CFIndex ): CFRunLoopSourceRef; external name '_CFUserNotificationCreateRunLoopSource';
+
+{ Convenience functions for handling the simplest and most common cases:  
+a one-way notification, and a notification with up to three buttons. }
+    
+function CFUserNotificationDisplayNotice( timeout: CFTimeInterval; flags: CFOptionFlags; iconURL: CFURLRef; soundURL: CFURLRef; localizationURL: CFURLRef; alertHeader: CFStringRef; alertMessage: CFStringRef; defaultButtonTitle: CFStringRef ): SInt32; external name '_CFUserNotificationDisplayNotice';
+
+function CFUserNotificationDisplayAlert( timeout: CFTimeInterval; flags: CFOptionFlags; iconURL: CFURLRef; soundURL: CFURLRef; localizationURL: CFURLRef; alertHeader: CFStringRef; alertMessage: CFStringRef; defaultButtonTitle: CFStringRef; alternateButtonTitle: CFStringRef; otherButtonTitle: CFStringRef; var responseFlags: CFOptionFlags ): SInt32; external name '_CFUserNotificationDisplayAlert';
+
+
+{ Flags }
+
+const
+	kCFUserNotificationStopAlertLevel = 0;
+	kCFUserNotificationNoteAlertLevel = 1;
+	kCFUserNotificationCautionAlertLevel = 2;
+	kCFUserNotificationPlainAlertLevel = 3;
+
+const
+	kCFUserNotificationDefaultResponse = 0;
+	kCFUserNotificationAlternateResponse = 1;
+	kCFUserNotificationOtherResponse = 2;
+	kCFUserNotificationCancelResponse = 3;
+
+const
+	kCFUserNotificationNoDefaultButtonFlag = 1 shl 5;
+	kCFUserNotificationUseRadioButtonsFlag = 1 shl 6;
+
+function CFUserNotificationCheckBoxChecked( i: CFIndex ): CFOptionFlags; inline;
+function CFUserNotificationSecureTextField( i: CFIndex ): CFOptionFlags; inline;
+function CFUserNotificationPopUpSelection( n: CFIndex ): CFOptionFlags; inline;
+
+
+{ Keys }
+
+var kCFUserNotificationIconURLKey: CFStringRef; external name '_kCFUserNotificationIconURLKey'; (* attribute const *)
+
+var kCFUserNotificationSoundURLKey: CFStringRef; external name '_kCFUserNotificationSoundURLKey'; (* attribute const *)
+
+var kCFUserNotificationLocalizationURLKey: CFStringRef; external name '_kCFUserNotificationLocalizationURLKey'; (* attribute const *)
+
+var kCFUserNotificationAlertHeaderKey: CFStringRef; external name '_kCFUserNotificationAlertHeaderKey'; (* attribute const *)
+
+var kCFUserNotificationAlertMessageKey: CFStringRef; external name '_kCFUserNotificationAlertMessageKey'; (* attribute const *)
+
+var kCFUserNotificationDefaultButtonTitleKey: CFStringRef; external name '_kCFUserNotificationDefaultButtonTitleKey'; (* attribute const *)
+
+var kCFUserNotificationAlternateButtonTitleKey: CFStringRef; external name '_kCFUserNotificationAlternateButtonTitleKey'; (* attribute const *)
+
+var kCFUserNotificationOtherButtonTitleKey: CFStringRef; external name '_kCFUserNotificationOtherButtonTitleKey'; (* attribute const *)
+
+var kCFUserNotificationProgressIndicatorValueKey: CFStringRef; external name '_kCFUserNotificationProgressIndicatorValueKey'; (* attribute const *)
+
+var kCFUserNotificationPopUpTitlesKey: CFStringRef; external name '_kCFUserNotificationPopUpTitlesKey'; (* attribute const *)
+
+var kCFUserNotificationTextFieldTitlesKey: CFStringRef; external name '_kCFUserNotificationTextFieldTitlesKey'; (* attribute const *)
+
+var kCFUserNotificationCheckBoxTitlesKey: CFStringRef; external name '_kCFUserNotificationCheckBoxTitlesKey'; (* attribute const *)
+
+var kCFUserNotificationTextFieldValuesKey: CFStringRef; external name '_kCFUserNotificationTextFieldValuesKey'; (* attribute const *)
+
+{#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
+var kCFUserNotificationPopUpSelectionKey: CFStringRef; external name '_kCFUserNotificationPopUpSelectionKey'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+{#endif}
+
+implementation
+
+
+{$R-}
+
+function CFUserNotificationCheckBoxChecked( i: CFIndex ): CFOptionFlags; inline;
+begin
+	CFUserNotificationCheckBoxChecked := CFOptionFlags(1 shl (8+i));
+end;
+
+function CFUserNotificationSecureTextField( i: CFIndex ): CFOptionFlags; inline;
+begin
+	CFUserNotificationSecureTextField := CFOptionFlags(1 shl (16+i));
+end;
+
+function CFUserNotificationPopUpSelection( n: CFIndex ): CFOptionFlags; inline;
+begin
+	CFUserNotificationPopUpSelection := CFOptionFlags(n shl 24);
+end;
+
+end.

+ 278 - 0
packages/extra/univint/CFXMLNode.pas

@@ -0,0 +1,278 @@
+{	CFXMLNode.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFXMLNode;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFDictionary,CFString,CFTree,CFURL;
+{$ALIGN POWER}
+
+
+const
+	kCFXMLNodeCurrentVersion = 1;
+
+type
+	CFXMLNodeRef = ^SInt32; { an opaque 32-bit type }
+	CFXMLNodeRefPtr = ^CFXMLNodeRef;
+	CFXMLTreeRef = CFTreeRef;
+
+{  An CFXMLNode describes an individual XML construct - like a tag, or a comment, or a string
+    of character data.  Each CFXMLNode contains 3 main pieces of information - the node's type,
+    the data string, and a pointer to an additional data structure.  The node's type ID is an enum
+    value of type CFXMLNodeTypeID.  The data string is always a CFStringRef; the meaning of the
+    string is dependent on the node's type ID. The format of the additional data is also dependent
+    on the node's type; in general, there is a custom structure for each type that requires
+    additional data.  See below for the mapping from type ID to meaning of the data string and
+    structure of the additional data.  Note that these structures are versioned, and may change
+    as the parser changes.  The current version can always be identified by kCFXMLNodeCurrentVersion;
+    earlier versions can be identified and used by passing earlier values for the version number
+    (although the older structures would have been removed from the header).
+
+    An CFXMLTree is simply a CFTree whose context data is known to be an CFXMLNodeRef.  As
+    such, an CFXMLTree can be used to represent an entire XML document; the CFTree
+    provides the tree structure of the document, while the CFXMLNodes identify and describe
+    the nodes of the tree.  An XML document can be parsed to a CFXMLTree, and a CFXMLTree
+    can generate the data for the equivalent XML document - see CFXMLParser.h for more
+    information on parsing XML.
+    }
+
+{ Type codes for the different possible XML nodes; this list may grow.}
+type
+	CFXMLNodeTypeCode = SInt32;
+const
+	kCFXMLNodeTypeDocument = 1;
+	kCFXMLNodeTypeElement = 2;
+	kCFXMLNodeTypeAttribute = 3;
+	kCFXMLNodeTypeProcessingInstruction = 4;
+	kCFXMLNodeTypeComment = 5;
+	kCFXMLNodeTypeText = 6;
+	kCFXMLNodeTypeCDATASection = 7;
+	kCFXMLNodeTypeDocumentFragment = 8;
+	kCFXMLNodeTypeEntity = 9;
+	kCFXMLNodeTypeEntityReference = 10;
+	kCFXMLNodeTypeDocumentType = 11;
+	kCFXMLNodeTypeWhitespace = 12;
+	kCFXMLNodeTypeNotation = 13;
+	kCFXMLNodeTypeElementTypeDeclaration = 14;
+	kCFXMLNodeTypeAttributeListDeclaration = 15;
+
+type
+	CFXMLElementInfoPtr = ^CFXMLElementInfo;
+	CFXMLElementInfo = record
+		attributes: CFDictionaryRef;
+		attributeOrder: CFArrayRef;
+		isEmpty: Boolean;
+		_reserved1,_reserved2,_reserved3: SInt8;
+	end;
+
+type
+	CFXMLProcessingInstructionInfoPtr = ^CFXMLProcessingInstructionInfo;
+	CFXMLProcessingInstructionInfo = record
+		dataString: CFStringRef;
+	end;
+
+type
+	CFXMLDocumentInfoPtr = ^CFXMLDocumentInfo;
+	CFXMLDocumentInfo = record
+		sourceURL: CFURLRef;
+		encoding: CFStringEncoding;
+	end;
+
+type
+	CFXMLExternalIDPtr = ^CFXMLExternalID;
+	CFXMLExternalID = record
+		systemID: CFURLRef;
+		publicID: CFStringRef;
+	end;
+
+type
+	CFXMLDocumentTypeInfoPtr = ^CFXMLDocumentTypeInfo;
+	CFXMLDocumentTypeInfo = record
+		externalID: CFXMLExternalID;
+	end;
+
+type
+	CFXMLNotationInfoPtr = ^CFXMLNotationInfo;
+	CFXMLNotationInfo = record
+		externalID: CFXMLExternalID;
+	end;
+
+type
+	CFXMLElementTypeDeclarationInfoPtr = ^CFXMLElementTypeDeclarationInfo;
+	CFXMLElementTypeDeclarationInfo = record
+{ This is expected to change in future versions }
+		contentDescription: CFStringRef;
+	end;
+
+type
+	CFXMLAttributeDeclarationInfoPtr = ^CFXMLAttributeDeclarationInfo;
+	CFXMLAttributeDeclarationInfo = record
+{ This is expected to change in future versions }
+		attributeName: CFStringRef;
+		typeString: CFStringRef;
+		defaultString: CFStringRef;
+	end;
+
+type
+	CFXMLAttributeListDeclarationInfoPtr = ^CFXMLAttributeListDeclarationInfo;
+	CFXMLAttributeListDeclarationInfo = record
+		numberOfAttributes: CFIndex;
+		attributes: CFXMLAttributeDeclarationInfoPtr;
+	end;
+
+type
+	CFXMLEntityTypeCode = SInt32;
+const
+	kCFXMLEntityTypeParameter = 0;							{  Implies parsed, internal  }
+	kCFXMLEntityTypeParsedInternal = 1;
+	kCFXMLEntityTypeParsedExternal = 2;
+	kCFXMLEntityTypeUnparsed = 3;
+	kCFXMLEntityTypeCharacter = 4;
+
+type
+	CFXMLEntityInfoPtr = ^CFXMLEntityInfo;
+	CFXMLEntityInfo = record
+		entityType: CFXMLEntityTypeCode;
+		replacementText: CFStringRef;     { NULL if entityType is external or unparsed }
+		entityID: CFXMLExternalID;          { entityID.systemID will be NULL if entityType is internal }
+		notationName: CFStringRef;        { NULL if entityType is parsed }
+	end;
+
+type
+	CFXMLEntityReferenceInfoPtr = ^CFXMLEntityReferenceInfo;
+	CFXMLEntityReferenceInfo = record
+		entityType: CFXMLEntityTypeCode;
+	end;
+
+{
+ dataTypeCode                       meaning of dataString                format of infoPtr
+ ===========                        =====================                =================
+ kCFXMLNodeTypeDocument             <currently unused>                   CFXMLDocumentInfo *
+ kCFXMLNodeTypeElement              tag name                             CFXMLElementInfo *
+ kCFXMLNodeTypeAttribute            <currently unused>                   <currently unused>
+ kCFXMLNodeTypeProcessingInstruction   name of the target                   CFXMLProcessingInstructionInfo *
+ kCFXMLNodeTypeComment              text of the comment                  NULL
+ kCFXMLNodeTypeText                 the text's contents                  NULL
+ kCFXMLNodeTypeCDATASection         text of the CDATA                    NULL
+ kCFXMLNodeTypeDocumentFragment     <currently unused>                   <currently unused>
+ kCFXMLNodeTypeEntity               name of the entity                   CFXMLEntityInfo *
+ kCFXMLNodeTypeEntityReference      name of the referenced entity        CFXMLEntityReferenceInfo *
+ kCFXMLNodeTypeDocumentType         name given as top-level element      CFXMLDocumentTypeInfo *
+ kCFXMLNodeTypeWhitespace           text of the whitespace               NULL
+ kCFXMLNodeTypeNotation             notation name                        CFXMLNotationInfo *
+ kCFXMLNodeTypeElementTypeDeclaration     tag name                       CFXMLElementTypeDeclarationInfo *
+ kCFXMLNodeTypeAttributeListDeclaration   tag name                       CFXMLAttributeListDeclarationInfo *
+}
+
+function CFXMLNodeGetTypeID: CFTypeID; external name '_CFXMLNodeGetTypeID';
+
+{ Creates a new node based on xmlType, dataString, and additionalInfoPtr.  version (together with xmlType) determines the expected structure of additionalInfoPtr }
+function CFXMLNodeCreate( alloc: CFAllocatorRef; xmlType: CFXMLNodeTypeCode; dataString: CFStringRef; additionalInfoPtr: {const} UnivPtr; version: CFIndex ): CFXMLNodeRef; external name '_CFXMLNodeCreate';
+
+{ Creates a copy of origNode (which may not be NULL). }
+function CFXMLNodeCreateCopy( alloc: CFAllocatorRef; origNode: CFXMLNodeRef ): CFXMLNodeRef; external name '_CFXMLNodeCreateCopy';
+
+function CFXMLNodeGetTypeCode( node: CFXMLNodeRef ): CFXMLNodeTypeCode; external name '_CFXMLNodeGetTypeCode';
+
+function CFXMLNodeGetString( node: CFXMLNodeRef ): CFStringRef; external name '_CFXMLNodeGetString';
+
+function CFXMLNodeGetInfoPtr( node: CFXMLNodeRef ): UnivPtr; external name '_CFXMLNodeGetInfoPtr';
+
+function CFXMLNodeGetVersion( node: CFXMLNodeRef ): CFIndex; external name '_CFXMLNodeGetVersion';
+
+{ CFXMLTreeRef }
+
+{ Creates a childless, parentless tree from node }
+function CFXMLTreeCreateWithNode( allocator: CFAllocatorRef; node: CFXMLNodeRef ): CFXMLTreeRef; external name '_CFXMLTreeCreateWithNode';
+
+{ Extracts and returns the node stored in xmlTree }
+function CFXMLTreeGetNode( xmlTree: CFXMLTreeRef ): CFXMLNodeRef; external name '_CFXMLTreeGetNode';
+
+
+end.

+ 339 - 0
packages/extra/univint/CFXMLParser.pas

@@ -0,0 +1,339 @@
+{	CFXMLParser.h
+	Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
+}
+{	  Pascal Translation Updated:  Peter N Lewis, <[email protected]>, November 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CFXMLParser;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFData,CFDictionary,CFTree,CFURL,CFXMLNode;
+{$ALIGN POWER}
+
+
+type
+	CFXMLParserRef = ^SInt32; { an opaque 32-bit type }
+	CFXMLParserRefPtr = ^CFXMLParserRef;
+{ These are the various options you can configure the parser with.  These are
+   chosen such that an option flag of 0 (kCFXMLParserNoOptions) leaves the XML
+   as "intact" as possible (reports all structures; performs no replacements).
+   Hence, to make the parser do the most work, returning only the pure element
+   tree, set the option flag to kCFXMLParserAllOptions.
+
+kCFXMLParserValidateDocument -
+   validate the document against its grammar from the DTD, reporting any errors.
+   Currently not supported.
+
+kCFXMLParserSkipMetaData -
+   silently skip over metadata constructs (the DTD and comments)
+
+kCFXMLParserReplacePhysicalEntities -
+   replace declared entities like &lt;.  Note that other than the 5 predefined
+   entities (lt, gt, quot, amp, apos), these must be defined in the DTD.
+   Currently not supported.
+
+kCFXMLParserSkipWhitespace -
+   skip over all whitespace that does not abut non-whitespace character data.
+   In other words, given <foo>  <bar> blah </bar></foo>, the whitespace between
+   foo's open tag and bar's open tag would be suppressed, but the whitespace
+   around blah would be preserved.
+
+kCFXMLParserAddImpliedAttributes -
+   where the DTD specifies implied attribute-value pairs for a particular element,
+   add those pairs to any occurances of the element in the element tree.
+   Currently not supported.
+}
+
+type
+	CFXMLParserOptions = SInt32;
+const
+	kCFXMLParserValidateDocument = 1 shl 0;
+	kCFXMLParserSkipMetaData = 1 shl 1;
+	kCFXMLParserReplacePhysicalEntities = 1 shl 2;
+	kCFXMLParserSkipWhitespace = 1 shl 3;
+	kCFXMLParserResolveExternalEntities = 1 shl 4;
+	kCFXMLParserAddImpliedAttributes = 1 shl 5;
+	kCFXMLParserAllOptions = $00FFFFFF;
+	kCFXMLParserNoOptions = 0;
+
+{ This list is expected to grow }
+type
+	CFXMLParserStatusCode = SInt32;
+const
+	kCFXMLStatusParseNotBegun	= -2;
+	kCFXMLStatusParseInProgress	= -1;
+	kCFXMLStatusParseSuccessful	= 0;
+	kCFXMLErrorUnexpectedEOF	= 1;
+	kCFXMLErrorUnknownEncoding	= 2;
+	kCFXMLErrorEncodingConversionFailure = 3;
+	kCFXMLErrorMalformedProcessingInstruction = 4;
+	kCFXMLErrorMalformedDTD		= 5;
+	kCFXMLErrorMalformedName	= 6;
+	kCFXMLErrorMalformedCDSect	= 7;
+	kCFXMLErrorMalformedCloseTag = 8;
+	kCFXMLErrorMalformedStartTag = 9;
+	kCFXMLErrorMalformedDocument = 10;
+	kCFXMLErrorElementlessDocument = 11;
+	kCFXMLErrorMalformedComment	= 12;
+	kCFXMLErrorMalformedCharacterReference = 13;
+	kCFXMLErrorMalformedParsedCharacterData = 14;
+	kCFXMLErrorNoData			= 15;
+
+
+{  These functions are called as a parse progresses.
+
+createXMLStructure -
+  called as new XML structures are encountered by the parser.  May return NULL to indicate
+  that the given structure should be skipped; if NULL is returned for a given structure,
+  only minimal parsing is done for that structure (enough to correctly determine its end,
+  and to extract any data necessary for the remainder of the parse, such as Entity definitions).
+  createXMLStructure (or indeed, any of the tree-creation callbacks) will not be called for any
+  children of the skipped structure.  The only exception is that the top-most element will always
+  be reported even if NULL was returned for the document as a whole.  NOTE: for performance reasons,
+  the node passed to createXMLStructure cannot be safely retained by the client; the node as
+  a whole must be copied (via CFXMLNodeCreateCopy), or its contents must be extracted and copied.
+
+addChild -
+  called as children are parsed and are ready to be added to the tree.  If createXMLStructure
+  returns NULL for a given structure, that structure is omitted entirely, and addChild will
+  NOT be called for either a NULL child or parent.
+
+endXMLStructure -
+  called once a structure (and all its children) are completely parsed.  As elements are encountered,
+  createXMLStructure is called for them first, then addChild to add the new structure to its parent,
+  then addChild (potentially several times) to add the new structure's children to it, then finally 
+  endXMLStructure to show that the structure has been fully parsed.
+
+createXMLStructure, addChild, and endXMLStructure are all REQUIRED TO BE NON-NULL.
+
+resolveExternalEntity -
+  called when external entities are referenced (NOT when they are simply defined).  If the function
+  pointer is NULL, the parser uses its internal routines to try and resolve the entity.  If the
+  function pointer is set, and the function returns NULL, a place holder for the external entity
+  is inserted into the tree.  In this manner, the parser's client can prevent any external network 
+  or file accesses.
+
+handleError - called as errors/warnings are encountered in the data stream.  At some point, we will
+  have an enum of the expected errors, some of which will be fatal, others of which will not.  If
+  the function pointer is NULL, the parser will silently attempt to recover.  The
+  handleError function may always return false to force the parser to stop; if handleError returns
+  true, the parser will attempt to recover (fatal errors will still cause the parse to abort
+  immediately).
+}
+
+type
+	CFXMLParserCreateXMLStructureCallBack = function( parser: CFXMLParserRef; nodeDesc: CFXMLNodeRef; info: UnivPtr ): UnivPtr;
+	CFXMLParserAddChildCallBack = procedure( parser: CFXMLParserRef; parent: UnivPtr; child: UnivPtr; info: UnivPtr );
+	CFXMLParserEndXMLStructureCallBack = procedure( parser: CFXMLParserRef; xmlType: UnivPtr; info: UnivPtr );
+	CFXMLParserResolveExternalEntityCallBack = function( parser: CFXMLParserRef; var extID: CFXMLExternalID; info: UnivPtr ): CFDataRef;
+	CFXMLParserHandleErrorCallBack = function( parser: CFXMLParserRef; error: CFXMLParserStatusCode; info: UnivPtr ): Boolean;
+	CFXMLParserCallBacksPtr = ^CFXMLParserCallBacks;
+	CFXMLParserCallBacks = record
+		version: CFIndex;
+		createXMLStructure: CFXMLParserCreateXMLStructureCallBack;
+		addChild: CFXMLParserAddChildCallBack;
+		endXMLStructure: CFXMLParserEndXMLStructureCallBack;
+		resolveExternalEntity: CFXMLParserResolveExternalEntityCallBack;
+		handleError: CFXMLParserHandleErrorCallBack;
+	end;
+
+type
+	CFXMLParserRetainCallBack = function( info: {const} UnivPtr ): UnivPtr;
+	CFXMLParserReleaseCallBack = procedure( info: {const} UnivPtr );
+	CFXMLParserCopyDescriptionCallBack = function( info: {const} UnivPtr ): CFStringRef;
+	CFXMLParserContextPtr = ^CFXMLParserContext;
+	CFXMLParserContext = record
+		version: CFIndex;
+		info: UnivPtr;
+		retain: CFXMLParserRetainCallBack;
+		release: CFXMLParserReleaseCallBack;
+		copyDescription: CFXMLParserCopyDescriptionCallBack;
+	end;
+
+function CFXMLParserGetTypeID: CFTypeID; external name '_CFXMLParserGetTypeID';
+
+{ Creates a parser which will parse the given data with the given options.  xmlData may not be NULL. 
+   dataSource should be the URL from which the data came, and may be NULL; it is used to resolve any
+   relative references found in xmlData. versionOfNodes determines which version CFXMLNodes are produced
+   by the parser; see CFXMLNode.h for more details.  callBacks are the callbacks called by the parser as
+   the parse progresses; callBacks, callBacks->createXMLStructure, callBacks->addChild, and
+   callBacks->endXMLStructure must all be non-NULL.  context determines what if any info pointer is
+   passed to the callbacks as the parse progresses; context may be NULL.  }
+function CFXMLParserCreate( allocator: CFAllocatorRef; xmlData: CFDataRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex; var callBacks: CFXMLParserCallBacks; var context: CFXMLParserContext ): CFXMLParserRef; external name '_CFXMLParserCreate';
+
+{ Arguments as above, except that the data to be parsed is loaded directly 
+   from dataSource.  dataSource may not be NULL.  }
+function CFXMLParserCreateWithDataFromURL( allocator: CFAllocatorRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex; var callBacks: CFXMLParserCallBacks; var context: CFXMLParserContext ): CFXMLParserRef; external name '_CFXMLParserCreateWithDataFromURL';
+
+procedure CFXMLParserGetContext( parser: CFXMLParserRef; var context: CFXMLParserContext ); external name '_CFXMLParserGetContext';
+
+procedure CFXMLParserGetCallBacks( parser: CFXMLParserRef; var callBacks: CFXMLParserCallBacks ); external name '_CFXMLParserGetCallBacks';
+
+function CFXMLParserGetSourceURL( parser: CFXMLParserRef ): CFURLRef; external name '_CFXMLParserGetSourceURL';
+
+{ Returns the character index of the current parse location }
+function CFXMLParserGetLocation( parser: CFXMLParserRef ): CFIndex; external name '_CFXMLParserGetLocation';
+
+{ Returns the line number of the current parse location }
+function CFXMLParserGetLineNumber( parser: CFXMLParserRef ): CFIndex; external name '_CFXMLParserGetLineNumber';
+
+{ Returns the top-most object returned by the createXMLStructure callback }
+function CFXMLParserGetDocument( parser: CFXMLParserRef ): UnivPtr; external name '_CFXMLParserGetDocument';
+
+{ Get the status code or a user-readable description of the last error that occurred in a parse.
+   If no error has occurred, a null description string is returned.  See the enum above for
+   possible status returns }
+function CFXMLParserGetStatusCode( parser: CFXMLParserRef ): CFXMLParserStatusCode; external name '_CFXMLParserGetStatusCode';
+
+function CFXMLParserCopyErrorDescription( parser: CFXMLParserRef ): CFStringRef; external name '_CFXMLParserCopyErrorDescription';
+
+{ Cause any in-progress parse to abort with the given error code and description.  errorCode
+   must be positive, and errorDescription may not be NULL.  Cannot be called asynchronously
+   (i.e. must be called from within a parser callback) }
+procedure CFXMLParserAbort( parser: CFXMLParserRef; errorCode: CFXMLParserStatusCode; errorDescription: CFStringRef ); external name '_CFXMLParserAbort';
+
+{ Starts a parse of the data the parser was created with; returns success or failure.
+   Upon success, use CFXMLParserGetDocument() to get the product of the parse.  Upon
+   failure, use CFXMLParserGetErrorCode() or CFXMLParserCopyErrorDescription() to get
+   information about the error.  It is an error to call CFXMLParserParse() while a
+   parse is already underway. }
+function CFXMLParserParse( parser: CFXMLParserRef ): Boolean; external name '_CFXMLParserParse';
+
+{ These functions provide a higher-level interface.  The XML data is parsed to a
+   special CFTree (an CFXMLTree) with known contexts and callbacks.  See CFXMLNode.h
+   for full details on using an CFXMLTree and the CFXMLNodes contained therein.
+}
+{ Parse to an CFXMLTreeRef.  parseOptions are as above. versionOfNodes determines
+   what version CFXMLNodes are used to populate the tree.  }
+function CFXMLTreeCreateFromData( allocator: CFAllocatorRef; xmlData: CFDataRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex ): CFXMLTreeRef; external name '_CFXMLTreeCreateFromData';
+
+{ As above, with the additional by-reference pass of a CFDictionaryRef containing
+   various error information (see below). The caller is responsible for releasing the
+   returned dictionary. If the error dictionary is not desired, pass NULL. }
+function CFXMLTreeCreateFromDataWithError( allocator: CFAllocatorRef; xmlData: CFDataRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex; var errorDict: CFDictionaryRef ): CFXMLTreeRef; external name '_CFXMLTreeCreateFromDataWithError';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Loads the data to be parsed directly from dataSource.  Arguments as above. }
+function CFXMLTreeCreateWithDataFromURL( allocator: CFAllocatorRef; dataSource: CFURLRef; parseOptions: CFOptionFlags; versionOfNodes: CFIndex ): CFXMLTreeRef; external name '_CFXMLTreeCreateWithDataFromURL';
+
+{ Generate the XMLData (ready to be written to whatever permanent storage is to be
+   used) from an CFXMLTree.  Will NOT regenerate entity references (except those
+   required for syntactic correctness) if they were replaced at the parse time;
+   clients that wish this should walk the tree and re-insert any entity references
+   that should appear in the final output file. }
+function CFXMLTreeCreateXMLData( allocator: CFAllocatorRef; xmlTree: CFXMLTreeRef ): CFDataRef; external name '_CFXMLTreeCreateXMLData';
+
+{ Escaping and unescaping XML entities in CFStrings. The standard XML entities
+   are always replaced.  }
+{ Creates a CFString by replacing entities that appear in the entities dictionary.
+   Dictionary keys are the entities themselves, and the values should be CFStrings
+   containing the expansion. Pass NULL for entitiesDictionary to indicate no entities
+   other than the standard five. }
+function CFXMLCreateStringByEscapingEntities( allocator: CFAllocatorRef; strng: CFStringRef; entitiesDictionary: CFDictionaryRef ): CFStringRef; external name '_CFXMLCreateStringByEscapingEntities';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+function CFXMLCreateStringByUnescapingEntities( allocator: CFAllocatorRef; strng: CFStringRef; entitiesDictionary: CFDictionaryRef ): CFStringRef; external name '_CFXMLCreateStringByUnescapingEntities';
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ CFXMLTreeCreateFromDataWithError error dictionary key constants. }
+var kCFXMLTreeErrorDescription: CFStringRef; external name '_kCFXMLTreeErrorDescription'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+    { value is a CFString containing the readable error string. }
+
+var kCFXMLTreeErrorLineNumber: CFStringRef; external name '_kCFXMLTreeErrorLineNumber'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+    { value is a CFNumber containing the line on which the error appears. }
+
+var kCFXMLTreeErrorLocation: CFStringRef; external name '_kCFXMLTreeErrorLocation'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+    { value is a CFNumber containing the byte location at which the error occurred. }
+
+var kCFXMLTreeErrorStatusCode: CFStringRef; external name '_kCFXMLTreeErrorStatusCode'; (* attribute const *)
+(* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+    { value is a CFNumber containing the error status code. }
+
+
+end.

+ 221 - 0
packages/extra/univint/CGAffineTransforms.pas

@@ -0,0 +1,221 @@
+{ CoreGraphics - CGAffineTransform.h
+ * Copyright (c) 1998-2000 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGAffineTransforms;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CGBase,CGGeometry;
+{$ALIGN POWER}
+
+
+type
+	CGAffineTransformPtr = ^CGAffineTransform;
+	CGAffineTransform = record
+		a, b, c, d: Float32;
+		tx, ty: Float32;
+	end;
+
+{ The identity transform: [ 1 0 0 1 0 0 ]. }
+
+var CGAffineTransformIdentity: CGAffineTransform; external name '_CGAffineTransformIdentity'; (* attribute const *)
+
+{ Return the transform [ a b c d tx ty ]. }
+
+function CGAffineTransformMake( a: Float32; b: Float32; c: Float32; d: Float32; tx: Float32; ty: Float32 ): CGAffineTransform; external name '_CGAffineTransformMake';
+
+{ Return a transform which translates by `(tx, ty)':
+ *   t' = [ 1 0 0 1 tx ty ] }
+
+function CGAffineTransformMakeTranslation( tx: Float32; ty: Float32 ): CGAffineTransform; external name '_CGAffineTransformMakeTranslation';
+
+{ Return a transform which scales by `(sx, sy)':
+ *   t' = [ sx 0 0 sy 0 0 ] }
+
+function CGAffineTransformMakeScale( sx: Float32; sy: Float32 ): CGAffineTransform; external name '_CGAffineTransformMakeScale';
+
+{ Return a transform which rotates by `angle' radians:
+ *   t' = [ cos(angle) sin(angle) -sin(angle) cos(angle) 0 0 ] }
+
+function CGAffineTransformMakeRotation( angle: Float32 ): CGAffineTransform; external name '_CGAffineTransformMakeRotation';
+
+{ Return true if `t' is the identity transform, false otherwise. }
+
+function CGAffineTransformIsIdentity( t: CGAffineTransform ): CBool; external name '_CGAffineTransformIsIdentity'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Translate `t' by `(tx, ty)' and return the result:
+ *   t' = [ 1 0 0 1 tx ty ] * t }
+
+function CGAffineTransformTranslate( t: CGAffineTransform; tx: Float32; ty: Float32 ): CGAffineTransform; external name '_CGAffineTransformTranslate';
+
+{ Scale `t' by `(sx, sy)' and return the result:
+ *   t' = [ sx 0 0 sy 0 0 ] * t }
+
+function CGAffineTransformScale( t: CGAffineTransform; sx: Float32; sy: Float32 ): CGAffineTransform; external name '_CGAffineTransformScale';
+
+{ Rotate `t' by `angle' radians and return the result:
+ *   t' =  [ cos(angle) sin(angle) -sin(angle) cos(angle) 0 0 ] * t }
+
+function CGAffineTransformRotate( t: CGAffineTransform; angle: Float32 ): CGAffineTransform; external name '_CGAffineTransformRotate';
+
+{ Invert `t' and return the result.  If `t' has zero determinant, then `t'
+ * is returned unchanged. }
+
+function CGAffineTransformInvert( t: CGAffineTransform ): CGAffineTransform; external name '_CGAffineTransformInvert';
+
+{ Concatenate `t2' to `t1' and return the result:
+ *   t' = t1 * t2 }
+
+function CGAffineTransformConcat( t1: CGAffineTransform; t2: CGAffineTransform ): CGAffineTransform; external name '_CGAffineTransformConcat';
+
+{ Return true if `t1' and `t2' are equal, false otherwise. }
+
+function CGAffineTransformEqualToTransform( t1: CGAffineTransform; t2: CGAffineTransform ): CBool; external name '_CGAffineTransformEqualToTransform'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `point' by `t' and return the result:
+ *   p' = p * t
+ * where p = [ x y 1 ]. }
+
+function CGPointApplyAffineTransform( point: CGPoint; t: CGAffineTransform ): CGPoint; external name '_CGPointApplyAffineTransform';
+
+{ Transform `size' by `t' and return the result:
+ *   s' = s * t
+ * where s = [ width height 0 ]. }
+
+function CGSizeApplyAffineTransform( size: CGSize; t: CGAffineTransform ): CGSize; external name '_CGSizeApplyAffineTransform';
+
+{ Transform `rect' by `t' and return the result. Since affine transforms
+ * do not preserve rectangles in general, this function returns the
+ * smallest rectangle which contains the transformed corner points of
+ * `rect'. If `t' consists solely of scales, flips and translations, then
+ * the returned rectangle coincides with the rectangle constructed from the
+ * four transformed corners. }
+
+function CGRectApplyAffineTransform( rect: CGRect; t: CGAffineTransform ): CGRect; external name '_CGRectApplyAffineTransform'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+(*
+{** Definitions of inline functions. **}
+
+CG_INLINE CGAffineTransform
+__CGAffineTransformMake(float a, float b, float c, float d, float tx, float ty)
+{
+    CGAffineTransform t;
+
+    t.a = a; t.b = b; t.c = c; t.d = d; t.tx = tx; t.ty = ty;
+    return t;
+}
+
+#define CGAffineTransformMake __CGAffineTransformMake
+
+CG_INLINE CGPoint
+__CGPointApplyAffineTransform(CGPoint point, CGAffineTransform t)
+{
+    CGPoint p;
+
+    p.x = t.a * point.x + t.c * point.y + t.tx;
+    p.y = t.b * point.x + t.d * point.y + t.ty;
+    return p;
+}
+
+#define CGPointApplyAffineTransform __CGPointApplyAffineTransform
+
+CG_INLINE CGSize
+__CGSizeApplyAffineTransform(CGSize size, CGAffineTransform t)
+{
+    CGSize s;
+
+    s.width = t.a * size.width + t.c * size.height;
+    s.height = t.b * size.width + t.d * size.height;
+    return s;
+}
+
+#define CGSizeApplyAffineTransform __CGSizeApplyAffineTransform
+*)
+
+end.

+ 117 - 0
packages/extra/univint/CGBase.pas

@@ -0,0 +1,117 @@
+{ CoreGraphics - CGBase.h
+ * Copyright (c) 2000 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGBase;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,ConditionalMacros;
+{$ALIGN POWER}
+
+
+type
+	size_t								= UInt32;
+	boolean_t							= SInt32;
+
+// Avoid cyclic dependencises by putting CGRefs here
+
+type
+	CGColorRef = ^SInt32; { an opaque 32-bit type }
+	CGPatternRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFStringRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFStreamRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFScannerRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFContentStreamRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFOperatorTableRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFPageRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFDictionaryRef = ^SInt32; { an opaque 32-bit type }
+	CGPDFArrayRef = ^SInt32; { an opaque 32-bit type }
+	CGPSConverterRef = ^SInt32; { an opaque 32-bit type }
+
+end.

+ 172 - 0
packages/extra/univint/CGBitmapContext.pas

@@ -0,0 +1,172 @@
+{ CoreGraphics - CGBitmapContext.h
+ * Copyright (c) 2000 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGBitmapContext;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CGColorSpace,CGImage,CGBase,CGContext;
+{$ALIGN POWER}
+
+
+{ Create a bitmap context.  The context draws into a bitmap which is
+ * `width' pixels wide and `height' pixels high.  The number of components
+ * for each pixel is specified by `colorspace', which also may specify a
+ * destination color profile. The number of bits for each component of a
+ * pixel is specified by `bitsPerComponent', which must be 1, 2, 4, or 8.
+ * Each row of the bitmap consists of `bytesPerRow' bytes, which must be at
+ * least `(width * bitsPerComponent * number of components + 7)/8' bytes.
+ * `data' points a block of memory at least `bytesPerRow * height' bytes.
+ * `bitmapInfo' specifies whether the bitmap should contain an alpha
+ * channel and how it's to be generated, along with whether the components
+ * are floating-point or integer. }
+
+function CGBitmapContextCreate( data: UnivPtr; width: size_t; height: size_t; bitsPerComponent: size_t; bytesPerRow: size_t; colorspace: CGColorSpaceRef; bitmapInfo: CGBitmapInfo ): CGContextRef; external name '_CGBitmapContextCreate';
+
+{ Return the data associated with the bitmap context `c', or NULL if `c'
+ * is not a bitmap context. }
+
+function CGBitmapContextGetData( c: CGContextRef ): UnivPtr; external name '_CGBitmapContextGetData'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the width of the bitmap context `c', or 0 if `c' is not a bitmap
+ * context. }
+
+function CGBitmapContextGetWidth( c: CGContextRef ): size_t; external name '_CGBitmapContextGetWidth'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the height of the bitmap context `c', or 0 if `c' is not a bitmap
+ * context. }
+
+function CGBitmapContextGetHeight( c: CGContextRef ): size_t; external name '_CGBitmapContextGetHeight'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the bits per component of the bitmap context `c', or 0 if `c' is
+ * not a bitmap context. }
+
+function CGBitmapContextGetBitsPerComponent( c: CGContextRef ): size_t; external name '_CGBitmapContextGetBitsPerComponent'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the bits per pixel of the bitmap context `c', or 0 if `c' is not
+ * a bitmap context. }
+
+function CGBitmapContextGetBitsPerPixel( c: CGContextRef ): size_t; external name '_CGBitmapContextGetBitsPerPixel'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the bytes per row of the bitmap context `c', or 0 if `c' is not a
+ * bitmap context. }
+
+function CGBitmapContextGetBytesPerRow( c: CGContextRef ): size_t; external name '_CGBitmapContextGetBytesPerRow'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the colorspace of the bitmap context `c', or NULL if `c' is not a
+ * bitmap context. }
+
+function CGBitmapContextGetColorSpace( c: CGContextRef ): CGColorSpaceRef; external name '_CGBitmapContextGetColorSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the alpha info of the bitmap context `c', or kCGImageAlphaNone if
+ * `c' is not a bitmap context. }
+
+function CGBitmapContextGetAlphaInfo( c: CGContextRef ): CGImageAlphaInfo; external name '_CGBitmapContextGetAlphaInfo'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Return the bitmap info of the bitmap context `c', or 0 if `c' is not a
+ * bitmap context. }
+
+function CGBitmapContextGetBitmapInfo( c: CGContextRef ): CGBitmapInfo; external name '_CGBitmapContextGetBitmapInfo'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Return an image containing a snapshot of the bitmap context `c'.  If
+ * context is not a bitmap context, or if the image cannot be created for
+ * any reason, this function returns NULL.  This is a "copy" operation ---
+ * subsequent changes to context will not affect the contents of the
+ * returned image.
+ *
+ * Note that in some cases the copy will actually follow "copy-on-write"
+ * semantics, so that the actual physical copy of the bits will only occur
+ * if the underlying data in the bitmap context is modified.  As a
+ * consequence, you may wish to use the resulting image and release it
+ * before performing more drawing into the bitmap context; in this way, the
+ * actual physical copy of the data may be avoided. }
+
+function CGBitmapContextCreateImage( c: CGContextRef ): CGImageRef; external name '_CGBitmapContextCreateImage'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+end.

+ 162 - 0
packages/extra/univint/CGColor.pas

@@ -0,0 +1,162 @@
+{ CoreGraphics - CGColor.h
+ * Copyright (c) 2003 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGColor;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CGBase,CGColorSpace;
+{$ALIGN POWER}
+
+
+// CGColorRef defined in CGBase
+
+
+{ Return the CFTypeID for CGColors. }
+
+function CGColorGetTypeID: CFTypeID; external name '_CGColorGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Create a color in colorspace `colorspace' with color components
+ * (including alpha) specified by `components'.  `colorspace' may be any
+ * colorspace except a pattern colorspace. }
+
+function CGColorCreate( colorspace: CGColorSpaceRef; {const} components: {variable-size-array} Float32Ptr ): CGColorRef; external name '_CGColorCreate'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Create a color in colorspace `colorspace' with pattern `pattern' and
+ * components `components'.  `colorspace' must be a pattern colorspace. }
+
+function CGColorCreateWithPattern( colorspace: CGColorSpaceRef; pattern: CGPatternRef; {const} components: {variable-size-array} Float32Ptr ): CGColorRef; external name '_CGColorCreateWithPattern'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Create a copy of `color'. }
+
+function CGColorCreateCopy( color: CGColorRef ): CGColorRef; external name '_CGColorCreateCopy'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Create a copy of `color' with alpha set to `alpha'. }
+
+function CGColorCreateCopyWithAlpha( color: CGColorRef; alpha: Float32 ): CGColorRef; external name '_CGColorCreateCopyWithAlpha'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Equivalent to `CFRetain(color)', except it doesn't crash (as CFRetain
+ * does) if `color' is NULL. }
+
+function CGColorRetain( color: CGColorRef ): CGColorRef; external name '_CGColorRetain'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Equivalent to `CFRelease(color)', except it doesn't crash (as CFRelease
+ * does) if `color' is NULL. }
+
+procedure CGColorRelease( color: CGColorRef ); external name '_CGColorRelease'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Return true if `color1' is equal to `color2'; false otherwise. }
+
+function CGColorEqualToColor( color1: CGColorRef; color2: CGColorRef ): CBool; external name '_CGColorEqualToColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Return the number of color components (including alpha) associated with
+ * `color'. }
+
+function CGColorGetNumberOfComponents( color: CGColorRef ): size_t; external name '_CGColorGetNumberOfComponents'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Return the color components (including alpha) associated with
+ * `color'. }
+
+function CGColorGetComponents( color: CGColorRef ): Float32Ptr; external name '_CGColorGetComponents'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Return the alpha component associated with `color'. }
+
+function CGColorGetAlpha( color: CGColorRef ): Float32; external name '_CGColorGetAlpha'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Return the colorspace associated with `color'. }
+
+function CGColorGetColorSpace( color: CGColorRef ): CGColorSpaceRef; external name '_CGColorGetColorSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Return the pattern associated with `color', if it's a color in a pattern
+ * colorspace; NULL otherwise. }
+
+function CGColorGetPattern( color: CGColorRef ): CGPatternRef; external name '_CGColorGetPattern'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+
+end.

+ 254 - 0
packages/extra/univint/CGColorSpace.pas

@@ -0,0 +1,254 @@
+{ CoreGraphics - CGColorSpace.h
+ * Copyright (c) 1999-2004 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGColorSpace;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFString,CMTypes,CGBase,CGDataProvider;
+{$ALIGN POWER}
+
+
+type
+	CGColorSpaceRef = ^SInt32; { an opaque 32-bit type }
+
+type
+	TristimulusValue = array[0..2] of Float32;
+	RedGreenBlueValue = array[0..2] of Float32;
+	Single4 = array[0..3] of Float32;
+	Single9 = array[0..8] of Float32;
+
+type
+	CGColorRenderingIntent = SInt32;
+const
+	kCGRenderingIntentDefault = 0;
+	kCGRenderingIntentAbsoluteColorimetric = 1;
+	kCGRenderingIntentRelativeColorimetric = 2;
+	kCGRenderingIntentPerceptual = 3;
+	kCGRenderingIntentSaturation = 4;
+
+var kCGColorSpaceGenericGray: CFStringRef; external name '_kCGColorSpaceGenericGray'; (* attribute const *) (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+var kCGColorSpaceGenericRGB: CFStringRef; external name '_kCGColorSpaceGenericRGB'; (* attribute const *) (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+var kCGColorSpaceGenericCMYK: CFStringRef; external name '_kCGColorSpaceGenericCMYK'; (* attribute const *) (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+{ Return the CFTypeID for CGColorSpaces. }
+
+function CGColorSpaceGetTypeID: CFTypeID; external name '_CGColorSpaceGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{* Device-dependent color spaces.  *}
+
+{ Create a DeviceGray colorspace. }
+
+function CGColorSpaceCreateDeviceGray: CGColorSpaceRef; external name '_CGColorSpaceCreateDeviceGray';
+
+{ Create a DeviceRGB colorspace. }
+
+function CGColorSpaceCreateDeviceRGB: CGColorSpaceRef; external name '_CGColorSpaceCreateDeviceRGB';
+
+{ Create a DeviceCMYK colorspace. }
+
+function CGColorSpaceCreateDeviceCMYK: CGColorSpaceRef; external name '_CGColorSpaceCreateDeviceCMYK';
+
+{* Device-independent color spaces. *}
+
+{ Create a calibrated gray colorspace.  `whitePoint' is an array of 3
+ * numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
+ * the diffuse white point.  `blackPoint' is an array of 3 numbers
+ * specifying the tristimulus value, in CIE 1931 XYZ-space, of the diffuse
+ * black point. `gamma' defines the gamma for the gray component. }
+
+function CGColorSpaceCreateCalibratedGray( const (*var*) whitePoint: TristimulusValue; const (*var*) blackPoint: TristimulusValue; gamma: Float32 ): CGColorSpaceRef; external name '_CGColorSpaceCreateCalibratedGray';
+
+{ Create a calibrated RGB colorspace.  `whitePoint' is an array of 3
+ * numbers specifying the tristimulus value, in the CIE 1931 XYZ-space, of
+ * the diffuse white point.  `blackPoint' is an array of 3 numbers
+ * specifying the tristimulus value, in CIE 1931 XYZ-space, of the diffuse
+ * black point. `gamma' is an array of 3 numbers specifying the gamma for
+ * the red, green, and blue components of the color space. `matrix' is an
+ * array of 9 numbers specifying the linear interpretation of the
+ * gamma-modified RGB values of the colorspace with respect to the final
+ * XYZ representation. }
+
+function CGColorSpaceCreateCalibratedRGB( const (*var*) whitePoint: TristimulusValue; const (*var*) blackPoint: TristimulusValue; const (*var*) gamma: RedGreenBlueValue; const (*var*) matrix: Single9 ): CGColorSpaceRef; external name '_CGColorSpaceCreateCalibratedRGB';
+
+{ Create an L*a*b* colorspace.  `whitePoint' is an array of 3 numbers
+ * specifying the tristimulus value, in the CIE 1931 XYZ-space, of the
+ * diffuse white point.  `blackPoint' is an array of 3 numbers specifying
+ * the tristimulus value, in CIE 1931 XYZ-space, of the diffuse black
+ * point. `range' is an array of four numbers specifying the range of valid
+ * values for the a* and b* components of the color space. }
+
+function CGColorSpaceCreateLab(const (*var*) whitePoint: TristimulusValue; const (*var*) blackPoint: TristimulusValue; const (*var*) range: Single4): CGColorSpaceRef; external name '_CGColorSpaceCreateLab';
+
+{ Create an ICC-based colorspace.  `nComponents' specifies the number of
+ * color components in the color space defined by the ICC profile data.
+ * This must match the number of components actually in the ICC profile,
+ * and must be 1, 3, or 4.  `range' is an array of 2*nComponents numbers
+ * specifying the minimum and maximum valid values of the corresponding
+ * color components, so that for color component k, range[2*k] <= c[k] <=
+ * range[2*k+1], where c[k] is the k'th color component.  `profile' is a
+ * data provider specifying the ICC profile.  `alternate' specifies an
+ * alternate colorspace to be used in case the ICC profile is not
+ * supported.  It must have `nComponents' color components. If `alternate'
+ * is NULL, then the color space used will be DeviceGray, DeviceRGB, or
+ * DeviceCMYK, depending on whether `nComponents' is 1, 3, or 4,
+ * respectively. }
+
+function CGColorSpaceCreateICCBased( nComponents: size_t; const (*var*) range: Float32; profile: CGDataProviderRef; alternate: CGColorSpaceRef ): CGColorSpaceRef; external name '_CGColorSpaceCreateICCBased';
+
+{* Special colorspaces. *}
+
+{ Create an indexed colorspace.  A sample value in an indexed color space
+ * is treated as an index into the color table of the color space.  `base'
+ * specifies the base color space in which the values in the color table
+ * are to be interpreted. `lastIndex' is an integer which specifies the
+ * maximum valid index value; it must be less than or equal to 255.
+ * `colorTable' is an array of m * (lastIndex + 1) bytes, where m is
+ * the number of color components in the base color space.  Each byte
+ * is an unsigned integer in the range 0 to 255 that is scaled to the
+ * range of the corresponding color component in the base color space. }
+
+function CGColorSpaceCreateIndexed( baseSpace: CGColorSpaceRef; lastIndex: size_t; colorTable: UInt8Ptr ): CGColorSpaceRef; external name '_CGColorSpaceCreateIndexed';
+
+{ Create a pattern colorspace. `baseSpace' is the underlying colorspace of
+ * the pattern colorspace.  For colored patterns, `baseSpace' should be
+ * NULL; for uncolored patterns, `baseSpace' specifies the colorspace of
+ * colors which will be painted through the pattern. }
+
+function CGColorSpaceCreatePattern( baseSpace: CGColorSpaceRef ): CGColorSpaceRef; external name '_CGColorSpaceCreatePattern';
+
+{ Create a CGColorSpace using `platformColorSpaceReference', a
+ * platform-specific color space reference. For MacOS X,
+ * `platformColorSpaceReference' should be a CMProfileRef. }
+
+function CGColorSpaceCreateWithPlatformColorSpace( platformColorSpaceReference: UnivPtr ): CGColorSpaceRef; external name '_CGColorSpaceCreateWithPlatformColorSpace';
+
+{ Create a colorspace using `name' as the identifier for the colorspace. }
+
+function CGColorSpaceCreateWithName( name: CFStringRef ): CGColorSpaceRef; external name '_CGColorSpaceCreateWithName'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{* Colorspace information. *}
+
+{ Return the number of color components in the colorspace `cs'. }
+
+function CGColorSpaceGetNumberOfComponents( cs: CGColorSpaceRef ): size_t; external name '_CGColorSpaceGetNumberOfComponents';
+
+{* Retaining & releasing colorspaces. *}
+
+{ Equivalent to `CFRetain(cs)'. }
+
+function CGColorSpaceRetain( cs: CGColorSpaceRef ): CGColorSpaceRef; external name '_CGColorSpaceRetain';
+
+{ Equivalent to `CFRelease(cs)'. }
+
+procedure CGColorSpaceRelease( cs: CGColorSpaceRef ); external name '_CGColorSpaceRelease';
+
+
+{* Deprecated APIs. *}
+
+{ Use "kCGColorSpaceGenericGray" instead. }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGColorSpaceUserGray CFSTRP('kCGColorSpaceUserGray')}
+{$endc}
+
+{ Use "kCGColorSpaceGenericRGB" instead. }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGColorSpaceUserRGB CFSTRP('kCGColorSpaceUserRGB')}
+{$endc}
+
+{ Use "kCGColorSpaceGenericCMYK" instead. }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGColorSpaceUserCMYK CFSTRP('kCGColorSpaceUserCMYK')}
+{$endc}
+
+
+end.

+ 863 - 0
packages/extra/univint/CGContext.pas

@@ -0,0 +1,863 @@
+{ CoreGraphics - CGContext.h
+ * Copyright (c) 2000-2003 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGContext;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CGGeometry,CGBase,CFDictionary,CGAffineTransforms,CGColorSpace,CGFont,CGImage,CGPDFDocument,CGPath,CGColor,CGShading,CGPDFPage;
+{$ALIGN POWER}
+
+
+type
+	CGContextRef = ^SInt32; { an opaque 32-bit type }
+
+
+{ Line join styles. }
+
+type
+	CGLineJoin = SInt32;
+const
+	kCGLineJoinMiter = 0;
+	kCGLineJoinRound = 1;
+	kCGLineJoinBevel = 2;
+
+{ Line cap styles. }
+
+type
+	CGLineCap = SInt32;
+const
+	kCGLineCapButt = 0;
+	kCGLineCapRound = 1;
+	kCGLineCapSquare = 2;
+
+{ Drawing modes for paths. }
+
+type
+	CGPathDrawingMode = SInt32;
+const
+	kCGPathFill = 0;
+	kCGPathEOFill = 1;
+	kCGPathStroke = 2;
+	kCGPathFillStroke = 3;
+	kCGPathEOFillStroke = 4;
+
+{ Drawing modes for text. }
+
+type
+	CGTextDrawingMode = SInt32;
+const
+	kCGTextFill = 0;
+	kCGTextStroke = 1;
+	kCGTextFillStroke = 2;
+	kCGTextInvisible = 3;
+	kCGTextFillClip = 4;
+	kCGTextStrokeClip = 5;
+	kCGTextFillStrokeClip = 6;
+	kCGTextClip = 7;
+
+{ Text encodings. }
+
+type
+	CGTextEncoding = SInt32;
+const
+	kCGEncodingFontSpecific = 0;
+	kCGEncodingMacRoman = 1;
+
+{ Interpolation quality. }
+
+type
+	CGInterpolationQuality = SInt32;
+const
+	kCGInterpolationDefault = 0;		{ Let the context decide. }
+	kCGInterpolationNone = 1;		{ Never interpolate. }
+	kCGInterpolationLow = 2;		{ Faster, lower quality. }
+	kCGInterpolationHigh = 3;		{ Slower, higher quality. }
+
+{ Blend modes. }
+
+type
+	CGBlendMode = SInt32;
+const
+	kCGBlendModeNormal = 0;
+	kCGBlendModeMultiply = 1;
+	kCGBlendModeScreen = 2;
+	kCGBlendModeOverlay = 3;
+	kCGBlendModeDarken = 4;
+	kCGBlendModeLighten = 5;
+	kCGBlendModeColorDodge = 6;
+	kCGBlendModeColorBurn = 7;
+	kCGBlendModeSoftLight = 8;
+	kCGBlendModeHardLight = 9;
+	kCGBlendModeDifference = 10;
+	kCGBlendModeExclusion = 11;
+	kCGBlendModeHue = 12;
+	kCGBlendModeSaturation = 13;
+	kCGBlendModeColor = 14;
+	kCGBlendModeLuminosity = 15; { Available in Mac OS X 10.4 & later. }
+
+
+{ Return the CFTypeID for CGContextRefs. }
+
+function CGContextGetTypeID: CFTypeID; external name '_CGContextGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{* Graphics state functions. *}
+
+{ Push a copy of the current graphics state onto the graphics state
+ * stack. Note that the path is not considered part of the gstate, and is
+ * not saved. }
+
+procedure CGContextSaveGState( c: CGContextRef ); external name '_CGContextSaveGState';
+
+{ Restore the current graphics state from the one on the top of the
+ * graphics state stack, popping the graphics state stack in the
+ * process. }
+
+procedure CGContextRestoreGState( c: CGContextRef ); external name '_CGContextRestoreGState';
+
+{* Coordinate space transformations. *}
+
+{ Scale the current graphics state's transformation matrix (the CTM) by
+ * `(sx, sy)'. }
+
+procedure CGContextScaleCTM( c: CGContextRef; sx: Float32; sy: Float32 ); external name '_CGContextScaleCTM';
+
+{ Translate the current graphics state's transformation matrix (the CTM)
+ * by `(tx, ty)'. }
+
+procedure CGContextTranslateCTM( c: CGContextRef; tx: Float32; ty: Float32 ); external name '_CGContextTranslateCTM';
+
+{ Rotate the current graphics state's transformation matrix (the CTM) by
+ * `angle' radians. }
+
+procedure CGContextRotateCTM( c: CGContextRef; angle: Float32 ); external name '_CGContextRotateCTM';
+
+{ Concatenate the current graphics state's transformation matrix (the CTM)
+ * with the affine transform `transform'. }
+
+procedure CGContextConcatCTM( c: CGContextRef; transform: CGAffineTransform ); external name '_CGContextConcatCTM';
+
+{ Return the current graphics state's transformation matrix. }
+
+function CGContextGetCTM( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetCTM';
+
+{* Drawing attribute functions. *}
+
+{ Set the line width in the current graphics state to `width'. }
+
+procedure CGContextSetLineWidth( c: CGContextRef; width: Float32 ); external name '_CGContextSetLineWidth';
+
+{ Set the line cap in the current graphics state to `cap'. }
+
+procedure CGContextSetLineCap( c: CGContextRef; cap: CGLineCap ); external name '_CGContextSetLineCap';
+
+{ Set the line join in the current graphics state to `join'. }
+
+procedure CGContextSetLineJoin( c: CGContextRef; join: CGLineJoin ); external name '_CGContextSetLineJoin';
+
+{ Set the miter limit in the current graphics state to `limit'. }
+
+procedure CGContextSetMiterLimit( c: CGContextRef; limit: Float32 ); external name '_CGContextSetMiterLimit';
+
+{ Set the line dash patttern in the current graphics state of `c'. }
+
+procedure CGContextSetLineDash( c: CGContextRef; phase: Float32; {const} lengths: {variable-size-array} Float32Ptr; count: size_t ); external name '_CGContextSetLineDash';
+
+{ Set the path flatness parameter in the current graphics state of `c' to
+ * `flatness'. }
+
+procedure CGContextSetFlatness( c: CGContextRef; flatness: Float32 ); external name '_CGContextSetFlatness';
+
+{ Set the alpha value in the current graphics state of `c' to `alpha'. }
+
+procedure CGContextSetAlpha( c: CGContextRef; alpha: Float32 ); external name '_CGContextSetAlpha';
+
+{ Set the blend mode of `context' to `mode'. }
+
+procedure CGContextSetBlendMode( context: CGContextRef; mode: CGBlendMode ); external name '_CGContextSetBlendMode'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{* Path construction functions. *}
+
+{ Note that a context has a single path in use at any time: a path is not
+ * part of the graphics state. }
+
+{ Begin a new path.  The old path is discarded. }
+
+procedure CGContextBeginPath( c: CGContextRef ); external name '_CGContextBeginPath';
+
+{ Start a new subpath at point `(x, y)' in the context's path. }
+
+procedure CGContextMoveToPoint( c: CGContextRef; x: Float32; y: Float32 ); external name '_CGContextMoveToPoint';
+
+{ Append a straight line segment from the current point to `(x, y)'. }
+
+procedure CGContextAddLineToPoint( c: CGContextRef; x: Float32; y: Float32 ); external name '_CGContextAddLineToPoint';
+
+{ Append a cubic Bezier curve from the current point to `(x,y)', with
+ * control points `(cp1x, cp1y)' and `(cp2x, cp2y)'. }
+
+procedure CGContextAddCurveToPoint( c: CGContextRef; cp1x: Float32; cp1y: Float32; cp2x: Float32; cp2y: Float32; x: Float32; y: Float32 ); external name '_CGContextAddCurveToPoint';
+
+{ Append a quadratic curve from the current point to `(x, y)', with
+ * control point `(cpx, cpy)'. }
+
+procedure CGContextAddQuadCurveToPoint( c: CGContextRef; cpx: Float32; cpy: Float32; x: Float32; y: Float32 ); external name '_CGContextAddQuadCurveToPoint';
+
+{ Close the current subpath of the context's path. }
+
+procedure CGContextClosePath( c: CGContextRef ); external name '_CGContextClosePath';
+
+{* Path construction convenience functions. *}
+
+{ Add a single rect to the context's path. }
+
+procedure CGContextAddRect( c: CGContextRef; rect: CGRect ); external name '_CGContextAddRect';
+
+{ Add a set of rects to the context's path. }
+
+procedure CGContextAddRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextAddRects';
+
+{ Add a set of lines to the context's path. }
+
+procedure CGContextAddLines( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextAddLines';
+
+{ Add an ellipse inside `rect' to the current path of `context'.  See the
+ * function `CGPathAddEllipseInRect' for more information on how the path
+ * for the ellipse is constructed. }
+
+procedure CGContextAddEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextAddEllipseInRect'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Add an arc of a circle to the context's path, possibly preceded by a
+ * straight line segment.  `(x, y)' is the center of the arc; `radius' is
+ * its radius; `startAngle' is the angle to the first endpoint of the arc;
+ * `endAngle' is the angle to the second endpoint of the arc; and
+ * `clockwise' is 1 if the arc is to be drawn clockwise, 0 otherwise.
+ * `startAngle' and `endAngle' are measured in radians. }
+
+procedure CGContextAddArc( c: CGContextRef; x: Float32; y: Float32; radius: Float32; startAngle: Float32; endAngle: Float32; clockwise: SInt32 ); external name '_CGContextAddArc';
+
+{ Add an arc of a circle to the context's path, possibly preceded by a
+ * straight line segment.  `radius' is the radius of the arc.  The arc is
+ * tangent to the line from the current point to `(x1, y1)', and the line
+ * from `(x1, y1)' to `(x2, y2)'. }
+
+procedure CGContextAddArcToPoint( c: CGContextRef; x1: Float32; y1: Float32; x2: Float32; y2: Float32; radius: Float32 ); external name '_CGContextAddArcToPoint';
+
+{ Add `path' to the path of context.  The points in `path' are transformed
+ * by the CTM of context before they are added. }
+
+procedure CGContextAddPath( context: CGContextRef; path: CGPathRef ); external name '_CGContextAddPath'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{* Path stroking. *}
+
+{ Replace the path in context with the stroked version of the path, using
+ * the parameters of `context' to calculate the stroked path.  The
+ * resulting path is created such that filling it with the appropriate
+ * color will produce the same results as stroking the original path. You
+ * can use this path in the same way you can use the path of any context;
+ * for example, you can clip to the stroked version of a path by calling
+ * this function followed by a call to "CGContextClipPath". }
+
+procedure CGContextReplacePathWithStrokedPath( c: CGContextRef ); external name '_CGContextReplacePathWithStrokedPath'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{* Path information functions. *}
+
+{ Return true if the context's path contains no elements, false otherwise. }
+
+function CGContextIsPathEmpty( c: CGContextRef ): CBool; external name '_CGContextIsPathEmpty';
+
+{ Return the current point of the current subpath of the context's
+ * path. }
+
+function CGContextGetPathCurrentPoint( c: CGContextRef ): CGPoint; external name '_CGContextGetPathCurrentPoint';
+
+{ Return the bounding box of the context's path.  The bounding box is the
+ * smallest rectangle completely enclosing all points in the path,
+ * including control points for Bezier and quadratic curves. }
+
+function CGContextGetPathBoundingBox( c: CGContextRef ): CGRect; external name '_CGContextGetPathBoundingBox';
+
+{ Return true if `point' is contained in the current path of `context'.  A
+ * point is contained within a context's path if it is inside the painted
+ * region when the path is stroked or filled with opaque colors using the
+ * path drawing mode `mode'.  `point' is specified is user space. }
+
+function CGContextPathContainsPoint( context: CGContextRef; point: CGPoint; mode: CGPathDrawingMode ): CBool; external name '_CGContextPathContainsPoint'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{* Path drawing functions. *}
+
+{ Draw the context's path using drawing mode `mode'. }
+
+procedure CGContextDrawPath( c: CGContextRef; mode: CGPathDrawingMode ); external name '_CGContextDrawPath';
+
+{* Path drawing convenience functions. *}
+
+{ Fill the context's path using the winding-number fill rule.  Any open
+ * subpath of the path is implicitly closed. }
+
+procedure CGContextFillPath( c: CGContextRef ); external name '_CGContextFillPath';
+
+{ Fill the context's path using the even-odd fill rule.  Any open subpath
+ * of the path is implicitly closed. }
+
+procedure CGContextEOFillPath( c: CGContextRef ); external name '_CGContextEOFillPath';
+
+{ Stroke the context's path. }
+
+procedure CGContextStrokePath( c: CGContextRef ); external name '_CGContextStrokePath';
+
+{ Fill `rect' with the current fill color. }
+
+procedure CGContextFillRect( c: CGContextRef; rect: CGRect ); external name '_CGContextFillRect';
+
+{ Fill `rects', an array of `count' CGRects, with the current fill
+ * color. }
+
+procedure CGContextFillRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextFillRects';
+
+{ Stroke `rect' with the current stroke color and the current linewidth. }
+
+procedure CGContextStrokeRect( c: CGContextRef; rect: CGRect ); external name '_CGContextStrokeRect';
+
+{ Stroke `rect' with the current stroke color, using `width' as the the
+ * line width. }
+
+procedure CGContextStrokeRectWithWidth( c: CGContextRef; rect: CGRect; width: Float32 ); external name '_CGContextStrokeRectWithWidth';
+
+{ Clear `rect' (that is, set the region within the rect to
+ * transparent). }
+
+procedure CGContextClearRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClearRect';
+
+{ Fill an ellipse (an oval) inside `rect'. }
+
+procedure CGContextFillEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextFillEllipseInRect'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Stroke an ellipse (an oval) inside `rect'. }
+
+procedure CGContextStrokeEllipseInRect( context: CGContextRef; rect: CGRect ); external name '_CGContextStrokeEllipseInRect'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Stroke a sequence of line segments one after another in `context'.  The
+ * line segments are specified by `points', an array of `count' CGPoints.
+ * This function is equivalent to
+ *   CGContextBeginPath(context);
+ *   for (k = 0; k < count; k += 2) begin
+ *       CGContextMoveToPoint(context, s[k].x, s[k].y);
+ *       CGContextAddLineToPoint(context, s[k+1].x, s[k+1].y);
+ *   end;
+ *   CGContextStrokePath(context);
+ }
+
+procedure CGContextStrokeLineSegments( c: CGContextRef; {const} points: {variable-size-array} CGPointPtr; count: size_t ); external name '_CGContextStrokeLineSegments'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{* Clipping functions. *}
+
+{ Intersect the context's path with the current clip path and use the
+ * resulting path as the clip path for subsequent rendering operations.
+ * Use the winding-number fill rule for deciding what's inside the path. }
+
+procedure CGContextClip( c: CGContextRef ); external name '_CGContextClip';
+
+{ Intersect the context's path with the current clip path and use the
+ * resulting path as the clip path for subsequent rendering operations.
+ * Use the even-odd fill rule for deciding what's inside the path. }
+
+procedure CGContextEOClip( c: CGContextRef ); external name '_CGContextEOClip';
+
+{ Add `mask' transformed to `rect' to the clipping area of `context'.  The
+ * mask, which may be either an image mask or an image, is mapped into the
+ * specified rectangle and intersected with the current clipping area of
+ * the context.
+ *
+ * If `mask' is an image mask, then it clips in a manner identical to the
+ * behavior if it were used with "CGContextDrawImage": it indicates an area
+ * to be masked out (left unchanged) when drawing.  The source samples of
+ * the image mask determine which points of the clipping area are changed,
+ * acting as an "inverse alpha": if the value of a source sample in the
+ * image mask is S, then the corresponding point in the current clipping
+ * area will be multiplied by an alpha of (1-S).  (For example, if S is 1,
+ * then the point in the clipping area becomes clear, while if S is 0, the
+ * point in the clipping area is unchanged.
+ *
+ * If `mask' is an image, then it serves as alpha mask and is blended with
+ * the current clipping area.  The source samples of mask determine which
+ * points of the clipping area are changed: if the value of the source
+ * sample in mask is S, then the corresponding point in the current
+ * clipping area will be multiplied by an alpha of S.  (For example, if S
+ * is 0, then the point in the clipping area becomes clear, while if S is
+ * 1, the point in the clipping area is unchanged.
+ *
+ * If `mask' is an image, then it must be in the DeviceGray color space,
+ * may not have alpha, and may not be masked by an image mask or masking
+ * color. }
+
+procedure CGContextClipToMask( c: CGContextRef; rect: CGRect; mask: CGImageRef ); external name '_CGContextClipToMask';
+
+{ Return the bounding box of the clip path of `c' in user space.  The
+ * bounding box is the smallest rectangle completely enclosing all points
+ * in the clip. }
+
+function CGContextGetClipBoundingBox( c: CGContextRef ): CGRect; external name '_CGContextGetClipBoundingBox'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{* Clipping convenience functions. *}
+
+{ Intersect the current clipping path with `rect'.  Note that this
+ * function resets the context's path to the empty path. }
+
+procedure CGContextClipToRect( c: CGContextRef; rect: CGRect ); external name '_CGContextClipToRect';
+
+{ Intersect the current clipping path with the clipping region formed by
+ * creating a path consisting of all rects in `rects'.  Note that this
+ * function resets the context's path to the empty path. }
+
+procedure CGContextClipToRects( c: CGContextRef; {const} rects: {variable-size-array} CGRectPtr; count: size_t ); external name '_CGContextClipToRects';
+
+{* Primitive color functions. *}
+
+{ Set the current fill color in the context `c' to `color'. }
+
+procedure CGContextSetFillColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetFillColorWithColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Set the current stroke color in the context `c' to `color'. }
+
+procedure CGContextSetStrokeColorWithColor( c: CGContextRef; color: CGColorRef ); external name '_CGContextSetStrokeColorWithColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{* Colorspace functions. *}
+
+{ Set the current fill colorspace in the context `c' to `colorspace'.  As
+ * a side-effect, set the fill color to a default value appropriate for the
+ * colorspace. }
+
+procedure CGContextSetFillColorSpace( c: CGContextRef; colorspace: CGColorSpaceRef ); external name '_CGContextSetFillColorSpace';
+
+{ Set the current stroke colorspace in the context `c' to `colorspace'.
+ * As a side-effect, set the stroke color to a default value appropriate
+ * for the colorspace. }
+
+procedure CGContextSetStrokeColorSpace( c: CGContextRef; colorspace: CGColorSpaceRef ); external name '_CGContextSetStrokeColorSpace';
+
+{* Color functions. *}
+
+{ Set the components of the current fill color in the context `c' to the
+ * values specifed by `components'.  The number of elements in `components'
+ * must be one greater than the number of components in the current fill
+ * colorspace (N color components + 1 alpha component).  The current fill
+ * colorspace must not be a pattern colorspace. }
+
+procedure CGContextSetFillColor( c: CGContextRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetFillColor';
+
+{ Set the components of the current stroke color in the context `c' to the
+ * values specifed by `components'.  The number of elements in `components'
+ * must be one greater than the number of components in the current stroke
+ * colorspace (N color components + 1 alpha component).  The current stroke
+ * colorspace must not be a pattern colorspace. }
+
+procedure CGContextSetStrokeColor( c: CGContextRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetStrokeColor';
+
+{* Pattern functions. *}
+
+{ Set the components of the current fill color in the context `c' to the
+ * values specifed by `components', and set the current fill pattern to
+ * `pattern'.  The number of elements in `components' must be one greater
+ * than the number of components in the current fill colorspace (N color
+ * components + 1 alpha component).  The current fill colorspace must be a
+ * pattern colorspace. }
+
+procedure CGContextSetFillPattern( c: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetFillPattern';
+
+{ Set the components of the current stroke color in the context `c' to the
+ * values specifed by `components', and set the current stroke pattern to
+ * `pattern'.  The number of elements in `components' must be one greater
+ * than the number of components in the current stroke colorspace (N color
+ * components + 1 alpha component).  The current stroke colorspace must be
+ * a pattern colorspace. }
+
+procedure CGContextSetStrokePattern( c: CGContextRef; pattern: CGPatternRef; {const} components: {variable-size-array} Float32Ptr ); external name '_CGContextSetStrokePattern';
+
+{ Set the pattern phase in the current graphics state of the context `c'
+ * to `phase'. }
+
+procedure CGContextSetPatternPhase( c: CGContextRef; phase: CGSize ); external name '_CGContextSetPatternPhase';
+
+{* Color convenience functions. *}
+
+{ Set the current fill colorspace in the context `c' to `DeviceGray' and
+ * set the components of the current fill color to `(gray, alpha)'. }
+
+procedure CGContextSetGrayFillColor( c: CGContextRef; gray: Float32; alpha: Float32 ); external name '_CGContextSetGrayFillColor';
+
+{ Set the current stroke colorspace in the context `c' to `DeviceGray' and
+ * set the components of the current stroke color to `(gray, alpha)'. }
+
+procedure CGContextSetGrayStrokeColor( c: CGContextRef; gray: Float32; alpha: Float32 ); external name '_CGContextSetGrayStrokeColor';
+
+{ Set the current fill colorspace in the context `c' to `DeviceRGB' and
+ * set the components of the current fill color to `(red, green, blue,
+ * alpha)'. }
+
+procedure CGContextSetRGBFillColor( c: CGContextRef; red: Float32; green: Float32; blue: Float32; alpha: Float32 ); external name '_CGContextSetRGBFillColor';
+
+{ Set the current stroke colorspace in the context `c' to `DeviceRGB' and
+ * set the components of the current stroke color to `(red, green, blue,
+ * alpha)'. }
+
+procedure CGContextSetRGBStrokeColor( c: CGContextRef; red: Float32; green: Float32; blue: Float32; alpha: Float32 ); external name '_CGContextSetRGBStrokeColor';
+
+{ Set the current fill colorspace in the context `c' to `DeviceCMYK' and
+ * set the components of the current fill color to `(cyan, magenta, yellow,
+ * black, alpha)'. }
+
+procedure CGContextSetCMYKFillColor( c: CGContextRef; cyan: Float32; magenta: Float32; yellow: Float32; black: Float32; alpha: Float32 ); external name '_CGContextSetCMYKFillColor';
+
+{ Set the current stroke colorspace in the context `c' to `DeviceCMYK' and
+ * set the components of the current stroke color to `(cyan, magenta,
+ * yellow, black, alpha)'. }
+
+procedure CGContextSetCMYKStrokeColor( c: CGContextRef; cyan: Float32; magenta: Float32; yellow: Float32; black: Float32; alpha: Float32 ); external name '_CGContextSetCMYKStrokeColor';
+
+{* Rendering intent. *}
+
+{ Set the rendering intent in the current graphics state of context `c' to
+ * `intent'. }
+
+procedure CGContextSetRenderingIntent( c: CGContextRef; intent: CGColorRenderingIntent ); external name '_CGContextSetRenderingIntent';
+
+{* Image functions. *}
+
+{ Draw `image' in the rectangular area specified by `rect' in the context
+ * `c'.  The image is scaled, if necessary, to fit into `rect'. }
+
+procedure CGContextDrawImage( c: CGContextRef; rect: CGRect; image: CGImageRef ); external name '_CGContextDrawImage';
+
+{ Return the interpolation quality for image rendering of the context `c'.
+ * The interpolation quality is a gstate-parameter which controls the level
+ * of interpolation performed when an image is interpolated (for example,
+ * when scaling the image). Note that it is merely a hint to the context:
+ * not all contexts support all interpolation quality levels. }
+
+function CGContextGetInterpolationQuality( c: CGContextRef ): CGInterpolationQuality; external name '_CGContextGetInterpolationQuality';
+
+{ Set the interpolation quality of the context `c' to `quality'. }
+
+procedure CGContextSetInterpolationQuality( c: CGContextRef; quality: CGInterpolationQuality ); external name '_CGContextSetInterpolationQuality';
+
+{* Shadow support. *}
+
+{ Set the shadow parameters in `context'.  `offset' specifies a
+ * translation in base-space; `blur' is a non-negative number specifying
+ * the amount of blur; `color' specifies the color of the shadow, which may
+ * contain a non-opaque alpha value.  If `color' is NULL, it's equivalent
+ * to specifying a fully transparent color.  The shadow is a gstate
+ * parameter. After a shadow is specified, all objects drawn subsequently
+ * will be shadowed.  To turn off shadowing, set the shadow color to a
+ * fully transparent color (or pass NULL as the color), or use the standard
+ * gsave/grestore mechanism. }
+
+procedure CGContextSetShadowWithColor( context: CGContextRef; offset: CGSize; blur: Float32; color: CGColorRef ); external name '_CGContextSetShadowWithColor'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ Equivalent to calling
+ *   CGContextSetShadowWithColor(context, offset, blur, color)
+ * where color is black with 1/3 alpha (i.e., RGBA = (0, 0, 0, 1.0/3.0)) in
+ * the DeviceRGB colorspace. }
+
+procedure CGContextSetShadow( context: CGContextRef; offset: CGSize; blur: Float32 ); external name '_CGContextSetShadow'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{* Shading functions. *}
+
+{ Fill the current clipping region of `c' with `shading'. }
+
+procedure CGContextDrawShading( c: CGContextRef; shading: CGShadingRef ); external name '_CGContextDrawShading'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{* Text functions. *}
+
+{ Set the current character spacing in the context `c' to `spacing'.  The
+ * character spacing is added to the displacement between the origin of one
+ * character and the origin of the next. }
+
+procedure CGContextSetCharacterSpacing( c: CGContextRef; spacing: Float32 ); external name '_CGContextSetCharacterSpacing';
+
+{ Set the user-space point at which text will be drawn in the context `c'
+ * to `(x, y)'. }
+
+procedure CGContextSetTextPosition( c: CGContextRef; x: Float32; y: Float32 ); external name '_CGContextSetTextPosition';
+
+{ Return the user-space point at which text will be drawn in the context
+ * `c'. }
+
+function CGContextGetTextPosition( c: CGContextRef ): CGPoint; external name '_CGContextGetTextPosition';
+
+{ Set the text matrix in the context `c' to `t'. }
+
+procedure CGContextSetTextMatrix( c: CGContextRef; t: CGAffineTransform ); external name '_CGContextSetTextMatrix';
+
+{ Return the text matrix in the context `c'. }
+
+function CGContextGetTextMatrix( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetTextMatrix';
+
+{ Set the text drawing mode in the current graphics state of the context
+ * `c' to `mode'. }
+
+procedure CGContextSetTextDrawingMode( c: CGContextRef; mode: CGTextDrawingMode ); external name '_CGContextSetTextDrawingMode';
+
+{ Set the font in the current graphics state of the context `c' to
+ * `font'. }
+
+procedure CGContextSetFont( c: CGContextRef; font: CGFontRef ); external name '_CGContextSetFont';
+
+{ Set the font size in the current graphics state of the context `c' to
+ * `size'. }
+
+procedure CGContextSetFontSize( c: CGContextRef; size: Float32 ); external name '_CGContextSetFontSize';
+
+{ Attempts to find the font named `name' and, if successful, sets it as
+ * the font in the current graphics state of `c' and sets the font size in
+ * the current graphics state to `size'. `textEncoding' specifies how to
+ * translate from bytes to glyphs when displaying text. }
+
+procedure CGContextSelectFont( c: CGContextRef; name: ConstCStringPtr; size: Float32; textEncoding: CGTextEncoding ); external name '_CGContextSelectFont';
+
+{ Draw `string', a string of `length' bytes, at the point specified by the
+ * text matrix in the context `c'.  Each byte of the string is mapped
+ * through the encoding vector of the current font to obtain the glyph to
+ * display. }
+
+procedure CGContextShowText( c: CGContextRef; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowText';
+
+{ Draw the glyphs pointed to by `g', an array of `count' glyphs, at the
+ * point specified by the text matrix in the context `c'. }
+
+procedure CGContextShowGlyphs( c: CGContextRef; {const} g: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphs';
+
+{ Draw `glyphs', an array of `count' CGGlyphs, at the current point
+ * specified by the text matrix.  Each element of `advances' specifies the
+ * offset from the previous glyph's origin to the origin of the associated
+ * glyph; the advances are specified in user space. }
+
+procedure CGContextShowGlyphsWithAdvances( c: CGContextRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} advances: {variable-size-array} CGSizePtr; count: size_t ); external name '_CGContextShowGlyphsWithAdvances'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{* Text convenience functions. *}
+
+{ Draw `string', a string of `length' bytes, at the point `(x, y)',
+ * specified in user space, in the context `c'.  Each byte of the string is
+ * mapped through the encoding vector of the current font to obtain the
+ * glyph to display. }
+
+procedure CGContextShowTextAtPoint( c: CGContextRef; x: Float32; y: Float32; strng: ConstCStringPtr; length: size_t ); external name '_CGContextShowTextAtPoint';
+
+{ Display the glyphs pointed to by `glyphs', an array of `count' glyphs,
+ * at at the point `(x, y)', specified in user space, in the context
+ * `c'. }
+
+procedure CGContextShowGlyphsAtPoint( c: CGContextRef; x: Float32; y: Float32; {const} glyphs: {variable-size-array} CGGlyphPtr; count: size_t ); external name '_CGContextShowGlyphsAtPoint';
+
+{* PDF functions. *}
+
+{ Draw `page' in the current user space of the context `c'. }
+
+procedure CGContextDrawPDFPage( c: CGContextRef; page: CGPDFPageRef ); external name '_CGContextDrawPDFPage'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ DEPRECATED; use the CGPDFPage API instead.
+ * Draw `page' in `document' in the rectangular area specified by `rect' in
+ * the context `c'.  The media box of the page is scaled, if necessary, to
+ * fit into `rect'. }
+
+procedure CGContextDrawPDFDocument( c: CGContextRef; rect: CGRect; document: CGPDFDocumentRef; page: SInt32 ); external name '_CGContextDrawPDFDocument';
+
+{* Output page functions. *}
+
+{ Begin a new page. }
+
+procedure CGContextBeginPage( c: CGContextRef; const (*var*) mediaBox: CGRect ); external name '_CGContextBeginPage';
+
+{ End the current page. }
+
+procedure CGContextEndPage( c: CGContextRef ); external name '_CGContextEndPage';
+
+{* Context functions. *}
+
+{ Equivalent to `CFRetain(c)'. }
+
+function CGContextRetain( c: CGContextRef ): CGContextRef; external name '_CGContextRetain';
+
+{ Equivalent to `CFRelease(c)'. }
+
+procedure CGContextRelease( c: CGContextRef ); external name '_CGContextRelease';
+
+{ Flush all drawing to the destination. }
+
+procedure CGContextFlush( c: CGContextRef ); external name '_CGContextFlush';
+
+{ Synchronized drawing. }
+
+procedure CGContextSynchronize( c: CGContextRef ); external name '_CGContextSynchronize';
+
+{* Antialiasing functions. *}
+
+{ Turn on antialiasing if `shouldAntialias' is true; turn it off
+ * otherwise.  This parameter is part of the graphics state. }
+
+procedure CGContextSetShouldAntialias( c: CGContextRef; shouldAntialias: CBool ); external name '_CGContextSetShouldAntialias';
+
+{ Allow antialiasing in context `c' if `allowsAntialiasing' is true; don't
+ * allow it otherwise. This parameter is not part of the graphics state. A
+ * context will perform antialiasing if both `allowsAntialiasing' and the
+ * graphics state parameter `shouldAntialias' are true. }
+
+procedure CGContextSetAllowsAntialiasing( context: CGContextRef; allowsAntialiasing: CBool ); external name '_CGContextSetAllowsAntialiasing'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{* Font smoothing functions. *}
+
+{ Turn on font smoothing if `shouldSmoothFonts' is true; turn it off
+ * otherwise.  This parameter is part of the graphics state. Note that this
+ * doesn't guarantee that font smoothing will occur: not all destination
+ * contexts support font smoothing. }
+
+procedure CGContextSetShouldSmoothFonts( c: CGContextRef; shouldSmoothFonts: CBool ); external name '_CGContextSetShouldSmoothFonts'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{* Transparency layer support. *}
+
+{ Begin a transparency layer.  All subsequent drawing operations until a
+ * corresponding CGContextEndTransparencyLayer are composited into a fully
+ * transparent backdrop (which is treated as a separate destination buffer
+ * from the context); after a call to CGContextEndTransparencyLayer, the
+ * result is composited into the context using the global alpha and shadow
+ * state of the context.  This operation respects the clipping region of
+ * the context.  After a call to this function, all of the parameters in
+ * the graphics state remain unchanged with the exception of the following:
+ *   The global alpha is set to 1.
+ *   The shadow is turned off.
+ * Ending the transparency layer restores these parameters to the values
+ * they had before CGContextBeginTransparencyLayer was called.
+ * Transparency layers may be nested. }
+
+procedure CGContextBeginTransparencyLayer( context: CGContextRef; auxiliaryInfo: CFDictionaryRef ); external name '_CGContextBeginTransparencyLayer'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{ End a tranparency layer. }
+
+procedure CGContextEndTransparencyLayer( context: CGContextRef ); external name '_CGContextEndTransparencyLayer'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{* User space to device space tranformations. *}
+
+{ Return the affine transform mapping the user space (abstract
+ * coordinates) of `context' to device space (pixels). }
+
+function CGContextGetUserSpaceToDeviceSpaceTransform( c: CGContextRef ): CGAffineTransform; external name '_CGContextGetUserSpaceToDeviceSpaceTransform'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `point' from the user space of `context' to device space. }
+
+function CGContextConvertPointToDeviceSpace( c: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToDeviceSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `point' from device space to the user space of `context'. }
+
+function CGContextConvertPointToUserSpace( c: CGContextRef; point: CGPoint ): CGPoint; external name '_CGContextConvertPointToUserSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `size' from the user space of `context' to device space. }
+
+function CGContextConvertSizeToDeviceSpace( c: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToDeviceSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `size' from device space to the user space of `context'. }
+
+function CGContextConvertSizeToUserSpace( c: CGContextRef; size: CGSize ): CGSize; external name '_CGContextConvertSizeToUserSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `rect' from the user space of `context' to device space. Since
+ * affine transforms do not preserve rectangles in general, this function
+ * returns the smallest rectangle which contains the transformed corner
+ * points of `rect'. }
+
+function CGContextConvertRectToDeviceSpace( c: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToDeviceSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Transform `rect' from device space to the user space of `context'. Since
+ * affine transforms do not preserve rectangles in general, this function
+ * returns the smallest rectangle which contains the transformed corner
+ * points of `rect'. }
+
+function CGContextConvertRectToUserSpace( c: CGContextRef; rect: CGRect ): CGRect; external name '_CGContextConvertRectToUserSpace'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+
+end.

+ 152 - 0
packages/extra/univint/CGDataConsumer.pas

@@ -0,0 +1,152 @@
+{ CoreGraphics - CGDataConsumer.h
+ * Copyright (c) 1999-2004 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGDataConsumer;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData,CGBase,CFURL;
+{$ALIGN POWER}
+
+
+type
+	CGDataConsumerRef = ^SInt32; { an opaque 32-bit type }
+
+
+{ This callback is called to copy `count' bytes from `buffer' to the
+ * data consumer. }
+
+type
+	CGDataConsumerPutBytesCallback = function( info: UnivPtr; const (*var*) buffer: UnivPtr; count: size_t ): size_t;
+
+{ This callback is called to release the `info' pointer when the data
+ * provider is freed. }
+
+type
+	CGDataConsumerReleaseInfoCallback = procedure( info: UnivPtr );
+
+{ Callbacks for accessing data.
+ * `putBytes' copies `count' bytes from `buffer' to the consumer, and
+ * returns the number of bytes copied.  It should return 0 if no more data
+ * can be written to the consumer.
+ * `releaseConsumer', if non-NULL, is called when the consumer is freed. }
+
+type
+	CGDataConsumerCallbacks = record
+		putBytes: CGDataConsumerPutBytesCallback;
+		releaseConsumer: CGDataConsumerReleaseInfoCallback;
+	end;
+
+{ Return the CFTypeID for CGDataConsumerRefs. }
+
+function CGDataConsumerGetTypeID: CFTypeID; external name '_CGDataConsumerGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Create a data consumer using `callbacks' to handle the data.  `info' is
+ * passed to each of the callback functions. }
+
+function CGDataConsumerCreate( info: UnivPtr; const (*var*) callbacks: CGDataConsumerCallbacks ): CGDataConsumerRef; external name '_CGDataConsumerCreate';
+
+{ Create a data consumer which writes data to `url'. }
+
+function CGDataConsumerCreateWithURL( url: CFURLRef ): CGDataConsumerRef; external name '_CGDataConsumerCreateWithURL';
+
+{ Create a data consumer which writes to `data'. }
+
+function CGDataConsumerCreateWithCFData( data: CFMutableDataRef ): CGDataConsumerRef; external name '_CGDataConsumerCreateWithCFData'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Equivalent to `CFRetain(consumer)'. }
+
+function CGDataConsumerRetain( consumer: CGDataConsumerRef ): CGDataConsumerRef; external name '_CGDataConsumerRetain';
+
+{ Equivalent to `CFRelease(consumer)'. }
+
+procedure CGDataConsumerRelease( consumer: CGDataConsumerRef ); external name '_CGDataConsumerRelease';
+
+
+end.

+ 230 - 0
packages/extra/univint/CGDataProvider.pas

@@ -0,0 +1,230 @@
+{ CoreGraphics - CGDataProvider.h
+ * Copyright (c) 1999-2004 Apple Computer, Inc.
+ * All rights reserved.
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGDataProvider;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFData,CGBase,CFURL;
+{$ALIGN POWER}
+
+
+type
+	CGDataProviderRef = ^SInt32; { an opaque 32-bit type }
+
+
+{ This callback is called to copy `count' bytes from the sequential data
+ * stream to `buffer'. }
+
+type
+	CGDataProviderGetBytesCallback = function( info: UnivPtr; buffer: UnivPtr; count: size_t ): size_t;
+
+{ This callback is called to skip `count' bytes forward in the sequential
+ * data stream. }
+
+type
+	CGDataProviderSkipBytesCallback = procedure( info: UnivPtr; count: size_t );
+
+{ This callback is called to rewind to the beginning of sequential data
+ * stream. }
+
+type
+	CGDataProviderRewindCallback = procedure( info: UnivPtr );
+
+{ This callback is called to release the `info' pointer when the data
+ * provider is freed. }
+
+type
+	CGDataProviderReleaseInfoCallback = procedure( info: UnivPtr );
+
+{ Callbacks for sequentially accessing data.
+ * `getBytes' is called to copy `count' bytes from the sequential data
+ *   stream to `buffer'.  It should return the number of bytes copied, or 0
+ *   if there's no more data.
+ * `skipBytes' is called to skip ahead in the sequential data stream by
+ *   `count' bytes.
+ * `rewind' is called to rewind the sequential data stream to the beginning
+ *   of the data.
+ * `releaseProvider', if non-NULL, is called to release the `info' pointer
+ *   when the provider is freed. }
+
+type
+	CGDataProviderCallbacks = record
+		getBytes: CGDataProviderGetBytesCallback;
+		skipBytes: CGDataProviderSkipBytesCallback;
+		rewind: CGDataProviderRewindCallback;
+		releaseProvider: CGDataProviderReleaseInfoCallback;
+	end;
+
+{ This callback is called to get a pointer to the entire block of data. }
+
+type
+	CGDataProviderGetBytePointerCallback = function( info: UnivPtr ): UnivPtr;
+
+{ This callback is called to release the pointer to entire block of
+ * data. }
+
+type
+	CGDataProviderReleaseBytePointerCallback = procedure( info: UnivPtr; pointr: {const} UnivPtr );
+
+{ This callback is called to copy `count' bytes at byte offset `offset'
+ * into `buffer'. }
+
+type
+	CGDataProviderGetBytesAtOffsetCallback = function( info: UnivPtr; buffer: UnivPtr; offset: size_t; count: size_t ): size_t;
+
+{ Callbacks for directly accessing data.
+ * `getBytePointer', if non-NULL, is called to return a pointer to the
+ *   provider's entire block of data.
+ * `releaseBytePointer', if non-NULL, is called to release a pointer to
+ *   the provider's entire block of data.
+ * `getBytes', if non-NULL, is called to copy `count' bytes at offset
+ * `offset' from the provider's data to `buffer'.  It should return the
+ *   number of bytes copied, or 0 if there's no more data.
+ * `releaseProvider', if non-NULL, is called when the provider is freed.
+ *
+ * At least one of `getBytePointer' or `getBytes' must be non-NULL.  }
+
+type
+	CGDataProviderDirectAccessCallbacks = record
+		getBytePointer: CGDataProviderGetBytePointerCallback;
+		releaseBytePointer: CGDataProviderReleaseBytePointerCallback;
+		getBytes: CGDataProviderGetBytesAtOffsetCallback;
+		releaseProvider: CGDataProviderReleaseInfoCallback;
+	end;
+
+{ Return the CFTypeID for CGDataProviderRefs. }
+
+function CGDataProviderGetTypeID: CFTypeID; external name '_CGDataProviderGetTypeID'; (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
+
+{ Create a sequential-access data provider using `callbacks' to provide
+ * the data.  `info' is passed to each of the callback functions. }
+
+function CGDataProviderCreate( info: UnivPtr; const (*var*) callbacks: CGDataProviderCallbacks ): CGDataProviderRef; external name '_CGDataProviderCreate';
+
+{ Create a direct-access data provider using `callbacks' to supply `size'
+ * bytes of data. `info' is passed to each of the callback functions. }
+
+function CGDataProviderCreateDirectAccess( info: UnivPtr; size: size_t; const (*var*) callbacks: CGDataProviderDirectAccessCallbacks ): CGDataProviderRef; external name '_CGDataProviderCreateDirectAccess';
+
+{ The callback used by `CGDataProviderCreateWithData'. }
+
+type
+	CGDataProviderReleaseDataCallback = procedure( info: UnivPtr; data: {const} UnivPtr; size: size_t );
+
+{ Create a direct-access data provider using `data', an array of `size'
+ * bytes.  `releaseData' is called when the data provider is freed, and is
+ * passed `info' as its first argument. }
+
+function CGDataProviderCreateWithData( info: UnivPtr; data: {const} UnivPtr; size: size_t; releaseData: CGDataProviderReleaseDataCallback ): CGDataProviderRef; external name '_CGDataProviderCreateWithData';
+
+{ Create a direct-access data provider which reads from `data'. }
+
+function CGDataProviderCreateWithCFData( data: CFDataRef ): CGDataProviderRef; external name '_CGDataProviderCreateWithCFData'; (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
+
+{ Create a data provider using `url'. }
+
+function CGDataProviderCreateWithURL( url: CFURLRef ): CGDataProviderRef; external name '_CGDataProviderCreateWithURL';
+
+{ Equivalent to `CFRetain(provider)'. }
+
+function CGDataProviderRetain( provider: CGDataProviderRef ): CGDataProviderRef; external name '_CGDataProviderRetain';
+
+{ Equivalent to `CFRelease(provider)'. }
+
+procedure CGDataProviderRelease( provider: CGDataProviderRef ); external name '_CGDataProviderRelease';
+
+{* DEPRECATED FUNCTIONS *}
+
+{ Don't use this function; use CGDataProviderCreateWithURL instead. }
+
+function CGDataProviderCreateWithFilename( filename: ConstCStringPtr ): CGDataProviderRef; external name '_CGDataProviderCreateWithFilename';
+
+
+end.

+ 542 - 0
packages/extra/univint/CGDirectDisplay.pas

@@ -0,0 +1,542 @@
+{
+ *  CGDirectDisplay.h
+ *  CoreGraphics
+ *
+ *  Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGDirectDisplay;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CFBase,CFArray,CFDictionary,CGContext,CGBase,CGGeometry,CGErrors;
+{$ALIGN POWER}
+
+
+{
+ * The following construct is present to avoid problems with some Apple tools.
+ * API in this module is not available in Mac OS Classic variations!
+ }
+
+
+type
+	CGDirectDisplayID = ^SInt32; { an opaque 32-bit type }
+	CGDirectDisplayIDPtr = ^CGDirectDisplayID;  { when a var xx:CGDirectDisplayID parameter can be nil, it is changed to xx: CGDirectDisplayIDPtr }
+type
+	CGDirectPaletteRef = ^SInt32; { an opaque 32-bit type }
+	CGDirectPaletteRefPtr = ^CGDirectPaletteRef;  { when a var xx:CGDirectPaletteRef parameter can be nil, it is changed to xx: CGDirectPaletteRefPtr }
+type
+	CGDisplayCount = UInt32;
+type
+	CGTableCount = UInt32;
+type
+	CGDisplayCoord = SInt32;
+type
+	CGByteValue = UInt8;
+	CGByteValuePtr					= ^CGByteValue;
+type
+	CGOpenGLDisplayMask = UInt32;
+type
+	CGBeamPosition = UInt32;
+type
+	CGMouseDelta = SInt32;
+type
+	CGRefreshRate = double;
+type
+	CGCaptureOptions = UInt32;
+
+type
+	CGDisplayErr = CGError;
+
+const
+	CGDisplayNoErr				= kCGErrorSuccess;
+
+	kCGDirectMainDisplay		= nil;
+
+{ Returns the display ID of the current main display }
+function CGMainDisplayID: CGDirectDisplayID; external name '_CGMainDisplayID';
+
+{
+ * Mechanisms used to find screen IDs
+ * An array length (maxDisplays) and array of CGDirectDisplayIDs are passed in.
+ * Up to maxDisplays of the array are filled in with the displays meeting the
+ * specified criteria.  The actual number of displays filled in is returned in
+ * dspyCnt.
+ *
+ * If the dspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
+ * in with the number of displays meeting the function's requirements.
+ }
+function CGGetDisplaysWithPoint( point: CGPoint; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetDisplaysWithPoint';
+
+function CGGetDisplaysWithRect( rect: CGRect; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetDisplaysWithRect';
+
+function CGGetDisplaysWithOpenGLDisplayMask( mask: CGOpenGLDisplayMask; maxDisplays: CGDisplayCount; dspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetDisplaysWithOpenGLDisplayMask';
+                            
+{
+ * Get lists of displays.  Use this to determine display IDs
+ *
+ * If the activeDspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
+ * in with the number of displays meeting the function's requirements.
+ *
+ * The first display returned in the list is the main display,
+ * the one with the menu bar.
+ * When mirroring, this will be the largest drawable display in the mirror,
+ * set, or if all are the same size, the one with the deepest pixel depth.
+ }
+function CGGetActiveDisplayList( maxDisplays: CGDisplayCount; activeDspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetActiveDisplayList';
+
+{
+ * With hardware mirroring, a display may be on-line,
+ * but not necessarily active, or drawable.
+ * Programs which manipulate display settings such as the
+ * palette or gamma tables need access to all displays in use,
+ * including hardware mirrors which are not drawable.
+ }
+function CGGetOnlineDisplayList( maxDisplays: CGDisplayCount; onlineDspys: CGDirectDisplayIDPtr; var dspyCnt: CGDisplayCount ): CGDisplayErr; external name '_CGGetOnlineDisplayList';
+
+{ Map a display to an OpenGL display mask; returns 0 on invalid display }
+function CGDisplayIDToOpenGLDisplayMask( display: CGDirectDisplayID ): CGOpenGLDisplayMask; external name '_CGDisplayIDToOpenGLDisplayMask';
+
+{
+ * Map an OpenGL display mask to a display.
+ * Returns kCGNullDirectDisplay if a bit doesn't
+ * match a display.
+ * Passing in multiple bits results in an arbitrary match. 
+ }
+function CGOpenGLDisplayMaskToDisplayID( mask: CGOpenGLDisplayMask ): CGDirectDisplayID; external name '_CGOpenGLDisplayMaskToDisplayID';
+
+{ Return screen size and origin in global coords; Empty rect if display is invalid }
+function CGDisplayBounds( display: CGDirectDisplayID ): CGRect; external name '_CGDisplayBounds';
+
+function CGDisplayPixelsWide( display: CGDirectDisplayID ): size_t; external name '_CGDisplayPixelsWide';
+function CGDisplayPixelsHigh( display: CGDirectDisplayID ): size_t; external name '_CGDisplayPixelsHigh';
+
+{
+ * Display mode selection
+ * Display modes are represented as CFDictionaries
+ * All dictionaries and arrays returned via these mechanisms are
+ * owned by the framework and should not be released.  The framework
+ * will not release them out from under your application.
+ *
+ * Values associated with the following keys are CFNumber types.
+ * With CFNumberGetValue(), use kCFNumberLongType for best results.
+ * kCGDisplayRefreshRate encodes a double value, so to get the fractional
+ * refresh rate use kCFNumberDoubleType.
+ }
+ 
+{
+ * Keys used in mode dictionaries.  Source C strings shown won't change.
+ * Some CFM environments cannot import data variables, and so
+ * the definitions are provided directly.
+ *
+ * These keys are used only within the scope of the mode dictionaries,
+ * so further uniquing, as by prefix, of the source string is not needed.
+ }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayWidth CFSTRP('Width')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayHeight CFSTRP('Height')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayMode CFSTRP('Mode')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayBitsPerPixel CFSTRP('BitsPerPixel')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayBitsPerSample CFSTRP('BitsPerSample')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplaySamplesPerPixel CFSTRP('SamplesPerPixel')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayRefreshRate CFSTRP('RefreshRate')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayModeUsableForDesktopGUI CFSTRP('UsableForDesktopGUI')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayIOFlags CFSTRP('IOFlags')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayBytesPerRow CFSTRP('kCGDisplayBytesPerRow')}
+{$endc}
+
+{
+ * Keys to describe optional properties of display modes.
+ *
+ * The key will only be present if the property applies,
+ * and will be associated with a value of kCFBooleanTrue.
+ * Keys not relevant to a particular display mode will not
+ * appear in the mode dictionary.
+ *
+ * These strings must remain unchanged in future releases, of course.
+ }
+
+{ Set if display mode doesn't need a confirmation dialog to be set }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayModeIsSafeForHardware CFSTRP('kCGDisplayModeIsSafeForHardware')}
+{$endc}
+
+{ The following keys reflect interesting bits of the IOKit display mode flags }
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayModeIsInterlaced CFSTRP('kCGDisplayModeIsInterlaced')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayModeIsStretched CFSTRP('kCGDisplayModeIsStretched')}
+{$endc}
+{$ifc USE_CFSTR_CONSTANT_MACROS}
+{$definec kCGDisplayModeIsTelevisionOutput CFSTRP('kCGDisplayModeIsTelevisionOutput')}
+{$endc}
+
+
+{
+ * Return a CFArray of CFDictionaries describing all display modes.
+ * Returns NULL if the display is invalid.
+ }
+function CGDisplayAvailableModes( display: CGDirectDisplayID ): CFArrayRef; external name '_CGDisplayAvailableModes';
+{
+ * Try to find a display mode of specified depth with dimensions equal or greater than
+ * specified.
+ * If no depth match is found, try for the next larger depth with dimensions equal or greater
+ * than specified.  If no luck, then just return the current mode.
+ *
+ * exactmatch, if not NULL, is set to 'true' if an exact match in width, height, and depth is found,
+ * and 'false' otherwise.
+ *
+ * CGDisplayBestModeForParametersAndRefreshRateWithProperty searches the list, looking for
+ * display modes with the specified property.  The property should be one of:
+ *	kCGDisplayModeIsSafeForHardware;
+ *	kCGDisplayModeIsInterlaced;
+ *	kCGDisplayModeIsStretched;
+ *	kCGDisplayModeIsTelevisionOutput
+ *	
+ * Returns NULL if display is invalid.
+ }
+function CGDisplayBestModeForParameters( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParameters';
+
+function CGDisplayBestModeForParametersAndRefreshRate( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refresh: CGRefreshRate; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRate';
+
+function CGDisplayBestModeForParametersAndRefreshRateWithProperty( display: CGDirectDisplayID; bitsPerPixel: size_t; width: size_t; height: size_t; refresh: CGRefreshRate; property: CFStringRef; var exactMatch: boolean_t ): CFDictionaryRef; external name '_CGDisplayBestModeForParametersAndRefreshRateWithProperty';
+
+{
+ * Return a CFDictionary describing the current display mode.
+ * Returns NULL if display is invalid.
+ }
+function CGDisplayCurrentMode( display: CGDirectDisplayID ): CFDictionaryRef; external name '_CGDisplayCurrentMode';
+{
+ * Switch display mode.  Note that after switching, 
+ * display parameters and addresses may change.
+ * The selected display mode persists for the life of the program, and automatically
+ * reverts to the permanent setting made by Preferences when the program terminates.
+ * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
+ * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
+ *
+ * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
+ * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
+ *
+ * When changing display modes of displays in a mirroring set, other displays in
+ * the mirroring set will be set to a display mode capable of mirroring the bounds
+ * of the largest display being explicitly set. 
+ }
+function CGDisplaySwitchToMode( display: CGDirectDisplayID; mode: CFDictionaryRef ): CGDisplayErr; external name '_CGDisplaySwitchToMode';
+
+{ Query parameters for current mode }
+function CGDisplayBitsPerPixel( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBitsPerPixel';
+function CGDisplayBitsPerSample( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBitsPerSample';
+function CGDisplaySamplesPerPixel( display: CGDirectDisplayID ): size_t; external name '_CGDisplaySamplesPerPixel';
+function CGDisplayBytesPerRow( display: CGDirectDisplayID ): size_t; external name '_CGDisplayBytesPerRow';
+
+{
+ * Set a display gamma/transfer function from a formula specifying
+ * min and max values and a gamma for each channel.
+ * Gamma values must be greater than 0.0.
+ * To get an antigamma of 1.6, one would specify a value of (1.0 / 1.6)
+ * Min values must be greater than or equal to 0.0 and less than 1.0.
+ * Max values must be greater than 0.0 and less than or equal to 1.0.
+ * Out of range values, or Max greater than or equal to Min result
+ * in a kCGSRangeCheck error.
+ *
+ * Values are computed by sampling a function for a range of indices from 0 through 1:
+ *	value = Min + ((Max - Min) * pow(index, Gamma))
+ * The resulting values are converted to a machine specific format
+ * and loaded into hardware.
+ }
+type
+	CGGammaValue = Float32;
+	CGGammaValuePtr					= ^CGGammaValue;
+                                              
+function CGSetDisplayTransferByFormula( display: CGDirectDisplayID; redMin: CGGammaValue; redMax: CGGammaValue; redGamma: CGGammaValue; greenMin: CGGammaValue; greenMax: CGGammaValue; greenGamma: CGGammaValue; blueMin: CGGammaValue; blueMax: CGGammaValue; blueGamma: CGGammaValue ): CGDisplayErr; external name '_CGSetDisplayTransferByFormula';
+                                              
+function CGGetDisplayTransferByFormula( display: CGDirectDisplayID; var redMin: CGGammaValue; var redMax: CGGammaValue; var redGamma: CGGammaValue; var greenMin: CGGammaValue; var greenMax: CGGammaValue; var greenGamma: CGGammaValue; var blueMin: CGGammaValue; var blueMax: CGGammaValue; var blueGamma: CGGammaValue ): CGDisplayErr; external name '_CGGetDisplayTransferByFormula';
+{
+ * Returns the capacity, or nunber of entries, in the camma table for the specified
+ * display.  If 'display' is invalid, returns 0.
+ }
+function CGDisplayGammaTableCapacity( display: CGDirectDisplayID ): CGTableCount; external name '_CGDisplayGammaTableCapacity'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{
+ * Set a display gamma/transfer function using tables of data for each channel.
+ * Values within each table should have values in the range of 0.0 through 1.0.
+ * The same table may be passed in for red, green, and blue channels. 'tableSize'
+ * indicates the number of entries in each table.
+ * The tables are interpolated as needed to generate the number of samples needed
+ * by hardware.
+ }
+function CGSetDisplayTransferByTable( display: CGDirectDisplayID; tableSize: CGTableCount; redTable: {const} CGGammaValuePtr; greenTable: {const} CGGammaValuePtr; blueTable: {const} CGGammaValuePtr ): CGDisplayErr; external name '_CGSetDisplayTransferByTable';
+
+{
+ * Get transfer tables.  Capacity should contain the number of samples each
+ * array can hold, and *sampleCount is filled in with the number of samples
+ * actually copied in.
+ }
+function CGGetDisplayTransferByTable( display: CGDirectDisplayID; capacity: CGTableCount; redTable: CGGammaValuePtr; greenTable: CGGammaValuePtr; blueTable: CGGammaValuePtr; var sampleCount: CGTableCount ): CGDisplayErr; external name '_CGGetDisplayTransferByTable';
+
+{ As a convenience, allow setting of the gamma table by byte values }
+function CGSetDisplayTransferByByteTable( display: CGDirectDisplayID; tableSize: CGTableCount; redTable: {const} CGByteValuePtr; greenTable: {const} CGByteValuePtr; blueTable: {const} CGByteValuePtr ): CGDisplayErr; external name '_CGSetDisplayTransferByByteTable';
+
+{ Restore gamma tables of system displays to the user's ColorSync specified values }
+procedure CGDisplayRestoreColorSyncSettings; external name '_CGDisplayRestoreColorSyncSettings';
+
+{
+ * Options used with CGDisplayCaptureWithOptions and CGCaptureAllDisplaysWithOptions
+ }
+const
+	kCGCaptureNoOptions = 0;	{ Default behavior }
+	kCGCaptureNoFill = 1 shl 0;	{ Disables fill with black on display capture }
+
+{ Display capture and release }
+function CGDisplayIsCaptured( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsCaptured';
+function CGDisplayCapture( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayCapture';
+function CGDisplayCaptureWithOptions( display: CGDirectDisplayID; options: CGCaptureOptions ): CGDisplayErr; external name '_CGDisplayCaptureWithOptions'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+function CGDisplayRelease( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayRelease';
+
+{
+ * Capture all displays; this has the nice effect of providing an immersive
+ * environment, and preventing other apps from trying to adjust themselves
+ * to display changes only needed by your app.
+ }
+function CGCaptureAllDisplays: CGDisplayErr; external name '_CGCaptureAllDisplays';
+function CGCaptureAllDisplaysWithOptions( options: CGCaptureOptions ): CGDisplayErr; external name '_CGCaptureAllDisplaysWithOptions'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{
+ * Release all captured displays, and restore the display modes to the
+ * user's preferences.  May be used in conjunction with CGDisplayCapture()
+ * or CGCaptureAllDisplays().
+ }
+function CGReleaseAllDisplays: CGDisplayErr; external name '_CGReleaseAllDisplays';
+
+{
+ * Returns CoreGraphics raw shield window ID or NULL if not shielded
+ * This value may be used with drawing surface APIs.
+ }
+function CGShieldingWindowID( display: CGDirectDisplayID ): UnivPtr; external name '_CGShieldingWindowID';
+
+{
+ * Returns the window level used for the shield window.
+ * This value may be used with Cocoa windows to position the
+ * Cocoa window in the same window level as the shield window.
+ }
+function CGShieldingWindowLevel: SInt32; external name '_CGShieldingWindowLevel';
+
+{
+ * Returns base address of display or NULL for an invalid display.
+ * If the display has not been captured, the returned address may refer
+ * to read-only memory.
+ }
+function CGDisplayBaseAddress( display: CGDirectDisplayID ): UnivPtr; external name '_CGDisplayBaseAddress';
+{
+ * return address for X,Y in global coordinates;
+ *	(0,0) represents the upper left corner of the main display.
+ * returns NULL for an invalid display or out of bounds coordinates
+ * If the display has not been captured, the returned address may refer
+ * to read-only memory.
+ }
+function CGDisplayAddressForPosition( display: CGDirectDisplayID; x: CGDisplayCoord; y: CGDisplayCoord ): UnivPtr; external name '_CGDisplayAddressForPosition';
+
+
+{ Mouse Cursor controls }
+function CGDisplayHideCursor( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayHideCursor';	{ increments hide cursor count }
+function CGDisplayShowCursor( display: CGDirectDisplayID ): CGDisplayErr; external name '_CGDisplayShowCursor';	{ decrements hide cursor count  }
+
+{
+ * Move the cursor to the specified point relative to the display origin
+ * (the upper left corner of the display).  Returns CGDisplayNoErr on success.
+ * No events are generated as a result of this move.
+ * Points that would lie outside the desktop are clipped to the desktop.
+ }
+function CGDisplayMoveCursorToPoint( display: CGDirectDisplayID; point: CGPoint ): CGDisplayErr; external name '_CGDisplayMoveCursorToPoint';
+
+{
+ * Report the mouse position change associated with the last mouse move event
+ * recieved by this application.
+ }
+procedure CGGetLastMouseDelta( var deltaX: CGMouseDelta; var deltaY: CGMouseDelta ); external name '_CGGetLastMouseDelta';
+
+
+{ Palette controls (8 bit pseudocolor only) }
+
+{
+ * Returns TRUE if the current display mode supports palettes.
+ * Display must not be a hardware mirror of another, and should
+ * have a depth of 8 bits per pixel for this to return TRUE.
+ }
+function CGDisplayCanSetPalette( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayCanSetPalette';
+
+{
+ * Set a palette.  The current gamma function is applied to the palette
+ * elements before being loaded into hardware.  The display must not be
+ * a hardware mirror of another, and should have a depth of 8 bits per pixel.
+ * Setting the palette on the active, or primary display in a hardware
+ * mirroring set affects all displays in that set.
+ }
+function CGDisplaySetPalette( display: CGDirectDisplayID; palette: CGDirectPaletteRef ): CGDisplayErr; external name '_CGDisplaySetPalette';
+
+{
+ * Wait until the beam position is outside the range specified by upperScanLine and lowerScanLine.
+ * Note that if upperScanLine and lowerScanLine encompass the entire display height,
+ * the function returns an error.
+ * lowerScanLine must be greater than or equal to upperScanLine.
+ *
+ * Some display systems may not conventional video vertical and horizontal sweep in painting.
+ * These displays report a kCGDisplayRefreshRate of 0 in the CFDictionaryRef returned by
+ * CGDisplayCurrentMode().  On such displays, this function returns at once.
+ *
+ * Some drivers may not implement support for this mechanism.
+ * On such displays, this function returns at once.
+ *
+ * Returns CGDisplayNoErr on success, and an error if display or upperScanLine and
+ * lowerScanLine are invalid.
+ *
+ * The app should set the values of upperScanLine and lowerScanLine to allow enough lead time
+ * for the drawing operation to complete.  A common strategy is to wait for the beam to pass
+ * the bottom of the drawing area, allowing almost a full vertical sweep period to perform drawing.
+ * To do this, set upperScanLine to 0, and set lowerScanLine to the bottom of the bounding box:
+ *	lowerScanLine = (CGBeamPosition)(cgrect.origin.y + cgrect.size.height);
+ *
+ * IOKit may implement this as a spin-loop on the beam position call used for CGDisplayBeamPosition().
+ * On such system the function is CPU bound, and subject to all the usual scheduling pre-emption.
+ * In particular, attempting to wait for the beam to hit a specific scanline may be an exercise in frustration.
+ *
+ * These functions are advisary in nature, and depend on IOKit and hardware specific drivers to implement
+ * support. If you need extremely precise timing, or access to vertical blanking interrupts,
+ * you should consider writing a device driver to tie into hardware-specific capabilities.
+ }
+function CGDisplayWaitForBeamPositionOutsideLines( display: CGDirectDisplayID; upperScanLine: CGBeamPosition; lowerScanLine: CGBeamPosition ): CGDisplayErr; external name '_CGDisplayWaitForBeamPositionOutsideLines';
+
+{
+ * Returns the current beam position on the display.  If display is invalid,
+ * or the display does not implement conventional video vertical and horizontal
+ * sweep in painting, or the driver does not implement this functionality, 0 is returned.
+ }
+function CGDisplayBeamPosition( display: CGDirectDisplayID ): CGBeamPosition; external name '_CGDisplayBeamPosition';
+
+{
+ * Obtain a CGContextRef suitable for drawing to a captured display.
+ *
+ * Returns a drawing context suitable for use on the display device.
+ * The context is owned by the device, and should not be released by
+ * the caller.
+ *
+ * The context remains valid while the display is captured, and the
+ * display configuration is unchanged.  Releasing the captured display
+ * or reconfiguring the display invalidates the drawing context.
+ *
+ * An application may register a display reconfiguration callback to determine
+ * when the display configuration is changing via CGRegisterDisplayReconfigurationProc().
+ * 
+ * After a display configuration change, or on capturing a display, call this
+ * function to obtain a current drawing context.
+ *
+ * If the display has not been captured, this function returns NULL.
+ }
+function CGDisplayGetDrawingContext( display: CGDirectDisplayID ): CGContextRef; external name '_CGDisplayGetDrawingContext'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+
+end.

+ 202 - 0
packages/extra/univint/CGDirectPalette.pas

@@ -0,0 +1,202 @@
+{
+ *  CGDirectPalette.h
+ *  CoreGraphics
+ *
+ *  Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{       Pascal Translation Updated:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGDirectPalette;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CGDirectDisplay;
+{$ALIGN POWER}
+
+
+type
+	CGPaletteBlendFraction = Float32; { A value between 0.0 and 1.0 }
+
+{
+ * Convenient device color representation
+ *
+ * Values should be in the range from 0.0 to 1.0, where 0.0 is black, and 1.0
+ * is full on for each channel.
+ }
+type
+	CGDeviceColorPtr = ^CGDeviceColor;
+	CGDeviceColor = record
+		red: Float32;
+		green: Float32;
+		blue: Float32;
+	end;
+
+	CGDeviceByteColorPtr = ^CGDeviceByteColor;
+	CGDeviceByteColor = record
+		red: SInt8;
+		green: SInt8;
+		blue: SInt8;
+	end;
+
+{
+ * Create a new palette object representing the default 8 bit color palette.
+ * Release the palette using CGPaletteRelease().
+ }
+function CGPaletteCreateDefaultColorPalette: CGDirectPaletteRef; external name '_CGPaletteCreateDefaultColorPalette';
+
+{
+ * Create a copy of the display's current palette, if any.
+ * Returns NULL if the current display mode does not support a palette.
+ * Release the palette using CGPaletteRelease().
+ }
+function CGPaletteCreateWithDisplay( display: CGDirectDisplayID ): CGDirectPaletteRef; external name '_CGPaletteCreateWithDisplay';
+
+{
+ * Create a new palette with a capacity as specified.  Entries are initialized from
+ * the default color palette.  Release the palette using CGPaletteRelease().
+ }
+function CGPaletteCreateWithCapacity( capacity: CGTableCount ): CGDirectPaletteRef; external name '_CGPaletteCreateWithCapacity';
+
+{
+ * Create a new palette with a capacity and contents as specified.
+ * Release the palette using CGPaletteRelease().
+ }
+function CGPaletteCreateWithSamples( var sampleTable: CGDeviceColor; sampleCount: CGTableCount ): CGDirectPaletteRef; external name '_CGPaletteCreateWithSamples';
+
+{
+ * Convenience function:
+ * Create a new palette with a capacity and contents as specified.
+ * Release the palette using CGPaletteRelease().
+ }
+function CGPaletteCreateWithByteSamples( var sampleTable: CGDeviceByteColor; sampleCount: CGTableCount ): CGDirectPaletteRef; external name '_CGPaletteCreateWithByteSamples';
+
+{
+ * Release a palette
+ }
+procedure CGPaletteRelease( palette: CGDirectPaletteRef ); external name '_CGPaletteRelease';
+
+{
+ * Get the color value at the specified index
+ }
+function CGPaletteGetColorAtIndex( palette: CGDirectPaletteRef; index: CGTableCount ): CGDeviceColor; external name '_CGPaletteGetColorAtIndex';
+
+{
+ * Get the index for the specified color value
+ * The index returned is for a palette color with the
+ * lowest RMS error to the specified color.
+ }
+function CGPaletteGetIndexForColor( palette: CGDirectPaletteRef; color: CGDeviceColor ): CGTableCount; external name '_CGPaletteGetIndexForColor';
+
+{
+ * Get the number of samples in the palette
+ }
+function CGPaletteGetNumberOfSamples( palette: CGDirectPaletteRef ): CGTableCount; external name '_CGPaletteGetNumberOfSamples';
+
+
+{
+ * Set the color value at the specified index
+ }
+procedure CGPaletteSetColorAtIndex( palette: CGDirectPaletteRef; color: CGDeviceColor; index: CGTableCount ); external name '_CGPaletteSetColorAtIndex';
+
+{
+ * Copy a palette
+ }
+function CGPaletteCreateCopy( palette: CGDirectPaletteRef ): CGDirectPaletteRef; external name '_CGPaletteCreateCopy';
+
+{
+ * Compare two palettes
+ }
+function CGPaletteIsEqualToPalette( palette1: CGDirectPaletteRef; palette2: CGDirectPaletteRef ): Boolean; external name '_CGPaletteIsEqualToPalette';
+
+{
+ * Create a new palette blended with a fraction of a device color.
+ * Free the resulting palette with CGPaletteRelease()
+ }
+function CGPaletteCreateFromPaletteBlendedWithColor( palette: CGDirectPaletteRef; fraction: CGPaletteBlendFraction; color: CGDeviceColor ): CGDirectPaletteRef; external name '_CGPaletteCreateFromPaletteBlendedWithColor';
+
+
+end.

+ 343 - 0
packages/extra/univint/CGDisplayConfiguration.pas

@@ -0,0 +1,343 @@
+{
+ *  CGDisplayConfiguration.h
+ *  CoreGraphics
+ *
+ *  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{       Pascal Translation:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGDisplayConfiguration;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CGBase,CGDirectDisplay,CGErrors,CFDictionary,CGGeometry;
+{$ALIGN POWER}
+
+
+{
+ * Display reconfiguration process.
+ * Call CGBeginDisplayConfiguration to start.
+ * Make all desired changes, for all displays.
+ * Commit the changes using CGPerformDisplayConfiguration(), or cancel with
+ * CGCancelDisplayConfiguration()
+ *
+ * The resulting layout will be adjusted so as to remove gaps or overlaps from
+ * the requested layout, if needed.
+ }
+type
+	CGDisplayConfigRef = ^SInt32; { an opaque 32-bit type }
+
+{ Get a new CGDisplayConfigRef }
+function CGBeginDisplayConfiguration( var pConfigRef: CGDisplayConfigRef ): CGError; external name '_CGBeginDisplayConfiguration';
+
+{
+ * Set the origin point for a display
+ *
+ * Note that setting the origin of a display which is mirroring
+ * another display will remove that display from any mirroring set.
+ *
+ * Any display whose origin is not explicitly set in a reconfiguration
+ * will be repositioned to a location as close as possible to it's
+ * current location without overlapping or leaving a gap between displays.
+ *
+ * The actual position a display is placed at will be as close as possible
+ * to the requested location without overlapping or leaving a gap between
+ * displays.
+ }
+function CGConfigureDisplayOrigin( configRef: CGDisplayConfigRef; display: CGDirectDisplayID; x: CGDisplayCoord; y: CGDisplayCoord ): CGError; external name '_CGConfigureDisplayOrigin';
+
+{
+ * Set the display mode
+ *
+ * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
+ * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
+ *
+ * When changing display modes of displays in a mirroring set, other displays in
+ * the mirroring set whose mode is not explicitly changed will be set to a display
+ * mode capable of mirroring the bounds of the largest display being explicitly set. 
+ }
+function CGConfigureDisplayMode( configRef: CGDisplayConfigRef; display: CGDirectDisplayID; mode: CFDictionaryRef ): CGError; external name '_CGConfigureDisplayMode';
+
+{
+ * Make a display a mirror of masterDisplay.
+ *
+ * Use a CGDirectDisplayID of kCGNullDirectDisplay for the masterDisplay to disable
+ * mirroring.
+ * Use a CGDirectDisplayID of CGMainDisplayID() for the masterDisplay to mirror
+ * the main display.
+ *
+ * Mirroring requests will be filled with hardware mirroring when possible,
+ * at the device driver's choice.  Displays will be matted as appropriate,
+ * using either hardware or software matte generation, again at the device driver's choice.
+ *
+ * Note that when hardware mirroring is in effect, the device driver may bind the hardware
+ * accelerator, drawing engine, and 3D engine to any one of the displays in the hardware
+ * mirroring set.  That display will become the active display for drawing purposes in that
+ * hardware mirroring set.  Use CGDisplayPrimaryDisplay() to determine the correct display
+ * device to process drawing operations in a hardware mirroring set.
+ *
+ * An app that uses CGGetActiveDisplayList() to determine the proper displays to draw to
+ * (All Carbon and Cocoa apps using windows and/or DrawSprocket fall into this class)
+ * will automatically get the correct behavior.
+ }
+function CGConfigureDisplayMirrorOfDisplay( configRef: CGDisplayConfigRef; display: CGDirectDisplayID; masterDisplay: CGDirectDisplayID ): CGError; external name '_CGConfigureDisplayMirrorOfDisplay';
+
+{ Cancel a reconfiguration operation, discarding the configRef }
+function CGCancelDisplayConfiguration( configRef: CGDisplayConfigRef ): CGError; external name '_CGCancelDisplayConfiguration';
+
+{
+ * Perform the requested reconfigurations and discard the configRef
+ *
+ * A configuration change can apply for the life of an app, the life of a login session, or
+ * permanently. If a request is made to make a change permanent, and the change
+ * cannot be supported by the Aqua UI (resolution and pixel depth constraints apply),
+ * then the configuration  change is demoted to lasting the session.
+ *
+ * A permanent configuration change also becomes the current session's
+ * configuration.
+ *
+ * When the system reverts confgurations at app termination, the
+ * configuration always reverts to the session or permanent configuration setting.
+ *
+ * When the system reverts confgurations at session termination, the
+ * configuration always reverts to the permanent configuration setting.
+ *
+ * This operation may fail if:
+ *     An unsupported display mode is requested
+ *     Another app is running in full-screen mode
+ *
+ }
+const
+	kCGConfigureForAppOnly = 0;
+	kCGConfigureForSession = 1;
+	kCGConfigurePermanently = 2;
+type
+	CGConfigureOption = UInt32;
+
+function CGCompleteDisplayConfiguration( configRef: CGDisplayConfigRef; option: CGConfigureOption ): CGError; external name '_CGCompleteDisplayConfiguration';
+
+{ Restore the permanent display configuration from the user's display preferences settings }
+procedure CGRestorePermanentDisplayConfiguration; external name '_CGRestorePermanentDisplayConfiguration';
+
+{
+ * Applications may want to register for notifications of display changes.
+ *
+ * Display changes are reported via a callback mechanism.
+ *
+ * Callbacks are invoked when the app is listening for events,
+ * on the event processing thread, or from within the display
+ * reconfiguration function when in the program that is driving the
+ * reconfiguration.
+ *
+ * Callbacks should avoid attempting to change display configurations,
+ * and should not raise exceptions or perform a non-local return such as
+ * calling longjmp().
+ *
+ * Before display reconfiguration, a callback fires to inform
+ * applications of a pending configuration change. The callback runs
+ * once for each on-line display.  The flags passed in are set to
+ * kCGDisplayBeginConfigurationFlag.  This callback does not
+ * carry other per-display information, as details of how a
+ * reconfiguration affects a particular device rely on device-specific
+ * behaviors which may not be exposed by a device driver.
+ *
+ * After display reconfiguration, at the time the callback function
+ * is invoked, all display state reported by CoreGraphics, QuickDraw,
+ * and the Carbon Display Manager API will be up to date.  This callback
+ * runs after the Carbon Display Manager notification callbacks.
+ * The callback runs once for each added, removed, and currently
+ * on-line display.  Note that in the case of removed displays, calls into
+ * the CoreGraphics API with the removed display ID will fail.
+ }
+
+const
+	kCGDisplayBeginConfigurationFlag = 1 shl 0; { Set in pre-reconfiguration callback }
+	kCGDisplayMovedFlag = 1 shl 1; { post-reconfiguration callback flag }
+	kCGDisplaySetMainFlag = 1 shl 2; { post-reconfiguration callback flag }
+	kCGDisplaySetModeFlag = 1 shl 3; { post-reconfiguration callback flag }
+	kCGDisplayAddFlag = 1 shl 4; { post-reconfiguration callback flag }
+	kCGDisplayRemoveFlag = 1 shl 5; { post-reconfiguration callback flag }
+	kCGDisplayEnabledFlag = 1 shl 8; { post-reconfiguration callback flag }
+	kCGDisplayDisabledFlag = 1 shl 9; { post-reconfiguration callback flag }
+	kCGDisplayMirrorFlag = 1 shl 10;{ post-reconfiguration callback flag }
+	kCGDisplayUnMirrorFlag = 1 shl 11; { post-reconfiguration callback flag }
+type
+	CGDisplayChangeSummaryFlags = UInt32;
+
+type
+	CGDisplayReconfigurationCallBack = procedure( display: CGDirectDisplayID; flags: CGDisplayChangeSummaryFlags; userInfo: UnivPtr );
+
+{
+ * Register and remove a display reconfiguration callback procedure
+ * The userInfo argument is passed back to the callback procedure each time
+ * it is invoked.
+ }
+function CGDisplayRegisterReconfigurationCallback( proc: CGDisplayReconfigurationCallBack; userInfo: UnivPtr ): CGError; external name '_CGDisplayRegisterReconfigurationCallback'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+function CGDisplayRemoveReconfigurationCallback( proc: CGDisplayReconfigurationCallBack; userInfo: UnivPtr ): CGError; external name '_CGDisplayRemoveReconfigurationCallback'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+{
+ * These APIs allow applications and higher level frameworks
+ * such as DrawSprocket to determine interesting properties
+ * of displays, such as if a display is built-in, if a display
+ * is the main display, if a display is being mirrored, which
+ * display in a hardware mirror set is bound to the graphics
+ * accelerator (important for games!) and so on.
+ *
+ * An app that uses CGGetActiveDisplayList() to determine the
+ * proper displays to draw to (All Carbon and Cocoa apps using
+ * windows and/or DrawSprocket fall into this class) will
+ * automatically get the correct behavior without using these APIs.
+ * These APIs are primarily of interest to specialized applications
+ * such as movie players, integrated TV/video graphics utilities,
+ * and similar specialized applications.
+ }
+
+{ True if the display is connected, awake, and drawable }
+function CGDisplayIsActive( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsActive';
+
+{ True if the display is asleep and therefore not drawable }
+function CGDisplayIsAsleep( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsAsleep';
+
+{
+ * True if the display is valid, with a monitor connected
+ * (support for hot plugging of monitors)
+ }
+function CGDisplayIsOnline( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsOnline';
+
+{ True if the display is the current main display }
+function CGDisplayIsMain( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsMain';
+
+{ True if the display is built in, such as the internal display in portables }
+function CGDisplayIsBuiltin( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsBuiltin';
+
+{ True if the display is in a mirroring set }
+function CGDisplayIsInMirrorSet( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsInMirrorSet';
+
+{ True if the display is always in a mirroring set, and cannot be unmirrored }
+function CGDisplayIsAlwaysInMirrorSet( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsAlwaysInMirrorSet';
+
+{ True if the display is in a hardware mirroring set }
+function CGDisplayIsInHWMirrorSet( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayIsInHWMirrorSet';
+
+{ Returns display being mirrored, or kCGNullDirectDisplay if master or unmirrored }
+function CGDisplayMirrorsDisplay( display: CGDirectDisplayID ): CGDirectDisplayID; external name '_CGDisplayMirrorsDisplay';
+
+{ True if the display is using OpenGL acceleration }
+function CGDisplayUsesOpenGLAcceleration( display: CGDirectDisplayID ): boolean_t; external name '_CGDisplayUsesOpenGLAcceleration';
+
+
+{
+ * Returns the display bound to the hardware accelerator in a HW mirror set,
+ * or 'display' if software mirrored or unmirrored
+ }
+function CGDisplayPrimaryDisplay( display: CGDirectDisplayID ): CGDirectDisplayID; external name '_CGDisplayPrimaryDisplay';
+
+{
+ * Returns the logical unit, vendor ID, vendor model number,
+ * and serial number for a display
+ }
+function CGDisplayUnitNumber( display: CGDirectDisplayID ): UInt32; external name '_CGDisplayUnitNumber';
+function CGDisplayVendorNumber( display: CGDirectDisplayID ): UInt32; external name '_CGDisplayVendorNumber';
+function CGDisplayModelNumber( display: CGDirectDisplayID ): UInt32; external name '_CGDisplayModelNumber';
+function CGDisplaySerialNumber( display: CGDirectDisplayID ): UInt32; external name '_CGDisplaySerialNumber';
+
+{ Returns the IOKit service port for a display device }
+// uncomment when IOKit translated function CGDisplayIOServicePort( display: CGDirectDisplayID ): io_service_t;
+
+{
+ * Returns the size of the specified display in millimeters.
+ *
+ * If 'display' is not a valid display ID, the size returned has a width and height of 0.
+ *
+ * If EDID data for the display device is not available, the size is estimated based on
+ * the device width and height in pixels from CGDisplayBounds(), with an assumed resolution
+ * of 2.835 pixels/mm, or 72 DPI, a reasonable guess for displays predating EDID support.
+ }
+function CGDisplayScreenSize( display: CGDirectDisplayID ): CGSize; external name '_CGDisplayScreenSize'; (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
+
+
+end.

+ 249 - 0
packages/extra/univint/CGDisplayFade.pas

@@ -0,0 +1,249 @@
+{
+ *  CGDisplayFade.h
+ *  CoreGraphics
+ *
+ *  API to fade displays to and from a solid color, without resorting
+ *  to playing with the gamma table APIs and losing ColorSync calibration.
+ *
+ *  These APIs should be used in perference to manipulating the gamma tables
+ *  for purposes of performing fade effects.
+ *
+ *  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ }
+{       Pascal Translation:  Peter N Lewis, <[email protected]>, August 2005 }
+{
+    Modified for use with Free Pascal
+    Version 200
+    Please report any bugs to <[email protected]>
+}
+
+{$mode macpas}
+{$packenum 1}
+{$macro on}
+{$inline on}
+{$CALLING MWPASCAL}
+
+unit CGDisplayFade;
+interface
+{$setc UNIVERSAL_INTERFACES_VERSION := $0342}
+{$setc GAP_INTERFACES_VERSION := $0200}
+
+{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
+    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
+{$endc}
+
+{$ifc defined CPUPOWERPC and defined CPUI386}
+	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
+{$endc}
+{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
+	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
+{$endc}
+
+{$ifc not defined __ppc__ and defined CPUPOWERPC}
+	{$setc __ppc__ := 1}
+{$elsec}
+	{$setc __ppc__ := 0}
+{$endc}
+{$ifc not defined __i386__ and defined CPUI386}
+	{$setc __i386__ := 1}
+{$elsec}
+	{$setc __i386__ := 0}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
+	{$error Conflicting definitions for __ppc__ and __i386__}
+{$endc}
+
+{$ifc defined __ppc__ and __ppc__}
+	{$setc TARGET_CPU_PPC := TRUE}
+	{$setc TARGET_CPU_X86 := FALSE}
+{$elifc defined __i386__ and __i386__}
+	{$setc TARGET_CPU_PPC := FALSE}
+	{$setc TARGET_CPU_X86 := TRUE}
+{$elsec}
+	{$error Neither __ppc__ nor __i386__ is defined.}
+{$endc}
+{$setc TARGET_CPU_PPC_64 := FALSE}
+
+{$ifc defined FPC_BIG_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
+{$elifc defined FPC_LITTLE_ENDIAN}
+	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
+	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
+{$elsec}
+	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
+{$endc}
+{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
+{$setc CALL_NOT_IN_CARBON := FALSE}
+{$setc OLDROUTINENAMES := FALSE}
+{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
+{$setc OPAQUE_UPP_TYPES := TRUE}
+{$setc OTCARBONAPPLICATION := TRUE}
+{$setc OTKERNEL := FALSE}
+{$setc PM_USE_SESSION_APIS := TRUE}
+{$setc TARGET_API_MAC_CARBON := TRUE}
+{$setc TARGET_API_MAC_OS8 := FALSE}
+{$setc TARGET_API_MAC_OSX := TRUE}
+{$setc TARGET_CARBON := TRUE}
+{$setc TARGET_CPU_68K := FALSE}
+{$setc TARGET_CPU_MIPS := FALSE}
+{$setc TARGET_CPU_SPARC := FALSE}
+{$setc TARGET_OS_MAC := TRUE}
+{$setc TARGET_OS_UNIX := FALSE}
+{$setc TARGET_OS_WIN32 := FALSE}
+{$setc TARGET_RT_MAC_68881 := FALSE}
+{$setc TARGET_RT_MAC_CFM := FALSE}
+{$setc TARGET_RT_MAC_MACHO := TRUE}
+{$setc TYPED_FUNCTION_POINTERS := TRUE}
+{$setc TYPE_BOOL := FALSE}
+{$setc TYPE_EXTENDED := FALSE}
+{$setc TYPE_LONGLONG := TRUE}
+uses MacTypes,CGBase,CGErrors,CGDirectDisplay,CGDisplayConfiguration;
+{$ALIGN POWER}
+
+
+type
+	CGDisplayFadeReservationToken = UInt32;
+const
+	kCGDisplayFadeReservationInvalidToken = 0;
+
+type
+	CGDisplayBlendFraction = Float32;
+{
+ * Values for the limits of the fade.
+ *	kCGDisplayBlendNormal represents a normal display state
+ *	kCGDisplayBlendSolidColor represents a display blended to a solid color
+ }
+const
+	kCGDisplayBlendNormal = 0.0;
+const
+	kCGDisplayBlendSolidColor = 1.0;
+
+{
+ * Time in seconds to perform a fade operation.
+ }
+type
+	CGDisplayFadeInterval = Float32;
+
+{
+ *
+ * Most fade operations done by apps and games are done around display
+ * configuration changes.  This API adds control over a built-in fade
+ * effect when performing display configuration changes.
+ *
+ * The default fade effect on a display mode change uses a fade-out of
+ * 0.3 seconds and a fade-in of 0.5 seconds.  Color fades to French Blue
+ * for a normal desktop, and black when displays are captured.
+ *
+ * CGConfigureDisplayFadeEffect sets the display fade time and color
+ * for a display reconfigure operation.
+ * Call after CGBeginDisplayConfiguration() and before
+ * calling CGCompleteDisplayConfiguration().
+ *
+ * When CGCompleteDisplayConfiguration() is called, a fade-out effect will be
+ * done prior to the display reconfiguration.  When the display reconfiguration
+ * is complete, control returns to the calling program, while a fade-in effect
+ * runs asynchronously.
+ }
+function CGConfigureDisplayFadeEffect( configRef: CGDisplayConfigRef; fadeOutSeconds: CGDisplayFadeInterval; fadeInSeconds: CGDisplayFadeInterval; fadeRed: Float32; fadeGreen: Float32; fadeBlue: Float32 ): CGError; external name '_CGConfigureDisplayFadeEffect';
+
+{
+ * It may also be desirable to perform fade operations at other times, as when
+ * transitioning between game play and cinematic sequences.  The following API
+ * provides a mechanism for controlling display fade operations outside of display
+ * mode reconfigurations.
+ }
+type
+	CGDisplayReservationInterval = Float32;
+const
+	kCGMaxDisplayReservationInterval = 15.0;
+{
+ * Before performing fade operation, the caller must reserve the hardware
+ * for the expected period of time that the program will be doing fades
+ *
+ * A reservation token is returned that must be passed in on subsequent calls.
+ *
+ * Failing to release the hardware by the end of the reservation interval will
+ * result in the reservation token becomingn invalid, and the hardware being
+ * unfaded back to a normal state.  The reservation interval is limited (clipped)
+ * to 15 seconds maximum, and should be greater than zero.
+ *
+ * Returns kCGErrorNoneAvailable if another reservation is in effect,
+ * and kCGErrorSuccess on success.
+ }
+function CGAcquireDisplayFadeReservation( seconds: CGDisplayReservationInterval; var pNewToken: CGDisplayFadeReservationToken ): CGError; external name '_CGAcquireDisplayFadeReservation';
+
+{
+ * Releases a display fade reservation, and unfades the display if needed
+ * The reservation token myToken is no longer valid after this operation.
+ *
+ * CGReleaseDisplayFadeReservation may be safely called while an async fade
+ * operation is running, and if the ending blend value is kCGDisplayBlendNormal,
+ * will not disturb the running operation.  The reservation is dropped when the
+ * fade opertion completes.
+ *
+ * Returns kCGErrorIllegalArgument if myToken is not the valid reservation token,
+ * and kCGErrorSuccess on success.
+ }
+function CGReleaseDisplayFadeReservation( myToken: CGDisplayFadeReservationToken ): CGError; external name '_CGReleaseDisplayFadeReservation';
+
+{
+ * The actual fade mechanism:
+ *
+ * The function takes the current reservation token,
+ * a time interval to perform the fade operation in seconds,
+ * a starting and ending blend coefficient, an RGB color in device space,
+ * and a boolean to indicate that the operation should be done synchronously.
+ *
+ * Over the fade operation time interval, the system will interpolate a
+ * blending coefficient between the starting and ending values given,
+ * applying a nonlinear (sine-based) bias term, and will blend the video output
+ * with the specified color based on the resulting value.
+ *
+ * If the time interval is specifed as 0.0, then the ending state blend value is
+ * applied at once and the function returns.
+ *
+ * The maximum allowable time interval is 15 seconds.
+ *
+ * If the parameter 'synchronous' is true, the function does not return
+ * til the fade operation is complete.  If false, the function returns at once,
+ * and the fade operation runs asynchronously.
+ *
+ * CGReleaseDisplayFadeReservation may be safely called while an async fade
+ * operation is running, and if the ending blend value is kCGDisplayBlendNormal,
+ * will not disturb the running operation.  The reservation is dropped when the
+ * fade opertion completes.
+ *
+ * Invalid parameters result in a return value of kCGErrorIllegalArgument.
+ * Trying to start a fade operation while an asynchronous fade operation is running
+ * results in a return value of kCGErrorNoneAvailable.
+ *
+ * To perform a 2 second fade to black, waiting til complete:
+ *
+ *	CGDisplayFade(myToken,
+ *      	      2.0,			// 2 seconds 
+ *		      kCGDisplayBlendNormal,	// Starting state 
+ *		      kCGDisplayBlendSolidColor, // Ending state 
+ *		      0.0, 0.0, 0.0,		// black 
+ *		      true);			// Wait for completion 
+ *
+ * To perform a 2 second fade from black to normal, without waiting for completion:
+ *
+ *	CGDisplayFade(myToken,
+ *      	      2.0,			// 2 seconds 
+ *		      kCGDisplayBlendSolidColor, // Starting state 
+ *		      kCGDisplayBlendNormal,	// Ending state 
+ *		      0.0, 0.0, 0.0,		// black 
+ *		      false);			// Don't wait for completion 
+ }
+function CGDisplayFade( myToken: CGDisplayFadeReservationToken; seconds: CGDisplayFadeInterval; startBlend: CGDisplayBlendFraction; endBlend: CGDisplayBlendFraction; redBlend: Float32; greenBlend: Float32; blueBlend: Float32; synchronous: boolean_t ): CGError; external name '_CGDisplayFade';
+
+{
+ * Returns true if a fade operation is currently in progress.
+ }
+function CGDisplayFadeOperationInProgress: boolean_t; external name '_CGDisplayFadeOperationInProgress';
+
+
+end.

Some files were not shown because too many files changed in this diff