1.1 --- a/src/Tools/isac/Interpret/calchead.sml Tue May 22 07:00:53 2012 +0200
1.2 +++ b/src/Tools/isac/Interpret/calchead.sml Tue May 22 13:40:06 2012 +0200
1.3 @@ -1945,38 +1945,35 @@
1.4 list
1.5 .*)
1.6 fun get_interval from to level pt =
1.7 -(* val (from,level) = (f,lev);
1.8 - val (from, to, level) = (([3, 2, 1], Res), ([],Res), 9999);
1.9 - *)
1.10 - let fun get_inter c (from:pos') (to:pos') lev pt =
1.11 -(* val (c, from, to, lev) = ([], from, to, level);
1.12 - ------for recursion.......
1.13 - val (c, from:pos', to:pos') = (c @ [(from, f)], move_dn [] pt from, to);
1.14 - *)
1.15 + let
1.16 + fun get_inter c (from:pos') (to:pos') lev pt =
1.17 if eq_pos' from to orelse from = ([],Res)
1.18 (*orelse ... avoids Exception- PTREE "end of calculation" raised,
1.19 if 'to' has values NOT generated by move_dn, see systest/me.sml
1.20 TODO.WN0501: introduce an order on pos' and check "from > to"..
1.21 ...there is an order in Java!
1.22 WN051224 the hack got worse with returning term instead ptform*)
1.23 - then let val (f,_,_) = pt_extract (pt, from)
1.24 - in case f of
1.25 - ModSpec (_,_,headline,_,_,_) => c @ [(from, headline)]
1.26 - | Form t => c @ [(from, t)]
1.27 - end
1.28 + then
1.29 + let val (f,_,_) = pt_extract (pt, from)
1.30 + in
1.31 + case f of
1.32 + ModSpec (_,_,headline,_,_,_) => c @ [(from, headline)]
1.33 + | Form t => c @ [(from, t)]
1.34 + end
1.35 else
1.36 - if lev < lev_of from
1.37 - then (get_inter c (move_dn [] pt from) to lev pt)
1.38 - handle (PTREE _(*from move_dn too far*)) => c
1.39 - else let val (f,_,_) = pt_extract (pt, from)
1.40 - val term = case f of
1.41 - ModSpec (_,_,headline,_,_,_)=> headline
1.42 - | Form t => t
1.43 - in (get_inter (c @ [(from, term)])
1.44 - (move_dn [] pt from) to lev pt)
1.45 - handle (PTREE _(*from move_dn too far*))
1.46 - => c @ [(from, term)] end
1.47 - in get_inter [] from to level pt end;
1.48 + if lev < lev_of from
1.49 + then (get_inter c (move_dn [] pt from) to lev pt)
1.50 + handle (PTREE _(*from move_dn too far*)) => c
1.51 + else
1.52 + let
1.53 + val (f,_,_) = pt_extract (pt, from)
1.54 + val term = case f of
1.55 + ModSpec (_,_,headline,_,_,_) => headline
1.56 + | Form t => t
1.57 + in (get_inter (c @ [(from, term)]) (move_dn [] pt from) to lev pt)
1.58 + handle (PTREE _(*from move_dn too far*)) => c @ [(from, term)]
1.59 + end
1.60 + in get_inter [] from to level pt end;
1.61
1.62 (*for tests*)
1.63 fun posform2str (pos:pos', form) =