1 {
2 File: CarbonCore/UnicodeConverter.h
3
4 Contains: Types, constants, and prototypes for Unicode Converter
5
6 Copyright: � 1994-2011 Apple Inc. All rights reserved.
7
8 Bugs?: For bug reports, consult the following page on
9 the World Wide Web:
10
11 http://bugs.freepascal.org
12
13 }
14 {
15 Modified for use with Free Pascal
16 Version 308
17 Please report any bugs to <gpc@microbizz.nl>
18 }
19
20 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
21 {$mode macpas}
22 {$modeswitch cblocks}
23 {$packenum 1}
24 {$macro on}
25 {$inline on}
26 {$calling mwpascal}
27
28 unit UnicodeConverter;
29 interface
30 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
31 {$setc GAP_INTERFACES_VERSION := $0308}
32
33 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
34 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
35 {$endc}
36
37 {$ifc defined CPUPOWERPC and defined CPUI386}
38 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
39 {$endc}
40 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
41 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
42 {$endc}
43
44 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
45 {$setc __ppc__ := 1}
46 {$elsec}
47 {$setc __ppc__ := 0}
48 {$endc}
49 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
50 {$setc __ppc64__ := 1}
51 {$elsec}
52 {$setc __ppc64__ := 0}
53 {$endc}
54 {$ifc not defined __i386__ and defined CPUI386}
55 {$setc __i386__ := 1}
56 {$elsec}
57 {$setc __i386__ := 0}
58 {$endc}
59 {$ifc not defined __x86_64__ and defined CPUX86_64}
60 {$setc __x86_64__ := 1}
61 {$elsec}
62 {$setc __x86_64__ := 0}
63 {$endc}
64 {$ifc not defined __arm__ and defined CPUARM}
65 {$setc __arm__ := 1}
66 {$elsec}
67 {$setc __arm__ := 0}
68 {$endc}
69 {$ifc not defined __arm64__ and defined CPUAARCH64}
70 {$setc __arm64__ := 1}
71 {$elsec}
72 {$setc __arm64__ := 0}
73 {$endc}
74
75 {$ifc defined cpu64}
76 {$setc __LP64__ := 1}
77 {$elsec}
78 {$setc __LP64__ := 0}
79 {$endc}
80
81
82 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
83 {$error Conflicting definitions for __ppc__ and __i386__}
84 {$endc}
85
86 {$ifc defined __ppc__ and __ppc__}
87 {$setc TARGET_CPU_PPC := TRUE}
88 {$setc TARGET_CPU_PPC64 := FALSE}
89 {$setc TARGET_CPU_X86 := FALSE}
90 {$setc TARGET_CPU_X86_64 := FALSE}
91 {$setc TARGET_CPU_ARM := FALSE}
92 {$setc TARGET_CPU_ARM64 := FALSE}
93 {$setc TARGET_OS_MAC := TRUE}
94 {$setc TARGET_OS_IPHONE := FALSE}
95 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
96 {$setc TARGET_OS_EMBEDDED := FALSE}
97 {$elifc defined __ppc64__ and __ppc64__}
98 {$setc TARGET_CPU_PPC := FALSE}
99 {$setc TARGET_CPU_PPC64 := TRUE}
100 {$setc TARGET_CPU_X86 := FALSE}
101 {$setc TARGET_CPU_X86_64 := FALSE}
102 {$setc TARGET_CPU_ARM := FALSE}
103 {$setc TARGET_CPU_ARM64 := FALSE}
104 {$setc TARGET_OS_MAC := TRUE}
105 {$setc TARGET_OS_IPHONE := FALSE}
106 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
107 {$setc TARGET_OS_EMBEDDED := FALSE}
108 {$elifc defined __i386__ and __i386__}
109 {$setc TARGET_CPU_PPC := FALSE}
110 {$setc TARGET_CPU_PPC64 := FALSE}
111 {$setc TARGET_CPU_X86 := TRUE}
112 {$setc TARGET_CPU_X86_64 := FALSE}
113 {$setc TARGET_CPU_ARM := FALSE}
114 {$setc TARGET_CPU_ARM64 := FALSE}
115 {$ifc defined iphonesim}
116 {$setc TARGET_OS_MAC := FALSE}
117 {$setc TARGET_OS_IPHONE := TRUE}
118 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
119 {$elsec}
120 {$setc TARGET_OS_MAC := TRUE}
121 {$setc TARGET_OS_IPHONE := FALSE}
122 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
123 {$endc}
124 {$setc TARGET_OS_EMBEDDED := FALSE}
125 {$elifc defined __x86_64__ and __x86_64__}
126 {$setc TARGET_CPU_PPC := FALSE}
127 {$setc TARGET_CPU_PPC64 := FALSE}
128 {$setc TARGET_CPU_X86 := FALSE}
129 {$setc TARGET_CPU_X86_64 := TRUE}
130 {$setc TARGET_CPU_ARM := FALSE}
131 {$setc TARGET_CPU_ARM64 := FALSE}
132 {$ifc defined iphonesim}
133 {$setc TARGET_OS_MAC := FALSE}
134 {$setc TARGET_OS_IPHONE := TRUE}
135 {$setc TARGET_IPHONE_SIMULATOR := TRUE}
136 {$elsec}
137 {$setc TARGET_OS_MAC := TRUE}
138 {$setc TARGET_OS_IPHONE := FALSE}
139 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
140 {$endc}
141 {$setc TARGET_OS_EMBEDDED := FALSE}
142 {$elifc defined __arm__ and __arm__}
143 {$setc TARGET_CPU_PPC := FALSE}
144 {$setc TARGET_CPU_PPC64 := FALSE}
145 {$setc TARGET_CPU_X86 := FALSE}
146 {$setc TARGET_CPU_X86_64 := FALSE}
147 {$setc TARGET_CPU_ARM := TRUE}
148 {$setc TARGET_CPU_ARM64 := FALSE}
149 {$setc TARGET_OS_MAC := FALSE}
150 {$setc TARGET_OS_IPHONE := TRUE}
151 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
152 {$setc TARGET_OS_EMBEDDED := TRUE}
153 {$elifc defined __arm64__ and __arm64__}
154 {$setc TARGET_CPU_PPC := FALSE}
155 {$setc TARGET_CPU_PPC64 := FALSE}
156 {$setc TARGET_CPU_X86 := FALSE}
157 {$setc TARGET_CPU_X86_64 := FALSE}
158 {$setc TARGET_CPU_ARM := FALSE}
159 {$setc TARGET_CPU_ARM64 := TRUE}
160 {$ifc defined ios}
161 {$setc TARGET_OS_MAC := FALSE}
162 {$setc TARGET_OS_IPHONE := TRUE}
163 {$setc TARGET_OS_EMBEDDED := TRUE}
164 {$elsec}
165 {$setc TARGET_OS_MAC := TRUE}
166 {$setc TARGET_OS_IPHONE := FALSE}
167 {$setc TARGET_OS_EMBEDDED := FALSE}
168 {$endc}
169 {$setc TARGET_IPHONE_SIMULATOR := FALSE}
170 {$elsec}
171 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
172 {$endc}
173
174 {$ifc defined __LP64__ and __LP64__ }
175 {$setc TARGET_CPU_64 := TRUE}
176 {$elsec}
177 {$setc TARGET_CPU_64 := FALSE}
178 {$endc}
179
180 {$ifc defined FPC_BIG_ENDIAN}
181 {$setc TARGET_RT_BIG_ENDIAN := TRUE}
182 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
183 {$elifc defined FPC_LITTLE_ENDIAN}
184 {$setc TARGET_RT_BIG_ENDIAN := FALSE}
185 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
186 {$elsec}
187 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
188 {$endc}
189 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
190 {$setc CALL_NOT_IN_CARBON := FALSE}
191 {$setc OLDROUTINENAMES := FALSE}
192 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
193 {$setc OPAQUE_UPP_TYPES := TRUE}
194 {$setc OTCARBONAPPLICATION := TRUE}
195 {$setc OTKERNEL := FALSE}
196 {$setc PM_USE_SESSION_APIS := TRUE}
197 {$setc TARGET_API_MAC_CARBON := TRUE}
198 {$setc TARGET_API_MAC_OS8 := FALSE}
199 {$setc TARGET_API_MAC_OSX := TRUE}
200 {$setc TARGET_CARBON := TRUE}
201 {$setc TARGET_CPU_68K := FALSE}
202 {$setc TARGET_CPU_MIPS := FALSE}
203 {$setc TARGET_CPU_SPARC := FALSE}
204 {$setc TARGET_OS_UNIX := FALSE}
205 {$setc TARGET_OS_WIN32 := FALSE}
206 {$setc TARGET_RT_MAC_68881 := FALSE}
207 {$setc TARGET_RT_MAC_CFM := FALSE}
208 {$setc TARGET_RT_MAC_MACHO := TRUE}
209 {$setc TYPED_FUNCTION_POINTERS := TRUE}
210 {$setc TYPE_BOOL := FALSE}
211 {$setc TYPE_EXTENDED := FALSE}
212 {$setc TYPE_LONGLONG := TRUE}
213 uses MacTypes,TextCommon;
214 {$endc} {not MACOSALLINCLUDE}
215
216
217 {$ifc TARGET_OS_MAC}
218
219 {$ALIGN MAC68K}
220
221 { Unicode conversion contexts: }
222
223 type
224 TextToUnicodeInfo = ^SInt32; { an opaque type }
225 TextToUnicodeInfoPtr = ^TextToUnicodeInfo; { when a var xx:TextToUnicodeInfo parameter can be nil, it is changed to xx: TextToUnicodeInfoPtr }
226 UnicodeToTextInfo = ^SInt32; { an opaque type }
227 UnicodeToTextInfoPtr = ^UnicodeToTextInfo; { when a var xx:UnicodeToTextInfo parameter can be nil, it is changed to xx: UnicodeToTextInfoPtr }
228 UnicodeToTextRunInfo = ^SInt32; { an opaque type }
229 UnicodeToTextRunInfoPtr = ^UnicodeToTextRunInfo; { when a var xx:UnicodeToTextRunInfo parameter can be nil, it is changed to xx: UnicodeToTextRunInfoPtr }
230 ConstTextToUnicodeInfo = TextToUnicodeInfo;
231 ConstUnicodeToTextInfo = UnicodeToTextInfo;
232 { UnicodeMapVersion type & values }
233 type
234 UnicodeMapVersion = SInt32;
235 const
236 kUnicodeUseLatestMapping = -1;
237 kUnicodeUseHFSPlusMapping = 4;
238
239 { Types used in conversion }
240 type
241 UnicodeMapping = record
242 unicodeEncoding: TextEncoding;
243 otherEncoding: TextEncoding;
244 mappingVersion: UnicodeMapVersion;
245 end;
246 UnicodeMappingPtr = ^UnicodeMapping;
247 type
248 ConstUnicodeMappingPtr = ^UnicodeMapping;
249 { Control flags for ConvertFromUnicodeToText and ConvertFromTextToUnicode }
250 const
251 kUnicodeUseFallbacksBit = 0;
252 kUnicodeKeepInfoBit = 1;
253 kUnicodeDirectionalityBits = 2;
254 kUnicodeVerticalFormBit = 4;
255 kUnicodeLooseMappingsBit = 5;
256 kUnicodeStringUnterminatedBit = 6;
257 kUnicodeTextRunBit = 7;
258 kUnicodeKeepSameEncodingBit = 8;
259 kUnicodeForceASCIIRangeBit = 9;
260 kUnicodeNoHalfwidthCharsBit = 10;
261 kUnicodeTextRunHeuristicsBit = 11;
262 kUnicodeMapLineFeedToReturnBit = 12; { if kUnicodeUseExternalEncodingFormBit is not set, }
263 { input/output UTF-16 (and UTF-32) is assumed to be in native endian. }
264 { if kUnicodeUseExternalEncodingFormBit is set, }
265 { input UTF-16 (and UTF-32) is assumed to be in big endian }
266 { unless it begins with a byte-order-mark, }
267 { and output UTF-16 (and UTF-32) will be in big endian. }
268 kUnicodeUseExternalEncodingFormBit = 13; { Bits 16-17 are defined in TextEncodingConverter.h for TECSetBasicOptions }
269
270 const
271 kUnicodeUseFallbacksMask = 1 shl kUnicodeUseFallbacksBit;
272 kUnicodeKeepInfoMask = 1 shl kUnicodeKeepInfoBit;
273 kUnicodeDirectionalityMask = 3 shl kUnicodeDirectionalityBits;
274 kUnicodeVerticalFormMask = 1 shl kUnicodeVerticalFormBit;
275 kUnicodeLooseMappingsMask = 1 shl kUnicodeLooseMappingsBit;
276 kUnicodeStringUnterminatedMask = 1 shl kUnicodeStringUnterminatedBit;
277 kUnicodeTextRunMask = 1 shl kUnicodeTextRunBit;
278 kUnicodeKeepSameEncodingMask = 1 shl kUnicodeKeepSameEncodingBit;
279 kUnicodeForceASCIIRangeMask = 1 shl kUnicodeForceASCIIRangeBit;
280 kUnicodeNoHalfwidthCharsMask = 1 shl kUnicodeNoHalfwidthCharsBit;
281 kUnicodeTextRunHeuristicsMask = 1 shl kUnicodeTextRunHeuristicsBit;
282 kUnicodeMapLineFeedToReturnMask = 1 shl kUnicodeMapLineFeedToReturnBit; { if kUnicodeUseExternalEncodingFormBit is not set, }
283 { input/output UTF-16 (and UTF-32) is assumed to be in native endian. }
284 { if kUnicodeUseExternalEncodingFormBit is set, }
285 { input UTF-16 (and UTF-32) is assumed to be in big endian }
286 { unless it begins with a byte-order-mark, }
287 { and output UTF-16 (and UTF-32) will be in big endian. }
288 kUnicodeUseExternalEncodingFormMask = 1 shl kUnicodeUseExternalEncodingFormBit;
289
290 { Values for kUnicodeDirectionality field }
291 const
292 kUnicodeDefaultDirection = 0;
293 kUnicodeLeftToRight = 1;
294 kUnicodeRightToLeft = 2;
295
296 { Directionality masks for control flags }
297 const
298 kUnicodeDefaultDirectionMask = kUnicodeDefaultDirection shl kUnicodeDirectionalityBits;
299 kUnicodeLeftToRightMask = kUnicodeLeftToRight shl kUnicodeDirectionalityBits;
300 kUnicodeRightToLeftMask = kUnicodeRightToLeft shl kUnicodeDirectionalityBits;
301
302
303 { Control flags for TruncateForUnicodeToText: }
304 {
305 Now TruncateForUnicodeToText uses control flags from the same set as used by
306 ConvertFromTextToUnicode, ConvertFromUnicodeToText, etc., but only
307 kUnicodeStringUnterminatedMask is meaningful for TruncateForUnicodeToText.
308
309 Previously two special control flags were defined for TruncateForUnicodeToText:
310 kUnicodeTextElementSafeBit = 0
311 kUnicodeRestartSafeBit = 1
312 However, neither of these was implemented.
313 Instead of implementing kUnicodeTextElementSafeBit, we now use
314 kUnicodeStringUnterminatedMask since it accomplishes the same thing and avoids
315 having special flags just for TruncateForUnicodeToText
316 Also, kUnicodeRestartSafeBit is unnecessary, since restart-safeness is handled by
317 setting kUnicodeKeepInfoBit with ConvertFromUnicodeToText.
318 If TruncateForUnicodeToText is called with one or both of the old special control
319 flags set (bits 0 or 1), it will not generate a paramErr, but the old bits have no
320 effect on its operation.
321 }
322
323 { Filter bits for filter field in QueryUnicodeMappings and CountUnicodeMappings: }
324 const
325 kUnicodeMatchUnicodeBaseBit = 0;
326 kUnicodeMatchUnicodeVariantBit = 1;
327 kUnicodeMatchUnicodeFormatBit = 2;
328 kUnicodeMatchOtherBaseBit = 3;
329 kUnicodeMatchOtherVariantBit = 4;
330 kUnicodeMatchOtherFormatBit = 5;
331
332 const
333 kUnicodeMatchUnicodeBaseMask = 1 shl kUnicodeMatchUnicodeBaseBit;
334 kUnicodeMatchUnicodeVariantMask = 1 shl kUnicodeMatchUnicodeVariantBit;
335 kUnicodeMatchUnicodeFormatMask = 1 shl kUnicodeMatchUnicodeFormatBit;
336 kUnicodeMatchOtherBaseMask = 1 shl kUnicodeMatchOtherBaseBit;
337 kUnicodeMatchOtherVariantMask = 1 shl kUnicodeMatchOtherVariantBit;
338 kUnicodeMatchOtherFormatMask = 1 shl kUnicodeMatchOtherFormatBit;
339
340 { Control flags for SetFallbackUnicodeToText }
341 const
342 kUnicodeFallbackSequencingBits = 0;
343
344 const
345 kUnicodeFallbackSequencingMask = 3 shl kUnicodeFallbackSequencingBits;
346 kUnicodeFallbackInterruptSafeMask = 1 shl 2; { To indicate that caller fallback routine doesn�t move memory}
347
348 { values for kUnicodeFallbackSequencing field }
349 const
350 kUnicodeFallbackDefaultOnly = 0;
351 kUnicodeFallbackCustomOnly = 1;
352 kUnicodeFallbackDefaultFirst = 2;
353 kUnicodeFallbackCustomFirst = 3;
354
355
356 { Caller-supplied entry point to a fallback handler }
357 type
iSrcUniStrnull358 UnicodeToTextFallbackProcPtr = function( iSrcUniStr: UniCharPtr; iSrcUniStrLen: ByteCount; var oSrcConvLen: ByteCount; oDestStr: TextPtr; iDestStrLen: ByteCount; var oDestConvLen: ByteCount; iInfoPtr: LogicalAddress; iUnicodeMappingPtr: ConstUnicodeMappingPtr ): OSStatus;
359 UnicodeToTextFallbackUPP = UnicodeToTextFallbackProcPtr;
360 {
361 * NewUnicodeToTextFallbackUPP()
362 *
363 * Availability:
364 * Mac OS X: in version 10.0 and later in CoreServices.framework
365 * CarbonLib: in CarbonLib 1.0 and later
366 * Non-Carbon CFM: available as macro/inline
367 }
NewUnicodeToTextFallbackUPPnull368 function NewUnicodeToTextFallbackUPP( userRoutine: UnicodeToTextFallbackProcPtr ): UnicodeToTextFallbackUPP; external name '_NewUnicodeToTextFallbackUPP';
369 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
370
371 {
372 * DisposeUnicodeToTextFallbackUPP()
373 *
374 * Availability:
375 * Mac OS X: in version 10.0 and later in CoreServices.framework
376 * CarbonLib: in CarbonLib 1.0 and later
377 * Non-Carbon CFM: available as macro/inline
378 }
379 procedure DisposeUnicodeToTextFallbackUPP( userUPP: UnicodeToTextFallbackUPP ); external name '_DisposeUnicodeToTextFallbackUPP';
380 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
381
382 {
383 * InvokeUnicodeToTextFallbackUPP()
384 *
385 * Availability:
386 * Mac OS X: in version 10.0 and later in CoreServices.framework
387 * CarbonLib: in CarbonLib 1.0 and later
388 * Non-Carbon CFM: available as macro/inline
389 }
InvokeUnicodeToTextFallbackUPPnull390 function InvokeUnicodeToTextFallbackUPP( iSrcUniStr: UniCharPtr; iSrcUniStrLen: ByteCount; var oSrcConvLen: ByteCount; oDestStr: TextPtr; iDestStrLen: ByteCount; var oDestConvLen: ByteCount; iInfoPtr: LogicalAddress; iUnicodeMappingPtr: ConstUnicodeMappingPtr; userUPP: UnicodeToTextFallbackUPP ): OSStatus; external name '_InvokeUnicodeToTextFallbackUPP';
391 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
392
393 { Function prototypes }
394 {
395 * CreateTextToUnicodeInfo()
396 *
397 * Availability:
398 * Mac OS X: in version 10.0 and later in CoreServices.framework
399 * CarbonLib: in CarbonLib 1.0 and later
400 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
401 }
CreateTextToUnicodeInfonull402 function CreateTextToUnicodeInfo( iUnicodeMapping: ConstUnicodeMappingPtr; var oTextToUnicodeInfo: TextToUnicodeInfo ): OSStatus; external name '_CreateTextToUnicodeInfo';
403 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
404
405
406 {
407 * CreateTextToUnicodeInfoByEncoding()
408 *
409 * Availability:
410 * Mac OS X: in version 10.0 and later in CoreServices.framework
411 * CarbonLib: in CarbonLib 1.0 and later
412 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
413 }
CreateTextToUnicodeInfoByEncodingnull414 function CreateTextToUnicodeInfoByEncoding( iEncoding: TextEncoding; var oTextToUnicodeInfo: TextToUnicodeInfo ): OSStatus; external name '_CreateTextToUnicodeInfoByEncoding';
415 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
416
417
418 {
419 * CreateUnicodeToTextInfo()
420 *
421 * Availability:
422 * Mac OS X: in version 10.0 and later in CoreServices.framework
423 * CarbonLib: in CarbonLib 1.0 and later
424 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
425 }
CreateUnicodeToTextInfonull426 function CreateUnicodeToTextInfo( iUnicodeMapping: ConstUnicodeMappingPtr; var oUnicodeToTextInfo: UnicodeToTextInfo ): OSStatus; external name '_CreateUnicodeToTextInfo';
427 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
428
429
430 {
431 * CreateUnicodeToTextInfoByEncoding()
432 *
433 * Availability:
434 * Mac OS X: in version 10.0 and later in CoreServices.framework
435 * CarbonLib: in CarbonLib 1.0 and later
436 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
437 }
CreateUnicodeToTextInfoByEncodingnull438 function CreateUnicodeToTextInfoByEncoding( iEncoding: TextEncoding; var oUnicodeToTextInfo: UnicodeToTextInfo ): OSStatus; external name '_CreateUnicodeToTextInfoByEncoding';
439 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
440
441
442 {
443 * CreateUnicodeToTextRunInfo()
444 *
445 * Availability:
446 * Mac OS X: in version 10.0 and later in CoreServices.framework
447 * CarbonLib: in CarbonLib 1.0 and later
448 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
449 }
CreateUnicodeToTextRunInfonull450 function CreateUnicodeToTextRunInfo( iNumberOfMappings: ItemCount; {const} iUnicodeMappings: {variable-size-array} UnicodeMappingPtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo ): OSStatus; external name '_CreateUnicodeToTextRunInfo';
451 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
452
453
454 {
455 * CreateUnicodeToTextRunInfoByEncoding()
456 *
457 * Availability:
458 * Mac OS X: in version 10.0 and later in CoreServices.framework
459 * CarbonLib: in CarbonLib 1.0 and later
460 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
461 }
CreateUnicodeToTextRunInfoByEncodingnull462 function CreateUnicodeToTextRunInfoByEncoding( iNumberOfEncodings: ItemCount; {const} iEncodings: {variable-size-array} TextEncodingPtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo ): OSStatus; external name '_CreateUnicodeToTextRunInfoByEncoding';
463 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
464
465
466 {
467 * CreateUnicodeToTextRunInfoByScriptCode()
468 *
469 * Availability:
470 * Mac OS X: in version 10.0 and later in CoreServices.framework
471 * CarbonLib: in CarbonLib 1.0 and later
472 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
473 }
CreateUnicodeToTextRunInfoByScriptCodenull474 function CreateUnicodeToTextRunInfoByScriptCode( iNumberOfScriptCodes: ItemCount; {const} iScripts: {variable-size-array} ScriptCodePtr; var oUnicodeToTextInfo: UnicodeToTextRunInfo ): OSStatus; external name '_CreateUnicodeToTextRunInfoByScriptCode';
475 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
476
477
478 { Change the TextToUnicodeInfo to another mapping. }
479 {
480 * ChangeTextToUnicodeInfo()
481 *
482 * Availability:
483 * Mac OS X: in version 10.0 and later in CoreServices.framework
484 * CarbonLib: in CarbonLib 1.0 and later
485 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
486 }
ChangeTextToUnicodeInfonull487 function ChangeTextToUnicodeInfo( ioTextToUnicodeInfo: TextToUnicodeInfo; iUnicodeMapping: ConstUnicodeMappingPtr ): OSStatus; external name '_ChangeTextToUnicodeInfo';
488 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
489
490
491 { Change the UnicodeToTextInfo to another mapping. }
492 {
493 * ChangeUnicodeToTextInfo()
494 *
495 * Availability:
496 * Mac OS X: in version 10.0 and later in CoreServices.framework
497 * CarbonLib: in CarbonLib 1.0 and later
498 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
499 }
ChangeUnicodeToTextInfonull500 function ChangeUnicodeToTextInfo( ioUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeMapping: ConstUnicodeMappingPtr ): OSStatus; external name '_ChangeUnicodeToTextInfo';
501 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
502
503
504 {
505 * DisposeTextToUnicodeInfo()
506 *
507 * Availability:
508 * Mac OS X: in version 10.0 and later in CoreServices.framework
509 * CarbonLib: in CarbonLib 1.0 and later
510 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
511 }
DisposeTextToUnicodeInfonull512 function DisposeTextToUnicodeInfo( var ioTextToUnicodeInfo: TextToUnicodeInfo ): OSStatus; external name '_DisposeTextToUnicodeInfo';
513 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
514
515
516 {
517 * DisposeUnicodeToTextInfo()
518 *
519 * Availability:
520 * Mac OS X: in version 10.0 and later in CoreServices.framework
521 * CarbonLib: in CarbonLib 1.0 and later
522 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
523 }
DisposeUnicodeToTextInfonull524 function DisposeUnicodeToTextInfo( var ioUnicodeToTextInfo: UnicodeToTextInfo ): OSStatus; external name '_DisposeUnicodeToTextInfo';
525 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
526
527
528 {
529 * DisposeUnicodeToTextRunInfo()
530 *
531 * Availability:
532 * Mac OS X: in version 10.0 and later in CoreServices.framework
533 * CarbonLib: in CarbonLib 1.0 and later
534 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
535 }
DisposeUnicodeToTextRunInfonull536 function DisposeUnicodeToTextRunInfo( var ioUnicodeToTextRunInfo: UnicodeToTextRunInfo ): OSStatus; external name '_DisposeUnicodeToTextRunInfo';
537 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
538
539
540 {
541 * ConvertFromTextToUnicode()
542 *
543 * Availability:
544 * Mac OS X: in version 10.0 and later in CoreServices.framework
545 * CarbonLib: in CarbonLib 1.0 and later
546 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
547 }
ConvertFromTextToUnicodenull548 function ConvertFromTextToUnicode( iTextToUnicodeInfo: TextToUnicodeInfo; iSourceLen: ByteCount; iSourceStr: ConstLogicalAddress; iControlFlags: OptionBits; iOffsetCount: ItemCount; {const} iOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; oOffsetCount: ItemCountPtr { can be NULL }; oOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; iOutputBufLen: ByteCount; var oSourceRead: ByteCount; var oUnicodeLen: ByteCount; oUnicodeStr: {variable-size-array} UniCharPtr ): OSStatus; external name '_ConvertFromTextToUnicode';
549 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
550
551
552 {
553 * ConvertFromUnicodeToText()
554 *
555 * Availability:
556 * Mac OS X: in version 10.0 and later in CoreServices.framework
557 * CarbonLib: in CarbonLib 1.0 and later
558 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
559 }
ConvertFromUnicodeToTextnull560 function ConvertFromUnicodeToText( iUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeLen: ByteCount; {const} iUnicodeStr: {variable-size-array} UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; {const} iOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; oOffsetCount: ItemCountPtr { can be NULL }; oOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress ): OSStatus; external name '_ConvertFromUnicodeToText';
561 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
562
563
564 {
565 * ConvertFromUnicodeToTextRun()
566 *
567 * Availability:
568 * Mac OS X: in version 10.0 and later in CoreServices.framework
569 * CarbonLib: in CarbonLib 1.0 and later
570 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
571 }
ConvertFromUnicodeToTextRunnull572 function ConvertFromUnicodeToTextRun( iUnicodeToTextInfo: UnicodeToTextRunInfo; iUnicodeLen: ByteCount; {const} iUnicodeStr: {variable-size-array} UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; {const} iOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; oOffsetCount: ItemCountPtr { can be NULL }; oOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress; iEncodingRunBufLen: ItemCount; var oEncodingRunOutLen: ItemCount; oEncodingRuns: {variable-size-array} TextEncodingRunPtr ): OSStatus; external name '_ConvertFromUnicodeToTextRun';
573 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
574
575
576 {
577 * ConvertFromUnicodeToScriptCodeRun()
578 *
579 * Availability:
580 * Mac OS X: in version 10.0 and later in CoreServices.framework
581 * CarbonLib: in CarbonLib 1.0 and later
582 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
583 }
ConvertFromUnicodeToScriptCodeRunnull584 function ConvertFromUnicodeToScriptCodeRun( iUnicodeToTextInfo: UnicodeToTextRunInfo; iUnicodeLen: ByteCount; {const} iUnicodeStr: {variable-size-array} UniCharPtr; iControlFlags: OptionBits; iOffsetCount: ItemCount; {const} iOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; oOffsetCount: ItemCountPtr { can be NULL }; oOffsetArray: {variable-size-array} ByteOffsetPtr { can be NULL }; iOutputBufLen: ByteCount; var oInputRead: ByteCount; var oOutputLen: ByteCount; oOutputStr: LogicalAddress; iScriptRunBufLen: ItemCount; var oScriptRunOutLen: ItemCount; oScriptCodeRuns: {variable-size-array} ScriptCodeRunPtr ): OSStatus; external name '_ConvertFromUnicodeToScriptCodeRun';
585 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
586
587
588 { Truncate a multibyte string at a safe place. }
589 {
590 * TruncateForTextToUnicode()
591 *
592 * Availability:
593 * Mac OS X: in version 10.0 and later in CoreServices.framework
594 * CarbonLib: in CarbonLib 1.0 and later
595 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
596 }
TruncateForTextToUnicodenull597 function TruncateForTextToUnicode( iTextToUnicodeInfo: ConstTextToUnicodeInfo; iSourceLen: ByteCount; iSourceStr: ConstLogicalAddress; iMaxLen: ByteCount; var oTruncatedLen: ByteCount ): OSStatus; external name '_TruncateForTextToUnicode';
598 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
599
600
601 { Truncate a Unicode string at a safe place. }
602 {
603 * TruncateForUnicodeToText()
604 *
605 * Availability:
606 * Mac OS X: in version 10.0 and later in CoreServices.framework
607 * CarbonLib: in CarbonLib 1.0 and later
608 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
609 }
TruncateForUnicodeToTextnull610 function TruncateForUnicodeToText( iUnicodeToTextInfo: ConstUnicodeToTextInfo; iSourceLen: ByteCount; iSourceStr: ConstUniCharPtr; iControlFlags: OptionBits; iMaxLen: ByteCount; var oTruncatedLen: ByteCount ): OSStatus; external name '_TruncateForUnicodeToText';
611 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
612
613
614 { Convert a Pascal string to Unicode string. }
615 {
616 * ConvertFromPStringToUnicode()
617 *
618 * Availability:
619 * Mac OS X: in version 10.0 and later in CoreServices.framework
620 * CarbonLib: in CarbonLib 1.0 and later
621 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
622 }
ConvertFromPStringToUnicodenull623 function ConvertFromPStringToUnicode( iTextToUnicodeInfo: TextToUnicodeInfo; const (*var*) iPascalStr: Str255; iOutputBufLen: ByteCount; var oUnicodeLen: ByteCount; oUnicodeStr: UniCharPtr ): OSStatus; external name '_ConvertFromPStringToUnicode';
624 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
625
626
627 { Convert a Unicode string to Pascal string. }
628 {
629 * ConvertFromUnicodeToPString()
630 *
631 * Availability:
632 * Mac OS X: in version 10.0 and later in CoreServices.framework
633 * CarbonLib: in CarbonLib 1.0 and later
634 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
635 }
ConvertFromUnicodeToPStringnull636 function ConvertFromUnicodeToPString( iUnicodeToTextInfo: UnicodeToTextInfo; iUnicodeLen: ByteCount; {const} iUnicodeStr: {variable-size-array} UniCharPtr; var oPascalStr: Str255 ): OSStatus; external name '_ConvertFromUnicodeToPString';
637 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
638
639
640 { Count the available conversion mappings. }
641 {
642 * CountUnicodeMappings()
643 *
644 * Availability:
645 * Mac OS X: in version 10.0 and later in CoreServices.framework
646 * CarbonLib: in CarbonLib 1.0 and later
647 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
648 }
CountUnicodeMappingsnull649 function CountUnicodeMappings( iFilter: OptionBits; iFindMapping: ConstUnicodeMappingPtr; var oActualCount: ItemCount ): OSStatus; external name '_CountUnicodeMappings';
650 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
651
652
653 { Get a list of the available conversion mappings. }
654 {
655 * QueryUnicodeMappings()
656 *
657 * Availability:
658 * Mac OS X: in version 10.0 and later in CoreServices.framework
659 * CarbonLib: in CarbonLib 1.0 and later
660 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
661 }
QueryUnicodeMappingsnull662 function QueryUnicodeMappings( iFilter: OptionBits; iFindMapping: ConstUnicodeMappingPtr; iMaxCount: ItemCount; var oActualCount: ItemCount; oReturnedMappings: {variable-size-array} UnicodeMappingPtr ): OSStatus; external name '_QueryUnicodeMappings';
663 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
664
665
666 { Setup the fallback handler for converting Unicode To Text. }
667 {
668 * SetFallbackUnicodeToText()
669 *
670 * Availability:
671 * Mac OS X: in version 10.0 and later in CoreServices.framework
672 * CarbonLib: in CarbonLib 1.0 and later
673 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
674 }
SetFallbackUnicodeToTextnull675 function SetFallbackUnicodeToText( iUnicodeToTextInfo: UnicodeToTextInfo; iFallback: UnicodeToTextFallbackUPP; iControlFlags: OptionBits; iInfoPtr: LogicalAddress ): OSStatus; external name '_SetFallbackUnicodeToText';
676 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
677
678
679 { Setup the fallback handler for converting Unicode To TextRuns. }
680 {
681 * SetFallbackUnicodeToTextRun()
682 *
683 * Availability:
684 * Mac OS X: in version 10.0 and later in CoreServices.framework
685 * CarbonLib: in CarbonLib 1.0 and later
686 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
687 }
SetFallbackUnicodeToTextRunnull688 function SetFallbackUnicodeToTextRun( iUnicodeToTextRunInfo: UnicodeToTextRunInfo; iFallback: UnicodeToTextFallbackUPP; iControlFlags: OptionBits; iInfoPtr: LogicalAddress ): OSStatus; external name '_SetFallbackUnicodeToTextRun';
689 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
690
691
692 { Re-initialize all state information kept by the context objects. }
693 {
694 * ResetTextToUnicodeInfo()
695 *
696 * Availability:
697 * Mac OS X: in version 10.0 and later in CoreServices.framework
698 * CarbonLib: in CarbonLib 1.0 and later
699 * Non-Carbon CFM: in UnicodeConverter 1.3 and later
700 }
ResetTextToUnicodeInfonull701 function ResetTextToUnicodeInfo( ioTextToUnicodeInfo: TextToUnicodeInfo ): OSStatus; external name '_ResetTextToUnicodeInfo';
702 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
703
704
705 { Re-initialize all state information kept by the context objects. }
706 {
707 * ResetUnicodeToTextInfo()
708 *
709 * Availability:
710 * Mac OS X: in version 10.0 and later in CoreServices.framework
711 * CarbonLib: in CarbonLib 1.0 and later
712 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
713 }
ResetUnicodeToTextInfonull714 function ResetUnicodeToTextInfo( ioUnicodeToTextInfo: UnicodeToTextInfo ): OSStatus; external name '_ResetUnicodeToTextInfo';
715 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
716
717
718 { Re-initialize all state information kept by the context objects in TextRun conversions. }
719 {
720 * ResetUnicodeToTextRunInfo()
721 *
722 * Availability:
723 * Mac OS X: in version 10.0 and later in CoreServices.framework
724 * CarbonLib: in CarbonLib 1.0 and later
725 * Non-Carbon CFM: in UnicodeConverter 1.1 and later
726 }
ResetUnicodeToTextRunInfonull727 function ResetUnicodeToTextRunInfo( ioUnicodeToTextRunInfo: UnicodeToTextRunInfo ): OSStatus; external name '_ResetUnicodeToTextRunInfo';
728 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
729
730
731
732 {$endc} {TARGET_OS_MAC}
733 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
734
735 end.
736 {$endc} {not MACOSALLINCLUDE}
737