(* camlp4r ./def.syn.cmo ./pa_html.cmo *) (* $Id: ascend.ml,v 4.39.2.1 2006/01/03 12:04:10 ddr Exp $ *) (* Copyright (c) 1998-2005 INRIA *) open Config; open Def; open Gutil; open Util; open Printf; value limit_by_list conf = match p_getint conf.base_env "max_anc_level" with [ Some x -> max 1 x | None -> 8 ] ; value limit_by_tree conf = match p_getint conf.base_env "max_anc_tree" with [ Some x -> max 1 x | None -> 7 ] ; value max_ancestor_level conf base ip = (* let _ = base.data.ascends.array () in let _ = base.data.couples.array () in *) let x = ref 0 in let mark = Array.create base.data.persons.len False in let rec loop level ip = if mark.(Adef.int_of_iper ip) then () else do { mark.(Adef.int_of_iper ip) := True; x.val := max x.val level; match parents (aget conf base ip) with [ Some ifam -> let cpl = coi base ifam in do { loop (succ level) (father cpl); loop (succ level) (mother cpl) } | _ -> () ] } in do { loop 0 ip; x.val } ; value text_to conf = fun [ 1 -> transl conf "specify" ^ " " ^ transl_nth conf "generation/generations" 0 | 2 -> transl conf "to the parents" | 3 -> transl conf "to the grandparents" | 4 -> transl conf "to the great-grandparents" | i -> sprintf (ftransl conf "to the %s generation") (transl_nth conf "nth (generation)" i) ] ; value text_level conf = fun [ 1 -> transl conf "specify" ^ " " ^ transl_nth conf "generation/generations" 0 | 2 -> transl conf "the parents" | 3 -> transl conf "the grandparents" | 4 -> transl conf "the great-grandparents" | i -> sprintf (ftransl conf "the %s generation") (transl_nth conf "nth (generation)" i) ] ; value print_choice conf base p effective_level = tag "form" "method=get action=\"%s\"" conf.command begin Util.hidden_env conf; Wserver.wprint "\n"; Wserver.wprint "\n"; wprint_hidden_person conf base "" p; tag "center" begin tag "select" "name=v" begin let rec loop i = if i > effective_level + 1 then () else do { Wserver.wprint "