PIDE: added missing code in interface-xml
authorWalther Neuper <wneuper@ist.tugraz.at>
Fri, 24 Jul 2015 07:47:06 +0200
changeset 59150dd8d5ede0ba6
parent 59149 5539f0851703
child 59151 98dc8a3e4406
PIDE: added missing code in interface-xml
src/Tools/isac/xmlsrc/datatypes.sml
src/Tools/isac/xmlsrc/interface-xml.sml
test/Tools/isac/ADDTESTS/libisabelle/mini-test.sml
     1.1 --- a/src/Tools/isac/xmlsrc/datatypes.sml	Sat Jul 18 15:43:58 2015 +0200
     1.2 +++ b/src/Tools/isac/xmlsrc/datatypes.sml	Fri Jul 24 07:47:06 2015 +0200
     1.3 @@ -476,6 +476,14 @@
     1.4  					  | _ => "Und")^" </BELONGSTO>\n"^
     1.5       spec2xml (j+i) spec ^
     1.6       indt j ^"</CALCHEAD>\n"):xml;
     1.7 +fun xml_of_posmodspec ((p: pos', (b, p_, head, gfr, pre, spec): ocalhd)) =
     1.8 +  XML.Elem (("CALCHEAD", [("status", if b then "correct" else "incorrect")]), [
     1.9 +    xml_of_pos "POSITION" p,
    1.10 +    XML.Elem (("HEAD", []), [xml_of_term head]),
    1.11 +    XML.Elem (("BELONGSTO", []), [
    1.12 +      XML.Text (case p_ of Pbl => "Pbl" | Met => "Met" | _ => "Und")]),
    1.13 +    xml_of_model gfr pre,
    1.14 +    xml_of_spec spec])
    1.15  
    1.16  fun sub2xml j (id, value) =
    1.17      (indt j ^"<PAIR>\n"^
     2.1 --- a/src/Tools/isac/xmlsrc/interface-xml.sml	Sat Jul 18 15:43:58 2015 +0200
     2.2 +++ b/src/Tools/isac/xmlsrc/interface-xml.sml	Fri Jul 24 07:47:06 2015 +0200
     2.3 @@ -71,7 +71,7 @@
     2.4      writeln ("@@@@@begin@@@@@\n "^string_of_int cI^" \n" ^
     2.5  	     "<CALCITERATOR>\n" ^
     2.6  	     "  <CALCID> "^string_of_int cI^" </CALCID>\n" ^
     2.7 -	     "  <ERROR> pos does not exist </ERROR>\n" ^
     2.8 +	     "  <ERROR> iteratorERROR2xml: pos does not exist </ERROR>\n" ^
     2.9  	     "</CALCITERATOR>\n" ^
    2.10  	     "@@@@@end@@@@@");
    2.11  fun iteratorOK2xml (calcid : calcID) (p : pos')= 
    2.12 @@ -81,7 +81,7 @@
    2.13  fun iteratorERROR2xml  (calcid : calcID) = 
    2.14    XML.Elem (("CALCITERATOR", []),
    2.15      [XML.Elem (("CALCID", []), [XML.Text (string_of_int calcid)]),
    2.16 -    XML.Elem (("ERROR", []), [XML.Text " pos does not exist "])])
    2.17 +    XML.Elem (("ERROR", []), [XML.Text " iteratorERROR2xml: pos does not exist "])])
    2.18  
    2.19  fun sysERROR2xml (cI:calcID) "" = 
    2.20      writeln ("@@@@@begin@@@@@\n "^string_of_int cI^" \n" ^
    2.21 @@ -128,9 +128,9 @@
    2.22            xml_of_pos "POSITION" p,
    2.23            XML.Elem (("FORMULA", []), [xml_of_term t])])])
    2.24    | refformulaOK2xml (calcid : calcID) p (ModSpec modspec) = 
    2.25 -      XML.Elem (("REFFORMULA", []),
    2.26 -        [XML.Elem (("CALCID", []), [XML.Text (string_of_int calcid)]),
    2.27 -        XML.Elem (("ERROR", []), [XML.Text " pos does not exist "])])
    2.28 +      XML.Elem (("REFFORMULA", []), [
    2.29 +        XML.Elem (("CALCID", []), [XML.Text (string_of_int calcid)]),
    2.30 +        (*L.Elem (("CALCHEAD*) xml_of_posmodspec (p, modspec)])
    2.31  
    2.32  fun refformulaERROR2xml (cI:calcID) = (*FIXME.WN.29.8.03 unused*)
    2.33      writeln ("@@@@@begin@@@@@\n "^string_of_int cI^" \n" ^
     3.1 --- a/test/Tools/isac/ADDTESTS/libisabelle/mini-test.sml	Sat Jul 18 15:43:58 2015 +0200
     3.2 +++ b/test/Tools/isac/ADDTESTS/libisabelle/mini-test.sml	Fri Jul 24 07:47:06 2015 +0200
     3.3 @@ -133,7 +133,7 @@
     3.4        xml_of_pos "POSITION" (is, kind),
     3.5        xml_of_int 0,
     3.6        xml_of_bool false]);
     3.7 -"~~~~~ operation_setup moveactiveroot, args:"; val calcid = calcid
     3.8 +"~~~~~ operation_setup getformulaefromto, args:"; val calcid = calcid
     3.9  	   val (ci, from, to, level, rules) = case intree of
    3.10         XML.Elem (("GETFORMULAEFROMTO", []), [
    3.11           XML.Elem (("CALCID", []), [XML.Text calcid]),
    3.12 @@ -183,10 +183,40 @@
    3.13  ;
    3.14  (* TODO ...*)
    3.15  "----------- step 5: operation_setup refformula ------------------------------------------------";
    3.16 -"~~~~~ operation_setup refformula, args:"; val () = ()
    3.17 +"~~~~~ operation_setup getformulaefromto, args:"; val () = ()
    3.18  ;
    3.19  "----------- step 6: operation_setup refformula ------------------------------------------------";
    3.20 -"~~~~~ operation_setup refformula, args:"; val () = ()
    3.21 +(* intree von TestPIDE.java:
    3.22 +<REFFORMULA>
    3.23 +  <CALCID>1</CALCID>
    3.24 +  <POSITION>
    3.25 +    <INTLIST/>
    3.26 +    <POS>Pbl</POS>
    3.27 +  </POSITION>
    3.28 +</REFFORMULA>*)
    3.29 +if ci = "1" then () else error "--- step 6: ci <> 1";
    3.30 +val intree = 
    3.31 +  XML.Elem (("REFFORMULA", []), [
    3.32 +    XML.Elem (("CALCID", []), [XML.Text ci]), 
    3.33 +    XML.Elem (("POSITION", []), [
    3.34 +      XML.Elem (("INTLIST", []), []),
    3.35 +      XML.Elem (("POS", []), [XML.Text "Pbl"])])])
    3.36 +;
    3.37 +"~~~~~ operation_setup refformula, args:"; val intree = intree;
    3.38 +	   val (ci, p) = 
    3.39 +       case intree of
    3.40 +         XML.Elem (("REFFORMULA", []), [
    3.41 +             XML.Elem (("CALCID", []), [XML.Text ci]), 
    3.42 +             p]) => (ci, p)
    3.43 +      | _ => error "operation_setup refformula intree changed"
    3.44 +     val SOME calcid = int_of_str ci
    3.45 +     val pos = xml_to_pos p
    3.46 +;
    3.47 +if calcid = 1 andalso pos = ([], Pbl) then () else error "--- step 6: intree changed";
    3.48 +     val result = Math_Engine.refFormula calcid pos
    3.49 +;
    3.50 +(*this vanished by now..*)
    3.51 +xmlstr 0 result = "<REFFORMULA>\n. <CALCID>\n. . 1\n. </CALCID>\n. <ERROR>\n. .  pos does not exist \n. </ERROR>\n</REFFORMULA>\n"
    3.52  ;
    3.53  "----------- step 7: operation_setup autocalculate ---------------------------------------------";
    3.54  "~~~~~ operation_setup autocalculate, args:"; val () = ()