1 {
2 File: CarbonCore/TextEncodingConverter.h
3
4 Contains: Text Encoding Conversion Interfaces.
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 TextEncodingConverter;
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,CFBase;
214 {$endc} {not MACOSALLINCLUDE}
215
216
217 {$ifc TARGET_OS_MAC}
218
219
220 {$ALIGN MAC68K}
221
222 type
223 TECPluginSignature = OSType;
224 TECPluginVersion = UInt32;
225 { plugin signatures }
226 const
227 kTECSignature = FourCharCode('encv');
228 kTECUnicodePluginSignature = FourCharCode('puni');
229 kTECJapanesePluginSignature = FourCharCode('pjpn');
230 kTECChinesePluginSignature = FourCharCode('pzho');
231 kTECKoreanPluginSignature = FourCharCode('pkor');
232
233
234 { converter object reference }
235 type
236 TECObjectRef = ^SInt32; { an opaque type }
237 TECObjectRefPtr = ^TECObjectRef; { when a var xx:TECObjectRef parameter can be nil, it is changed to xx: TECObjectRefPtr }
238 TECSnifferObjectRef = ^SInt32; { an opaque type }
239 TECSnifferObjectRefPtr = ^TECSnifferObjectRef; { when a var xx:TECSnifferObjectRef parameter can be nil, it is changed to xx: TECSnifferObjectRefPtr }
240 TECPluginSig = OSType;
241 TECConversionInfoPtr = ^TECConversionInfo;
242 TECConversionInfo = record
243 sourceEncoding: TextEncoding;
244 destinationEncoding: TextEncoding;
245 reserved1: UInt16;
246 reserved2: UInt16;
247 end;
248
249 {
250 * TECInternetNameUsageMask
251 *
252 * Discussion:
253 * Mask values that control the mapping between TextEncoding and
254 * IANA charset name or MIB enum.
255 }
256 type
257 TECInternetNameUsageMask = UInt32;
258 const
259 { Use one of the following}
260
261 {
262 * Use the default type of mapping given other usage information
263 * (none currently defined).
264 }
265 kTECInternetNameDefaultUsageMask = 0;
266
267 {
268 * Use the closest possible match between TextEncoding value and IANA
269 * charset name or MIB enum
270 }
271 kTECInternetNameStrictUsageMask = 1;
272
273 {
274 * When mapping from IANA charset name or MIB enum to TextEncoding,
275 * map to the largest superset of the encoding specified by the
276 * charset name or MIB enum (i.e. be tolerant). When mapping from
277 * TextEncoding to IANA charset name or MIB enum, typically map to
278 * the most generic or widely recognized charset name or MIB enum.
279 }
280 kTECInternetNameTolerantUsageMask = 2;
281
282 { Special values for MIB enums }
283 const
284 kTEC_MIBEnumDontCare = -1;
285
286 { Additional control flags for TECSetBasicOptions }
287 const
288 kTECDisableFallbacksBit = 16;
289 kTECDisableLooseMappingsBit = 17;
290
291 const
292 kTECDisableFallbacksMask = 1 shl kTECDisableFallbacksBit;
293 kTECDisableLooseMappingsMask = 1 shl kTECDisableLooseMappingsBit;
294
295
296 { return number of encodings types supported by user's configuraton of the encoding converter }
297 {
298 * TECCountAvailableTextEncodings()
299 *
300 * Availability:
301 * Mac OS X: in version 10.0 and later in CoreServices.framework
302 * CarbonLib: in CarbonLib 1.0 and later
303 * Non-Carbon CFM: in TextEncodingConverter 1.1 and later
304 }
TECCountAvailableTextEncodingsnull305 function TECCountAvailableTextEncodings( var numberEncodings: ItemCount ): OSStatus; external name '_TECCountAvailableTextEncodings';
306 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
307
308
309 { fill in an array of type TextEncoding passed in by the user with types of encodings the current configuration of the encoder can handle. }
310 {
311 * TECGetAvailableTextEncodings()
312 *
313 * Availability:
314 * Mac OS X: in version 10.0 and later in CoreServices.framework
315 * CarbonLib: in CarbonLib 1.0 and later
316 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
317 }
TECGetAvailableTextEncodingsnull318 function TECGetAvailableTextEncodings( availableEncodings: {variable-size-array} TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount ): OSStatus; external name '_TECGetAvailableTextEncodings';
319 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
320
321
322 { return number of from-to encoding conversion pairs supported }
323 {
324 * TECCountDirectTextEncodingConversions()
325 *
326 * Availability:
327 * Mac OS X: in version 10.0 and later in CoreServices.framework
328 * CarbonLib: in CarbonLib 1.0 and later
329 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
330 }
TECCountDirectTextEncodingConversionsnull331 function TECCountDirectTextEncodingConversions( var numberOfEncodings: ItemCount ): OSStatus; external name '_TECCountDirectTextEncodingConversions';
332 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
333
334
335 { fill in an array of type TextEncodingPair passed in by the user with types of encoding pairs the current configuration of the encoder can handle. }
336 {
337 * TECGetDirectTextEncodingConversions()
338 *
339 * Availability:
340 * Mac OS X: in version 10.0 and later in CoreServices.framework
341 * CarbonLib: in CarbonLib 1.0 and later
342 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
343 }
TECGetDirectTextEncodingConversionsnull344 function TECGetDirectTextEncodingConversions( availableConversions: {variable-size-array} TECConversionInfoPtr; maxAvailableConversions: ItemCount; var actualAvailableConversions: ItemCount ): OSStatus; external name '_TECGetDirectTextEncodingConversions';
345 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
346
347
348 { return number of encodings a given encoding can be converter into }
349 {
350 * TECCountDestinationTextEncodings()
351 *
352 * Availability:
353 * Mac OS X: in version 10.0 and later in CoreServices.framework
354 * CarbonLib: in CarbonLib 1.0 and later
355 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
356 }
TECCountDestinationTextEncodingsnull357 function TECCountDestinationTextEncodings( inputEncoding: TextEncoding; var numberOfEncodings: ItemCount ): OSStatus; external name '_TECCountDestinationTextEncodings';
358 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
359
360
361 { fill in an array of type TextEncodingPair passed in by the user with types of encodings pairs the current configuration of the encoder can handle. }
362 {
363 * TECGetDestinationTextEncodings()
364 *
365 * Availability:
366 * Mac OS X: in version 10.0 and later in CoreServices.framework
367 * CarbonLib: in CarbonLib 1.0 and later
368 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
369 }
TECGetDestinationTextEncodingsnull370 function TECGetDestinationTextEncodings( inputEncoding: TextEncoding; destinationEncodings: {variable-size-array} TextEncodingPtr; maxDestinationEncodings: ItemCount; var actualDestinationEncodings: ItemCount ): OSStatus; external name '_TECGetDestinationTextEncodings';
371 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
372
373
374 { get info about a text encoding }
375 {
376 * TECGetTextEncodingInternetName()
377 *
378 * Availability:
379 * Mac OS X: in version 10.0 and later in CoreServices.framework
380 * CarbonLib: in CarbonLib 1.0 and later
381 * Non-Carbon CFM: in TextEncodingConverter 1.1 and later
382 }
TECGetTextEncodingInternetNamenull383 function TECGetTextEncodingInternetName( textEncoding_: TextEncoding; var encodingName: Str255 ): OSStatus; external name '_TECGetTextEncodingInternetName';
384 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
385
386
387 {
388 * TECGetTextEncodingFromInternetName()
389 *
390 * Availability:
391 * Mac OS X: in version 10.0 and later in CoreServices.framework
392 * CarbonLib: in CarbonLib 1.0 and later
393 * Non-Carbon CFM: in TextEncodingConverter 1.1 and later
394 }
TECGetTextEncodingFromInternetNamenull395 function TECGetTextEncodingFromInternetName( var textEncoding_: TextEncoding; const (*var*) encodingName: Str255 ): OSStatus; external name '_TECGetTextEncodingFromInternetName';
396 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
397
398
399 { create/dispose converters }
400 {
401 * TECCreateConverter()
402 *
403 * Availability:
404 * Mac OS X: in version 10.0 and later in CoreServices.framework
405 * CarbonLib: in CarbonLib 1.0 and later
406 * Non-Carbon CFM: in TextEncodingConverter 1.1 and later
407 }
TECCreateConverternull408 function TECCreateConverter( var newEncodingConverter: TECObjectRef; inputEncoding: TextEncoding; outputEncoding: TextEncoding ): OSStatus; external name '_TECCreateConverter';
409 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
410
411
412 {
413 * TECCreateConverterFromPath()
414 *
415 * Availability:
416 * Mac OS X: in version 10.0 and later in CoreServices.framework
417 * CarbonLib: in CarbonLib 1.0 and later
418 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
419 }
TECCreateConverterFromPathnull420 function TECCreateConverterFromPath( var newEncodingConverter: TECObjectRef; {const} inPath: {variable-size-array} TextEncodingPtr; inEncodings: ItemCount ): OSStatus; external name '_TECCreateConverterFromPath';
421 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
422
423
424 {
425 * TECDisposeConverter()
426 *
427 * Availability:
428 * Mac OS X: in version 10.0 and later in CoreServices.framework
429 * CarbonLib: in CarbonLib 1.0 and later
430 * Non-Carbon CFM: in TextEncodingConverter 1.1 and later
431 }
TECDisposeConverternull432 function TECDisposeConverter( newEncodingConverter: TECObjectRef ): OSStatus; external name '_TECDisposeConverter';
433 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
434
435
436 { convert text encodings }
437 {
438 * TECClearConverterContextInfo()
439 *
440 * Availability:
441 * Mac OS X: in version 10.0 and later in CoreServices.framework
442 * CarbonLib: in CarbonLib 1.0 and later
443 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
444 }
TECClearConverterContextInfonull445 function TECClearConverterContextInfo( encodingConverter: TECObjectRef ): OSStatus; external name '_TECClearConverterContextInfo';
446 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
447
448
449 {
450 * TECConvertText()
451 *
452 * Availability:
453 * Mac OS X: in version 10.0 and later in CoreServices.framework
454 * CarbonLib: in CarbonLib 1.0 and later
455 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
456 }
TECConvertTextnull457 function TECConvertText( encodingConverter: TECObjectRef; inputBuffer: ConstTextPtr; inputBufferLength: ByteCount; var actualInputLength: ByteCount; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount ): OSStatus; external name '_TECConvertText';
458 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
459
460
461 {
462 * TECFlushText()
463 *
464 * Availability:
465 * Mac OS X: in version 10.0 and later in CoreServices.framework
466 * CarbonLib: in CarbonLib 1.0 and later
467 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
468 }
TECFlushTextnull469 function TECFlushText( encodingConverter: TECObjectRef; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount ): OSStatus; external name '_TECFlushText';
470 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
471
472
473 { one-to-many routines }
474 {
475 * TECCountSubTextEncodings()
476 *
477 * Availability:
478 * Mac OS X: in version 10.0 and later in CoreServices.framework
479 * CarbonLib: in CarbonLib 1.0 and later
480 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
481 }
TECCountSubTextEncodingsnull482 function TECCountSubTextEncodings( inputEncoding: TextEncoding; var numberOfEncodings: ItemCount ): OSStatus; external name '_TECCountSubTextEncodings';
483 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
484
485
486 {
487 * TECGetSubTextEncodings()
488 *
489 * Availability:
490 * Mac OS X: in version 10.0 and later in CoreServices.framework
491 * CarbonLib: in CarbonLib 1.0 and later
492 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
493 }
TECGetSubTextEncodingsnull494 function TECGetSubTextEncodings( inputEncoding: TextEncoding; subEncodings: {variable-size-array} TextEncodingPtr; maxSubEncodings: ItemCount; var actualSubEncodings: ItemCount ): OSStatus; external name '_TECGetSubTextEncodings';
495 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
496
497
498 {
499 * TECGetEncodingList()
500 *
501 * Parameters:
502 *
503 * encodingConverter:
504 * The encodingConverter to return the encoding list for
505 *
506 * numEncodings:
507 * On exit, the number of encodings in encodingList
508 *
509 * encodingList:
510 * On exit, a handle containing numEncodings values of type
511 * TextEncoding, for each known encoding. Do not dispose of this
512 * handle.
513 *
514 * Availability:
515 * Mac OS X: in version 10.0 and later in CoreServices.framework
516 * CarbonLib: in CarbonLib 1.0 and later
517 * Non-Carbon CFM: in TextEncodingConverter 1.1 and later
518 }
TECGetEncodingListnull519 function TECGetEncodingList( encodingConverter: TECObjectRef; var numEncodings: ItemCount; var encodingList: Handle ): OSStatus; external name '_TECGetEncodingList';
520 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
521
522
523 {
524 * TECCreateOneToManyConverter()
525 *
526 * Availability:
527 * Mac OS X: in version 10.0 and later in CoreServices.framework
528 * CarbonLib: in CarbonLib 1.0 and later
529 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
530 }
TECCreateOneToManyConverternull531 function TECCreateOneToManyConverter( var newEncodingConverter: TECObjectRef; inputEncoding: TextEncoding; numOutputEncodings: ItemCount; {const} outputEncodings: {variable-size-array} TextEncodingPtr ): OSStatus; external name '_TECCreateOneToManyConverter';
532 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
533
534
535 {
536 * TECConvertTextToMultipleEncodings()
537 *
538 * Availability:
539 * Mac OS X: in version 10.0 and later in CoreServices.framework
540 * CarbonLib: in CarbonLib 1.0 and later
541 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
542 }
TECConvertTextToMultipleEncodingsnull543 function TECConvertTextToMultipleEncodings( encodingConverter: TECObjectRef; inputBuffer: ConstTextPtr; inputBufferLength: ByteCount; var actualInputLength: ByteCount; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount; outEncodingsBuffer: {variable-size-array} TextEncodingRunPtr; maxOutEncodingRuns: ItemCount; var actualOutEncodingRuns: ItemCount ): OSStatus; external name '_TECConvertTextToMultipleEncodings';
544 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
545
546
547 {
548 * TECFlushMultipleEncodings()
549 *
550 * Availability:
551 * Mac OS X: in version 10.0 and later in CoreServices.framework
552 * CarbonLib: in CarbonLib 1.0 and later
553 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
554 }
TECFlushMultipleEncodingsnull555 function TECFlushMultipleEncodings( encodingConverter: TECObjectRef; outputBuffer: TextPtr; outputBufferLength: ByteCount; var actualOutputLength: ByteCount; outEncodingsBuffer: {variable-size-array} TextEncodingRunPtr; maxOutEncodingRuns: ItemCount; var actualOutEncodingRuns: ItemCount ): OSStatus; external name '_TECFlushMultipleEncodings';
556 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
557
558
559 { international internet info }
560 {
561 * TECCountWebTextEncodings()
562 *
563 * Availability:
564 * Mac OS X: in version 10.0 and later in CoreServices.framework
565 * CarbonLib: in CarbonLib 1.0 and later
566 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
567 }
TECCountWebTextEncodingsnull568 function TECCountWebTextEncodings( locale: RegionCode; var numberEncodings: ItemCount ): OSStatus; external name '_TECCountWebTextEncodings';
569 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
570
571
572 {
573 * TECGetWebTextEncodings()
574 *
575 * Availability:
576 * Mac OS X: in version 10.0 and later in CoreServices.framework
577 * CarbonLib: in CarbonLib 1.0 and later
578 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
579 }
TECGetWebTextEncodingsnull580 function TECGetWebTextEncodings( locale: RegionCode; availableEncodings: {variable-size-array} TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount ): OSStatus; external name '_TECGetWebTextEncodings';
581 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
582
583
584 {
585 * TECCountMailTextEncodings()
586 *
587 * Availability:
588 * Mac OS X: in version 10.0 and later in CoreServices.framework
589 * CarbonLib: in CarbonLib 1.0 and later
590 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
591 }
TECCountMailTextEncodingsnull592 function TECCountMailTextEncodings( locale: RegionCode; var numberEncodings: ItemCount ): OSStatus; external name '_TECCountMailTextEncodings';
593 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
594
595
596 {
597 * TECGetMailTextEncodings()
598 *
599 * Availability:
600 * Mac OS X: in version 10.0 and later in CoreServices.framework
601 * CarbonLib: in CarbonLib 1.0 and later
602 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
603 }
TECGetMailTextEncodingsnull604 function TECGetMailTextEncodings( locale: RegionCode; availableEncodings: {variable-size-array} TextEncodingPtr; maxAvailableEncodings: ItemCount; var actualAvailableEncodings: ItemCount ): OSStatus; external name '_TECGetMailTextEncodings';
605 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
606
607
608 { examine text encodings }
609 {
610 * TECCountAvailableSniffers()
611 *
612 * Availability:
613 * Mac OS X: in version 10.0 and later in CoreServices.framework
614 * CarbonLib: in CarbonLib 1.0 and later
615 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
616 }
TECCountAvailableSniffersnull617 function TECCountAvailableSniffers( var numberOfEncodings: ItemCount ): OSStatus; external name '_TECCountAvailableSniffers';
618 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
619
620
621 {
622 * TECGetAvailableSniffers()
623 *
624 * Availability:
625 * Mac OS X: in version 10.0 and later in CoreServices.framework
626 * CarbonLib: in CarbonLib 1.0 and later
627 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
628 }
TECGetAvailableSniffersnull629 function TECGetAvailableSniffers( availableSniffers: {variable-size-array} TextEncodingPtr; maxAvailableSniffers: ItemCount; var actualAvailableSniffers: ItemCount ): OSStatus; external name '_TECGetAvailableSniffers';
630 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
631
632
633 {
634 * TECCreateSniffer()
635 *
636 * Availability:
637 * Mac OS X: in version 10.0 and later in CoreServices.framework
638 * CarbonLib: in CarbonLib 1.0 and later
639 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
640 }
TECCreateSniffernull641 function TECCreateSniffer( var encodingSniffer: TECSnifferObjectRef; {const} testEncodings: {variable-size-array} TextEncodingPtr; numTextEncodings: ItemCount ): OSStatus; external name '_TECCreateSniffer';
642 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
643
644
645 {
646 * TECSniffTextEncoding()
647 *
648 * Availability:
649 * Mac OS X: in version 10.0 and later in CoreServices.framework
650 * CarbonLib: in CarbonLib 1.0 and later
651 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
652 }
TECSniffTextEncodingnull653 function TECSniffTextEncoding( encodingSniffer: TECSnifferObjectRef; inputBuffer: ConstTextPtr; inputBufferLength: ByteCount; testEncodings: {variable-size-array} TextEncodingPtr; numTextEncodings: ItemCount; numErrsArray: {variable-size-array} ItemCountPtr; maxErrs: ItemCount; numFeaturesArray: {variable-size-array} ItemCountPtr; maxFeatures: ItemCount ): OSStatus; external name '_TECSniffTextEncoding';
654 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
655
656
657 {
658 * TECDisposeSniffer()
659 *
660 * Availability:
661 * Mac OS X: in version 10.0 and later in CoreServices.framework
662 * CarbonLib: in CarbonLib 1.0 and later
663 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
664 }
TECDisposeSniffernull665 function TECDisposeSniffer( encodingSniffer: TECSnifferObjectRef ): OSStatus; external name '_TECDisposeSniffer';
666 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
667
668
669 {
670 * TECClearSnifferContextInfo()
671 *
672 * Availability:
673 * Mac OS X: in version 10.0 and later in CoreServices.framework
674 * CarbonLib: in CarbonLib 1.0 and later
675 * Non-Carbon CFM: in TextEncodingConverter 1.2 and later
676 }
TECClearSnifferContextInfonull677 function TECClearSnifferContextInfo( encodingSniffer: TECSnifferObjectRef ): OSStatus; external name '_TECClearSnifferContextInfo';
678 (* __OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_NA) *)
679
680
681 {
682 * TECSetBasicOptions()
683 *
684 * Summary:
685 * Sets encodingConverter options affecting
686 * TECConvertText[ToMultipleEncodings].
687 *
688 * Parameters:
689 *
690 * encodingConverter:
691 * The high-level encoding converter object created by
692 * TECCreateConverter or TECCreateOneToManyConverter whose
693 * behavior is to be modified by the options specified in
694 * controlFlags.
695 *
696 * controlFlags:
697 * A bit mask specifying the desired options. The following mask
698 * constants are valid for this parameter; multiple mask constants
699 * may be ORed together to set multiple options; passing 0 for
700 * this parameter clears all options:
701 *
702 * kUnicodeForceASCIIRangeMask, kUnicodeNoHalfwidthCharsMask
703 * (defined in UnicodeConverter.h)
704 *
705 * kTECDisableFallbacksMask, kTECDisableLooseMappingsMask (defined
706 * above) - loose and fallback mappings are both enabled by
707 * default for the TextEncodingConverter.h conversion APIs
708 * (TECConvertText, TECConvertTextToMultipleEncodings), unlike the
709 * behavior of the conversion APIs in UnicodeConverter.h. These
710 * options may be used to disable loose and/or fallback mappings
711 * for the TextEncodingConverter.h conversion APIs.
712 *
713 * Result:
714 * The function returns paramErr for invalid masks,
715 * kTECCorruptConverterErr for an invalid encodingConverter, noErr
716 * otherwise.
717 *
718 * Availability:
719 * Mac OS X: in version 10.3 and later in CoreServices.framework
720 * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
721 * Non-Carbon CFM: in TextEncodingConverter 1.5 and later
722 }
TECSetBasicOptionsnull723 function TECSetBasicOptions( encodingConverter: TECObjectRef; controlFlags: OptionBits ): OSStatus; external name '_TECSetBasicOptions';
724 (* __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
725
726
727 { Map TextEncoding values to/from IANA charset names and/or MIB enums, with usage control }
728 {
729 * TECCopyTextEncodingInternetNameAndMIB()
730 *
731 * Summary:
732 * Converts a TextEncoding value to an IANA charset name and/or a
733 * MIB enum value
734 *
735 * Discussion:
736 * Given a TextEncoding value, this function maps it to an IANA
737 * charset name (if encodingNamePtr is non-NULL) and/or a MIB enum
738 * value (if mibEnumPtr is non-NULL), as specified by the usage
739 * parameter.
740 *
741 * Parameters:
742 *
743 * textEncoding:
744 * A TextEncoding value to map to a charset name and/or MIB enum.
745 *
746 * usage:
747 * Specifies the type of mapping desired (see
748 * TECInternetNameUsageMask above).
749 *
750 * encodingNamePtr:
751 * If non-NULL, is a pointer to a CStringRef for an immutable
752 * CFString created by this function; when the caller is finished
753 * with it, the caller must dispose of it by calling CFRelease.
754 *
755 * mibEnumPtr:
756 * If non-NULL, is a pointer to an SInt32 that will be set to the
757 * appropriate MIB enum value, or to 0 (or kTEC_MIBEnumDontCare)
758 * if there is no appropriate MIB enum value (valid MIB enums
759 * begin at 3).
760 *
761 * Result:
762 * The function returns paramErr if encodingNamePtr and mibEnumPtr
763 * are both NULL. It returns kTextUnsupportedEncodingErr if it has
764 * no data for the supplied textEncoding. It returns noErr if it
765 * found useful data.
766 *
767 * Availability:
768 * Mac OS X: in version 10.3 and later in CoreServices.framework
769 * CarbonLib: not available
770 * Non-Carbon CFM: not available
771 }
TECCopyTextEncodingInternetNameAndMIBnull772 function TECCopyTextEncodingInternetNameAndMIB( textEncoding_: TextEncoding; usage: TECInternetNameUsageMask; encodingNamePtr: CFStringRefPtr { can be NULL }; mibEnumPtr: SInt32Ptr { can be NULL } ): OSStatus; external name '_TECCopyTextEncodingInternetNameAndMIB';
773 (* __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
774
775
776 {
777 * TECGetTextEncodingFromInternetNameOrMIB()
778 *
779 * Summary:
780 * Converts an IANA charset name or a MIB enum value to a
781 * TextEncoding value
782 *
783 * Discussion:
784 * If encodingName is non-NULL, this function treats it as an IANA
785 * charset name and maps it to a TextEncoding value; in this case
786 * mibEnum is ignored, and may be set to kTEC_MIBEnumDontCare.
787 * Otherwise, this function maps the mibEnum to a TextEncoding
788 * value. In either case, the mapping is controlled by the usage
789 * parameter. The textEncodingPtr parameter must be non-NULL.
790 *
791 * Result:
792 * The function returns paramErr if textEncodingPtr is NULL. It
793 * returns kTextUnsupportedEncodingErr if it has no data for the
794 * supplied encodingName or mibEnum. It returns noErr if it found
795 * useful data.
796 *
797 * Availability:
798 * Mac OS X: in version 10.3 and later in CoreServices.framework
799 * CarbonLib: not available
800 * Non-Carbon CFM: not available
801 }
TECGetTextEncodingFromInternetNameOrMIBnull802 function TECGetTextEncodingFromInternetNameOrMIB( var textEncodingPtr: TextEncoding; usage: TECInternetNameUsageMask; encodingName: CFStringRef; mibEnum: SInt32 ): OSStatus; external name '_TECGetTextEncodingFromInternetNameOrMIB';
803 (* __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_NA) *)
804
805
806 {$endc} {TARGET_OS_MAC}
807
808 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
809
810 end.
811 {$endc} {not MACOSALLINCLUDE}
812