** ** $Id: IFFError.S,v 21.1 92/05/15 03:21:40 chris Exp $ ** $Revision: 21.1 $ ** ** $Filename: IFFError.S $ ** $Author: chris $ ** $Date: 92/05/15 03:21:40 $ ** ** iff.library/IFFL_IFFError ** ** COPYRIGHT (C) 1987-1992 BY CHRISTIAN A. WEBER, BRUGGERWEG 2, ** CH-8037 ZUERICH, SWITZERLAND. ALL RIGHTS RESERVED. NO PART ** OF THIS SOFTWARE MAY BE COPIED, REPRODUCED, OR TRANSMITTED ** IN ANY FORM OR BY ANY MEANS, WITHOUT THE PRIOR WRITTEN PER- ** MISSION OF THE AUTHOR. USE AT YOUR OWN RISK. ** IDNT IFFL_IFFError SECTION text,CODE INCLUDE "IFFLib.i" XDEF FindOurNode,SetError,ClearError XDEF IFFErrorFunc ******* iff.library/IFFL_IFFError ******************************************* * * NAME * IFFL_IFFError -- Get detailed error descrpition after an error * * SYNOPSIS * error = IFFL_IFFError() * D0 * * LONG IFFL_IFFError( VOID ) * * FUNCTION * If one of the iff.library functions returns zero, you can call * IFFL_IFFError() to know the reason for the failure. An error * code is returned, please refer to the files 'iff.h' or 'iff.i' * for the complete list of errors. * * INPUTS * none * * RESULT * Error-number generated by the latest function call, or zero if * no error. * * BUGS * If you don't close the IFF library at the end of your program * (using CloseLibrary()) the error node will not be freed. The * same task will then not be able to re-open the iff.library. * (This is not a bug, it's a feature ;-)) * * SEE ALSO * * ***************************************************************************** *** Unseren Node nach D0 und A0 bringen, Set Z-Flag if not found FindOurNode: movea.l iffb_SysBase(a5),a6 move.l ThisTask(a6),d1 move.l iffb_ErrList(a5),d0 ; 1. Node in Error Liste .findloop: movea.l d0,a0 ; next node move.l LN_SUCC(a0),d0 beq.s .findend ; ---> Ende (Z-Flag gesetzt) cmp.l ifferr_Task(a0),d1 ; Unser Node ? bne.s .findloop move.l a0,d0 ; unser Node, Clear Z-Flag .findend: rts ***************************************************************************** ClearError: bsr FindOurNode ; Node nach D0 und A0 ;; tst.l d0 beq.s 1$ ; no node ---> nichts eintragen clr.l ifferr_Error(a0) 1$: moveq #1,d0 ; Code für 'OK' rts ***************************************************************************** SetError: move.l d0,-(SP) ; Error-Nummer retten bsr FindOurNode ; Node nach D0 und A0 ;; tst.l d0 beq.s 1$ ; kein Node ---> nichts eintragen move.l (SP),ifferr_Error(a0) 1$: addq.l #4,SP moveq #0,d0 ; Code für 'Error' rts ***************************************************************************** IFFErrorFunc: movem.l a5-a6,-(SP) movea.l a6,a5 ; IFFBase bsr FindOurNode ; Node nach D0 und A0 ;; tst.l d0 beq.s 1$ ; kein Node ---> Fehler!! move.l ifferr_Error(a0),d0 clr.l ifferr_Error(a0) ; Error rücksetzen 2$: movem.l (SP)+,a5-a6 rts 1$: moveq #IFFL_ERROR_BADTASK,d0 bra.s 2$ END