grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / iffparse / parentchunk.c
blobcbb44bdc933d3481845c39a88ce5fe2113b6fa24
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_LH1(struct ContextNode *, ParentChunk,
15 /* SYNOPSIS */
16 AROS_LHA(struct ContextNode *, contextNode, A0),
18 /* LOCATION */
19 struct Library *, IFFParseBase, 30, IFFParse)
21 /* FUNCTION
22 Returns a pointer to the parent context node to the given
23 one on the context node stack. The parent context node
24 represents the chunk enclosing the chunk given.
25 This can be use together with CurrentChunk() to iterate the
26 context node stack top-down.
28 INPUTS
29 contextNode - pointer to a context node.
31 RESULT
32 parent - pointer to the parent context node or NULL if none.
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 CurrentChunk()
43 INTERNALS
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct ContextNode *parentcn;
51 (void) IFFParseBase;
53 /* Get the parent of this contextnode. The contextstack
54 is simulated via AddHead/RemHead so we should use
55 .mln_Succ to get the parent
57 parentcn = (struct ContextNode*)contextNode->cn_Node.mln_Succ;
59 /* If the parent of the found node is 0 (mlh_Tail field
60 in struct MinList, then parentcn is the default contextnode,
61 which the user not should have access to
64 if (!parentcn->cn_Node.mln_Succ)
65 parentcn = NULL;
67 return (parentcn);
69 AROS_LIBFUNC_EXIT
70 } /* ParentChunk */