]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Use po_scan instead of po_scan_file.
authorBruno Haible <bruno@clisp.org>
Mon, 28 Apr 2003 13:10:17 +0000 (13:10 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:24 +0000 (12:10 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/msgfmt.c
gettext-tools/src/read-po-abstract.c
gettext-tools/src/read-po-abstract.h
gettext-tools/src/read-po.c
gettext-tools/src/xgettext.c

index 587013fa9feb417e5df8eb6f4a28e91859fa6b6c..7fde60e232410be6a0ced86ceffe95d0c642b6f3 100644 (file)
@@ -1,3 +1,13 @@
+2003-04-21  Bruno Haible  <bruno@clisp.org>
+
+       * read-po-abstract.h (po_scan_file): Remove declaration.
+       * read-po-abstract.c (po_scan_file): Remove function.
+       * read-po.c (read_po_file): Call read_po.
+       * msgfmt.c (read_po_file_msgfmt): Call open_po_file. Invoke po_scan
+       instead of po_scan_file.
+       * xgettext.c (read_exclusion_file): Call open_po_file. Invoke po_scan
+       instead of po_scan_file.
+
 2003-04-20  Bruno Haible  <bruno@clisp.org>
 
        * open-po.h (open_po_file): Add argument 'exit_on_error'.
index 91d9c1cc97fbda5d60e6f073814ab7ffed7a8b48..7a1fbe20b47728e74a0d4366b2ba5f3184f3ca96 100644 (file)
@@ -50,6 +50,7 @@
 
 #include "gettext.h"
 #include "message.h"
+#include "open-po.h"
 #include "read-po.h"
 
 #define _(str) gettext (str)
@@ -1538,6 +1539,8 @@ static default_po_reader_class_ty msgfmt_methods =
 static void
 read_po_file_msgfmt (char *filename)
 {
+  char *real_filename;
+  FILE *fp = open_po_file (filename, &real_filename, true);
   default_po_reader_ty *pop;
 
   pop = default_po_reader_alloc (&msgfmt_methods);
@@ -1555,6 +1558,9 @@ read_po_file_msgfmt (char *filename)
       pop->mlp = current_domain->mlp;
     }
   po_lex_pass_obsolete_entries (true);
-  po_scan_file ((abstract_po_reader_ty *) pop, filename);
+  po_scan ((abstract_po_reader_ty *) pop, fp, real_filename, filename);
   po_reader_free ((abstract_po_reader_ty *) pop);
+
+  if (fp != stdin)
+    fclose (fp);
 }
index 2e5be2e8d3014fad6db7b06a6baefdd7be90cc5b..4805fd75ff4a6cbbdc097f73aef2f03c8fb8dddb 100644 (file)
@@ -31,7 +31,6 @@
 #include "po-charset.h"
 #include "po-gram.h"
 #include "po-hash.h"
-#include "open-po.h"
 #include "xmalloc.h"
 
 /* Local variables.  */
@@ -169,20 +168,6 @@ po_scan (abstract_po_reader_ty *pop, FILE *fp,
 }
 
 
-void
-po_scan_file (abstract_po_reader_ty *pop, const char *filename)
-{
-  /* Open the file and parse it.  */
-  char *real_filename;
-  FILE *fp = open_po_file (filename, &real_filename, true);
-
-  po_scan (pop, fp, real_filename, filename);
-
-  if (fp != stdin)
-    fclose (fp);
-}
-
-
 /* ========================================================================= */
 /* Callbacks used by po-gram.y or po-hash.y or po-lex.c, indirectly
    from po_scan.  */
index c7bb0cb57e44580d97fba53ea1f43ca2e5cb39e2..87590a67298ca5fd88de1d3b13bc5008fa06d676 100644 (file)
@@ -137,11 +137,6 @@ extern void
        po_scan (abstract_po_reader_ty *pop, FILE *fp,
                const char *real_filename, const char *logical_filename);
 
-/* Locate a PO file, open it, read it, dispatching to the various
-   abstract_po_reader_class_ty methods, and close it.  */
-extern void
-       po_scan_file (abstract_po_reader_ty *pop, const char *filename);
-
 /* Call the destructor and deallocate a abstract_po_reader_ty (or derived
    class) instance.  */
 extern void
index 17e52594e1507fe41192852e1673508807af7b00..e4aec2089ada749dd0a98157f541021bda99bec7 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "open-po.h"
 #include "xmalloc.h"
 #include "gettext.h"
 
@@ -453,20 +454,14 @@ read_po (FILE *fp, const char *real_filename, const char *logical_filename)
 msgdomain_list_ty *
 read_po_file (const char *filename)
 {
-  default_po_reader_ty *pop;
-  msgdomain_list_ty *mdlp;
+  char *real_filename;
+  FILE *fp = open_po_file (filename, &real_filename, true);
+  msgdomain_list_ty *result;
 
-  pop = default_po_reader_alloc (&default_methods);
-  pop->handle_comments = true;
-  pop->handle_filepos_comments = (line_comment != 0);
-  pop->allow_domain_directives = true;
-  pop->allow_duplicates = allow_duplicates;
-  pop->allow_duplicates_if_same_msgstr = false;
-  pop->mdlp = msgdomain_list_alloc (!pop->allow_duplicates);
-  pop->mlp = msgdomain_list_sublist (pop->mdlp, pop->domain, true);
-  po_lex_pass_obsolete_entries (true);
-  po_scan_file ((abstract_po_reader_ty *) pop, filename);
-  mdlp = pop->mdlp;
-  po_reader_free ((abstract_po_reader_ty *) pop);
-  return mdlp;
+  result = read_po (fp, real_filename, filename);
+
+  if (fp != stdin)
+    fclose (fp);
+
+  return result;
 }
index 5a74a7262478bd40e434f30a7373b7079413d6d5..b89e6a61f997bc75c52969330d749da04db514bb 100644 (file)
@@ -47,6 +47,7 @@
 #include "pathname.h"
 #include "strcase.h"
 #include "stpcpy.h"
+#include "open-po.h"
 #include "read-po-abstract.h"
 #include "message.h"
 #include "po-charset.h"
@@ -794,13 +795,18 @@ static abstract_po_reader_class_ty exclude_methods =
 
 
 static void
-read_exclusion_file (char *file_name)
+read_exclusion_file (char *filename)
 {
+  char *real_filename;
+  FILE *fp = open_po_file (filename, &real_filename, true);
   abstract_po_reader_ty *pop;
 
   pop = po_reader_alloc (&exclude_methods);
-  po_scan_file (pop, file_name);
+  po_scan (pop, fp, real_filename, filename);
   po_reader_free (pop);
+
+  if (fp != stdin)
+    fclose (fp);
 }