home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-15 | 6.4 KB | 251 lines | [TEXT/MPS ] |
- // RenoDBLib.h
- //
- // Copyright ©1994 Apple Computer, Inc. All rights reserved.
- // A POCO Production
- // 15-Aug-94
- //
- // A C interface to the RenoDB library.
- //
- // Also see the AGFile library which provides access
- // to information about the guide file.
-
-
- // The AGDBRefNum structure is used by the RenoDBLib C Glue to perform its stuff.
- // It should not be modified in any way.
-
- struct AGDBRefNum
- {
- unsigned long dbRefRes;
- unsigned long dbRefIndex;
- short flags;
- } AGDBRefNum;
-
- //
- // --------- General RenoDB structures --------------
- //
-
- struct ResData
- {
- unsigned short resID;
- OSType resType;
- unsigned short keyAttributes;
- };
-
- struct Reference
- {
- unsigned short resID;
- OSType resType;
- unsigned short keyAttributes;
- short resFileIndex;
- };
-
- struct KeyRef
- {
- unsigned char *key; // Pascal string
- Reference ref;
- };
-
- struct TReferenceList
- {
- enum { kNoOrder, kAscending, kDescending, kRandom };
- OSErr result;
- int size;
- int limit;
- int listOrder;
- char isCompact;
- unsigned char *keyBuffer;
- KeyRef **list;
- KeyRef lastKeyDropped;
- Handle itl2Hand;
- short fFastUSASCIIDB;
- short fDBScript;
- unsigned long fCompareCount;
- };
-
- typedef OSType DBScopeType;
-
- //
- // --------- Phrase reduction information --------------
- //
-
- struct wordElement {
- unsigned char processResult; // kStopListEntry, kThesaurusEntry, kStemmed
- short occurenceCount; // number of finds in the db
- OffPair bufferOffsets; // where the word began and ended in the buffer
- OffPair destOffsets; // where the word began and ended in destination
- };
-
- struct LookForRec {
- short phraseWords; // The number of words in the original phrase
- short phraseOccurenceCount; // The number of finds for the whole phrase
- wordElement word[1]; // The first element of the list - more can follow
- };
-
- typedef LookForRec *LookForPtr, **LookForHand;
-
- //
- // --------- Primary functions to open and close the guide file --------------
- //
-
- // DBNew creates new files & opens them
- OSErr
- DBNew( AGDBRefNum* dbRefNum, FSSpec* theFile );
-
- // DBNewRW creates new files & opens them for authoring
- OSErr
- DBNewRW( AGDBRefNum* dbRefNum, FSSpec* theFile );
-
- // DBOpen opens file
- OSErr
- DBOpen( AGDBRefNum* dbRefNum, FSSpec* theFile );
-
- // DBOpenRW opens file for authoring
- OSErr
- DBOpenRW( AGDBRefNum* dbRefNum, FSSpec* theFile );
-
- // DBClose closes file
- OSErr
- DBClose( AGDBRefNum* dbRefNum );
-
- //
- // --------- Functions to access the guide file resource fork --------------
- //
- // Functions that access only the resource fork of the open guide file.
- //
-
- short DBCount1Types( AGDBRefNum* dbRefNum );
- void DBGetIndType( AGDBRefNum* dbRefNum, ResType* rType, short rIndex );
- short DBCountResources(AGDBRefNum* dbRefNum, ResType rType );
- Handle DBGetIndResource(AGDBRefNum* dbRefNum, ResType rType, short rIndex );
- Handle DBGetResource(AGDBRefNum* dbRefNum, ResType rType, short rID );
- Handle DBGetNamedResource( AGDBRefNum* dbRefNum, ResType rType, unsigned char * rText );
- Handle DBGetPicture( AGDBRefNum* dbRefNum, short pictID );
- Handle DBGetIcon( AGDBRefNum* dbRefNum, short iconID );
- void DBGetIndString( AGDBRefNum* dbRefNum, Str255 theString, short strListID, short index );
- ControlHandle DBGetNewControl( AGDBRefNum* dbRefNum, short controlID, WindowPtr theWindow );
- CursHandle DBGetCursor( AGDBRefNum* dbRefNum, short cursorID );
- short DBUniqueID( AGDBRefNum* dbRefNum, ResType rType );
-
-
- //
- // --------- Standard guide file read-only functions --------------
- //
- // Functions which first access the resource fork and then, if not found,
- // access the data fork.
- //
-
- Handle
- DBGetIUSortResource( AGDBRefNum* dbRefNum );
-
- void
- DBSetIUSortResource(AGDBRefNum* dbRefNum, Handle theitl2 );
-
- short
- DBIsFastUSASCIISortDB(AGDBRefNum* dbRefNum);
-
- void
- DBSetFastUSASCIISortDB(AGDBRefNum* dbRefNum, short newState );
-
- long
- DBKeyCount(AGDBRefNum* dbRefNum, DBScopeType theScope );
-
- long
- DBKeyCount(AGDBRefNum* dbRefNum, DBScopeType theScope, const unsigned char* theKey );
-
- KeyRef
- DBFirstIndex(AGDBRefNum* dbRefNum, DBScopeType theScope );
-
- void
- DBFirstIndex(AGDBRefNum* dbRefNum, DBScopeType theScope, short maximum, TReferenceList* refList );
-
- void
- DBNextIndex(AGDBRefNum* dbRefNum, KeyRef* keyRef);
-
- void
- DBNextIndex(AGDBRefNum* dbRefNum, short maximum, TReferenceList* refList);
-
- void
- DBLastIndex(AGDBRefNum* dbRefNum, DBScopeType theScope, KeyRef* keyRef);
-
- void
- DBFindIndex(AGDBRefNum* dbRefNum, DBScopeType theScope,
- const unsigned char* firstKey, const unsigned char* lastKey,
- short maximum, TReferenceList* refList);
-
- void
- DBPreviousIndex(AGDBRefNum* dbRefNum, DBScopeType theScope,
- const unsigned char* theKey, KeyRef* keyRef);
-
- short
- DBNumDBFiles( AGDBRefNum* dbRefNum );
-
- OSErr
- DBGetDBFileInfo( AGDBRefNum* dbRefNum, short index, FSSpec* theDBFile );
-
- OSErr
- DBReducePhrase( AGDBRefNum* dbRefNum, unsigned char* thePhrase, LookForHand* theInfo );
-
- void
- DBLookForPhrase( AGDBRefNum* dbRefNum, DBScopeType theScope,
- unsigned char* reducedString, LookForHand theInfo,
- short scopeInData, TReferenceList* refList );
-
- short
- DBGetDefaultRefNum( AGDBRefNum* dbRefNum );
-
- void
- DBSetDefaultRefNum( AGDBRefNum* dbRefNum, short newRefNum );
-
- Handle
- DBGetData( AGDBRefNum* dbRefNum, Reference* foundItem );
-
- Handle
- DBGetData( AGDBRefNum* dbRefNum, KeyRef* foundItem );
-
- short
- DBGetDBRefNum( AGDBRefNum* dbRefNum, const short index );
-
- //
- // --------- Authoring functions (read/write) --------------
- //
-
- OSErr
- DBKeyBetween( AGDBRefNum* dbRefNum, unsigned char *destKey,
- unsigned char *firstKey, unsigned char *lastKey );
-
- OSErr
- DBBuildIncMask( AGDBRefNum* dbRefNum, unsigned char *firstKey,
- unsigned char *lastKey, short divisions, unsigned short *incMask );
-
- OSErr
- DBIncrementKey( AGDBRefNum* dbRefNum, unsigned char *theKey, unsigned short incMask );
-
- OSErr
- DBAddIndex( AGDBRefNum* dbRefNum, Reference* theContent,
- DBScopeType theScope, const unsigned char *theKey );
-
- OSErr
- DBDeleteIndex( AGDBRefNum* dbRefNum, Reference* theContent,
- DBScopeType theScope, const unsigned char *theKey );
-
- OSErr
- DBLoadDB( AGDBRefNum* dbRefNum, FSSpec* dbFile );
-
- OSErr
- DBDumpDB( AGDBRefNum* dbRefNum, FSSpec* dbFile, short index );
-
- OSErr
- DBDumpOneDBResType( AGDBRefNum* dbRefNum, FSSpec* dbFile, OSType onlyOne, short index );
-
- OSErr
- StoreDataRef( AGDBRefNum* dbRefNum, Reference theKind, Handle theData );
-
- OSErr
- StoreDataKeyRef( AGDBRefNum* dbRefNum, KeyRef theKind, Handle theData );
-
- OSErr
- DeleteDataRef( AGDBRefNum* dbRefNum, Reference theContent );
-
- OSErr
- DeleteDataKeyRef( AGDBRefNum* dbRefNum, KeyRef theContent );
-