; ; File: AEHandlerTable.a ; ; Contains: xxx put contents here xxx ; ; Written by: xxx put writers here xxx ; ; Copyright: © 1990 by Apple Computer, Inc., all rights reserved. ; ; This file is used in these builds: BigBang ; ; ; Change History (most recent first): ; ; <2> 1/11/91 Lai 'indc' handler is used in object library support ; <1> 12/13/90 Lai first checked in ; ; To Do: ; ; ======================================================================================= ; Files needed by this Package ; ======================================================================================= STRING ASIS IMPORT AddToTable,RemoveFromTable,GetEventHandler ;--------------------------------------------------------------------------- ;{ we can reduce code size by rewriting in assembler } ;{ first pop the return address, then push FALSE, then TRUE, then push return address and JMP to AddToTable } ; ;FUNCTION AE_InstallEventHandler(theAEEventClass: AEEventClass; ; theAEEventID: AEEventID; ; theHandler: ProcPtr; ; handlerRefcon: LONGINT; ; isSysHandler: Boolean): OSErr; ; ; BEGIN ; { just add it by calling AddToTable } ; AE_InstallEventHandler := AddToTable(theAEEventClass, theAEEventID, ; theHandler, handlerRefcon, isSysHandler, FALSE, TRUE) ; END; ; ;--------------------------------------------------------------------------- AE_InstallEventHandler PROC EXPORT MOVE.L (A7)+,A0 ; return address CLR.W -(A7) ; push isSpecialHandler=false on stack MOVE.B #1,-(A7) ; push isEventHandler=true on stack MOVE.L A0,-(A7) ; push back return addres JMP AddToTable ENDP ;--------------------------------------------------------------------------- ;{ we can reduce code size by rewriting in assembler } ;FUNCTION AE_InstallCoercionHandler(fromType: DescType; ; toType: DescType; ; theHandler: ProcPtr; ; handlerRefcon: LONGINT; ; fromTypeAsDesc: Boolean; ; isSysHandler: Boolean): OSErr; ; ; BEGIN ; { just add it by calling AddToTable } ; AE_InstallCoercionHandler := AddToTable(fromType, toType, theHandler, handlerRefcon, isSysHandler, fromTypeAsDesc, FALSE); ; END; ; ;--------------------------------------------------------------------------- AE_InstallCoercionHandler PROC EXPORT MOVE.L (A7)+,A0 ; return address MOVE.L (A7),D0 ; isSysHandler & fromTypeAsDesc SWAP D0 ; reverse order MOVE.L D0,(A7) ; put it back ; CLR.W -(A7) ; push isEventHandler=false on stack MOVE.L A0,-(A7) ; push back return addres JMP AddToTable ENDP ;--------------------------------------------------------------------------- ;{ we can reduce code size by rewriting in assembler } ;FUNCTION AE_RemoveEventHandler(theAEEventClass: AEEventClass; ; theAEEventID: AEEventID; ; theHandler: ProcPtr; ; isSysHandler: Boolean): OSErr; ; ; BEGIN ; { just remove it by calling RemoveFrom table } ; AE_RemoveEventHandler := RemoveFromTable(theAEEventClass, theAEEventID, ; theHandler, isSysHandler, TRUE); ; END; ; ;--------------------------------------------------------------------------- AE_RemoveEventHandler PROC EXPORT MOVE.L (A7)+,A0 ; return address MOVE.B #1,-(A7) ; push isEventHandler=true on stack MOVE.L A0,-(A7) ; push back return addres JMP RemoveFromTable ENDP ;--------------------------------------------------------------------------- ;{ we can reduce code size by rewriting in assembler } ;FUNCTION AE_RemoveCoercionHandler(fromType: DescType; ; toType: DescType; ; theHandler: ProcPtr; ; isSysHandler: Boolean): OSErr; ; ; BEGIN ; { just remove it by calling RemoveFrom table } ; AE_RemoveCoercionHandler := RemoveFromTable(fromType, toType, theHandler, isSysHandler, FALSE); ; END; ; ;--------------------------------------------------------------------------- AE_RemoveCoercionHandler PROC EXPORT MOVE.L (A7)+,A0 ; return address CLR.W -(A7) ; push isEventHandler=false on stack MOVE.L A0,-(A7) ; push back return addres JMP RemoveFromTable ENDP ;--------------------------------------------------------------------------- ;{ we can reduce code size by rewriting in assembler } ;FUNCTION AE_GetCoercionHandler(fromType: DescType; ; toType: DescType; ; VAR theHandler: ProcPtr; ; VAR handlerRefcon: LONGINT; ; VAR fromTypeAsDesc: Boolean; ; isSysHandler: Boolean): OSErr; ; ; BEGIN ; { just get it by calling GetEventHandler } ; AE_GetCoercionHandler := GetEventHandler(fromType, toType, theHandler, handlerRefcon, ; fromTypeAsDesc, isSysHandler, FALSE); ; END; ; ;--------------------------------------------------------------------------- AE_GetCoercionHandler PROC EXPORT MOVE.L (A7)+,A0 ; return address CLR.W -(A7) ; push isEventHandler=false on stack MOVE.L A0,-(A7) ; push back return addres JMP GetEventHandler ENDP ;--------------------------------------------------------------------------- ; ;FUNCTION GetSpecialProcOffset(functionClass: AEKeyWord): LONGINT; ; VAR ; offset: Integer; ; ; BEGIN ; IF LONGINT(functionClass) = LONGINT(keyPreDispatch) THEN ; offset := phacOffset ; ELSE IF LONGINT(functionClass) = LONGINT(keySelectProc) THEN ; offset := selhOffset ; ELSE IF LONGINT(functionClass) = LONGINT(keyBlockingProc) THEN ; offset := blockingoffset ; ELSE IF LONGINT(functionClass) = LONGINT(keyUnblockProc) THEN ; offset := unblockOffset ; ELSE IF LONGINT(functionClass) = LONGINT(keyDiposeTokenProc) THEN ; offset := diposeTokenOffset ; ELSE IF LONGINT(functionClass) = LONGINT(keyCmprProc) THEN ; offset := kurProc1Offset ; ELSE IF LONGINT(functionClass) = LONGINT(keyContProc) THEN ; offset := kurProc2Offset ; ELSE IF LONGINT(functionClass) = LONGINT(keyMkidProc) THEN ; offset := kurProc3Offset ; ELSE IF LONGINT(functionClass) = LONGINT(keyMarkProc) THEN ; offset := kurProc4Offset ; ELSE IF LONGINT(functionClass) = LONGINT(keyAdjmProc) THEN ; offset := kurProc5Offset ; ELSE ; offset := 0; ; GetSpecialProcOffset := offset; ; END; ; ; ;--------------------------------------------------------------------------- phacOffset EQU 12 PROC EXPORT GetSpecialProcOffset SelTable DC.B 'phac' DC.B 'selh' DC.B 'blck' DC.B 'unbk' DC.B 'xtok' DC.B 'cmpr' DC.B 'cont' DC.B 'mkid' DC.B 'mark' DC.B 'adjm' DC.B 'navt' DC.B 'indc' selectCount EQU (*-SelTable)/4 GetSpecialProcOffset MOVE.L (A7)+,A0 ; return address MOVE.L (A7)+,D0 ; the functionClass LEA SelTable,A1 MOVE.L #phacOffset-4,D1 MOVE.W #selectCount-1,D2 ChkNxt ADD.L #4,D1 ; increment offset CMP.L (A1)+,D0 ; is this the keyeword DBEQ D2,ChkNxt ; loop if not BEQ.S PutBack ; it is found MOVE.L #0,D1 ; indicates not found PutBack MOVE.L D1,(A7) ; put into function result JMP (A0) ; return ENDP END