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.

1299 lines
35 KiB

  1. /*
  2. File: Dictionary.h
  3. Contains: Dictionary Manager Interfaces
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1992-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 __DICTIONARY__
  11. #define __DICTIONARY__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __FILES__
  16. #include <Files.h>
  17. #endif
  18. #ifndef __CODEFRAGMENTS__
  19. #include <CodeFragments.h>
  20. #endif
  21. #ifndef __MACERRORS__
  22. #include <MacErrors.h>
  23. #endif
  24. #ifndef __AEREGISTRY__
  25. #include <AERegistry.h>
  26. #endif
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if PRAGMA_IMPORT
  34. #pragma import on
  35. #endif
  36. #if PRAGMA_STRUCT_ALIGN
  37. #pragma options align=power
  38. #elif PRAGMA_STRUCT_PACKPUSH
  39. #pragma pack(push, 2)
  40. #elif PRAGMA_STRUCT_PACK
  41. #pragma pack(2)
  42. #endif
  43. /*
  44. =============================================================================================
  45. Modern Dictionary Manager
  46. =============================================================================================
  47. */
  48. /*
  49. Dictionary information
  50. */
  51. enum {
  52. kDictionaryFileType = FOUR_CHAR_CODE('dict'),
  53. kDCMDictionaryHeaderSignature = FOUR_CHAR_CODE('dict'),
  54. kDCMDictionaryHeaderVersion = 2
  55. };
  56. enum {
  57. kDCMAnyFieldTag = typeWildCard,
  58. kDCMAnyFieldType = typeWildCard
  59. };
  60. /*
  61. Contents of a Field Info Record (an AERecord)
  62. */
  63. enum {
  64. keyDCMFieldTag = FOUR_CHAR_CODE('ftag'), /* typeEnumeration */
  65. keyDCMFieldType = FOUR_CHAR_CODE('ftyp'), /* typeEnumeration */
  66. keyDCMMaxRecordSize = FOUR_CHAR_CODE('mrsz'), /* typeMagnitude */
  67. keyDCMFieldAttributes = FOUR_CHAR_CODE('fatr'),
  68. keyDCMFieldDefaultData = FOUR_CHAR_CODE('fdef'),
  69. keyDCMFieldName = FOUR_CHAR_CODE('fnam'), /* typeChar */
  70. keyDCMFieldFindMethods = FOUR_CHAR_CODE('ffnd') /* typeAEList of typeDCMFindMethod */
  71. };
  72. /*
  73. Special types for fields of a Field Info Record
  74. */
  75. enum {
  76. typeDCMFieldAttributes = FOUR_CHAR_CODE('fatr'),
  77. typeDCMFindMethod = FOUR_CHAR_CODE('fmth')
  78. };
  79. /*
  80. Field attributes
  81. */
  82. enum {
  83. kDCMIndexedFieldMask = 0x00000001,
  84. kDCMRequiredFieldMask = 0x00000002,
  85. kDCMIdentifyFieldMask = 0x00000004,
  86. kDCMFixedSizeFieldMask = 0x00000008,
  87. kDCMHiddenFieldMask = (long)0x80000000
  88. };
  89. typedef OptionBits DCMFieldAttributes;
  90. /*
  91. Standard dictionary properties
  92. */
  93. enum {
  94. pDCMAccessMethod = FOUR_CHAR_CODE('amtd'), /* data type: typeChar ReadOnly */
  95. pDCMPermission = FOUR_CHAR_CODE('perm'), /* data type: typeUInt16 */
  96. pDCMListing = FOUR_CHAR_CODE('list'), /* data type: typeUInt16 */
  97. pDCMMaintenance = FOUR_CHAR_CODE('mtnc'), /* data type: typeUInt16 */
  98. pDCMLocale = FOUR_CHAR_CODE('locl'), /* data type: typeUInt32. Optional; default = kLocaleIdentifierWildCard */
  99. pDCMClass = pClass, /* data type: typeUInt16 */
  100. pDCMCopyright = FOUR_CHAR_CODE('info') /* data type: typeChar */
  101. };
  102. /*
  103. pDCMPermission property constants
  104. */
  105. enum {
  106. kDCMReadOnlyDictionary = 0,
  107. kDCMReadWriteDictionary = 1
  108. };
  109. /*
  110. pDCMListing property constants
  111. */
  112. enum {
  113. kDCMAllowListing = 0,
  114. kDCMProhibitListing = 1
  115. };
  116. /*
  117. pDCMClass property constants
  118. */
  119. enum {
  120. kDCMUserDictionaryClass = 0,
  121. kDCMSpecificDictionaryClass = 1,
  122. kDCMBasicDictionaryClass = 2
  123. };
  124. /*
  125. Standard search method
  126. */
  127. enum {
  128. kDCMFindMethodExactMatch = kAEEquals,
  129. kDCMFindMethodBeginningMatch = kAEBeginsWith,
  130. kDCMFindMethodContainsMatch = kAEContains,
  131. kDCMFindMethodEndingMatch = kAEEndsWith,
  132. kDCMFindMethodForwardTrie = FOUR_CHAR_CODE('ftri'), /* used for morphological analysis*/
  133. kDCMFindMethodBackwardTrie = FOUR_CHAR_CODE('btri') /* used for morphological analysis*/
  134. };
  135. typedef OSType DCMFindMethod;
  136. /*
  137. AccessMethod features
  138. */
  139. enum {
  140. kDCMCanUseFileDictionaryMask = 0x00000001,
  141. kDCMCanUseMemoryDictionaryMask = 0x00000002,
  142. kDCMCanStreamDictionaryMask = 0x00000004,
  143. kDCMCanHaveMultipleIndexMask = 0x00000008,
  144. kDCMCanModifyDictionaryMask = 0x00000010,
  145. kDCMCanCreateDictionaryMask = 0x00000020,
  146. kDCMCanAddDictionaryFieldMask = 0x00000040,
  147. kDCMCanUseTransactionMask = 0x00000080
  148. };
  149. typedef OptionBits DCMAccessMethodFeature;
  150. typedef UInt32 DCMUniqueID;
  151. typedef struct OpaqueDCMObjectID* DCMObjectID;
  152. typedef DCMObjectID DCMAccessMethodID;
  153. typedef DCMObjectID DCMDictionaryID;
  154. #define kDCMInvalidObjectID ((DCMObjectID) kInvalidID)
  155. typedef struct OpaqueDCMObjectRef* DCMObjectRef;
  156. typedef DCMObjectRef DCMDictionaryRef;
  157. typedef DCMObjectRef DCMDictionaryStreamRef;
  158. #define kDCMInvalidObjectRef ((DCMObjectRef) kInvalidID)
  159. typedef struct OpaqueDCMObjectIterator* DCMObjectIterator;
  160. typedef DCMObjectIterator DCMAccessMethodIterator;
  161. typedef DCMObjectIterator DCMDictionaryIterator;
  162. typedef struct OpaqueDCMFoundRecordIterator* DCMFoundRecordIterator;
  163. /*
  164. Field specification declarations
  165. */
  166. typedef DescType DCMFieldTag;
  167. typedef DescType DCMFieldType;
  168. /*
  169. Dictionary header information
  170. */
  171. struct DCMDictionaryHeader {
  172. FourCharCode headerSignature;
  173. UInt32 headerVersion;
  174. ByteCount headerSize;
  175. Str63 accessMethod;
  176. };
  177. typedef struct DCMDictionaryHeader DCMDictionaryHeader;
  178. /*
  179. Callback routines
  180. */
  181. typedef CALLBACK_API( Boolean , DCMProgressFilterProcPtr )(Boolean determinateProcess, UInt16 percentageComplete, UInt32 callbackUD);
  182. typedef STACK_UPP_TYPE(DCMProgressFilterProcPtr) DCMProgressFilterUPP;
  183. #if CALL_NOT_IN_CARBON
  184. /*
  185. * NewDCMProgressFilterUPP()
  186. *
  187. * Availability:
  188. * Non-Carbon CFM: available as macro/inline
  189. * CarbonLib: not available
  190. * Mac OS X: not available
  191. */
  192. EXTERN_API_C( DCMProgressFilterUPP )
  193. NewDCMProgressFilterUPP(DCMProgressFilterProcPtr userRoutine);
  194. #if !OPAQUE_UPP_TYPES
  195. enum { uppDCMProgressFilterProcInfo = 0x00000E50 }; /* pascal 1_byte Func(1_byte, 2_bytes, 4_bytes) */
  196. #ifdef __cplusplus
  197. inline DEFINE_API_C(DCMProgressFilterUPP) NewDCMProgressFilterUPP(DCMProgressFilterProcPtr userRoutine) { return (DCMProgressFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDCMProgressFilterProcInfo, GetCurrentArchitecture()); }
  198. #else
  199. #define NewDCMProgressFilterUPP(userRoutine) (DCMProgressFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDCMProgressFilterProcInfo, GetCurrentArchitecture())
  200. #endif
  201. #endif
  202. /*
  203. * DisposeDCMProgressFilterUPP()
  204. *
  205. * Availability:
  206. * Non-Carbon CFM: available as macro/inline
  207. * CarbonLib: not available
  208. * Mac OS X: not available
  209. */
  210. EXTERN_API_C( void )
  211. DisposeDCMProgressFilterUPP(DCMProgressFilterUPP userUPP);
  212. #if !OPAQUE_UPP_TYPES
  213. #ifdef __cplusplus
  214. inline DEFINE_API_C(void) DisposeDCMProgressFilterUPP(DCMProgressFilterUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  215. #else
  216. #define DisposeDCMProgressFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  217. #endif
  218. #endif
  219. /*
  220. * InvokeDCMProgressFilterUPP()
  221. *
  222. * Availability:
  223. * Non-Carbon CFM: available as macro/inline
  224. * CarbonLib: not available
  225. * Mac OS X: not available
  226. */
  227. EXTERN_API_C( Boolean )
  228. InvokeDCMProgressFilterUPP(
  229. Boolean determinateProcess,
  230. UInt16 percentageComplete,
  231. UInt32 callbackUD,
  232. DCMProgressFilterUPP userUPP);
  233. #if !OPAQUE_UPP_TYPES
  234. #ifdef __cplusplus
  235. inline DEFINE_API_C(Boolean) InvokeDCMProgressFilterUPP(Boolean determinateProcess, UInt16 percentageComplete, UInt32 callbackUD, DCMProgressFilterUPP userUPP) { return (Boolean)CALL_THREE_PARAMETER_UPP(userUPP, uppDCMProgressFilterProcInfo, determinateProcess, percentageComplete, callbackUD); }
  236. #else
  237. #define InvokeDCMProgressFilterUPP(determinateProcess, percentageComplete, callbackUD, userUPP) (Boolean)CALL_THREE_PARAMETER_UPP((userUPP), uppDCMProgressFilterProcInfo, (determinateProcess), (percentageComplete), (callbackUD))
  238. #endif
  239. #endif
  240. #endif /* CALL_NOT_IN_CARBON */
  241. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  242. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  243. #define NewDCMProgressFilterProc(userRoutine) NewDCMProgressFilterUPP(userRoutine)
  244. #define CallDCMProgressFilterProc(userRoutine, determinateProcess, percentageComplete, callbackUD) InvokeDCMProgressFilterUPP(determinateProcess, percentageComplete, callbackUD, userRoutine)
  245. #endif /* CALL_NOT_IN_CARBON */
  246. /*
  247. Library version
  248. */
  249. /*
  250. * DCMLibraryVersion()
  251. *
  252. * Availability:
  253. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  254. * CarbonLib: in CarbonLib 1.0 and later
  255. * Mac OS X: in version 10.0 and later
  256. */
  257. EXTERN_API( UInt32 )
  258. DCMLibraryVersion(void);
  259. /*
  260. Create/delete dictionary
  261. */
  262. /*
  263. * DCMNewDictionary()
  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. EXTERN_API( OSStatus )
  271. DCMNewDictionary(
  272. DCMAccessMethodID accessMethodID,
  273. const FSSpec * newDictionaryFile,
  274. ScriptCode scriptTag,
  275. const AEDesc * listOfFieldInfoRecords,
  276. Boolean invisible,
  277. ItemCount recordCapacity,
  278. DCMDictionaryID * newDictionary);
  279. /*
  280. * DCMDeriveNewDictionary()
  281. *
  282. * Availability:
  283. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  284. * CarbonLib: in CarbonLib 1.0 and later
  285. * Mac OS X: in version 10.0 and later
  286. */
  287. EXTERN_API( OSStatus )
  288. DCMDeriveNewDictionary(
  289. DCMDictionaryID srcDictionary,
  290. const FSSpec * newDictionaryFile,
  291. ScriptCode scriptTag,
  292. Boolean invisible,
  293. ItemCount recordCapacity,
  294. DCMDictionaryID * newDictionary);
  295. /*
  296. * DCMDeleteDictionary()
  297. *
  298. * Availability:
  299. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  300. * CarbonLib: in CarbonLib 1.0 and later
  301. * Mac OS X: in version 10.0 and later
  302. */
  303. EXTERN_API( OSStatus )
  304. DCMDeleteDictionary(DCMDictionaryID dictionaryID);
  305. /*
  306. Register dictionary
  307. */
  308. /*
  309. * DCMRegisterDictionaryFile()
  310. *
  311. * Availability:
  312. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  313. * CarbonLib: in CarbonLib 1.0 and later
  314. * Mac OS X: in version 10.0 and later
  315. */
  316. EXTERN_API( OSStatus )
  317. DCMRegisterDictionaryFile(
  318. const FSSpec * dictionaryFile,
  319. DCMDictionaryID * dictionaryID);
  320. /*
  321. * DCMUnregisterDictionary()
  322. *
  323. * Availability:
  324. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  325. * CarbonLib: in CarbonLib 1.0 and later
  326. * Mac OS X: in version 10.0 and later
  327. */
  328. EXTERN_API( OSStatus )
  329. DCMUnregisterDictionary(DCMDictionaryID dictionaryID);
  330. /*
  331. Open dictionary
  332. */
  333. /*
  334. * DCMOpenDictionary()
  335. *
  336. * Availability:
  337. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  338. * CarbonLib: in CarbonLib 1.0 and later
  339. * Mac OS X: in version 10.0 and later
  340. */
  341. EXTERN_API( OSStatus )
  342. DCMOpenDictionary(
  343. DCMDictionaryID dictionaryID,
  344. ByteCount protectKeySize,
  345. ConstLogicalAddress protectKey,
  346. DCMDictionaryRef * dictionaryRef);
  347. /*
  348. * DCMCloseDictionary()
  349. *
  350. * Availability:
  351. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  352. * CarbonLib: in CarbonLib 1.0 and later
  353. * Mac OS X: in version 10.0 and later
  354. */
  355. EXTERN_API( OSStatus )
  356. DCMCloseDictionary(DCMDictionaryRef dictionaryRef);
  357. /*
  358. Change access privilege
  359. */
  360. /*
  361. * DCMGetDictionaryWriteAccess()
  362. *
  363. * Availability:
  364. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  365. * CarbonLib: in CarbonLib 1.0 and later
  366. * Mac OS X: in version 10.0 and later
  367. */
  368. EXTERN_API( OSStatus )
  369. DCMGetDictionaryWriteAccess(
  370. DCMDictionaryRef dictionaryRef,
  371. Duration timeOutDuration);
  372. /*
  373. * DCMReleaseDictionaryWriteAccess()
  374. *
  375. * Availability:
  376. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  377. * CarbonLib: in CarbonLib 1.0 and later
  378. * Mac OS X: in version 10.0 and later
  379. */
  380. EXTERN_API( OSStatus )
  381. DCMReleaseDictionaryWriteAccess(
  382. DCMDictionaryRef dictionaryRef,
  383. Boolean commitTransaction);
  384. /*
  385. Find records
  386. */
  387. /*
  388. * DCMFindRecords()
  389. *
  390. * Availability:
  391. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  392. * CarbonLib: in CarbonLib 1.0 and later
  393. * Mac OS X: in version 10.0 and later
  394. */
  395. EXTERN_API( OSStatus )
  396. DCMFindRecords(
  397. DCMDictionaryRef dictionaryRef,
  398. DCMFieldTag keyFieldTag,
  399. ByteCount keySize,
  400. ConstLogicalAddress keyData,
  401. DCMFindMethod findMethod,
  402. ItemCount preFetchedDataNum,
  403. DCMFieldTag preFetchedData[],
  404. ItemCount skipCount,
  405. ItemCount maxRecordCount,
  406. DCMFoundRecordIterator * recordIterator);
  407. /*
  408. * DCMCountRecordIterator()
  409. *
  410. * Availability:
  411. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  412. * CarbonLib: in CarbonLib 1.0 and later
  413. * Mac OS X: in version 10.0 and later
  414. */
  415. EXTERN_API( ItemCount )
  416. DCMCountRecordIterator(DCMFoundRecordIterator recordIterator);
  417. /*
  418. * DCMIterateFoundRecord()
  419. *
  420. * Availability:
  421. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  422. * CarbonLib: in CarbonLib 1.0 and later
  423. * Mac OS X: in version 10.0 and later
  424. */
  425. EXTERN_API( OSStatus )
  426. DCMIterateFoundRecord(
  427. DCMFoundRecordIterator recordIterator,
  428. ByteCount maxKeySize,
  429. ByteCount * actualKeySize,
  430. LogicalAddress keyData,
  431. DCMUniqueID * uniqueID,
  432. AEDesc * dataList);
  433. /*
  434. * DCMDisposeRecordIterator()
  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. EXTERN_API( OSStatus )
  442. DCMDisposeRecordIterator(DCMFoundRecordIterator recordIterator);
  443. /*
  444. Dump dictionary
  445. */
  446. /*
  447. * DCMCountRecord()
  448. *
  449. * Availability:
  450. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  451. * CarbonLib: in CarbonLib 1.0 and later
  452. * Mac OS X: in version 10.0 and later
  453. */
  454. EXTERN_API( OSStatus )
  455. DCMCountRecord(
  456. DCMDictionaryID dictionaryID,
  457. ItemCount * count);
  458. /*
  459. * DCMGetRecordSequenceNumber()
  460. *
  461. * Availability:
  462. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  463. * CarbonLib: in CarbonLib 1.0 and later
  464. * Mac OS X: in version 10.0 and later
  465. */
  466. EXTERN_API( OSStatus )
  467. DCMGetRecordSequenceNumber(
  468. DCMDictionaryRef dictionaryRef,
  469. DCMFieldTag keyFieldTag,
  470. ByteCount keySize,
  471. ConstLogicalAddress keyData,
  472. DCMUniqueID uniqueID,
  473. ItemCount * sequenceNum);
  474. /*
  475. * DCMGetNthRecord()
  476. *
  477. * Availability:
  478. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  479. * CarbonLib: in CarbonLib 1.0 and later
  480. * Mac OS X: in version 10.0 and later
  481. */
  482. EXTERN_API( OSStatus )
  483. DCMGetNthRecord(
  484. DCMDictionaryRef dictionaryRef,
  485. DCMFieldTag keyFieldTag,
  486. ItemCount serialNum,
  487. ByteCount maxKeySize,
  488. ByteCount * keySize,
  489. LogicalAddress keyData,
  490. DCMUniqueID * uniqueID);
  491. /*
  492. * DCMGetNextRecord()
  493. *
  494. * Availability:
  495. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  496. * CarbonLib: in CarbonLib 1.0 and later
  497. * Mac OS X: in version 10.0 and later
  498. */
  499. EXTERN_API( OSStatus )
  500. DCMGetNextRecord(
  501. DCMDictionaryRef dictionaryRef,
  502. DCMFieldTag keyFieldTag,
  503. ByteCount keySize,
  504. ConstLogicalAddress keyData,
  505. DCMUniqueID uniqueID,
  506. ByteCount maxKeySize,
  507. ByteCount * nextKeySize,
  508. LogicalAddress nextKeyData,
  509. DCMUniqueID * nextUniqueID);
  510. /*
  511. * DCMGetPrevRecord()
  512. *
  513. * Availability:
  514. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  515. * CarbonLib: in CarbonLib 1.0 and later
  516. * Mac OS X: in version 10.0 and later
  517. */
  518. EXTERN_API( OSStatus )
  519. DCMGetPrevRecord(
  520. DCMDictionaryRef dictionaryRef,
  521. DCMFieldTag keyFieldTag,
  522. ByteCount keySize,
  523. ConstLogicalAddress keyData,
  524. DCMUniqueID uniqueID,
  525. ByteCount maxKeySize,
  526. ByteCount * prevKeySize,
  527. LogicalAddress prevKeyData,
  528. DCMUniqueID * prevUniqueID);
  529. /*
  530. Get field data
  531. */
  532. /*
  533. * DCMGetFieldData()
  534. *
  535. * Availability:
  536. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  537. * CarbonLib: in CarbonLib 1.0 and later
  538. * Mac OS X: in version 10.0 and later
  539. */
  540. EXTERN_API( OSStatus )
  541. DCMGetFieldData(
  542. DCMDictionaryRef dictionaryRef,
  543. DCMFieldTag keyFieldTag,
  544. ByteCount keySize,
  545. ConstLogicalAddress keyData,
  546. DCMUniqueID uniqueID,
  547. ItemCount numOfData,
  548. const DCMFieldTag dataTag[],
  549. AEDesc * dataList);
  550. /*
  551. * DCMSetFieldData()
  552. *
  553. * Availability:
  554. * Non-Carbon CFM: in DictionaryMgrLib 1.0 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. DCMSetFieldData(
  560. DCMDictionaryRef dictionaryRef,
  561. DCMFieldTag keyFieldTag,
  562. ByteCount keySize,
  563. ConstLogicalAddress keyData,
  564. DCMUniqueID uniqueID,
  565. const AEDesc * dataList);
  566. /*
  567. Add record
  568. */
  569. /*
  570. * DCMAddRecord()
  571. *
  572. * Availability:
  573. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  574. * CarbonLib: in CarbonLib 1.0 and later
  575. * Mac OS X: in version 10.0 and later
  576. */
  577. EXTERN_API( OSStatus )
  578. DCMAddRecord(
  579. DCMDictionaryRef dictionaryRef,
  580. DCMFieldTag keyFieldTag,
  581. ByteCount keySize,
  582. ConstLogicalAddress keyData,
  583. Boolean checkOnly,
  584. const AEDesc * dataList,
  585. DCMUniqueID * newUniqueID);
  586. /*
  587. * DCMDeleteRecord()
  588. *
  589. * Availability:
  590. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  591. * CarbonLib: in CarbonLib 1.0 and later
  592. * Mac OS X: in version 10.0 and later
  593. */
  594. EXTERN_API( OSStatus )
  595. DCMDeleteRecord(
  596. DCMDictionaryRef dictionaryRef,
  597. DCMFieldTag keyFieldTag,
  598. ByteCount keySize,
  599. ConstLogicalAddress keyData,
  600. DCMUniqueID uniqueID);
  601. /*
  602. Reorganize/compact dictionary
  603. */
  604. /*
  605. * DCMReorganizeDictionary()
  606. *
  607. * Availability:
  608. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  609. * CarbonLib: in CarbonLib 1.0 and later
  610. * Mac OS X: in version 10.0 and later
  611. */
  612. EXTERN_API( OSStatus )
  613. DCMReorganizeDictionary(
  614. DCMDictionaryID dictionaryID,
  615. ItemCount extraCapacity,
  616. DCMProgressFilterUPP progressProc,
  617. UInt32 userData);
  618. /*
  619. * DCMCompactDictionary()
  620. *
  621. * Availability:
  622. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  623. * CarbonLib: in CarbonLib 1.0 and later
  624. * Mac OS X: in version 10.0 and later
  625. */
  626. EXTERN_API( OSStatus )
  627. DCMCompactDictionary(
  628. DCMDictionaryID dictionaryID,
  629. DCMProgressFilterUPP progressProc,
  630. UInt32 userData);
  631. /*
  632. DictionaryID utilities
  633. */
  634. /*
  635. * DCMGetFileFromDictionaryID()
  636. *
  637. * Availability:
  638. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  639. * CarbonLib: in CarbonLib 1.0 and later
  640. * Mac OS X: in version 10.0 and later
  641. */
  642. EXTERN_API( OSStatus )
  643. DCMGetFileFromDictionaryID(
  644. DCMDictionaryID dictionaryID,
  645. FSSpec * fileRef);
  646. /*
  647. * DCMGetDictionaryIDFromFile()
  648. *
  649. * Availability:
  650. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  651. * CarbonLib: in CarbonLib 1.0 and later
  652. * Mac OS X: in version 10.0 and later
  653. */
  654. EXTERN_API( OSStatus )
  655. DCMGetDictionaryIDFromFile(
  656. const FSSpec * fileRef,
  657. DCMDictionaryID * dictionaryID);
  658. /*
  659. * DCMGetDictionaryIDFromRef()
  660. *
  661. * Availability:
  662. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  663. * CarbonLib: in CarbonLib 1.0 and later
  664. * Mac OS X: in version 10.0 and later
  665. */
  666. EXTERN_API( DCMDictionaryID )
  667. DCMGetDictionaryIDFromRef(DCMDictionaryRef dictionaryRef);
  668. /*
  669. Field information and manipulation
  670. */
  671. /*
  672. * DCMGetDictionaryFieldInfo()
  673. *
  674. * Availability:
  675. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  676. * CarbonLib: in CarbonLib 1.0 and later
  677. * Mac OS X: in version 10.0 and later
  678. */
  679. EXTERN_API( OSStatus )
  680. DCMGetDictionaryFieldInfo(
  681. DCMDictionaryID dictionaryID,
  682. DCMFieldTag fieldTag,
  683. AEDesc * fieldInfoRecord);
  684. /*
  685. Dictionary property
  686. */
  687. /*
  688. * DCMGetDictionaryProperty()
  689. *
  690. * Availability:
  691. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  692. * CarbonLib: in CarbonLib 1.0 and later
  693. * Mac OS X: in version 10.0 and later
  694. */
  695. EXTERN_API( OSStatus )
  696. DCMGetDictionaryProperty(
  697. DCMDictionaryID dictionaryID,
  698. DCMFieldTag propertyTag,
  699. ByteCount maxPropertySize,
  700. ByteCount * actualSize,
  701. LogicalAddress propertyValue);
  702. /*
  703. * DCMSetDictionaryProperty()
  704. *
  705. * Availability:
  706. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  707. * CarbonLib: in CarbonLib 1.0 and later
  708. * Mac OS X: in version 10.0 and later
  709. */
  710. EXTERN_API( OSStatus )
  711. DCMSetDictionaryProperty(
  712. DCMDictionaryID dictionaryID,
  713. DCMFieldTag propertyTag,
  714. ByteCount propertySize,
  715. ConstLogicalAddress propertyValue);
  716. /*
  717. * DCMGetDictionaryPropertyList()
  718. *
  719. * Availability:
  720. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  721. * CarbonLib: in CarbonLib 1.0 and later
  722. * Mac OS X: in version 10.0 and later
  723. */
  724. EXTERN_API( OSStatus )
  725. DCMGetDictionaryPropertyList(
  726. DCMDictionaryID dictionaryID,
  727. ItemCount maxPropertyNum,
  728. ItemCount * numProperties,
  729. DCMFieldTag propertyTag[]);
  730. /*
  731. Seaarch dictionary
  732. */
  733. /*
  734. * DCMCreateDictionaryIterator()
  735. *
  736. * Availability:
  737. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  738. * CarbonLib: in CarbonLib 1.0 and later
  739. * Mac OS X: in version 10.0 and later
  740. */
  741. EXTERN_API( OSStatus )
  742. DCMCreateDictionaryIterator(DCMDictionaryIterator * dictionaryIterator);
  743. /*
  744. Search AccessMethod
  745. */
  746. /*
  747. * DCMCreateAccessMethodIterator()
  748. *
  749. * Availability:
  750. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  751. * CarbonLib: in CarbonLib 1.0 and later
  752. * Mac OS X: in version 10.0 and later
  753. */
  754. EXTERN_API( OSStatus )
  755. DCMCreateAccessMethodIterator(DCMAccessMethodIterator * accessMethodIterator);
  756. /*
  757. Iterator Operation
  758. */
  759. /*
  760. * DCMCountObjectIterator()
  761. *
  762. * Availability:
  763. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  764. * CarbonLib: in CarbonLib 1.0 and later
  765. * Mac OS X: in version 10.0 and later
  766. */
  767. EXTERN_API( ItemCount )
  768. DCMCountObjectIterator(DCMObjectIterator iterator);
  769. /*
  770. * DCMIterateObject()
  771. *
  772. * Availability:
  773. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  774. * CarbonLib: in CarbonLib 1.0 and later
  775. * Mac OS X: in version 10.0 and later
  776. */
  777. EXTERN_API( OSStatus )
  778. DCMIterateObject(
  779. DCMObjectIterator iterator,
  780. DCMObjectID * objectID);
  781. /*
  782. * DCMResetObjectIterator()
  783. *
  784. * Availability:
  785. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  786. * CarbonLib: in CarbonLib 1.0 and later
  787. * Mac OS X: in version 10.0 and later
  788. */
  789. EXTERN_API( OSStatus )
  790. DCMResetObjectIterator(DCMObjectIterator iterator);
  791. /*
  792. * DCMDisposeObjectIterator()
  793. *
  794. * Availability:
  795. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  796. * CarbonLib: in CarbonLib 1.0 and later
  797. * Mac OS X: in version 10.0 and later
  798. */
  799. EXTERN_API( OSStatus )
  800. DCMDisposeObjectIterator(DCMObjectIterator iterator);
  801. /*
  802. Get AccessMethod information
  803. */
  804. /*
  805. * DCMGetAccessMethodIDFromName()
  806. *
  807. * Availability:
  808. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  809. * CarbonLib: in CarbonLib 1.0 and later
  810. * Mac OS X: in version 10.0 and later
  811. */
  812. EXTERN_API( OSStatus )
  813. DCMGetAccessMethodIDFromName(
  814. ConstStr63Param accessMethodName,
  815. DCMAccessMethodID * accessMethodID);
  816. /*
  817. Field Info Record routines
  818. */
  819. /*
  820. * DCMCreateFieldInfoRecord()
  821. *
  822. * Availability:
  823. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  824. * CarbonLib: in CarbonLib 1.0 and later
  825. * Mac OS X: in version 10.0 and later
  826. */
  827. EXTERN_API( OSStatus )
  828. DCMCreateFieldInfoRecord(
  829. DescType fieldTag,
  830. DescType fieldType,
  831. ByteCount maxRecordSize,
  832. DCMFieldAttributes fieldAttributes,
  833. AEDesc * fieldDefaultData,
  834. ItemCount numberOfFindMethods,
  835. DCMFindMethod findMethods[],
  836. AEDesc * fieldInfoRecord);
  837. /*
  838. * DCMGetFieldTagAndType()
  839. *
  840. * Availability:
  841. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  842. * CarbonLib: in CarbonLib 1.0 and later
  843. * Mac OS X: in version 10.0 and later
  844. */
  845. EXTERN_API( OSStatus )
  846. DCMGetFieldTagAndType(
  847. const AEDesc * fieldInfoRecord,
  848. DCMFieldTag * fieldTag,
  849. DCMFieldType * fieldType);
  850. /*
  851. * DCMGetFieldMaxRecordSize()
  852. *
  853. * Availability:
  854. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  855. * CarbonLib: in CarbonLib 1.0 and later
  856. * Mac OS X: in version 10.0 and later
  857. */
  858. EXTERN_API( OSStatus )
  859. DCMGetFieldMaxRecordSize(
  860. const AEDesc * fieldInfoRecord,
  861. ByteCount * maxRecordSize);
  862. /*
  863. * DCMGetFieldAttributes()
  864. *
  865. * Availability:
  866. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  867. * CarbonLib: in CarbonLib 1.0 and later
  868. * Mac OS X: in version 10.0 and later
  869. */
  870. EXTERN_API( OSStatus )
  871. DCMGetFieldAttributes(
  872. const AEDesc * fieldInfoRecord,
  873. DCMFieldAttributes * attributes);
  874. /*
  875. * DCMGetFieldDefaultData()
  876. *
  877. * Availability:
  878. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  879. * CarbonLib: in CarbonLib 1.0 and later
  880. * Mac OS X: in version 10.0 and later
  881. */
  882. EXTERN_API( OSStatus )
  883. DCMGetFieldDefaultData(
  884. const AEDesc * fieldInfoRecord,
  885. DescType desiredType,
  886. AEDesc * fieldDefaultData);
  887. /*
  888. * DCMGetFieldFindMethods()
  889. *
  890. * Availability:
  891. * Non-Carbon CFM: in DictionaryMgrLib 1.0 and later
  892. * CarbonLib: in CarbonLib 1.0 and later
  893. * Mac OS X: in version 10.0 and later
  894. */
  895. EXTERN_API( OSStatus )
  896. DCMGetFieldFindMethods(
  897. const AEDesc * fieldInfoRecord,
  898. ItemCount findMethodsArrayMaxSize,
  899. DCMFindMethod findMethods[],
  900. ItemCount * actualNumberOfFindMethods);
  901. /*
  902. Check Dictionary Manager availability
  903. */
  904. #if TARGET_RT_MAC_CFM
  905. #ifdef __cplusplus
  906. inline pascal Boolean DCMDictionaryManagerAvailable() { return (DCMLibraryVersion != (void*)kUnresolvedCFragSymbolAddress); }
  907. #else
  908. #define DCMDictionaryManagerAvailable() ((DCMLibraryVersion != (void*)kUnresolvedCFragSymbolAddress)
  909. #endif
  910. #elif TARGET_RT_MAC_MACHO
  911. /* Dictionary Manager is always available on OS X */
  912. #ifdef __cplusplus
  913. inline pascal Boolean DCMDictionaryManagerAvailable() { return true; }
  914. #else
  915. #define DCMDictionaryManagerAvailable() (true)
  916. #endif
  917. #endif /* */
  918. /*
  919. =============================================================================================
  920. Definitions for Japanese Analysis Module
  921. =============================================================================================
  922. */
  923. /*
  924. Default dictionary access method for Japanese analysis
  925. */
  926. #define kAppleJapaneseDefaultAccessMethodName "\pDAM:Apple Backward Trie Access Method"
  927. /*
  928. Data length limitations of Apple Japanese dictionaries
  929. */
  930. enum {
  931. kMaxYomiLengthInAppleJapaneseDictionary = 40,
  932. kMaxKanjiLengthInAppleJapaneseDictionary = 64
  933. };
  934. /*
  935. Defined field tags of Apple Japanese dictionary
  936. */
  937. enum {
  938. kDCMJapaneseYomiTag = FOUR_CHAR_CODE('yomi'),
  939. kDCMJapaneseHyokiTag = FOUR_CHAR_CODE('hyok'),
  940. kDCMJapaneseHinshiTag = FOUR_CHAR_CODE('hins'),
  941. kDCMJapaneseWeightTag = FOUR_CHAR_CODE('hind'),
  942. kDCMJapanesePhoneticTag = FOUR_CHAR_CODE('hton'),
  943. kDCMJapaneseAccentTag = FOUR_CHAR_CODE('acnt'),
  944. kDCMJapaneseOnKunReadingTag = FOUR_CHAR_CODE('OnKn'),
  945. kDCMJapaneseFukugouInfoTag = FOUR_CHAR_CODE('fuku')
  946. };
  947. enum {
  948. kDCMJapaneseYomiType = typeUnicodeText,
  949. kDCMJapaneseHyokiType = typeUnicodeText,
  950. kDCMJapaneseHinshiType = FOUR_CHAR_CODE('hins'),
  951. kDCMJapaneseWeightType = typeShortInteger,
  952. kDCMJapanesePhoneticType = typeUnicodeText,
  953. kDCMJapaneseAccentType = FOUR_CHAR_CODE('byte'),
  954. kDCMJapaneseOnKunReadingType = typeUnicodeText,
  955. kDCMJapaneseFukugouInfoType = FOUR_CHAR_CODE('fuku')
  956. };
  957. /*
  958. =============================================================================================
  959. System 7 Dictionary Manager
  960. =============================================================================================
  961. */
  962. #if PRAGMA_STRUCT_ALIGN
  963. #pragma options align=reset
  964. #pragma options align=mac68k
  965. #endif
  966. enum {
  967. /* Dictionary data insertion modes */
  968. kInsert = 0, /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  969. kReplace = 1, /* Only replace the entries which match the key with the input entry. */
  970. 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. */
  971. };
  972. /* This Was InsertMode */
  973. typedef short DictionaryDataInsertMode;
  974. enum {
  975. /* Key attribute constants */
  976. kIsCaseSensitive = 0x10, /* case sensitive = 16 */
  977. kIsNotDiacriticalSensitive = 0x20 /* diac not sensitive = 32 */
  978. };
  979. enum {
  980. /* Registered attribute type constants. */
  981. kNoun = -1,
  982. kVerb = -2,
  983. kAdjective = -3,
  984. kAdverb = -4
  985. };
  986. /* This Was AttributeType */
  987. typedef SInt8 DictionaryEntryAttribute;
  988. /* Dictionary information record */
  989. struct DictionaryInformation {
  990. FSSpec dictionaryFSSpec;
  991. SInt32 numberOfRecords;
  992. SInt32 currentGarbageSize;
  993. ScriptCode script;
  994. SInt16 maximumKeyLength;
  995. SInt8 keyAttributes;
  996. };
  997. typedef struct DictionaryInformation DictionaryInformation;
  998. struct DictionaryAttributeTable {
  999. UInt8 datSize;
  1000. DictionaryEntryAttribute datTable[1];
  1001. };
  1002. typedef struct DictionaryAttributeTable DictionaryAttributeTable;
  1003. typedef DictionaryAttributeTable * DictionaryAttributeTablePtr;
  1004. #if CALL_NOT_IN_CARBON
  1005. /*
  1006. * InitializeDictionary()
  1007. *
  1008. * Availability:
  1009. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1010. * CarbonLib: not available
  1011. * Mac OS X: not available
  1012. */
  1013. EXTERN_API( OSErr )
  1014. InitializeDictionary(
  1015. const FSSpec * theFsspecPtr,
  1016. SInt16 maximumKeyLength,
  1017. SInt8 keyAttributes,
  1018. ScriptCode script) THREEWORDINLINE(0x303C, 0x0500, 0xAA53);
  1019. /*
  1020. * OpenDictionary()
  1021. *
  1022. * Availability:
  1023. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1024. * CarbonLib: not available
  1025. * Mac OS X: not available
  1026. */
  1027. EXTERN_API( OSErr )
  1028. OpenDictionary(
  1029. const FSSpec * theFsspecPtr,
  1030. SInt8 accessPermission,
  1031. SInt32 * dictionaryReference) THREEWORDINLINE(0x303C, 0x0501, 0xAA53);
  1032. /*
  1033. * CloseDictionary()
  1034. *
  1035. * Availability:
  1036. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1037. * CarbonLib: not available
  1038. * Mac OS X: not available
  1039. */
  1040. EXTERN_API( OSErr )
  1041. CloseDictionary(SInt32 dictionaryReference) THREEWORDINLINE(0x303C, 0x0202, 0xAA53);
  1042. /*
  1043. * InsertRecordToDictionary()
  1044. *
  1045. * Availability:
  1046. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1047. * CarbonLib: not available
  1048. * Mac OS X: not available
  1049. */
  1050. EXTERN_API( OSErr )
  1051. InsertRecordToDictionary(
  1052. SInt32 dictionaryReference,
  1053. ConstStr255Param key,
  1054. Handle recordDataHandle,
  1055. DictionaryDataInsertMode whichMode) THREEWORDINLINE(0x303C, 0x0703, 0xAA53);
  1056. /*
  1057. * DeleteRecordFromDictionary()
  1058. *
  1059. * Availability:
  1060. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1061. * CarbonLib: not available
  1062. * Mac OS X: not available
  1063. */
  1064. EXTERN_API( OSErr )
  1065. DeleteRecordFromDictionary(
  1066. SInt32 dictionaryReference,
  1067. ConstStr255Param key) THREEWORDINLINE(0x303C, 0x0404, 0xAA53);
  1068. /*
  1069. * FindRecordInDictionary()
  1070. *
  1071. * Availability:
  1072. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1073. * CarbonLib: not available
  1074. * Mac OS X: not available
  1075. */
  1076. EXTERN_API( OSErr )
  1077. FindRecordInDictionary(
  1078. SInt32 dictionaryReference,
  1079. ConstStr255Param key,
  1080. DictionaryAttributeTablePtr requestedAttributeTablePointer,
  1081. Handle recordDataHandle) THREEWORDINLINE(0x303C, 0x0805, 0xAA53);
  1082. /*
  1083. * FindRecordByIndexInDictionary()
  1084. *
  1085. * Availability:
  1086. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1087. * CarbonLib: not available
  1088. * Mac OS X: not available
  1089. */
  1090. EXTERN_API( OSErr )
  1091. FindRecordByIndexInDictionary(
  1092. SInt32 dictionaryReference,
  1093. SInt32 recordIndex,
  1094. DictionaryAttributeTablePtr requestedAttributeTablePointer,
  1095. Str255 recordKey,
  1096. Handle recordDataHandle) THREEWORDINLINE(0x303C, 0x0A06, 0xAA53);
  1097. /*
  1098. * GetDictionaryInformation()
  1099. *
  1100. * Availability:
  1101. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1102. * CarbonLib: not available
  1103. * Mac OS X: not available
  1104. */
  1105. EXTERN_API( OSErr )
  1106. GetDictionaryInformation(
  1107. SInt32 dictionaryReference,
  1108. DictionaryInformation * theDictionaryInformation) THREEWORDINLINE(0x303C, 0x0407, 0xAA53);
  1109. /*
  1110. * CompactDictionary()
  1111. *
  1112. * Availability:
  1113. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1114. * CarbonLib: not available
  1115. * Mac OS X: not available
  1116. */
  1117. EXTERN_API( OSErr )
  1118. CompactDictionary(SInt32 dictionaryReference) THREEWORDINLINE(0x303C, 0x0208, 0xAA53);
  1119. #endif /* CALL_NOT_IN_CARBON */
  1120. #if PRAGMA_STRUCT_ALIGN
  1121. #pragma options align=reset
  1122. #elif PRAGMA_STRUCT_PACKPUSH
  1123. #pragma pack(pop)
  1124. #elif PRAGMA_STRUCT_PACK
  1125. #pragma pack()
  1126. #endif
  1127. #ifdef PRAGMA_IMPORT_OFF
  1128. #pragma import off
  1129. #elif PRAGMA_IMPORT
  1130. #pragma import reset
  1131. #endif
  1132. #ifdef __cplusplus
  1133. }
  1134. #endif
  1135. #endif /* __DICTIONARY__ */