Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / iffparse / allociff.c
blob53ae4ad4355f21d7ffdbc058b2377ba0b388a26f
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_LH0(struct IFFHandle *, AllocIFF,
15 /* SYNOPSIS */
16 /* void */
18 /* LOCATION */
19 struct Library *, IFFParseBase, 5, IFFParse)
21 /* FUNCTION
22 Allocates an IFFHandle struct.
24 INPUTS
27 RESULT
28 An unitialized IFFHandle structure.
30 NOTES
31 The default context-node is created in AllocIFF() and persists until
32 FreeIFF().
34 EXAMPLE
36 BUGS
38 SEE ALSO
39 FreeIFF()
41 INTERNALS
42 Since the default contextnode persistes from AllocIFF until FreeIFF, it
43 is built-in into the internal IFFHandle structure
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct IntIFFHandle *intiff;
51 DEBUG_ALLOCIFF(dprintf("AllocIff: entry\n"));
53 if ( (intiff=(struct IntIFFHandle*)AllocMem (sizeof(struct IntIFFHandle),
54 MEMF_ANY|MEMF_CLEAR)
55 ) )
58 GetIH(intiff)->iff_Flags = (0L|IFFF_READ);
61 /* No need for buffering yet */
62 intiff->iff_BufferStartDepth = 0;
64 /* Initialize the context-stack list */
65 NewList ((struct List*)&(intiff->iff_CNStack));
68 /* Initialize the default context node */
69 NewList ((struct List*)&(intiff->iff_DefaultCN.cn_LCIList));
71 /* And add it to the stack */
72 AddHead
74 (struct List*)&(intiff->iff_CNStack),
75 (struct Node*)&(intiff->iff_DefaultCN)
78 /* Depth is 0 even if we have a default contextnode */
79 GetIH(intiff)->iff_Depth = 0;
83 DEBUG_ALLOCIFF(dprintf("AllocIff: return %p\n", intiff));
84 return ((struct IFFHandle*)intiff);
86 AROS_LIBFUNC_EXIT
87 } /* AllocIFF */