1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
|