gnucash/po/extract-macros.perl.in
Dave Peticolas a29e317b9f *** empty log message ***
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2172 57a11ea4-9604-0410-9ed3-97b8803252fd
2000-04-09 18:51:04 +00:00

72 lines
2.0 KiB
Perl

#! /usr/bin/perl -s
#
# extract-macros.perl.in - Generate C file for input to xgettext
# Copyright (C) 1999 Laurent Pélecq
#
# 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 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Author: Laurent Pélecq
# Address: 71 rue de Bagnolet
# F-75020 Paris (France)
# Begin variables set by configure
$package_name="@PACKAGE@";
$cpp="@CPP@";
# End variables set by configure
sub usage {
my ($status)=@_;
print "usage:\t$0 <header-file> ...\n";
exit $status;
}
usage 1 if $#ARGV==-1;
usage 0 if $h;
$prefile="messages-i18n.c";
open(TMP, ">$prefile") || die "$prefile: can't open file\n";
select TMP;
printf "/* automatically generated by %s\n", $0;
printf " source files:\n";
foreach $file (@ARGV)
{
printf " - %s\n", $file;
}
printf "*/\n\n";
foreach $file (@ARGV)
{
printf "#include \"%s\"\n", $file;
}
printf "\n/* Strings for package %s */\n", $package_name;
printf "const char *all_strings[]={\n";
while(<>)
{
printf ("\t%s,\n", $1) if (/^#define\s+([A-Z0-9_]+)\s+_\(\"/);
printf ("\t_ %s,\n", $1) if (/^#define\s+([A-Z0-9_]+)\s+N_\(\"/);
}
printf "\tNULL\n";
printf "};\n";
select STDOUT;
close (TMP);
system ("$cpp -DHAVE_GETTEXT $prefile");
unlink ($prefile);