summaryrefslogtreecommitdiff
path: root/Source/IFFError.S
diff options
context:
space:
mode:
authorChristian A. Weber <chris@gna.ch>1992-05-12 22:26:12 +0000
committerChristian A. Weber <chris@gna.ch>1992-05-12 22:26:12 +0000
commit36c824864c02f0a3f62c8a1d365d1670835c8c96 (patch)
treef3f433e4af522925d4c91f56865d38efaf83a456 /Source/IFFError.S
downloadiff-library-36c824864c02f0a3f62c8a1d365d1670835c8c96.tar.gz
iff-library-36c824864c02f0a3f62c8a1d365d1670835c8c96.tar.bz2
iff-library-36c824864c02f0a3f62c8a1d365d1670835c8c96.zip
Initial revision
Diffstat (limited to 'Source/IFFError.S')
-rw-r--r--Source/IFFError.S140
1 files changed, 140 insertions, 0 deletions
diff --git a/Source/IFFError.S b/Source/IFFError.S
new file mode 100644
index 0000000..3472f59
--- /dev/null
+++ b/Source/IFFError.S
@@ -0,0 +1,140 @@
+**
+** $Id: $
+** $Revision: $
+**
+** $Filename: IFFError.S $
+** $Author: Christian A. Weber $
+** $Release: 19.1 $
+** $Date: 92/05/11 21:11:27 $
+**
+** iff.library/IFFLib_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 IFFLib_IFFError
+ SECTION text,CODE
+
+ INCLUDE "IFFLib.i"
+
+ XDEF FindOurNode,SetError,ClearError
+ XDEF IFFErrorFunc
+
+
+******* iff.library/IFFLib_IFFError *****************************************
+*
+* NAME
+* IFFLib_IFFError -- Get detailed error descrpition
+*
+* SYNOPSIS
+* error = IFFLib_IFFError()
+* D0
+*
+* LONG IFFLib_IFFError( void )
+*
+* FUNCTION
+* If one of the above functions returns zero, you can call
+* IFFLib_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
+*
+* Cuurently the following numbers are used:
+*
+* Nr. Symbol Function Description
+*
+* 16 IFF_CANTOPENFILE OpenIFF() File not found
+* 17 IFF_READERROR OpenIFF() Read() returned an error
+* 18 IFF_NOMEM OpenIFF() Not enough memory for the file
+* 19 IFF_NOTIFF OpenIFF() File is not IFF
+* 20 IFF_WRITEERROR SaveBitMap() Cannot write the file
+*
+* 24 IFF_NOILBM DecodePic() IFF file is not an ILBM file
+* 25 IFF_NOBMHD DecodePic() BMHD chunk not found
+* 26 IFF_NOBODY DecodePic() BODY chunk not found
+* 27 IFF_TOOMANYPLANES DecodePic() Picture has more planes than the
+* BitMap (OBSOLETE SINCE 18.7!)
+* 28 IFF_UNKNOWNCOMPRESSION " Unknown compression type
+* 29 IFF_NOANHD ModifyFrame() ANHD chunk not found
+* 30 IFF_NODLTA ModifyFrame() DLTA chunk not found
+*
+* -1 IFF_BADTASK A task which did not open the IFF library
+* tried to call IFFError(). Since the IFF
+* library is capable of multi-tasking, the
+* error-values are stored for each task
+* separately.
+*
+* 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 ib_SysBase(a5),a6
+ move.l ThisTask(a6),d1
+ move.l ib_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 er_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 er_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$ ; no node ---> nichts eintragen
+ move.l (SP),er_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 er_Error(a0),d0
+ clr.l er_Error(a0) ; Error rücksetzen
+2$: movem.l (SP)+,a5-a6
+ rts
+1$:
+ moveq #IFF_BADTASK,d0
+ bra.s 2$
+
+ END