]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
xgettext: Refactor.
authorBruno Haible <bruno@clisp.org>
Thu, 30 Nov 2023 07:34:51 +0000 (08:34 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 30 Nov 2023 10:40:20 +0000 (11:40 +0100)
* gettext-tools/src/xg-formatstring.h: New file, extracted from xgettext.h.
* gettext-tools/src/xg-formatstring.c: New file, extracted from xgettext.c.
* gettext-tools/src/FILES: Mention them.
* gettext-tools/src/Makefile.am (noinst_HEADERS): Add xg-formatstring.h.
(xgettext_SOURCES): Add xg-formatstring.c.
* gettext-tools/src/xgettext.h (current_formatstring_parser1,
current_formatstring_parser2, current_formatstring_parser3,
current_formatstring_parser4): Remove declarations.
* gettext-tools/src/xgettext.c: Include xg-formatstring.h.
(current_formatstring_parser1, current_formatstring_parser2,
current_formatstring_parser3, current_formatstring_parser4): Remove variables.
* gettext-tools/src/xg-message.c: Include xg-formatstring.h.

gettext-tools/src/FILES
gettext-tools/src/Makefile.am
gettext-tools/src/xg-formatstring.c [new file with mode: 0644]
gettext-tools/src/xg-formatstring.h [new file with mode: 0644]
gettext-tools/src/xg-message.c
gettext-tools/src/xgettext.c
gettext-tools/src/xgettext.h

index 34aa6f3b573e0f5a4c3d5058bd4efec929aaf478..47b29bd12a8d6d6bfc60e81a14820395a854615f 100644 (file)
@@ -308,6 +308,9 @@ msgl-check.c
 | xg-mixed-string.c
 |               Handling strings that are given partially in the source
 |               encoding and partially in Unicode.
+| xg-formatstring.h
+| xg-formatstring.c
+|               Recognizing language-dependent format strings.
 | xg-arglist-context.h
 | xg-arglist-context.c
 |               Keeping track of the flags that apply to a string extracted
index a71d5e26ffc96c740fe550afe401f618d59792fc..d95b08ed6148f5d8975051b7f6c6e9d1bfa0c47b 100644 (file)
@@ -63,8 +63,9 @@ noinst_HEADERS = \
   po-time.h plural-table.h lang-table.h format.h filters.h \
   xgettext.h \
   if-error.h \
-  rc-str-list.h xg-pos.h xg-encoding.h xg-mixed-string.h xg-arglist-context.h \
-  xg-arglist-callshape.h xg-arglist-parser.h xg-message.h xg-check.h \
+  rc-str-list.h xg-pos.h xg-encoding.h xg-mixed-string.h xg-formatstring.h \
+  xg-arglist-context.h xg-arglist-callshape.h xg-arglist-parser.h xg-message.h \
+  xg-check.h \
   x-po.h x-properties.h x-stringtable.h \
   x-c.h \
   x-python.h \
@@ -238,6 +239,7 @@ xgettext_SOURCES += \
   xg-pos.c \
   xg-encoding.c \
   xg-mixed-string.c \
+  xg-formatstring.c \
   xg-arglist-context.c xg-arglist-callshape.c xg-arglist-parser.c \
   xg-message.c \
   xg-check.c \
diff --git a/gettext-tools/src/xg-formatstring.c b/gettext-tools/src/xg-formatstring.c
new file mode 100644 (file)
index 0000000..ecc2ecb
--- /dev/null
@@ -0,0 +1,30 @@
+/* Language-dependent format strings.
+   Copyright (C) 2003-2023 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include "xg-formatstring.h"
+
+
+/* Language dependent format string parser.
+   NULL if the language has no notion of format strings.  */
+struct formatstring_parser *current_formatstring_parser1;
+struct formatstring_parser *current_formatstring_parser2;
+struct formatstring_parser *current_formatstring_parser3;
+struct formatstring_parser *current_formatstring_parser4;
diff --git a/gettext-tools/src/xg-formatstring.h b/gettext-tools/src/xg-formatstring.h
new file mode 100644 (file)
index 0000000..406bab9
--- /dev/null
@@ -0,0 +1,37 @@
+/* Language-dependent format strings.
+   Copyright (C) 2003-2023 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _XGETTEXT_FORMATSTRING_H
+#define _XGETTEXT_FORMATSTRING_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Language dependent format string parser.
+   NULL if the language has no notion of format strings.  */
+extern struct formatstring_parser *current_formatstring_parser1;
+extern struct formatstring_parser *current_formatstring_parser2;
+extern struct formatstring_parser *current_formatstring_parser3;
+extern struct formatstring_parser *current_formatstring_parser4;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XGETTEXT_FORMATSTRING_H */
index 895127d3d1341b46898b97e97f63a3c522a829ab..53e64afd6dd65e2d447e5dc57fcc3730ef5826d5 100644 (file)
@@ -33,6 +33,7 @@
 #include "verify.h"
 
 #include "xgettext.h"
+#include "xg-formatstring.h"
 
 #include "gettext.h"
 #define _(str) gettext (str)
index 8abb61ba865188c1c837fc29dc20d4bfa2032faf..8ab5f9573e264f0496880fd1ce1c6306fc0bfdfd 100644 (file)
@@ -44,6 +44,7 @@
 #include "noreturn.h"
 #include "rc-str-list.h"
 #include "xg-encoding.h"
+#include "xg-formatstring.h"
 #include "xg-arglist-context.h"
 #include "xg-message.h"
 #include "closeout.h"
@@ -1921,14 +1922,6 @@ xgettext_open (const char *fn,
 }
 
 
-/* Language dependent format string parser.
-   NULL if the language has no notion of format strings.  */
-struct formatstring_parser *current_formatstring_parser1;
-struct formatstring_parser *current_formatstring_parser2;
-struct formatstring_parser *current_formatstring_parser3;
-struct formatstring_parser *current_formatstring_parser4;
-
-
 static void
 extract_from_file (const char *file_name, extractor_ty extractor,
                    msgdomain_list_ty *mdlp)
index c37f4a9adb4be64863592bc37c60fd73d8466385..8d0af3bcc62dbc56800200de0a26d599d2e227b8 100644 (file)
@@ -55,13 +55,6 @@ extern int verbose;
 
 extern enum is_syntax_check default_syntax_check[NSYNTAXCHECKS];
 
-/* Language dependent format string parser.
-   NULL if the language has no notion of format strings.  */
-extern struct formatstring_parser *current_formatstring_parser1;
-extern struct formatstring_parser *current_formatstring_parser2;
-extern struct formatstring_parser *current_formatstring_parser3;
-extern struct formatstring_parser *current_formatstring_parser4;
-
 
 /* Record a flag in the appropriate backend's table.
    OPTIONSTRING has the syntax WORD:ARG:FLAG (as documented)