Each category now tracks with nodes belong to it.

This is needed to correctly implement dag_to_file.
Adds @vars to dag_to_file
Do not include special variables in d,n->variables
Add categories to dag_to_file
Implements variables with category scope.

This change will allow to easily define variables such as BATCH_OPTIONS
per category.