NextTagArg

Finds the next TagArg in a tag list.

Synopsis

TagArg *NextTagArg( const TagArg **tagList );

Description

This function iterates through a tag list, skipping and chaining as dictated by control tags. There are three control tags:

TAG_NOP
Ignores that single entry and moves to the next one.
TAG_JUMP
Has a pointer to another array of tags.
TAG_END
Marks the end of the tag list.
This function only returns TagArgs which are not system tags. Each call returns either the next TagArg you should examine, or NULL when the end of the list has been reached.

Arguments

tagList
This is a pointer to a storage location used by the iterator to keep track of its current location in the tag list. The variable that this parameter points to should be initialized to point to the first TagArg in the tag list, and should not be changed thereafter.

Return Value

This function returns a pointer to a TagArg structure, or NULL if all the tags have been visited. None of the control tags are ever returned to you, they are handled transparently by this function.

Example

Example 1: Example for NextTagArg

void WalkTagList(const TagArg *tags)
{
TagArg *state;
TagArg *currentTag;
 
    state = tags;
        while ((tag = NextTagItem(&state)) != NULL)
    {
            switch (tag->ta_Tag)
            {
                case TAG1: // process this tag
                           break;
 
                case TAG2: // process this tag
                           break;
 
                default  : // unknown tag, return an error
                       break;
        }
        }
}

Implementation

Folio call implemented in kernel folio V24.

Associated Files

tags.h

See Also

FindTagArg()