wneuper@4723
|
1 |
/*
|
wneuper@4723
|
2 |
* @author Walther Neuper
|
wneuper@4723
|
3 |
* Copyright (c) due to license terms
|
wneuper@4723
|
4 |
* Created on Jul 14, 2015
|
wneuper@4723
|
5 |
* Institute for Softwaretechnology, Graz University of Technology, Austria.
|
wneuper@4723
|
6 |
*/
|
wneuper@4723
|
7 |
|
wneuper@4723
|
8 |
package isac.bridge.xml
|
wneuper@4723
|
9 |
|
wneuper@4788
|
10 |
import isac.bridge.CChanged
|
wneuper@4788
|
11 |
import isac.bridge.CEvent
|
wneuper@4729
|
12 |
import isac.bridge.CMessage
|
wneuper@4791
|
13 |
import isac.util.formulae.Assumptions
|
wneuper@4729
|
14 |
import isac.util.formulae.CalcFormula
|
wneuper@4729
|
15 |
import isac.util.formulae.CalcHead
|
wneuper@4729
|
16 |
import isac.util.formulae.CalcHeadSimpleID
|
wneuper@4802
|
17 |
import isac.util.formulae.Context
|
wneuper@4789
|
18 |
import isac.util.formulae.ContextTheory
|
wneuper@4729
|
19 |
import isac.util.formulae.Formula
|
wneuper@4729
|
20 |
import isac.util.formulae.HierarchyKey
|
wneuper@4802
|
21 |
import isac.util.formulae.KEStoreKey
|
wneuper@4729
|
22 |
import isac.util.formulae.Model
|
wneuper@4729
|
23 |
import isac.util.formulae.ModelItem
|
wneuper@4729
|
24 |
import isac.util.formulae.ModelItemList
|
wneuper@4723
|
25 |
import isac.util.formulae.Position
|
wneuper@4729
|
26 |
import isac.util.formulae.Specification
|
wneuper@4729
|
27 |
import isac.util.Message
|
wneuper@4723
|
28 |
|
walther@5239
|
29 |
import edu.tum.cs.isabelle.api.XML
|
wneuper@4729
|
30 |
|
wneuper@4723
|
31 |
import java.util.ArrayList
|
wneuper@4723
|
32 |
import java.util.Vector
|
wneuper@4723
|
33 |
import java.math.BigInteger
|
wneuper@4723
|
34 |
import scala.math.BigInt
|
wneuper@4723
|
35 |
import scala.collection.JavaConverters._
|
wneuper@4723
|
36 |
|
wneuper@4760
|
37 |
/**
|
wneuper@4760
|
38 |
* Convert results of JSystem.invoke(Operations.* to Java-objects.
|
wneuper@4760
|
39 |
* Conversions use Scala's pattern matching, which is not available in Java.
|
wneuper@4760
|
40 |
*
|
wneuper@4760
|
41 |
* The sequence in the kernel's signature below is maintained.
|
wneuper@4760
|
42 |
*/
|
wneuper@4723
|
43 |
object IsaToJava {
|
wneuper@4760
|
44 |
|
wneuper@4793
|
45 |
//is the tree (expected to contain data going to Dialog) a message ?
|
wneuper@4793
|
46 |
// CALCMESSAGE is excluded, because this goes to Dialog as CCEvent
|
wneuper@4793
|
47 |
def is_message(t: XML.Tree): java.lang.Boolean = t match {
|
wneuper@4793
|
48 |
case
|
wneuper@4848
|
49 |
XML.Elem(("MESSAGE", Nil), List(
|
wneuper@4848
|
50 |
XML.Elem(("CALCID", Nil), List(XML.Text (_))),
|
wneuper@4848
|
51 |
XML.Elem(("STRING", Nil), List(XML.Text (_))))) => true
|
wneuper@4793
|
52 |
case
|
wneuper@4848
|
53 |
XML.Elem(("SYSERROR", Nil), List(
|
wneuper@4848
|
54 |
XML.Elem(("CALCID", Nil), List(XML.Text (_))),
|
wneuper@4848
|
55 |
XML.Elem(("ERROR", Nil), List(XML.Text (_))))) => true
|
wneuper@4793
|
56 |
case
|
wneuper@4848
|
57 |
XML.Elem((_/*"SETNEXTTACTIC"*/, Nil), List(
|
wneuper@4848
|
58 |
XML.Elem(("CALCID", Nil), List(XML.Text (_))),
|
wneuper@4848
|
59 |
XML.Elem(("MESSAGE", Nil), List(XML.Text (_))))) => true
|
wneuper@4793
|
60 |
case _ => false //expected data going to Dialog
|
wneuper@4793
|
61 |
}
|
wneuper@4806
|
62 |
def is_syserror(t: XML.Tree): java.lang.Boolean = t match {
|
wneuper@4806
|
63 |
case
|
wneuper@4848
|
64 |
XML.Elem(("SYSERROR", Nil), List(
|
wneuper@4848
|
65 |
XML.Elem(("CALCID", Nil), List(XML.Text (_))),
|
wneuper@4848
|
66 |
XML.Elem(("ERROR", Nil), List(XML.Text (_))))) => true
|
wneuper@4806
|
67 |
case _ => false
|
wneuper@4806
|
68 |
}
|
wneuper@4793
|
69 |
|
wneuper@4787
|
70 |
/* from isabisac/src/Tools/Frontend/interface.sml + XML generation
|
wneuper@4760
|
71 |
signature MATH_ENGINE =
|
wneuper@4760
|
72 |
sig
|
wneuper@4760
|
73 |
val appendFormula : calcID -> cterm' -> XML.tree
|
wneuper@4787
|
74 |
appendformulaOK2xml
|
wneuper@4787
|
75 |
appendformulaERROR2xml
|
wneuper@4787
|
76 |
sysERROR2xml
|
wneuper@4760
|
77 |
val autoCalculate : calcID -> auto -> XML.tree
|
wneuper@4787
|
78 |
autocalculateOK2xml
|
wneuper@4787
|
79 |
autocalculateERROR2xml
|
wneuper@4787
|
80 |
sysERROR2xml
|
wneuper@4760
|
81 |
val applyTactic : calcID -> pos' -> tac -> XML.tree
|
wneuper@4787
|
82 |
autocalculateOK2xml
|
wneuper@4787
|
83 |
autocalculateERROR2xml
|
wneuper@4760
|
84 |
val CalcTree : fmz list -> XML.tree
|
wneuper@4787
|
85 |
calctreeOK2xml
|
wneuper@4787
|
86 |
sysERROR2xml
|
wneuper@4760
|
87 |
val checkContext : calcID -> pos' -> guh -> XML.tree
|
wneuper@4787
|
88 |
message2xml
|
wneuper@4787
|
89 |
contextthyOK2xml
|
wneuper@4787
|
90 |
sysERROR2xml
|
wneuper@4760
|
91 |
val DEconstrCalcTree : calcID -> XML.tree
|
wneuper@4787
|
92 |
deconstructcalctreeOK2xml
|
wneuper@4760
|
93 |
val fetchApplicableTactics : calcID -> int -> pos' -> XML.tree
|
wneuper@4787
|
94 |
applicabletacticsOK
|
wneuper@4787
|
95 |
sysERROR2xml
|
wneuper@4760
|
96 |
val fetchProposedTactic : calcID -> XML.tree
|
wneuper@4787
|
97 |
fetchproposedtacticOK2xml
|
wneuper@4787
|
98 |
fetchproposedtacticERROR2xml
|
wneuper@4787
|
99 |
sysERROR2xml
|
wneuper@4760
|
100 |
val findFillpatterns : calcID -> errpatID -> XML.tree
|
wneuper@4787
|
101 |
findFillpatterns2xml
|
wneuper@4760
|
102 |
val getAccumulatedAsms : calcID -> pos' -> XML.tree
|
wneuper@4787
|
103 |
getasmsOK2xml
|
wneuper@4787
|
104 |
sysERROR2xml
|
wneuper@4760
|
105 |
val getActiveFormula : calcID -> XML.tree
|
wneuper@4787
|
106 |
iteratorOK2xml
|
wneuper@4760
|
107 |
val getAssumptions : calcID -> pos' -> XML.tree
|
wneuper@4787
|
108 |
getasmsOK2xml
|
wneuper@4787
|
109 |
sysERROR2xml
|
wneuper@4760
|
110 |
val getFormulaeFromTo : calcID -> pos' -> pos' -> int -> bool -> XML.tree
|
wneuper@4787
|
111 |
getintervalOK
|
wneuper@4787
|
112 |
sysERROR2xml
|
wneuper@4760
|
113 |
val getTactic : calcID -> pos' -> XML.tree
|
wneuper@4787
|
114 |
gettacticOK2xml
|
wneuper@4787
|
115 |
gettacticERROR2xml
|
wneuper@4787
|
116 |
sysERROR2xml
|
wneuper@4760
|
117 |
val initContext : calcID -> ketype -> pos' -> XML.tree
|
wneuper@4787
|
118 |
message2xml
|
wneuper@4787
|
119 |
contextthyOK2xml
|
wneuper@4787
|
120 |
sysERROR2xml
|
wneuper@4760
|
121 |
val inputFillFormula: calcID -> string -> XML.tree
|
wneuper@4787
|
122 |
autocalculateOK2xml
|
wneuper@4787
|
123 |
autocalculateERROR2xml
|
wneuper@4787
|
124 |
message2xml
|
wneuper@4760
|
125 |
val interSteps : calcID -> pos' -> XML.tree
|
wneuper@4787
|
126 |
interStepsOK
|
wneuper@4787
|
127 |
interStepsERROR
|
wneuper@4787
|
128 |
sysERROR2xml
|
wneuper@4760
|
129 |
val Iterator : calcID -> XML.tree
|
wneuper@4787
|
130 |
adduserOK2xml
|
wneuper@4787
|
131 |
sysERROR2xml
|
wneuper@4760
|
132 |
val IteratorTEST : calcID -> iterID
|
wneuper@4760
|
133 |
val modelProblem : calcID -> XML.tree
|
wneuper@4787
|
134 |
modifycalcheadOK2xml
|
wneuper@4787
|
135 |
sysERROR2xml
|
wneuper@4760
|
136 |
val modifyCalcHead : calcID -> icalhd -> XML.tree
|
wneuper@4787
|
137 |
modifycalcheadOK2xml
|
wneuper@4787
|
138 |
sysERROR2xml
|
wneuper@4760
|
139 |
val moveActiveCalcHead : calcID -> XML.tree
|
wneuper@4787
|
140 |
iteratorOK2xml
|
wneuper@4787
|
141 |
sysERROR2xml
|
wneuper@4760
|
142 |
val moveActiveDown : calcID -> XML.tree
|
wneuper@4787
|
143 |
iteratorOK2xml
|
wneuper@4787
|
144 |
iteratorERROR2xml
|
wneuper@4787
|
145 |
sysERROR2xml
|
wneuper@4760
|
146 |
val moveActiveFormula : calcID -> pos' -> XML.tree
|
wneuper@4787
|
147 |
iteratorOK2xml
|
wneuper@4787
|
148 |
sysERROR2xml
|
wneuper@4760
|
149 |
val moveActiveLevelDown : calcID -> XML.tree
|
wneuper@4787
|
150 |
iteratorOK2xml
|
wneuper@4787
|
151 |
iteratorERROR2xml
|
wneuper@4787
|
152 |
sysERROR2xml
|
wneuper@4760
|
153 |
val moveActiveLevelUp : calcID -> XML.tree
|
wneuper@4787
|
154 |
iteratorOK2xml
|
wneuper@4787
|
155 |
iteratorERROR2xml
|
wneuper@4787
|
156 |
sysERROR2xml
|
wneuper@4760
|
157 |
val moveActiveRoot : calcID -> XML.tree
|
wneuper@4787
|
158 |
iteratorOK2xml
|
wneuper@4787
|
159 |
sysERROR2xml
|
wneuper@4760
|
160 |
val moveActiveRootTEST : calcID -> XML.tree
|
wneuper@4760
|
161 |
val moveActiveUp : calcID -> XML.tree
|
wneuper@4787
|
162 |
iteratorOK2xml
|
wneuper@4787
|
163 |
iteratorERROR2xml
|
wneuper@4787
|
164 |
sysERROR2xml
|
wneuper@4760
|
165 |
val moveCalcHead : calcID -> pos' -> XML.tree
|
wneuper@4787
|
166 |
iteratorOK2xml
|
wneuper@4787
|
167 |
iteratorERROR2xml
|
wneuper@4787
|
168 |
sysERROR2xml
|
wneuper@4760
|
169 |
val moveDown : calcID -> pos' -> XML.tree
|
wneuper@4787
|
170 |
iteratorOK2xml
|
wneuper@4787
|
171 |
iteratorERROR2xml
|
wneuper@4787
|
172 |
sysERROR2xml
|
wneuper@4760
|
173 |
val moveLevelDown : calcID -> pos' -> XML.tree
|
wneuper@4787
|
174 |
iteratorOK2xml
|
wneuper@4787
|
175 |
iteratorERROR2xml
|
wneuper@4787
|
176 |
sysERROR2xml
|
wneuper@4760
|
177 |
val moveLevelUp : calcID -> pos' -> XML.tree
|
wneuper@4787
|
178 |
iteratorOK2xml
|
wneuper@4787
|
179 |
iteratorERROR2xml
|
wneuper@4787
|
180 |
sysERROR2xml
|
wneuper@4760
|
181 |
val moveRoot : calcID -> XML.tree
|
wneuper@4787
|
182 |
iteratorOK2xml
|
wneuper@4787
|
183 |
sysERROR2xml
|
wneuper@4760
|
184 |
val moveUp : calcID -> pos' -> XML.tree
|
wneuper@4787
|
185 |
iteratorOK2xml
|
wneuper@4787
|
186 |
iteratorERROR2xml
|
wneuper@4787
|
187 |
sysERROR2xml
|
wneuper@4760
|
188 |
val refFormula : calcID -> pos' -> XML.tree
|
wneuper@4787
|
189 |
refformulaOK2xml
|
wneuper@4787
|
190 |
sysERROR2xml
|
wneuper@4760
|
191 |
val refineProblem : calcID -> pos' -> guh -> XML.tree
|
wneuper@4787
|
192 |
xml_of_matchpbl
|
wneuper@4787
|
193 |
sysERROR2xml
|
wneuper@4760
|
194 |
val replaceFormula : calcID -> cterm' -> XML.tree
|
wneuper@4787
|
195 |
replaceformulaOK2xml
|
wneuper@4787
|
196 |
replaceformulaERROR2xml
|
wneuper@4787
|
197 |
sysERROR2xml
|
wneuper@4760
|
198 |
val requestFillformula : calcID -> errpatID * fillpatID -> XML.tree
|
wneuper@4787
|
199 |
autocalculateOK2xml
|
wneuper@4787
|
200 |
autocalculateERROR2xml
|
wneuper@4760
|
201 |
val resetCalcHead : calcID -> XML.tree
|
wneuper@4787
|
202 |
modifycalcheadOK2xml
|
wneuper@4787
|
203 |
sysERROR2xml
|
wneuper@4760
|
204 |
val setContext : calcID -> pos' -> guh -> XML.tree
|
wneuper@4787
|
205 |
message2xml
|
wneuper@4787
|
206 |
autocalculateOK2xml
|
wneuper@4787
|
207 |
sysERROR2xml
|
wneuper@4760
|
208 |
val setMethod : calcID -> metID -> XML.tree
|
wneuper@4787
|
209 |
modifycalcheadOK2xml
|
wneuper@4787
|
210 |
sysERROR2xml
|
wneuper@4760
|
211 |
val setNextTactic : calcID -> tac -> XML.tree
|
wneuper@4787
|
212 |
setnexttactic2xml
|
wneuper@4787
|
213 |
sysERROR2xml
|
wneuper@4760
|
214 |
val setProblem : calcID -> pblID -> XML.tree
|
wneuper@4787
|
215 |
modifycalcheadOK2xml
|
wneuper@4787
|
216 |
sysERROR2xml
|
wneuper@4760
|
217 |
val setTheory : calcID -> thyID -> XML.tree
|
wneuper@4787
|
218 |
modifycalcheadOK2xml
|
wneuper@4787
|
219 |
sysERROR2xml
|
wneuper@4760
|
220 |
end
|
wneuper@4760
|
221 |
*/
|
wneuper@4792
|
222 |
|
wneuper@4760
|
223 |
//fun appendFormula : calcID -> cterm' -> XML.tree
|
wneuper@4788
|
224 |
def append_form_out(t: XML.Tree): IntCEvent = t match {
|
wneuper@4787
|
225 |
case
|
wneuper@4848
|
226 |
XML.Elem(("APPENDFORMULA", Nil), List(
|
wneuper@4848
|
227 |
XML.Elem(("CALCID", Nil), List(XML.Text (calcid))),
|
wneuper@4788
|
228 |
cevent_xml))
|
wneuper@4788
|
229 |
=> new IntCEvent(new java.lang.Integer(calcid),
|
wneuper@4788
|
230 |
DataTypes.xml_to_CEvent(cevent_xml))
|
wneuper@4804
|
231 |
case _ => throw new IllegalArgumentException("append_form_out wrong arg: " + t)
|
wneuper@4787
|
232 |
}
|
wneuper@4759
|
233 |
|
wneuper@4760
|
234 |
//fun autoCalculate : calcID -> auto -> XML.tree
|
wneuper@4788
|
235 |
def auto_calc_out(t: XML.Tree): IntCEvent = t match {
|
wneuper@4723
|
236 |
case
|
wneuper@4848
|
237 |
XML.Elem(("AUTOCALC", Nil), List(
|
wneuper@4848
|
238 |
XML.Elem(("CALCID", Nil), List(XML.Text (calcid))),
|
wneuper@4788
|
239 |
cevent_xml))
|
wneuper@4788
|
240 |
=> new IntCEvent(new java.lang.Integer(calcid),
|
wneuper@4788
|
241 |
DataTypes.xml_to_CEvent(cevent_xml))
|
wneuper@4752
|
242 |
case _ => throw new IllegalArgumentException("auto_calc_out wrong arg: " + t)
|
wneuper@4723
|
243 |
}
|
wneuper@4729
|
244 |
|
wneuper@4787
|
245 |
//fun applyTactic : calcID -> pos' -> tac -> XML.tree ...NOT IMPL. IN isac-java WN150813
|
wneuper@4760
|
246 |
|
wneuper@4760
|
247 |
//fun CalcTree : fmz list -> XML.tree
|
wneuper@4760
|
248 |
def calc_tree_out(t: XML.Tree): java.lang.Integer = t match {
|
wneuper@4760
|
249 |
case
|
wneuper@4848
|
250 |
XML.Elem(("CALCTREE", Nil), List(
|
wneuper@4848
|
251 |
XML.Elem(("CALCID", Nil), List(XML.Text(i)))))
|
wneuper@4760
|
252 |
=> new Integer(i)
|
wneuper@4760
|
253 |
case //TODO catch in Java
|
wneuper@4848
|
254 |
XML.Elem(("SYSERROR", Nil), List(
|
wneuper@4848
|
255 |
XML.Elem(("CALCID", Nil), List(XML.Text(i))),
|
wneuper@4848
|
256 |
XML.Elem(("ERROR", Nil), List(XML.Text(msg)))))
|
wneuper@4760
|
257 |
=> throw new IllegalArgumentException("calc_tree_out SYSERROR wrong arg: " + t)
|
wneuper@4760
|
258 |
case _ => throw new IllegalArgumentException("calc_tree_out wrong arg: " + t)
|
wneuper@4760
|
259 |
}
|
wneuper@4760
|
260 |
|
wneuper@4789
|
261 |
//fun checkContext : calcID -> pos' -> guh -> XML.tree
|
wneuper@4789
|
262 |
def check_ctxt_out(t: XML.Tree): ContextTheory = t match {
|
wneuper@4789
|
263 |
case
|
wneuper@4848
|
264 |
XML.Elem(("CONTEXTTHY", Nil), List(
|
wneuper@4848
|
265 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4825
|
266 |
contthy_xml))
|
wneuper@4789
|
267 |
=> DataTypes.xml_to_ContextTheory(contthy_xml)
|
wneuper@4808
|
268 |
case _ => throw new IllegalArgumentException("check_ctxt_out wrong arg: " + t)
|
wneuper@4789
|
269 |
}
|
wneuper@4760
|
270 |
|
wneuper@4760
|
271 |
//fun DEconstrCalcTree : calcID -> XML.tree
|
wneuper@4760
|
272 |
def del_calc_out(t: XML.Tree): java.lang.Integer = t match {
|
wneuper@4760
|
273 |
case
|
wneuper@4848
|
274 |
XML.Elem(("DELCALC", Nil), List(
|
wneuper@4848
|
275 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid)))))
|
wneuper@4760
|
276 |
=> new java.lang.Integer(calcid)
|
wneuper@4760
|
277 |
case _ => throw new IllegalArgumentException("del_calc_out wrong arg: " + t)
|
wneuper@4760
|
278 |
}
|
wneuper@4760
|
279 |
|
wneuper@4760
|
280 |
//fun fetchApplicableTactics : calcID -> int -> pos' -> XML.tree
|
wneuper@4787
|
281 |
def fetch_applicable_tacs_out(t: XML.Tree): IntTactics = t match {
|
wneuper@4787
|
282 |
case
|
wneuper@4848
|
283 |
XML.Elem(("APPLICABLETACTICS", Nil), List(
|
wneuper@4848
|
284 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4787
|
285 |
tacs_xml))
|
wneuper@4787
|
286 |
=> new IntTactics(new java.lang.Integer(calcid),
|
wneuper@4787
|
287 |
DataTypes.xml_to_VectorTactic(tacs_xml))
|
wneuper@4808
|
288 |
case _ => throw new IllegalArgumentException("fetch_applicable_tacs_out wrong arg: " + t)
|
wneuper@4787
|
289 |
}
|
wneuper@4787
|
290 |
|
wneuper@4760
|
291 |
//fun fetchProposedTactic : calcID -> XML.tree
|
wneuper@4787
|
292 |
def fetch_proposed_tac_out(t: XML.Tree): IntTacticErrPats = t match {
|
wneuper@4787
|
293 |
case
|
wneuper@4848
|
294 |
XML.Elem(("NEXTTAC", Nil), List(
|
wneuper@4848
|
295 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4848
|
296 |
XML.Elem(("TACTICERRORPATTERNS", Nil), List(errpat_ids)),
|
wneuper@4787
|
297 |
tac))
|
wneuper@4787
|
298 |
=> new IntTacticErrPats(new java.lang.Integer(calcid),
|
wneuper@4787
|
299 |
DataTypes.xml_to_VectorString(errpat_ids), DataTypes.xml_to_Tactic(tac))
|
wneuper@4808
|
300 |
case _ => throw new IllegalArgumentException("fetch_proposed_tac_out wrong arg: " + t)
|
wneuper@4787
|
301 |
}
|
wneuper@4808
|
302 |
|
wneuper@4760
|
303 |
//fun findFillpatterns : calcID -> errpatID -> XML.tree
|
wneuper@4787
|
304 |
//... only implemented in Math_Engine
|
wneuper@4787
|
305 |
|
wneuper@4788
|
306 |
//fun getAccumulatedAsms : calcID -> pos' -> XML.tree
|
wneuper@4788
|
307 |
def get_accumulated_asms_out(t: XML.Tree): IntAssumptions = t match {
|
wneuper@4788
|
308 |
case
|
wneuper@4848
|
309 |
XML.Elem(("ASSUMPTIONS", Nil), List(
|
wneuper@4848
|
310 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4848
|
311 |
XML.Elem(("ASMLIST", Nil), asms)))
|
wneuper@4788
|
312 |
=> new IntAssumptions(new java.lang.Integer(calcid),
|
wneuper@4928
|
313 |
new Assumptions(DataTypes.sListToVectorFormula(asms map DataTypes.xml_to_Formula_NEW)))
|
wneuper@4788
|
314 |
case _ => throw new IllegalArgumentException("get_accumulated_asms_out wrong arg: " + t)
|
wneuper@4788
|
315 |
}
|
wneuper@4787
|
316 |
|
wneuper@4760
|
317 |
//fun getActiveFormula : calcID -> XML.tree
|
wneuper@4788
|
318 |
def get_active_form_out(t: XML.Tree): IntPosition = t match {
|
wneuper@4788
|
319 |
case
|
wneuper@4848
|
320 |
XML.Elem(("CALCITERATOR", Nil), List(
|
wneuper@4848
|
321 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4788
|
322 |
pos_xml))
|
wneuper@4788
|
323 |
=> new IntPosition(new java.lang.Integer(calcid),
|
wneuper@4788
|
324 |
DataTypes.xml_to_Position(pos_xml))
|
wneuper@4788
|
325 |
case _ => throw new IllegalArgumentException("get_SOME_Iterator wrong arg: " + t)
|
wneuper@4788
|
326 |
}
|
wneuper@4788
|
327 |
|
wneuper@4760
|
328 |
//fun getAssumptions : calcID -> pos' -> XML.tree
|
wneuper@4788
|
329 |
def get_asms_out(t: XML.Tree): IntAssumptions = t match {
|
wneuper@4788
|
330 |
case
|
wneuper@4848
|
331 |
XML.Elem(("ASSUMPTIONS", Nil), List(
|
wneuper@4848
|
332 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4848
|
333 |
XML.Elem(("ASMLIST", Nil), asms)))
|
wneuper@4788
|
334 |
=> new IntAssumptions(new java.lang.Integer(calcid),
|
wneuper@4928
|
335 |
new Assumptions(DataTypes.sListToVectorFormula(asms map DataTypes.xml_to_Formula_NEW)))
|
wneuper@4788
|
336 |
case _ => throw new IllegalArgumentException("get_asms wrong arg: " + t)
|
wneuper@4788
|
337 |
}
|
wneuper@4760
|
338 |
|
wneuper@4760
|
339 |
//fun getFormulaeFromTo : calcID -> pos' -> pos' -> int -> bool -> XML.tree
|
wneuper@4760
|
340 |
def get_formulae_out(t: XML.Tree): IntFormulas = t match {
|
wneuper@4760
|
341 |
case
|
wneuper@4848
|
342 |
XML.Elem(("GETELEMENTSFROMTO", Nil), List(
|
wneuper@4848
|
343 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4848
|
344 |
XML.Elem(("FORMHEADS", Nil), forms)))
|
wneuper@4760
|
345 |
=> new IntFormulas(new java.lang.Integer(calcid),
|
wneuper@4760
|
346 |
DataTypes.sListToVectorCalcFormula(forms map DataTypes.xml_to_CalcFormula))
|
wneuper@4760
|
347 |
case _ => throw new IllegalArgumentException("iterator_out wrong arg: " + t)
|
wneuper@4760
|
348 |
}
|
wneuper@4760
|
349 |
|
wneuper@4760
|
350 |
//fun getTactic : calcID -> pos' -> XML.tree
|
wneuper@4811
|
351 |
def get_tac_out(t: XML.Tree): IntTactic = t match {
|
wneuper@4788
|
352 |
case
|
wneuper@4848
|
353 |
XML.Elem(("GETTACTIC", Nil), List(
|
wneuper@4848
|
354 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4811
|
355 |
tac))
|
wneuper@4811
|
356 |
=> new IntTactic(new java.lang.Integer(calcid),
|
wneuper@4811
|
357 |
DataTypes.xml_to_Tactic(tac))
|
wneuper@4788
|
358 |
case _ => throw new IllegalArgumentException("get_tac_out wrong arg: " + t)
|
wneuper@4788
|
359 |
}
|
wneuper@4788
|
360 |
|
wneuper@4789
|
361 |
//fun initContext : calcID -> ketype -> pos' -> XML.tree
|
wneuper@4820
|
362 |
def init_ctxt_out(t: XML.Tree): Context = t match {
|
wneuper@4789
|
363 |
case
|
wneuper@4848
|
364 |
XML.Elem(("CONTEXTTHY", Nil), List(
|
wneuper@4848
|
365 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4825
|
366 |
contthy_xml))
|
wneuper@4789
|
367 |
=> DataTypes.xml_to_ContextTheory(contthy_xml)
|
wneuper@4825
|
368 |
case
|
wneuper@4848
|
369 |
XML.Elem(("CONTEXTPBL", Nil), List(
|
wneuper@4848
|
370 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4825
|
371 |
contpbl_xml))
|
wneuper@4825
|
372 |
=> DataTypes.xml_to_ContextProblem(contpbl_xml)
|
wneuper@4825
|
373 |
case
|
wneuper@4848
|
374 |
XML.Elem(("CONTEXTMET", Nil), List(
|
wneuper@4848
|
375 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4825
|
376 |
contmet_xml))
|
wneuper@4825
|
377 |
=> DataTypes.xml_to_ContextMethod(contmet_xml)
|
wneuper@4789
|
378 |
case _ => throw new IllegalArgumentException("init_ctxt_out wrong arg: " + t)
|
wneuper@4789
|
379 |
}
|
wneuper@4787
|
380 |
|
wneuper@4760
|
381 |
//fun inputFillFormula: calcID -> string -> XML.tree
|
wneuper@4787
|
382 |
//... ONLY IMPL. IN Math_Engine
|
wneuper@4787
|
383 |
|
wneuper@4760
|
384 |
//fun interSteps : calcID -> pos' -> XML.tree
|
wneuper@4788
|
385 |
def inter_steps_out(t: XML.Tree): IntCEvent = t match {
|
wneuper@4788
|
386 |
case
|
wneuper@4848
|
387 |
XML.Elem(("INTERSTEPS", Nil), List(
|
wneuper@4848
|
388 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4788
|
389 |
cevent_xml))
|
wneuper@4788
|
390 |
=> new IntCEvent(new java.lang.Integer(calcid),
|
wneuper@4788
|
391 |
DataTypes.xml_to_CEvent(cevent_xml))
|
wneuper@4788
|
392 |
case _ => throw new IllegalArgumentException("inter_steps_out wrong arg: " + t)
|
wneuper@4788
|
393 |
}
|
wneuper@4760
|
394 |
|
wneuper@4760
|
395 |
//fun Iterator : calcID -> XML.tree
|
wneuper@4760
|
396 |
def iterator_out(t: XML.Tree): IntIntCompound = t match {
|
wneuper@4760
|
397 |
case
|
wneuper@4848
|
398 |
XML.Elem(("ADDUSER", Nil), List(
|
wneuper@4848
|
399 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4848
|
400 |
XML.Elem(("USERID", Nil), List(XML.Text(userid)))))
|
wneuper@4760
|
401 |
=> new IntIntCompound(new java.lang.Integer(calcid), new java.lang.Integer(userid))
|
wneuper@4760
|
402 |
case _ => throw new IllegalArgumentException("iterator_out wrong arg: " + t)
|
wneuper@4760
|
403 |
}
|
wneuper@4760
|
404 |
|
wneuper@4789
|
405 |
//fun IteratorTEST : calcID -> iterID
|
wneuper@4789
|
406 |
//... only relevant for Isabelle/Isac
|
wneuper@4788
|
407 |
|
wneuper@4760
|
408 |
//fun modelProblem : calcID -> XML.tree
|
wneuper@4787
|
409 |
def modify_calchead_out(t: XML.Tree): IntCalcHead = t match {
|
wneuper@4787
|
410 |
case
|
wneuper@4848
|
411 |
XML.Elem(("MODIFYCALCHEAD", Nil), List(
|
wneuper@4848
|
412 |
XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4787
|
413 |
calchead_xml))
|
wneuper@4787
|
414 |
=> new IntCalcHead(new java.lang.Integer(calcid),
|
wneuper@4787
|
415 |
DataTypes.xml_to_CalcHead(calchead_xml))
|
wneuper@4788
|
416 |
case _ => throw new IllegalArgumentException("modify_calchead_out wrong arg: " + t)
|
wneuper@4787
|
417 |
}
|
wneuper@4787
|
418 |
|
wneuper@4788
|
419 |
//fun modifyCalcHead : calcID -> icalhd -> XML.tree
|
wneuper@4788
|
420 |
def model_pbl_out(t: XML.Tree): IntCalcHead = modify_calchead_out(t)
|
wneuper@4760
|
421 |
//fun moveActiveCalcHead : calcID -> XML.tree
|
wneuper@4788
|
422 |
def move_active_calchead_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
423 |
//fun moveActiveDown : calcID -> XML.tree
|
wneuper@4788
|
424 |
def move_active_down_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
425 |
//fun moveActiveFormula : calcID -> pos' -> XML.tree
|
wneuper@4788
|
426 |
def move_active_form_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
427 |
//fun moveActiveLevelDown : calcID -> XML.tree
|
wneuper@4788
|
428 |
def move_active_levdown_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
429 |
//fun moveActiveLevelUp : calcID -> XML.tree
|
wneuper@4788
|
430 |
def move_active_levup_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
431 |
//fun moveActiveRoot : calcID -> XML.tree
|
wneuper@4788
|
432 |
def move_active_root_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
433 |
|
wneuper@4760
|
434 |
|
wneuper@4760
|
435 |
//fun moveActiveRootTEST : calcID -> XML.tree
|
wneuper@4787
|
436 |
//... only relevant for Isabelle/Isac
|
wneuper@4787
|
437 |
|
wneuper@4760
|
438 |
//fun moveActiveUp : calcID -> XML.tree
|
wneuper@4788
|
439 |
def move_active_up_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
440 |
//fun moveCalcHead : calcID -> pos' -> XML.tree
|
wneuper@4788
|
441 |
def move_calchead_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
442 |
//fun moveDown : calcID -> pos' -> XML.tree
|
wneuper@4788
|
443 |
def move_down_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
444 |
//fun moveLevelDown : calcID -> pos' -> XML.tree
|
wneuper@4788
|
445 |
def move_levdn_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
446 |
//fun moveLevelUp : calcID -> pos' -> XML.tree
|
wneuper@4789
|
447 |
def move_levup_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
448 |
//fun moveRoot : calcID -> XML.tree
|
wneuper@4788
|
449 |
def move_root_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
450 |
//fun moveUp : calcID -> pos' -> XML.tree
|
wneuper@4788
|
451 |
def move_up_out(t: XML.Tree): IntPosition = get_active_form_out(t)
|
wneuper@4760
|
452 |
|
wneuper@4760
|
453 |
//fun refFormula : calcID -> pos' -> XML.tree
|
wneuper@4731
|
454 |
def ref_formula_out(t: XML.Tree): IntFormHead = t match {
|
wneuper@4723
|
455 |
case
|
wneuper@4848
|
456 |
XML.Elem(("REFFORMULA", Nil), List(
|
wneuper@4848
|
457 |
XML.Elem(("CALCID", Nil), List(
|
wneuper@4729
|
458 |
XML.Text (calcid))),
|
wneuper@4848
|
459 |
XML.Elem(("CALCFORMULA", Nil), cform_etc)))
|
wneuper@4735
|
460 |
=> new IntFormHead(new java.lang.Integer(calcid),
|
wneuper@4848
|
461 |
DataTypes.xml_to_CalcFormula(XML.Elem(("CALCFORMULA", Nil), cform_etc)))
|
wneuper@4729
|
462 |
case
|
wneuper@4848
|
463 |
XML.Elem(("REFFORMULA", Nil), List(
|
wneuper@4848
|
464 |
XML.Elem(("CALCID", Nil), List(XML.Text (calcid))),
|
wneuper@4848
|
465 |
XML.Elem(("CALCHEAD", status), chead_etc)))
|
wneuper@4746
|
466 |
=> new IntFormHead(new java.lang.Integer(calcid),
|
wneuper@4848
|
467 |
DataTypes.xml_to_CalcHead(XML.Elem(("CALCHEAD", status), chead_etc)))
|
wneuper@4729
|
468 |
case // singularity in error handling
|
wneuper@4848
|
469 |
XML.Elem(("REFFORMULA", Nil), List(
|
wneuper@4848
|
470 |
XML.Elem(("CALCID", Nil), List(XML.Text (calcid))),
|
wneuper@4848
|
471 |
XML.Elem(("ERROR", Nil), List(XML.Text(msg)))))
|
wneuper@4747
|
472 |
=> new IntFormHead(new java.lang.Integer(calcid), new Message(msg))
|
wneuper@4752
|
473 |
case _ => throw new IllegalArgumentException("ref_formula_out wrong arg: " + t)
|
wneuper@4723
|
474 |
}
|
wneuper@4759
|
475 |
|
wneuper@4760
|
476 |
//fun refineProblem : calcID -> pos' -> guh -> XML.tree
|
wneuper@4802
|
477 |
/* WN150824: isabisac ... isac-java seems to incompatible:
|
wneuper@4802
|
478 |
* isabisac/../interface-xml.xml_of_matchpbl is incompatible with
|
wneuper@4802
|
479 |
* isac.util.parser.XMLParserDigest //=== Rules for parsing Contexts.
|
wneuper@4802
|
480 |
*
|
wneuper@4802
|
481 |
* Unfortunately there is no use-case and no test for refineProblem,
|
wneuper@4802
|
482 |
* so the Context only gets the KEStoreKey ("GUH"),
|
wneuper@4802
|
483 |
* not the HierarchyKey.
|
wneuper@4802
|
484 |
*/
|
wneuper@4802
|
485 |
def refine_pbl_out(t: XML.Tree): IntContext = t match {
|
wneuper@4788
|
486 |
case
|
wneuper@4848
|
487 |
XML.Elem(("CONTEXTPBL", Nil), List(
|
wneuper@4788
|
488 |
// WN150530: calcid will be required for asynchronous communication *)
|
wneuper@4848
|
489 |
// XML.Elem(("CALCID", Nil), List(XML.Text(calcid))),
|
wneuper@4848
|
490 |
XML.Elem(("GUH", Nil), List(XML.Text(guh))),
|
wneuper@4848
|
491 |
XML.Elem(("STATUS", Nil), List(XML.Text(status))),
|
wneuper@4788
|
492 |
form_xml,
|
wneuper@4788
|
493 |
model_xml))
|
wneuper@4802
|
494 |
=> new IntContext(/*new java.lang.Integer(calcid),*/
|
wneuper@4802
|
495 |
new Context(null/*see WN150824*/, new KEStoreKey(guh)))
|
wneuper@4788
|
496 |
case _ => throw new IllegalArgumentException("refine_pbl_out wrong arg: " + t)
|
wneuper@4788
|
497 |
}
|
wneuper@4788
|
498 |
|
wneuper@4760
|
499 |
//fun replaceFormula : calcID -> cterm' -> XML.tree
|
wneuper@4788
|
500 |
def replace_form_out(t: XML.Tree): IntCEvent = t match {
|
wneuper@4788
|
501 |
case
|
wneuper@4848
|
502 |
XML.Elem(("REPLACEFORMULA", Nil), List(
|
wneuper@4848
|
503 |
XML.Elem(("CALCID", Nil), List(XML.Text (calcid))),
|
wneuper@4788
|
504 |
cevent_xml))
|
wneuper@4788
|
505 |
=> new IntCEvent(new java.lang.Integer(calcid),
|
wneuper@4788
|
506 |
DataTypes.xml_to_CEvent(cevent_xml))
|
wneuper@4788
|
507 |
case _ => throw new IllegalArgumentException("replace_form_out wrong arg: " + t)
|
wneuper@4788
|
508 |
}
|
wneuper@4787
|
509 |
|
wneuper@4760
|
510 |
//fun requestFillformula : calcID -> errpatID * fillpatID -> XML.tree
|
wneuper@4787
|
511 |
//...ONLY IMPLEMENTED IN Math_Engine
|
wneuper@4787
|
512 |
|
wneuper@4760
|
513 |
//fun resetCalcHead : calcID -> XML.tree
|
wneuper@4787
|
514 |
def reset_calchead_out(t: XML.Tree): IntCalcHead = modify_calchead_out(t)
|
wneuper@4787
|
515 |
|
wneuper@4760
|
516 |
//fun setContext : calcID -> pos' -> guh -> XML.tree
|
wneuper@4789
|
517 |
def set_ctxt_out(t: XML.Tree): IntCEvent = auto_calc_out(t)
|
wneuper@4787
|
518 |
|
wneuper@4760
|
519 |
//fun setMethod : calcID -> metID -> XML.tree
|
wneuper@4787
|
520 |
def set_met_out(t: XML.Tree): IntCalcHead = modify_calchead_out(t)
|
wneuper@4799
|
521 |
|
wneuper@4760
|
522 |
//fun setNextTactic : calcID -> tac -> XML.tree
|
wneuper@4799
|
523 |
def set_next_tac_out(t: XML.Tree): Message = t match {
|
wneuper@4799
|
524 |
case
|
wneuper@4848
|
525 |
XML.Elem(("SETNEXTTACTIC", Nil), List(
|
wneuper@4848
|
526 |
XML.Elem(("CALCID", Nil), List(XML.Text (_))),
|
wneuper@4848
|
527 |
XML.Elem(("MESSAGE", Nil), List(XML.Text (msg)))))
|
wneuper@4799
|
528 |
=> new Message(msg)
|
wneuper@4799
|
529 |
case t => throw new IllegalArgumentException("set_next_tac_out wrong arg: " + t)
|
wneuper@4799
|
530 |
}
|
wneuper@4799
|
531 |
|
wneuper@4760
|
532 |
//fun setProblem : calcID -> pblID -> XML.tree
|
wneuper@4787
|
533 |
def set_pbl_out(t: XML.Tree): IntCalcHead = modify_calchead_out(t)
|
wneuper@4760
|
534 |
//fun setTheory : calcID -> thyID -> XML.tree
|
wneuper@4787
|
535 |
def set_thy_out(t: XML.Tree): IntCalcHead = modify_calchead_out(t)
|
wneuper@4723
|
536 |
|
walther@5239
|
537 |
}
|