mac-rom/OS/HFS/Extensions/DTDBMgrPriv.a
Elliot Nunn 0ba83392d4 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-09-20 18:04:16 +08:00

362 lines
9.1 KiB
Plaintext

;
; File: DTDBMgrPriv.a
;
; Contains: private equates for the desktop database manager
;
; Written by: Dave Feldman
;
; Copyright: © 1989-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <12> 9/13/91 JSM Cleanup header.
; <11> 1/30/91 dnf csd, #dnf002: Set the max key length for 7.0 desktop btree
; files to 37 to make it compatible with the (hardcoded) BTCheck
; routine in AppleShare 2.0.1 servers.
; <10> 1/22/91 dnf (ppd, tgh) Make _HOpen calls through the i/o bottleneck to make
; sure that dtOwnCall is set.
; <9> 12/18/90 dnf (dba) Make _BTInit, _BTOpen, and _BTClose synchronous. Make
; _BTClose, _Close and _BTOpen happen in SystemMode, make _HOpen
; synchronous.
; <8> 12/5/90 dnf <dba> Spiff up AppLocals by using real records in the
; definition.
; <7> 9/22/90 dnf Move interruptRegs into QMgrEqu.a
; <6> 8/6/90 dnf Add data structures to DTDBQElt to implement better btree hint
; control.
; <5> 6/2/90 dnf Get rid of obsolete fields in DTDBQElt
; <4> 5/4/90 dnf Change MaxKeySize to 11
; <3> 4/10/90 dnf Move MaxCommentLen to DTDBEqu.a
; <2> 2/4/90 dnf Add storage for btree hint across calls
; <1.6> 12/8/89 dnf Make HOpen and BTOpen calls in SystemMode
; <1.5> 11/8/89 dnf Changed datafile type to match appleshare, add data structures
; for unmount notify
; <1.4> 10/11/89 dnf Added macros for i/o bottleneck
; <1.3> 9/18/89 dnf Type & creator equates, upped data clump size
; <1.2> 8/7/89 dnf Change IconRec to IconDRec to avoid collisions with QD equates
; <1.1> 7/6/89 dnf Got rid of equate of fsVars
; <1.0> 5/30/89 dnf Integrate CatSearch, FileID's and Desktop Database Mgr into one
; ptch
;
;
; Debugging flag
;
DTDebug equ 0 ; set to 1 for debug code
;
; These macros generate variable length symbol names for Macsbug. The first
; argument is the routine name, in quotes. 'Foo', for example. The second is an
; integer indicating the amount of constant data. This number is used by macsbug
; to figure out where the next routine starts.
;
macro
_DTDebugTail &routineName, &dataSize
if DTDebug then
dc.b $80 ; i.e variable length string, next byte has length
dc.b &len(&routineName)-2 ; length of string (-2 for the quotes around it)
dc.b &routineName ;
align 2
dc.w &dataSize ; size (bytes) of constant data
endif
endm
; same as above, but adds an rts for routines which don't end with one.
macro
_DTDebugRts &routineName, &dataSize
if DTDebug then
rts ; many DT routines don't end w/rts, so add one in.
dc.b $80 ; i.e variable length string, next byte has length
dc.b &len(&routineName)-2 ; length of string (-2 for the quotes around it)
dc.b &routineName ;
align 2
dc.w &dataSize ; size (bytes) of constant data
endif
endm
;
; Private equates:
;
DTBTClpSize EQU 32 ; Number of nodes per clump in DB File
DTFClpSize EQU 32 ; Number of allocation blocks per clump in DT File
DTMinVolSize equ 2*1024*1024 ; 2 Mb is minimum size ejectable volume to support
DTBigPBSize equ 200 ; as big as largest BT or HFS param block (¥¥ get real value)
DTStackSize equ 1500 ; 1.5K should to do for DT stack
DTDataClump equ 64*1024 ; add to the icon file size 32K at a time
; finder info
DTDataFileType equ 'DTFL'
DTBTFileType equ 'BTFL'
DTFileCreator equ 'DMGR'
; DT Manager's global area, allocated at startup time.
; The global area starts with a header for the queue of all open databases
DTGlobals record 0, increment
qFlags ds.w 1 ; queue header flags word
qHead ds.l 1 ; first element in queue [pointer]
qTail ds.l 1 ; last element in queue [pointer]
targetVRef ds.w 1 ; volume current call is aimed at
infoFlags ds.b 1 ; general state flags
size equ *-DTGlobals
endr
; bit positions for infoFlags
notifyBit equ 0 ; true if volume notify already requested
IconKeyType equ 1 ; Icon key type
IconKey record 0, increment
Len ds.b 1 ; Overall key length [byte]
Type ds.b 1 ; Key type [byte], $01 for icon keys
CrType ds.b 4 ; Creator type
FlType ds.b 4 ; File type [for Icon keys]
IconType ds.b 1 ; Icon Type (byte) [for Icon keys]
filler ds.b 1 ; filler to match original dt format key
IKLen equ *-IconKey
endr
IconDRec record 0, increment ; <1.2>
TagInfo ds.l 1 ; Tag info [for Icon and APPL entries]
IconPos ds.l 1 ; Icon ID [File position in Desktop datafile]
IconSize ds.w 1 ; Icon Size [word]
IRLen equ *-IconDRec ; size of an icon's entry in the BT file
endr
APPLKeyType equ 2 ; APPL key type
APPLKey record 0, increment
Len ds.b 1 ; Key length
Type ds.b 1 ; Key type [byte], $02 for APPL keys
CrType ds.l 1 ; Creator type
SeqNum ds.w 1 ; APPL serial number
AKLen equ *-APPLKey
endr
APPLRec record 0, increment
TagInfo ds.l 1 ; Creation date
ParID ds.l 1 ; APPL (parent) directory ID
CName ds.b 32 ; APPL CName (¥¥ magic constant)
ARLen equ *-APPLRec
endr
CommentKeyType equ 3 ; Comment key type
CommentKey record 0, increment
Len ds.b 1 ; Overall key length [byte]
Type ds.b 1 ; Key type [byte], $03 for file comment keys
CNID ds.l 1 ; File number [long]
CKLen equ *-CommentKey
endr
MaxCommentLen equ 199 ; max # chars in a file comment
CommentRec record 0, increment
CmtSize ds.b 1 ; Size of comment
CmtData ds.b MaxCommentLen ; Comment text
CRLen equ *-CommentRec
endr
DTMaxKeySize equ 37 ; Maximum overall key size (must be odd)
DTMaxIconSize equ 4500 ; limit on icon data (¥¥ Get real number here)
MaxDTRecSize equ CommentRec.CRLen ; 'cause it's the longest
BTMaxKeyLen equ maxKeyLen ; ¥¥ this should change when btequ changes
;
; DT Manager database queue element
; One per open database, allocated at DTOpen time
;
DTDBQElt record 0, increment
qLink ds.l 1 ; points to next entry
qType ds.w 1 ; DTQ entry type
DTRefNum ds.w 1 ; This database's DTRefnum
DBRefNum ds.w 1 ; database's B*-Tree file refNum [Word]
DFRefNum ds.w 1 ; database's icon data file refNum [Word]
Flags ds.b 1 ; Flags [Byte]
Reserved ds.b 1 ; [Byte]
XVRefNum ds.w 1 ; VRefNum of volume for which DT was opened
VRefNum ds.w 1 ; VRefNum of volume containing DB & DF files
ParID ds.l 1 ; Directory containing Desktop files
Index ds.w 1 ; B*-Tree record index [word]
DFClumpSize ds.l 1 ; allocation clump for data file
lastHint ds.l 4 ; the last btree hint we had (¥¥ magic length)
Size equ *-DTDBQElt
endr
; Flag bits in Flags [top byte]
;
; <none for now>
; stack from for volume notification procedure
notifyFrame record 0, increment ; pascal stack frame with no locals
A6Link ds.l 1
retAddr ds.l 1
vnbPtr ds.l 1 ; pointer to VolumeNoticeBlock
theErr ds.w 1 ; output parameter
endr
; Generic locals records
; applications
APPLLocals record 0, increment
bigPB ds.b DTBigPBSize ; big enough for any file or btree call
Key ds.b APPLKey ; big enough for an application key
Data ds.b APPLRec ; big enough for an application record
AppSpec ds.b FSSpec ; FSSpec with name of app
index ds.w 1 ; hold a record index
crDate ds.l 1 ; creation date of the app
theDate ds.l 1 ; date on an interesting record
theSeqNum ds.w 1 ; seqnum on an interesting record
count ds.w 1 ; count
flags ds.b 1 ; iterator signal flags
align 2
LSize equ *-APPLLocals
endr
; values for iterator signal flags
; (AddAPPL flags)
applSawARecord equ 0 ; iterator saw at least 1 good record
applFoundADup equ 1 ; iterator saw a duplicate entry
applFoundASeqNum equ 2 ; iterator found a good seqnum
; (RemoveAPPL flags)
applFoundAMatch equ 3 ; iterator saw a match
applNotLeftmost equ 4 ; the match isn't the leftmost entry
; macros for the I/O bottleneck
macro
go_HOpen
bsr myBeginSystemMode
bsr doHOpen
bsr myEndSystemMode
endm
macro
go_HDelete
bsr doHDelete
endm
macro
go_Close
bsr myBeginSystemMode
bsr doClose
bsr myEndSystemMode
endm
macro
go_Read
bsr doRead
endm
macro
go_Write
bsr doWrite
endm
macro
go_GetCatInfo
bsr doGetCatInfo
endm
macro
go_HGetFileInfo
bsr doHGetFileInfo
endm
macro
go_HGetVInfo
bsr doHGetVInfo
endm
macro
go_HCreate
bsr doHCreate
endm
macro
go_Allocate
bsr doAllocate
endm
macro
go_SetEOF
bsr doSetEOF
endm
macro
go_GetEOF
bsr doGetEOF
endm
macro
go_GetFCBInfo
bsr doGetFCBInfo
endm
macro
go_HSetFileInfo
bsr doHSetFileInfo
endm
macro
go_GetVolParms
bsr doGetVolParms
endm
macro
go_FlushVol
bsr doFlushVol
endm
macro
go_MakeFSSpec
bsr doMakeFSSpec
endm
macro
go_BTInit
_BTInit
endm
macro
go_BTOpen
bsr myBeginSystemMode
_BTOpen
bsr myEndSystemMode
endm
macro
go_BTClose
bsr myBeginSystemMode
_BTClose
bsr myEndSystemMode
endm
macro
go_BTSearch
bsr doBTSearch
endm
macro
go_BTGetRec
bsr doBTGetRec
endm
macro
go_BTSetRec
bsr doBTSetRec
endm
macro
go_BTReplRec
bsr doBTReplRec
endm
macro
go_BTDelRec
bsr doBTDelRec
endm
macro
go_BTFlush
bsr doBTFlush
endm