Dictionary.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:29k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Dictionary.h
  3.  
  4.      Contains:   Dictionary Manager Interfaces
  5.  
  6.      Version:    Technology: System 7
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1992-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DICTIONARY__
  18. #define __DICTIONARY__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __FILES__
  23. #include "Files.h"
  24. #endif
  25. #ifndef __AEREGISTRY__
  26. #include "AERegistry.h"
  27. #endif
  28. #ifndef __CODEFRAGMENTS__
  29. #include "CodeFragments.h"
  30. #endif
  31. #ifndef __MACERRORS__
  32. #include "MacErrors.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=power
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. /*
  51. =============================================================================================
  52.  Modern Dictionary Manager
  53. =============================================================================================
  54. */
  55. /*
  56.     Dictionary information
  57. */
  58. enum {
  59.     kDictionaryFileType         = FOUR_CHAR_CODE('dict'),
  60.     kDCMDictionaryHeaderSignature = FOUR_CHAR_CODE('dict'),
  61.     kDCMDictionaryHeaderVersion = 2
  62. };
  63. enum {
  64.     kDCMAnyFieldTag             = typeWildCard,
  65.     kDCMAnyFieldType            = typeWildCard
  66. };
  67. /*
  68.     Contents of a Field Info Record (an AERecord)
  69. */
  70. enum {
  71.     keyDCMFieldTag              = FOUR_CHAR_CODE('ftag'),       /* typeEnumeration */
  72.     keyDCMFieldType             = FOUR_CHAR_CODE('ftyp'),       /* typeEnumeration */
  73.     keyDCMMaxRecordSize         = FOUR_CHAR_CODE('mrsz'),       /* typeMagnitude */
  74.     keyDCMFieldAttributes       = FOUR_CHAR_CODE('fatr'),
  75.     keyDCMFieldDefaultData      = FOUR_CHAR_CODE('fdef'),
  76.     keyDCMFieldName             = FOUR_CHAR_CODE('fnam'),       /* typeChar */
  77.     keyDCMFieldFindMethods      = FOUR_CHAR_CODE('ffnd')        /* typeAEList of typeDCMFindMethod */
  78. };
  79. /*
  80.     Special types for fields of a Field Info Record
  81. */
  82. enum {
  83.     typeDCMFieldAttributes      = FOUR_CHAR_CODE('fatr'),
  84.     typeDCMFindMethod           = FOUR_CHAR_CODE('fmth')
  85. };
  86. /*
  87.     Field attributes
  88. */
  89. enum {
  90.     kDCMIndexedFieldMask        = 0x00000001,
  91.     kDCMRequiredFieldMask       = 0x00000002,
  92.     kDCMIdentifyFieldMask       = 0x00000004,
  93.     kDCMFixedSizeFieldMask      = 0x00000008,
  94.     kDCMHiddenFieldMask         = (long)0x80000000
  95. };
  96. typedef OptionBits                      DCMFieldAttributes;
  97. /*
  98.     Standard dictionary properties
  99. */
  100. enum {
  101.     pDCMAccessMethod            = FOUR_CHAR_CODE('amtd'),       /* data type: typeChar ReadOnly */
  102.     pDCMPermission              = FOUR_CHAR_CODE('perm'),       /* data type: typeUInt16 */
  103.     pDCMListing                 = FOUR_CHAR_CODE('list'),       /* data type: typeUInt16 */
  104.     pDCMMaintenance             = FOUR_CHAR_CODE('mtnc'),       /* data type: typeUInt16 */
  105.     pDCMLocale                  = FOUR_CHAR_CODE('locl'),       /* data type: typeUInt32.  Optional; default = kLocaleIdentifierWildCard */
  106.     pDCMClass                   = pClass,                       /* data type: typeUInt16 */
  107.     pDCMCopyright               = FOUR_CHAR_CODE('info')        /* data type: typeChar */
  108. };
  109. /*
  110.     pDCMPermission property constants
  111. */
  112. enum {
  113.     kDCMReadOnlyDictionary      = 0,
  114.     kDCMReadWriteDictionary     = 1
  115. };
  116. /*
  117.     pDCMListing property constants
  118. */
  119. enum {
  120.     kDCMAllowListing            = 0,
  121.     kDCMProhibitListing         = 1
  122. };
  123. /*
  124.     pDCMClass property constants
  125. */
  126. enum {
  127.     kDCMUserDictionaryClass     = 0,
  128.     kDCMSpecificDictionaryClass = 1,
  129.     kDCMBasicDictionaryClass    = 2
  130. };
  131. /*
  132.     Standard search method
  133. */
  134. enum {
  135.     kDCMFindMethodExactMatch    = kAEEquals,
  136.     kDCMFindMethodBeginningMatch = kAEBeginsWith,
  137.     kDCMFindMethodContainsMatch = kAEContains,
  138.     kDCMFindMethodEndingMatch   = kAEEndsWith,
  139.     kDCMFindMethodForwardTrie   = FOUR_CHAR_CODE('ftri'),       /* used for morphological analysis*/
  140.     kDCMFindMethodBackwardTrie  = FOUR_CHAR_CODE('btri')        /* used for morphological analysis*/
  141. };
  142. typedef OSType                          DCMFindMethod;
  143. /*
  144.     AccessMethod features
  145. */
  146. enum {
  147.     kDCMCanUseFileDictionaryMask = 0x00000001,
  148.     kDCMCanUseMemoryDictionaryMask = 0x00000002,
  149.     kDCMCanStreamDictionaryMask = 0x00000004,
  150.     kDCMCanHaveMultipleIndexMask = 0x00000008,
  151.     kDCMCanModifyDictionaryMask = 0x00000010,
  152.     kDCMCanCreateDictionaryMask = 0x00000020,
  153.     kDCMCanAddDictionaryFieldMask = 0x00000040,
  154.     kDCMCanUseTransactionMask   = 0x00000080
  155. };
  156. typedef OptionBits                      DCMAccessMethodFeature;
  157. typedef UInt32                          DCMUniqueID;
  158. typedef struct OpaqueDCMObjectID*       DCMObjectID;
  159. typedef DCMObjectID                     DCMAccessMethodID;
  160. typedef DCMObjectID                     DCMDictionaryID;
  161. #define kDCMInvalidObjectID ((DCMObjectID) kInvalidID)
  162. typedef struct OpaqueDCMObjectRef*      DCMObjectRef;
  163. typedef DCMObjectRef                    DCMDictionaryRef;
  164. typedef DCMObjectRef                    DCMDictionaryStreamRef;
  165. #define kDCMInvalidObjectRef ((DCMObjectRef) kInvalidID)
  166. typedef struct OpaqueDCMObjectIterator*  DCMObjectIterator;
  167. typedef DCMObjectIterator               DCMAccessMethodIterator;
  168. typedef DCMObjectIterator               DCMDictionaryIterator;
  169. typedef struct OpaqueDCMFoundRecordIterator*  DCMFoundRecordIterator;
  170. /*
  171.     Field specification declarations
  172. */
  173. typedef DescType                        DCMFieldTag;
  174. typedef DescType                        DCMFieldType;
  175. /*
  176.     Dictionary header information
  177. */
  178. struct DCMDictionaryHeader {
  179.     FourCharCode                    headerSignature;
  180.     UInt32                          headerVersion;
  181.     ByteCount                       headerSize;
  182.     Str63                           accessMethod;
  183. };
  184. typedef struct DCMDictionaryHeader      DCMDictionaryHeader;
  185. /*
  186.     Callback routines
  187. */
  188. typedef CALLBACK_API( Boolean , DCMProgressFilterProcPtr )(Boolean determinateProcess, UInt16 percentageComplete, UInt32 callbackUD);
  189. typedef STACK_UPP_TYPE(DCMProgressFilterProcPtr)                DCMProgressFilterUPP;
  190. #if OPAQUE_UPP_TYPES
  191. #if CALL_NOT_IN_CARBON
  192.     EXTERN_API(DCMProgressFilterUPP)
  193.     NewDCMProgressFilterUPP        (DCMProgressFilterProcPtr userRoutine);
  194.     EXTERN_API(void)
  195.     DisposeDCMProgressFilterUPP    (DCMProgressFilterUPP    userUPP);
  196.     EXTERN_API(Boolean)
  197.     InvokeDCMProgressFilterUPP     (Boolean                 determinateProcess,
  198.                                     UInt16                  percentageComplete,
  199.                                     UInt32                  callbackUD,
  200.                                     DCMProgressFilterUPP    userUPP);
  201. #endif  /* CALL_NOT_IN_CARBON */
  202. #else
  203.     enum { uppDCMProgressFilterProcInfo = 0x00000E50 };             /* pascal 1_byte Func(1_byte, 2_bytes, 4_bytes) */
  204.     #define NewDCMProgressFilterUPP(userRoutine)                    (DCMProgressFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDCMProgressFilterProcInfo, GetCurrentArchitecture())
  205.     #define DisposeDCMProgressFilterUPP(userUPP)                    DisposeRoutineDescriptor(userUPP)
  206.     #define InvokeDCMProgressFilterUPP(determinateProcess, percentageComplete, callbackUD, userUPP)  (Boolean)CALL_THREE_PARAMETER_UPP((userUPP), uppDCMProgressFilterProcInfo, (determinateProcess), (percentageComplete), (callbackUD))
  207. #endif
  208. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  209. #define NewDCMProgressFilterProc(userRoutine)                   NewDCMProgressFilterUPP(userRoutine)
  210. #define CallDCMProgressFilterProc(userRoutine, determinateProcess, percentageComplete, callbackUD) InvokeDCMProgressFilterUPP(determinateProcess, percentageComplete, callbackUD, userRoutine)
  211. /*
  212.     Library version
  213. */
  214. EXTERN_API( UInt32 )
  215. DCMLibraryVersion               (void);
  216. /*
  217.     Create/delete dictionary
  218. */
  219. EXTERN_API( OSStatus )
  220. DCMNewDictionary                (DCMAccessMethodID      accessMethodID,
  221.                                  const FSSpec *         newDictionaryFile,
  222.                                  ScriptCode             scriptTag,
  223.                                  const AEDesc *         listOfFieldInfoRecords,
  224.                                  Boolean                invisible,
  225.                                  ItemCount              recordCapacity,
  226.                                  DCMDictionaryID *      newDictionary);
  227. EXTERN_API( OSStatus )
  228. DCMDeriveNewDictionary          (DCMDictionaryID        srcDictionary,
  229.                                  const FSSpec *         newDictionaryFile,
  230.                                  ScriptCode             scriptTag,
  231.                                  Boolean                invisible,
  232.                                  ItemCount              recordCapacity,
  233.                                  DCMDictionaryID *      newDictionary);
  234. EXTERN_API( OSStatus )
  235. DCMDeleteDictionary             (DCMDictionaryID        dictionaryID);
  236. /*
  237.     Register dictionary
  238. */
  239. EXTERN_API( OSStatus )
  240. DCMRegisterDictionaryFile       (const FSSpec *         dictionaryFile,
  241.                                  DCMDictionaryID *      dictionaryID);
  242. EXTERN_API( OSStatus )
  243. DCMUnregisterDictionary         (DCMDictionaryID        dictionaryID);
  244. /*
  245.     Open dictionary
  246. */
  247. EXTERN_API( OSStatus )
  248. DCMOpenDictionary               (DCMDictionaryID        dictionaryID,
  249.                                  ByteCount              protectKeySize,
  250.                                  ConstLogicalAddress    protectKey,
  251.                                  DCMDictionaryRef *     dictionaryRef);
  252. EXTERN_API( OSStatus )
  253. DCMCloseDictionary              (DCMDictionaryRef       dictionaryRef);
  254. /*
  255.     Change access privilege
  256. */
  257. EXTERN_API( OSStatus )
  258. DCMGetDictionaryWriteAccess     (DCMDictionaryRef       dictionaryRef,
  259.                                  Duration               timeOutDuration);
  260. EXTERN_API( OSStatus )
  261. DCMReleaseDictionaryWriteAccess (DCMDictionaryRef       dictionaryRef,
  262.                                  Boolean                commitTransaction);
  263. /*
  264.     Find records
  265. */
  266. EXTERN_API( OSStatus )
  267. DCMFindRecords                  (DCMDictionaryRef       dictionaryRef,
  268.                                  DCMFieldTag            keyFieldTag,
  269.                                  ByteCount              keySize,
  270.                                  ConstLogicalAddress    keyData,
  271.                                  DCMFindMethod          findMethod,
  272.                                  ItemCount              preFetchedDataNum,
  273.                                  DCMFieldTag            preFetchedData[],
  274.                                  ItemCount              skipCount,
  275.                                  ItemCount              maxRecordCount,
  276.                                  DCMFoundRecordIterator * recordIterator);
  277. EXTERN_API( ItemCount )
  278. DCMCountRecordIterator          (DCMFoundRecordIterator  recordIterator);
  279. EXTERN_API( OSStatus )
  280. DCMIterateFoundRecord           (DCMFoundRecordIterator  recordIterator,
  281.                                  ByteCount              maxKeySize,
  282.                                  ByteCount *            actualKeySize,
  283.                                  LogicalAddress         keyData,
  284.                                  DCMUniqueID *          uniqueID,
  285.                                  AEDesc *               dataList);
  286. EXTERN_API( OSStatus )
  287. DCMDisposeRecordIterator        (DCMFoundRecordIterator  recordIterator);
  288. /*
  289.     Dump dictionary
  290. */
  291. EXTERN_API( OSStatus )
  292. DCMCountRecord                  (DCMDictionaryID        dictionaryID,
  293.                                  ItemCount *            count);
  294. EXTERN_API( OSStatus )
  295. DCMGetRecordSequenceNumber      (DCMDictionaryRef       dictionaryRef,
  296.                                  DCMFieldTag            keyFieldTag,
  297.                                  ByteCount              keySize,
  298.                                  ConstLogicalAddress    keyData,
  299.                                  DCMUniqueID            uniqueID,
  300.                                  ItemCount *            sequenceNum);
  301. EXTERN_API( OSStatus )
  302. DCMGetNthRecord                 (DCMDictionaryRef       dictionaryRef,
  303.                                  DCMFieldTag            keyFieldTag,
  304.                                  ItemCount              serialNum,
  305.                                  ByteCount              maxKeySize,
  306.                                  ByteCount *            keySize,
  307.                                  LogicalAddress         keyData,
  308.                                  DCMUniqueID *          uniqueID);
  309. EXTERN_API( OSStatus )
  310. DCMGetNextRecord                (DCMDictionaryRef       dictionaryRef,
  311.                                  DCMFieldTag            keyFieldTag,
  312.                                  ByteCount              keySize,
  313.                                  ConstLogicalAddress    keyData,
  314.                                  DCMUniqueID            uniqueID,
  315.                                  ByteCount              maxKeySize,
  316.                                  ByteCount *            nextKeySize,
  317.                                  LogicalAddress         nextKeyData,
  318.                                  DCMUniqueID *          nextUniqueID);
  319. EXTERN_API( OSStatus )
  320. DCMGetPrevRecord                (DCMDictionaryRef       dictionaryRef,
  321.                                  DCMFieldTag            keyFieldTag,
  322.                                  ByteCount              keySize,
  323.                                  ConstLogicalAddress    keyData,
  324.                                  DCMUniqueID            uniqueID,
  325.                                  ByteCount              maxKeySize,
  326.                                  ByteCount *            prevKeySize,
  327.                                  LogicalAddress         prevKeyData,
  328.                                  DCMUniqueID *          prevUniqueID);
  329. /*
  330.     Get field data
  331. */
  332. EXTERN_API( OSStatus )
  333. DCMGetFieldData                 (DCMDictionaryRef       dictionaryRef,
  334.                                  DCMFieldTag            keyFieldTag,
  335.                                  ByteCount              keySize,
  336.                                  ConstLogicalAddress    keyData,
  337.                                  DCMUniqueID            uniqueID,
  338.                                  ItemCount              numOfData,
  339.                                  const DCMFieldTag      dataTag[],
  340.                                  AEDesc *               dataList);
  341. EXTERN_API( OSStatus )
  342. DCMSetFieldData                 (DCMDictionaryRef       dictionaryRef,
  343.                                  DCMFieldTag            keyFieldTag,
  344.                                  ByteCount              keySize,
  345.                                  ConstLogicalAddress    keyData,
  346.                                  DCMUniqueID            uniqueID,
  347.                                  const AEDesc *         dataList);
  348. /*
  349.     Add record
  350. */
  351. EXTERN_API( OSStatus )
  352. DCMAddRecord                    (DCMDictionaryRef       dictionaryRef,
  353.                                  DCMFieldTag            keyFieldTag,
  354.                                  ByteCount              keySize,
  355.                                  ConstLogicalAddress    keyData,
  356.                                  Boolean                checkOnly,
  357.                                  const AEDesc *         dataList,
  358.                                  DCMUniqueID *          newUniqueID);
  359. EXTERN_API( OSStatus )
  360. DCMDeleteRecord                 (DCMDictionaryRef       dictionaryRef,
  361.                                  DCMFieldTag            keyFieldTag,
  362.                                  ByteCount              keySize,
  363.                                  ConstLogicalAddress    keyData,
  364.                                  DCMUniqueID            uniqueID);
  365. /*
  366.     Reorganize/compact dictionary
  367. */
  368. EXTERN_API( OSStatus )
  369. DCMReorganizeDictionary         (DCMDictionaryID        dictionaryID,
  370.                                  ItemCount              extraCapacity,
  371.                                  DCMProgressFilterUPP   progressProc,
  372.                                  UInt32                 userData);
  373. EXTERN_API( OSStatus )
  374. DCMCompactDictionary            (DCMDictionaryID        dictionaryID,
  375.                                  DCMProgressFilterUPP   progressProc,
  376.                                  UInt32                 userData);
  377. /*
  378.     DictionaryID utilities
  379. */
  380. EXTERN_API( OSStatus )
  381. DCMGetFileFromDictionaryID      (DCMDictionaryID        dictionaryID,
  382.                                  FSSpec *               fileRef);
  383. EXTERN_API( OSStatus )
  384. DCMGetDictionaryIDFromFile      (const FSSpec *         fileRef,
  385.                                  DCMDictionaryID *      dictionaryID);
  386. EXTERN_API( DCMDictionaryID )
  387. DCMGetDictionaryIDFromRef       (DCMDictionaryRef       dictionaryRef);
  388. /*
  389.     Field information and manipulation
  390. */
  391. EXTERN_API( OSStatus )
  392. DCMGetDictionaryFieldInfo       (DCMDictionaryID        dictionaryID,
  393.                                  DCMFieldTag            fieldTag,
  394.                                  AEDesc *               fieldInfoRecord);
  395. /*
  396.     Dictionary property
  397. */
  398. EXTERN_API( OSStatus )
  399. DCMGetDictionaryProperty        (DCMDictionaryID        dictionaryID,
  400.                                  DCMFieldTag            propertyTag,
  401.                                  ByteCount              maxPropertySize,
  402.                                  ByteCount *            actualSize,
  403.                                  LogicalAddress         propertyValue);
  404. EXTERN_API( OSStatus )
  405. DCMSetDictionaryProperty        (DCMDictionaryID        dictionaryID,
  406.                                  DCMFieldTag            propertyTag,
  407.                                  ByteCount              propertySize,
  408.                                  ConstLogicalAddress    propertyValue);
  409. EXTERN_API( OSStatus )
  410. DCMGetDictionaryPropertyList    (DCMDictionaryID        dictionaryID,
  411.                                  ItemCount              maxPropertyNum,
  412.                                  ItemCount *            numProperties,
  413.                                  DCMFieldTag            propertyTag[]);
  414. /*
  415.     Seaarch dictionary
  416. */
  417. EXTERN_API( OSStatus )
  418. DCMCreateDictionaryIterator     (DCMDictionaryIterator * dictionaryIterator);
  419. /*
  420.     Search AccessMethod
  421. */
  422. EXTERN_API( OSStatus )
  423. DCMCreateAccessMethodIterator   (DCMAccessMethodIterator * accessMethodIterator);
  424. /*
  425.     Iterator Operation
  426. */
  427. EXTERN_API( ItemCount )
  428. DCMCountObjectIterator          (DCMObjectIterator      iterator);
  429. EXTERN_API( OSStatus )
  430. DCMIterateObject                (DCMObjectIterator      iterator,
  431.                                  DCMObjectID *          objectID);
  432. EXTERN_API( OSStatus )
  433. DCMResetObjectIterator          (DCMObjectIterator      iterator);
  434. EXTERN_API( OSStatus )
  435. DCMDisposeObjectIterator        (DCMObjectIterator      iterator);
  436. /*
  437.     Get AccessMethod information
  438. */
  439. EXTERN_API( OSStatus )
  440. DCMGetAccessMethodIDFromName    (ConstStr63Param        accessMethodName,
  441.                                  DCMAccessMethodID *    accessMethodID);
  442. /*
  443.     Field Info Record routines
  444. */
  445. EXTERN_API( OSStatus )
  446. DCMCreateFieldInfoRecord        (DescType               fieldTag,
  447.                                  DescType               fieldType,
  448.                                  ByteCount              maxRecordSize,
  449.                                  DCMFieldAttributes     fieldAttributes,
  450.                                  AEDesc *               fieldDefaultData,
  451.                                  ItemCount              numberOfFindMethods,
  452.                                  DCMFindMethod          findMethods[],
  453.                                  AEDesc *               fieldInfoRecord);
  454. EXTERN_API( OSStatus )
  455. DCMGetFieldTagAndType           (const AEDesc *         fieldInfoRecord,
  456.                                  DCMFieldTag *          fieldTag,
  457.                                  DCMFieldType *         fieldType);
  458. EXTERN_API( OSStatus )
  459. DCMGetFieldMaxRecordSize        (const AEDesc *         fieldInfoRecord,
  460.                                  ByteCount *            maxRecordSize);
  461. EXTERN_API( OSStatus )
  462. DCMGetFieldAttributes           (const AEDesc *         fieldInfoRecord,
  463.                                  DCMFieldAttributes *   attributes);
  464. EXTERN_API( OSStatus )
  465. DCMGetFieldDefaultData          (const AEDesc *         fieldInfoRecord,
  466.                                  DescType               desiredType,
  467.                                  AEDesc *               fieldDefaultData);
  468. EXTERN_API( OSStatus )
  469. DCMGetFieldFindMethods          (const AEDesc *         fieldInfoRecord,
  470.                                  ItemCount              findMethodsArrayMaxSize,
  471.                                  DCMFindMethod          findMethods[],
  472.                                  ItemCount *            actualNumberOfFindMethods);
  473. /*
  474.     Check Dictionary Manager availability
  475. */
  476. #if TARGET_RT_MAC_CFM
  477. #ifdef __cplusplus
  478.     inline pascal Boolean DCMDictionaryManagerAvailable() { return (DCMLibraryVersion != (void*)kUnresolvedCFragSymbolAddress); }
  479. #else
  480.     #define DCMDictionaryManagerAvailable()     ((DCMLibraryVersion != (void*)kUnresolvedCFragSymbolAddress)
  481. #endif
  482. #elif TARGET_RT_MAC_MACHO
  483. /* Dictionary Manager is always available on OS X */
  484. #ifdef __cplusplus
  485.     inline pascal Boolean DCMDictionaryManagerAvailable() { return true; }
  486. #else
  487.     #define DCMDictionaryManagerAvailable()     (true)
  488. #endif
  489. #endif  /*  */
  490. /*
  491. =============================================================================================
  492.     Definitions for Japanese Analysis Module
  493. =============================================================================================
  494. */
  495. /*
  496.     Default dictionary access method for Japanese analysis
  497. */
  498. #define kAppleJapaneseDefaultAccessMethodName   "pDAM:Apple Backward Trie Access Method"
  499. /*
  500.     Data length limitations of Apple Japanese dictionaries
  501. */
  502. enum {
  503.     kMaxYomiLengthInAppleJapaneseDictionary = 40,
  504.     kMaxKanjiLengthInAppleJapaneseDictionary = 64
  505. };
  506. /*
  507.     Defined field tags of Apple Japanese dictionary
  508. */
  509. enum {
  510.     kDCMJapaneseYomiTag         = FOUR_CHAR_CODE('yomi'),
  511.     kDCMJapaneseHyokiTag        = FOUR_CHAR_CODE('hyok'),
  512.     kDCMJapaneseHinshiTag       = FOUR_CHAR_CODE('hins'),
  513.     kDCMJapaneseWeightTag       = FOUR_CHAR_CODE('hind'),
  514.     kDCMJapanesePhoneticTag     = FOUR_CHAR_CODE('hton'),
  515.     kDCMJapaneseAccentTag       = FOUR_CHAR_CODE('acnt'),
  516.     kDCMJapaneseOnKunReadingTag = FOUR_CHAR_CODE('OnKn'),
  517.     kDCMJapaneseFukugouInfoTag  = FOUR_CHAR_CODE('fuku')
  518. };
  519. enum {
  520.     kDCMJapaneseYomiType        = typeUnicodeText,
  521.     kDCMJapaneseHyokiType       = typeUnicodeText,
  522.     kDCMJapaneseHinshiType      = FOUR_CHAR_CODE('hins'),
  523.     kDCMJapaneseWeightType      = typeShortInteger,
  524.     kDCMJapanesePhoneticType    = typeUnicodeText,
  525.     kDCMJapaneseAccentType      = FOUR_CHAR_CODE('byte'),
  526.     kDCMJapaneseOnKunReadingType = typeUnicodeText,
  527.     kDCMJapaneseFukugouInfoType = FOUR_CHAR_CODE('fuku')
  528. };
  529. /*
  530. =============================================================================================
  531.  System 7 Dictionary Manager
  532. =============================================================================================
  533. */
  534. #if PRAGMA_STRUCT_ALIGN
  535. #pragma options align=reset
  536. #pragma options align=mac68k
  537. #endif
  538. enum {
  539.                                                                 /* Dictionary data insertion modes */
  540.     kInsert                     = 0,                            /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  541.     kReplace                    = 1,                            /* Only replace the entries which match the key with the input entry. */
  542.     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. */
  543. };
  544. /* This Was InsertMode */
  545. typedef short                           DictionaryDataInsertMode;
  546. enum {
  547.                                                                 /* Key attribute constants */
  548.     kIsCaseSensitive            = 0x10,                         /* case sensitive = 16       */
  549.     kIsNotDiacriticalSensitive  = 0x20                          /* diac not sensitive = 32    */
  550. };
  551. enum {
  552.                                                                 /* Registered attribute type constants.   */
  553.     kNoun                       = -1,
  554.     kVerb                       = -2,
  555.     kAdjective                  = -3,
  556.     kAdverb                     = -4
  557. };
  558. /* This Was AttributeType */
  559. typedef SInt8                           DictionaryEntryAttribute;
  560. /* Dictionary information record */
  561. struct DictionaryInformation {
  562.     FSSpec                          dictionaryFSSpec;
  563.     SInt32                          numberOfRecords;
  564.     SInt32                          currentGarbageSize;
  565.     ScriptCode                      script;
  566.     SInt16                          maximumKeyLength;
  567.     SInt8                           keyAttributes;
  568. };
  569. typedef struct DictionaryInformation    DictionaryInformation;
  570. struct DictionaryAttributeTable {
  571.     UInt8                           datSize;
  572.     DictionaryEntryAttribute        datTable[1];
  573. };
  574. typedef struct DictionaryAttributeTable DictionaryAttributeTable;
  575. typedef DictionaryAttributeTable *      DictionaryAttributeTablePtr;
  576. #if CALL_NOT_IN_CARBON
  577. EXTERN_API( OSErr )
  578. InitializeDictionary            (const FSSpec *         theFsspecPtr,
  579.                                  SInt16                 maximumKeyLength,
  580.                                  SInt8                  keyAttributes,
  581.                                  ScriptCode             script)                             THREEWORDINLINE(0x303C, 0x0500, 0xAA53);
  582. EXTERN_API( OSErr )
  583. OpenDictionary                  (const FSSpec *         theFsspecPtr,
  584.                                  SInt8                  accessPermission,
  585.                                  SInt32 *               dictionaryReference)                THREEWORDINLINE(0x303C, 0x0501, 0xAA53);
  586. EXTERN_API( OSErr )
  587. CloseDictionary                 (SInt32                 dictionaryReference)                THREEWORDINLINE(0x303C, 0x0202, 0xAA53);
  588. EXTERN_API( OSErr )
  589. InsertRecordToDictionary        (SInt32                 dictionaryReference,
  590.                                  ConstStr255Param       key,
  591.                                  Handle                 recordDataHandle,
  592.                                  DictionaryDataInsertMode  whichMode)                       THREEWORDINLINE(0x303C, 0x0703, 0xAA53);
  593. EXTERN_API( OSErr )
  594. DeleteRecordFromDictionary      (SInt32                 dictionaryReference,
  595.                                  ConstStr255Param       key)                                THREEWORDINLINE(0x303C, 0x0404, 0xAA53);
  596. EXTERN_API( OSErr )
  597. FindRecordInDictionary          (SInt32                 dictionaryReference,
  598.                                  ConstStr255Param       key,
  599.                                  DictionaryAttributeTablePtr  requestedAttributeTablePointer,
  600.                                  Handle                 recordDataHandle)                   THREEWORDINLINE(0x303C, 0x0805, 0xAA53);
  601. EXTERN_API( OSErr )
  602. FindRecordByIndexInDictionary   (SInt32                 dictionaryReference,
  603.                                  SInt32                 recordIndex,
  604.                                  DictionaryAttributeTablePtr  requestedAttributeTablePointer,
  605.                                  Str255                 recordKey,
  606.                                  Handle                 recordDataHandle)                   THREEWORDINLINE(0x303C, 0x0A06, 0xAA53);
  607. EXTERN_API( OSErr )
  608. GetDictionaryInformation        (SInt32                 dictionaryReference,
  609.                                  DictionaryInformation * theDictionaryInformation)          THREEWORDINLINE(0x303C, 0x0407, 0xAA53);
  610. EXTERN_API( OSErr )
  611. CompactDictionary               (SInt32                 dictionaryReference)                THREEWORDINLINE(0x303C, 0x0208, 0xAA53);
  612. #endif  /* CALL_NOT_IN_CARBON */
  613. #if PRAGMA_STRUCT_ALIGN
  614.     #pragma options align=reset
  615. #elif PRAGMA_STRUCT_PACKPUSH
  616.     #pragma pack(pop)
  617. #elif PRAGMA_STRUCT_PACK
  618.     #pragma pack()
  619. #endif
  620. #ifdef PRAGMA_IMPORT_OFF
  621. #pragma import off
  622. #elif PRAGMA_IMPORT
  623. #pragma import reset
  624. #endif
  625. #ifdef __cplusplus
  626. }
  627. #endif
  628. #endif /* __DICTIONARY__ */