Skip to content

Commit

Permalink
Util.string_of_witness_now: take sex as parameter instead of person.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Sagot committed Nov 13, 2018
1 parent 0348f0a commit 8c539ea
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/history_diff.ml
Expand Up @@ -553,7 +553,7 @@ let string_of_event_witness conf base witnesses =
List.fold_right
(fun (ip, wk) accu ->
let witn = person_of_iper conf base ip in
let kind = Util.string_of_witness_kind conf (poi base ip) wk in
let kind = Util.string_of_witness_kind conf (get_sex @@ poi base ip) wk in
if witn = "" then (kind ^ ": " ^ witn) :: accu else accu)
(Array.to_list witnesses) []
in
Expand Down
2 changes: 1 addition & 1 deletion lib/perso.ml
Expand Up @@ -5440,7 +5440,7 @@ let print_foreach conf base print_ast eval_expr =
Mutil.list_iter_first
(fun first (ip, wk) ->
let p = pget conf base ip in
let wk = Util.string_of_witness_kind conf p wk in
let wk = Util.string_of_witness_kind conf (get_sex p) wk in
let env = ("event_witness", Vind p) :: env in
let env = ("event_witness_kind", Vstring wk) :: env in
let env = ("first", Vbool first) :: env in
Expand Down
2 changes: 1 addition & 1 deletion lib/updateInd.ml
Expand Up @@ -157,7 +157,7 @@ and eval_simple_var conf base env p =
let wit =
List.fold_right
(fun (w, wk) accu ->
(Util.string_of_witness_kind conf p wk ^ ": " ^
(Util.string_of_witness_kind conf (get_sex p) wk ^ ": " ^
Util.person_text conf base (poi base w)) ::
accu)
(Array.to_list e.epers_witnesses) []
Expand Down
6 changes: 3 additions & 3 deletions lib/util.ml
Expand Up @@ -1122,11 +1122,11 @@ let string_of_fevent_name conf base efam_name =
| Efam_Residence -> transl conf "residence"
| Efam_Name n -> sou base n

let string_of_witness_kind conf p witness_kind =
let string_of_witness_kind conf sex witness_kind =
match witness_kind with
Witness -> transl_nth conf "witness/witness/witnesses" 0
| Witness_GodParent ->
let n = index_of_sex (get_sex p) in
let n = index_of_sex sex in
transl_nth conf "godfather/godmother/godparents" n

let base_path pref bname =
Expand Down Expand Up @@ -3567,7 +3567,7 @@ let array_mem_witn conf base x a =
let rec loop i =
if i = Array.length a then (false, "")
else if x = fst a.(i)
then (true, string_of_witness_kind conf (poi base x) (snd a.(i)))
then (true, string_of_witness_kind conf (get_sex @@ poi base x) (snd a.(i)))
else loop (i + 1)
in
loop 0
Expand Down
6 changes: 5 additions & 1 deletion lib/util.mli
Expand Up @@ -174,7 +174,11 @@ val string_of_pevent_name :
config -> base -> istr gen_pers_event_name -> string
val string_of_fevent_name :
config -> base -> istr gen_fam_event_name -> string
val string_of_witness_kind : config -> person -> witness_kind -> string

(** [string_of_witness_kind conf sex wk]
Return the string corresponding to wk according to [sex] and [conf].
*)
val string_of_witness_kind : config -> sex -> witness_kind -> string

val relation_txt :
config -> sex -> family -> (('a -> 'b) -> 'b, 'a, 'b) format
Expand Down

0 comments on commit 8c539ea

Please sign in to comment.