summaryrefslogtreecommitdiff
path: root/tools/depthfirst.gvpr
blob: 5539be22e17e4241f93ac671dd0322fc0dd741af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
BEGIN {
  int i, indent;
  int seen[string];
  void prInd (int cnt) {
  for (i = 0; i < cnt; i++) printf (" "); }
}
BEG_G {
  $tvtype = TV_prepostfwd; $tvroot = node($,ARGV[0]);
} N{
  if (seen[$.name]) {
    indent--;
    if (indent == 0) exit(0);
  } else {
    prInd(indent); print ($.name);
    seen[$.name] = 1;
    indent++;
  }
}