]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
General tweaks, code moves, and cleanups.
authorBruno Haible <bruno@clisp.org>
Tue, 9 Jan 2001 19:22:07 +0000 (19:22 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 9 Jan 2001 19:22:07 +0000 (19:22 +0000)
30 files changed:
lib/ChangeLog
lib/system.h
po/ChangeLog
po/da.po
src/ChangeLog
src/FILES [new file with mode: 0644]
src/Makefile.am
src/dir-list.c
src/dir-list.h
src/domain.h [deleted file]
src/gettextp.c
src/message.c
src/message.h
src/msgcmp.c
src/msgcomm.c
src/msgfmt.c
src/msgmerge.c
src/msgunfmt.c
src/open-po.c
src/open-po.h [new file with mode: 0644]
src/po-gram-gen.y
src/po-lex.c
src/po-lex.h
src/po.c
src/po.h
src/pos.h [new file with mode: 0644]
src/str-list.c
src/str-list.h
src/xgettext.c
src/ylwrap

index 52add8b9ec4be16632adb3edc6a8937598493eff..8823b2fbcf63b697520f5e3799fc161e6b766931 100644 (file)
@@ -1,3 +1,7 @@
+2000-12-30  Bruno Haible  <haible@clisp.cons.org>
+
+       * system.h (open_po_file): Remove declaration.
+
 2000-12-30  Bruno Haible  <haible@clisp.cons.org>
 
        * printf.h (printf_info): New fields is_char, is_longlong.
index 75c2ed855c229237d41ebb5cfdc0868450f23fec..f938d76148d1988b7406f2eb2b97e3f1594259d3 100644 (file)
@@ -1,5 +1,5 @@
 /* Header for GNU gettext libiberty
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 unsigned long strtoul ();
 #endif
 
-/* Prototypes for helper functions.  */
-extern FILE *open_po_file PARAMS ((const char *__input_name,
-                                  char **__file_name));
-
 /* Wrapper functions with error checking for standard functions.  */
 extern char *xgetcwd PARAMS ((void));
 extern void *xmalloc PARAMS ((size_t __n));
index 8a0e8361c5ca67e5bec6dc1bb1f0434d252f4a9e..14d683d6b7fe55c07907e5fefba6929726d25e9c 100644 (file)
@@ -1,6 +1,10 @@
+2000-12-31  Bruno Haible  <haible@clisp.cons.org>
+
+       * da.po: Change charset from ISO-Latin-1 to ISO-8859-1.
+
 2000-11-10  Bruno Haible  <haible@clisp.cons.org>
 
-       * po/Makefile.in.in (dist, distdir): Don't use 'ln' (which was just a
+       * Makefile.in.in (dist, distdir): Don't use 'ln' (which was just a
        space optimization anyway) to populate $(distdir).  Otherwise, the
        dist rules that change permissions end up affecting the master
        sources.  From Jim Meyering  <meyering@ascend.com>.
index db9b05670bb0bb9dd279383348834f2d9c763f1d..e95706bc639eded840dc020c772e1f59bb998ce7 100644 (file)
--- a/po/da.po
+++ b/po/da.po
@@ -9,7 +9,7 @@ msgstr ""
 "Last-Translator: Thorbjoern Ravn Andersen <ravn@mip.ou.dk>\n"
 "Language-Team: Danish <da@li.org>\n"
 "MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-Latin-1\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: Base64\n"
 
 #: lib/error.c:103
index cc8cca75c7e5c080356979813136df0cab8b5eb8..481f2d994555da182e8446f6806ee4480023d257 100644 (file)
@@ -1,3 +1,63 @@
+2000-12-31  Bruno Haible  <haible@clisp.cons.org>
+
+       * str-list.h: Fix typo. Add comments.
+       * str-list.c: Add comments.
+
+       * dir-list.h: Add comments.
+       * dir-list.c: Likewise.
+
+       * domain.h: Remove file.
+       * msgfmt.c: Incorporate it here. Don't include "domain.h".
+       * msgunfmt.c: Don't include "domain.h".
+       * xgettext.c: Likewise.
+       * Makefile.am (noinst_HEADERS): Remove domain.h.
+
+       * open-po.h: New file.
+       * open-po.c: Include it.
+       * po-lex.c: Likewise.
+       * Makefile.am (noinst_HEADERS): Add open-po.h.
+
+       * open-po.c (open_po_file): Merge duplicated code.
+
+       * po-lex.h: Add comments.
+       (gram_max_allowed_errors): Change type to 'unsigned int'.
+       (po_gram_error_at_line): Renamed from gram_error_at_line.
+       (po_gram_error, po_gram_error_at_line): Use ISO C 99 macro vararg
+       syntax if possible.
+       * po-lex.c: Add comments. Don't include "po-gram.h".
+       (po_gram_error_at_line): Renamed from gram_error_at_line.
+       * msgmerge.c (main): Initialize gram_max_allowed_errors to UINT_MAX.
+
+       * message.h: Add comments.
+       (enum is_wrap): New type.
+       (parse_c_width_description_string): Change return type.
+       (message_ty): Change type of do_wrap field.
+       * message.c (wrap): Change type of do_wrap argument.
+       * msgfmt.c (msgfmt_class_ty): Change type of do_wrap field.
+       * msgmerge.c (merge_class_ty): Change type of do_wrap field.
+       * msgcomm.c (extract_class_ty): Change types of is_c_format, do_wrap
+       fields.
+       * xgettext.c (extract_class_ty): Likewise.
+       (remember_a_message): Change type of do_wrap.
+
+       * pos.h: New file.
+       * po-lex.h: Include it.
+       (struct lex_pos_ty): Remove type, now in pos.h.
+       * message,h: Include pos.h instead of po-lex.h.
+       * Makefile.am (noinst_HEADERS): Add pos.h.
+
+       * po.h: Add comments.
+
+       * gettextp.c (main): Use bindtextdomain instead of bindtextdomain__,
+       and dgettext instead of dgettext__. There is no need to use the
+       included libintl when GNU gettext or an X/Open gettext or a catgets
+       has been found in the system's C library.
+
+       * ylwrap: Update from automake-1.4.
+
+       * FILES: New file.
+       * Makefile.am (EXTRA_DIST): New variable.
+
 2000-12-30  Bruno Haible  <haible@clisp.cons.org>
 
        * xgettext.c (scanner_c, scanner_cxx): Remove declarations.
diff --git a/src/FILES b/src/FILES
new file mode 100644 (file)
index 0000000..320bb9b
--- /dev/null
+++ b/src/FILES
@@ -0,0 +1,67 @@
+                Short description of the source files
+                =====================================
+
+1)
+gettextp.c      Source for the 'gettext' program.
+
+2) The msgfmt, msgunfmt, msgcmp, msgcomm, msgmerge, xgettext programs.
+
+Bottom-up structure:
+
+str-list.h
+str-list.c
+                A list-of-immutable-strings type.
+
+dir-list.h
+dir-list.c
+                Management of the list of directories where PO files are
+                searched.
+
+pos.h
+                Source file positions.
+
+message.h
+message.c
+                The message type, with many utility routines.
+                A list-of-messages type.
+                A list-of-lists-of-messages type.
+
+msgunfmt.c      Main source for the 'msgunfmt' program.
+
+open-po.h
+open-po.c
+                Opening PO files for reading.
+
+po-lex.h
+po-lex.c
+                Lexical analysis of PO files.
+
+po.h
+po-hash.h
+po-hash-gen.y
+po-gram.h
+po-gram-gen.y
+po.c
+                Parsing of PO files.
+        po.h
+                        General parser structure.
+        po-hash.h
+        po-hash-gen.y
+                        Lexical analysis and parsing of pseudo-comments in
+                        PO files, introduced by "#:" and "#".
+        po-gram.h
+        po-gram-gen.y
+                        Parsing of PO files, based on po-lex.{h,c}.
+        po.c
+                        Top-level parser functions and callbacks.
+
+msgfmt.c        Main source for the 'msgfmt' program.
+msgcmp.c        Main source for the 'msgcmp' program.
+msgcomm.c       Main source for the 'msgcomm' program.
+msgmerge.c      Main source for the 'msgmerge' program.
+
+xget-lex.h
+xget-lex.c
+                Lexical analysis of C/C++ files.
+
+xgettext.c      Main source for the 'xgettext' program.
index 2e6ffb9f1740e3bad1c59c681bae8a60f7c8521b..2cdf0932810212eff8e7ce9bbc8e7ef3a97456c7 100644 (file)
@@ -21,9 +21,11 @@ AUTOMAKE_OPTIONS = 1.2 gnits
 
 bin_PROGRAMS = gettext msgcmp msgfmt msgmerge msgunfmt xgettext msgcomm
 
-noinst_HEADERS = domain.h message.h po-gram.h po-hash.h po-lex.h po.h \
+noinst_HEADERS = pos.h message.h po-gram.h po-hash.h po-lex.h po.h open-po.h \
 str-list.h xget-lex.h dir-list.h po-gram-gen.h po-hash-gen.h
 
+EXTRA_DIST = FILES
+
 datadir = $(prefix)/@DATADIRNAME@
 localedir = $(datadir)/locale
 
index e02d708994b3705060a52c779d9633698dd9694b..9173bb5391965cccfd574877633008f80d8ae815 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "config.h"
 #endif
 
-#ifdef STDC_HEADERS
+#ifdef HAVE_STDLIB_H
 # include <stdlib.h>
 #endif
 
@@ -30,9 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "dir-list.h"
 #include "str-list.h"
 
-static string_list_ty *directory;
+static string_list_ty *directory /* = NULL */;
 
 
+/* Append a directory to the end of the list of directories.  */
 void
 dir_list_append (s)
      const char *s;
@@ -43,12 +44,15 @@ dir_list_append (s)
 }
 
 
+/* Return the nth directory, or NULL of n is out of range.  */
 const char *
 dir_list_nth (n)
      int n;
 {
+  /* The default value of the list consists of the single directory ".".  */
   if (directory == NULL)
     dir_list_append (".");
+
   if (n < 0 || n >= directory->nitems)
     return NULL;
   return directory->item[n];
index fd6bae7a35cca7f5404f0df47343234228a355a3..d3378c2c91ace79e3b3815cb22ff5a8c30fc82f7 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -20,7 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #ifndef SRC_DIR_LIST_H
 #define SRC_DIR_LIST_H
 
-void dir_list_append PARAMS ((const char *__directory));
-const char *dir_list_nth PARAMS ((int __n));
+/* Management of the list of directories where PO files are searched.
+   It is an ordered list, without duplicates.  The default value of the
+   list consists of the single directory ".".  */
+
+/* Append a directory to the end of the list of directories.  */
+extern void dir_list_append PARAMS ((const char *__directory));
+
+/* Return the nth directory, or NULL of n is out of range.  */
+extern const char *dir_list_nth PARAMS ((int __n));
 
 #endif /* SRC_DIR_LIST_H */
diff --git a/src/domain.h b/src/domain.h
deleted file mode 100644 (file)
index c3d4284..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-#ifndef _DOMAIN_H
-#define _DOMAIN_H 1
-
-#include <stdio.h>
-#include "hash.h"
-
-struct msg_domain
-{
-  /* Table for mapping message IDs to message strings.  */
-  hash_table symbol_tab;
-  /* Name domain these ID/String pairs are part of.  */
-  const char *domain_name;
-  /* Link to the next domain.  */
-  struct msg_domain *next;
-};
-
-#endif /* domain.h  */
index 911577e65bfe3de1c6412ca998873be482033182..6b6d1079235a060c5da05f7fa2b70301f7efe383 100644 (file)
@@ -1,5 +1,5 @@
 /* gettext - retrieve text string from message catalog and print it.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, May 1995.
 
    This program is free software; you can redistribute it and/or modify
@@ -23,7 +23,7 @@
 #include <getopt.h>
 #include <stdio.h>
 
-#ifdef STDC_HEADERS
+#ifdef HAVE_STDLIB_H
 # include <stdlib.h>
 #else
 char *getenv ();
@@ -74,17 +74,19 @@ main (argc, argv)
      char *argv[];
 {
   int optchar;
+  const char *msgid;
+
+  /* Default values for command line options.  */
   int do_help = 0;
   int do_shell = 0;
   int do_version = 0;
-  const char *msgid;
   const char *domain = getenv ("TEXTDOMAIN");
   const char *domaindir = getenv ("TEXTDOMAINDIR");
+  add_newline = 1;
+  do_expand = 0;
 
   /* Set program name for message texts.  */
   program_name = argv[0];
-  add_newline = 1;
-  do_expand = 0;
 
 #ifdef HAVE_SETLOCALE
   /* Set locale via LC_ALL.  */
@@ -95,6 +97,7 @@ main (argc, argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  /* Parse command line options.  */
   while ((optchar = getopt_long (argc, argv, "+d:eEhnsV", long_options, NULL))
         != EOF)
     switch (optchar)
@@ -173,14 +176,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
 
       /* Bind domain to appropriate directory.  */
       if (domaindir != NULL && domaindir[0] != '\0')
-       bindtextdomain__ (domain, domaindir);
+       bindtextdomain (domain, domaindir);
 
       /* Expand escape sequences is enabled.  */
       if (do_expand)
        msgid = expand_escape (msgid);
 
       /* Write out the result.  */
-      fputs (dgettext__ (domain, msgid), stdout);
+      fputs (dgettext (domain, msgid), stdout);
     }
   else
     {
@@ -191,7 +194,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       else
        /* Bind domain to appropriate directory.  */
        if (domaindir != NULL && domaindir[0] != '\0')
-         bindtextdomain__ (domain, domaindir);
+         bindtextdomain (domain, domaindir);
 
       /* We have to simulate `echo'.  All arguments are strings.  */
       while (optind < argc)
@@ -203,14 +206,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
            msgid = expand_escape (msgid);
 
          /* Write out the result.  */
-         fputs (domain == NULL ? msgid : dgettext__ (domain, msgid), stdout);
+         fputs (domain == NULL ? msgid : dgettext (domain, msgid), stdout);
 
          /* We separate the arguments by a single ' '.  */
          if (optind < argc)
            fputc (' ', stdout);
        }
 
-      /* If not otherwise told add trailing newline.  */
+      /* If not otherwise told: add trailing newline.  */
       if (add_newline)
        fputc ('\n', stdout);
     }
index 2ff1156231219b4b8bf8c04cb4e1bd84b8ccf40a..26c21eb45a9ac51fa6f685c3612a0d73d840f360 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -63,7 +63,7 @@ static size_t page_width = PAGE_WIDTH;
 /* Prototypes for local functions.  */
 static void wrap PARAMS ((FILE *__fp, const char *__line_prefix,
                          const char *__name, const char *__value,
-                         int do_wrap));
+                         enum is_wrap do_wrap));
 static void print_blank_line PARAMS ((FILE *__fp));
 static void message_print PARAMS ((const message_ty *__mp, FILE *__fp,
                                   const char *__domain, int blank_line,
@@ -78,11 +78,113 @@ static const char *make_c_format_description_string PARAMS ((enum is_c_format,
 static const char *make_c_width_description_string PARAMS ((enum is_c_format));
 static int significant_c_format_p PARAMS ((enum is_c_format __is_c_format));
 
- static message_ty *message_list_search_fuzzy_inner PARAMS ((
+static message_ty *message_list_search_fuzzy_inner PARAMS ((
        message_list_ty *__mlp, const char *__msgid, double *__best_weight_p));
 
 
 
+enum is_c_format
+parse_c_format_description_string (s)
+     const char *s;
+{
+  if (strstr (s, "no-c-format") != NULL)
+    return no;
+  else if (strstr (s, "impossible-c-format") != NULL)
+    return impossible;
+  else if (strstr (s, "possible-c-format") != NULL)
+    return possible;
+  else if (strstr (s, "c-format") != NULL)
+    return yes;
+  return undecided;
+}
+
+
+static const char *
+make_c_format_description_string (is_c_format, debug)
+     enum is_c_format is_c_format;
+     int debug;
+{
+  const char *result = NULL;
+
+  switch (is_c_format)
+    {
+    case possible:
+      if (debug)
+       {
+         result = " possible-c-format";
+         break;
+       }
+      /* FALLTHROUGH */
+    case yes:
+      result = " c-format";
+      break;
+    case impossible:
+      result = " impossible-c-format";
+      break;
+    case no:
+      result = " no-c-format";
+      break;
+    case undecided:
+      result = " undecided";
+      break;
+    default:
+      abort ();
+    }
+
+  return result;
+}
+
+
+int
+possible_c_format_p (is_c_format)
+     enum is_c_format is_c_format;
+{
+  return is_c_format == possible || is_c_format == yes;
+}
+
+
+static int
+significant_c_format_p (is_c_format)
+     enum is_c_format is_c_format;
+{
+  return is_c_format != undecided && is_c_format != impossible;
+}
+
+
+enum is_c_format
+parse_c_width_description_string (s)
+     const char *s;
+{
+  if (strstr (s, "no-wrap") != NULL)
+    return no;
+  else if (strstr (s, "wrap") != NULL)
+    return yes;
+  return undecided;
+}
+
+
+static const char *
+make_c_width_description_string (do_wrap)
+     enum is_wrap do_wrap;
+{
+  const char *result = NULL;
+
+  switch (do_wrap)
+    {
+    case yes:
+      result = " wrap";
+      break;
+    case no:
+      result = " no-wrap";
+      break;
+    default:
+      abort ();
+    }
+
+  return result;
+}
+
+
 message_ty *
 message_alloc (msgid)
      char *msgid;
@@ -751,7 +853,7 @@ wrap (fp, line_prefix, name, value, do_wrap)
      const char *line_prefix;
      const char *name;
      const char *value;
-     int do_wrap;
+     enum is_wrap do_wrap;
 {
   const char *s;
   int first_line;
@@ -1401,108 +1503,6 @@ message_list_sort_by_filepos (mlp)
 }
 
 
-enum is_c_format
-parse_c_format_description_string (s)
-     const char *s;
-{
-  if (strstr (s, "no-c-format") != NULL)
-    return no;
-  else if (strstr (s, "impossible-c-format") != NULL)
-    return impossible;
-  else if (strstr (s, "possible-c-format") != NULL)
-    return possible;
-  else if (strstr (s, "c-format") != NULL)
-    return yes;
-  return undecided;
-}
-
-
-enum is_c_format
-parse_c_width_description_string (s)
-     const char *s;
-{
-  if (strstr (s, "no-wrap") != NULL)
-    return no;
-  else if (strstr (s, "wrap") != NULL)
-    return yes;
-  return undecided;
-}
-
-
-static const char *
-make_c_format_description_string (is_c_format, debug)
-     enum is_c_format is_c_format;
-     int debug;
-{
-  const char *result = NULL;
-
-  switch (is_c_format)
-    {
-    case possible:
-      if (debug)
-       {
-         result = " possible-c-format";
-         break;
-       }
-      /* FALLTHROUGH */
-    case yes:
-      result = " c-format";
-      break;
-    case impossible:
-      result = " impossible-c-format";
-      break;
-    case no:
-      result = " no-c-format";
-      break;
-    case undecided:
-      result = " undecided";
-      break;
-    default:
-      abort ();
-    }
-
-  return result;
-}
-
-
-static const char *
-make_c_width_description_string (do_wrap)
-     enum is_c_format do_wrap;
-{
-  const char *result = NULL;
-
-  switch (do_wrap)
-    {
-    case yes:
-      result = " wrap";
-      break;
-    case no:
-      result = " no-wrap";
-      break;
-    default:
-      abort ();
-    }
-
-  return result;
-}
-
-
-int
-possible_c_format_p (is_c_format)
-     enum is_c_format is_c_format;
-{
-  return is_c_format == possible || is_c_format == yes;
-}
-
-
-static int
-significant_c_format_p (is_c_format)
-     enum is_c_format is_c_format;
-{
-  return is_c_format != undecided && is_c_format != impossible;
-}
-
-
 void
 message_page_width_set (n)
      size_t n;
index aa6000557c258de235971be5dce2b3e674430392..ed9e8f8a7c588e913573c7dcf1c870f785ce0bf7 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -20,8 +20,8 @@
 #ifndef _MESSAGE_H
 #define _MESSAGE_H
 
-#include "po-lex.h"
 #include "str-list.h"
+#include "pos.h"
 
 /* According to Sun's Uniforum proposal the default message domain is
    named `messages'.  */
@@ -38,6 +38,27 @@ enum is_c_format
   impossible
 };
 
+extern enum is_c_format
+       parse_c_format_description_string PARAMS ((const char *s));
+extern int possible_c_format_p PARAMS ((enum is_c_format));
+
+
+/* Is current msgid wrappable?  */
+#if 0
+enum is_wrap
+{
+  undecided,
+  yes,
+  no
+};
+#else /* HACK - C's enum concept is so stupid */
+#define is_wrap is_c_format
+#endif
+
+extern enum is_wrap parse_c_width_description_string PARAMS ((const char *s));
+extern void message_page_width_set PARAMS ((size_t width));
+
+
 typedef struct message_variant_ty message_variant_ty;
 struct message_variant_ty
 {
@@ -66,7 +87,7 @@ struct message_ty
   enum is_c_format is_c_format;
 
   /* Do we want the string to be wrapped in the emitted PO file?  */
-  enum is_c_format do_wrap;
+  enum is_wrap do_wrap;
 
   /* The msgid string.  */
   const char *msgid;
@@ -141,9 +162,4 @@ message_ty *message_list_list_search PARAMS ((message_list_list_ty *,
 message_ty *message_list_list_search_fuzzy PARAMS ((message_list_list_ty *,
                                                    const char *));
 
-enum is_c_format parse_c_format_description_string PARAMS ((const char *s));
-enum is_c_format parse_c_width_description_string PARAMS ((const char *s));
-int possible_c_format_p PARAMS ((enum is_c_format));
-void message_page_width_set PARAMS ((size_t width));
-
 #endif /* message.h */
index af689a299c4e7a8d93db03beb15d79a01337b9de..785162847d9b48871af53b8e374b4fea5d7fea4f 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
    This program is free software; you can redistribute it and/or modify
@@ -256,15 +256,15 @@ compare (fn1, fn2)
       mp1 = message_list_search_fuzzy (list1, mp2->msgid);
       if (mp1)
        {
-         gram_error_at_line (&mp2->variant[0].pos, _("\
+         po_gram_error_at_line (&mp2->variant[0].pos, _("\
 this message is used but not defined..."));
-         gram_error_at_line (&mp1->variant[0].pos, _("\
+         po_gram_error_at_line (&mp1->variant[0].pos, _("\
 ...but this definition is similar"));
          mp1->used = 1;
        }
       else
        {
-         gram_error_at_line (&mp2->variant[0].pos, _("\
+         po_gram_error_at_line (&mp2->variant[0].pos, _("\
 this message is used but not defined in %s"), fn1);
        }
     }
@@ -277,7 +277,7 @@ this message is used but not defined in %s"), fn1);
       mp1 = list1->item[k];
       if (mp1->used)
        continue;
-      gram_error_at_line (&mp1->variant[0].pos,
+      po_gram_error_at_line (&mp1->variant[0].pos,
                           _("warning: this message is not used"));
     }
 
@@ -352,8 +352,8 @@ compare_directive_message (that, msgid, msgid_pos, msgstr, msgstr_pos)
   mvp = message_variant_search (mp, this->domain);
   if (mvp)
     {
-      gram_error_at_line (msgid_pos, _("duplicate message definition"));
-      gram_error_at_line (&mvp->pos, _("\
+      po_gram_error_at_line (msgid_pos, _("duplicate message definition"));
+      po_gram_error_at_line (&mvp->pos, _("\
 ...this is the location of the first definition"));
       free (msgstr);
     }
@@ -393,7 +393,7 @@ compare_parse_debrief (that)
                break;
            }
          if (m >= mp->variant_count)
-           gram_error_at_line (&mp->variant[0].pos, _("\
+           po_gram_error_at_line (&mp->variant[0].pos, _("\
 this message has no definition in the \"%s\" domain"), domain_name);
        }
     }
index 082639ac533de3ff323cf103540853e5a1fc2330..e78da184eb3f8b55733e1e6ed8e8e87c8039277c 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -524,8 +524,8 @@ struct extract_class_ty
   string_list_ty *comment_dot;
 
   int is_fuzzy;
-  int is_c_format;
-  int do_wrap;
+  enum is_c_format is_c_format;
+  enum is_wrap do_wrap;
 
   int filepos_count;
   lex_pos_ty *filepos;
index d535ed58e5cec10131e6dbefb23e3ad087ddaed3..931fd2216f735a0ce3873ae3d50c55c96f86835a 100644 (file)
@@ -1,5 +1,5 @@
 /* Converts Uniforum style .po files to binary .mo files
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
 
    This program is free software; you can redistribute it and/or modify
@@ -44,7 +44,6 @@
 #include <system.h>
 
 #include "gettext.h"
-#include "domain.h"
 #include "hash-string.h"
 #include <libintl.h>
 #include "message.h"
@@ -81,7 +80,7 @@ struct msgfmt_class_ty
 
   int is_fuzzy;
   enum is_c_format is_c_format;
-  enum is_c_format do_wrap;
+  enum is_wrap do_wrap;
 
   int has_header_entry;
 };
@@ -107,6 +106,15 @@ const char *program_name;
 /* We may have more than one input file.  Domains with same names in
    different files have to merged.  So we need a list of tables for
    each output file.  */
+struct msg_domain
+{
+  /* Table for mapping message IDs to message strings.  */
+  hash_table symbol_tab;
+  /* Name of domain these ID/String pairs are part of.  */
+  const char *domain_name;
+  /* Link to the next domain.  */
+  struct msg_domain *next;
+};
 static struct msg_domain *domain;
 static struct msg_domain *current_domain;
 
@@ -630,8 +638,9 @@ some header fields still have the initial default value"));
                      strlen (msgid_string), (void **) &entry);
          if (0 != strcmp(msgstr_string, entry->msgstr))
            {
-             gram_error_at_line (msgid_pos, _("duplicate message definition"));
-             gram_error_at_line (&entry->pos, _("\
+             po_gram_error_at_line (msgid_pos, _("\
+duplicate message definition"));
+             po_gram_error_at_line (&entry->pos, _("\
 ...this is the location of the first definition"));
 
              /* FIXME Should this be always a reason for an exit status != 0?  */
index 27481d9dfd257c8cf3483c3d291d49cf576b3539..78b7cded7df830b4dd000ce2b9d4d7c1406fe786 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
    This program is free software; you can redistribute it and/or modify
@@ -72,7 +72,7 @@ struct merge_class_ty
   /* Flags transported in special comments.  */
   int is_fuzzy;
   enum is_c_format is_c_format;
-  enum is_c_format do_wrap;
+  enum is_wrap do_wrap;
 
   /* Accumulate filepos comments for the next message directive.  */
   size_t filepos_count;
@@ -164,7 +164,7 @@ main (argc, argv)
   verbosity_level = 0;
   quiet = 0;
   error_print_progname = error_print;
-  gram_max_allowed_errors = INT_MAX;
+  gram_max_allowed_errors = UINT_MAX;
 
 #ifdef HAVE_SETLOCALE
   /* Set locale via LC_ALL.  */
@@ -514,8 +514,8 @@ merge_directive_message (that, msgid, msgid_pos, msgstr, msgstr_pos)
   mvp = message_variant_search (mp, this->domain);
   if (mvp)
     {
-      gram_error_at_line (msgid_pos, _("duplicate message definition"));
-      gram_error_at_line (&mvp->pos, _("\
+      po_gram_error_at_line (msgid_pos, _("duplicate message definition"));
+      po_gram_error_at_line (&mvp->pos, _("\
 ...this is the location of the first definition"));
       free (msgstr);
     }
@@ -563,7 +563,7 @@ merge_parse_debrief (that)
                break;
            }
          if (m >= mp->variant_count)
-           gram_error_at_line (&mp->variant[0].pos, _("\
+           po_gram_error_at_line (&mp->variant[0].pos, _("\
 this message has no definition in the \"%s\" domain"), domain_name);
        }
     }
@@ -743,9 +743,9 @@ merge (fn1, fn2)
 
          if (verbosity_level > 1)
            {
-             gram_error_at_line (&refmsg->variant[0].pos, _("\
+             po_gram_error_at_line (&refmsg->variant[0].pos, _("\
 this message is used but not defined..."));
-             gram_error_at_line (&defmsg->variant[0].pos, _("\
+             po_gram_error_at_line (&defmsg->variant[0].pos, _("\
 ...but this definition is similar"));
            }
 
@@ -772,7 +772,7 @@ this message is used but not defined..."));
          message_ty *mp;
 
          if (verbosity_level > 1)
-             gram_error_at_line (&refmsg->variant[0].pos, _("\
+             po_gram_error_at_line (&refmsg->variant[0].pos, _("\
 this message is used but not defined in %s"), fn1);
 
          mp = message_copy (refmsg);
index 920d82fef652f5b9c9808af2b88f7374f1e140cb..6c5b6b7090fa8ec32c212ce2ead8f60ef9783908 100644 (file)
@@ -43,7 +43,6 @@
 #include <system.h>
 
 #include "gettext.h"
-#include "domain.h"
 #include "hash-string.h"
 #include <libintl.h>
 #include "message.h"
index aad7e6190d778277572b8737dc4f2f5d8a08398a..1954b02030970c8feada216ed1092281af00cd71 100644 (file)
@@ -1,5 +1,5 @@
 /* open-po - search for .po file along search path list and open for reading
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
 
 This program is free software; you can redistribute it and/or modify
@@ -28,12 +28,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 # include <stdlib.h>
 #endif
 
-#if defined STDC_HEADERS || HAVE_STRING_H
+#ifdef HAVE_STRING_H
 # include <string.h>
 #else
 # include <strings.h>
 #endif
 
+#include "open-po.h"
 #include "dir-list.h"
 #include "error.h"
 #include "system.h"
@@ -54,7 +55,8 @@ extern char *xstrdup PARAMS ((const char *string));
 
 /* Open the input file with the name INPUT_NAME.  The ending .po is added
    if necessary.  If INPUT_NAME is not an absolute file name and the file is
-   not found, the list of directories in INPUT_PATH_LIST is searched.  */
+   not found, the list of directories in "dir-list.h" is searched.  The
+   file's pathname is returned in *FILE_NAME, for error message purposes.  */
 FILE *
 open_po_file (input_name, file_name)
      const char *input_name;
@@ -89,40 +91,37 @@ open_po_file (input_name, file_name)
 
          free (*file_name);
        }
-
-      /* File does not exist.  */
-      *file_name = xstrdup (input_name);
-      errno = ENOENT;
-      return NULL;
     }
-
-  /* For relative file names, look through the directory search list,
-     trying the various extensions.  If no directory search list is
-     specified, the current directory is used.  */
-  for (j = 0; (dir = dir_list_nth (j)) != NULL; ++j)
-    for (k = 0; k < SIZEOF (extension); ++k)
-      {
-       ext = extension[k];
-       if (dir[0] == '.' && dir[1] == '\0')
-         {
-           *file_name = xmalloc (strlen(input_name) + strlen(ext) + 1);
-           stpcpy (stpcpy (*file_name, input_name), ext);
-         }
-       else
+  else
+    {
+      /* For relative file names, look through the directory search list,
+        trying the various extensions.  If no directory search list is
+        specified, the current directory is used.  */
+      for (j = 0; (dir = dir_list_nth (j)) != NULL; ++j)
+       for (k = 0; k < SIZEOF (extension); ++k)
          {
-           *file_name = xmalloc (strlen (dir) + strlen (input_name)
-                                 + strlen (ext) + 2);
-           stpcpy (stpcpy (stpcpy (stpcpy (*file_name, dir), "/"),
-                           input_name),
-                   ext);
+           ext = extension[k];
+           if (dir[0] == '.' && dir[1] == '\0')
+             {
+               *file_name = xmalloc (strlen(input_name) + strlen(ext) + 1);
+               stpcpy (stpcpy (*file_name, input_name), ext);
+             }
+           else
+             {
+               *file_name = xmalloc (strlen (dir) + strlen (input_name)
+                                     + strlen (ext) + 2);
+               stpcpy (stpcpy (stpcpy (stpcpy (*file_name, dir), "/"),
+                               input_name),
+                       ext);
+             }
+
+           ret_val = fopen (*file_name, "r");
+           if (ret_val != NULL || errno != ENOENT)
+             return ret_val;
+
+           free (*file_name);
          }
-
-       ret_val = fopen (*file_name, "r");
-       if (ret_val != NULL || errno != ENOENT)
-         return ret_val;
-
-       free (*file_name);
-      }
+    }
 
   /* File does not exist.  */
   *file_name = xstrdup (input_name);
diff --git a/src/open-po.h b/src/open-po.h
new file mode 100644 (file)
index 0000000..0bf9cb3
--- /dev/null
@@ -0,0 +1,28 @@
+/* Opening PO files.
+   Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef SRC_OPEN_PO_H
+#define SRC_OPEN_PO_H
+
+/* Open the input file with the name INPUT_NAME.  The ending .po is added
+   if necessary.  If INPUT_NAME is not an absolute file name and the file is
+   not found, the list of directories in "dir-list.h" is searched.  The
+   file's pathname is returned in *FILE_NAME, for error message purposes.  */
+extern FILE *open_po_file PARAMS ((const char *__input_name,
+                                  char **__file_name));
+
+#endif
index 4d5023f0b46764932606abf91fd67c1ea1059ff6..9153139d20194a1fbd9b8db275403309672f1307 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <pmiller@agso.gov.au>
 
@@ -126,7 +126,7 @@ message
                }
        | msgid string_list
                {
-                 gram_error_at_line (&$1, _("missing `msgstr' section"));
+                 po_gram_error_at_line (&$1, _("missing `msgstr' section"));
                  free ($2);
                }
        ;
index 248ddc3a634de98166418601979909e97728dc94..5e97946890a38d756a47c242b60015decaa04320 100644 (file)
@@ -44,9 +44,9 @@
 #endif
 
 #include "po-lex.h"
-#include "po-gram.h"
 #include "system.h"
 #include "error.h"
+#include "open-po.h"
 #include "po-gram-gen2.h"
 
 #if HAVE_C_BACKSLASH_A
@@ -70,6 +70,7 @@ static int keyword_p PARAMS ((char *__s));
 static int control_sequence PARAMS ((void));
 
 
+/* Open the PO file FNAME and prepare its lexical analysis.  */
 void
 lex_open (fname)
      const char *fname;
@@ -83,6 +84,7 @@ lex_open (fname)
 }
 
 
+/* Terminate lexical analysis and close the current PO file.  */
 void
 lex_close ()
 {
@@ -99,7 +101,7 @@ lex_close ()
 
 
 /* CAUTION: If you change this function, you must also make identical
-   changes to the macro of the same name in src/po-lex.h  */
+   changes to the macros of the same name in src/po-lex.h  */
 
 #if !__STDC__ || !defined __GNUC__ || __GNUC__ == 1
 /* VARARGS1 */
@@ -142,9 +144,9 @@ po_gram_error (fmt, va_alist)
 /* VARARGS2 */
 void
 # if defined VA_START && __STDC__
-gram_error_at_line (const lex_pos_ty *pp, const char *fmt, ...)
+po_gram_error_at_line (const lex_pos_ty *pp, const char *fmt, ...)
 # else
-gram_error_at_line (pp, fmt, va_alist)
+po_gram_error_at_line (pp, fmt, va_alist)
      const lex_pos_ty *pp;
      const char *fmt;
      va_dcl
@@ -176,6 +178,7 @@ gram_error_at_line (pp, fmt, va_alist)
 #endif
 
 
+/* Read a single character, dealing with backslash-newline.  */
 static int
 lex_getc ()
 {
@@ -352,6 +355,8 @@ control_sequence ()
 }
 
 
+/* Return the next token in the PO file.  The return codes are defined
+   in "po-gram-gen2.h".  Associated data is put in 'po_gram_lval.  */
 int
 po_gram_lex ()
 {
@@ -549,6 +554,7 @@ po_gram_lex ()
 }
 
 
+/* po_gram_lex() can return comments as COMMENT.  Switch this on or off.  */
 void
 po_lex_pass_comments (flag)
      int flag;
@@ -557,6 +563,8 @@ po_lex_pass_comments (flag)
 }
 
 
+/* po_gram_lex() can return obsolete entries as if they were normal entries.
+   Switch this on or off.  */
 void
 po_lex_pass_obsolete_entries (flag)
      int flag;
index fd95d97498d8c125bb6dc06e09cf3d5583c83d64..82ae7e856a6342a902a2da7b4a9d59dad456cba4 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
 
 #include <sys/types.h>
 #include "error.h"
+#include "pos.h"
 
-typedef struct lex_pos_ty lex_pos_ty;
-struct lex_pos_ty
-{
-  char *file_name;
-  size_t line_number;
-};
+/* Lexical analyzer for reading PO files.  */
 
 
 /* Global variables from po-lex.c.  */
+
+/* Current position within the PO file.  */
 extern lex_pos_ty gram_pos;
-extern size_t gram_max_allowed_errors;
 
+/* Number of parse errors within a PO file that cause the program to
+   terminate.  Cf. error_message_count, declared in <error.h>.  */
+extern unsigned int gram_max_allowed_errors;
+
+
+/* Open the PO file FNAME and prepare its lexical analysis.  */
+extern void lex_open PARAMS ((const char *__fname));
+
+/* Terminate lexical analysis and close the current PO file.  */
+extern void lex_close PARAMS ((void));
 
-void lex_open PARAMS ((const char *__fname));
-void lex_close PARAMS ((void));
-int po_gram_lex PARAMS ((void));
-void po_lex_pass_comments PARAMS ((int __flag));
-void po_lex_pass_obsolete_entries PARAMS ((int __flag));
+/* Return the next token in the PO file.  The return codes are defined
+   in "po-gram-gen2.h".  Associated data is put in 'po_gram_lval.  */
+extern int po_gram_lex PARAMS ((void));
 
+/* po_gram_lex() can return comments as COMMENT.  Switch this on or off.  */
+extern void po_lex_pass_comments PARAMS ((int __flag));
 
-/* GCC is smart enough to allow optimizations like this.  */
-#if __STDC__ && defined __GNUC__ && __GNUC__ >= 2
+/* po_gram_lex() can return obsolete entries as if they were normal entries.
+   Switch this on or off.  */
+extern void po_lex_pass_obsolete_entries PARAMS ((int __flag));
 
 
+/* ISO C 99 is smart enough to allow optimizations like this.  */
+#if __STDC__ && (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
+
+/* CAUTION: If you change this macro, you must also make identical
+   changes to the function of the same name in src/po-lex.c  */
+
+# define po_gram_error(fmt, ...)                                           \
+  do {                                                                     \
+    error_at_line (0, 0, gram_pos.file_name, gram_pos.line_number,         \
+                   fmt, __VA_ARGS__);                                      \
+    if (*fmt == '.')                                                       \
+      --error_message_count;                                               \
+    else if (error_message_count >= gram_max_allowed_errors)               \
+      error (1, 0, _("too many errors, aborting"));                        \
+  } while (0)
+
+
+/* CAUTION: If you change this macro, you must also make identical
+   changes to the function of the same name in src/po-lex.c  */
+
+# define po_gram_error_at_line(pos, fmt, ...)                              \
+  do {                                                                     \
+    error_at_line (0, 0, (pos)->file_name, (pos)->line_number,             \
+                   fmt, __VA_ARGS__);                                      \
+    if (*fmt == '.')                                                       \
+      --error_message_count;                                               \
+    else if (error_message_count >= gram_max_allowed_errors)               \
+      error (1, 0, _("too many errors, aborting"));                        \
+  } while (0)
+
+/* GCC is also smart enough to allow optimizations like this.  */
+#elif __STDC__ && defined __GNUC__ && __GNUC__ >= 2
+
 /* CAUTION: If you change this macro, you must also make identical
    changes to the function of the same name in src/po-lex.c  */
 
@@ -56,7 +97,7 @@ void po_lex_pass_obsolete_entries PARAMS ((int __flag));
                    fmt, ## args);                                          \
     if (*fmt == '.')                                                       \
       --error_message_count;                                               \
-    else if (error_message_count >= gram_max_allowed_errors)                       \
+    else if (error_message_count >= gram_max_allowed_errors)               \
       error (1, 0, _("too many errors, aborting"));                        \
   } while (0)
 
@@ -64,7 +105,7 @@ void po_lex_pass_obsolete_entries PARAMS ((int __flag));
 /* CAUTION: If you change this macro, you must also make identical
    changes to the function of the same name in src/po-lex.c  */
 
-# define gram_error_at_line(pos, fmt, args...)                             \
+# define po_gram_error_at_line(pos, fmt, args...)                          \
   do {                                                                     \
     error_at_line (0, 0, (pos)->file_name, (pos)->line_number,             \
                    fmt, ## args);                                          \
@@ -73,10 +114,11 @@ void po_lex_pass_obsolete_entries PARAMS ((int __flag));
     else if (error_message_count >= gram_max_allowed_errors)               \
       error (1, 0, _("too many errors, aborting"));                        \
   } while (0)
+
 #else
-void po_gram_error PARAMS ((const char *__fmt, ...));
-void gram_error_at_line PARAMS ((const lex_pos_ty *__pos, const char *__fmt,
-                                ...));
+extern void po_gram_error PARAMS ((const char *__fmt, ...));
+extern void po_gram_error_at_line PARAMS ((const lex_pos_ty *__pos,
+                                          const char *__fmt, ...));
 #endif
 
 
index f22a45e7cc4d8529c88ac0eeeb752e90dd5532e7..2f959740cf2e32d6c1d4d2192cfde3a2002657b7 100644 (file)
--- a/src/po.c
+++ b/src/po.c
@@ -96,7 +96,7 @@ po_scan (pop, filename)
   po_gram_parse ();
   po_parse_debrief (pop);
   lex_close ();
-  callback_arg = 0;
+  callback_arg = NULL;
 }
 
 
index 4800a6f5171bb4dd1e5044a8ca5a5d96821c581a..45e742c31277708a5d2d290752da56158288e664 100644 (file)
--- a/src/po.h
+++ b/src/po.h
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "po-lex.h"
 
 /* Note: the _t suffix is reserved by ANSI C, so the _ty suffix is
-   used to indicate a type name  */
+   used to indicate a type name.  */
 
 /* The following pair of structures cooperate to create an "Object" in
    the OO sense, we are simply doing it manually, rather than with the
@@ -96,7 +96,7 @@ struct po_method_ty
 
 /* This next structure defines the base class passed to the methods.
    Derived methods will often need to cast their first argument before
-   using it (this correponds to the implicit ``this'' argument of many
+   using it (this corresponds to the implicit ``this'' argument of many
    C++ implementations).
 
    When declaring derived classes, use the PO_BASE_TY define at the
@@ -113,17 +113,27 @@ struct po_ty
 };
 
 
-po_ty *po_alloc PARAMS ((po_method_ty *__jtable));
-void po_scan PARAMS ((po_ty *__pop, const char *__filename));
-void po_free PARAMS ((po_ty *__pop));
+/* Allocate a fresh po_ty (or derived class) instance and call its
+   constructor.  */
+extern po_ty *po_alloc PARAMS ((po_method_ty *__jtable));
+
+/* Read a PO file, and dispatch to the various po_method_ty methods.  */
+extern void po_scan PARAMS ((po_ty *__pop, const char *__filename));
+
+/* Call the destructor and deallocate a po_ty (or derived class)
+   instance.  */
+extern void po_free PARAMS ((po_ty *__pop));
+
 
 /* Callbacks used by po-gram.y or po-hash.y or po-lex.c, indirectly
    from po_scan.  */
-void po_callback_domain PARAMS ((char *__name));
-void po_callback_message PARAMS ((char *__msgid, lex_pos_ty *__msgid_pos,
-                                 char *__msgstr, lex_pos_ty *__msgstr_pos));
-void po_callback_comment PARAMS ((const char *__s));
-void po_callback_comment_dot PARAMS ((const char *__s));
-void po_callback_comment_filepos PARAMS ((const char *__s, int __line));
+extern void po_callback_domain PARAMS ((char *__name));
+extern void po_callback_message PARAMS ((char *__msgid,
+                                        lex_pos_ty *__msgid_pos,
+                                        char *__msgstr,
+                                        lex_pos_ty *__msgstr_pos));
+extern void po_callback_comment PARAMS ((const char *__s));
+extern void po_callback_comment_dot PARAMS ((const char *__s));
+extern void po_callback_comment_filepos PARAMS ((const char *__s, int __line));
 
 #endif
diff --git a/src/pos.h b/src/pos.h
new file mode 100644 (file)
index 0000000..5626cbc
--- /dev/null
+++ b/src/pos.h
@@ -0,0 +1,30 @@
+/* Source file positions.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef SRC_POS_H
+#define SRC_POS_H
+
+/* Position of a message within a source file.
+   Used for error reporting purposes.  */
+typedef struct lex_pos_ty lex_pos_ty;
+struct lex_pos_ty
+{
+  char *file_name;
+  size_t line_number;
+};
+
+#endif
index 40007452c568024b59eba60f34e45e1f8f159f03..7d27020e50c2d64a03703f5114c75925687afb40 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "str-list.h"
 
 
+/* Return a fresh, empty list of strings.  */
 string_list_ty *
 string_list_alloc ()
 {
@@ -41,6 +42,7 @@ string_list_alloc ()
 }
 
 
+/* Append a single string to the end of a list of strings.  */
 void
 string_list_append (slp, s)
      string_list_ty *slp;
@@ -61,6 +63,8 @@ string_list_append (slp, s)
 }
 
 
+/* Append a single string to the end of a list of strings, unless it is
+   already contained in the list.  */
 void
 string_list_append_unique (slp, s)
      string_list_ty *slp;
@@ -87,6 +91,7 @@ string_list_append_unique (slp, s)
 }
 
 
+/* Free a list of strings.  */
 void
 string_list_free (slp)
      string_list_ty *slp;
@@ -101,6 +106,8 @@ string_list_free (slp)
 }
 
 
+/* Return a freshly allocated string obtained by concatenating all the
+   strings in the list, separated by spaces.  */
 char *
 string_list_join (slp)
      const string_list_ty *slp;
@@ -127,11 +134,12 @@ string_list_join (slp)
       memcpy (result + pos, slp->item[j], len);
       pos += len;
     }
-  result[pos] = 0;
+  result[pos] = '\0';
   return result;
 }
 
 
+/* Return 1 if s is contained in the list of strings, 0 otherwise.  */
 int
 string_list_member (slp, s)
      const string_list_ty *slp;
index 9e2b998175601f473af80e6ba75b6127cc92c91f..cecee48957c75a4ef16919d962422aa28e7bb341 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -20,16 +20,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #ifndef SRC_STR_LIST_H
 #define SRC_STR_LIST_H 1
 
-#ifdef STC_HEADERS
-# define __need_size_t
-# define __need_NULL
+/* Get size_t and NULL.  */
+#ifdef HAVE_STDDEF_H
 # include <stddef.h>
 #else
 # include <sys/types.h>
 # include <stdio.h>
 #endif
 
-/* Type describing list of strings implemented using a dynamic array.  */
+/* Type describing list of immutable strings,
+   implemented using a dynamic array.  */
 typedef struct string_list_ty string_list_ty;
 struct string_list_ty
 {
@@ -38,13 +38,27 @@ struct string_list_ty
   size_t nitems_max;
 };
 
+/* Return a fresh, empty list of strings.  */
+extern string_list_ty *string_list_alloc PARAMS ((void));
 
-string_list_ty *string_list_alloc PARAMS ((void));
-void string_list_append PARAMS ((string_list_ty *__slp, const char *__s));
-void string_list_append_unique PARAMS ((string_list_ty *__slp,
+/* Append a single string to the end of a list of strings.  */
+extern void string_list_append PARAMS ((string_list_ty *__slp,
                                        const char *__s));
-void string_list_free PARAMS ((string_list_ty *__slp));
-char *string_list_join PARAMS ((const string_list_ty *__slp));
-int string_list_member PARAMS ((const string_list_ty *__slp, const char *__s));
+
+/* Append a single string to the end of a list of strings, unless it is
+   already contained in the list.  */
+extern void string_list_append_unique PARAMS ((string_list_ty *__slp,
+                                              const char *__s));
+
+/* Free a list of strings.  */
+extern void string_list_free PARAMS ((string_list_ty *__slp));
+
+/* Return a freshly allocated string obtained by concatenating all the
+   strings in the list, separated by spaces.  */
+extern char *string_list_join PARAMS ((const string_list_ty *__slp));
+
+/* Return 1 if s is contained in the list of strings, 0 otherwise.  */
+extern int string_list_member PARAMS ((const string_list_ty *__slp,
+                                      const char *__s));
 
 #endif
index 0ac43da3b703106a7d7d082f0c8a112efdbb845a..884ecb7824cdcf72f0cc80c7edab3805317af975 100644 (file)
@@ -56,7 +56,6 @@ extern int errno;
 #include "printf-parse.h"
 
 #include "gettext.h"
-#include "domain.h"
 #include <libintl.h>
 
 #ifndef _POSIX_VERSION
@@ -735,7 +734,7 @@ remember_a_message (mlp, tp)
      xgettext_token_ty *tp;
 {
   enum is_c_format is_c_format = undecided;
-  enum is_c_format do_wrap = undecided;
+  enum is_wrap do_wrap = undecided;
   char *msgid;
   message_ty *mp;
   char *msgstr;
@@ -960,8 +959,8 @@ struct extract_class_ty
   string_list_ty *comment_dot;
 
   int is_fuzzy;
-  int is_c_format;
-  int do_wrap;
+  enum is_c_format is_c_format;
+  enum is_wrap do_wrap;
 
   int filepos_count;
   lex_pos_ty *filepos;
@@ -1083,8 +1082,8 @@ extract_directive_message (that, msgid, msgid_pos, msgstr, msgstr_pos)
   mvp = message_variant_search (mp, MESSAGE_DOMAIN_DEFAULT);
   if (mvp != NULL && strcmp (msgstr, mvp->msgstr) != 0)
     {
-      gram_error_at_line (msgid_pos, _("duplicate message definition"));
-      gram_error_at_line (&mvp->pos, _("\
+      po_gram_error_at_line (msgid_pos, _("duplicate message definition"));
+      po_gram_error_at_line (&mvp->pos, _("\
 ...this is the location of the first definition"));
       free (msgstr);
     }
index fbae17bd7af84127a505978ed26c3eda5f2bcd01..13fc38d75f2a47bc55e90ad5bf8d8a0184b14878 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # ylwrap - wrapper for lex/yacc invocations.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
 # The program to run.
 prog="$1"
 shift
+# Make any relative path in $prog absolute.
+case "$prog" in
+ /* | [A-Za-z]:\\*) ;;
+ */*) prog="`pwd`/$prog" ;;
+esac
 
 # The input.
 input="$1"
 shift
 case "$input" in
- /*)
+ /* | [A-Za-z]:\\*)
     # Absolute path; do nothing.
     ;;
  *)
@@ -45,9 +50,17 @@ case "$input" in
     ;;
 esac
 
+# We don't want to use the absolute path if the input in the current
+# directory like when making a tar ball.
+input_base=`echo $input | sed -e 's|.*/||'`
+if test -f $input_base && cmp $input_base $input >/dev/null 2>&1; then
+  input=$input_base
+fi
+
 pairlist=
 while test "$#" -ne 0; do
    if test "$1" = "--"; then
+      shift
       break
    fi
    pairlist="$pairlist $1"
@@ -61,6 +74,15 @@ trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
 mkdir $dirname || exit 1
 
 cd $dirname
+case "$input" in
+ /* | [A-Za-z]:\\*)
+    # Absolute path; do nothing.
+    ;;
+ *)
+    # Make a symbolic link, hard link or hardcopy.
+    ln -s ../"$input" . > /dev/null 2>&1 || ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" .
+    ;;
+esac
 $prog ${1+"$@"} "$input"
 status=$?
 
@@ -73,7 +95,7 @@ if test $status -eq 0; then
          # If $2 is an absolute path name, then just use that,
          # otherwise prepend `../'.
          case "$2" in
-          /*) target="$2";;
+          /* | [A-Za-z]:\\*) target="$2";;
           *) target="../$2";;
         esac
         mv "$1" "$target" || status=$?