; ; File: AEDFWrapper.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): ; ; <1> 12/13/90 Lai first checked in ; ; To Do: ; ; ======================================================================================= ; Files needed by this Package ; ======================================================================================= STRING ASIS IMPORT WriteData,AddDesc,ReadData,FetchDesc,GetAttribute ;--------------------------------------------------------------------------- ;FUNCTION AE_DeleteRange(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT ; numberOfItems: LONGINT): OSErr; ; ;FUNCTION AE_DeleteItem(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT): OSErr; ; ; BEGIN ; { passing -1 in the pointer is delete } ; AE_DeleteItem := WriteData(theAEDescList, AEKeyWord(0), DescType(0), Ptr(-1), 0, index, 1); ; END; ; ; same call, depend on number of parameters ; ;--------------------------------------------------------------------------- AE_DeleteItem PROC EXPORT EXPORT AE_DeleteKeyDesc MOVE.L (A7)+,A0 ; return address CMP.W #$040E,D0 ; is it single item? BEQ.S DeleteSingle ; yes, branch to it MOVE.L (A7)+,D1 ; number of items MOVE.L (A7)+,D0 ; index CLR.L -(A7) ; AEKeysword(0) BRA.S DeleteCommon ;--------------------------------------------------------------------------- ;FUNCTION AE_DeleteItem(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT): OSErr; ; ; BEGIN ; { passing -1 in the pointer is delete } ; AE_DeleteItem := WriteData(theAEDescList, AEKeyWord(0), DescType(0), Ptr(-1), 0, index, 1); ; END; ; ; ;--------------------------------------------------------------------------- DeleteSingle MOVE.L (A7)+,D0 ; index CLR.L -(A7) ; AEKeysword(0) MOVE.L #1,D1 ; numberOfItems = 1 BRA.S DeleteCommon ;--------------------------------------------------------------------------- ;FUNCTION AE_DeleteKeyDesc(VAR theAERecord: AERecord; { VAR is for efficiency only } ; theAEKeyWord: AEKeyWord): OSErr; ; ; BEGIN ; { passing -1 in the pointer is delete } ; AE_DeleteKeyDesc := WriteData(theAERecord, theAEKeyWord, DescType(0), Ptr(-1), 0, 0, 1); ; END; ; ;--------------------------------------------------------------------------- AE_DeleteKeyDesc MOVE.L (A7)+,A0 ; return address MOVE.L #0,D0 ; index = 0 MOVE.L #1,D1 ; numberOfItems = 1 DeleteCommon CLR.L -(A7) ; DescType(0) MOVE.L #-1,D2 MOVE.L D2,-(A7) ; Ptr(-1) CLR.L -(A7) ; DataLength = 0 MOVE.L D0,-(A7) ; index MOVE.L D1,-(A7) ; numberOfItems MOVE.L A0,-(A7) ; push back return addres JMP WriteData ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_PutKeyPtr(VAR theAERecord: AERecord; { VAR is for efficiency only } ; theAEKeyword: AEKeyWord; ; typeCode: DescType; ; dataPtr: Ptr; ; dataSize: LONGINT): OSErr; ; ; BEGIN ; AE_PutKeyPtr := WriteData(theAERecord, theAEKeyword, typeCode, dataPtr, dataSize, 0, 1); ; END; ; ;--------------------------------------------------------------------------- AE_PutKeyPtr PROC EXPORT MOVE.L (A7)+,A0 ; return address CLR.L -(A7) ; index = 0 MOVE.L #1,D1 MOVE.L D1,-(A7) ; numberOfItems = 1 MOVE.L A0,-(A7) ; push back return addres JMP WriteData ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_PutPtr(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT; ; typeCode: DescType; ; dataPtr: Ptr; ; dataSize: LONGINT): OSErr; ; ; BEGIN ; AE_PutPtr := WriteData(theAEDescList, typeWildCard, typeCode, dataPtr, dataSize, index, 1); ; END; ; ;--------------------------------------------------------------------------- AE_PutPtr PROC EXPORT MOVE.L (A7)+,A0 ; return address MOVE.L 12(A7),D0 ; index MOVE.L #'****',12(A7) ; put in wild card MOVE.L D0,-(A7) ; put in index MOVE.L #1,D1 MOVE.L D1,-(A7) ; numberOfItems = 1 MOVE.L A0,-(A7) ; push back return addres JMP WriteData ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_PutDesc(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT; ; VAR theAEDesc: AEDesc): OSErr; { VAR is for efficiency only } ; ; BEGIN ; AE_PutDesc := AddDesc(theAEDescList, typeWildCard, theAEDesc, index); ; END; ;--------------------------------------------------------------------------- AE_PutDesc PROC EXPORT MOVE.L (A7)+,A0 ; return address MOVE.L 4(A7),D0 ; index MOVE.L #'****',4(A7) ; put in wild card MOVE.L D0,-(A7) ; put in index MOVE.L A0,-(A7) ; push back return addres JMP AddDesc ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_PutKeyDesc(VAR theAERecord: AERecord; { VAR is for efficiency only } ; theAEKeyWord: AEKeyWord; ; VAR theAEDesc: AEDesc { VAR is for efficiency only } ; ): OSErr; ; ; BEGIN ; AE_PutKeyDesc := AddDesc(theAERecord, theAEKeyWord, theAEDesc, 0); ; END; ;--------------------------------------------------------------------------- AE_PutKeyDesc PROC EXPORT MOVE.L (A7)+,A0 ; return address CLR.L -(A7) ; index = 0 MOVE.L A0,-(A7) ; push back return addres JMP AddDesc ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_GetNthPtr(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT; ; desiredType: DescType; ; VAR theAEKeyword: AEKeyWord; ; VAR typeCode: DescType; ; dataPtr: Ptr; ; maximumSize: LONGINT; ; VAR actualSize: LONGINT): OSErr; ; ; BEGIN ; theAEKeyword := typeWildCard; { indicates undefined, also avoid error when index = 0 } ; AE_GetNthPtr := ReadData(theAEDescList, index, desiredType, theAEKeyword, typeCode, dataPtr, maximumSize, actualSize); ; END; ;--------------------------------------------------------------------------- AE_GetNthPtr PROC EXPORT MOVE.L 20(A7),A0 ; address of theAEKeyword MOVE.L #'****',(A0) JMP ReadData ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_GetNthDesc(VAR theAEDescList: AEDescList; { VAR is for efficiency only } ; index: LONGINT; ; desiredType: DescType; ; VAR theAEKeyword: AEKeyWord; ; VAR theAEDesc: AEDesc): OSErr; ; ; BEGIN ; theAEKeyword := typeWildCard; { indicates undefined, also avoid error when index = 0 } ; AE_GetNthDesc := FetchDesc(theAEDescList, index, desiredType, theAEKeyword, theAEDesc); ; END; ;--------------------------------------------------------------------------- AE_GetNthDesc PROC EXPORT MOVE.L 8(A7),A0 ; address of theAEKeyword MOVE.L #'****',(A0) JMP FetchDesc ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_GetAttributePtr(VAR theAppleEvent: AppleEvent; { VAR is for efficiency only } ; theAEKeyWord: AEKeyWord; ; desiredType: DescType; ; VAR typeCode: DescType; ; dataPtr: Ptr; ; maximumSize: Size; ; VAR actualSize: Size): OSErr; ; ; BEGIN ; AE_GetAttributePtr := GetAttribute(theAppleEvent, theAEKeyWord, desiredType, typeCode, dataPtr, ; maximumSize, actualSize, FALSE); ; END; ;--------------------------------------------------------------------------- AE_GetAttributePtr PROC EXPORT MOVE.L (A7)+,A0 ; return address CLR.W -(A7) ; wantDesc = false MOVE.L A0,-(A7) ; push back return addres JMP GetAttribute ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_GetAttributeDesc(VAR theAppleEvent: AppleEvent; { VAR is for efficiency only } ; theAEKeyWord: AEKeyWord; ; desiredType: DescType; ; VAR result: AEDesc): OSErr; ; ; BEGIN ; WITH result DO ; AE_GetAttributeDesc := GetAttribute(theAppleEvent, theAEKeyWord, desiredType, descriptorType, NIL, 0, LONGINT(dataHandle), TRUE); ; END; ;--------------------------------------------------------------------------- AE_GetAttributeDesc PROC EXPORT MOVE.L (A7)+,A0 ; return address MOVE.L (A7),A1 ; address of result ; we leave the address of result on the stack because that is also the address of descriptor CLR.L -(A7) ; dataPtr = NIL CLR.L -(A7) ; max Size = 0 ADD.L #4,A1 ; address of result.dataHandle MOVE.L A1,-(A7) MOVE.B #1,-(A7) ; push true on stack MOVE.L A0,-(A7) ; push back return addres JMP GetAttribute ENDP ;--------------------------------------------------------------------------- ;FUNCTION AE_SizeOfAttribute(VAR theAppleEvent: AppleEvent; { VAR is for efficiency only } ; theAEKeyWord: AEKeyWord; ; VAR typeCode: DescType; ; VAR dataSize: Size): OSErr; ; ; BEGIN ; AE_SizeOfAttribute := GetAttribute(theAppleEvent, theAEKeyWord, typeWildCard, typeCode, NIL, 0, ; dataSize, FALSE); ; END; ;--------------------------------------------------------------------------- AE_SizeOfAttribute PROC EXPORT MOVE.L (A7)+,A0 ; return address MOVE.L (A7)+,D0 ; address of dataSize MOVE.L (A7)+,D1 ; address of typeCode MOVE.L #'****',-(A7) ; want wildcard type MOVE.L D1,-(A7) ; put back address of typeCode CLR.L -(A7) ; dataPtr = NIL CLR.L -(A7) ; max Size = 0 MOVE.L D0,-(A7) ; put back address of dataSize CLR.W -(A7) ; wantDesc = false MOVE.L A0,-(A7) ; push back return addres JMP GetAttribute ENDP END