Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 8 - Dictionary Manager / Dictionary Manager Reference
Routines / Making a Dictionary


InitializeDictionary

The InitializeDictionary function constructs, for the specified file, the internal B*-tree structure that makes it a dictionary file.

FUNCTION InitializeDictionary (theFSSpecPtr: FSSpecPtr;
                               maximumKeyLength: Integer;
                               keyAttributes: Byte; 
                               script: ScriptCode): OSErr;
theFSSpecPtr
A pointer to a file system specification record. This record contains the filename, directory, and volume associated with this dictionary file.
maximumKeyLength

The maximum length of the keys in the dictionary, including the length byte. The length must be less than or equal to 129.
keyAttributes

The search criteria for the keys in the dictionary.
script
The number that specifies the script system this dictionary supports.
DESCRIPTION
InitializeDictionary does not open the dictionary file after the Dictionary Manager initializes it. To open and use a dictionary file, use the OpenDictionary function (see page 8-22).

You can set the maximum key length of a dictionary only once; you cannot change
it after the dictionary has been created. To maximize efficiency, keep the length to
a minimum.

The keyAttributes parameter allows you to specify search criteria. For example, in one script system, it might be desirable to design the search to disregard case and be sensitive to diacritical marks, whereas in another script system these preferences might be reversed in keeping with the character encoding. Two predefined constants are available for the key attributes: the kIsCaseSensitive constant indicates that search procedures are to be case sensitive, and the kIsNotDiacriticalSensitive constant specifies that the search procedures are to ignore diacritical marks. To specify a combination of the different attributes, you add the constants together.
ConstantValueExplanation
kIsCaseSensitive16Search is case-sensitive
kIsNotDiacriticalSensitive32Search is not diacritical-sensitive

SPECIAL CONSIDERATIONS
InitializeDictionary may move memory; your application should not call this function at interrupt time.

RESULT CODES
In addition to the standard File Manager, Memory Manager, and Resource Manager error codes, InitializeDictionary may return any of the following result codes.
noErr0No error
btNoSpace-413Insufficient disk space to store dictionary information
keyLenErr-416Maximum key length too great or equal to zero
keyAttrErr-417No such key attribute

SEE ALSO
Constants for all defined script codes are listed in the chapter "Script Manager" in
this book.

File system specification records and File Manager error codes are described in Inside Macintosh: Files. Memory Manager error codes are described in Inside Macintosh: Memory. Resource Manager error codes are described in Inside Macintosh: More Macintosh Toolbox.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996