Skip to content

Commit

Permalink
Revert "Remove 'open Printf'"
Browse files Browse the repository at this point in the history
This reverts commit 0e77228.
  • Loading branch information
Julien Sagot committed Sep 13, 2018
1 parent a8b41ff commit b49518b
Show file tree
Hide file tree
Showing 60 changed files with 1,204 additions and 1,217 deletions.
3 changes: 2 additions & 1 deletion contrib/gwFix/gwFindCpl.ml
Expand Up @@ -3,6 +3,7 @@

open Def;
open Gwdb;
open Printf;


value designation base ip p =
Expand Down Expand Up @@ -93,7 +94,7 @@ value main () = do {
lock Mutil.lock_file bname.val with
[ Accept -> check bname.val
| Refuse -> do {
Printf.eprintf "Cannot lock database. Try again.\n";
eprintf "Cannot lock database. Try again.\n";
flush stderr;
} ]
};
Expand Down
61 changes: 31 additions & 30 deletions contrib/gwFix/gwFixBase.ml
Expand Up @@ -3,6 +3,7 @@

open Def;
open Gwdb;
open Printf;


value designation base ip p =
Expand All @@ -16,7 +17,7 @@ value designation base ip p =
;

value check_keys base nb_ind fix = do {
Printf.printf "Check keys\n";
printf "Check keys\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_ind - 1 do {
Expand All @@ -31,22 +32,22 @@ value check_keys base nb_ind fix = do {
[ Some ip2 ->
if ip2 <> ip then do {
ProgrBar.suspend ();
Printf.printf "*** key %s.%d %s is \"%s\"\n" fn occ sn
printf "*** key %s.%d %s is \"%s\"\n" fn occ sn
(designation base ip (poi base ip2));
flush stdout;
Gwdb.patch_key base ip fn sn occ;
Printf.printf "*** fixed\n";
printf "*** fixed\n";
flush stdout;
fix.val := True;
ProgrBar.restart i nb_ind;
}
else ()
| None -> do {
ProgrBar.suspend ();
Printf.printf "*** key %s.%d %s = no anwser\n" fn occ sn;
printf "*** key %s.%d %s = no anwser\n" fn occ sn;
flush stdout;
Gwdb.patch_key base ip fn sn occ;
Printf.printf "*** fixed\n";
printf "*** fixed\n";
flush stdout;
fix.val := True;
ProgrBar.restart i nb_ind;
Expand All @@ -57,7 +58,7 @@ value check_keys base nb_ind fix = do {
};

value check_families_parents base nb_fam = do {
Printf.printf "Check families' parents\n";
printf "Check families' parents\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_fam - 1 do {
Expand All @@ -72,7 +73,7 @@ value check_families_parents base nb_fam = do {
if Array.mem ifam (get_family (poi base ip)) then ()
else do {
ProgrBar.suspend ();
Printf.printf "*** no family for : %s\n"
printf "*** no family for : %s\n"
(designation base ip (poi base ip));
flush stdout;
ProgrBar.restart i nb_fam;
Expand All @@ -83,7 +84,7 @@ value check_families_parents base nb_fam = do {
};

value check_families_children base nb_fam fix = do {
Printf.printf "Check families' children\n";
printf "Check families' children\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_fam - 1 do {
Expand All @@ -99,14 +100,14 @@ value check_families_children base nb_fam fix = do {
match get_parents a with
[ Some ifam1 ->
if ifam1 != ifam then do {
Printf.printf "*** bad parents : %s\n"
printf "*** bad parents : %s\n"
(designation base ip (poi base ip));
flush stdout;
}
else ()
| None -> do {
ProgrBar.suspend ();
Printf.printf "*** no parents : %s in family\n %s & %s\n"
printf "*** no parents : %s in family\n %s & %s\n"
(designation base ip (poi base ip))
(let ip = get_father fam in designation base ip (poi base ip))
(let ip = get_mother fam in designation base ip (poi base ip));
Expand All @@ -122,7 +123,7 @@ value check_families_children base nb_fam fix = do {
};

value check_persons_parents base nb_ind fix = do {
Printf.printf "Check persons' parents\n";
printf "Check persons' parents\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_ind - 1 do {
Expand All @@ -133,7 +134,7 @@ value check_persons_parents base nb_ind fix = do {
[ Some ifam ->
let fam = foi base ifam in
if is_deleted_family fam then do {
Printf.printf "*** parent family deleted: %s\n"
printf "*** parent family deleted: %s\n"
(designation base ip (poi base ip));
flush stdout;
patch_ascend base ip {parents = None; consang = Adef.fix (-1)};
Expand All @@ -143,7 +144,7 @@ value check_persons_parents base nb_ind fix = do {
let children = get_children fam in
if Array.mem ip children then ()
else do {
Printf.printf "*** not in parent's family: %s\n"
printf "*** not in parent's family: %s\n"
(designation base ip (poi base ip));
flush stdout;
let children = Array.append children [| ip |] in
Expand All @@ -156,7 +157,7 @@ value check_persons_parents base nb_ind fix = do {
};

value check_persons_families base nb_ind fix = do {
Printf.printf "Check persons' families\n";
printf "Check persons' families\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_ind - 1 do {
Expand All @@ -170,15 +171,15 @@ value check_persons_families base nb_ind fix = do {
if Array.mem ip (get_parent_array cpl) then ()
else do {
ProgrBar.suspend ();
Printf.printf "*** not father or mother of hir family: %s\n"
printf "*** not father or mother of hir family: %s\n"
(designation base ip (poi base ip));
flush stdout;
let ifams =
Array.append (Array.sub ifams 0 j)
(Array.sub ifams (j + 1) (Array.length ifams - j - 1))
in
patch_union base ip {family = ifams};
Printf.printf "*** fixed\n";
printf "*** fixed\n";
flush stdout;
fix.val := True;
ProgrBar.restart i nb_ind;
Expand All @@ -189,7 +190,7 @@ value check_persons_families base nb_ind fix = do {
};

value check_witnesses base nb_fam fix = do {
Printf.printf "Check witnesses\n";
printf "Check witnesses\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_fam - 1 do {
Expand All @@ -204,15 +205,15 @@ value check_witnesses base nb_fam fix = do {
if not (List.memq ifath (get_related p)) then do {
ProgrBar.suspend ();
let imoth = get_mother fam in
Printf.printf "*** in marriage: %s & %s\n"
printf "*** in marriage: %s & %s\n"
(designation base ifath (poi base ifath))
(designation base ifath (poi base imoth));
Printf.printf "*** witness has no pointer to marriage: %s\n"
printf "*** witness has no pointer to marriage: %s\n"
(designation base ip p);
flush stdout;
patch_person base ip
{(gen_person_of_person p) with related = [ifath :: get_related p]};
Printf.printf "*** fixed\n";
printf "*** fixed\n";
fix.val := True;
flush stdout;
ProgrBar.restart i nb_fam;
Expand All @@ -224,7 +225,7 @@ value check_witnesses base nb_fam fix = do {
};

value check_pevents_witnesses base nb_ind fix = do {
Printf.printf "Check persons' events witnesses\n";
printf "Check persons' events witnesses\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_ind - 1 do {
Expand All @@ -240,14 +241,14 @@ value check_pevents_witnesses base nb_ind fix = do {
let p2 = poi base ip2 in
if not (List.memq ip (get_related p2)) then do {
ProgrBar.suspend ();
Printf.printf "*** in persons' event: %s\n"
printf "*** in persons' event: %s\n"
(designation base ip2 (poi base ip2));
Printf.printf "*** witness has no pointer to persons' event: %s\n"
printf "*** witness has no pointer to persons' event: %s\n"
(designation base ip p);
flush stdout;
patch_person base ip2
{(gen_person_of_person p2) with related = [ip :: get_related p2]};
Printf.printf "*** fixed\n";
printf "*** fixed\n";
fix.val := True;
flush stdout;
ProgrBar.restart i nb_ind;
Expand All @@ -260,7 +261,7 @@ value check_pevents_witnesses base nb_ind fix = do {
};

value check_fevents_witnesses base nb_fam fix = do {
Printf.printf "Check family events witnesses\n";
printf "Check family events witnesses\n";
flush stdout;
ProgrBar.start ();
for i = 0 to nb_fam - 1 do {
Expand All @@ -278,15 +279,15 @@ value check_fevents_witnesses base nb_fam fix = do {
if not (List.memq ifath (get_related p)) then do {
ProgrBar.suspend ();
let imoth = get_mother fam in
Printf.printf "*** in family event: %s & %s\n"
printf "*** in family event: %s & %s\n"
(designation base ifath (poi base ifath))
(designation base ifath (poi base imoth));
Printf.printf "*** witness has no pointer to family event: %s\n"
printf "*** witness has no pointer to family event: %s\n"
(designation base ip p);
flush stdout;
patch_person base ip
{(gen_person_of_person p) with related = [ifath :: get_related p]};
Printf.printf "*** fixed\n";
printf "*** fixed\n";
fix.val := True;
flush stdout;
ProgrBar.restart i nb_fam;
Expand All @@ -313,7 +314,7 @@ value check bname = do {
check_fevents_witnesses base nb_fam fix;
if fix.val then Gwdb.commit_patches base
else do {
Printf.printf "No change\n";
printf "No change\n";
flush stdout;
}
};
Expand All @@ -333,7 +334,7 @@ value main () = do {
lock Mutil.lock_file bname.val with
[ Accept -> check bname.val
| Refuse -> do {
Printf.eprintf "Cannot lock database. Try again.\n";
eprintf "Cannot lock database. Try again.\n";
flush stderr;
} ]
};
Expand Down
7 changes: 4 additions & 3 deletions contrib/gwFix/gwFixBurial.ml
Expand Up @@ -3,6 +3,7 @@

open Def;
open Gwdb;
open Printf;

value trace = ref False;

Expand All @@ -21,7 +22,7 @@ value update_database_with_burial base = do {
else
do {
if trace.val then do {
Printf.eprintf "Modifiy person : %s\n" (Gutil.designation base p);
eprintf "Modifiy person : %s\n" (Gutil.designation base p);
flush stderr
}
else ();
Expand All @@ -44,7 +45,7 @@ value update_database_with_burial base = do {
};
if changed.val then do {
commit_patches base;
Printf.eprintf "Number of modified persons: %d\n" nb_modified.val;
eprintf "Number of modified persons: %d\n" nb_modified.val;
flush stderr
}
else ()
Expand All @@ -67,7 +68,7 @@ value main () = do {
let base = Gwdb.open_base bname.val in
update_database_with_burial base
| Refuse -> do {
Printf.eprintf "Cannot lock database. Try again.\n";
eprintf "Cannot lock database. Try again.\n";
flush stderr;
} ]
};
Expand Down
11 changes: 5 additions & 6 deletions contrib/gwFix/gwFixColon.ml
Expand Up @@ -2,6 +2,7 @@
(* $Id: gw_fix_base.ml,v 0.01 2014-02-21 16:26:45 flh Exp $ *)

open Gwdb;
open Printf;


value designation base ip p =
Expand All @@ -15,17 +16,15 @@ value designation base ip p =
;

value check_name base nb_ind fix = do {
Printf.printf "Check colon\n";
printf "Check colon\n";
flush stdout;
for i = 0 to nb_ind - 1 do {
let ip = Adef.iper_of_int i in
let p = poi base ip in
let fn = sou base (get_first_name p) in
let sn = sou base (get_surname p) in
if String.contains fn ':' || String.contains sn ':' then do {
Printf.printf
"*** bad name : %s %s (%d) => %s\n"
fn sn i (designation base ip (poi base ip));
printf "*** bad name : %s %s (%d) => %s\n" fn sn i (designation base ip (poi base ip));
flush stdout;
}
else ();
Expand All @@ -40,7 +39,7 @@ value check bname = do {
check_name base nb_ind fix;
if fix.val then Gwdb.commit_patches base
else do {
Printf.printf "No change\n";
printf "No change\n";
flush stdout;
}
};
Expand All @@ -60,7 +59,7 @@ value main () = do {
lock Mutil.lock_file bname.val with
[ Accept -> check bname.val
| Refuse -> do {
Printf.eprintf "Cannot lock database. Try again.\n";
eprintf "Cannot lock database. Try again.\n";
flush stderr;
} ]
};
Expand Down
7 changes: 4 additions & 3 deletions contrib/gwFix/gwFixEvtSrc.ml
Expand Up @@ -3,6 +3,7 @@

open Def;
open Gwdb;
open Printf;

value trace = ref False;

Expand Down Expand Up @@ -88,7 +89,7 @@ value update_database_with_burial base = do {
in
if changed then do {
if trace.val then do {
Printf.eprintf "Modifiy person : %s\n" (Gutil.designation base p);
eprintf "Modifiy person : %s\n" (Gutil.designation base p);
flush stderr
}
else ();
Expand All @@ -104,7 +105,7 @@ value update_database_with_burial base = do {
};
if base_changed.val then do {
commit_patches base;
Printf.eprintf "Number of modified persons: %d\n" nb_modified.val;
eprintf "Number of modified persons: %d\n" nb_modified.val;
flush stderr
}
else ()
Expand All @@ -127,7 +128,7 @@ value main () = do {
let base = Gwdb.open_base bname.val in
update_database_with_burial base
| Refuse -> do {
Printf.eprintf "Cannot lock database. Try again.\n";
eprintf "Cannot lock database. Try again.\n";
flush stderr;
} ]
};
Expand Down

0 comments on commit b49518b

Please sign in to comment.