Dictionary.pas 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. {
  2. File: Dictionary.p
  3. Contains: Dictionary Manager Interfaces
  4. Version: Technology: System 7
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1992-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 200
  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 Dictionary;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  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,AEDataModel,Files,AERegistry,CodeFragments,MacErrors;
  92. {$ALIGN POWER}
  93. {
  94. =============================================================================================
  95. Modern Dictionary Manager
  96. =============================================================================================
  97. }
  98. {
  99. Dictionary information
  100. }
  101. const
  102. kDictionaryFileType = $64696374 (* 'dict' *);
  103. kDCMDictionaryHeaderSignature = $64696374 (* 'dict' *);
  104. kDCMDictionaryHeaderVersion = 2;
  105. kDCMAnyFieldTag = $2A2A2A2A (* '****' *);
  106. kDCMAnyFieldType = $2A2A2A2A (* '****' *);
  107. {
  108. Contents of a Field Info Record (an AERecord)
  109. }
  110. keyDCMFieldTag = $66746167 (* 'ftag' *); { typeEnumeration }
  111. keyDCMFieldType = $66747970 (* 'ftyp' *); { typeEnumeration }
  112. keyDCMMaxRecordSize = $6D72737A (* 'mrsz' *); { typeMagnitude }
  113. keyDCMFieldAttributes = $66617472 (* 'fatr' *);
  114. keyDCMFieldDefaultData = $66646566 (* 'fdef' *);
  115. keyDCMFieldName = $666E616D (* 'fnam' *); { typeChar }
  116. keyDCMFieldFindMethods = $66666E64 (* 'ffnd' *); { typeAEList of typeDCMFindMethod }
  117. {
  118. Special types for fields of a Field Info Record
  119. }
  120. typeDCMFieldAttributes = $66617472 (* 'fatr' *);
  121. typeDCMFindMethod = $666D7468 (* 'fmth' *);
  122. {
  123. Field attributes
  124. }
  125. kDCMIndexedFieldMask = $00000001;
  126. kDCMRequiredFieldMask = $00000002;
  127. kDCMIdentifyFieldMask = $00000004;
  128. kDCMFixedSizeFieldMask = $00000008;
  129. kDCMHiddenFieldMask = $80000000;
  130. type
  131. DCMFieldAttributes = OptionBits;
  132. {
  133. Standard dictionary properties
  134. }
  135. const
  136. pDCMAccessMethod = $616D7464 (* 'amtd' *); { data type: typeChar ReadOnly }
  137. pDCMPermission = $7065726D (* 'perm' *); { data type: typeUInt16 }
  138. pDCMListing = $6C697374 (* 'list' *); { data type: typeUInt16 }
  139. pDCMMaintenance = $6D746E63 (* 'mtnc' *); { data type: typeUInt16 }
  140. pDCMLocale = $6C6F636C (* 'locl' *); { data type: typeUInt32. Optional; default = kLocaleIdentifierWildCard }
  141. pDCMClass = $70636C73 (* 'pcls' *); { data type: typeUInt16 }
  142. pDCMCopyright = $696E666F (* 'info' *); { data type: typeChar }
  143. {
  144. pDCMPermission property constants
  145. }
  146. kDCMReadOnlyDictionary = 0;
  147. kDCMReadWriteDictionary = 1;
  148. {
  149. pDCMListing property constants
  150. }
  151. kDCMAllowListing = 0;
  152. kDCMProhibitListing = 1;
  153. {
  154. pDCMClass property constants
  155. }
  156. kDCMUserDictionaryClass = 0;
  157. kDCMSpecificDictionaryClass = 1;
  158. kDCMBasicDictionaryClass = 2;
  159. {
  160. Standard search method
  161. }
  162. kDCMFindMethodExactMatch = $3D202020 (* '= ' *);
  163. kDCMFindMethodBeginningMatch = $62677774 (* 'bgwt' *);
  164. kDCMFindMethodContainsMatch = $636F6E74 (* 'cont' *);
  165. kDCMFindMethodEndingMatch = $656E6473 (* 'ends' *);
  166. kDCMFindMethodForwardTrie = $66747269 (* 'ftri' *); { used for morphological analysis }
  167. kDCMFindMethodBackwardTrie = $62747269 (* 'btri' *); { used for morphological analysis }
  168. type
  169. DCMFindMethod = OSType;
  170. {
  171. AccessMethod features
  172. }
  173. const
  174. kDCMCanUseFileDictionaryMask = $00000001;
  175. kDCMCanUseMemoryDictionaryMask = $00000002;
  176. kDCMCanStreamDictionaryMask = $00000004;
  177. kDCMCanHaveMultipleIndexMask = $00000008;
  178. kDCMCanModifyDictionaryMask = $00000010;
  179. kDCMCanCreateDictionaryMask = $00000020;
  180. kDCMCanAddDictionaryFieldMask = $00000040;
  181. kDCMCanUseTransactionMask = $00000080;
  182. type
  183. DCMAccessMethodFeature = OptionBits;
  184. DCMUniqueID = UInt32;
  185. DCMObjectID = ^SInt32; { an opaque 32-bit type }
  186. DCMObjectIDPtr = ^DCMObjectID; { when a var xx:DCMObjectID parameter can be nil, it is changed to xx: DCMObjectIDPtr }
  187. DCMAccessMethodID = DCMObjectID;
  188. DCMDictionaryID = DCMObjectID;
  189. DCMObjectRef = ^SInt32; { an opaque 32-bit type }
  190. DCMObjectRefPtr = ^DCMObjectRef; { when a var xx:DCMObjectRef parameter can be nil, it is changed to xx: DCMObjectRefPtr }
  191. DCMDictionaryRef = DCMObjectRef;
  192. DCMDictionaryStreamRef = DCMObjectRef;
  193. DCMObjectIterator = ^SInt32; { an opaque 32-bit type }
  194. DCMObjectIteratorPtr = ^DCMObjectIterator; { when a var xx:DCMObjectIterator parameter can be nil, it is changed to xx: DCMObjectIteratorPtr }
  195. DCMAccessMethodIterator = DCMObjectIterator;
  196. DCMDictionaryIterator = DCMObjectIterator;
  197. DCMFoundRecordIterator = ^SInt32; { an opaque 32-bit type }
  198. DCMFoundRecordIteratorPtr = ^DCMFoundRecordIterator; { when a var xx:DCMFoundRecordIterator parameter can be nil, it is changed to xx: DCMFoundRecordIteratorPtr }
  199. {
  200. Field specification declarations
  201. }
  202. DCMFieldTag = DescType;
  203. DCMFieldTagPtr = ^DCMFieldTag;
  204. DCMFieldType = DescType;
  205. {
  206. Dictionary header information
  207. }
  208. DCMDictionaryHeaderPtr = ^DCMDictionaryHeader;
  209. DCMDictionaryHeader = record
  210. headerSignature: FourCharCode;
  211. headerVersion: UInt32;
  212. headerSize: ByteCount;
  213. accessMethod: Str63;
  214. end;
  215. {
  216. Callback routines
  217. }
  218. {$ifc TYPED_FUNCTION_POINTERS}
  219. DCMProgressFilterProcPtr = function(determinateProcess: boolean; percentageComplete: UInt16; callbackUD: UInt32): boolean;
  220. {$elsec}
  221. DCMProgressFilterProcPtr = ProcPtr;
  222. {$endc}
  223. {$ifc OPAQUE_UPP_TYPES}
  224. DCMProgressFilterUPP = ^SInt32; { an opaque UPP }
  225. {$elsec}
  226. DCMProgressFilterUPP = UniversalProcPtr;
  227. {$endc}
  228. const
  229. uppDCMProgressFilterProcInfo = $00000E50;
  230. {$ifc CALL_NOT_IN_CARBON}
  231. {
  232. * NewDCMProgressFilterUPP()
  233. *
  234. * Availability:
  235. * Non-Carbon CFM: available as macro/inline
  236. * CarbonLib: not available
  237. * Mac OS X: not available
  238. }
  239. function NewDCMProgressFilterUPP(userRoutine: DCMProgressFilterProcPtr): DCMProgressFilterUPP; external name '_NewDCMProgressFilterUPP'; { old name was NewDCMProgressFilterProc }
  240. {
  241. * DisposeDCMProgressFilterUPP()
  242. *
  243. * Availability:
  244. * Non-Carbon CFM: available as macro/inline
  245. * CarbonLib: not available
  246. * Mac OS X: not available
  247. }
  248. procedure DisposeDCMProgressFilterUPP(userUPP: DCMProgressFilterUPP); external name '_DisposeDCMProgressFilterUPP';
  249. {
  250. * InvokeDCMProgressFilterUPP()
  251. *
  252. * Availability:
  253. * Non-Carbon CFM: available as macro/inline
  254. * CarbonLib: not available
  255. * Mac OS X: not available
  256. }
  257. function InvokeDCMProgressFilterUPP(determinateProcess: boolean; percentageComplete: UInt16; callbackUD: UInt32; userRoutine: DCMProgressFilterUPP): boolean; external name '_InvokeDCMProgressFilterUPP'; { old name was CallDCMProgressFilterProc }
  258. {$endc} {CALL_NOT_IN_CARBON}
  259. {
  260. Library version
  261. }
  262. {
  263. * DCMLibraryVersion()
  264. *
  265. * Availability:
  266. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  267. * CarbonLib: in CarbonLib 1.0 and later
  268. * Mac OS X: in version 10.0 and later
  269. }
  270. function DCMLibraryVersion: UInt32; external name '_DCMLibraryVersion';
  271. {
  272. Create/delete dictionary
  273. }
  274. {
  275. * DCMNewDictionary()
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  279. * CarbonLib: in CarbonLib 1.0 and later
  280. * Mac OS X: in version 10.0 and later
  281. }
  282. function DCMNewDictionary(accessMethodID: DCMAccessMethodID; const (*var*) newDictionaryFile: FSSpec; scriptTag: ScriptCode; const (*var*) listOfFieldInfoRecords: AEDesc; invisible: boolean; recordCapacity: ItemCount; var newDictionary: DCMDictionaryID): OSStatus; external name '_DCMNewDictionary';
  283. {
  284. * DCMDeriveNewDictionary()
  285. *
  286. * Availability:
  287. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  288. * CarbonLib: in CarbonLib 1.0 and later
  289. * Mac OS X: in version 10.0 and later
  290. }
  291. function DCMDeriveNewDictionary(srcDictionary: DCMDictionaryID; const (*var*) newDictionaryFile: FSSpec; scriptTag: ScriptCode; invisible: boolean; recordCapacity: ItemCount; var newDictionary: DCMDictionaryID): OSStatus; external name '_DCMDeriveNewDictionary';
  292. {
  293. * DCMDeleteDictionary()
  294. *
  295. * Availability:
  296. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  297. * CarbonLib: in CarbonLib 1.0 and later
  298. * Mac OS X: in version 10.0 and later
  299. }
  300. function DCMDeleteDictionary(dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMDeleteDictionary';
  301. {
  302. Register dictionary
  303. }
  304. {
  305. * DCMRegisterDictionaryFile()
  306. *
  307. * Availability:
  308. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  309. * CarbonLib: in CarbonLib 1.0 and later
  310. * Mac OS X: in version 10.0 and later
  311. }
  312. function DCMRegisterDictionaryFile(const (*var*) dictionaryFile: FSSpec; var dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMRegisterDictionaryFile';
  313. {
  314. * DCMUnregisterDictionary()
  315. *
  316. * Availability:
  317. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  318. * CarbonLib: in CarbonLib 1.0 and later
  319. * Mac OS X: in version 10.0 and later
  320. }
  321. function DCMUnregisterDictionary(dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMUnregisterDictionary';
  322. {
  323. Open dictionary
  324. }
  325. {
  326. * DCMOpenDictionary()
  327. *
  328. * Availability:
  329. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  330. * CarbonLib: in CarbonLib 1.0 and later
  331. * Mac OS X: in version 10.0 and later
  332. }
  333. function DCMOpenDictionary(dictionaryID: DCMDictionaryID; protectKeySize: ByteCount; protectKey: ConstLogicalAddress; var dictionaryRef: DCMDictionaryRef): OSStatus; external name '_DCMOpenDictionary';
  334. {
  335. * DCMCloseDictionary()
  336. *
  337. * Availability:
  338. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  339. * CarbonLib: in CarbonLib 1.0 and later
  340. * Mac OS X: in version 10.0 and later
  341. }
  342. function DCMCloseDictionary(dictionaryRef: DCMDictionaryRef): OSStatus; external name '_DCMCloseDictionary';
  343. {
  344. Change access privilege
  345. }
  346. {
  347. * DCMGetDictionaryWriteAccess()
  348. *
  349. * Availability:
  350. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  351. * CarbonLib: in CarbonLib 1.0 and later
  352. * Mac OS X: in version 10.0 and later
  353. }
  354. function DCMGetDictionaryWriteAccess(dictionaryRef: DCMDictionaryRef; timeOutDuration: Duration): OSStatus; external name '_DCMGetDictionaryWriteAccess';
  355. {
  356. * DCMReleaseDictionaryWriteAccess()
  357. *
  358. * Availability:
  359. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  360. * CarbonLib: in CarbonLib 1.0 and later
  361. * Mac OS X: in version 10.0 and later
  362. }
  363. function DCMReleaseDictionaryWriteAccess(dictionaryRef: DCMDictionaryRef; commitTransaction: boolean): OSStatus; external name '_DCMReleaseDictionaryWriteAccess';
  364. {
  365. Find records
  366. }
  367. {
  368. * DCMFindRecords()
  369. *
  370. * Availability:
  371. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  372. * CarbonLib: in CarbonLib 1.0 and later
  373. * Mac OS X: in version 10.0 and later
  374. }
  375. function DCMFindRecords(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; findMethod: DCMFindMethod; preFetchedDataNum: ItemCount; preFetchedData: DCMFieldTagPtr; skipCount: ItemCount; maxRecordCount: ItemCount; var recordIterator: DCMFoundRecordIterator): OSStatus; external name '_DCMFindRecords';
  376. {
  377. * DCMCountRecordIterator()
  378. *
  379. * Availability:
  380. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  381. * CarbonLib: in CarbonLib 1.0 and later
  382. * Mac OS X: in version 10.0 and later
  383. }
  384. function DCMCountRecordIterator(recordIterator: DCMFoundRecordIterator): ItemCount; external name '_DCMCountRecordIterator';
  385. {
  386. * DCMIterateFoundRecord()
  387. *
  388. * Availability:
  389. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  390. * CarbonLib: in CarbonLib 1.0 and later
  391. * Mac OS X: in version 10.0 and later
  392. }
  393. function DCMIterateFoundRecord(recordIterator: DCMFoundRecordIterator; maxKeySize: ByteCount; var actualKeySize: ByteCount; keyData: LogicalAddress; var uniqueID: DCMUniqueID; var dataList: AEDesc): OSStatus; external name '_DCMIterateFoundRecord';
  394. {
  395. * DCMDisposeRecordIterator()
  396. *
  397. * Availability:
  398. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  399. * CarbonLib: in CarbonLib 1.0 and later
  400. * Mac OS X: in version 10.0 and later
  401. }
  402. function DCMDisposeRecordIterator(recordIterator: DCMFoundRecordIterator): OSStatus; external name '_DCMDisposeRecordIterator';
  403. {
  404. Dump dictionary
  405. }
  406. {
  407. * DCMCountRecord()
  408. *
  409. * Availability:
  410. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  411. * CarbonLib: in CarbonLib 1.0 and later
  412. * Mac OS X: in version 10.0 and later
  413. }
  414. function DCMCountRecord(dictionaryID: DCMDictionaryID; var count: ItemCount): OSStatus; external name '_DCMCountRecord';
  415. {
  416. * DCMGetRecordSequenceNumber()
  417. *
  418. * Availability:
  419. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  420. * CarbonLib: in CarbonLib 1.0 and later
  421. * Mac OS X: in version 10.0 and later
  422. }
  423. function DCMGetRecordSequenceNumber(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; var sequenceNum: ItemCount): OSStatus; external name '_DCMGetRecordSequenceNumber';
  424. {
  425. * DCMGetNthRecord()
  426. *
  427. * Availability:
  428. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  429. * CarbonLib: in CarbonLib 1.0 and later
  430. * Mac OS X: in version 10.0 and later
  431. }
  432. function DCMGetNthRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; serialNum: ItemCount; maxKeySize: ByteCount; var keySize: ByteCount; keyData: LogicalAddress; var uniqueID: DCMUniqueID): OSStatus; external name '_DCMGetNthRecord';
  433. {
  434. * DCMGetNextRecord()
  435. *
  436. * Availability:
  437. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  438. * CarbonLib: in CarbonLib 1.0 and later
  439. * Mac OS X: in version 10.0 and later
  440. }
  441. function DCMGetNextRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; maxKeySize: ByteCount; var nextKeySize: ByteCount; nextKeyData: LogicalAddress; var nextUniqueID: DCMUniqueID): OSStatus; external name '_DCMGetNextRecord';
  442. {
  443. * DCMGetPrevRecord()
  444. *
  445. * Availability:
  446. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  447. * CarbonLib: in CarbonLib 1.0 and later
  448. * Mac OS X: in version 10.0 and later
  449. }
  450. function DCMGetPrevRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; maxKeySize: ByteCount; var prevKeySize: ByteCount; prevKeyData: LogicalAddress; var prevUniqueID: DCMUniqueID): OSStatus; external name '_DCMGetPrevRecord';
  451. {
  452. Get field data
  453. }
  454. {
  455. * DCMGetFieldData()
  456. *
  457. * Availability:
  458. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  459. * CarbonLib: in CarbonLib 1.0 and later
  460. * Mac OS X: in version 10.0 and later
  461. }
  462. function DCMGetFieldData(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; numOfData: ItemCount; dataTag: DCMFieldTagPtr; var dataList: AEDesc): OSStatus; external name '_DCMGetFieldData';
  463. {
  464. * DCMSetFieldData()
  465. *
  466. * Availability:
  467. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  468. * CarbonLib: in CarbonLib 1.0 and later
  469. * Mac OS X: in version 10.0 and later
  470. }
  471. function DCMSetFieldData(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID; const (*var*) dataList: AEDesc): OSStatus; external name '_DCMSetFieldData';
  472. {
  473. Add record
  474. }
  475. {
  476. * DCMAddRecord()
  477. *
  478. * Availability:
  479. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  480. * CarbonLib: in CarbonLib 1.0 and later
  481. * Mac OS X: in version 10.0 and later
  482. }
  483. function DCMAddRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; checkOnly: boolean; const (*var*) dataList: AEDesc; var newUniqueID: DCMUniqueID): OSStatus; external name '_DCMAddRecord';
  484. {
  485. * DCMDeleteRecord()
  486. *
  487. * Availability:
  488. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  489. * CarbonLib: in CarbonLib 1.0 and later
  490. * Mac OS X: in version 10.0 and later
  491. }
  492. function DCMDeleteRecord(dictionaryRef: DCMDictionaryRef; keyFieldTag: DCMFieldTag; keySize: ByteCount; keyData: ConstLogicalAddress; uniqueID: DCMUniqueID): OSStatus; external name '_DCMDeleteRecord';
  493. {
  494. Reorganize/compact dictionary
  495. }
  496. {
  497. * DCMReorganizeDictionary()
  498. *
  499. * Availability:
  500. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  501. * CarbonLib: in CarbonLib 1.0 and later
  502. * Mac OS X: in version 10.0 and later
  503. }
  504. function DCMReorganizeDictionary(dictionaryID: DCMDictionaryID; extraCapacity: ItemCount; progressProc: DCMProgressFilterUPP; userData: UInt32): OSStatus; external name '_DCMReorganizeDictionary';
  505. {
  506. * DCMCompactDictionary()
  507. *
  508. * Availability:
  509. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  510. * CarbonLib: in CarbonLib 1.0 and later
  511. * Mac OS X: in version 10.0 and later
  512. }
  513. function DCMCompactDictionary(dictionaryID: DCMDictionaryID; progressProc: DCMProgressFilterUPP; userData: UInt32): OSStatus; external name '_DCMCompactDictionary';
  514. {
  515. DictionaryID utilities
  516. }
  517. {
  518. * DCMGetFileFromDictionaryID()
  519. *
  520. * Availability:
  521. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  522. * CarbonLib: in CarbonLib 1.0 and later
  523. * Mac OS X: in version 10.0 and later
  524. }
  525. function DCMGetFileFromDictionaryID(dictionaryID: DCMDictionaryID; var fileRef: FSSpec): OSStatus; external name '_DCMGetFileFromDictionaryID';
  526. {
  527. * DCMGetDictionaryIDFromFile()
  528. *
  529. * Availability:
  530. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  531. * CarbonLib: in CarbonLib 1.0 and later
  532. * Mac OS X: in version 10.0 and later
  533. }
  534. function DCMGetDictionaryIDFromFile(const (*var*) fileRef: FSSpec; var dictionaryID: DCMDictionaryID): OSStatus; external name '_DCMGetDictionaryIDFromFile';
  535. {
  536. * DCMGetDictionaryIDFromRef()
  537. *
  538. * Availability:
  539. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  540. * CarbonLib: in CarbonLib 1.0 and later
  541. * Mac OS X: in version 10.0 and later
  542. }
  543. function DCMGetDictionaryIDFromRef(dictionaryRef: DCMDictionaryRef): DCMDictionaryID; external name '_DCMGetDictionaryIDFromRef';
  544. {
  545. Field information and manipulation
  546. }
  547. {
  548. * DCMGetDictionaryFieldInfo()
  549. *
  550. * Availability:
  551. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  552. * CarbonLib: in CarbonLib 1.0 and later
  553. * Mac OS X: in version 10.0 and later
  554. }
  555. function DCMGetDictionaryFieldInfo(dictionaryID: DCMDictionaryID; fieldTag: DCMFieldTag; var fieldInfoRecord: AEDesc): OSStatus; external name '_DCMGetDictionaryFieldInfo';
  556. {
  557. Dictionary property
  558. }
  559. {
  560. * DCMGetDictionaryProperty()
  561. *
  562. * Availability:
  563. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  564. * CarbonLib: in CarbonLib 1.0 and later
  565. * Mac OS X: in version 10.0 and later
  566. }
  567. function DCMGetDictionaryProperty(dictionaryID: DCMDictionaryID; propertyTag: DCMFieldTag; maxPropertySize: ByteCount; var actualSize: ByteCount; propertyValue: LogicalAddress): OSStatus; external name '_DCMGetDictionaryProperty';
  568. {
  569. * DCMSetDictionaryProperty()
  570. *
  571. * Availability:
  572. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  573. * CarbonLib: in CarbonLib 1.0 and later
  574. * Mac OS X: in version 10.0 and later
  575. }
  576. function DCMSetDictionaryProperty(dictionaryID: DCMDictionaryID; propertyTag: DCMFieldTag; propertySize: ByteCount; propertyValue: ConstLogicalAddress): OSStatus; external name '_DCMSetDictionaryProperty';
  577. {
  578. * DCMGetDictionaryPropertyList()
  579. *
  580. * Availability:
  581. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  582. * CarbonLib: in CarbonLib 1.0 and later
  583. * Mac OS X: in version 10.0 and later
  584. }
  585. function DCMGetDictionaryPropertyList(dictionaryID: DCMDictionaryID; maxPropertyNum: ItemCount; var numProperties: ItemCount; propertyTag: DCMFieldTagPtr): OSStatus; external name '_DCMGetDictionaryPropertyList';
  586. {
  587. Seaarch dictionary
  588. }
  589. {
  590. * DCMCreateDictionaryIterator()
  591. *
  592. * Availability:
  593. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  594. * CarbonLib: in CarbonLib 1.0 and later
  595. * Mac OS X: in version 10.0 and later
  596. }
  597. function DCMCreateDictionaryIterator(var dictionaryIterator: DCMDictionaryIterator): OSStatus; external name '_DCMCreateDictionaryIterator';
  598. {
  599. Search AccessMethod
  600. }
  601. {
  602. * DCMCreateAccessMethodIterator()
  603. *
  604. * Availability:
  605. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  606. * CarbonLib: in CarbonLib 1.0 and later
  607. * Mac OS X: in version 10.0 and later
  608. }
  609. function DCMCreateAccessMethodIterator(var accessMethodIterator: DCMAccessMethodIterator): OSStatus; external name '_DCMCreateAccessMethodIterator';
  610. {
  611. Iterator Operation
  612. }
  613. {
  614. * DCMCountObjectIterator()
  615. *
  616. * Availability:
  617. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  618. * CarbonLib: in CarbonLib 1.0 and later
  619. * Mac OS X: in version 10.0 and later
  620. }
  621. function DCMCountObjectIterator(iterator: DCMObjectIterator): ItemCount; external name '_DCMCountObjectIterator';
  622. {
  623. * DCMIterateObject()
  624. *
  625. * Availability:
  626. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  627. * CarbonLib: in CarbonLib 1.0 and later
  628. * Mac OS X: in version 10.0 and later
  629. }
  630. function DCMIterateObject(iterator: DCMObjectIterator; var objectID: DCMObjectID): OSStatus; external name '_DCMIterateObject';
  631. {
  632. * DCMResetObjectIterator()
  633. *
  634. * Availability:
  635. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  636. * CarbonLib: in CarbonLib 1.0 and later
  637. * Mac OS X: in version 10.0 and later
  638. }
  639. function DCMResetObjectIterator(iterator: DCMObjectIterator): OSStatus; external name '_DCMResetObjectIterator';
  640. {
  641. * DCMDisposeObjectIterator()
  642. *
  643. * Availability:
  644. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  645. * CarbonLib: in CarbonLib 1.0 and later
  646. * Mac OS X: in version 10.0 and later
  647. }
  648. function DCMDisposeObjectIterator(iterator: DCMObjectIterator): OSStatus; external name '_DCMDisposeObjectIterator';
  649. {
  650. Get AccessMethod information
  651. }
  652. {
  653. * DCMGetAccessMethodIDFromName()
  654. *
  655. * Availability:
  656. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  657. * CarbonLib: in CarbonLib 1.0 and later
  658. * Mac OS X: in version 10.0 and later
  659. }
  660. function DCMGetAccessMethodIDFromName(const (*var*) accessMethodName: Str63; var accessMethodID: DCMAccessMethodID): OSStatus; external name '_DCMGetAccessMethodIDFromName';
  661. {
  662. Field Info Record routines
  663. }
  664. {
  665. * DCMCreateFieldInfoRecord()
  666. *
  667. * Availability:
  668. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  669. * CarbonLib: in CarbonLib 1.0 and later
  670. * Mac OS X: in version 10.0 and later
  671. }
  672. function DCMCreateFieldInfoRecord(fieldTag: DescType; fieldType: DescType; maxRecordSize: ByteCount; fieldAttributes: DCMFieldAttributes; var fieldDefaultData: AEDesc; numberOfFindMethods: ItemCount; var findMethods: DCMFindMethod; var fieldInfoRecord: AEDesc): OSStatus; external name '_DCMCreateFieldInfoRecord';
  673. {
  674. * DCMGetFieldTagAndType()
  675. *
  676. * Availability:
  677. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  678. * CarbonLib: in CarbonLib 1.0 and later
  679. * Mac OS X: in version 10.0 and later
  680. }
  681. function DCMGetFieldTagAndType(const (*var*) fieldInfoRecord: AEDesc; var fieldTag: DCMFieldTag; var fieldType: DCMFieldType): OSStatus; external name '_DCMGetFieldTagAndType';
  682. {
  683. * DCMGetFieldMaxRecordSize()
  684. *
  685. * Availability:
  686. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  687. * CarbonLib: in CarbonLib 1.0 and later
  688. * Mac OS X: in version 10.0 and later
  689. }
  690. function DCMGetFieldMaxRecordSize(const (*var*) fieldInfoRecord: AEDesc; var maxRecordSize: ByteCount): OSStatus; external name '_DCMGetFieldMaxRecordSize';
  691. {
  692. * DCMGetFieldAttributes()
  693. *
  694. * Availability:
  695. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  696. * CarbonLib: in CarbonLib 1.0 and later
  697. * Mac OS X: in version 10.0 and later
  698. }
  699. function DCMGetFieldAttributes(const (*var*) fieldInfoRecord: AEDesc; var attributes: DCMFieldAttributes): OSStatus; external name '_DCMGetFieldAttributes';
  700. {
  701. * DCMGetFieldDefaultData()
  702. *
  703. * Availability:
  704. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  705. * CarbonLib: in CarbonLib 1.0 and later
  706. * Mac OS X: in version 10.0 and later
  707. }
  708. function DCMGetFieldDefaultData(const (*var*) fieldInfoRecord: AEDesc; desiredType: DescType; var fieldDefaultData: AEDesc): OSStatus; external name '_DCMGetFieldDefaultData';
  709. {
  710. * DCMGetFieldFindMethods()
  711. *
  712. * Availability:
  713. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  714. * CarbonLib: in CarbonLib 1.0 and later
  715. * Mac OS X: in version 10.0 and later
  716. }
  717. function DCMGetFieldFindMethods(const (*var*) fieldInfoRecord: AEDesc; findMethodsArrayMaxSize: ItemCount; var findMethods: DCMFindMethod; var actualNumberOfFindMethods: ItemCount): OSStatus; external name '_DCMGetFieldFindMethods';
  718. {
  719. Check Dictionary Manager availability
  720. }
  721. {$ifc TARGET_RT_MAC_CFM}
  722. {
  723. DCMDictionaryManagerAvailable() is a macro available only in C/C++.
  724. To get the same functionality from pascal or assembly, you need
  725. to test if Dictionary Manager functions are not NULL.
  726. For instance:
  727. IF @DCMLibraryVersion <> kUnresolvedCFragSymbolAddress THEN
  728. gDictionaryManagerAvailable = TRUE;
  729. ELSE
  730. gDictionaryManagerAvailable = FALSE;
  731. end
  732. }
  733. {$elsec}
  734. {$ifc TARGET_RT_MAC_MACHO}
  735. { Dictionary Manager is always available on OS X }
  736. {$endc}
  737. {$endc}
  738. {
  739. =============================================================================================
  740. Definitions for Japanese Analysis Module
  741. =============================================================================================
  742. }
  743. {
  744. Default dictionary access method for Japanese analysis
  745. }
  746. {
  747. Data length limitations of Apple Japanese dictionaries
  748. }
  749. const
  750. kMaxYomiLengthInAppleJapaneseDictionary = 40;
  751. kMaxKanjiLengthInAppleJapaneseDictionary = 64;
  752. {
  753. Defined field tags of Apple Japanese dictionary
  754. }
  755. kDCMJapaneseYomiTag = $796F6D69 (* 'yomi' *);
  756. kDCMJapaneseHyokiTag = $68796F6B (* 'hyok' *);
  757. kDCMJapaneseHinshiTag = $68696E73 (* 'hins' *);
  758. kDCMJapaneseWeightTag = $68696E64 (* 'hind' *);
  759. kDCMJapanesePhoneticTag = $68746F6E (* 'hton' *);
  760. kDCMJapaneseAccentTag = $61636E74 (* 'acnt' *);
  761. kDCMJapaneseOnKunReadingTag = $4F6E4B6E (* 'OnKn' *);
  762. kDCMJapaneseFukugouInfoTag = $66756B75 (* 'fuku' *);
  763. kDCMJapaneseYomiType = $75747874 (* 'utxt' *);
  764. kDCMJapaneseHyokiType = $75747874 (* 'utxt' *);
  765. kDCMJapaneseHinshiType = $68696E73 (* 'hins' *);
  766. kDCMJapaneseWeightType = $73686F72 (* 'shor' *);
  767. kDCMJapanesePhoneticType = $75747874 (* 'utxt' *);
  768. kDCMJapaneseAccentType = $62797465 (* 'byte' *);
  769. kDCMJapaneseOnKunReadingType = $75747874 (* 'utxt' *);
  770. kDCMJapaneseFukugouInfoType = $66756B75 (* 'fuku' *);
  771. {
  772. =============================================================================================
  773. System 7 Dictionary Manager
  774. =============================================================================================
  775. }
  776. {$ALIGN MAC68K}
  777. { Dictionary data insertion modes }
  778. kInsert = 0; { Only insert the input entry if there is nothing in the dictionary that matches the key. }
  779. kReplace = 1; { Only replace the entries which match the key with the input entry. }
  780. kInsertOrReplace = 2; { Insert the entry if there is nothing in the dictionary which matches the key, otherwise replaces the existing matched entries with the input entry. }
  781. { This Was InsertMode }
  782. type
  783. DictionaryDataInsertMode = SInt16;
  784. const
  785. { Key attribute constants }
  786. kIsCaseSensitive = $10; { case sensitive = 16 }
  787. kIsNotDiacriticalSensitive = $20; { diac not sensitive = 32 }
  788. { Registered attribute type constants. }
  789. kNoun = -1;
  790. kVerb = -2;
  791. kAdjective = -3;
  792. kAdverb = -4;
  793. { This Was AttributeType }
  794. type
  795. DictionaryEntryAttribute = SInt8;
  796. { Dictionary information record }
  797. DictionaryInformationPtr = ^DictionaryInformation;
  798. DictionaryInformation = record
  799. dictionaryFSSpec: FSSpec;
  800. numberOfRecords: SInt32;
  801. currentGarbageSize: SInt32;
  802. script: ScriptCode;
  803. maximumKeyLength: SInt16;
  804. keyAttributes: SInt8;
  805. end;
  806. DictionaryAttributeTablePtr = ^DictionaryAttributeTable;
  807. DictionaryAttributeTable = packed record
  808. datSize: UInt8;
  809. datTable: array [0..0] of DictionaryEntryAttribute;
  810. end;
  811. {$ifc CALL_NOT_IN_CARBON}
  812. {
  813. * InitializeDictionary()
  814. *
  815. * Availability:
  816. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  817. * CarbonLib: not available
  818. * Mac OS X: not available
  819. }
  820. function InitializeDictionary(const (*var*) theFsspecPtr: FSSpec; maximumKeyLength: SInt16; keyAttributes: SInt8; script: ScriptCode): OSErr; external name '_InitializeDictionary';
  821. {
  822. * OpenDictionary()
  823. *
  824. * Availability:
  825. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  826. * CarbonLib: not available
  827. * Mac OS X: not available
  828. }
  829. function OpenDictionary(const (*var*) theFsspecPtr: FSSpec; accessPermission: SInt8; var dictionaryReference: SInt32): OSErr; external name '_OpenDictionary';
  830. {
  831. * CloseDictionary()
  832. *
  833. * Availability:
  834. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  835. * CarbonLib: not available
  836. * Mac OS X: not available
  837. }
  838. function CloseDictionary(dictionaryReference: SInt32): OSErr; external name '_CloseDictionary';
  839. {
  840. * InsertRecordToDictionary()
  841. *
  842. * Availability:
  843. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  844. * CarbonLib: not available
  845. * Mac OS X: not available
  846. }
  847. function InsertRecordToDictionary(dictionaryReference: SInt32; const (*var*) key: Str255; recordDataHandle: Handle; whichMode: DictionaryDataInsertMode): OSErr; external name '_InsertRecordToDictionary';
  848. {
  849. * DeleteRecordFromDictionary()
  850. *
  851. * Availability:
  852. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  853. * CarbonLib: not available
  854. * Mac OS X: not available
  855. }
  856. function DeleteRecordFromDictionary(dictionaryReference: SInt32; const (*var*) key: Str255): OSErr; external name '_DeleteRecordFromDictionary';
  857. {
  858. * FindRecordInDictionary()
  859. *
  860. * Availability:
  861. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  862. * CarbonLib: not available
  863. * Mac OS X: not available
  864. }
  865. function FindRecordInDictionary(dictionaryReference: SInt32; const (*var*) key: Str255; requestedAttributeTablePointer: DictionaryAttributeTablePtr; recordDataHandle: Handle): OSErr; external name '_FindRecordInDictionary';
  866. {
  867. * FindRecordByIndexInDictionary()
  868. *
  869. * Availability:
  870. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  871. * CarbonLib: not available
  872. * Mac OS X: not available
  873. }
  874. function FindRecordByIndexInDictionary(dictionaryReference: SInt32; recordIndex: SInt32; requestedAttributeTablePointer: DictionaryAttributeTablePtr; var recordKey: Str255; recordDataHandle: Handle): OSErr; external name '_FindRecordByIndexInDictionary';
  875. {
  876. * GetDictionaryInformation()
  877. *
  878. * Availability:
  879. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  880. * CarbonLib: not available
  881. * Mac OS X: not available
  882. }
  883. function GetDictionaryInformation(dictionaryReference: SInt32; var theDictionaryInformation: DictionaryInformation): OSErr; external name '_GetDictionaryInformation';
  884. {
  885. * CompactDictionary()
  886. *
  887. * Availability:
  888. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  889. * CarbonLib: not available
  890. * Mac OS X: not available
  891. }
  892. function CompactDictionary(dictionaryReference: SInt32): OSErr; external name '_CompactDictionary';
  893. {$endc} {CALL_NOT_IN_CARBON}
  894. {$ALIGN MAC68K}
  895. end.