home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / workbench / libs / iffparse / storeitemincontext.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-03  |  2.0 KB  |  95 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: storeitemincontext.c,v 1.1 1997/02/03 16:44:29 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_LH3(void, StoreItemInContext,
  16.  
  17. /*  SYNOPSIS */
  18.     AROS_LHA(struct IFFHandle        *, iff, A0),
  19.     AROS_LHA(struct LocalContextItem *, localItem, A1),
  20.     AROS_LHA(struct ContextNode      *, contextNode, A2),
  21.  
  22. /*  LOCATION */
  23.     struct Library *, IFFParseBase, 37, IFFParse)
  24.  
  25. /*  FUNCTION
  26.     Stores the given local context item into the given context node.
  27.     If a LCI with the some id, type and class identifier allready exists
  28.     in the context node, the old one will be purged, and the new one
  29.     inserted.
  30.  
  31.     INPUTS
  32.     iff        - pointer to IFFHandle struct.
  33.     localItem    -    pointer to LCI to install.
  34.     contextNode  -    pointer to the context node in which the LCI will be stored.
  35.  
  36.     RESULT
  37.  
  38.     NOTES
  39.  
  40.     EXAMPLE
  41.  
  42.     BUGS
  43.  
  44.     SEE ALSO
  45.     StoreLocalItem()
  46.  
  47.     INTERNALS
  48.  
  49.     HISTORY
  50.   27-11-96    digulla automatically created from
  51.       iffparse_lib.fd and clib/iffparse_protos.h
  52.  
  53. *****************************************************************************/
  54. {
  55.     AROS_LIBFUNC_INIT
  56.     AROS_LIBBASE_EXT_DECL(struct Library *,IFFParseBase)
  57.  
  58.     struct LocalContextItem *node,
  59.                 *nextnode;
  60.  
  61.     struct MinList *lcilist;
  62.  
  63.     lcilist = &( GetIntCN(contextNode)->cn_LCIList );
  64.  
  65.     /* Check if there are other similar LCIs stored */
  66.     node = (struct LocalContextItem*)lcilist->mlh_Head;
  67.  
  68.     while ((nextnode = (struct LocalContextItem*)node->lci_Node.mln_Succ))
  69.     {
  70.     if
  71.     (
  72.         ( node->lci_ID     == localItem->lci_ID    )
  73.     &&
  74.         ( node->lci_Type   == localItem->lci_Type  )
  75.     &&
  76.         ( node->lci_Ident  == localItem->lci_Ident  )
  77.     )
  78.         PurgeLCI(node, IPB(IFFParseBase));
  79.  
  80.     node = nextnode;
  81.  
  82.     }
  83.  
  84.     /* Insert the LCI */
  85.     AddHead
  86.     (
  87.     (struct List*)lcilist,
  88.     (struct Node*)localItem
  89.     );
  90.  
  91.     return;
  92.  
  93.     AROS_LIBFUNC_EXIT
  94. } /* StoreItemInContext */
  95.