This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Making platform specific help translatable.
- To: pthomas at suse dot de
- Subject: Re: Making platform specific help translatable.
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 1 Jun 2000 19:29:51 +0200
- CC: gcc at gcc dot gnu dot org, drepper at cygnus dot com
- References: <20000531191949.X12004@Jeffreys.suse.de> <200005311746.TAA01248@loewis.home.cs.tu-berlin.de> <20000531200141.Z12004@Jeffreys.suse.de> <200005311846.UAA01568@loewis.home.cs.tu-berlin.de> <20000601164618.A6166@Jeffreys.suse.de>
> The modified gettext package should then be made available in the
> infrastructure directory to make it easy for those that want to work on the
> NLS stuff.
I've produced a patch against gettext 0.10.35, included below. This
patch contains only the primary changes; when compiling, gettext will
regenerate some files that are also included in the distribution.
I've performed only minimal tests, please let me know whether it works.
Regards,
Martin
2000-06-01 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* xgettext.c (long_options): New option defines.
* xget-lex.c (phase6_get): If set, process #defines as well.
diff -ur gettext-0.10.35/src/xget-lex.c ./src/xget-lex.c
--- gettext-0.10.35/src/xget-lex.c Fri May 1 06:45:12 1998
+++ ./src/xget-lex.c Thu Jun 1 19:09:48 2000
@@ -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>
@@ -1038,7 +1038,7 @@
/* Maximum used guaranteed to be < 4. */
static token_ty phase6_pushback[4];
static int phase6_pushback_length;
-
+extern int defines;
static void
phase6_get (tp)
@@ -1062,9 +1062,36 @@
if (tp->type != token_type_hash)
return;
+ /* Find the first non-whitespace token. If it is a define, we
+ will treat the rest of the line as normal input, if defines
+ is set. */
+ if (defines)
+ {
+ while (1)
+ {
+ phaseX_get (tp);
+ if (tp->type == token_type_eoln || tp->type == token_type_eof)
+ return;
+ if (tp->type != token_type_white_space)
+ break;
+ }
+ if (tp->type == token_type_name
+ && strcmp (tp->string, "define") == 0)
+ return;
+ /* It's not a define, so we start collecting tokens. */
+ if (!bufmax)
+ {
+ bufmax = 100;
+ buf = xrealloc (buf, bufmax * sizeof (buf[0]));
+ }
+ buf[0] = *tp;
+ bufpos = 1;
+ }
+ else
+ bufpos = 0;
+
/* Accumulate the rest of the directive in a buffer. Work out
what it is later. */
- bufpos = 0;
while (1)
{
phaseX_get (tp);
@@ -1104,7 +1131,6 @@
logical_file_name = xstrdup (buf[1].string);
line_number = buf[0].number;
}
-
/* Release the storage held by the directive. */
for (j = 0; j < bufpos; ++j)
{
diff -ur gettext-0.10.35/src/xgettext.c ./src/xgettext.c
--- gettext-0.10.35/src/xgettext.c Wed Apr 29 18:57:50 1998
+++ ./src/xgettext.c Thu Jun 1 19:10:11 2000
@@ -1,5 +1,5 @@
/* Extracts strings from C source file to Uniforum style .po file.
- 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
@@ -80,6 +80,9 @@
/* Name of default domain file. If not set defaults to messages.po. */
static char *default_domain;
+/* If preprocessor defines are also analyzed for keywords. */
+int defines;
+
/* If called with --debug option the output reflects whether format
string recognition is done automatically or forced by the user. */
static int do_debug;
@@ -125,6 +128,7 @@
{ "debug", no_argument, &do_debug, 1 },
{ "default-domain", required_argument, NULL, 'd' },
{ "directory", required_argument, NULL, 'D' },
+ { "defines", no_argument, &defines, 1 },
{ "escape", no_argument, NULL, 'E' },
{ "exclude-file", required_argument, NULL, 'x' },
{ "extract-all", no_argument, &extract_all, 1 },
@@ -545,6 +549,7 @@
-C, --c++ shorthand for --language=C++\n\
--debug more detailed formatstring recognision result\n\
-d, --default-domain=NAME use NAME.po for output (instead of messages.po)\n\
+ --defines analyze preprocessor defines\n\
-D, --directory=DIRECTORY add DIRECTORY to list for input files search\n\
-e, --no-escape do not use C escapes in output (default)\n\
-E, --escape use C escapes in output, no extended chars\n\
--- gettext-0.10.35/doc/gettext.texi Fri May 1 07:53:32 1998
+++ doc/gettext.texi Thu Jun 1 19:20:00 2000
@@ -20,7 +20,7 @@
This file provides documentation for GNU @code{gettext} utilities.
It also serves as a reference for the free Translation Project.
-Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -1827,6 +1827,10 @@
The special domain name @file{-} or @file{/dev/stdout} means to write
the output to @file{stdout}.
+@itemx --defines
+Look for the keywords in #define statements as well. Normally, xgettext
+will treat them as white space.
+
@item -D @var{directory}
@itemx --directory=@var{directory}
Change to @var{directory} before beginning to search and scan source