From 8ae1ec789e8843a2d2a5e71ab11bc9cb6c3cfcd1 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 23:51:52 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/.gitignore b/.gitignore index 87821c3..d853d40 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,3 @@ -*.a -*.cma -*.cmi -*.cmo -*.cmx -*.cmxa -*.o -*.so -*_parser.output /_build/ /setup.data /setup.log @@ -16,12 +7,6 @@ /configure /libgettext-ocaml/META /libgettext-ocaml/gettextConfig.ml -/libgettext-ocaml/gettextPo_parser.mli /config.log /config.status -/po/*.mo /po/fr.po.bak -/doc/*.1 -/doc/*.5 -/ocaml-gettext/ocaml-gettext -/ocaml-gettext/ocaml-xgettext diff --git a/TopMakefile b/TopMakefile index cd2d505..4405879 100644 --- a/TopMakefile +++ b/TopMakefile @@ -102,7 +102,7 @@ GET_MLI=$(foreach interf,$(patsubst %.mli,%,$(filter %.mli,$(patsubst %.cmi,%.ml %.cmxa %.a %.so: $(if $(STUBSOBJS), \ $(OCAMLMKLIB) -o $* $^ $(OCAMLMKLIB_FLAGS), \ - $(OCAMLOPT) -g -a -o $*.cmxa $^ \ + $(OCAMLOPT) -a -o $*.cmxa $^ \ ) %.cma %.a %.so: @@ -161,7 +161,7 @@ install-prog-byte: install-buildprog-byte OLIBS = $(addsuffix .cmxa,$(LIBS)) install-buildprog-opt: $(CMX) - $(OCAMLOPT) -g -o $(NAME) $(INCLUDES) -package "$(REQUIRES)" -linkpkg \ + $(OCAMLOPT) -o $(NAME) $(INCLUDES) -package "$(REQUIRES)" -linkpkg \ -predicates "$(PREDICATES)" $(OLIBS) $(CMX) $(INSTALL) -d $(BUILDBIN) $(INSTALL_SCRIPT) -t $(BUILDBIN) $(NAME) @@ -300,10 +300,10 @@ uninstall-doc-man: clean-doc-man $(OCAMLC) $(INCLUDES) $(CLI_OCAMLFIND) -c $< .ml.o: - $(OCAMLOPT) -g $(INCLUDES) $(CLI_OCAMLFIND) -c $< + $(OCAMLOPT) $(INCLUDES) $(CLI_OCAMLFIND) -c $< .ml.cmx: - $(OCAMLOPT) -g $(INCLUDES) $(CLI_OCAMLFIND) -c $< + $(OCAMLOPT) $(INCLUDES) $(CLI_OCAMLFIND) -c $< .mll.ml: $(OCAMLLEX) $< diff --git a/libgettext-ocaml/gettextMo_int32.ml b/libgettext-ocaml/gettextMo_int32.ml index 97c7c82..7490a3e 100644 --- a/libgettext-ocaml/gettextMo_int32.ml +++ b/libgettext-ocaml/gettextMo_int32.ml @@ -104,11 +104,11 @@ let input_int32_pair_string chn endian = (Int32.to_int length,Int32.to_int offset) in if 0 <= ioffset + ilength && ioffset + ilength < in_channel_length chn then - let str = Bytes.make ilength 'X' + let str = String.make ilength 'X' in seek_in chn ioffset; really_input chn str 0 ilength; - Bytes.to_string str + str else (* We use this exception, because that what should happen if we try to read the string *) diff --git a/libgettext-ocaml/pr_gettext.ml b/libgettext-ocaml/pr_gettext.ml index 47d93e5..c44933f 100644 --- a/libgettext-ocaml/pr_gettext.ml +++ b/libgettext-ocaml/pr_gettext.ml @@ -71,18 +71,49 @@ struct module Loc = Syntax.Loc module Ast = Syntax.Ast + type untranslated_t = + { + str: string; (* Real string, not OCaml one *) + locations: (string * int) list; (* Location in the file *) + } + type t = { po_content: po_content; translated: SetString.t; + untranslated: untranslated_t MapString.t; } let string_of_ocaml_string str = + prerr_endline str; Scanf.sscanf (Printf.sprintf "\"%s\"" str) "%S" (fun s -> s) + let string_not_translated t ocaml_str = + not (SetString.mem ocaml_str t.translated) + + let add_untranslated t loc ocaml_str = + let cur = + try + MapString.find ocaml_str t.untranslated + with Not_found -> + { + str = string_of_ocaml_string ocaml_str; + locations = []; + } + in + let untranslated = + MapString.add + ocaml_str + {cur with + locations = + (Loc.file_name loc, Loc.start_line loc) :: cur.locations} + t.untranslated + in + {t with untranslated = untranslated} + let add_translation t loc ocaml_singular plural_opt domain = let filepos = @@ -133,6 +164,15 @@ struct | Some f -> open_out f | None -> stdout in + MapString.iter + (fun _ {str = str; locations = locs} -> + List.iter + (fun (fn, lineno) -> + Printf.eprintf + "%s:%d String %S not translated\n%!" + fn lineno str) + locs) + t.untranslated; Marshal.to_channel fd t.po_content [] (* Check if the given node belong to the given functions *) @@ -157,6 +197,7 @@ struct val t = { po_content = empty_po; + untranslated = MapString.empty; translated = SetString.empty; } @@ -193,6 +234,10 @@ struct (* Add a plural / defined domain string *) {< t = add_translation t loc singular (Some plural) (Some domain) >} + | <:expr@loc<$str:str$>> when + string_not_translated t str -> + {< t = add_untranslated t loc str >} + | e -> super#expr e end