Commit d70283ce by Jeff Law

Initial revision

From-SVN: r21536
parent 19b7a780
#! /bin/sh
# Wrapper around gettext for GCC sources.
# Copyright 1998 Free Software Foundation, Inc.
# Written by Paul Eggert <eggert@twinsun.com>.
# This file is part of GNU CC.
# GNU CC 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.
# GNU CC 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 GNU CC; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Set environment to default value, if not already set.
: ${AWK=awk}
# The argument to this wrapper is the xgettext command to be executed.
# Extract the xgettext program name from the rest of the command.
xgettext=${1?}
shift
# Save work if we're just wrapping a no-op.
case $xgettext in
:) exit;;
esac
# Find the files to be scanned, and the directory to scan them from.
directory=.
files=
for i
do
case $i in
--directory=*)
directory=`expr " $i" : ' --directory=\(.*\)'`;;
--files-from=*)
files_from=`expr " $i" : ' --files-from=\(.*\)'`
files=`$AWK '/^[^#]/ { print }' $files_from`;;
esac
done
# Generate keyword options for xgettext,
# by scanning for declarations of functions
# whose parameter names end in "msgid".
generate_keyword_options='
/^[A-Z_a-z].*\(.*msgid[,)]/ {
paren_index = index($0, "(")
name = substr($0, 1, paren_index - 1)
sub(/[^0-9A-Z_a-z]*$/, "", name)
sub(/[ ]+PARAMS/, "", name)
sub(/[ ]+VPROTO/, "", name)
sub(/.*[^0-9A-Z_a-z]/, "", name)
args = substr($0, paren_index)
sub(/msgid[,)].*/, "", args)
for (n = 1; sub(/^[^,]*,/, "", args); n++) {
continue;
}
if (n == 1) {
keyword = name
} else {
keyword = name ":" n
}
if (! keyword_seen[keyword]++) {
print "--keyword=" keyword
}
}
'
keyword_options=`(
cd $directory &&
$AWK "$generate_keyword_options" $files < /dev/null
)` || exit
# Generate temporary file reflecting the %e strings in the scanned files.
tmp=tmp-emsgids.c
generate_emsgids='
/%e.*}/ {
line = $0
while ((percent_index = index(line, "%e")) != 0) {
line = substr(line, percent_index + 2)
bracket_index = index(line, "}")
if (bracket_index == 0) {
continue
}
msgid = substr(line, 1, bracket_index - 1)
if (index(msgid, "%") != 0) {
continue
}
printf "#line %d \"%s\"\n", FNR, FILENAME
printf "_(\"%s\")\n", msgid
line = substr(line, bracket_index + 1)
}
}
'
(cd $directory &&
$AWK "$generate_emsgids" $files < /dev/null
) > $directory/$tmp || exit
# Run the xgettext command, with temporary added as a file to scan.
"$xgettext" $keyword_options ${1+"$@"} $tmp || exit
# Clean up.
# If we don't get here, `make clean' will remove this file later.
rm -f $directory/$tmp
#line 59 "config/arc/arc.h"
_("may not use both -EB and -EL")
#line 176 "config/arm/arm.h"
_("-mapcs-26 and -mapcs-32 may not be used together")
#line 187 "config/arm/arm.h"
_("-msoft-float and -mhard_float may not be used together")
#line 198 "config/arm/arm.h"
_("-mbig-endian and -mlittle-endian may not be used together")
#line 72 "config/arm/riscix.h"
_("-mbsd and -pedantic incompatible")
#line 73 "config/arm/riscix.h"
_("-mbsd and -mxopen incompatible")
#line 74 "config/arm/riscix.h"
_("-mxopen and -pedantic incompatible")
#line 133 "config/arm/riscix.h"
_("-mbsd and -pedantic incompatible")
#line 134 "config/arm/riscix.h"
_("-mbsd and -mxopen incompatible")
#line 135 "config/arm/riscix.h"
_("-mxopen and -pedantic incompatible")
#line 126 "config/dsp16xx/dsp16xx.h"
_("A -ifile option requires a -map option")
#line 135 "config/dsp16xx/dsp16xx.h"
_("A -ifile option requires a -map option")
#line 809 "config/i386/sco5.h"
_("-static not valid with -mcoff")
#line 810 "config/i386/sco5.h"
_("-shared not valid with -mcoff")
#line 811 "config/i386/sco5.h"
_("-symbolic not valid with -mcoff")
#line 847 "config/i386/sco5.h"
_("-fpic is not valid with -mcoff")
#line 848 "config/i386/sco5.h"
_("-fPIC is not valid with -mcoff")
#line 882 "config/i386/sco5.h"
_("-static not valid with -mcoff")
#line 883 "config/i386/sco5.h"
_("-shared not valid with -mcoff")
#line 884 "config/i386/sco5.h"
_("-symbolic not valid with -mcoff")
#line 885 "config/i386/sco5.h"
_("-fpic not valid with -mcoff")
#line 886 "config/i386/sco5.h"
_("-fPIC not valid with -mcoff")
#line 305 "config/i860/fx2800.h"
_("-p option not supported: use -pg instead")
#line 674 "config/mips/mips.h"
_("-pipe is not supported.")
#line 811 "config/mips/mips.h"
_("may not use both -mfp64 and -msingle-float")
#line 812 "config/mips/mips.h"
_("may not use both -mfp64 and -m4650")
#line 815 "config/mips/mips.h"
_("may not use both -EB and -EL")
#line 27 "config/mips/r3900.h"
_("-mhard-float not supported.")
#line 29 "config/mips/r3900.h"
_("-msingle-float and -msoft-float can not both be specified.")
#line 41 "config/mips/r3900.h"
_("-mhard-float not supported.")
#line 43 "config/mips/r3900.h"
_("-msingle-float and -msoft-float can not both be specified.")
#line 166 "config/nextstep.h"
_("-p profiling is no longer supported. Use -pg instead.")
#line 169 "config/nextstep.h"
_("-p profiling is no longer supported. Use -pg instead.")
#line 36 "config/vax/vax.h"
_("profiling not supported with -mg\n")
#line 37 "config/vax/vax.h"
_("profiling not supported with -mg\n")
#line 32 "cp/lang-specs.h"
_("GNU C++ does not support -C without using -E")
#line 45 "cp/lang-specs.h"
_("-pg and -fomit-frame-pointer are incompatible")
#line 56 "cp/lang-specs.h"
_("-pg and -fomit-frame-pointer are incompatible")
#line 603 "gcc.c"
_("GNU C does not support -C without using -E")
#line 617 "gcc.c"
_("-pg and -fomit-frame-pointer are incompatible")
#line 624 "gcc.c"
_("GNU C does not support -C without using -E")
#line 633 "gcc.c"
_("-E required when input is from standard input")
#line 637 "gcc.c"
_("GNU C does not support -C without using -E")
#line 652 "gcc.c"
_("-pg and -fomit-frame-pointer are incompatible")
#line 659 "gcc.c"
_("Compilation of header file requested")
#line 661 "gcc.c"
_("GNU C does not support -C without using -E")
#line 676 "gcc.c"
_("-pg and -fomit-frame-pointer are incompatible")
#line 689 "gcc.c"
_("GNU C does not support -C without using -E")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment