sys7.1-doc-wip/Toolbox/DataAccessMgr/DataAccessMgr.a
2019-07-27 22:37:48 +08:00

241 lines
6.4 KiB
Plaintext

;
; File: DataAccessMgr.a
;
; Contains: Data Access Manager (codename SnarfMan) dispatch table, plus
; other misc. assembly routines.
;
; Written by: Jeff Miller
;
; Copyright: © 1989-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <10> 3/13/92 JSM Renamed this file DataAccessMgr.a from SnarfMan.a, keeping all
; the old revisions.
; <9> 6/12/91 JSM Completely delete about box code, which hasn't been used since
; revision 6 anyway.
; <8> 3/4/91 dba dty: get rid of extraneous forROM and SysVers stuff and turn off
; debugging symbols
; <7> 4/25/90 JSM Unimplement QuitDBPack.
; <6> 4/2/90 JSM Use DBRA in mymemclear, remove pstrcpy (replaced by a macro), no
; more about box.
; <5> 3/13/90 JSM Bump version in header, change names of ResultsHandler routines
; to ResultHandler.
; <4> 3/12/90 JSM Move SnarfManCR to SnarfCompletion.a.
; <3> 2/26/90 JSM Get rid of SnarfDispatch, now use PACKHelper, bump version in
; header.
; <2> 12/20/89 JSM Update to use public includes.
; <2.4> 11/7/89 JSM Bumped version expected on InitDBPack.
; <2.3> 11/6/89 JSM Fixed a bug cleaning up the stack for a bad selector or when the
; package was not inited.
; <2.2> 10/6/89 JSM Updated to make SnarfMan a PACK.
; <2.1> 9/18/89 JSM General cleanup.
; <2.0> 8/29/89 JSM Updated for new version 2 API.
; <1.8> 8/7/89 JSM Added kill and results-to-text stuff to jump table.
; <1.7> 7/19/89 JSM Changed 'type' to 'dataType' in several places.
; <1.6> 7/15/89 JSM Async stuff works now.
; <1.5> 6/22/89 JSM Updated async stuff.
; <1.4> 6/9/89 JSM Added more stuff to support async, not quite working yet.
; <1.3> 5/31/89 JSM Added GetGlobals, pstrcpy, and mymemclear routines.
; <1.2> 5/18/89 JSM Now use EMT's jump table technique.
; <1.1> 4/28/89 JSM Changed DBDisposQuery to DBDisposeQuery.
; <1.0> 4/11/89 JSM Added to EASE for the first time.
;
TITLE 'DataAccessMgr.a'
STRING ASIS
CASE OBJ
;
; Define DataAccessDebug to get MacsBug labels
;
; IF &TYPE('DataAccessDebug')='UNDEFINED' THEN
DataAccessDebug EQU 0
; ENDIF
; Includes
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'DatabaseAccess.a'
PRINT ON
;
; Macro to put in debug symbols for MacsBug
;
IF DataAccessDebug THEN
MACRO
DoDebugSymbols &name
DC.B $80 + &LEN(&name), '&name'
DC.W $0000
ENDM
ENDIF
;===============================================================================
;
; PROCEDURE DataAccessPackEntry(); - entry point for the Data Access Mgr
;
;===============================================================================
DataAccessPackEntry PROC EXPORT
DC.W $A9FF ; package entry point (unused now)
DC.B 'PACK'
DC.W 13 ; package number
DC.W 4 ; version
;
; DispatchTable for DispatchHelper
;
MyDispatchTable
DC.W 0 ; dispatchFlags (always 0)
DC.B $FF ; first selector (-1 for DBIdle)
DC.B $16 ; last selector (22 for DBGetResultsHandler)
;
; macro to build jump table
;
MACRO
JT &entry
IMPORT &entry
DC.W &entry - MyDispatchTable
ENDM
CASE OFF ; following are Pascal routines
JT SMIdle ; private routines
JT SMInitDBPack ; public routines
;
; The following entry used to be SMQuitDBPack, which is no longer implemented.
; DispatchHelper will return paramErr when it sees the DispatchTable entry is
; now 0.
;
DC.W 0
JT SMInit
JT SMEnd
JT SMGetConnInfo
JT SMGetSessionNum
JT SMSend
JT SMSendItem
JT SMExec
JT SMState
JT SMGetErr
JT SMBreak
JT SMGetItem
JT SMUnGetItem
JT SMKill
JT SMGetNewQuery
JT SMDisposeQuery
JT SMStartQuery
JT SMGetQueryResults
JT SMResultsToText
JT SMInstallResultHandler
JT SMRemoveResultHandler
JT SMGetResultHandler
CASE OBJ
;===============================================================================
;
; snarfGlobPtr GetGlobals() - Return Data Access Mgr globals.
;
;===============================================================================
GetGlobals PROC EXPORT
WITH ExpandMemRec ; for referencing globals
MOVE.L ExpandMem, A0 ; get expanded memory area
MOVE.L emSnarfGlobals(A0), D0 ; return globals
ENDWITH ; ExpandMemRec
RTS
IF DataAccessDebug THEN
DoDebugSymbols GetGlobals ; label for MacsBug
ENDIF
ENDPROC ;end of GetGlobals
;===============================================================================
;
; Ptr GetGlobalsPtr(); - Return a pointer to the emSnarfGlobals field
; in the ExpandMem record.
;
;===============================================================================
GetGlobalsPtr PROC EXPORT
WITH ExpandMemRec ; for referencing globals
MOVE.L ExpandMem, D0 ; get expanded memory area
ADD.L #emSnarfGlobals, D0 ; get pointer to global pointer
ENDWITH ; ExpandMemRec
RTS
IF DataAccessDebug THEN
DoDebugSymbols GetGlobalsPtr ; label for MacsBug
ENDIF
ENDPROC ; end of GetGlobalsPtr
;===============================================================================
;
; void mymemclear(char *s, long size); - Clears memory.
;
; Assumes size is greater than 0.
;
;===============================================================================
mymemclear PROC EXPORT
MOVE.L 4(A7), A0 ; A0 = src
MOVE.L 8(A7), D0 ; D0 = size
SUBQ #1, D0 ; D0 = D0 - 1 for DBRA
lLoop
MOVE.B #0, (A0)+ ; zero byte, increment pointer
DBRA D0, lLoop ; continue until done
RTS
IF DataAccessDebug THEN
DoDebugSymbols mymemclear ; label for MacsBug
ENDIF
ENDPROC ; end of mymemclear
;===============================================================================
;
; void CallCompletion(DBAsyncParmBlkPtr pb); - Calls completion routine.
;
;===============================================================================
CallCompletion PROC EXPORT
MOVE.L 4(A7), A0 ; A0 = pb
WITH DBAsyncParamBlockRec
MOVE.L completionProc(A0), A1 ; A1 = completion routine
ENDWITH ; DBAsyncParamBlockRec
JSR (A1) ; call completion routine
RTS
IF DataAccessDebug THEN
DoDebugSymbols CallCompletion ; label for MacsBug
ENDIF
ENDPROC ; end of CallCompletion
END