Debian Codegraph @

test/profile2.ok

raw
1 # BEGIN rule(s)
2
3 BEGIN {
4 1 if (sortcmd == "") {
5 sortcmd = "sort"
6 }
7 1 asplit("BEGIN:END:atan2:break:close:continue:cos:delete:" "do:else:exit:exp:for:getline:gsub:if:in:index:int:" "length:log:match:next:print:printf:rand:return:sin:" "split:sprintf:sqrt:srand:sub:substr:system:while", keywords, ":")
8 1 split("00:00:00:00:00:00:00:00:00:00:" "20:10:10:12:12:11:07:00:00:00:" "08:08:08:08:08:33:08:00:00:00:" "08:44:08:36:08:08:08:00:00:00:" "08:44:45:42:42:41:08", machine, ":")
9 1 state = 1
10 570 for (;;) {
11 570 symb = lex()
12 570 nextstate = substr(machine[state symb], 1, 1)
13 570 act = substr(machine[state symb], 2, 1)
14 570 if (act == "0") { # 12
15 558 } else if (act == "1") { # 8
16 8 if (! inarray(tok, names)) { # 3
17 3 names[++nnames] = tok
18 }
19 8 lines[tok, ++xnames[tok]] = NR
20 550 } else if (act == "2") { # 425
21 425 if (tok in local) { # 309
22 309 tok = tok "(" funcname ")"
23 309 if (! inarray(tok, names)) { # 22
24 22 names[++nnames] = tok
25 }
26 309 lines[tok, ++xnames[tok]] = NR
27 116 } else {
28 116 tok = tok "()"
29 116 if (! inarray(tok, names)) { # 21
30 21 names[++nnames] = tok
31 }
32 116 lines[tok, ++xnames[tok]] = NR
33 }
34 125 } else if (act == "3") { # 4
35 4 funcname = tok
36 4 flines[tok] = NR
37 121 } else if (act == "4") { # 49
38 49 braces++
39 72 } else if (act == "5") { # 49
40 49 braces--
41 49 if (braces == 0) { # 4
42 22 for (temp in local) {
43 22 delete local[temp]
44 }
45 4 funcname = ""
46 4 nextstate = 1
47 }
48 23 } else if (act == "6") { # 22
49 22 local[tok] = 1
50 1 } else if (act == "7") { # 1
51 1 break
52 } else if (act == "8") {
53 print("error: xref.awk: line " NR ": aborting") > "/dev/con"
54 exit 1
55 }
56 569 state = nextstate
57 }
58 46 for (i = 1; i <= nnames; i++) {
59 46 printf("%d ", xnames[names[i]]) | sortcmd
60 46 if (index(names[i], "(") == 0) { # 3
61 3 printf("%s(%d)", names[i], flines[names[i]]) | sortcmd
62 43 } else {
63 43 printf("%s", names[i]) | sortcmd
64 }
65 433 for (j = 1; j <= xnames[names[i]]; j++) {
66 433 if (lines[names[i], j] != lines[names[i], j - 1]) { # 389
67 389 printf(" %d", lines[names[i], j]) | sortcmd
68 }
69 }
70 46 printf("\n") | sortcmd
71 }
72 1 close(sortcmd)
73 }
74
75 # Functions, listed alphabetically
76
77 1 function asplit(str, arr, fs, n)
78 {
79 1 n = split(str, temp_asplit, fs)
80 36 for (i = 1; i <= n; i++) {
81 36 arr[temp_asplit[i]]++
82 }
83 }
84
85 433 function inarray(val, arr, j, tmp)
86 {
87 15872 for (j in arr) {
88 15872 tmp[arr[j]]++
89 }
90 433 return (val in tmp)
91 }
92
93 570 function lex()
94 {
95 1698 for (;;) {
96 1698 if (tok == "(eof)") {
97 return 7
98 }
99 326 while (length(line) == 0) {
100 326 if ((getline line) == 0) { # 1
101 1 tok = "(eof)"
102 1 return 7
103 }
104 }
105 1697 sub(/^[ \t]+/, "", line)
106 1697 sub(/^"([^"]|\\")*"/, "", line)
107 1697 sub(/^\/([^\/]|\\\/)+\//, "", line)
108 1697 sub(/^#.*/, "", line)
109 1697 if (line ~ /^function/) { # 4
110 4 tok = "function"
111 4 line = substr(line, 9)
112 4 return 1
113 1693 } else if (line ~ /^{/) { # 53
114 53 tok = "{"
115 53 line = substr(line, 2)
116 53 return 2
117 1640 } else if (line ~ /^}/) { # 53
118 53 tok = "}"
119 53 line = substr(line, 2)
120 53 return 3
121 1587 } else if (match(line, /^[[:alpha:]_][[:alnum:]_]*\[/)) { # 43
122 43 tok = substr(line, 1, RLENGTH - 1)
123 43 line = substr(line, RLENGTH + 1)
124 43 return 5
125 1544 } else if (match(line, /^[[:alpha:]_][[:alnum:]_]*\(/)) { # 87
126 87 tok = substr(line, 1, RLENGTH - 1)
127 87 line = substr(line, RLENGTH + 1)
128 87 if (! (tok in keywords)) { # 12
129 12 return 6
130 }
131 1457 } else if (match(line, /^[[:alpha:]_][[:alnum:]_]*/)) { # 521
132 521 tok = substr(line, 1, RLENGTH)
133 521 line = substr(line, RLENGTH + 1)
134 521 if (! (tok in keywords)) { # 404
135 404 return 4
136 }
137 936 } else {
138 936 match(line, /^[^[:alpha:]_{}]/)
139 936 tok = substr(line, 1, RLENGTH)
140 936 line = substr(line, RLENGTH + 1)
141 }
142 }
143 }