home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / AROS / utility / nexttagitem.c < prev    next >
Encoding:
C/C++ Source or Header  |  1978-03-06  |  2.1 KB  |  94 lines

  1. /*
  2.     (C) 1995 AROS - The Amiga Replacement OS
  3.     $Id: nexttagitem.c,v 1.3 1996/10/24 15:51:36 aros Exp $    $Log
  4.     Desc:
  5.     Lang: english
  6. */
  7. #include "utility_intern.h"
  8.  
  9. /*****************************************************************************
  10.  
  11.     NAME */
  12.     #include <utility/tagitem.h>
  13.     #include <clib/utility_protos.h>
  14.  
  15.     AROS_LH1(struct TagItem *, NextTagItem,
  16.  
  17. /*  SYNOPSIS */
  18.     AROS_LHA(struct TagItem **, tagListPtr, A0),
  19.  
  20. /*  LOCATION */
  21.     struct Library *, UtilityBase, 8, Utility)
  22.  
  23. /*  FUNCTION
  24.     Returns the address of the next tag-item in the list. This
  25.     routine correctly handles TAG_END, TAG_DONE, TAG_MORE and
  26.     TAG_IGNORE.
  27.  
  28.     TAG_END and TAG_DONE both terminate a TagItems-array (in
  29.     fact, TAG_DONE is the same as TAG_END).
  30.  
  31.     With TAG_MORE, you can redirect the processing to a new list
  32.     of tags. Note that the processing will not return to the previous
  33.     list when a TAG_END/TAG_DONE is encountered.
  34.  
  35.     TAG_IGNORE disables the processing of an entry in the list.
  36.     This entry is just ignored (We use this technique for filtering).
  37.  
  38.     INPUTS
  39.     tagListPtr - Pointer to an element in a taglist.
  40.  
  41.     RESULT
  42.     Next tag item or NULL if you reached the end of the list.
  43.  
  44.     NOTES
  45.     - TAG_MORE works like "go on with new list" instead of "read new
  46.       list and go on with the current one".
  47.  
  48.     EXAMPLE
  49.  
  50.     BUGS
  51.  
  52.     SEE ALSO
  53.  
  54.     INTERNALS
  55.  
  56.     HISTORY
  57.     29-10-95    digulla automatically created from
  58.                 utility_lib.fd and clib/utility_protos.h
  59.  
  60. *****************************************************************************/
  61. {
  62.     AROS_LIBFUNC_INIT
  63.     AROS_LIBBASE_EXT_DECL(struct Library *,UtilityBase)
  64.  
  65.     while (TRUE)
  66.     {
  67.     switch ((*tagListPtr)->ti_Tag)
  68.     {
  69.     case TAG_MORE:
  70.         (*tagListPtr) = (struct TagItem *)(*tagListPtr)->ti_Data;
  71.         continue;
  72.  
  73.     case TAG_IGNORE:
  74.         break;
  75.  
  76.     case TAG_END:
  77.         return (NULL);
  78.  
  79.     case TAG_SKIP:
  80.         (*tagListPtr) += (*tagListPtr)->ti_Data + 1;
  81.         continue;
  82.  
  83.     default:
  84.         /* Use post-increment (return will return the current value and
  85.         then tagListPtr will be incremented) */
  86.         return (*tagListPtr) ++;
  87.     }
  88.  
  89.     (*tagListPtr) ++;
  90.     }
  91.  
  92.     AROS_LIBFUNC_EXIT
  93. } /* NextTagItem */
  94.