1.1 --- a/src/sml/xmlsrc/datatypes.sml Sat Feb 05 15:04:29 2005 +0100
1.2 +++ b/src/sml/xmlsrc/datatypes.sml Sat Feb 05 15:04:29 2005 +0100
1.3 @@ -33,6 +33,19 @@
1.4
1.5 (** isac datatypes **)
1.6
1.7 +fun pos_2xml j pos_ =
1.8 + (indt j) ^ "<POS> " ^ pos_2str pos_ ^ " </POS>\n";
1.9 +
1.10 +(*.due to specialties of isac/util/parser/XMLParseDigest.java
1.11 + pos' requires different tags.*)
1.12 +fun pos'2xml j (tag, (pos, pos_)) =
1.13 + indt (j) ^ "<" ^ tag ^ ">\n" ^
1.14 + ints2xml (j+i) pos ^
1.15 + pos_2xml (j+i) pos_ ^
1.16 + indt (j) ^ "</" ^ tag ^ ">\n";
1.17 +(* writeln(pos'2xml 3 ("POSITION", ([1,2,3], Pbl)));
1.18 + *)
1.19 +
1.20 fun rule2xml j Erule =
1.21 (indt j ^ "<RULE> empty_rule </RULE>\n"):xml
1.22 | rule2xml j (Thm (thmID, thm)) =
1.23 @@ -171,9 +184,9 @@
1.24 fun modspec2xml j ((b, p_, head, gfr, pre, spec): ocalhd) =
1.25 (indt j ^"<CALCHEAD status = "^
1.26 quote (if b then "correct" else "incorrect")^">\n"^
1.27 - indt (j+1) ^"<HEAD>\n"^
1.28 - term2xml (j+1) head^"\n"^
1.29 - indt (j+1) ^"</HEAD>\n"^
1.30 + indt (j+i) ^"<HEAD>\n"^
1.31 + term2xml (j+i) head^"\n"^
1.32 + indt (j+i) ^"</HEAD>\n"^
1.33 model2xml (j+i) gfr pre ^
1.34 indt (j+i) ^"<BELONGSTO> "^(case p_ of Pbl => "Pbl"
1.35 | Met => "Met"
1.36 @@ -182,6 +195,19 @@
1.37 indt j ^"</CALCHEAD>\n"):xml;
1.38 (* writeln (modspec2xml 2 e_ocalhd);
1.39 *)
1.40 +fun pos'calchead2xml j (p:pos', (b, p_, head, gfr, pre, spec): ocalhd) =
1.41 + (indt j ^"<CALCHEAD status = "^
1.42 + quote (if b then "correct" else "incorrect")^">\n"^
1.43 + pos'2xml (j+i) ("POSITION", p) ^
1.44 + indt (j+i) ^"<HEAD>\n"^
1.45 + term2xml (j+i) head^"\n"^
1.46 + indt (j+i) ^"</HEAD>\n"^
1.47 + model2xml (j+i) gfr pre ^
1.48 + indt (j+i) ^"<BELONGSTO> "^(case p_ of Pbl => "Pbl"
1.49 + | Met => "Met"
1.50 + | _ => "Und")^" </BELONGSTO>\n"^
1.51 + spec2xml (j+i) spec ^
1.52 + indt j ^"</CALCHEAD>\n"):xml;
1.53
1.54 fun sub2xml j (id, value) =
1.55 (indt j ^"<PAIR>\n"^
1.56 @@ -202,19 +228,6 @@
1.57 writeln(subs2xml 0 subs);
1.58 *)
1.59
1.60 -fun pos_2xml j pos_ =
1.61 - (indt j) ^ "<POS> " ^ pos_2str pos_ ^ " </POS>\n";
1.62 -
1.63 -(*.due to specialties of isac/util/parser/XMLParseDigest.java
1.64 - pos' requires different tags.*)
1.65 -fun pos'2xml j (tag, (pos, pos_)) =
1.66 - indt j ^ "<" ^ tag ^ ">\n" ^
1.67 - ints2xml (j + i) pos ^
1.68 - pos_2xml (j + i) pos_ ^
1.69 - indt j ^ "</" ^ tag ^ ">\n";
1.70 -(* writeln(pos'2xml 3 ("POSITION", ([1,2,3], Pbl)));
1.71 - *)
1.72 -
1.73
1.74
1.75 fun thmstr2xml j str = ((((term2xml j) o str2term) str)^"\n"):xml;
1.76 @@ -321,17 +334,14 @@
1.77
1.78
1.79 fun posformhead2xml j (p:pos', Form f) =
1.80 - indt j ^"<POSFORM>\n"^
1.81 - pos'2xml (j+i) ("GENERATED", p) ^
1.82 + indt j ^"<CALCFORMULA>\n"^
1.83 + pos'2xml (j+i) ("POSITION", p) ^
1.84 indt (j+i) ^"<FORMULA>\n"^
1.85 term2xml (j+i) f^"\n"^
1.86 indt (j+i) ^"</FORMULA>\n"^
1.87 - indt j ^"</POSFORM>\n"
1.88 + indt j ^"</CALCFORMULA>\n"
1.89 | posformhead2xml j (p, ModSpec c) =
1.90 - indt j ^"<POSHEAD>\n"^
1.91 - pos'2xml (j+i) ("GENERATED", p) ^
1.92 - modspec2xml (j+i) c^
1.93 - indt j ^"</POSHEAD>\n";
1.94 + pos'calchead2xml (j) (p, c);
1.95
1.96 fun posformheads2xml j [] = ("":xml)
1.97 | posformheads2xml j (r::rs) = posformhead2xml j r ^ posformheads2xml j rs;
2.1 --- a/src/sml/xmlsrc/interface-xml.sml Sat Feb 05 15:04:29 2005 +0100
2.2 +++ b/src/sml/xmlsrc/interface-xml.sml Sat Feb 05 15:04:29 2005 +0100
2.3 @@ -65,19 +65,20 @@
2.4 fun refformulaOK2xml (cI:calcID) p (Form t) =
2.5 writeln ("@@@@@begin@@@@@\n "^string_of_int cI^" \n\
2.6 \<REFFORMULA>\n\
2.7 - \ <CALCID> "^string_of_int cI^" </CALCID>\n"^
2.8 - pos'2xml i ("POSITION", p) ^
2.9 - " <FORMULA>\n"^
2.10 - (term2xml i t)^"\n"^
2.11 - " </FORMULA>\n\
2.12 + \ <CALCID> "^string_of_int cI^" </CALCID>\n\
2.13 + \ <CALCFORMULA>\n"^
2.14 + pos'2xml (2*i) ("POSITION", p) ^
2.15 + " <FORMULA>"^
2.16 + term2xml (2*i) t ^"\n"^
2.17 + " </FORMULA>\n\
2.18 + \ </CALCFORMULA>\n\
2.19 \</REFFORMULA>\n\
2.20 \@@@@@end@@@@@")
2.21 | refformulaOK2xml (cI:calcID) p (ModSpec modspec) =
2.22 writeln ("@@@@@begin@@@@@\n "^string_of_int cI^" \n\
2.23 \<REFFORMULA>\n\
2.24 \ <CALCID> "^string_of_int cI^" </CALCID>\n"^
2.25 - pos'2xml i ("POSITION", p) ^
2.26 - modspec2xml i modspec^
2.27 + pos'calchead2xml i (p, modspec)^
2.28 "</REFFORMULA>\n\
2.29 \@@@@@end@@@@@");
2.30
2.31 @@ -107,9 +108,9 @@
2.32 writeln ("@@@@@begin@@@@@\n "^string_of_int cI^" \n\
2.33 \<GETELEMENTSFROMTO>\n\
2.34 \ <CALCID> "^string_of_int cI^" </CALCID>\n\
2.35 - \ <POSFORMHEADS>\n"^
2.36 + \ <FORMHEADS>\n"^
2.37 posformheads2xml (2*i) fs^
2.38 - " <POSFORMHEADS>\n\
2.39 + " <FORMHEADS>\n\
2.40 \</GETELEMENTSFROMTO>\n\
2.41 \@@@@@end@@@@@");
2.42