Tabs to spaces, more consistent formatting.
[AROS.git] / workbench / libs / iffparse / findpropcontext.c
blobdade2a4f662f871a6bb8ac0bac5880ac750413bc
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_LH1(struct ContextNode *, FindPropContext,
17 /* SYNOPSIS */
18 AROS_LHA(struct IFFHandle *, iff, A0),
20 /* LOCATION */
21 struct Library *, IFFParseBase, 28, IFFParse)
23 /* FUNCTION
24 Finds the proper context in which to store a property.
25 If we have installed a property entry handler via PropChunk()
26 and such a property chunk (for example id is "CMAP" and type is "ILBM"
27 inside a form, then the storedproperty will be stored in the enclosing
28 FORM chink. If the chunk was inside a PROP chunk inside a LIST, then
29 the storedproperty would be installed in the LIST context.
31 INPUTS
32 iff - pointer to IFFHandle struct.
34 RESULT
35 cn - pointer to contextnode where the property might be installed, or
36 NULL if no such context exists.
38 NOTES
39 This function is most for internal use.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 ParentChunk(), CurrentChunk(), StoreItemInContext(), PropChunk()
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct ContextNode *node;
56 D(bug ("FindPropContext (iff=%p)\n", iff));
58 node = TopChunk(iff);
60 /* Start at the parent of the top node */
63 DB2(bug(" node=%p (%c%c%c%c)\n",
64 node,
65 dmkid(node->cn_ID)
66 ));
68 /* If this node is a FORM or a LIST, then we have acorrect property */
69 if ( (node->cn_ID == ID_FORM) || (node->cn_ID == ID_LIST) )
70 ReturnPtr ("FindPropContext",struct ContextNode *,node);
73 while ((node = ParentChunk(node) ));
75 /* No proper context found */
76 ReturnPtr ("FindPropContext",struct ContextNode *,NULL);
77 AROS_LIBFUNC_EXIT
78 } /* FindPropContext */