home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Dictionary.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  4.1 KB  |  142 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Dictionary.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Dictionary;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __DICTIONARY__}
  27. {$SETC __DICTIONARY__ := 1}
  28.  
  29. {$I+}
  30. {$SETC DictionaryIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __FILES__}
  40. {$I Files.p}
  41. {$ENDC}
  42. {    MixedMode.p                                                    }
  43. {    OSUtils.p                                                    }
  44. {        Memory.p                                                }
  45.  
  46. {$PUSH}
  47. {$ALIGN MAC68K}
  48. {$LibExport+}
  49.  
  50. CONST
  51. { Dictionary data insertion modes }
  52.     kInsert                        = 0;                            { Only insert the input entry if there is nothing in the dictionary that matches the key. }
  53.     kReplace                    = 1;                            { Only replace the entries which match the key with the input entry. }
  54.     kInsertOrReplace            = 2;                            { Insert the entry if there is nothing in the dictionary which matches the key. 
  55.                            If there is already matched entries, replace the existing matched entries with the input entry. }
  56.  
  57. { This Was InsertMode }
  58.     
  59. TYPE
  60.     DictionaryDataInsertMode = INTEGER;
  61.  
  62.  
  63. CONST
  64. { Key attribute constants }
  65.     kIsCaseSensitive            = $10;                            { case sensitive = 16        }
  66.     kIsNotDiacriticalSensitive    = $20;                            { diac not sensitive = 32    }
  67.  
  68. { Registered attribute type constants.    }
  69.     kNoun                        = -1;
  70.     kVerb                        = -2;
  71.     kAdjective                    = -3;
  72.     kAdverb                        = -4;
  73.  
  74. { This Was AttributeType }
  75.     
  76. TYPE
  77.     DictionaryEntryAttribute = SInt8;
  78.  
  79. { Dictionary information record }
  80.     DictionaryInformation = RECORD
  81.         dictionaryFSSpec:        FSSpec;
  82.         numberOfRecords:        LONGINT;
  83.         currentGarbageSize:        LONGINT;
  84.         script:                    ScriptCode;
  85.         maximumKeyLength:        INTEGER;
  86.         keyAttributes:            SInt8;
  87.     END;
  88.     DictionaryAttributeTable = PACKED RECORD
  89.         datSize:                UInt8;
  90.         datTable:                PACKED ARRAY [0..0] OF DictionaryEntryAttribute;
  91.     END;
  92.     DictionaryAttributeTablePtr = ^DictionaryAttributeTable;
  93.  
  94.  
  95. FUNCTION InitializeDictionary({CONST}VAR theFsspecPtr: FSSpec; maximumKeyLength: INTEGER; keyAttributes: ByteParameter; script: ScriptCode): OSErr;
  96.     {$IFC NOT GENERATINGCFM}
  97.     INLINE $303C, $0500, $AA53;
  98.     {$ENDC}
  99. FUNCTION OpenDictionary({CONST}VAR theFsspecPtr: FSSpec; accessPermission: ByteParameter; VAR dictionaryReference: LONGINT): OSErr;
  100.     {$IFC NOT GENERATINGCFM}
  101.     INLINE $303C, $0501, $AA53;
  102.     {$ENDC}
  103. FUNCTION CloseDictionary(dictionaryReference: LONGINT): OSErr;
  104.     {$IFC NOT GENERATINGCFM}
  105.     INLINE $303C, $0202, $AA53;
  106.     {$ENDC}
  107. FUNCTION InsertRecordToDictionary(dictionaryReference: LONGINT; key: ConstStr255Param; recordDataHandle: Handle; whichMode: DictionaryDataInsertMode): OSErr;
  108.     {$IFC NOT GENERATINGCFM}
  109.     INLINE $303C, $0703, $AA53;
  110.     {$ENDC}
  111. FUNCTION DeleteRecordFromDictionary(dictionaryReference: LONGINT; key: ConstStr255Param): OSErr;
  112.     {$IFC NOT GENERATINGCFM}
  113.     INLINE $303C, $0404, $AA53;
  114.     {$ENDC}
  115. FUNCTION FindRecordInDictionary(dictionaryReference: LONGINT; key: ConstStr255Param; requestedAttributeTablePointer: DictionaryAttributeTablePtr; recordDataHandle: Handle): OSErr;
  116.     {$IFC NOT GENERATINGCFM}
  117.     INLINE $303C, $0805, $AA53;
  118.     {$ENDC}
  119. FUNCTION FindRecordByIndexInDictionary(dictionaryReference: LONGINT; recordIndex: LONGINT; requestedAttributeTablePointer: DictionaryAttributeTablePtr; VAR recordKey: Str255; recordDataHandle: Handle): OSErr;
  120.     {$IFC NOT GENERATINGCFM}
  121.     INLINE $303C, $0A06, $AA53;
  122.     {$ENDC}
  123. FUNCTION GetDictionaryInformation(dictionaryReference: LONGINT; VAR theDictionaryInformation: DictionaryInformation): OSErr;
  124.     {$IFC NOT GENERATINGCFM}
  125.     INLINE $303C, $0407, $AA53;
  126.     {$ENDC}
  127. FUNCTION CompactDictionary(dictionaryReference: LONGINT): OSErr;
  128.     {$IFC NOT GENERATINGCFM}
  129.     INLINE $303C, $0208, $AA53;
  130.     {$ENDC}
  131.  
  132. {$ALIGN RESET}
  133. {$POP}
  134.  
  135. {$SETC UsingIncludes := DictionaryIncludes}
  136.  
  137. {$ENDC} {__DICTIONARY__}
  138.  
  139. {$IFC NOT UsingIncludes}
  140.  END.
  141. {$ENDC}
  142.