New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / workbench / libs / iffparse / entryhandler.c
blobd469ef39ccdb6edcd132ca66832bf234357ec00c
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
7 #include <aros/debug.h>
8 #include "iffparse_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/iffparse.h>
15 AROS_LH6(LONG, EntryHandler,
17 /* SYNOPSIS */
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),
25 /* LOCATION */
26 struct Library *, IFFParseBase, 17, IFFParse)
28 /* FUNCTION
29 Installs an entry handler for a specific chunk type
30 that wil be called whenever a chunk of that type is pushed on the contextstack
31 via ParseIFF().
34 INPUTS
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
39 more info.
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.
44 RESULT
45 error - 0 If successfull, IFFERR_#? elsewise.
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 ExitHandler(), StoreLocalItem(), StoreItemInContext()
58 INTERNALS
60 *****************************************************************************/
62 AROS_LIBFUNC_INIT
63 AROS_LIBBASE_EXT_DECL(struct Library *,IFFParseBase)
65 struct LocalContextItem *lci;
66 struct HandlerInfo *hi;
68 D(bug ("EntryHandler (iff=%p, type=%c%c%c%c, id=%c%c%c%c, position=%d, handler=%p, object=%p)\n",
69 iff,
70 dmkid(type),
71 dmkid(id),
72 position, handler, object
73 ));
75 if (!(lci = AllocLocalItem(
76 type,
77 id,
78 IFFLCI_ENTRYHANDLER,
79 sizeof (struct HandlerInfo))))
81 ReturnInt ("EntryHandler",LONG,IFFERR_NOMEM);
84 /* Get pointer to the user data */
85 hi = LocalItemData(lci);
87 hi->hi_Hook = handler;
89 hi->hi_Object = object;
91 ReturnInt
93 "EntryHandler",
94 LONG,
95 StoreLocalItem
97 iff,
98 lci,
99 position
103 AROS_LIBFUNC_EXIT
104 } /* EntryHandler */