2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
8 #include "iffparse_intern.h"
10 /*****************************************************************************
13 #include <proto/iffparse.h>
15 AROS_LH6(LONG
, ExitHandler
,
18 AROS_LHA(struct IFFHandle
*, iff
, A0
),
19 AROS_LHA(LONG
, type
, D0
),
20 AROS_LHA(LONG
, id
, D1
),
21 AROS_LHA(LONG
, position
, D2
),
22 AROS_LHA(struct Hook
*, handler
, A1
),
23 AROS_LHA(APTR
, object
, A2
),
26 struct Library
*, IFFParseBase
, 18, IFFParse
)
29 Installs an exit handler for a specific chunk type
30 that wil be called whenever a chunk of that type is popped off the contextstack
35 iff - pointer to an iffhandle struct.
36 type - type code for the chunk to handle. (ex: "ILBM").
37 id - ID code for the chunk to handle. (ex: "CMAP")
38 position - position of localcontextitem. See StoreLocalItem for
40 handler - an initialised Hook structure for the handler function.
41 object - pointer to some kind of object that will be passed to
42 your handler function.
45 error - 0 If successfull, IFFERR_#? elsewise.
54 EntryHandler(), StoreLocalItem(), StoreItemInContext()
58 *****************************************************************************/
61 AROS_LIBBASE_EXT_DECL(struct Library
*,IFFParseBase
)
63 struct LocalContextItem
*lci
;
64 struct HandlerInfo
*hi
;
66 D(bug ("ExitHandler (iff=%p, type=%c%c%c%c, id=%c%c%c%c, position=%d, handler=%p, object=%p)\n",
70 position
, handler
, object
73 if (!(lci
= AllocLocalItem(
77 sizeof (struct HandlerInfo
))))
79 D(bug("ExitHandler: return IFFERR_NOME\n"));
80 return (IFFERR_NOMEM
);
83 /* Get pointer to the user contining a HandlerInfo structure data */
84 hi
= LocalItemData(lci
);
86 hi
->hi_Hook
= handler
;
88 hi
->hi_Object
= object
;