equal
deleted
inserted
replaced
31 |
31 |
32 (*ad DTD: a NODE contains an ID and zero or more NODEs*) |
32 (*ad DTD: a NODE contains an ID and zero or more NODEs*) |
33 (*old version with pos2filename*) |
33 (*old version with pos2filename*) |
34 fun hierarchy pm(*"pbl" | "met"*) h = |
34 fun hierarchy pm(*"pbl" | "met"*) h = |
35 let val j = indentation |
35 let val j = indentation |
36 fun nd i p (Celem1.Ptyp (id,_,ns)) = |
36 fun nd i p (Store.Ptyp (id,_,ns)) = |
37 let val p' = Pos.lev_on p |
37 let val p' = Pos.lev_on p |
38 in (indt i) ^ "<NODE>\n" ^ |
38 in (indt i) ^ "<NODE>\n" ^ |
39 (indt (i+j)) ^ "<ID> " ^ id ^ " </ID>\n" ^ |
39 (indt (i+j)) ^ "<ID> " ^ id ^ " </ID>\n" ^ |
40 (indt (i+j)) ^ "<NO> " (*on this level*) ^ |
40 (indt (i+j)) ^ "<NO> " (*on this level*) ^ |
41 (string_of_int o last_elem) p' ^ " </NO>\n" ^ |
41 (string_of_int o last_elem) p' ^ " </NO>\n" ^ |
48 | nds i p (n::ns) = (nd i p n) ^ (nds i (Pos.lev_on p) ns); |
48 | nds i p (n::ns) = (nd i p n) ^ (nds i (Pos.lev_on p) ns); |
49 in nds j [0] h end; |
49 in nds j [0] h end; |
50 (*.create a hierarchy with references to the guh's.*) |
50 (*.create a hierarchy with references to the guh's.*) |
51 fun hierarchy_pbl h = |
51 fun hierarchy_pbl h = |
52 let val j = indentation |
52 let val j = indentation |
53 fun nd i p (Celem1.Ptyp (id,[n as {guh,...} : Celem.pbt],ns)) = |
53 fun nd i p (Store.Ptyp (id,[n as {guh,...} : Celem.pbt],ns)) = |
54 let val p' = Pos.lev_on p |
54 let val p' = Pos.lev_on p |
55 in (indt i) ^ "<NODE>\n" ^ |
55 in (indt i) ^ "<NODE>\n" ^ |
56 (indt (i+j)) ^ "<ID> " ^ id ^ " </ID>\n" ^ |
56 (indt (i+j)) ^ "<ID> " ^ id ^ " </ID>\n" ^ |
57 (indt (i+j)) ^ "<NO> " (*on this level*) ^ |
57 (indt (i+j)) ^ "<NO> " (*on this level*) ^ |
58 (string_of_int o last_elem) p' ^ " </NO>\n" ^ |
58 (string_of_int o last_elem) p' ^ " </NO>\n" ^ |
64 and nds _ _ [] = "" |
64 and nds _ _ [] = "" |
65 | nds i p (n::ns) = (nd i p n) ^ (nds i (Pos.lev_on p) ns); |
65 | nds i p (n::ns) = (nd i p n) ^ (nds i (Pos.lev_on p) ns); |
66 in nds j [0] h : Celem.xml end; |
66 in nds j [0] h : Celem.xml end; |
67 fun hierarchy_met h = |
67 fun hierarchy_met h = |
68 let val j = indentation |
68 let val j = indentation |
69 fun nd i p (Celem1.Ptyp (id,[n as {guh,...} : Celem.met],ns)) = |
69 fun nd i p (Store.Ptyp (id,[n as {guh,...} : Celem.met],ns)) = |
70 let val p' = Pos.lev_on p |
70 let val p' = Pos.lev_on p |
71 in (indt i) ^ "<NODE>\n" ^ |
71 in (indt i) ^ "<NODE>\n" ^ |
72 (indt (i+j)) ^ "<ID> " ^ id ^ " </ID>\n" ^ |
72 (indt (i+j)) ^ "<ID> " ^ id ^ " </ID>\n" ^ |
73 (indt (i+j)) ^ "<NO> " (*on this level*) ^ |
73 (indt (i+j)) ^ "<NO> " (*on this level*) ^ |
74 (string_of_int o last_elem) p' ^ " </NO>\n" ^ |
74 (string_of_int o last_elem) p' ^ " </NO>\n" ^ |
262 fun met2file (path: Celem.filepath) (pos: Pos.pos) (id: Celem.metID) (met as {guh,...}) = |
262 fun met2file (path: Celem.filepath) (pos: Pos.pos) (id: Celem.metID) (met as {guh,...}) = |
263 (writeln ("### met2file: id = " ^ strs2str id); |
263 (writeln ("### met2file: id = " ^ strs2str id); |
264 ((str2file (path ^ Rtools.guh2filename guh)) o (met2xml id)) met); |
264 ((str2file (path ^ Rtools.guh2filename guh)) o (met2xml id)) met); |
265 |
265 |
266 (*.scan the mtree Ptyp and print the nodes using wfn.*) |
266 (*.scan the mtree Ptyp and print the nodes using wfn.*) |
267 fun node (pa: Celem.filepath) ids po wfn (Celem1.Ptyp (id,[n],ns)) = |
267 fun node (pa: Celem.filepath) ids po wfn (Store.Ptyp (id,[n],ns)) = |
268 let val po' = Pos.lev_on po |
268 let val po' = Pos.lev_on po |
269 in |
269 in |
270 wfn pa po' (ids@[id]) n; |
270 wfn pa po' (ids@[id]) n; |
271 nodes pa (ids@[id]) (Pos.lev_dn po') wfn ns |
271 nodes pa (ids@[id]) (Pos.lev_dn po') wfn ns |
272 end |
272 end |