home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / workbench / libs / iffparse / allociff.c next >
Encoding:
C/C++ Source or Header  |  1997-02-04  |  1.8 KB  |  92 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: allociff.c,v 1.2 1997/02/04 14:09:48 digulla Exp $
  4.  
  5.     Desc:
  6.     Lang: english
  7. */
  8. #include "iffparse_intern.h"
  9.  
  10. /*****************************************************************************
  11.  
  12.     NAME */
  13. #include <proto/iffparse.h>
  14.  
  15.     AROS_LH0(struct IFFHandle *, AllocIFF,
  16.  
  17. /*  SYNOPSIS */
  18.     /* void */
  19.  
  20. /*  LOCATION */
  21.     struct Library *, IFFParseBase, 5, IFFParse)
  22.  
  23. /*  FUNCTION
  24.       Allocates an IFFHandle struct.
  25.  
  26.     INPUTS
  27.  
  28.  
  29.     RESULT
  30.     An unitialized IFFHandle structure.
  31.  
  32.     NOTES
  33.     The default context-node is created in AllocIFF() and persists until
  34.     FreeIFF().
  35.  
  36.     EXAMPLE
  37.  
  38.     BUGS
  39.  
  40.     SEE ALSO
  41.     FreeIFF()
  42.  
  43.     INTERNALS
  44.     Since the default contextnode persistes from AllocIFF until FreeIFF, it
  45.     is built-in into the internal IFFHandle structure
  46.  
  47.  
  48.     HISTORY
  49.   27-11-96    digulla automatically created from
  50.       iffparse_lib.fd and clib/iffparse_protos.h
  51.  
  52. *****************************************************************************/
  53. {
  54.     AROS_LIBFUNC_INIT
  55.     AROS_LIBBASE_EXT_DECL(struct Library *,IFFParseBase)
  56.  
  57.     struct IntIFFHandle *intiff;
  58.  
  59.     if ( (intiff=(struct IntIFFHandle*)AllocMem (sizeof(struct IntIFFHandle),
  60.         MEMF_ANY|MEMF_CLEAR)
  61.     ) )
  62.     {
  63.  
  64.     GetIH(intiff)->iff_Flags = (0L|IFFF_READ);
  65.  
  66.  
  67.     /* No need for buffering yet */
  68.     intiff->iff_BufferStartDepth = 0;
  69.  
  70.     /* Initialize the context-stack list */
  71.     NewList ((struct List*)&(intiff->iff_CNStack));
  72.  
  73.  
  74.     /* Initialize the default context node */
  75.     NewList ((struct List*)&(intiff->iff_DefaultCN.cn_LCIList));
  76.  
  77.     /* And add it to the stack */
  78.     AddHead
  79.     (
  80.         (struct List*)&(intiff->iff_CNStack),
  81.         (struct Node*)&(intiff->iff_DefaultCN)
  82.     );
  83.  
  84.     /* Depth is 0 even if we have a default contextnode */
  85.     GetIH(intiff)->iff_Depth = 0;
  86.  
  87.     }
  88.     return ((struct IFFHandle*)intiff);
  89.  
  90.     AROS_LIBFUNC_EXIT
  91. } /* AllocIFF */
  92.