grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / iffparse / storeitemincontext.c
blob9b51e0e6646835b5acabbfdda26ccd2cb6c8503f
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "iffparse_intern.h"
8 /*****************************************************************************
10 NAME */
11 #include <proto/iffparse.h>
13 AROS_LH3(void, StoreItemInContext,
15 /* SYNOPSIS */
16 AROS_LHA(struct IFFHandle *, iff, A0),
17 AROS_LHA(struct LocalContextItem *, localItem, A1),
18 AROS_LHA(struct ContextNode *, contextNode, A2),
20 /* LOCATION */
21 struct Library *, IFFParseBase, 37, IFFParse)
23 /* FUNCTION
24 Stores the given local context item into the given context node.
25 If a LCI with the some id, type and class identifier allready exists
26 in the context node, the old one will be purged, and the new one
27 inserted.
29 INPUTS
30 iff - pointer to IFFHandle struct.
31 localItem - pointer to LCI to install.
32 contextNode - pointer to the context node in which the LCI will be stored.
34 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 StoreLocalItem()
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct LocalContextItem *node,
52 *nextnode;
54 struct MinList *lcilist;
56 (void) iff;
58 DEBUG_STOREITEMINCONTEXT(dprintf("StoreItemInContext: iff 0x%lx item 0x%lx context 0x%lx\n",
59 iff, localItem, contextNode));
61 lcilist = &( GetIntCN(contextNode)->cn_LCIList );
63 /* Check if there are other similar LCIs stored */
64 node = (struct LocalContextItem*)lcilist->mlh_Head;
66 while ((nextnode = (struct LocalContextItem*)node->lci_Node.mln_Succ))
70 ( node->lci_ID == localItem->lci_ID )
72 ( node->lci_Type == localItem->lci_Type )
74 ( node->lci_Ident == localItem->lci_Ident )
76 PurgeLCI(node, IPB(IFFParseBase));
78 node = nextnode;
82 /* Insert the LCI */
83 AddHead
85 (struct List*)lcilist,
86 (struct Node*)localItem
89 return;
91 AROS_LIBFUNC_EXIT
92 } /* StoreItemInContext */