2
0

TextUtils.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. {
  2. File: CarbonCore/TextUtils.h
  3. Contains: Text Utilities Interfaces.
  4. Copyright: © 1985-2011 Apple Inc. All rights reserved.
  5. Bugs?: For bug reports, consult the following page on
  6. the World Wide Web:
  7. http://bugs.freepascal.org
  8. }
  9. {
  10. Modified for use with Free Pascal
  11. Version 308
  12. Please report any bugs to <[email protected]>
  13. }
  14. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  15. {$mode macpas}
  16. {$modeswitch cblocks}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit TextUtils;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  24. {$setc GAP_INTERFACES_VERSION := $0308}
  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 CPUPOWERPC32}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  40. {$setc __ppc64__ := 1}
  41. {$elsec}
  42. {$setc __ppc64__ := 0}
  43. {$endc}
  44. {$ifc not defined __i386__ and defined CPUI386}
  45. {$setc __i386__ := 1}
  46. {$elsec}
  47. {$setc __i386__ := 0}
  48. {$endc}
  49. {$ifc not defined __x86_64__ and defined CPUX86_64}
  50. {$setc __x86_64__ := 1}
  51. {$elsec}
  52. {$setc __x86_64__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm__ and defined CPUARM}
  55. {$setc __arm__ := 1}
  56. {$elsec}
  57. {$setc __arm__ := 0}
  58. {$endc}
  59. {$ifc not defined __arm64__ and defined CPUAARCH64}
  60. {$setc __arm64__ := 1}
  61. {$elsec}
  62. {$setc __arm64__ := 0}
  63. {$endc}
  64. {$ifc defined cpu64}
  65. {$setc __LP64__ := 1}
  66. {$elsec}
  67. {$setc __LP64__ := 0}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  70. {$error Conflicting definitions for __ppc__ and __i386__}
  71. {$endc}
  72. {$ifc defined __ppc__ and __ppc__}
  73. {$setc TARGET_CPU_PPC := TRUE}
  74. {$setc TARGET_CPU_PPC64 := FALSE}
  75. {$setc TARGET_CPU_X86 := FALSE}
  76. {$setc TARGET_CPU_X86_64 := FALSE}
  77. {$setc TARGET_CPU_ARM := FALSE}
  78. {$setc TARGET_CPU_ARM64 := FALSE}
  79. {$setc TARGET_OS_MAC := TRUE}
  80. {$setc TARGET_OS_IPHONE := FALSE}
  81. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  82. {$setc TARGET_OS_EMBEDDED := FALSE}
  83. {$elifc defined __ppc64__ and __ppc64__}
  84. {$setc TARGET_CPU_PPC := FALSE}
  85. {$setc TARGET_CPU_PPC64 := TRUE}
  86. {$setc TARGET_CPU_X86 := FALSE}
  87. {$setc TARGET_CPU_X86_64 := FALSE}
  88. {$setc TARGET_CPU_ARM := FALSE}
  89. {$setc TARGET_CPU_ARM64 := FALSE}
  90. {$setc TARGET_OS_MAC := TRUE}
  91. {$setc TARGET_OS_IPHONE := FALSE}
  92. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  93. {$setc TARGET_OS_EMBEDDED := FALSE}
  94. {$elifc defined __i386__ and __i386__}
  95. {$setc TARGET_CPU_PPC := FALSE}
  96. {$setc TARGET_CPU_PPC64 := FALSE}
  97. {$setc TARGET_CPU_X86 := TRUE}
  98. {$setc TARGET_CPU_X86_64 := FALSE}
  99. {$setc TARGET_CPU_ARM := FALSE}
  100. {$setc TARGET_CPU_ARM64 := FALSE}
  101. {$ifc defined iphonesim}
  102. {$setc TARGET_OS_MAC := FALSE}
  103. {$setc TARGET_OS_IPHONE := TRUE}
  104. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  105. {$elsec}
  106. {$setc TARGET_OS_MAC := TRUE}
  107. {$setc TARGET_OS_IPHONE := FALSE}
  108. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  109. {$endc}
  110. {$setc TARGET_OS_EMBEDDED := FALSE}
  111. {$elifc defined __x86_64__ and __x86_64__}
  112. {$setc TARGET_CPU_PPC := FALSE}
  113. {$setc TARGET_CPU_PPC64 := FALSE}
  114. {$setc TARGET_CPU_X86 := FALSE}
  115. {$setc TARGET_CPU_X86_64 := TRUE}
  116. {$setc TARGET_CPU_ARM := FALSE}
  117. {$setc TARGET_CPU_ARM64 := FALSE}
  118. {$ifc defined iphonesim}
  119. {$setc TARGET_OS_MAC := FALSE}
  120. {$setc TARGET_OS_IPHONE := TRUE}
  121. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  122. {$elsec}
  123. {$setc TARGET_OS_MAC := TRUE}
  124. {$setc TARGET_OS_IPHONE := FALSE}
  125. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  126. {$endc}
  127. {$setc TARGET_OS_EMBEDDED := FALSE}
  128. {$elifc defined __arm__ and __arm__}
  129. {$setc TARGET_CPU_PPC := FALSE}
  130. {$setc TARGET_CPU_PPC64 := FALSE}
  131. {$setc TARGET_CPU_X86 := FALSE}
  132. {$setc TARGET_CPU_X86_64 := FALSE}
  133. {$setc TARGET_CPU_ARM := TRUE}
  134. {$setc TARGET_CPU_ARM64 := FALSE}
  135. {$setc TARGET_OS_MAC := FALSE}
  136. {$setc TARGET_OS_IPHONE := TRUE}
  137. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  138. {$setc TARGET_OS_EMBEDDED := TRUE}
  139. {$elifc defined __arm64__ and __arm64__}
  140. {$setc TARGET_CPU_PPC := FALSE}
  141. {$setc TARGET_CPU_PPC64 := FALSE}
  142. {$setc TARGET_CPU_X86 := FALSE}
  143. {$setc TARGET_CPU_X86_64 := FALSE}
  144. {$setc TARGET_CPU_ARM := FALSE}
  145. {$setc TARGET_CPU_ARM64 := TRUE}
  146. {$ifc defined ios}
  147. {$setc TARGET_OS_MAC := FALSE}
  148. {$setc TARGET_OS_IPHONE := TRUE}
  149. {$setc TARGET_OS_EMBEDDED := TRUE}
  150. {$elsec}
  151. {$setc TARGET_OS_MAC := TRUE}
  152. {$setc TARGET_OS_IPHONE := FALSE}
  153. {$setc TARGET_OS_EMBEDDED := FALSE}
  154. {$endc}
  155. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  156. {$elsec}
  157. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  158. {$endc}
  159. {$ifc defined __LP64__ and __LP64__ }
  160. {$setc TARGET_CPU_64 := TRUE}
  161. {$elsec}
  162. {$setc TARGET_CPU_64 := FALSE}
  163. {$endc}
  164. {$ifc defined FPC_BIG_ENDIAN}
  165. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  166. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  167. {$elifc defined FPC_LITTLE_ENDIAN}
  168. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  169. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  170. {$elsec}
  171. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  172. {$endc}
  173. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  174. {$setc CALL_NOT_IN_CARBON := FALSE}
  175. {$setc OLDROUTINENAMES := FALSE}
  176. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  177. {$setc OPAQUE_UPP_TYPES := TRUE}
  178. {$setc OTCARBONAPPLICATION := TRUE}
  179. {$setc OTKERNEL := FALSE}
  180. {$setc PM_USE_SESSION_APIS := TRUE}
  181. {$setc TARGET_API_MAC_CARBON := TRUE}
  182. {$setc TARGET_API_MAC_OS8 := FALSE}
  183. {$setc TARGET_API_MAC_OSX := TRUE}
  184. {$setc TARGET_CARBON := TRUE}
  185. {$setc TARGET_CPU_68K := FALSE}
  186. {$setc TARGET_CPU_MIPS := FALSE}
  187. {$setc TARGET_CPU_SPARC := FALSE}
  188. {$setc TARGET_OS_UNIX := FALSE}
  189. {$setc TARGET_OS_WIN32 := FALSE}
  190. {$setc TARGET_RT_MAC_68881 := FALSE}
  191. {$setc TARGET_RT_MAC_CFM := FALSE}
  192. {$setc TARGET_RT_MAC_MACHO := TRUE}
  193. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  194. {$setc TYPE_BOOL := FALSE}
  195. {$setc TYPE_EXTENDED := FALSE}
  196. {$setc TYPE_LONGLONG := TRUE}
  197. uses MacTypes,IntlResources;
  198. {$endc} {not MACOSALLINCLUDE}
  199. {$ifc TARGET_OS_MAC}
  200. {$ALIGN MAC68K}
  201. {
  202. Here are the current System 7 routine names and the translations to the older forms.
  203. Please use the newer forms in all new code and migrate the older names out of existing
  204. code as maintainance permits.
  205. NEW NAME OLD NAMEs OBSOLETE FORM (no script code)
  206. FindScriptRun
  207. FindWordBreaks NFindWord, FindWord
  208. GetIndString
  209. GetString
  210. Munger
  211. NewString
  212. SetString
  213. StyledLineBreak
  214. TruncString
  215. TruncText
  216. UpperString ($A054) UprString, UprText
  217. UppercaseText SCUpperText (a only) UpperText ($A456)
  218. LowercaseText LwrString, LowerText, LwrText ($A056)
  219. StripDiacritics StripText ($A256)
  220. UppercaseStripDiacritics StripUpperText ($A656)
  221. }
  222. { TruncCode, StyledLineBreakCode, and truncation constants moved to QuickDrawText.i }
  223. {$ifc not TARGET_CPU_64}
  224. type
  225. ScriptRunStatusPtr = ^ScriptRunStatus;
  226. ScriptRunStatus = record
  227. script: SInt8;
  228. runVariant: SInt8;
  229. end;
  230. type
  231. BreakTable = record
  232. charTypes: packed array [0..255] of AnsiChar;
  233. tripleLength: SInt16;
  234. triples: array [0..0] of SInt16;
  235. end;
  236. BreakTablePtr = ^BreakTable;
  237. type
  238. NBreakTable = record
  239. flags1: SInt8;
  240. flags2: SInt8;
  241. version: SInt16;
  242. classTableOff: SInt16;
  243. auxCTableOff: SInt16;
  244. backwdTableOff: SInt16;
  245. forwdTableOff: SInt16;
  246. doBackup: SInt16;
  247. length: SInt16; { length of NBreakTable }
  248. charTypes: packed array [0..255] of AnsiChar;
  249. tables: array [0..0] of SInt16;
  250. end;
  251. NBreakTablePtr = ^NBreakTable;
  252. {$endc} {not TARGET_CPU_64}
  253. { The following functions are new names that work on 68k and PowerPC}
  254. {
  255. * Munger() *** DEPRECATED ***
  256. *
  257. * Deprecated:
  258. * Use CFStringFindAndReplace or CFDataFind plus CFDataReplaceBytes
  259. * (or strstr plus memmove), depending on usage; see discussion.
  260. *
  261. * Discussion:
  262. * For text operations performed with Munger, use
  263. * CFStringFindAndReplace instead.
  264. *
  265. * For operations on arbitrary bytes performed with Munger, use
  266. * CFDataFind plus CFDataReplaceBytes instead (Another option is to
  267. * use strstr plus memmove).
  268. *
  269. * Availability:
  270. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.6
  271. * CarbonLib: in CarbonLib 1.0 and later
  272. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  273. }
  274. function Munger( h: Handle; offset: SIGNEDLONG; ptr1: {const} UnivPtr; len1: SIGNEDLONG; ptr2: {const} UnivPtr; len2: SIGNEDLONG ): SIGNEDLONG; external name '_Munger';
  275. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_6, __IPHONE_NA, __IPHONE_NA) *)
  276. {$ifc not TARGET_CPU_64}
  277. {
  278. * NewString() *** DEPRECATED ***
  279. *
  280. * Deprecated:
  281. * use CFStringCreateCopy instead.
  282. *
  283. * Discussion:
  284. * This function is no longer recommended. Please use
  285. * CFStringCreateCopy instead.
  286. *
  287. * Availability:
  288. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  289. * CarbonLib: in CarbonLib 1.0 and later
  290. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  291. }
  292. function NewString( const (*var*) theString: Str255 ): StringHandle; external name '_NewString';
  293. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  294. {
  295. * SetString() *** DEPRECATED ***
  296. *
  297. * Deprecated:
  298. * use CFStringCreateWithPascalString and CFStringReplaceAll instead.
  299. *
  300. * Discussion:
  301. * This function is no longer recommended. Please use
  302. * CFStringCreateWithPascalString and CFStringReplaceAll instead.
  303. *
  304. * Availability:
  305. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  306. * CarbonLib: in CarbonLib 1.0 and later
  307. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  308. }
  309. procedure SetString( theString: StringHandle; const (*var*) strNew: Str255 ); external name '_SetString';
  310. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  311. {
  312. * GetString() *** DEPRECATED ***
  313. *
  314. * Deprecated:
  315. * use CFBundleCopyLocalizedString instead.
  316. *
  317. * Discussion:
  318. * This function is no longer recommended. Please use
  319. * CFBundleCopyLocalizedString instead.
  320. *
  321. * Availability:
  322. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  323. * CarbonLib: in CarbonLib 1.0 and later
  324. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  325. }
  326. function GetString( stringID: SInt16 ): StringHandle; external name '_GetString';
  327. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  328. {$endc} {not TARGET_CPU_64}
  329. {$ifc not TARGET_CPU_64}
  330. {
  331. * GetIndString() *** DEPRECATED ***
  332. *
  333. * Deprecated:
  334. * use CFBundleCopyLocalizedString instead.
  335. *
  336. * Discussion:
  337. * This function is no longer recommended. Please use
  338. * CFBundleCopyLocalizedString instead.
  339. *
  340. * Availability:
  341. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  342. * CarbonLib: in CarbonLib 1.0 and later
  343. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  344. }
  345. procedure GetIndString( var theString: Str255; strListID: SInt16; itemIndex: SInt16 ); external name '_GetIndString';
  346. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  347. {$endc} {not TARGET_CPU_64}
  348. {
  349. * setstring()
  350. *
  351. * Availability:
  352. * Mac OS X: not available
  353. * CarbonLib: not available
  354. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  355. }
  356. {$ifc not TARGET_CPU_64}
  357. {
  358. * newstring() *** DEPRECATED ***
  359. *
  360. * Deprecated:
  361. * use CFStringCreateCopy instead.
  362. *
  363. * Discussion:
  364. * This function is no longer recommended. Please use
  365. * CFStringCreateCopy instead.
  366. *
  367. * Availability:
  368. * Mac OS X: not available [32-bit only] but deprecated in 10.4
  369. * CarbonLib: not available
  370. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  371. }
  372. {$endc} {not TARGET_CPU_64}
  373. {
  374. * getindstring()
  375. *
  376. * Availability:
  377. * Mac OS X: not available
  378. * CarbonLib: not available
  379. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  380. }
  381. {$ifc not TARGET_CPU_64}
  382. {
  383. * FindWordBreaks() *** DEPRECATED ***
  384. *
  385. * Deprecated:
  386. * use UCFindTextBreak instead.
  387. *
  388. * Discussion:
  389. * This function is no longer recommended. Please use
  390. * UCFindTextBreak instead.
  391. *
  392. * Availability:
  393. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  394. * CarbonLib: in CarbonLib 1.0 and later
  395. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  396. }
  397. procedure FindWordBreaks( textPtr: Ptr; textLength: SInt16; offset: SInt16; leadingEdge: Boolean; breaks: BreakTablePtr; var offsets: OffsetTable; script: ScriptCode ); external name '_FindWordBreaks';
  398. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  399. {
  400. * LowercaseText() *** DEPRECATED ***
  401. *
  402. * Deprecated:
  403. * use CFStringLowercase instead.
  404. *
  405. * Discussion:
  406. * This function is no longer recommended. Please use
  407. * CFStringLowercase instead.
  408. *
  409. * Availability:
  410. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  411. * CarbonLib: in CarbonLib 1.0 and later
  412. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  413. }
  414. procedure LowercaseText( textPtr: Ptr; len: SInt16; script: ScriptCode ); external name '_LowercaseText';
  415. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  416. {
  417. * UppercaseText() *** DEPRECATED ***
  418. *
  419. * Deprecated:
  420. * use CFStringUppercase instead.
  421. *
  422. * Discussion:
  423. * This function is no longer recommended. Please use
  424. * CFStringUppercase instead.
  425. *
  426. * Availability:
  427. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  428. * CarbonLib: in CarbonLib 1.0 and later
  429. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  430. }
  431. procedure UppercaseText( textPtr: Ptr; len: SInt16; script: ScriptCode ); external name '_UppercaseText';
  432. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  433. {
  434. * StripDiacritics() *** DEPRECATED ***
  435. *
  436. * Deprecated:
  437. * use CFStringTransform instead.
  438. *
  439. * Discussion:
  440. * This function is no longer recommended. Please use
  441. * CFStringTransform instead.
  442. *
  443. * Availability:
  444. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  445. * CarbonLib: in CarbonLib 1.0 and later
  446. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  447. }
  448. procedure StripDiacritics( textPtr: Ptr; len: SInt16; script: ScriptCode ); external name '_StripDiacritics';
  449. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  450. {
  451. * UppercaseStripDiacritics() *** DEPRECATED ***
  452. *
  453. * Deprecated:
  454. * use CFStringTransform instead.
  455. *
  456. * Discussion:
  457. * This function is no longer recommended. Please use
  458. * CFStringTransform instead.
  459. *
  460. * Availability:
  461. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  462. * CarbonLib: in CarbonLib 1.0 and later
  463. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  464. }
  465. procedure UppercaseStripDiacritics( textPtr: Ptr; len: SInt16; script: ScriptCode ); external name '_UppercaseStripDiacritics';
  466. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  467. {
  468. * FindScriptRun() *** DEPRECATED ***
  469. *
  470. * Deprecated:
  471. * No longer needed on MacOS X.
  472. *
  473. * Discussion:
  474. * This function is obsolate.
  475. *
  476. * Availability:
  477. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  478. * CarbonLib: in CarbonLib 1.0 and later
  479. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  480. }
  481. function FindScriptRun( textPtr: Ptr; textLen: SIGNEDLONG; var lenUsed: SIGNEDLONG ): ScriptRunStatus; external name '_FindScriptRun';
  482. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  483. {
  484. The following functions are old names, but are required for PowerPC builds
  485. because InterfaceLib exports these names, instead of the new ones.
  486. }
  487. {$endc} {not TARGET_CPU_64}
  488. {
  489. * FindWord()
  490. *
  491. * Availability:
  492. * Mac OS X: not available
  493. * CarbonLib: not available
  494. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  495. }
  496. {
  497. * NFindWord()
  498. *
  499. * Availability:
  500. * Mac OS X: not available
  501. * CarbonLib: not available
  502. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  503. }
  504. {
  505. On 68K machines, LwrText, LowerText, StripText, UpperText and StripUpperText
  506. return an error code in register D0, but System 7 PowerMacs do not emulate
  507. this properly, so checking D0 is unreliable.
  508. }
  509. {
  510. * LwrText()
  511. *
  512. * Availability:
  513. * Mac OS X: not available
  514. * CarbonLib: not available
  515. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  516. }
  517. {
  518. * LowerText()
  519. *
  520. * Availability:
  521. * Mac OS X: not available
  522. * CarbonLib: not available
  523. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  524. }
  525. {
  526. * StripText()
  527. *
  528. * Availability:
  529. * Mac OS X: not available
  530. * CarbonLib: not available
  531. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  532. }
  533. {
  534. * UpperText()
  535. *
  536. * Availability:
  537. * Mac OS X: not available
  538. * CarbonLib: not available
  539. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  540. }
  541. {
  542. * StripUpperText()
  543. *
  544. * Availability:
  545. * Mac OS X: not available
  546. * CarbonLib: not available
  547. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  548. }
  549. { The following are new names which are exported by InterfaceLib}
  550. {$ifc not TARGET_CPU_64}
  551. {
  552. * UpperString() *** DEPRECATED ***
  553. *
  554. * Deprecated:
  555. * use CFStringUppercase instead.
  556. *
  557. * Discussion:
  558. * This function is no longer recommended. Please use
  559. * CFStringUppercase instead.
  560. *
  561. * Availability:
  562. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  563. * CarbonLib: in CarbonLib 1.0 and later
  564. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  565. }
  566. procedure UpperString( var theString: Str255; diacSensitive: Boolean ); external name '_UpperString';
  567. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  568. {$endc} {not TARGET_CPU_64}
  569. {$ifc not TARGET_CPU_64}
  570. {
  571. * upperstring() *** DEPRECATED ***
  572. *
  573. * Deprecated:
  574. * use CFStringUppercase instead.
  575. *
  576. * Discussion:
  577. * This function is no longer recommended. Please use
  578. * CFStringUppercase instead.
  579. *
  580. * Availability:
  581. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  582. * CarbonLib: in CarbonLib 1.0 and later
  583. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  584. }
  585. (*
  586. overloading not available
  587. procedure upperstring( theString: CStringPtr; diacSensitive: Boolean ); external name '_upperstring';
  588. *)
  589. // AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
  590. {$endc} {not TARGET_CPU_64}
  591. { Old routine name but no new names are mapped to it:}
  592. {
  593. * UprText()
  594. *
  595. * Availability:
  596. * Mac OS X: not available
  597. * CarbonLib: not available
  598. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  599. }
  600. {
  601. Functions for converting between C and Pascal Strings
  602. (Previously in Strings.h)
  603. Note: CopyPascalStringToC, CopyCStringToPascal, c2pstrcpy, and p2cstrcpy
  604. are written to allow inplace conversion. That is, the src and dst
  605. parameters can point to the memory location. These functions
  606. are available in CarbonLib and CarbonAccessors.o.
  607. Note: c2pstr, C2PStr, p2cstr, and P2CStr are all deprecated. These functions
  608. only do inplace conversion and often require casts to call them. This can
  609. cause bugs because you can easily cast away a const and change the
  610. contents of a read-only buffer. These functions are available
  611. in InterfaceLib, or when building for Carbon if you #define OLDP2C,
  612. then they are available as a macro.
  613. }
  614. {$ifc not TARGET_CPU_64}
  615. {
  616. * c2pstrcpy() *** DEPRECATED ***
  617. *
  618. * Deprecated:
  619. * use CFString instead.
  620. *
  621. * Discussion:
  622. * This function is no longer recommended. Please use CFString
  623. * instead.
  624. *
  625. * Availability:
  626. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  627. * CarbonLib: in CarbonLib 1.0 and later
  628. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  629. }
  630. procedure c2pstrcpy( var dst: Str255; src: ConstCStringPtr ); external name '_c2pstrcpy';
  631. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  632. {
  633. * p2cstrcpy() *** DEPRECATED ***
  634. *
  635. * Deprecated:
  636. * use CFString instead.
  637. *
  638. * Discussion:
  639. * This function is no longer recommended. Please use CFString
  640. * instead.
  641. *
  642. * Availability:
  643. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  644. * CarbonLib: in CarbonLib 1.0 and later
  645. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  646. }
  647. procedure p2cstrcpy( dst: CStringPtr; const (*var*) src: Str255 ); external name '_p2cstrcpy';
  648. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  649. {
  650. * CopyPascalStringToC() *** DEPRECATED ***
  651. *
  652. * Deprecated:
  653. * use CFString instead.
  654. *
  655. * Discussion:
  656. * This function is no longer recommended. Please use CFString
  657. * instead.
  658. *
  659. * Availability:
  660. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  661. * CarbonLib: in CarbonLib 1.0 and later
  662. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  663. }
  664. procedure CopyPascalStringToC( const (*var*) src: Str255; dst: CStringPtr ); external name '_CopyPascalStringToC';
  665. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  666. {
  667. * CopyCStringToPascal() *** DEPRECATED ***
  668. *
  669. * Deprecated:
  670. * use CFString instead.
  671. *
  672. * Discussion:
  673. * This function is no longer recommended. Please use CFString
  674. * instead.
  675. *
  676. * Availability:
  677. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  678. * CarbonLib: in CarbonLib 1.0 and later
  679. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  680. }
  681. procedure CopyCStringToPascal( src: ConstCStringPtr; var dst: Str255 ); external name '_CopyCStringToPascal';
  682. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  683. {$endc} {not TARGET_CPU_64}
  684. {$ifc not TARGET_CPU_64}
  685. {
  686. * c2pstr() *** DEPRECATED ***
  687. *
  688. * Availability:
  689. * Mac OS X: in version 10.4 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  690. * CarbonLib: not available
  691. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  692. }
  693. (*
  694. overloading not available
  695. function c2pstr( aStr: CStringPtr ): StringPtr; external name '_c2pstr';
  696. *)
  697. //AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED;
  698. {
  699. * C2PStr() *** DEPRECATED ***
  700. *
  701. * Availability:
  702. * Mac OS X: in version 10.4 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  703. * CarbonLib: not available
  704. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  705. }
  706. function C2PStr( cString: UnivPtr ): StringPtr; external name '_C2PStr';
  707. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_5, __IPHONE_NA, __IPHONE_NA) *)
  708. {
  709. * p2cstr() *** DEPRECATED ***
  710. *
  711. * Availability:
  712. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  713. * CarbonLib: not available
  714. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  715. }
  716. (*
  717. overloading based on result type not possible
  718. function p2cstr( aStr: StringPtr ): CStringPtr; external name '_p2cstr';
  719. *)
  720. //AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
  721. {
  722. * P2CStr() *** DEPRECATED ***
  723. *
  724. * Availability:
  725. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.4
  726. * CarbonLib: not available
  727. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  728. }
  729. function P2CStr( pString: StringPtr ): Ptr; external name '_P2CStr';
  730. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_4, __IPHONE_NA, __IPHONE_NA) *)
  731. {$endc} {not TARGET_CPU_64}
  732. {$endc} {TARGET_OS_MAC}
  733. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  734. end.
  735. {$endc} {not MACOSALLINCLUDE}