external create_empty : int -> bits = "caml_result_set_create"
external set : bits -> int -> unit = "caml_result_set_set"
external next : bits -> int -> int = "caml_result_set_next"
+ external count : bits -> int = "caml_result_set_count"
external clear : bits -> elt -> elt -> unit = "caml_result_set_clear"
+
external set_tag_bits : bits -> Tag.t -> Tree.t -> elt -> elt = "caml_set_tag_bits"
type t =
{ segments : elt list;
in loop (next t.bits 0) acc
let map _ _ = failwith "noop"
- let length t = let cpt = ref 0 in
- iter (fun _ -> incr cpt) t; !cpt
+ (*let length t = let cpt = ref 0 in
+ iter (fun _ -> incr cpt) t; !cpt *)
+ let length t = count t.bits
let clear_bits t =
let rec loop l = match l with
let cont =
match f_kind,n_kind with
| `NIL,`NIL ->
- Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__);
(fun t _ -> eval_fold2_slist fl_list t (Tree.tag tree t) empty_res empty_res)
| _,`NIL -> (
match f_kind with
if (Algebra.is_rec a s fst) && (Algebra.is_rec a s snd)
&& (Algebra.is_final_marking a s)
then
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
RS.mk_quick_tag_loop default llist 1 tree tag'
- else
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
- default
- else
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
- default
+ else default
+ else default
| _ ->
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t _ -> eval_fold2_slist fl_list t (Tree.tag tree t) empty_res
(loop (first t) llist t ))
)
if t == Tree.nil then empty_res else
let res2 = loop (next t ctx) ctx in
eval_fold2_slist fl_list t tag res2 empty_res
- in Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__);loop
+ in loop
else
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t ctx -> eval_fold2_slist fl_list t (Tree.tag tree t)
(loop_tag tag' (next t ctx) rlist ctx ) empty_res)
| _ ->
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t ctx -> eval_fold2_slist fl_list t (Tree.tag tree t)
(loop (next t ctx) rlist ctx ) empty_res)
)
| `TAG(tag1),`TAG(tag2) ->
- let _ = Printf.eprintf "Using %i %s %s\n" (Loc.start_line __LOCATION__)
- (Tag.to_string tag1)
- (Tag.to_string tag2)
- in
(fun t ctx ->
eval_fold2_slist fl_list t (Tree.tag tree t)
(loop_tag tag2 (next t ctx) rlist ctx )
(loop_tag tag1 (first t) llist t ))
| `TAG(tag'),`ANY ->
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t ctx ->
eval_fold2_slist fl_list t (Tree.tag tree t)
(loop (next t ctx) rlist ctx )
(loop_tag tag' (first t) llist t ))
| `ANY,`TAG(tag') ->
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t ctx ->
eval_fold2_slist fl_list t (Tree.tag tree t)
(loop_tag tag' (next t ctx) rlist ctx )
(loop (first t) llist t ))
| `ANY,`ANY ->
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
if SList.equal slist rlist && SList.equal slist llist
then
let rec loop t ctx =
and r2 = loop (next t ctx) ctx
in
eval_fold2_slist fl_list t (Tree.tag tree t) r2 r1
- in
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
- loop
+ in loop
else
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t ctx ->
eval_fold2_slist fl_list t (Tree.tag tree t)
(loop (next t ctx) rlist ctx )
(loop (first t) llist t ))
| _,_ ->
- let _ = Printf.eprintf "Using %i\n" (Loc.start_line __LOCATION__) in
(fun t ctx ->
eval_fold2_slist fl_list t (Tree.tag tree t)
(loop (next t ctx) rlist ctx )
let top_down_count a t = let module RI = Run(Integer) in Integer.length (RI.run_top_down a t)
let top_down a t = let module RI = Run(IdSet) in (RI.run_top_down a t)
let bottom_up_count a t k = let module RI = Run(Integer) in Integer.length (RI.run_bottom_up a t k)
-
+ let bottom_up a t k = let module RI = Run(IdSet) in (RI.run_bottom_up a t k)
module Test (Doc : sig val doc : Tree.t end) =
struct