~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to dotneato/awk/typegraph.awk

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) AT&T Corp. 1994, 1995.
 
2
# This code is licensed by AT&T Corp.  For the
 
3
# terms and conditions of the license, see
 
4
# http://www.research.att.com/orgs/ssr/book/reuse
 
5
 
 
6
BEGIN   {
 
7
                        n_names = 0;
 
8
                        printf("strict digraph typeref {\n");
 
9
                        printf("        node [shape=record];\n");
 
10
                }
 
11
 
 
12
(NF == 1) {             # starts a new node in the node file
 
13
                        Name[n_names++] = name = $1;
 
14
                        n_fields = 0;
 
15
                }
 
16
 
 
17
(NF == 2) {             # enters a field in the node file
 
18
                        if (($2 == "v") || (PROCS && ($2 == "p"))) {
 
19
                                Field[name,n_fields] = $2 ": " $1;
 
20
                                Field[name,$1] = n_fields;
 
21
                                n_fields++;
 
22
                        }
 
23
                }
 
24
 
 
25
(NF == 6) {             # an entry in the edge file. example:
 
26
                                # v BinaryNode left t - Tree
 
27
                        kind = $1;
 
28
                        if ((kind == "v") || (PROCS && (kind == "p"))) {
 
29
                                if (($2 != "-") && ($2 != $3))
 
30
                                        from = "\"" $2 "\".f0_1_" Field[$2,$3];
 
31
                                else from = "\"" $3 "\"";
 
32
 
 
33
                                if (($5 != "-") && ($5 != $6))
 
34
                                        to = "\"" $5 "\".f0_1_" Field[$5,$6];
 
35
                                else to = "\"" $6 "\"";
 
36
 
 
37
                                printf("\t%s -> %s;\n",from, to);
 
38
                        }
 
39
                }
 
40
 
 
41
END     {
 
42
                        for (i in Name) {
 
43
                                name = Name[i];
 
44
                                printf("\t\"%s\" [label=\"{%s{",name,name);
 
45
                                for (j = 0; Field[name,j] != ""; j++) {
 
46
                                        if (j > 0) printf("|");
 
47
                                        printf("%s",Field[name,j]);
 
48
                                }
 
49
                                printf("}}\"];\n");
 
50
                        }
 
51
                        printf("}\n");
 
52
                }