Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

759 lines
24 KiB

  1. /*
  2. File: UnicodeConverter.h
  3. Contains: Types, constants, and prototypes for Unicode Converter
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1994-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __UNICODECONVERTER__
  11. #define __UNICODECONVERTER__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __TEXTCOMMON__
  16. #include <TextCommon.h>
  17. #endif
  18. #ifndef __MIXEDMODE__
  19. #include <MixedMode.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. #if PRAGMA_STRUCT_ALIGN
  31. #pragma options align=mac68k
  32. #elif PRAGMA_STRUCT_PACKPUSH
  33. #pragma pack(push, 2)
  34. #elif PRAGMA_STRUCT_PACK
  35. #pragma pack(2)
  36. #endif
  37. /* Unicode conversion contexts: */
  38. typedef struct OpaqueTextToUnicodeInfo* TextToUnicodeInfo;
  39. typedef struct OpaqueUnicodeToTextInfo* UnicodeToTextInfo;
  40. typedef struct OpaqueUnicodeToTextRunInfo* UnicodeToTextRunInfo;
  41. typedef const TextToUnicodeInfo ConstTextToUnicodeInfo;
  42. typedef const UnicodeToTextInfo ConstUnicodeToTextInfo;
  43. /* UnicodeMapVersion type & values */
  44. typedef SInt32 UnicodeMapVersion;
  45. enum {
  46. kUnicodeUseLatestMapping = -1,
  47. kUnicodeUseHFSPlusMapping = 4
  48. };
  49. /* Types used in conversion */
  50. struct UnicodeMapping {
  51. TextEncoding unicodeEncoding;
  52. TextEncoding otherEncoding;
  53. UnicodeMapVersion mappingVersion;
  54. };
  55. typedef struct UnicodeMapping UnicodeMapping;
  56. typedef UnicodeMapping * UnicodeMappingPtr;
  57. typedef const UnicodeMapping * ConstUnicodeMappingPtr;
  58. /* Control flags for ConvertFromUnicodeToText and ConvertFromTextToUnicode */
  59. enum {
  60. kUnicodeUseFallbacksBit = 0,
  61. kUnicodeKeepInfoBit = 1,
  62. kUnicodeDirectionalityBits = 2,
  63. kUnicodeVerticalFormBit = 4,
  64. kUnicodeLooseMappingsBit = 5,
  65. kUnicodeStringUnterminatedBit = 6,
  66. kUnicodeTextRunBit = 7,
  67. kUnicodeKeepSameEncodingBit = 8,
  68. kUnicodeForceASCIIRangeBit = 9,
  69. kUnicodeNoHalfwidthCharsBit = 10,
  70. kUnicodeTextRunHeuristicsBit = 11,
  71. kUnicodeMapLineFeedToReturnBit = 12
  72. };
  73. enum {
  74. kUnicodeUseFallbacksMask = 1L << kUnicodeUseFallbacksBit,
  75. kUnicodeKeepInfoMask = 1L << kUnicodeKeepInfoBit,
  76. kUnicodeDirectionalityMask = 3L << kUnicodeDirectionalityBits,
  77. kUnicodeVerticalFormMask = 1L << kUnicodeVerticalFormBit,
  78. kUnicodeLooseMappingsMask = 1L << kUnicodeLooseMappingsBit,
  79. kUnicodeStringUnterminatedMask = 1L << kUnicodeStringUnterminatedBit,
  80. kUnicodeTextRunMask = 1L << kUnicodeTextRunBit,
  81. kUnicodeKeepSameEncodingMask = 1L << kUnicodeKeepSameEncodingBit,
  82. kUnicodeForceASCIIRangeMask = 1L << kUnicodeForceASCIIRangeBit,
  83. kUnicodeNoHalfwidthCharsMask = 1L << kUnicodeNoHalfwidthCharsBit,
  84. kUnicodeTextRunHeuristicsMask = 1L << kUnicodeTextRunHeuristicsBit,
  85. kUnicodeMapLineFeedToReturnMask = 1L << kUnicodeMapLineFeedToReturnBit
  86. };
  87. /* Values for kUnicodeDirectionality field */
  88. enum {
  89. kUnicodeDefaultDirection = 0,
  90. kUnicodeLeftToRight = 1,
  91. kUnicodeRightToLeft = 2
  92. };
  93. /* Directionality masks for control flags */
  94. enum {
  95. kUnicodeDefaultDirectionMask = kUnicodeDefaultDirection << kUnicodeDirectionalityBits,
  96. kUnicodeLeftToRightMask = kUnicodeLeftToRight << kUnicodeDirectionalityBits,
  97. kUnicodeRightToLeftMask = kUnicodeRightToLeft << kUnicodeDirectionalityBits
  98. };
  99. /* Control flags for TruncateForUnicodeToText: */
  100. /*
  101. Now TruncateForUnicodeToText uses control flags from the same set as used by
  102. ConvertFromTextToUnicode, ConvertFromUnicodeToText, etc., but only
  103. kUnicodeStringUnterminatedMask is meaningful for TruncateForUnicodeToText.
  104. Previously two special control flags were defined for TruncateForUnicodeToText:
  105. kUnicodeTextElementSafeBit = 0
  106. kUnicodeRestartSafeBit = 1
  107. However, neither of these was implemented.
  108. Instead of implementing kUnicodeTextElementSafeBit, we now use
  109. kUnicodeStringUnterminatedMask since it accomplishes the same thing and avoids
  110. having special flags just for TruncateForUnicodeToText
  111. Also, kUnicodeRestartSafeBit is unnecessary, since restart-safeness is handled by
  112. setting kUnicodeKeepInfoBit with ConvertFromUnicodeToText.
  113. If TruncateForUnicodeToText is called with one or both of the old special control
  114. flags set (bits 0 or 1), it will not generate a paramErr, but the old bits have no
  115. effect on its operation.
  116. */
  117. /* Filter bits for filter field in QueryUnicodeMappings and CountUnicodeMappings: */
  118. enum {
  119. kUnicodeMatchUnicodeBaseBit = 0,
  120. kUnicodeMatchUnicodeVariantBit = 1,
  121. kUnicodeMatchUnicodeFormatBit = 2,
  122. kUnicodeMatchOtherBaseBit = 3,
  123. kUnicodeMatchOtherVariantBit = 4,
  124. kUnicodeMatchOtherFormatBit = 5
  125. };
  126. enum {
  127. kUnicodeMatchUnicodeBaseMask = 1L << kUnicodeMatchUnicodeBaseBit,
  128. kUnicodeMatchUnicodeVariantMask = 1L << kUnicodeMatchUnicodeVariantBit,
  129. kUnicodeMatchUnicodeFormatMask = 1L << kUnicodeMatchUnicodeFormatBit,
  130. kUnicodeMatchOtherBaseMask = 1L << kUnicodeMatchOtherBaseBit,
  131. kUnicodeMatchOtherVariantMask = 1L << kUnicodeMatchOtherVariantBit,
  132. kUnicodeMatchOtherFormatMask = 1L << kUnicodeMatchOtherFormatBit
  133. };
  134. /* Control flags for SetFallbackUnicodeToText */
  135. enum {
  136. kUnicodeFallbackSequencingBits = 0
  137. };
  138. enum {
  139. kUnicodeFallbackSequencingMask = 3L << kUnicodeFallbackSequencingBits,
  140. kUnicodeFallbackInterruptSafeMask = 1L << 2 /* To indicate that caller fallback routine doesn't move memory*/
  141. };
  142. /* values for kUnicodeFallbackSequencing field */
  143. enum {
  144. kUnicodeFallbackDefaultOnly = 0L,
  145. kUnicodeFallbackCustomOnly = 1L,
  146. kUnicodeFallbackDefaultFirst = 2L,
  147. kUnicodeFallbackCustomFirst = 3L
  148. };
  149. /* Caller-supplied entry point to a fallback handler */
  150. typedef CALLBACK_API( OSStatus , UnicodeToTextFallbackProcPtr )(UniChar *iSrcUniStr, ByteCount iSrcUniStrLen, ByteCount *oSrcConvLen, TextPtr oDestStr, ByteCount iDestStrLen, ByteCount *oDestConvLen, LogicalAddress iInfoPtr, ConstUnicodeMappingPtr iUnicodeMappingPtr);
  151. typedef STACK_UPP_TYPE(UnicodeToTextFallbackProcPtr) UnicodeToTextFallbackUPP;
  152. /*
  153. * NewUnicodeToTextFallbackUPP()
  154. *
  155. * Availability:
  156. * Non-Carbon CFM: available as macro/inline
  157. * CarbonLib: in CarbonLib 1.0 and later
  158. * Mac OS X: in version 10.0 and later
  159. */
  160. EXTERN_API_C( UnicodeToTextFallbackUPP )
  161. NewUnicodeToTextFallbackUPP(UnicodeToTextFallbackProcPtr userRoutine);
  162. #if !OPAQUE_UPP_TYPES
  163. enum { uppUnicodeToTextFallbackProcInfo = 0x003FFFF0 }; /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  164. #ifdef __cplusplus
  165. inline DEFINE_API_C(UnicodeToTextFallbackUPP) NewUnicodeToTextFallbackUPP(UnicodeToTextFallbackProcPtr userRoutine) { return (UnicodeToTextFallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUnicodeToTextFallbackProcInfo, GetCurrentArchitecture()); }
  166. #else
  167. #define NewUnicodeToTextFallbackUPP(userRoutine) (UnicodeToTextFallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUnicodeToTextFallbackProcInfo, GetCurrentArchitecture())
  168. #endif
  169. #endif
  170. /*
  171. * DisposeUnicodeToTextFallbackUPP()
  172. *
  173. * Availability:
  174. * Non-Carbon CFM: available as macro/inline
  175. * CarbonLib: in CarbonLib 1.0 and later
  176. * Mac OS X: in version 10.0 and later
  177. */
  178. EXTERN_API_C( void )
  179. DisposeUnicodeToTextFallbackUPP(UnicodeToTextFallbackUPP userUPP);
  180. #if !OPAQUE_UPP_TYPES
  181. #ifdef __cplusplus
  182. inline DEFINE_API_C(void) DisposeUnicodeToTextFallbackUPP(UnicodeToTextFallbackUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  183. #else
  184. #define DisposeUnicodeToTextFallbackUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  185. #endif
  186. #endif
  187. /*
  188. * InvokeUnicodeToTextFallbackUPP()
  189. *
  190. * Availability:
  191. * Non-Carbon CFM: available as macro/inline
  192. * CarbonLib: in CarbonLib 1.0 and later
  193. * Mac OS X: in version 10.0 and later
  194. */
  195. EXTERN_API_C( OSStatus )
  196. InvokeUnicodeToTextFallbackUPP(
  197. UniChar * iSrcUniStr,
  198. ByteCount iSrcUniStrLen,
  199. ByteCount * oSrcConvLen,
  200. TextPtr oDestStr,
  201. ByteCount iDestStrLen,
  202. ByteCount * oDestConvLen,
  203. LogicalAddress iInfoPtr,
  204. ConstUnicodeMappingPtr iUnicodeMappingPtr,
  205. UnicodeToTextFallbackUPP userUPP);
  206. #if !OPAQUE_UPP_TYPES
  207. #ifdef __cplusplus
  208. inline DEFINE_API_C(OSStatus) InvokeUnicodeToTextFallbackUPP(UniChar * iSrcUniStr, ByteCount iSrcUniStrLen, ByteCount * oSrcConvLen, TextPtr oDestStr, ByteCount iDestStrLen, ByteCount * oDestConvLen, LogicalAddress iInfoPtr, ConstUnicodeMappingPtr iUnicodeMappingPtr, UnicodeToTextFallbackUPP userUPP) { return (OSStatus)CALL_EIGHT_PARAMETER_UPP(userUPP, uppUnicodeToTextFallbackProcInfo, iSrcUniStr, iSrcUniStrLen, oSrcConvLen, oDestStr, iDestStrLen, oDestConvLen, iInfoPtr, iUnicodeMappingPtr); }
  209. #else
  210. #define InvokeUnicodeToTextFallbackUPP(iSrcUniStr, iSrcUniStrLen, oSrcConvLen, oDestStr, iDestStrLen, oDestConvLen, iInfoPtr, iUnicodeMappingPtr, userUPP) (OSStatus)CALL_EIGHT_PARAMETER_UPP((userUPP), uppUnicodeToTextFallbackProcInfo, (iSrcUniStr), (iSrcUniStrLen), (oSrcConvLen), (oDestStr), (iDestStrLen), (oDestConvLen), (iInfoPtr), (iUnicodeMappingPtr))
  211. #endif
  212. #endif
  213. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  214. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  215. #define NewUnicodeToTextFallbackProc(userRoutine) NewUnicodeToTextFallbackUPP(userRoutine)
  216. #define CallUnicodeToTextFallbackProc(userRoutine, iSrcUniStr, iSrcUniStrLen, oSrcConvLen, oDestStr, iDestStrLen, oDestConvLen, iInfoPtr, iUnicodeMappingPtr) InvokeUnicodeToTextFallbackUPP(iSrcUniStr, iSrcUniStrLen, oSrcConvLen, oDestStr, iDestStrLen, oDestConvLen, iInfoPtr, iUnicodeMappingPtr, userRoutine)
  217. #endif /* CALL_NOT_IN_CARBON */
  218. /* Function prototypes */
  219. #if TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  220. /*
  221. Routine to Initialize the Unicode Converter and cleanup once done with it.
  222. These routines must be called from Static Library clients.
  223. */
  224. #if CALL_NOT_IN_CARBON
  225. /*
  226. * InitializeUnicodeConverter()
  227. *
  228. * Availability:
  229. * Non-Carbon CFM: not available
  230. * CarbonLib: not available
  231. * Mac OS X: not available
  232. */
  233. EXTERN_API( OSStatus )
  234. InitializeUnicodeConverter(StringPtr TECFileName);
  235. /*
  236. * TerminateUnicodeConverter()
  237. *
  238. * Availability:
  239. * Non-Carbon CFM: not available
  240. * CarbonLib: not available
  241. * Mac OS X: not available
  242. */
  243. EXTERN_API( void )
  244. TerminateUnicodeConverter(void);
  245. /* Note: the old names (InitializeUnicode, TerminateUnicode) for the above are still exported.*/
  246. #endif /* CALL_NOT_IN_CARBON */
  247. #endif /* TARGET_CPU_68K && !TARGET_RT_MAC_CFM */
  248. /*
  249. * CreateTextToUnicodeInfo()
  250. *
  251. * Availability:
  252. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  253. * CarbonLib: in CarbonLib 1.0 and later
  254. * Mac OS X: in version 10.0 and later
  255. */
  256. EXTERN_API( OSStatus )
  257. CreateTextToUnicodeInfo(
  258. ConstUnicodeMappingPtr iUnicodeMapping,
  259. TextToUnicodeInfo * oTextToUnicodeInfo);
  260. /*
  261. * CreateTextToUnicodeInfoByEncoding()
  262. *
  263. * Availability:
  264. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  265. * CarbonLib: in CarbonLib 1.0 and later
  266. * Mac OS X: in version 10.0 and later
  267. */
  268. EXTERN_API( OSStatus )
  269. CreateTextToUnicodeInfoByEncoding(
  270. TextEncoding iEncoding,
  271. TextToUnicodeInfo * oTextToUnicodeInfo);
  272. /*
  273. * CreateUnicodeToTextInfo()
  274. *
  275. * Availability:
  276. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  277. * CarbonLib: in CarbonLib 1.0 and later
  278. * Mac OS X: in version 10.0 and later
  279. */
  280. EXTERN_API( OSStatus )
  281. CreateUnicodeToTextInfo(
  282. ConstUnicodeMappingPtr iUnicodeMapping,
  283. UnicodeToTextInfo * oUnicodeToTextInfo);
  284. /*
  285. * CreateUnicodeToTextInfoByEncoding()
  286. *
  287. * Availability:
  288. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  289. * CarbonLib: in CarbonLib 1.0 and later
  290. * Mac OS X: in version 10.0 and later
  291. */
  292. EXTERN_API( OSStatus )
  293. CreateUnicodeToTextInfoByEncoding(
  294. TextEncoding iEncoding,
  295. UnicodeToTextInfo * oUnicodeToTextInfo);
  296. /*
  297. * CreateUnicodeToTextRunInfo()
  298. *
  299. * Availability:
  300. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  301. * CarbonLib: in CarbonLib 1.0 and later
  302. * Mac OS X: in version 10.0 and later
  303. */
  304. EXTERN_API( OSStatus )
  305. CreateUnicodeToTextRunInfo(
  306. ItemCount iNumberOfMappings,
  307. const UnicodeMapping iUnicodeMappings[],
  308. UnicodeToTextRunInfo * oUnicodeToTextInfo);
  309. /*
  310. * CreateUnicodeToTextRunInfoByEncoding()
  311. *
  312. * Availability:
  313. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  314. * CarbonLib: in CarbonLib 1.0 and later
  315. * Mac OS X: in version 10.0 and later
  316. */
  317. EXTERN_API( OSStatus )
  318. CreateUnicodeToTextRunInfoByEncoding(
  319. ItemCount iNumberOfEncodings,
  320. const TextEncoding iEncodings[],
  321. UnicodeToTextRunInfo * oUnicodeToTextInfo);
  322. /*
  323. * CreateUnicodeToTextRunInfoByScriptCode()
  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. EXTERN_API( OSStatus )
  331. CreateUnicodeToTextRunInfoByScriptCode(
  332. ItemCount iNumberOfScriptCodes,
  333. const ScriptCode iScripts[],
  334. UnicodeToTextRunInfo * oUnicodeToTextInfo);
  335. /* Change the TextToUnicodeInfo to another mapping. */
  336. /*
  337. * ChangeTextToUnicodeInfo()
  338. *
  339. * Availability:
  340. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  341. * CarbonLib: in CarbonLib 1.0 and later
  342. * Mac OS X: in version 10.0 and later
  343. */
  344. EXTERN_API( OSStatus )
  345. ChangeTextToUnicodeInfo(
  346. TextToUnicodeInfo ioTextToUnicodeInfo,
  347. ConstUnicodeMappingPtr iUnicodeMapping);
  348. /* Change the UnicodeToTextInfo to another mapping. */
  349. /*
  350. * ChangeUnicodeToTextInfo()
  351. *
  352. * Availability:
  353. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  354. * CarbonLib: in CarbonLib 1.0 and later
  355. * Mac OS X: in version 10.0 and later
  356. */
  357. EXTERN_API( OSStatus )
  358. ChangeUnicodeToTextInfo(
  359. UnicodeToTextInfo ioUnicodeToTextInfo,
  360. ConstUnicodeMappingPtr iUnicodeMapping);
  361. /*
  362. * DisposeTextToUnicodeInfo()
  363. *
  364. * Availability:
  365. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  366. * CarbonLib: in CarbonLib 1.0 and later
  367. * Mac OS X: in version 10.0 and later
  368. */
  369. EXTERN_API( OSStatus )
  370. DisposeTextToUnicodeInfo(TextToUnicodeInfo * ioTextToUnicodeInfo);
  371. /*
  372. * DisposeUnicodeToTextInfo()
  373. *
  374. * Availability:
  375. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  376. * CarbonLib: in CarbonLib 1.0 and later
  377. * Mac OS X: in version 10.0 and later
  378. */
  379. EXTERN_API( OSStatus )
  380. DisposeUnicodeToTextInfo(UnicodeToTextInfo * ioUnicodeToTextInfo);
  381. /*
  382. * DisposeUnicodeToTextRunInfo()
  383. *
  384. * Availability:
  385. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  386. * CarbonLib: in CarbonLib 1.0 and later
  387. * Mac OS X: in version 10.0 and later
  388. */
  389. EXTERN_API( OSStatus )
  390. DisposeUnicodeToTextRunInfo(UnicodeToTextRunInfo * ioUnicodeToTextRunInfo);
  391. /*
  392. * ConvertFromTextToUnicode()
  393. *
  394. * Availability:
  395. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  396. * CarbonLib: in CarbonLib 1.0 and later
  397. * Mac OS X: in version 10.0 and later
  398. */
  399. EXTERN_API( OSStatus )
  400. ConvertFromTextToUnicode(
  401. TextToUnicodeInfo iTextToUnicodeInfo,
  402. ByteCount iSourceLen,
  403. ConstLogicalAddress iSourceStr,
  404. OptionBits iControlFlags,
  405. ItemCount iOffsetCount,
  406. ByteOffset iOffsetArray[], /* can be NULL */
  407. ItemCount * oOffsetCount, /* can be NULL */
  408. ByteOffset oOffsetArray[], /* can be NULL */
  409. ByteCount iOutputBufLen,
  410. ByteCount * oSourceRead,
  411. ByteCount * oUnicodeLen,
  412. UniChar oUnicodeStr[]);
  413. /*
  414. * ConvertFromUnicodeToText()
  415. *
  416. * Availability:
  417. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  418. * CarbonLib: in CarbonLib 1.0 and later
  419. * Mac OS X: in version 10.0 and later
  420. */
  421. EXTERN_API( OSStatus )
  422. ConvertFromUnicodeToText(
  423. UnicodeToTextInfo iUnicodeToTextInfo,
  424. ByteCount iUnicodeLen,
  425. const UniChar iUnicodeStr[],
  426. OptionBits iControlFlags,
  427. ItemCount iOffsetCount,
  428. ByteOffset iOffsetArray[], /* can be NULL */
  429. ItemCount * oOffsetCount, /* can be NULL */
  430. ByteOffset oOffsetArray[], /* can be NULL */
  431. ByteCount iOutputBufLen,
  432. ByteCount * oInputRead,
  433. ByteCount * oOutputLen,
  434. LogicalAddress oOutputStr);
  435. /*
  436. * ConvertFromUnicodeToTextRun()
  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. EXTERN_API( OSStatus )
  444. ConvertFromUnicodeToTextRun(
  445. UnicodeToTextRunInfo iUnicodeToTextInfo,
  446. ByteCount iUnicodeLen,
  447. const UniChar iUnicodeStr[],
  448. OptionBits iControlFlags,
  449. ItemCount iOffsetCount,
  450. ByteOffset iOffsetArray[], /* can be NULL */
  451. ItemCount * oOffsetCount, /* can be NULL */
  452. ByteOffset oOffsetArray[], /* can be NULL */
  453. ByteCount iOutputBufLen,
  454. ByteCount * oInputRead,
  455. ByteCount * oOutputLen,
  456. LogicalAddress oOutputStr,
  457. ItemCount iEncodingRunBufLen,
  458. ItemCount * oEncodingRunOutLen,
  459. TextEncodingRun oEncodingRuns[]);
  460. /*
  461. * ConvertFromUnicodeToScriptCodeRun()
  462. *
  463. * Availability:
  464. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  465. * CarbonLib: in CarbonLib 1.0 and later
  466. * Mac OS X: in version 10.0 and later
  467. */
  468. EXTERN_API( OSStatus )
  469. ConvertFromUnicodeToScriptCodeRun(
  470. UnicodeToTextRunInfo iUnicodeToTextInfo,
  471. ByteCount iUnicodeLen,
  472. const UniChar iUnicodeStr[],
  473. OptionBits iControlFlags,
  474. ItemCount iOffsetCount,
  475. ByteOffset iOffsetArray[], /* can be NULL */
  476. ItemCount * oOffsetCount, /* can be NULL */
  477. ByteOffset oOffsetArray[], /* can be NULL */
  478. ByteCount iOutputBufLen,
  479. ByteCount * oInputRead,
  480. ByteCount * oOutputLen,
  481. LogicalAddress oOutputStr,
  482. ItemCount iScriptRunBufLen,
  483. ItemCount * oScriptRunOutLen,
  484. ScriptCodeRun oScriptCodeRuns[]);
  485. /* Truncate a multibyte string at a safe place. */
  486. /*
  487. * TruncateForTextToUnicode()
  488. *
  489. * Availability:
  490. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  491. * CarbonLib: in CarbonLib 1.0 and later
  492. * Mac OS X: in version 10.0 and later
  493. */
  494. EXTERN_API( OSStatus )
  495. TruncateForTextToUnicode(
  496. ConstTextToUnicodeInfo iTextToUnicodeInfo,
  497. ByteCount iSourceLen,
  498. ConstLogicalAddress iSourceStr,
  499. ByteCount iMaxLen,
  500. ByteCount * oTruncatedLen);
  501. /* Truncate a Unicode string at a safe place. */
  502. /*
  503. * TruncateForUnicodeToText()
  504. *
  505. * Availability:
  506. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  507. * CarbonLib: in CarbonLib 1.0 and later
  508. * Mac OS X: in version 10.0 and later
  509. */
  510. EXTERN_API( OSStatus )
  511. TruncateForUnicodeToText(
  512. ConstUnicodeToTextInfo iUnicodeToTextInfo,
  513. ByteCount iSourceLen,
  514. const UniChar iSourceStr[],
  515. OptionBits iControlFlags,
  516. ByteCount iMaxLen,
  517. ByteCount * oTruncatedLen);
  518. /* Convert a Pascal string to Unicode string. */
  519. /*
  520. * ConvertFromPStringToUnicode()
  521. *
  522. * Availability:
  523. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  524. * CarbonLib: in CarbonLib 1.0 and later
  525. * Mac OS X: in version 10.0 and later
  526. */
  527. EXTERN_API( OSStatus )
  528. ConvertFromPStringToUnicode(
  529. TextToUnicodeInfo iTextToUnicodeInfo,
  530. ConstStr255Param iPascalStr,
  531. ByteCount iOutputBufLen,
  532. ByteCount * oUnicodeLen,
  533. UniChar oUnicodeStr[]);
  534. /* Convert a Unicode string to Pascal string. */
  535. /*
  536. * ConvertFromUnicodeToPString()
  537. *
  538. * Availability:
  539. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  540. * CarbonLib: in CarbonLib 1.0 and later
  541. * Mac OS X: in version 10.0 and later
  542. */
  543. EXTERN_API( OSStatus )
  544. ConvertFromUnicodeToPString(
  545. UnicodeToTextInfo iUnicodeToTextInfo,
  546. ByteCount iUnicodeLen,
  547. const UniChar iUnicodeStr[],
  548. Str255 oPascalStr);
  549. /* Count the available conversion mappings. */
  550. /*
  551. * CountUnicodeMappings()
  552. *
  553. * Availability:
  554. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  555. * CarbonLib: in CarbonLib 1.0 and later
  556. * Mac OS X: in version 10.0 and later
  557. */
  558. EXTERN_API( OSStatus )
  559. CountUnicodeMappings(
  560. OptionBits iFilter,
  561. ConstUnicodeMappingPtr iFindMapping,
  562. ItemCount * oActualCount);
  563. /* Get a list of the available conversion mappings. */
  564. /*
  565. * QueryUnicodeMappings()
  566. *
  567. * Availability:
  568. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  569. * CarbonLib: in CarbonLib 1.0 and later
  570. * Mac OS X: in version 10.0 and later
  571. */
  572. EXTERN_API( OSStatus )
  573. QueryUnicodeMappings(
  574. OptionBits iFilter,
  575. ConstUnicodeMappingPtr iFindMapping,
  576. ItemCount iMaxCount,
  577. ItemCount * oActualCount,
  578. UnicodeMapping oReturnedMappings[]);
  579. /* Setup the fallback handler for converting Unicode To Text. */
  580. /*
  581. * SetFallbackUnicodeToText()
  582. *
  583. * Availability:
  584. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  585. * CarbonLib: in CarbonLib 1.0 and later
  586. * Mac OS X: in version 10.0 and later
  587. */
  588. EXTERN_API( OSStatus )
  589. SetFallbackUnicodeToText(
  590. UnicodeToTextInfo iUnicodeToTextInfo,
  591. UnicodeToTextFallbackUPP iFallback,
  592. OptionBits iControlFlags,
  593. LogicalAddress iInfoPtr);
  594. /* Setup the fallback handler for converting Unicode To TextRuns. */
  595. /*
  596. * SetFallbackUnicodeToTextRun()
  597. *
  598. * Availability:
  599. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  600. * CarbonLib: in CarbonLib 1.0 and later
  601. * Mac OS X: in version 10.0 and later
  602. */
  603. EXTERN_API( OSStatus )
  604. SetFallbackUnicodeToTextRun(
  605. UnicodeToTextRunInfo iUnicodeToTextRunInfo,
  606. UnicodeToTextFallbackUPP iFallback,
  607. OptionBits iControlFlags,
  608. LogicalAddress iInfoPtr);
  609. /* Re-initialize all state information kept by the context objects. */
  610. /*
  611. * ResetTextToUnicodeInfo()
  612. *
  613. * Availability:
  614. * Non-Carbon CFM: in UnicodeConverter 1.3 and later
  615. * CarbonLib: in CarbonLib 1.0 and later
  616. * Mac OS X: in version 10.0 and later
  617. */
  618. EXTERN_API( OSStatus )
  619. ResetTextToUnicodeInfo(TextToUnicodeInfo ioTextToUnicodeInfo);
  620. /* Re-initialize all state information kept by the context objects. */
  621. /*
  622. * ResetUnicodeToTextInfo()
  623. *
  624. * Availability:
  625. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  626. * CarbonLib: in CarbonLib 1.0 and later
  627. * Mac OS X: in version 10.0 and later
  628. */
  629. EXTERN_API( OSStatus )
  630. ResetUnicodeToTextInfo(UnicodeToTextInfo ioUnicodeToTextInfo);
  631. /* Re-initialize all state information kept by the context objects in TextRun conversions. */
  632. /*
  633. * ResetUnicodeToTextRunInfo()
  634. *
  635. * Availability:
  636. * Non-Carbon CFM: in UnicodeConverter 1.1 and later
  637. * CarbonLib: in CarbonLib 1.0 and later
  638. * Mac OS X: in version 10.0 and later
  639. */
  640. EXTERN_API( OSStatus )
  641. ResetUnicodeToTextRunInfo(UnicodeToTextRunInfo ioUnicodeToTextRunInfo);
  642. #if PRAGMA_STRUCT_ALIGN
  643. #pragma options align=reset
  644. #elif PRAGMA_STRUCT_PACKPUSH
  645. #pragma pack(pop)
  646. #elif PRAGMA_STRUCT_PACK
  647. #pragma pack()
  648. #endif
  649. #ifdef PRAGMA_IMPORT_OFF
  650. #pragma import off
  651. #elif PRAGMA_IMPORT
  652. #pragma import reset
  653. #endif
  654. #ifdef __cplusplus
  655. }
  656. #endif
  657. #endif /* __UNICODECONVERTER__ */