[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Translator comments and other extensions to genparse
From: |
Michael Geng |
Subject: |
Translator comments and other extensions to genparse |
Date: |
Sat, 13 Oct 2007 14:38:10 +0200 |
User-agent: |
Mutt/1.5.9i |
Hi Bruno, Jim, Andreas, hello mailing list,
I released genparse version 0.7.2 which addresses some issues which we
recently discussed in the mailing list.
Splitting usage text in smaller pieces
======================================
Regarding http://lists.gnu.org/archive/html/bug-coreutils/2007-10/msg00048.html:
genparse now has a new command line option -P / --manyprints which causes the
description for every command line parameter to be printed in a seperate print
command. See example below.
Note that genparse also has a global directive #break_lines which allows to
break lines in the usage text automatically to a specified width.
Translator comments
===================
Release 0.7.2 also has a new directive __COMMENT__ which allows to add comments
to the source code which prints the help text. The example below shows how
this can be used especially for translator comments.
puts instead of printf
======================
Regarding http://lists.gnu.org/archive/html/bug-coreutils/2007-10/msg00087.html:
genparse automatically uses the puts command now if possible.
An updated version of genparse, updated docu and examples can be accessed from
http://genparse.sourceforge.net/ as usual.
========================================================
Below is a modified version of the genparse file for the wc command:
#include "coreutils.h"
c / bytes flag "print the byte counts"
m / chars flag "print the character counts"
l / lines flag "print the newline counts"
NONE / files0-from=F string "read input from the files specified by"
" NUL-terminated names in file F"
L / max-line-length flag __COMMENT__(TRANSLATORS: the length here is
actually the screen width)
"print the length of the longest line"
w / words flag "print the word counts"
#gp_include help_version.gp
#usage_begin
__COMMENT__(TRANSLATORS: Keep the colons aligned.)
Usage: __PROGRAM_NAME__ [OPTION]... [FILE]...
or: __PROGRAM_NAME__ [OPTION]...__NEW_PRINT__
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified. With no FILE, or when FILE is -,
read standard input.__NEW_PRINT__
__GLOSSARY_GNU__(25)
__COMMAND__(emit_bug_reporting_address ())
#usage_end
========================================================
And below is the usage () function of the parser genparse 0.7.2 generates
when invoked with
genparse --longmembers --internationalize --static-headers --gnulib
--manyprints -o wc-clp wc.gp
/*----------------------------------------------------------------------------
**
** usage ()
**
** Print out usage information, then exit
**
**--------------------------------------------------------------------------*/
void usage (int status, char *program_name)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
/* TRANSLATORS: Keep the colons aligned. */
printf (_("\
Usage: %s [OPTION]... [FILE]...\n\
or: %s [OPTION]...\n"), program_name, program_name);
puts (_("\
Print newline, word, and byte counts for each FILE, and a total line if\n\
more than one FILE is specified. With no FILE, or when FILE is -,\n\
read standard input."));
puts (_("\
-c, --bytes print the byte counts"));
puts (_("\
-m, --chars print the character counts"));
puts (_("\
-l, --lines print the newline counts"));
puts (_("\
--files0-from=F read input from the files specified by\n\
NUL-terminated names in file F"));
/* TRANSLATORS: the length here is actually the screen width */
puts (_("\
-L, --max-line-length print the length of the longest line"));
puts (_("\
-w, --words print the word counts"));
puts (_("\
--help display this help and exit"));
puts (_("\
--version output version information and exit"));
emit_bug_reporting_address ();
}
exit (status);
}
Michael
- Translator comments and other extensions to genparse,
Michael Geng <=