+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'.
#include "gettext.h"
#include "message.h"
+#include "open-po.h"
#include "read-po.h"
#define _(str) gettext (str)
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);
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);
}
#include "po-charset.h"
#include "po-gram.h"
#include "po-hash.h"
-#include "open-po.h"
#include "xmalloc.h"
/* Local variables. */
}
-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. */
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
#include <stdlib.h>
#include <string.h>
+#include "open-po.h"
#include "xmalloc.h"
#include "gettext.h"
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;
}
#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"
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);
}