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

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: findlocalitem.c,v 1.1 1997/02/03 16:44:23 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_LH4(struct LocalContextItem *, FindLocalItem,
  16.  
  17. /*  SYNOPSIS */
  18.     AROS_LHA(struct IFFHandle *, iff, A0),
  19.     AROS_LHA(LONG              , type, D0),
  20.     AROS_LHA(LONG              , id, D1),
  21.     AROS_LHA(LONG              , ident, D2),
  22.  
  23. /*  LOCATION */
  24.     struct Library *, IFFParseBase, 35, IFFParse)
  25.  
  26. /*  FUNCTION
  27.     Goes through the whole context node stack starting at the top
  28.     searching the contecnodes for attached LocalContextItems with the
  29.     specified type, id and ident codes.
  30.  
  31.     INPUTS
  32.     iff   - pointer to an IFFHandle struct.
  33.     type  - type code for item to find.
  34.     id    -  identifier code for item to find.
  35.     ident - ident code for the class of context item to find.
  36.  
  37.     RESULT
  38.     lci   - pointer to a local context item if found, or NULL if
  39.         none is found.
  40.  
  41.     NOTES
  42.  
  43.     EXAMPLE
  44.  
  45.     BUGS
  46.  
  47.     SEE ALSO
  48.     StoreLocalItem()
  49.  
  50.     INTERNALS
  51.  
  52.     HISTORY
  53.   27-11-96    digulla automatically created from
  54.       iffparse_lib.fd and clib/iffparse_protos.h
  55.  
  56. *****************************************************************************/
  57. {
  58.     AROS_LIBFUNC_INIT
  59.     AROS_LIBBASE_EXT_DECL(struct Library *,IFFParseBase)
  60.  
  61.     struct IntContextNode   *cn_node,
  62.                 *cn_nextnode;
  63.  
  64.     struct LocalContextItem *lci_node,
  65.                 *lci_nextnode;
  66.     /* Get contextnode at top */
  67.     cn_node = (struct IntContextNode*)TopChunk(iff);
  68.  
  69.     while ((cn_nextnode = (struct IntContextNode*)cn_node->CN.cn_Node.mln_Succ))
  70.     {
  71.     /* Get LCI at top inside contextnode */
  72.     lci_node = (struct LocalContextItem*)cn_node->cn_LCIList.mlh_Head;
  73.  
  74.     while ((lci_nextnode = (struct LocalContextItem*)lci_node->lci_Node.mln_Succ))
  75.     {
  76.         /* Do we have a match ? */
  77.         if
  78.         (
  79.         (lci_node->lci_Type   == type   )
  80.         &&
  81.         (lci_node->lci_ID      == id    )
  82.         &&
  83.         (lci_node->lci_Ident  == ident )
  84.         )
  85.         return (lci_node);
  86.  
  87.         lci_node = lci_nextnode;
  88.     }
  89.  
  90.     cn_node = cn_nextnode;
  91.     }
  92.  
  93.     return (NULL);
  94.  
  95.     AROS_LIBFUNC_EXIT
  96. } /* FindLocalItem */
  97.