MacLocales.pas 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. {
  2. File: MacLocales.p
  3. Contains: Types & prototypes for locale functions
  4. Version: Technology: Mac OS 9.0
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1998-2002 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 210
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit MacLocales;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0210}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,MacErrors;
  92. {$ALIGN MAC68K}
  93. {
  94. -------------------------------------------------------------------------------------------------
  95. TYPES & CONSTANTS
  96. -------------------------------------------------------------------------------------------------
  97. }
  98. type
  99. LocaleRef = ^SInt32; { an opaque 32-bit type }
  100. LocaleRefPtr = ^LocaleRef; { when a var xx:LocaleRef parameter can be nil, it is changed to xx: LocaleRefPtr }
  101. LocalePartMask = UInt32;
  102. const
  103. { bit set requests the following: }
  104. kLocaleLanguageMask = $00000001; { ISO 639-1 or -2 language code (2 or 3 letters) }
  105. kLocaleLanguageVariantMask = $00000002; { custom string for language variant }
  106. kLocaleScriptMask = $00000004; { ISO 15924 script code (2 letters) }
  107. kLocaleScriptVariantMask = $00000008; { custom string for script variant }
  108. kLocaleRegionMask = $00000010; { ISO 3166 country/region code (2 letters) }
  109. kLocaleRegionVariantMask = $00000020; { custom string for region variant }
  110. kLocaleAllPartsMask = $0000003F; { all of the above }
  111. type
  112. LocaleOperationClass = FourCharCode;
  113. { constants for LocaleOperationClass are in UnicodeUtilities interfaces }
  114. LocaleOperationVariant = FourCharCode;
  115. LocaleAndVariantPtr = ^LocaleAndVariant;
  116. LocaleAndVariant = record
  117. locale: LocaleRef;
  118. opVariant: LocaleOperationVariant;
  119. end;
  120. LocaleNameMask = UInt32;
  121. const
  122. { bit set requests the following: }
  123. kLocaleNameMask = $00000001; { name of locale }
  124. kLocaleOperationVariantNameMask = $00000002; { name of LocaleOperationVariant }
  125. kLocaleAndVariantNameMask = $00000003; { all of the above }
  126. {
  127. -------------------------------------------------------------------------------------------------
  128. function PROTOTYPES
  129. -------------------------------------------------------------------------------------------------
  130. }
  131. { Convert to or from LocaleRefs (and related utilities) }
  132. {
  133. * LocaleRefFromLangOrRegionCode()
  134. *
  135. * Availability:
  136. * Non-Carbon CFM: in LocalesLib 8.6 and later
  137. * CarbonLib: in CarbonLib 1.0 and later
  138. * Mac OS X: in version 10.0 and later
  139. }
  140. function LocaleRefFromLangOrRegionCode(lang: LangCode; region: RegionCode; var locale: LocaleRef): OSStatus; external name '_LocaleRefFromLangOrRegionCode';
  141. {
  142. * LocaleRefFromLocaleString()
  143. *
  144. * Availability:
  145. * Non-Carbon CFM: in LocalesLib 8.6 and later
  146. * CarbonLib: in CarbonLib 1.0 and later
  147. * Mac OS X: in version 10.0 and later
  148. }
  149. function LocaleRefFromLocaleString(localeString: ConstCStringPtr; var locale: LocaleRef): OSStatus; external name '_LocaleRefFromLocaleString';
  150. {
  151. * LocaleRefGetPartString()
  152. *
  153. * Availability:
  154. * Non-Carbon CFM: in LocalesLib 8.6 and later
  155. * CarbonLib: in CarbonLib 1.0 and later
  156. * Mac OS X: in version 10.0 and later
  157. }
  158. function LocaleRefGetPartString(locale: LocaleRef; partMask: LocalePartMask; maxStringLen: ByteCount; var partString: char): OSStatus; external name '_LocaleRefGetPartString';
  159. {
  160. * LocaleStringToLangAndRegionCodes()
  161. *
  162. * Availability:
  163. * Non-Carbon CFM: in LocalesLib 9.0 and later
  164. * CarbonLib: in CarbonLib 1.0 and later
  165. * Mac OS X: in version 10.0 and later
  166. }
  167. function LocaleStringToLangAndRegionCodes(localeString: ConstCStringPtr; var lang: LangCode; var region: RegionCode): OSStatus; external name '_LocaleStringToLangAndRegionCodes';
  168. { Enumerate locales for a LocaleOperationClass }
  169. {
  170. * LocaleOperationCountLocales()
  171. *
  172. * Availability:
  173. * Non-Carbon CFM: in LocalesLib 8.6 and later
  174. * CarbonLib: in CarbonLib 1.0 and later
  175. * Mac OS X: in version 10.0 and later
  176. }
  177. function LocaleOperationCountLocales(opClass: LocaleOperationClass; var localeCount: ItemCount): OSStatus; external name '_LocaleOperationCountLocales';
  178. {
  179. * LocaleOperationGetLocales()
  180. *
  181. * Availability:
  182. * Non-Carbon CFM: in LocalesLib 8.6 and later
  183. * CarbonLib: in CarbonLib 1.0 and later
  184. * Mac OS X: in version 10.0 and later
  185. }
  186. function LocaleOperationGetLocales(opClass: LocaleOperationClass; maxLocaleCount: ItemCount; var actualLocaleCount: ItemCount; var localeVariantList: LocaleAndVariant): OSStatus; external name '_LocaleOperationGetLocales';
  187. { Get names for a locale (or a region's language) }
  188. {
  189. * LocaleGetName()
  190. *
  191. * Availability:
  192. * Non-Carbon CFM: in LocalesLib 8.6 and later
  193. * CarbonLib: in CarbonLib 1.0 and later
  194. * Mac OS X: in version 10.0 and later
  195. }
  196. function LocaleGetName(locale: LocaleRef; opVariant: LocaleOperationVariant; nameMask: LocaleNameMask; displayLocale: LocaleRef; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr): OSStatus; external name '_LocaleGetName';
  197. {
  198. * LocaleCountNames()
  199. *
  200. * Availability:
  201. * Non-Carbon CFM: in LocalesLib 8.6 and later
  202. * CarbonLib: in CarbonLib 1.0 and later
  203. * Mac OS X: in version 10.0 and later
  204. }
  205. function LocaleCountNames(locale: LocaleRef; opVariant: LocaleOperationVariant; nameMask: LocaleNameMask; var nameCount: ItemCount): OSStatus; external name '_LocaleCountNames';
  206. {
  207. * LocaleGetIndName()
  208. *
  209. * Availability:
  210. * Non-Carbon CFM: in LocalesLib 8.6 and later
  211. * CarbonLib: in CarbonLib 1.0 and later
  212. * Mac OS X: in version 10.0 and later
  213. }
  214. function LocaleGetIndName(locale: LocaleRef; opVariant: LocaleOperationVariant; nameMask: LocaleNameMask; nameIndex: ItemCount; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr; var displayLocale: LocaleRef): OSStatus; external name '_LocaleGetIndName';
  215. {
  216. * LocaleGetRegionLanguageName()
  217. *
  218. * Availability:
  219. * Non-Carbon CFM: in LocalesLib 9.0 and later
  220. * CarbonLib: in CarbonLib 1.0 and later
  221. * Mac OS X: in version 10.0 and later
  222. }
  223. function LocaleGetRegionLanguageName(region: RegionCode; var languageName: Str255): OSStatus; external name '_LocaleGetRegionLanguageName';
  224. { Get names for a LocaleOperationClass }
  225. {
  226. * LocaleOperationGetName()
  227. *
  228. * Availability:
  229. * Non-Carbon CFM: in LocalesLib 8.6 and later
  230. * CarbonLib: in CarbonLib 1.0 and later
  231. * Mac OS X: in version 10.0 and later
  232. }
  233. function LocaleOperationGetName(opClass: LocaleOperationClass; displayLocale: LocaleRef; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr): OSStatus; external name '_LocaleOperationGetName';
  234. {
  235. * LocaleOperationCountNames()
  236. *
  237. * Availability:
  238. * Non-Carbon CFM: in LocalesLib 8.6 and later
  239. * CarbonLib: in CarbonLib 1.0 and later
  240. * Mac OS X: in version 10.0 and later
  241. }
  242. function LocaleOperationCountNames(opClass: LocaleOperationClass; var nameCount: ItemCount): OSStatus; external name '_LocaleOperationCountNames';
  243. {
  244. * LocaleOperationGetIndName()
  245. *
  246. * Availability:
  247. * Non-Carbon CFM: in LocalesLib 8.6 and later
  248. * CarbonLib: in CarbonLib 1.0 and later
  249. * Mac OS X: in version 10.0 and later
  250. }
  251. function LocaleOperationGetIndName(opClass: LocaleOperationClass; nameIndex: ItemCount; maxNameLen: UniCharCount; var actualNameLen: UniCharCount; displayName: UniCharPtr; var displayLocale: LocaleRef): OSStatus; external name '_LocaleOperationGetIndName';
  252. {$ALIGN MAC68K}
  253. end.