Added empty bootstrap.c and its build target
[AROS.git] / workbench / libs / iffparse / storelocalitem.c
blobdd1de39739c156fb9e43ec38a433e53a1ee2d36d
1 /*
2 Copyright © 1995-2007, 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_LH3(LONG, StoreLocalItem,
17 /* SYNOPSIS */
18 AROS_LHA(struct IFFHandle *, iff, A0),
19 AROS_LHA(struct LocalContextItem *, localItem, A1),
20 AROS_LHA(LONG , position, D0),
22 /* LOCATION */
23 struct Library *, IFFParseBase, 36, IFFParse)
25 /* FUNCTION
26 Stores the given local context item in a context node.
27 Which context node this is depends on the value of the position
28 argument:
29 IFFSLI_ROOT - insert into the default contextnode.
30 IFFSLI_PROP - insert into the node returned by FindPropContext().
31 IFFSLI_TOP - insert item into the current contextnode.
34 INPUTS
35 iff - pointer to IFFHandle struct.
36 localItem - pointer to local context item.
37 position - IFFSLI_ROOT, IFFSLI_PROP or IFFSLI_TOP.
39 RESULT
40 error - 0 if succesfull, IFFERR_#? otherwise.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 StoreItemInContext(), FindLocalItem(), EntryHandler(), ExitHandler()
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 LONG err = 0;
58 struct ContextNode *cn;
60 #if DEBUG
61 bug ("StoreLocalItem (iff=%p, localItem=%p, position=%d)\n",
62 iff, localItem, position
64 #endif
66 switch (position)
68 case IFFSLI_ROOT:
69 /* Store in default context-node */
70 StoreItemInContext
72 iff,
73 localItem,
74 RootChunk(iff)
76 break;
78 case IFFSLI_TOP:
79 /* Store in top context-node */
80 StoreItemInContext
82 iff,
83 localItem,
84 TopChunk(iff)
86 break;
88 case IFFSLI_PROP:
89 /* Store in top FORM or LIST chunk */
91 cn = FindPropContext(iff);
93 if (!cn)
94 err = IFFERR_NOSCOPE;
95 else
97 StoreItemInContext
99 iff,
100 localItem,
104 break;
107 } /* End of switch */
109 ReturnInt ("StoreLocalItem",LONG,err);
110 AROS_LIBFUNC_EXIT
111 } /* StoreLocalItem */