UnicodeConverter.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. {
  2. File: UnicodeConverter.p
  3. Contains: Types, constants, and prototypes for Unicode Converter
  4. Version: Technology: Mac OS 9.0
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1994-2002 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit UnicodeConverter;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,TextCommon,MixedMode;
  92. {$ALIGN MAC68K}
  93. { Unicode conversion contexts: }
  94. type
  95. TextToUnicodeInfo = ^SInt32; { an opaque 32-bit type }
  96. TextToUnicodeInfoPtr = ^TextToUnicodeInfo; { when a var xx:TextToUnicodeInfo parameter can be nil, it is changed to xx: TextToUnicodeInfoPtr }
  97. UnicodeToTextInfo = ^SInt32; { an opaque 32-bit type }
  98. UnicodeToTextInfoPtr = ^UnicodeToTextInfo; { when a var xx:UnicodeToTextInfo parameter can be nil, it is changed to xx: UnicodeToTextInfoPtr }
  99. UnicodeToTextRunInfo = ^SInt32; { an opaque 32-bit type }
  100. UnicodeToTextRunInfoPtr = ^UnicodeToTextRunInfo; { when a var xx:UnicodeToTextRunInfo parameter can be nil, it is changed to xx: UnicodeToTextRunInfoPtr }
  101. ConstTextToUnicodeInfo = TextToUnicodeInfo;
  102. ConstUnicodeToTextInfo = UnicodeToTextInfo;
  103. { UnicodeMapVersion type & values }
  104. UnicodeMapVersion = SInt32;
  105. const
  106. kUnicodeUseLatestMapping = -1;
  107. kUnicodeUseHFSPlusMapping = 4;
  108. { Types used in conversion }
  109. type
  110. UnicodeMappingPtr = ^UnicodeMapping;
  111. UnicodeMapping = record
  112. unicodeEncoding: TextEncoding;
  113. otherEncoding: TextEncoding;
  114. mappingVersion: UnicodeMapVersion;
  115. end;
  116. ConstUnicodeMappingPtr = ^UnicodeMapping;
  117. { Control flags for ConvertFromUnicodeToText and ConvertFromTextToUnicode }
  118. const
  119. kUnicodeUseFallbacksBit = 0;
  120. kUnicodeKeepInfoBit = 1;
  121. kUnicodeDirectionalityBits = 2;
  122. kUnicodeVerticalFormBit = 4;
  123. kUnicodeLooseMappingsBit = 5;
  124. kUnicodeStringUnterminatedBit = 6;
  125. kUnicodeTextRunBit = 7;
  126. kUnicodeKeepSameEncodingBit = 8;
  127. kUnicodeForceASCIIRangeBit = 9;
  128. kUnicodeNoHalfwidthCharsBit = 10;
  129. kUnicodeTextRunHeuristicsBit = 11;
  130. kUnicodeUseFallbacksMask = $00000001;
  131. kUnicodeKeepInfoMask = $00000002;
  132. kUnicodeDirectionalityMask = $0000000C;
  133. kUnicodeVerticalFormMask = $00000010;
  134. kUnicodeLooseMappingsMask = $00000020;
  135. kUnicodeStringUnterminatedMask = $00000040;
  136. kUnicodeTextRunMask = $00000080;
  137. kUnicodeKeepSameEncodingMask = $00000100;
  138. kUnicodeForceASCIIRangeMask = $00000200;
  139. kUnicodeNoHalfwidthCharsMask = $00000400;
  140. kUnicodeTextRunHeuristicsMask = $00000800;
  141. { Values for kUnicodeDirectionality field }
  142. kUnicodeDefaultDirection = 0;
  143. kUnicodeLeftToRight = 1;
  144. kUnicodeRightToLeft = 2;
  145. { Directionality masks for control flags }
  146. kUnicodeDefaultDirectionMask = $00;
  147. kUnicodeLeftToRightMask = $04;
  148. kUnicodeRightToLeftMask = $08;
  149. { Control flags for TruncateForUnicodeToText: }
  150. {
  151. Now TruncateForUnicodeToText uses control flags from the same set as used by
  152. ConvertFromTextToUnicode, ConvertFromUnicodeToText, etc., but only
  153. kUnicodeStringUnterminatedMask is meaningful for TruncateForUnicodeToText.
  154. Previously two special control flags were defined for TruncateForUnicodeToText:
  155. kUnicodeTextElementSafeBit = 0
  156. kUnicodeRestartSafeBit = 1
  157. However, neither of these was implemented.
  158. Instead of implementing kUnicodeTextElementSafeBit, we now use
  159. kUnicodeStringUnterminatedMask since it accomplishes the same thing and avoids
  160. having special flags just for TruncateForUnicodeToText
  161. Also, kUnicodeRestartSafeBit is unnecessary, since restart-safeness is handled by
  162. setting kUnicodeKeepInfoBit with ConvertFromUnicodeToText.
  163. If TruncateForUnicodeToText is called with one or both of the old special control
  164. flags set (bits 0 or 1), it will not generate a paramErr, but the old bits have no
  165. effect on its operation.
  166. }
  167. { Filter bits for filter field in QueryUnicodeMappings and CountUnicodeMappings: }
  168. kUnicodeMatchUnicodeBaseBit = 0;
  169. kUnicodeMatchUnicodeVariantBit = 1;
  170. kUnicodeMatchUnicodeFormatBit = 2;
  171. kUnicodeMatchOtherBaseBit = 3;
  172. kUnicodeMatchOtherVariantBit = 4;
  173. kUnicodeMatchOtherFormatBit = 5;
  174. kUnicodeMatchUnicodeBaseMask = $00000001;
  175. kUnicodeMatchUnicodeVariantMask = $00000002;
  176. kUnicodeMatchUnicodeFormatMask = $00000004;
  177. kUnicodeMatchOtherBaseMask = $00000008;
  178. kUnicodeMatchOtherVariantMask = $00000010;
  179. kUnicodeMatchOtherFormatMask = $00000020;
  180. { Control flags for SetFallbackUnicodeToText }
  181. kUnicodeFallbackSequencingBits = 0;
  182. kUnicodeFallbackSequencingMask = $00000003;
  183. kUnicodeFallbackInterruptSafeMask = $00000004; { To indicate that caller fallback routine doesnÕt move memory }
  184. { values for kUnicodeFallbackSequencing field }
  185. kUnicodeFallbackDefaultOnly = 0;
  186. kUnicodeFallbackCustomOnly = 1;
  187. kUnicodeFallbackDefaultFirst = 2;
  188. kUnicodeFallbackCustomFirst = 3;
  189. { Caller-supplied entry point to a fallback handler }
  190. type
  191. {$ifc TYPED_FUNCTION_POINTERS}
  192. UnicodeToTextFallbackProcPtr = function(iSrcUniStr: UniCharPtr; iSrcUniStrLen: ByteCount; var oSrcConvLen: ByteCount; oDestStr: TextPtr; iDestStrLen: ByteCount; var oDestConvLen: ByteCount; iInfoPtr: LogicalAddress; iUnicodeMappingPtr: ConstUnicodeMappingPtr): OSStatus;
  193. {$elsec}
  194. UnicodeToTextFallbackProcPtr = ProcPtr;
  195. {$endc}
  196. {$ifc OPAQUE_UPP_TYPES}
  197. UnicodeToTextFallbackUPP = ^SInt32; { an opaque UPP }
  198. {$elsec}
  199. UnicodeToTextFallbackUPP = UniversalProcPtr;
  200. {$endc}
  201. const
  202. uppUnicodeToTextFallbackProcInfo = $003FFFF0;
  203. {
  204. * NewUnicodeToTextFallbackUPP()
  205. *
  206. * Availability:
  207. * Non-Carbon CFM: available as macro/inline
  208. * CarbonLib: in CarbonLib 1.0 and later
  209. * Mac OS X: in version 10.0 and later
  210. }
  211. function NewUnicodeToTextFallbackUPP(userRoutine: UnicodeToTextFallbackProcPtr): UnicodeToTextFallbackUPP; external name '_NewUnicodeToTextFallbackUPP'; { old name was NewUnicodeToTextFallbackProc }
  212. {
  213. * DisposeUnicodeToTextFallbackUPP()
  214. *
  215. * Availability:
  216. * Non-Carbon CFM: available as macro/inline
  217. * CarbonLib: in CarbonLib 1.0 and later
  218. * Mac OS X: in version 10.0 and later
  219. }
  220. procedure DisposeUnicodeToTextFallbackUPP(userUPP: UnicodeToTextFallbackUPP); external name '_DisposeUnicodeToTextFallbackUPP';
  221. {
  222. * InvokeUnicodeToTextFallbackUPP()
  223. *
  224. * Availability:
  225. * Non-Carbon CFM: available as macro/inline
  226. * CarbonLib: in CarbonLib 1.0 and later
  227. * Mac OS X: in version 10.0 and later
  228. }
  229. function InvokeUnicodeToTextFallbackUPP(iSrcUniStr: UniCharPtr; iSrcUniStrLen: ByteCount; var oSrcConvLen: ByteCount; oDestStr: TextPtr; iDestStrLen: ByteCount; var oDestConvLen: ByteCount; iInfoPtr: LogicalAddress; iUnicodeMappingPtr: ConstUnicodeMappingPtr; userRoutine: UnicodeToTextFallbackUPP): OSStatus; external name '_InvokeUnicodeToTextFallbackUPP'; { old name was CallUnicodeToTextFallbackProc }
  230. { Function prototypes }
  231. {$ifc TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  232. {
  233. Routine to Initialize the Unicode Converter and cleanup once done with it.
  234. These routines must be called from Static Library clients.
  235. }
  236. {$ifc CALL_NOT_IN_CARBON}
  237. {
  238. * InitializeUnicodeConverter()
  239. *
  240. * Availability:
  241. * Non-Carbon CFM: not available
  242. * CarbonLib: not available
  243. * Mac OS X: not available
  244. }
  245. function InitializeUnicodeConverter(TECFileName: StringPtr): OSStatus; external name '_InitializeUnicodeConverter';
  246. {
  247. * TerminateUnicodeConverter()
  248. *
  249. * Availability:
  250. * Non-Carbon CFM: not available
  251. * CarbonLib: not available
  252. * Mac OS X: not available
  253. }
  254. procedure TerminateUnicodeConverter; external name '_TerminateUnicodeConverter';
  255. { Note: the old names (InitializeUnicode, TerminateUnicode) for the above are still exported. }
  256. {$endc} {CALL_NOT_IN_CARBON}
  257. {$endc}
  258. {
  259. * CreateTextToUnicodeInfo()
  260. *
  261. * Availability:
  262. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  263. * CarbonLib: in CarbonLib 1.0 and later
  264. * Mac OS X: in version 10.0 and later
  265. }
  266. function CreateTextToUnicodeInfo(iUnicodeMapping: ConstUnicodeMappingPtr; var oTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_CreateTextToUnicodeInfo';
  267. {
  268. * CreateTextToUnicodeInfoByEncoding()
  269. *
  270. * Availability:
  271. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  272. * CarbonLib: in CarbonLib 1.0 and later
  273. * Mac OS X: in version 10.0 and later
  274. }
  275. function CreateTextToUnicodeInfoByEncoding(iEncoding: TextEncoding; var oTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_CreateTextToUnicodeInfoByEncoding';
  276. {
  277. * CreateUnicodeToTextInfo()
  278. *
  279. * Availability:
  280. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  281. * CarbonLib: in CarbonLib 1.0 and later
  282. * Mac OS X: in version 10.0 and later
  283. }
  284. function CreateUnicodeToTextInfo(iUnicodeMapping: ConstUnicodeMappingPtr; var oUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_CreateUnicodeToTextInfo';
  285. {
  286. * CreateUnicodeToTextInfoByEncoding()
  287. *
  288. * Availability:
  289. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  290. * CarbonLib: in CarbonLib 1.0 and later
  291. * Mac OS X: in version 10.0 and later
  292. }
  293. function CreateUnicodeToTextInfoByEncoding(iEncoding: TextEncoding; var oUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_CreateUnicodeToTextInfoByEncoding';
  294. {
  295. * CreateUnicodeToTextRunInfo()
  296. *
  297. * Availability:
  298. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  299. * CarbonLib: in CarbonLib 1.0 and later
  300. * Mac OS X: in version 10.0 and later
  301. }
  302. function CreateUnicodeToTextRunInfo(iNumberOfMappings: ItemCount; const (*var*) iUnicodeMappings: UnicodeMapping; var oUnicodeToTextInfo: UnicodeToTextRunInfo): OSStatus; external name '_CreateUnicodeToTextRunInfo';
  303. {
  304. * CreateUnicodeToTextRunInfoByEncoding()
  305. *
  306. * Availability:
  307. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  308. * CarbonLib: in CarbonLib 1.0 and later
  309. * Mac OS X: in version 10.0 and later
  310. }
  311. function CreateUnicodeToTextRunInfoByEncoding(iNumberOfEncodings: ItemCount; iEncodings: TextEncodingPtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo): OSStatus; external name '_CreateUnicodeToTextRunInfoByEncoding';
  312. {
  313. * CreateUnicodeToTextRunInfoByScriptCode()
  314. *
  315. * Availability:
  316. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  317. * CarbonLib: in CarbonLib 1.0 and later
  318. * Mac OS X: in version 10.0 and later
  319. }
  320. function CreateUnicodeToTextRunInfoByScriptCode(iNumberOfScriptCodes: ItemCount; iScripts: ScriptCodePtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo): OSStatus; external name '_CreateUnicodeToTextRunInfoByScriptCode';
  321. { Change the TextToUnicodeInfo to another mapping. }
  322. {
  323. * ChangeTextToUnicodeInfo()
  324. *
  325. * Availability:
  326. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  327. * CarbonLib: in CarbonLib 1.0 and later
  328. * Mac OS X: in version 10.0 and later
  329. }
  330. function ChangeTextToUnicodeInfo(ioTextToUnicodeInfo: TextToUnicodeInfo; iUnicodeMapping: ConstUnicodeMappingPtr): OSStatus; external name '_ChangeTextToUnicodeInfo';
  331. { Change the UnicodeToTextInfo to another mapping. }
  332. {
  333. * ChangeUnicodeToTextInfo()
  334. *
  335. * Availability:
  336. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  337. * CarbonLib: in CarbonLib 1.0 and later
  338. * Mac OS X: in version 10.0 and later
  339. }
  340. function ChangeUnicodeToTextInfo(ioUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeMapping: ConstUnicodeMappingPtr): OSStatus; external name '_ChangeUnicodeToTextInfo';
  341. {
  342. * DisposeTextToUnicodeInfo()
  343. *
  344. * Availability:
  345. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  346. * CarbonLib: in CarbonLib 1.0 and later
  347. * Mac OS X: in version 10.0 and later
  348. }
  349. function DisposeTextToUnicodeInfo(var ioTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_DisposeTextToUnicodeInfo';
  350. {
  351. * DisposeUnicodeToTextInfo()
  352. *
  353. * Availability:
  354. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  355. * CarbonLib: in CarbonLib 1.0 and later
  356. * Mac OS X: in version 10.0 and later
  357. }
  358. function DisposeUnicodeToTextInfo(var ioUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_DisposeUnicodeToTextInfo';
  359. {
  360. * DisposeUnicodeToTextRunInfo()
  361. *
  362. * Availability:
  363. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  364. * CarbonLib: in CarbonLib 1.0 and later
  365. * Mac OS X: in version 10.0 and later
  366. }
  367. function DisposeUnicodeToTextRunInfo(var ioUnicodeToTextRunInfo: UnicodeToTextRunInfo): OSStatus; external name '_DisposeUnicodeToTextRunInfo';
  368. {
  369. * ConvertFromTextToUnicode()
  370. *
  371. * Availability:
  372. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  373. * CarbonLib: in CarbonLib 1.0 and later
  374. * Mac OS X: in version 10.0 and later
  375. }
  376. function ConvertFromTextToUnicode(iTextToUnicodeInfo: TextToUnicodeInfo; iSourceLen: ByteCount; iSourceStr: ConstLogicalAddress; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oSourceRead: ByteCount; var oUnicodeLen: ByteCount; oUnicodeStr: UniCharPtr): OSStatus; external name '_ConvertFromTextToUnicode';
  377. {
  378. * ConvertFromUnicodeToText()
  379. *
  380. * Availability:
  381. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  382. * CarbonLib: in CarbonLib 1.0 and later
  383. * Mac OS X: in version 10.0 and later
  384. }
  385. function ConvertFromUnicodeToText(iUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress): OSStatus; external name '_ConvertFromUnicodeToText';
  386. {
  387. * ConvertFromUnicodeToTextRun()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  391. * CarbonLib: in CarbonLib 1.0 and later
  392. * Mac OS X: in version 10.0 and later
  393. }
  394. function ConvertFromUnicodeToTextRun(iUnicodeToTextInfo: UnicodeToTextRunInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress; iEncodingRunBufLen: ItemCount; var oEncodingRunOutLen: ItemCount; var oEncodingRuns: TextEncodingRun): OSStatus; external name '_ConvertFromUnicodeToTextRun';
  395. {
  396. * ConvertFromUnicodeToScriptCodeRun()
  397. *
  398. * Availability:
  399. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  400. * CarbonLib: in CarbonLib 1.0 and later
  401. * Mac OS X: in version 10.0 and later
  402. }
  403. function ConvertFromUnicodeToScriptCodeRun(iUnicodeToTextInfo: UnicodeToTextRunInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; iOffsetArray: ByteOffsetPtr; oOffsetCount: ItemCountPtr; oOffsetArray: ByteOffsetPtr; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress; iScriptRunBufLen: ItemCount; var oScriptRunOutLen: ItemCount; var oScriptCodeRuns: ScriptCodeRun): OSStatus; external name '_ConvertFromUnicodeToScriptCodeRun';
  404. { Truncate a multibyte string at a safe place. }
  405. {
  406. * TruncateForTextToUnicode()
  407. *
  408. * Availability:
  409. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  410. * CarbonLib: in CarbonLib 1.0 and later
  411. * Mac OS X: in version 10.0 and later
  412. }
  413. function TruncateForTextToUnicode(iTextToUnicodeInfo: ConstTextToUnicodeInfo; iSourceLen: ByteCount; iSourceStr: ConstLogicalAddress; iMaxLen: ByteCount; var oTruncatedLen: ByteCount): OSStatus; external name '_TruncateForTextToUnicode';
  414. { Truncate a Unicode string at a safe place. }
  415. {
  416. * TruncateForUnicodeToText()
  417. *
  418. * Availability:
  419. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  420. * CarbonLib: in CarbonLib 1.0 and later
  421. * Mac OS X: in version 10.0 and later
  422. }
  423. function TruncateForUnicodeToText(iUnicodeToTextInfo: ConstUnicodeToTextInfo; iSourceLen: ByteCount; iSourceStr: ConstUniCharPtr; iControlFlags: OptionBits; iMaxLen: ByteCount; var oTruncatedLen: ByteCount): OSStatus; external name '_TruncateForUnicodeToText';
  424. { Convert a Pascal string to Unicode string. }
  425. {
  426. * ConvertFromPStringToUnicode()
  427. *
  428. * Availability:
  429. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  430. * CarbonLib: in CarbonLib 1.0 and later
  431. * Mac OS X: in version 10.0 and later
  432. }
  433. function ConvertFromPStringToUnicode(iTextToUnicodeInfo: TextToUnicodeInfo; const (*var*) iPascalStr: Str255; iOutputBufLen: ByteCount; var oUnicodeLen: ByteCount; oUnicodeStr: UniCharPtr): OSStatus; external name '_ConvertFromPStringToUnicode';
  434. { Convert a Unicode string to Pascal string. }
  435. {
  436. * ConvertFromUnicodeToPString()
  437. *
  438. * Availability:
  439. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  440. * CarbonLib: in CarbonLib 1.0 and later
  441. * Mac OS X: in version 10.0 and later
  442. }
  443. function ConvertFromUnicodeToPString(iUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeLen: ByteCount; iUnicodeStr: UniCharPtr; var oPascalStr: Str255): OSStatus; external name '_ConvertFromUnicodeToPString';
  444. { Count the available conversion mappings. }
  445. {
  446. * CountUnicodeMappings()
  447. *
  448. * Availability:
  449. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  450. * CarbonLib: in CarbonLib 1.0 and later
  451. * Mac OS X: in version 10.0 and later
  452. }
  453. function CountUnicodeMappings(iFilter: OptionBits; iFindMapping: ConstUnicodeMappingPtr; var oActualCount: ItemCount): OSStatus; external name '_CountUnicodeMappings';
  454. { Get a list of the available conversion mappings. }
  455. {
  456. * QueryUnicodeMappings()
  457. *
  458. * Availability:
  459. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  460. * CarbonLib: in CarbonLib 1.0 and later
  461. * Mac OS X: in version 10.0 and later
  462. }
  463. function QueryUnicodeMappings(iFilter: OptionBits; iFindMapping: ConstUnicodeMappingPtr; iMaxCount: ItemCount; var oActualCount: ItemCount; var oReturnedMappings: UnicodeMapping): OSStatus; external name '_QueryUnicodeMappings';
  464. { Setup the fallback handler for converting Unicode To Text. }
  465. {
  466. * SetFallbackUnicodeToText()
  467. *
  468. * Availability:
  469. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  470. * CarbonLib: in CarbonLib 1.0 and later
  471. * Mac OS X: in version 10.0 and later
  472. }
  473. function SetFallbackUnicodeToText(iUnicodeToTextInfo: UnicodeToTextInfo; iFallback: UnicodeToTextFallbackUPP; iControlFlags: OptionBits; iInfoPtr: LogicalAddress): OSStatus; external name '_SetFallbackUnicodeToText';
  474. { Setup the fallback handler for converting Unicode To TextRuns. }
  475. {
  476. * SetFallbackUnicodeToTextRun()
  477. *
  478. * Availability:
  479. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  480. * CarbonLib: in CarbonLib 1.0 and later
  481. * Mac OS X: in version 10.0 and later
  482. }
  483. function SetFallbackUnicodeToTextRun(iUnicodeToTextRunInfo: UnicodeToTextRunInfo; iFallback: UnicodeToTextFallbackUPP; iControlFlags: OptionBits; iInfoPtr: LogicalAddress): OSStatus; external name '_SetFallbackUnicodeToTextRun';
  484. { Re-initialize all state information kept by the context objects. }
  485. {
  486. * ResetTextToUnicodeInfo()
  487. *
  488. * Availability:
  489. * Non-Carbon CFM: in UnicodeConverter 1.3 and later
  490. * CarbonLib: in CarbonLib 1.0 and later
  491. * Mac OS X: in version 10.0 and later
  492. }
  493. function ResetTextToUnicodeInfo(ioTextToUnicodeInfo: TextToUnicodeInfo): OSStatus; external name '_ResetTextToUnicodeInfo';
  494. { Re-initialize all state information kept by the context objects. }
  495. {
  496. * ResetUnicodeToTextInfo()
  497. *
  498. * Availability:
  499. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  500. * CarbonLib: in CarbonLib 1.0 and later
  501. * Mac OS X: in version 10.0 and later
  502. }
  503. function ResetUnicodeToTextInfo(ioUnicodeToTextInfo: UnicodeToTextInfo): OSStatus; external name '_ResetUnicodeToTextInfo';
  504. { Re-initialize all state information kept by the context objects in TextRun conversions. }
  505. {
  506. * ResetUnicodeToTextRunInfo()
  507. *
  508. * Availability:
  509. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  510. * CarbonLib: in CarbonLib 1.0 and later
  511. * Mac OS X: in version 10.0 and later
  512. }
  513. function ResetUnicodeToTextRunInfo(ioUnicodeToTextRunInfo: UnicodeToTextRunInfo): OSStatus; external name '_ResetUnicodeToTextRunInfo';
  514. {$ALIGN MAC68K}
  515. end.