Permalink
Browse files

Convert gwsetup to UTF-8/HTML5, few new options

* clean-up of files, typography for French
* add missing options available in CLI
* add connex
* gwsetup is now fully aware of the port used by gwd (-p_gwd, %P)
* possibility of a small css file in setup/lang/*.htm files
  • Loading branch information...
hgouraud authored and sagotch committed Apr 3, 2018
1 parent 0b0c99f commit 17179d102fbb0fe4785b4da1958b75ee9a49bd21
Showing with 5,448 additions and 3,995 deletions.
  1. +6 −6 Makefile
  2. +110 −20 contrib/gwbase/etc/connex.ml
  3. +5 −1 contrib/gwdiff/gwdiff.ml
  4. +78 −61 etc/START.htm
  5. +8 −12 etc/macOS/geneweb.command
  6. BIN etc/macOS/icons/gwd-114x114.png
  7. BIN etc/macOS/icons/gwd-120x120.png
  8. BIN etc/macOS/icons/gwd-158x158.png
  9. BIN etc/macOS/icons/gwd-180x180.png
  10. BIN etc/macOS/icons/gwd-320x320.png
  11. BIN etc/macOS/icons/gwd.png
  12. +0 −38 etc/macOS/install.command
  13. +27 −26 setup/lang/backg.htm
  14. +103 −0 setup/lang/bsc.htm
  15. +43 −38 setup/lang/bsi.htm
  16. +107 −0 setup/lang/bsi_connex.htm
  17. +56 −33 setup/lang/bsi_err.htm
  18. +76 −76 setup/lang/bso.htm
  19. +20 −15 setup/lang/bso_comm.htm
  20. +31 −31 setup/lang/bso_err.htm
  21. +44 −0 setup/lang/bso_log.htm
  22. +50 −50 setup/lang/bso_ok.htm
  23. +51 −51 setup/lang/clean_ok.htm
  24. +69 −80 setup/lang/cleanup.htm
  25. +38 −38 setup/lang/cleanup1.htm
  26. +195 −0 setup/lang/connex.htm
  27. +78 −0 setup/lang/connex_ok.htm
  28. +50 −50 setup/lang/consang.htm
  29. +33 −33 setup/lang/consg_ok.htm
  30. +36 −36 setup/lang/del_ok.htm
  31. +41 −44 setup/lang/delete.htm
  32. +42 −42 setup/lang/delete_1.htm
  33. +30 −30 setup/lang/err_acc.htm
  34. +18 −18 setup/lang/err_cnfl.htm
  35. +23 −23 setup/lang/err_miss.htm
  36. +35 −35 setup/lang/err_name.htm
  37. +16 −16 setup/lang/err_ndir.htm
  38. +52 −52 setup/lang/err_ngw.htm
  39. +27 −27 setup/lang/err_outd.htm
  40. +62 −62 setup/lang/err_reco.htm
  41. +13 −13 setup/lang/err_smdr.htm
  42. +21 −21 setup/lang/err_unkn.htm
  43. +334 −314 setup/lang/ged2gwb.htm
  44. +429 −301 setup/lang/ged2gwb2.htm
  45. +33 −33 setup/lang/gw2gd_ok.htm
  46. +183 −183 setup/lang/gwb2ged.htm
  47. +141 −91 setup/lang/gwc.htm
  48. +141 −91 setup/lang/gwc2.htm
  49. +195 −195 setup/lang/gwd.htm
  50. +54 −53 setup/lang/gwd_info.htm
  51. +44 −44 setup/lang/gwd_ok.htm
  52. +237 −0 setup/lang/gwdiff.htm
  53. +59 −0 setup/lang/gwdiff_ok.htm
  54. +33 −33 setup/lang/gwf.htm
  55. +291 −291 setup/lang/gwf_1.htm
  56. +49 −49 setup/lang/gwf_ok.htm
  57. +129 −108 setup/lang/gwu.htm
  58. +60 −32 setup/lang/gwu_ok.htm
  59. +16 −16 setup/lang/intro.txt
  60. +0 −64 setup/lang/intro.txt.dos
  61. +41 −38 setup/lang/lexicon.txt
  62. +31 −30 setup/lang/list.htm
  63. +125 −124 setup/lang/main.htm
  64. +61 −76 setup/lang/merge.htm
  65. +39 −38 setup/lang/merge_1.htm
  66. +30 −30 setup/lang/recover.htm
  67. +56 −57 setup/lang/recover1.htm
  68. +67 −67 setup/lang/recover2.htm
  69. +30 −30 setup/lang/ren_ok.htm
  70. +32 −32 setup/lang/rename.htm
  71. +61 −62 setup/lang/save.htm
  72. +35 −40 setup/lang/simple.htm
  73. +36 −41 setup/lang/simple2.htm
  74. +53 −35 setup/lang/traces.htm
  75. +40 −44 setup/lang/update_nldb.htm
  76. +35 −33 setup/lang/update_nldb_ok.htm
  77. +184 −193 setup/lang/welcome.htm
  78. +34 −0 setup/setup.css
  79. +3 −0 setup/setup.gwf
  80. +333 −49 setup/setup.ml
View
@@ -5,7 +5,7 @@ include $(ROOT)/tools/Makefile.common
# ALL: directories needed to make distribution
ALL_TARGETS := wserver dag2html src ged2gwb gwb2ged setup gwtp
# EVERYTHING: any other maintained project
EVERYTHING_TARGETS := gui contrib/gwpublic contrib/oneshot contrib/misc contrib/gwFix contrib/history contrib/gwdiff contrib/gwbase/etc contrib/lex
EVERYTHING_TARGETS := contrib/gwpublic contrib/oneshot contrib/misc contrib/gwFix contrib/history contrib/gwdiff contrib/gwbase/etc contrib/lex
suffixed_TARGETS := $(foreach suffix,all clean depend everything opt out,$(ALL_TARGETS:=?$(suffix)) $(EVERYTHING_TARGETS:=?$(suffix)) tools?$(suffix))
@@ -109,6 +109,8 @@ distrib:
cp ged2gwb/ged2gwb $(DESTDIR)/gw/ged2gwb$(EXE)
cp ged2gwb/ged2gwb2 $(DESTDIR)/gw/ged2gwb2$(EXE)
cp gwb2ged/gwb2ged $(DESTDIR)/gw/gwb2ged$(EXE)
cp contrib/gwbase/etc/connex.out $(DESTDIR)/gw/connex$(EXE)
cp contrib/gwdiff/gwdiff.out $(DESTDIR)/gw/gwdiff$(EXE)
cp setup/setup $(DESTDIR)/gw/gwsetup$(EXE)
mkdir $(DESTDIR)/gw/gwtp_tmp
mkdir $(DESTDIR)/gw/gwtp_tmp/lang
@@ -118,13 +120,11 @@ distrib:
mkdir $(DESTDIR)/gw/setup
cp setup/intro.txt $(DESTDIR)/gw/setup/.
mkdir $(DESTDIR)/gw/setup/lang
if test $(OS_TYPE) = "Win"; then \
cp setup/lang/intro.txt.dos $(DESTDIR)/gw/setup/lang/intro.txt; \
else \
cp setup/lang/intro.txt $(DESTDIR)/gw/setup/lang/intro.txt; \
fi
cp setup/setup.gwf $(DESTDIR)/gw/setup/.
cp setup/setup.css $(DESTDIR)/gw/setup/.
cp setup/lang/*.htm $(DESTDIR)/gw/setup/lang/.
cp setup/lang/lexicon.txt $(DESTDIR)/gw/setup/lang/.
cp setup/lang/intro.txt $(DESTDIR)/gw/setup/lang/.
cp -R hd/* $(DESTDIR)/gw/.
rm -f $(DESTDIR)/exe-version.txt
echo "Commit: `git log -1 | grep commit | cut -c8-15`, `date`" > $(DESTDIR)/commit.txt
@@ -5,10 +5,17 @@ open Def;
open Gwdb;
value all = ref False;
value statistics = ref False;
value detail = ref 0;
value ignore = ref [];
value output = ref "";
value ignore_files = ref True;
value ask_for_delete = ref 0;
value cnt_for_delete = ref 0;
value exact = ref False;
value gwd_port = ref 2317;
value bname = ref "";
value server = ref "127.0.0.1";
value rec merge_families ifaml1f ifaml2f =
match (ifaml1f, ifaml2f) with
@@ -84,16 +91,42 @@ value utf8_designation base p =
else s
;
value print_family base ifam = do {
value wiki_designation base basename p =
let first_name = p_first_name base p in
let surname = p_surname base p in
let s = "[[" ^ first_name ^ "/" ^ surname ^ "/" ^ string_of_int (get_occ p) ^ "/" ^
first_name ^ "." ^ string_of_int (get_occ p) ^ " " ^ surname ^ "]]" in
if first_name = "?" || surname = "?" then
let indx = string_of_int (Adef.int_of_iper (get_key_index p)) in
s ^ " <a href=\"http://" ^ server.val ^ ":" ^ (string_of_int gwd_port.val) ^ "/" ^
basename ^ "?i=" ^ indx ^ "\">(i=" ^ indx ^ ")</a><br>"
else s ^ "<br>"
;
value print_family base basename ifam = do {
let fam = foi base ifam in
let p = poi base (get_father fam) in
if sou base (get_first_name p) = "?" || sou base (get_surname p) = "?"
then
Printf.printf "i=%d" (Adef.int_of_iper (get_key_index p))
else Printf.printf " - %s" (utf8_designation base p);
Printf.printf "\n";
Printf.printf " - %s\n"
(utf8_designation base (poi base (get_mother fam)));
do {
if output.val <> "" then do {
if sou base (get_first_name p) = "?" || sou base (get_surname p) = "?"
then
Printf.eprintf "i=%d" (Adef.int_of_iper (get_key_index p))
else Printf.eprintf " - %s" (utf8_designation base p);
Printf.eprintf "\n";
Printf.eprintf " - %s\n"
(utf8_designation base (poi base (get_mother fam)));
flush stderr;
} else ();
if sou base (get_first_name p) = "?" || sou base (get_surname p) = "?"
then
let indx = (Adef.int_of_iper (get_key_index p)) in
Printf.printf " - <a href=\"http://%s:%d/%s?i=%d\">i=%d</a><br>"
server.val gwd_port.val basename indx indx
else Printf.printf " - %s" (wiki_designation base basename p);
Printf.printf "\n";
Printf.printf " - %s\n"
(wiki_designation base basename (poi base (get_mother fam)));
}
};
value kill_family base fam ip =
@@ -113,15 +146,22 @@ value effective_del base (ifam, fam) = do {
Gwdb.delete_family base ifam;
};
value move base = do {
value move base basename = do {
load_ascends_array base;
load_unions_array base;
load_couples_array base;
load_descends_array base;
Printf.printf "<h3>Connected components of base %s</h3><br>\n" basename;
let ic = Unix.open_process_in "date" in
let date = input_line ic in
let () = close_in ic in
Printf.printf "Computed on %s<br><br>\n" date;
flush stderr;
let nb_fam = nb_of_families base in
let mark = Array.make nb_fam False in
let min = ref max_int in
let max = ref 0 in
let hts = Hashtbl.create 100 in
for i = 0 to nb_fam - 1 do {
let ifam = Adef.ifam_of_int i in
let fam = foi base ifam in
@@ -154,16 +194,39 @@ value move base = do {
if nb > 0 && (all.val || nb <= min.val) then do {
if nb <= min.val then min.val := nb else ();
if nb >= max.val then max.val := nb else ();
Printf.printf "Connex component \"%s\" length %d\n"
if output.val <> "" then do {
Printf.eprintf "Connex component \"%s\" length %d\n"
(sou base origin_file) nb;
flush stderr;
} else ();
Printf.printf "Connex component \"%s\" length %d<br>\n"
(sou base origin_file) nb;
if detail.val == nb then List.iter (print_family base) ifaml
else print_family base ifam;
if detail.val == nb then List.iter (print_family base basename) ifaml
else print_family base basename ifam;
if statistics.val then
try
let n = Hashtbl.find hts nb in
Hashtbl.replace hts nb (n+1)
with
[ Not_found -> Hashtbl.add hts nb 1 ]
else ();
flush stdout;
if ask_for_delete.val > 0 && nb <= ask_for_delete.val then do {
Printf.eprintf "Delete that branch (y/N) ? ";
let check_ask =
if exact.val then nb = ask_for_delete.val else nb <= ask_for_delete.val
in
if ask_for_delete.val > 0 && check_ask then do {
(* if -o file, repeat branch definition to stderr! *)
Printf.eprintf "Delete up to %d branches of size %s %d ?\n"
cnt_for_delete.val (if exact.val then "=" else "<=") ask_for_delete.val;
flush stderr;
let r = input_line stdin in
let r = if cnt_for_delete.val > 0 then "y"
else do {
Printf.eprintf "Delete that branch (y/N) ?";
flush stderr;
input_line stdin }
in
if r = "y" then do {
decr cnt_for_delete;
List.iter
(fun ifam -> do {
let fam = foi base ifam in
@@ -185,19 +248,46 @@ value move base = do {
else ();
};
if ask_for_delete.val > 0 then Gwdb.commit_patches base else ();
if statistics.val then do {
Printf.printf "<br>\nStatistics:<br>\n";
let ls =
Hashtbl.fold (fun nb n ls -> [(nb, n) :: ls] ) hts []
in
let ls = List.sort compare ls in
let ls = List.rev ls in
List.iter
(fun item ->
match item with
[(nb, n) -> Printf.printf "%d(%d) " nb n ]
) ls;
Printf.printf "\n"
}
else ();
};
value bname = ref "";
value usage = "usage: " ^ Sys.argv.(0) ^ " <base>";
value speclist =
[("-a", Arg.Set all, ": all connex components");
[("-gwd_p", Arg.Int (fun x -> gwd_port.val := x),
"<number>: Specify the port number of gwd (default = " ^
string_of_int gwd_port.val ^ "); > 1024 for normal users.");
("-server", Arg.String (fun x -> server.val := x ),
"<string>: Name of the server (default is 127.0.0.1).");
("-a", Arg.Set all, ": all connex components");
("-s", Arg.Set statistics, ": produce statistics");
("-d", Arg.Int (fun x -> detail.val := x),
"<int> : detail for this length");
("-i", Arg.String (fun x -> ignore.val := [x :: ignore.val]),
"<file> : ignore this file");
("-bf", Arg.Clear ignore_files, ": by origin files");
("-del", Arg.Int (fun i -> ask_for_delete.val := i),
"<int> : ask for deleting branches whose size <= that value")]
"<int> : ask for deleting branches whose size <= that value");
("-cnt", Arg.Int (fun i -> cnt_for_delete.val := i),
"<int> : delete cnt branches whose size <= -del value");
("-exact", Arg.Set exact, ": delete only branches whose size strictly = -del value");
("-o", Arg.String (fun x -> output.val := x),
"<file> : output to this file")
]
;
value main () =
@@ -206,14 +296,14 @@ value main () =
if ask_for_delete.val > 0 then
match
Lock.control (Mutil.lock_file bname.val) False
(fun () -> move (Gwdb.open_base bname.val))
(fun () -> move (Gwdb.open_base bname.val) bname.val)
with
[ Some () -> ()
| None -> do {
Printf.eprintf "Base locked. Try again.\n";
flush stdout
} ]
else move (Gwdb.open_base bname.val)
else move (Gwdb.open_base bname.val) bname.val
}
;
View
@@ -13,6 +13,7 @@ value in_file2 = ref "";
value html = ref False;
value root = ref "";
value cr = ref "";
value output = ref [];
type messages =
[ MsgBadChild of iper
@@ -558,7 +559,10 @@ value speclist =
": checks descendants (default)");
("-html", Arg.String (fun s -> do { html.val := True; root.val := s }),
"<root>: HTML format used for report");
("-mem", Arg.Set mem, ": save memory space, but slower") ]
("-mem", Arg.Set mem, ": save memory space, but slower");
("-o", Arg.String (fun x -> output.val := [x :: output.val]),
"<file> : output to this file")
]
;
value anonfun s =
Oops, something went wrong.

0 comments on commit 17179d1

Please sign in to comment.