Fix tmpl2str.

If may be given a NULL tmpl, if we're printing a "case {"
It's better to do it here instead of in every caller.

Handle xlat && regex structs.

Fix checks for too little room on escaped characters.
typo
Future debugging
Parse "foreach" into a vpt, and do sanity checks on it
Use tags in "foreach"
foreach now loops over a copy of the attributes

So that they can be deleted without affecting the loop