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

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: storelocalitem.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(LONG, StoreLocalItem,
  16.  
  17. /*  SYNOPSIS */
  18.     AROS_LHA(struct IFFHandle        *, iff, A0),
  19.     AROS_LHA(struct LocalContextItem *, localItem, A1),
  20.     AROS_LHA(LONG                     , position, D0),
  21.  
  22. /*  LOCATION */
  23.     struct Library *, IFFParseBase, 36, IFFParse)
  24.  
  25. /*  FUNCTION
  26.     Stores the given local context item in a context node.
  27.     Which context node this is depends on the valu of the position
  28.     argument:
  29.         IFFSLI_ROOT - insert into the default contextnode.
  30.         IFFSLI_PROP  -  insert into the node returned by FindPropContext().
  31.         IFFSLI_TOP    -  insert item into the current contextnode.
  32.  
  33.  
  34.     INPUTS
  35.     iff       - pointer to IFFHandle struct.
  36.     localItem  -  pointer to local context item.
  37.     position  -  IFFSLI_ROOT, IFFSLI_PROP os IFFSLI_TOP.
  38.  
  39.     RESULT
  40.     error      -  0 if succesfull, IFFERR_#? otherwise.
  41.  
  42.     NOTES
  43.  
  44.     EXAMPLE
  45.  
  46.     BUGS
  47.  
  48.     SEE ALSO
  49.     StoreItemInContext(), FindLocalItem(), EntryHandler(), ExitHandler()
  50.  
  51.     INTERNALS
  52.  
  53.     HISTORY
  54.   27-11-96    digulla automatically created from
  55.       iffparse_lib.fd and clib/iffparse_protos.h
  56.  
  57. *****************************************************************************/
  58. {
  59.     AROS_LIBFUNC_INIT
  60.     AROS_LIBBASE_EXT_DECL(struct Library *,IFFParseBase)
  61.  
  62.  
  63.     LONG err = NULL;
  64.     struct ContextNode *cn;
  65.  
  66.     switch (position)
  67.     {
  68.     case IFFSLI_ROOT:
  69.         /* Store in default context-node */
  70.         StoreItemInContext
  71.         (
  72.         iff,
  73.         localItem,
  74.         RootChunk(iff)
  75.         );
  76.         break;
  77.  
  78.     case IFFSLI_TOP:
  79.         /* Store in top context-node */
  80.         StoreItemInContext
  81.         (
  82.         iff,
  83.         localItem,
  84.         TopChunk(iff)
  85.         );
  86.         break;
  87.  
  88.     case IFFSLI_PROP:
  89.         /* Store in top FORM or LIST chunk */
  90.  
  91.         cn = FindPropContext(iff);
  92.  
  93.         if (!cn)
  94.         err = IFFERR_NOSCOPE;
  95.  
  96.         else
  97.         {
  98.         StoreItemInContext
  99.         (
  100.             iff,
  101.             localItem,
  102.             cn
  103.             );
  104.         }
  105.         break;
  106.  
  107.  
  108.     }     /* End of switch */
  109.  
  110.     return (err);
  111.  
  112.  
  113.     AROS_LIBFUNC_EXIT
  114. } /* StoreLocalItem */
  115.