1
|
<?xml version="1.0"?>
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
<cfg>
|
20
|
|
21
|
|
22
|
<worker class="com.goldencode.p2j.uast.ProgressPatternWorker"
|
23
|
namespace="prog" />
|
24
|
<worker class="com.goldencode.p2j.convert.ExpressionConversionWorker"
|
25
|
namespace="ecw" />
|
26
|
|
27
|
|
28
|
<include name="common-progress" />
|
29
|
<include name="report" />
|
30
|
|
31
|
|
32
|
<variable name="outputFilename" init="'output.txt'" />
|
33
|
<variable name="fid" init="#(long) (-1)" />
|
34
|
<variable name="dynFuncTargets" type="java.util.Set" />
|
35
|
<variable name="funcList" type="java.util.Map" />
|
36
|
<variable name="rtypeList" type="java.util.Set" />
|
37
|
<variable name="iter" type="java.util.Iterator" />
|
38
|
<variable name="titer" type="java.util.Iterator" />
|
39
|
<variable name="rtype" type="java.lang.String" />
|
40
|
<variable name="fname" type="java.lang.String" />
|
41
|
<variable name="ref" type="com.goldencode.ast.Aast" />
|
42
|
|
43
|
|
44
|
|
45
|
|
46
|
<init-rules>
|
47
|
<rule>dynFuncTargets = #(java.util.Set) create("java.util.HashSet")</rule>
|
48
|
<rule>funcList = #(java.util.Map) create("java.util.HashMap")</rule>
|
49
|
</init-rules>
|
50
|
|
51
|
|
52
|
|
53
|
|
54
|
<rule-set input="tree" >
|
55
|
<walk-rules>
|
56
|
<rule>
|
57
|
type == prog.func_poly and
|
58
|
#(java.lang.Long) this.getAnnotation("oldtype") == prog.kw_dyn_func
|
59
|
|
60
|
<action>ref = this.getChildAt(0)</action>
|
61
|
|
62
|
<rule>ref.type == prog.string
|
63
|
<action>fname = progressToJavaString(ref.text).toUpperCase()</action>
|
64
|
<action>dynFuncTargets.add(fname)</action>
|
65
|
</rule>
|
66
|
</rule>
|
67
|
<rule>type == prog.kw_funct and parent.type == prog.function
|
68
|
<action>fname = getNoteString("name").toUpperCase()</action>
|
69
|
<action>rtype = this.lookupTokenName(#(java.lang.Integer) getNoteLong("type"))</action>
|
70
|
<rule>funcList.containsKey(fname)
|
71
|
<action>rtypeList = #(java.util.Set) funcList.get(fname)</action>
|
72
|
<action>rtypeList.add(rtype)</action>
|
73
|
<action on="false">rtypeList = #(java.util.Set) create("java.util.HashSet")</action>
|
74
|
<action on="false">rtypeList.add(rtype)</action>
|
75
|
<action on="false">funcList.put(fname, rtypeList)</action>
|
76
|
</rule>
|
77
|
</rule>
|
78
|
</walk-rules>
|
79
|
</rule-set>
|
80
|
|
81
|
|
82
|
<post-rules>
|
83
|
<rule>deleteFile(outputFilename, false)</rule>
|
84
|
<rule>fid = openStream(outputFilename, true)</rule>
|
85
|
<rule>iter = dynFuncTargets.iterator()</rule>
|
86
|
<while>iter.hasNext()
|
87
|
<action>fname = #(java.lang.String) iter.next()</action>
|
88
|
<rule>funcList.containsKey(fname)
|
89
|
<action>rtypeList = #(java.util.Set) funcList.get(fname)</action>
|
90
|
<rule>rtypeList.size() == 1
|
91
|
<action>fprintf(fid, 'OK')</action>
|
92
|
<action on="false">fprintf(fid, 'BAD')</action>
|
93
|
</rule>
|
94
|
<action>fprintf(fid, ' %s', fname)</action>
|
95
|
<action>titer = rtypeList.iterator()</action>
|
96
|
<while>titer.hasNext()
|
97
|
<action>rtype = #(java.lang.String) titer.next()</action>
|
98
|
<action>fprintf(fid, ' %s', rtype)</action>
|
99
|
</while>
|
100
|
<action>fprintf(fid, '\n')</action>
|
101
|
<action on="false">fprintf(fid, 'NODEF %s\n', fname)</action>
|
102
|
</rule>
|
103
|
</while>
|
104
|
<rule>closeStream(fid)</rule>
|
105
|
</post-rules>
|
106
|
|
107
|
</cfg>
|