1
|
package com.goldencode.testcases;
|
2
|
|
3
|
import com.goldencode.p2j.util.*;
|
4
|
import com.goldencode.p2j.ui.*;
|
5
|
|
6
|
import static com.goldencode.p2j.util.BlockManager.*;
|
7
|
import static com.goldencode.p2j.util.ArrayAssigner.*;
|
8
|
import static com.goldencode.p2j.ui.LogicalTerminal.*;
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
public class DynamicExtentParamInit
|
15
|
{
|
16
|
integer[] i1 = new integer[0];
|
17
|
|
18
|
integer[] i3 = new integer[0];
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
|
24
|
public void execute()
|
25
|
{
|
26
|
externalProcedure(new Block()
|
27
|
{
|
28
|
public void init()
|
29
|
{
|
30
|
assignMulti(i1, new integer(0));
|
31
|
ArrayAssigner.registerDynamicArray(i1);
|
32
|
TransactionManager.register((Object) i1, (Object) i3);
|
33
|
assignMulti(i3, new integer(0));
|
34
|
ArrayAssigner.registerDynamicArray(i3);
|
35
|
}
|
36
|
|
37
|
public void body()
|
38
|
{
|
39
|
foo1(new ExtentExpr0());
|
40
|
ControlFlowOps.invokeWithMode("proc1", "U", new ExtentExpr1());
|
41
|
foo2(i1);
|
42
|
ControlFlowOps.invokeWithMode("proc2", "I", (Object) i1);
|
43
|
foo3(new ExtentExpr2());
|
44
|
ControlFlowOps.invokeWithMode("proc3", "O", new ExtentExpr3());
|
45
|
}
|
46
|
});
|
47
|
}
|
48
|
|
49
|
public integer foo1(final OutputExtentParameter<integer> extj)
|
50
|
{
|
51
|
return function(integer.class, new Block()
|
52
|
{
|
53
|
integer[] j = extj.getVariable(2);
|
54
|
|
55
|
public void init()
|
56
|
{
|
57
|
extj.setParameter(j, true);
|
58
|
TransactionManager.deregister(new Undoable[][]
|
59
|
{
|
60
|
j
|
61
|
});
|
62
|
}
|
63
|
|
64
|
public void body()
|
65
|
{
|
66
|
message(new Object[]
|
67
|
{
|
68
|
"foo1:",
|
69
|
j.length,
|
70
|
subscript(j, 1),
|
71
|
subscript(j, 2)
|
72
|
});
|
73
|
}
|
74
|
});
|
75
|
}
|
76
|
|
77
|
public void proc1(final OutputExtentParameter<integer> extj)
|
78
|
{
|
79
|
internalProcedure(new Block()
|
80
|
{
|
81
|
integer[] j = extj.getVariable(2);
|
82
|
|
83
|
public void init()
|
84
|
{
|
85
|
extj.setParameter(j, true);
|
86
|
TransactionManager.registerUndo(j);
|
87
|
}
|
88
|
|
89
|
public void body()
|
90
|
{
|
91
|
message(new Object[]
|
92
|
{
|
93
|
"proc1:",
|
94
|
j.length,
|
95
|
subscript(j, 1),
|
96
|
subscript(j, 2)
|
97
|
});
|
98
|
}
|
99
|
});
|
100
|
}
|
101
|
|
102
|
public integer foo2(final integer[] _j)
|
103
|
{
|
104
|
return function(integer.class, new Block()
|
105
|
{
|
106
|
integer[] j = ArrayAssigner.copyOf(_j);
|
107
|
|
108
|
public void body()
|
109
|
{
|
110
|
message(new Object[]
|
111
|
{
|
112
|
"foo2:",
|
113
|
j.length,
|
114
|
subscript(j, 1),
|
115
|
subscript(j, 2)
|
116
|
});
|
117
|
}
|
118
|
});
|
119
|
}
|
120
|
|
121
|
public void proc2(final integer[] _j)
|
122
|
{
|
123
|
internalProcedure(new Block()
|
124
|
{
|
125
|
integer[] j = ArrayAssigner.copyOf(_j);
|
126
|
|
127
|
public void init()
|
128
|
{
|
129
|
TransactionManager.registerUndo(j);
|
130
|
}
|
131
|
|
132
|
public void body()
|
133
|
{
|
134
|
message(new Object[]
|
135
|
{
|
136
|
"proc2:",
|
137
|
j.length,
|
138
|
subscript(j, 1),
|
139
|
subscript(j, 2)
|
140
|
});
|
141
|
}
|
142
|
});
|
143
|
}
|
144
|
|
145
|
public integer foo3(final OutputExtentParameter<integer> extj)
|
146
|
{
|
147
|
return function(integer.class, new Block()
|
148
|
{
|
149
|
integer[] j = extj.getVariable(2);
|
150
|
|
151
|
public void init()
|
152
|
{
|
153
|
extj.setParameter(j);
|
154
|
TransactionManager.deregister(new Undoable[][]
|
155
|
{
|
156
|
j
|
157
|
});
|
158
|
}
|
159
|
|
160
|
public void body()
|
161
|
{
|
162
|
message(new Object[]
|
163
|
{
|
164
|
"foo3:",
|
165
|
j.length,
|
166
|
subscript(j, 1),
|
167
|
subscript(j, 2)
|
168
|
});
|
169
|
}
|
170
|
});
|
171
|
}
|
172
|
|
173
|
public void proc3(final OutputExtentParameter<integer> extj)
|
174
|
{
|
175
|
internalProcedure(new Block()
|
176
|
{
|
177
|
integer[] j = extj.getVariable(2);
|
178
|
|
179
|
public void init()
|
180
|
{
|
181
|
extj.setParameter(j);
|
182
|
TransactionManager.registerUndo(j);
|
183
|
}
|
184
|
|
185
|
public void body()
|
186
|
{
|
187
|
message(new Object[]
|
188
|
{
|
189
|
"proc3:",
|
190
|
j.length,
|
191
|
subscript(j, 1),
|
192
|
subscript(j, 2)
|
193
|
});
|
194
|
}
|
195
|
});
|
196
|
}
|
197
|
|
198
|
private class ExtentExpr0
|
199
|
extends OutputExtentParameter<integer>
|
200
|
{
|
201
|
public integer[] getVariable()
|
202
|
{
|
203
|
return i1;
|
204
|
}
|
205
|
|
206
|
public void setVariable(final integer[] newRef)
|
207
|
{
|
208
|
i1 = newRef;
|
209
|
}
|
210
|
}
|
211
|
|
212
|
private class ExtentExpr1
|
213
|
extends OutputExtentParameter<integer>
|
214
|
{
|
215
|
public integer[] getVariable()
|
216
|
{
|
217
|
return i1;
|
218
|
}
|
219
|
|
220
|
public void setVariable(final integer[] newRef)
|
221
|
{
|
222
|
i1 = newRef;
|
223
|
}
|
224
|
}
|
225
|
|
226
|
private class ExtentExpr2
|
227
|
extends OutputExtentParameter<integer>
|
228
|
{
|
229
|
public integer[] getVariable()
|
230
|
{
|
231
|
return i3;
|
232
|
}
|
233
|
|
234
|
public void setVariable(final integer[] newRef)
|
235
|
{
|
236
|
i3 = newRef;
|
237
|
}
|
238
|
}
|
239
|
|
240
|
private class ExtentExpr3
|
241
|
extends OutputExtentParameter<integer>
|
242
|
{
|
243
|
public integer[] getVariable()
|
244
|
{
|
245
|
return i3;
|
246
|
}
|
247
|
|
248
|
public void setVariable(final integer[] newRef)
|
249
|
{
|
250
|
i3 = newRef;
|
251
|
}
|
252
|
}
|
253
|
}
|