@@ -50,11 +50,11 @@ and a hashtable for each compilation unit.
50
50
$ mv impl-main__A. odocl main__A
51
51
$ mv impl-main__B. odocl main__B
52
52
$ mv impl-main__C. odocl main__C
53
- $ odoc count-occurrences -I main -o occurrences- main. odoc
54
- $ odoc count-occurrences -I main__ -o occurrences- main__. odoc
55
- $ odoc count-occurrences -I main__A -o occurrences- main__A. odoc
56
- $ odoc count-occurrences -I main__B -o occurrences- main__B. odoc
57
- $ odoc count-occurrences -I main__C -o occurrences- main__C. odoc
53
+ $ odoc count-occurrences main -o main. odoc-occurrences
54
+ $ odoc count-occurrences main__ -o main__. odoc-occurrences
55
+ $ odoc count-occurrences main__A -o main__A. odoc-occurrences
56
+ $ odoc count-occurrences main__B -o main__B. odoc-occurrences
57
+ $ odoc count-occurrences main__C -o main__C. odoc-occurrences
58
58
59
59
The occurrences_print executable, available only for testing, unmarshal the file
60
60
and prints the number of occurrences in a readable format.
@@ -65,18 +65,18 @@ Uses of C are not counted, since the canonical destination (Main.C, generated by
65
65
Uses of B. Z are not counted since they go to a hidden module.
66
66
Uses of values Y. x and Z . y (in b. ml) are not counted since they come from a " local" module.
67
67
68
- $ occurrences_print occurrences- main. odoc | sort
68
+ $ occurrences_print main. odoc-occurrences | sort
69
69
Main was used directly 0 times and indirectly 2 times
70
70
Main. A was used directly 1 times and indirectly 0 times
71
71
Main. B was used directly 1 times and indirectly 0 times
72
72
73
- $ occurrences_print occurrences- main__. odoc | sort
73
+ $ occurrences_print main__. odoc-occurrences | sort
74
74
75
75
A only uses " persistent" values : one it defines itself.
76
- $ occurrences_print occurrences- main__A. odoc | sort
76
+ $ occurrences_print main__A. odoc-occurrences | sort
77
77
78
78
" Aliased" values are not counted since they become persistent
79
- $ occurrences_print occurrences- main__B. odoc | sort
79
+ $ occurrences_print main__B. odoc-occurrences | sort
80
80
Main was used directly 0 times and indirectly 7 times
81
81
Main. A was used directly 2 times and indirectly 5 times
82
82
Main. A. (|| > ) was used directly 1 times and indirectly 0 times
@@ -85,21 +85,21 @@ A only uses "persistent" values: one it defines itself.
85
85
Main. A. x was used directly 1 times and indirectly 0 times
86
86
87
87
" Aliased" values are not counted since they become persistent
88
- $ occurrences_print occurrences- main__C. odoc | sort
88
+ $ occurrences_print main__C. odoc-occurrences | sort
89
89
Main was used directly 0 times and indirectly 2 times
90
90
Main. A was used directly 1 times and indirectly 1 times
91
91
Main. A. x was used directly 1 times and indirectly 0 times
92
92
93
93
Now we can merge all tables
94
94
95
95
$ cat > files. map << EOF
96
- > occurrences- main__A. odoc
97
- > occurrences- main__B. odoc
98
- > occurrences- main__C. odoc
96
+ > main__A. odoc-occurrences
97
+ > main__B. odoc-occurrences
98
+ > main__C. odoc-occurrences
99
99
> EOF
100
- $ odoc aggregate-occurrences occurrences- main. odoc occurrences- main__. odoc -- file-list files. map -o occurrences- aggregated. odoc
100
+ $ odoc aggregate-occurrences main. odoc-occurrences main__. odoc-occurrences -- file-list files. map -o aggregated. odoc-occurrences
101
101
102
- $ occurrences_print occurrences- aggregated. odoc | sort > all_merged
102
+ $ occurrences_print aggregated. odoc-occurrences | sort > all_merged
103
103
$ cat all_merged
104
104
Main was used directly 0 times and indirectly 11 times
105
105
Main. A was used directly 4 times and indirectly 6 times
@@ -111,14 +111,14 @@ Now we can merge all tables
111
111
112
112
Compare with the one created directly with all occurrences:
113
113
114
- $ odoc count-occurrences -I . -o occurrences- all. odoc
115
- $ occurrences_print occurrences- all. odoc | sort > directly_all
114
+ $ odoc count-occurrences . -o all . odoc-occurrences
115
+ $ occurrences_print all . odoc-occurrences | sort > directly_all
116
116
$ diff all_merged directly_all
117
117
118
118
We can also include hidden ids:
119
119
120
- $ odoc count-occurrences -I main__B -o occurrences- b. odoc -- include-hidden
121
- $ occurrences_print occurrences- b. odoc | sort
120
+ $ odoc count-occurrences main__B -o b. odoc-occurrences -- include-hidden
121
+ $ occurrences_print b. odoc-occurrences | sort
122
122
Main was used directly 0 times and indirectly 7 times
123
123
Main. A was used directly 2 times and indirectly 5 times
124
124
Main. A. (|| > ) was used directly 1 times and indirectly 0 times
@@ -129,8 +129,8 @@ We can also include hidden ids:
129
129
Main__. C was used directly 1 times and indirectly 1 times
130
130
Main__. C. y was used directly 1 times and indirectly 0 times
131
131
132
- $ odoc count-occurrences -I . -o occurrences- all. odoc -- include-hidden
133
- $ occurrences_print occurrences- all. odoc | sort
132
+ $ odoc count-occurrences . -o all . odoc-occurrences -- include-hidden
133
+ $ occurrences_print all . odoc-occurrences | sort
134
134
Main was used directly 0 times and indirectly 11 times
135
135
Main. A was used directly 4 times and indirectly 6 times
136
136
Main. A. (|| > ) was used directly 1 times and indirectly 0 times
@@ -149,7 +149,7 @@ We can use the generated table when generating the json output:
149
149
150
150
$ odoc link -I . main. odoc
151
151
152
- $ odoc compile-index -- json -o index . json -- occurrences occurrences- all. odoc main. odocl
152
+ $ odoc compile-index -- json -o index . json -- occurrences all . odoc-occurrences main. odocl
153
153
154
154
$ cat index . json | jq sort | jq ' .[]' -c
155
155
{" id" : [{" kind" : " Root" ," name" : " Main" }]," doc" : " Handwritten top-level module" ," kind" : {" kind" : " Module" }," display" : {" url" : " Main/index.html" ," html" : " <code class=\" entry-kind\" >mod</code><code class=\" entry-title\" ><span class=\" entry-name\" >Main</span></code><div class=\" entry-comment\" ><div><p>Handwritten top-level module</p></div></div>" }," occurrences" : {" direct" : 0 ," indirect" : 11 }}
0 commit comments