# Parsing Tags

If you write utility routines to be shared by many programmers, it is often useful to implement functions that take TagArg arrays in a manner similar to the system functions.

The `NextTagArg()` function lets you easily go through all the TagArg structures in an array. The function automatically handles all system tag commands like `TAG_NOP` and `TAG_JUMP`, and only returns TagArg structures that do not contain system tag commands. You give `NextTagArg()` a pointer to a variable that points to the tag array to process. It returns a pointer to the first TagArg structure within the array. You then call the function repeatedly until it returns NULL. Every time you call it, it returns the next TagArg structure in the array.

The`FindTagArg()` function takes a pointer to an array of TagArg structures and to a particular tag command. The function scans the supplied array looking for a TagArg structure that has the requested command. It returns a pointer to the TagArg structure, or NULL if no structure with that command is found.

The `GetTagArg()` function works much as `FindTagArg()` does, except that instead of returning a pointer to a TagArg structure, it returns the value stored in the`ta_Arg` field of the TagArg structure. You also give the function a default data value. If the desired TagArg can't be found, the function returns the default data value to you.

Finally, the `DumpTagList()` function displays all the tag commands and arguments in a TagArg array to the debugging terminal. This is very useful when you need to see every tag value being passed to a function call.