+2001-06-30 Bruno Haible <haible@clisp.cons.org>
+
+ * configure.in: Call gt_STDBOOL_H.
+
2001-06-25 Bruno Haible <haible@clisp.cons.org>
* configure.in (ACLOCAL_VERSION): Remove.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.13)
-AC_REVISION($Revision: 1.34 $)
+AC_REVISION($Revision: 1.35 $)
AC_INIT(src/msgfmt.c)
AM_INIT_AUTOMAKE(gettext, 0.11)
RELEASE_DATE=2001-05-23 dnl in "date +%Y-%m-%d" format
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h malloc.h string.h unistd.h values.h)
+gt_STDBOOL_H
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+2001-06-30 Bruno Haible <haible@clisp.cons.org>
+
+ * stdbool.h.in: New file.
+ * Makefile.am (EXTRA_DIST): Add stdbool.h.in.
+ (all-local): Depend on @STDBOOL_H@.
+ (stdbool.h): New rule.
+ (MOSTLYCLEANFILES): New variable.
+ * progname.h: Include stdbool.h.
+ (error_with_progname): Change type to bool.
+ * progname.c (error_with_progname): Likewise.
+
2001-06-25 Bruno Haible <haible@clisp.cons.org>
* mbswidth.c (mbsinit): Define to 1 if not defined. For SCO 3.2v5.0.2.
EXTRA_DIST = alloca.c config.charset error.c getline.c memset.c memmove.c \
printf-prs.c ref-add.sin ref-del.sin stpcpy.c stpncpy.c strcasecmp.c \
strcspn.c strncasecmp.c strstr.c strtol.c strtoul.c vasprintf.c \
+stdbool.h.in \
gen-lbrkprop.c 3level.h
libnlsut_a_SOURCES = basename.c c-ctype.c concatpath.c findprog.c fstrcmp.c \
INCLUDES = -I. -I$(srcdir) -I.. -I../intl
+all-local: @STDBOOL_H@
+stdbool.h: stdbool.h.in
+ cp $(srcdir)/stdbool.h.in stdbool.h
+MOSTLYCLEANFILES = @STDBOOL_H@
+
+
# The following is needed in order to install a simple file in $(libdir)
# which is shared with other installed packages. We use a list of referencing
# packages so that "make uninstall" will remove the file if and only if it
/* Indicates whether errors and warnings get prefixed with program_name.
Default is true. */
-int error_with_progname = 1;
+bool error_with_progname = true;
/* Print program_name prefix on stderr if and only if error_with_progname
is true. */
#ifndef _PROGNAME_H
#define _PROGNAME_H
+#include <stdbool.h>
+
/* This file supports selectively prefixing or nor prefixing error messages
with the program name.
Default is true.
A reason to omit the prefix is for better interoperability with Emacs'
compile.el. */
-extern int error_with_progname;
+extern bool error_with_progname;
/* Print program_name prefix on stderr if and only if error_with_progname
is true. */
--- /dev/null
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+
+ 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+/* ISO C 99 <stdbool.h> for platforms that lack it. */
+
+/* 7.16. Boolean type and values */
+
+/* For the sake of symbolic names in gdb, define _Bool as an enum type. */
+typedef enum { false = 0, true = 1 } _Bool;
+#define bool _Bool
+
+/* The other macros must be usable in preprocessor directives. */
+#define false 0
+#define true 1
+#define __bool_true_false_are_defined 1
+
+#endif /* _STDBOOL_H */
+2001-06-30 Bruno Haible <haible@clisp.cons.org>
+
+ * stdbool.m4: New file.
+ * Makefile.am (EXTRA_DIST): Add it.
+
2001-06-25 Bruno Haible <haible@clisp.cons.org>
* mbswidth.m4: Also check for mbsinit. Needed for SCO 3.2v5.0.2.
EXTRA_DIST = README \
c-bs-a.m4 codeset.m4 getline.m4 gettext.m4 glibc21.m4 iconv.m4 \
inttypes_h.m4 isc-posix.m4 lcmessage.m4 libtool.m4 mbrtowc.m4 mbstate_t.m4 \
-mbswidth.m4 progtest.m4 setlocale.m4 signed.m4 ssize_t.m4 uintmax_t.m4 \
-ulonglong.m4 unionwait.m4
+mbswidth.m4 progtest.m4 setlocale.m4 signed.m4 ssize_t.m4 stdbool.m4 \
+uintmax_t.m4 ulonglong.m4 unionwait.m4
--- /dev/null
+dnl serial 1
+
+dnl From Bruno Haible.
+dnl Test whether <stdbool.h> is supported or must be substituted.
+
+AC_DEFUN([gt_STDBOOL_H],
+[dnl gcc 2.95.2 has an <stdbool.h> for which both 'true' and 'false' evaluate
+dnl to 0 in preprocessor expressions.
+AC_MSG_CHECKING([for stdbool.h])
+AC_CACHE_VAL(gt_cv_header_stdbool_h, [
+ AC_TRY_COMPILE([#include <stdbool.h>
+#if false
+int A[-1];
+#endif
+#define b -1
+#if true
+#undef b
+#define b 1
+#endif
+int B[b];
+], [], gt_cv_header_stdbool_h=yes, gt_cv_header_stdbool_h=no)])
+AC_MSG_RESULT([$gt_cv_header_stdbool_h])
+if test $gt_cv_header_stdbool_h = yes; then
+ AC_DEFINE(HAVE_STDBOOL_H, 1,
+ [Define if you have a working <stdbool.h> header file.])
+ STDBOOL_H=''
+else
+ STDBOOL_H='stdbool.h'
+fi
+AC_SUBST(STDBOOL_H)
+])
+2001-06-30 Bruno Haible <haible@clisp.cons.org>
+
+ * message.h: Include stdbool.h.
+ (message_ty): Change type of fields 'is_fuzzy', 'obsolete' to bool.
+ (message_predicate_ty): Change return type to bool.
+ * message.c (message_alloc): Update.
+ * msgcat.c (is_message_selected): Change return type to bool.
+ (is_message_needed): Likewise.
+ (is_message_first_needed): Likewise.
+ (main): Use bool.
+ (catenate_msgdomain_list): Update. Use yes/no for is_c_format and
+ do_wrap.
+ * msgcmp.c (multi_domain_mode): Change type to bool.
+ (compare_directive_message): Change 'obsolete' argument type to bool.
+ (main): Use bool.
+ * msgcomm.c (is_message_selected): Change return type to bool.
+ (extract_directive_message): Change 'obsolete' argument type to bool.
+ (main): Use bool.
+ (struct extract_class_ty): Change type of field 'is_fuzzy' to bool.
+ Change type of field 'filepos_count' to size_t.
+ (extract_constructor): Update.
+ (extract_parse_brief): Update.
+ (extract_comment_special): Update.
+ (read_po_file): Update.
+ * msgconv.c (main): Use bool.
+ * msgen.c (main): Use bool.
+ * msgfmt.c (struct msgfmt_class_ty): Change type of fields 'is_fuzzy',
+ 'has_header_entry' to bool.
+ (include_all): Change type to bool.
+ (do_check): Likewise.
+ (long_options): Update.
+ (format_directive_message): Change 'obsolete' argument type to bool.
+ (main): Use bool.
+ (format_constructor): Update.
+ (format_debrief): Update.
+ (format_comment_special): Update.
+ (check_pair): Update.
+ * msggrep.c (is_string_selected): Change return type to bool.
+ (is_message_selected): Likewise.
+ (main): Use bool.
+ * msgl-charset.c (compare_po_locale_charsets): Use bool.
+ * msgl-iconv.c (iconv_message_list): Update.
+ * msgmerge.c (quiet): Change type to bool.
+ (multi_domain_mode): Likewise.
+ (main): Use bool.
+ (match_domain): Update.
+ (merge): Update.
+ * msgsed.c (main): Use bool.
+ * msgunfmt.c (main): Use bool.
+ * po-gram-gen.y (string, stringlist, number, pos, rhs): Change type of
+ 'obsolete' field to bool.
+ * po-lex.h: Include stdbool.h.
+ (pass_obsolete_entries): Change type to bool.
+ (po_lex_pass_comments): Change argument type to bool.
+ (po_lex_pass_obsolete_entries): Likewise.
+ (po_gram_error): Update.
+ (po_gram_error_at_line): Update.
+ * po-lex.c (po_lex_obsolete): Change type to bool.
+ (pass_comments): Likewise.
+ (pass_obsolete_entries): Likewise.
+ (lex_open): Update.
+ (lex_close): Update.
+ (po_gram_error): Update.
+ (po_gram_error_at_line): Update.
+ (po_gram_lex): Update.
+ (po_lex_pass_comments): Change argument type to bool.
+ (po_lex_pass_obsolete_entries): Likewise.
+ * po.h (struct po_method_ty): Change 'obsolete' argument type of
+ directive_message to bool.
+ (po_callback_message): Change 'obsolete' argument type to bool.
+ * po.c (po_directive_message): Change 'obsolete' argument type to bool.
+ (po_callback_message): Likewise.
+ * read-po.c (struct readall_class_ty): Change type of field 'is_fuzzy'
+ to bool.
+ (readall_directive_message): Change 'obsolete' argument type to bool.
+ (readall_constructor): Update.
+ (readall_parse_brief): Update.
+ (readall_comment_special): Update.
+ (read_po_file): Update.
+ * str-list.h: Include stdbool.h.
+ (string_list_member): Change return type to bool.
+ * str-list.c (string_list_member): Change return type to bool.
+ * write-po.h (message_print_style_escape, msgdomain_list_print): Change
+ argument type to bool.
+ * write-po.c (make_c_format_description_string) Change argument type
+ to bool.
+ (message_print): Likewise.
+ (message_print_obsolete): Likewise.
+ (indent): Change type to bool.
+ (uniforum): Likewise.
+ (escape): Likewise.
+ (message_print_style_indent): Update.
+ (message_print_style_uniforum): Update.
+ (message_print_style_escape): Change argument type to bool.
+ (wrap): Update.
+ (msgdomain_list_print): Change argument type to bool.
+ * xget-lex.h (xgettext_any_keywords): Change return type to bool.
+ * xget-lex.c (trigraphs): Change type to bool.
+ (default_keywords): Likewise.
+ (phase5_get): Use NULL not 0. Update.
+ (phaseX_get): Use bool.
+ (xgettext_lex): Update.
+ (xgettext_lex_keyword): Update.
+ (xgettext_any_keywords): Change return type to bool.
+ (xgettext_lex_trigraphs): Update.
+ * xgettext.c (add_all_comments): Change type to bool.
+ (extract_all): Likewise.
+ (long_options): Update.
+ (exclude_directive_message): Change 'obsolete' argument type to bool.
+ (extract_directive_message): Likewise.
+ (main): Use bool.
+ (scan_c_file): Update.
+ (struct extract_class_ty): Change type of field 'is_fuzzy' to bool.
+ Change type of field 'filepos_count' to size_t.
+ (extract_constructor): Update.
+ (extract_parse_brief): Update.
+ (extract_comment_special): Update.
+ (construct_header): Update.
+
2001-06-25 Bruno Haible <haible@clisp.cons.org>
* msggrep.c (usage): Explain the pattern syntax.
mp->comment_dot = NULL;
mp->filepos_count = 0;
mp->filepos = NULL;
- mp->is_fuzzy = 0;
+ mp->is_fuzzy = false;
mp->is_c_format = undecided;
mp->do_wrap = undecided;
mp->used = 0;
- mp->obsolete = 0;
+ mp->obsolete = false;
return mp;
}
#include "str-list.h"
#include "pos.h"
+#include <stdbool.h>
+
/* According to Sun's Uniforum proposal the default message domain is
named 'messages'. */
#define MESSAGE_DOMAIN_DEFAULT "messages"
lex_pos_ty *filepos;
/* Informations from special comments (e.g. generated by msgmerge). */
- int is_fuzzy;
+ bool is_fuzzy;
enum is_c_format is_c_format;
/* Do we want the string to be wrapped in the emitted PO file? */
/* If set the message is obsolete and while writing out it should be
commented out. */
- int obsolete;
+ bool obsolete;
/* Used for checking that messages have been used, in the msgcmp,
msgmerge, msgcomm and msgcat programs. */
message_list_prepend PARAMS ((message_list_ty *mlp, message_ty *mp));
extern void
message_list_delete_nth PARAMS ((message_list_ty *mlp, size_t n));
-typedef int message_predicate_ty PARAMS ((const message_ty *mp));
+typedef bool message_predicate_ty PARAMS ((const message_ty *mp));
extern void
message_list_remove_if_not PARAMS ((message_list_ty *mlp,
message_predicate_ty *predicate));
/* Prototypes for local functions. */
static void usage PARAMS ((int status));
static string_list_ty *read_name_from_file PARAMS ((const char *file_name));
-static int is_message_selected PARAMS ((const message_ty *tmp));
-static int is_message_needed PARAMS ((const message_ty *tmp));
-static int is_message_first_needed PARAMS ((const message_ty *tmp));
+static bool is_message_selected PARAMS ((const message_ty *tmp));
+static bool is_message_needed PARAMS ((const message_ty *tmp));
+static bool is_message_first_needed PARAMS ((const message_ty *tmp));
static msgdomain_list_ty *
catenate_msgdomain_list PARAMS ((string_list_ty *file_list,
const char *to_code));
{
int cnt;
int optchar;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
char *output_file;
const char *files_from;
string_list_ty *file_list;
msgdomain_list_ty *result;
- int sort_by_msgid = 0;
- int sort_by_filepos = 0;
+ bool sort_by_msgid = false;
+ bool sort_by_filepos = false;
/* Set program name for messages. */
program_name = argv[0];
textdomain (PACKAGE);
/* Set default values for variables. */
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
output_file = NULL;
files_from = NULL;
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'f':
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
msgdomain_list_sort_by_msgid (result);
/* Write the PO file. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
}
-static int
+static bool
is_message_selected (tmp)
const message_ty *tmp;
{
}
-static int
+static bool
is_message_needed (mp)
const message_ty *mp;
{
/* The use_first logic. */
-static int
+static bool
is_message_first_needed (mp)
const message_ty *mp;
{
if (mp->tmp->obsolete && is_message_needed (mp))
{
- mp->tmp->obsolete = 0;
- return 1;
+ mp->tmp->obsolete = false;
+ return true;
}
else
- return 0;
+ return false;
}
if (mlp->nitems > 0)
{
for (j = 0; j < mlp->nitems; j++)
- if (mlp->item[j]->msgid[0] == '\0' && mlp->item[j]->obsolete == 0)
+ if (mlp->item[j]->msgid[0] == '\0' && !mlp->item[j]->obsolete)
{
const char *header = mlp->item[j]->msgstr;
char *project_id = NULL;
for (j = 0; j < mlp->nitems; j++)
- if (mlp->item[j]->msgid[0] == '\0' && mlp->item[j]->obsolete == 0)
+ if (mlp->item[j]->msgid[0] == '\0' && !mlp->item[j]->obsolete)
{
const char *header = mlp->item[j]->msgstr;
{
tmp = message_alloc (mp->msgid, mp->msgid_plural, NULL, 0,
&mp->pos);
- tmp->is_c_format = 0; /* may be set to 1 later */
- tmp->do_wrap = 1; /* may be set to 0 later */
- tmp->obsolete = 1; /* may be set to 0 later */
+ tmp->is_c_format = no; /* may be set to yes later */
+ tmp->do_wrap = yes; /* may be set to no later */
+ tmp->obsolete = true; /* may be set to false later */
message_list_append (total_mlp, tmp);
}
all in a single encoding. If so, conversion is not needed. */
const char *first = NULL;
const char *second = NULL;
- int with_UTF8 = 0;
+ bool with_UTF8 = false;
for (n = 0; n < nfiles; n++)
{
second = canon_charsets[n][k];
if (strcmp (canon_charsets[n][k], "UTF-8") == 0)
- with_UTF8 = 1;
+ with_UTF8 = true;
}
}
for (i = 0; i < mp->filepos_count; i++)
message_comment_filepos (tmp, mp->filepos[i].file_name,
mp->filepos[i].line_number);
- tmp->is_fuzzy = 1;
- if (mp->is_c_format)
- tmp->is_c_format = 1;
- if (!mp->do_wrap)
- tmp->do_wrap = 0;
+ tmp->is_fuzzy = true;
+ if (mp->is_c_format == yes)
+ tmp->is_c_format = yes;
+ if (mp->do_wrap == no)
+ tmp->do_wrap = no;
if (!mp->obsolete)
- tmp->obsolete = 0;
+ tmp->obsolete = false;
}
}
}
/* Apply the .pot file to each of the domains in the PO file. */
-static int multi_domain_mode;
+static bool multi_domain_mode = false;
/* Long options. */
static const struct option long_options[] =
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
int
char *argv[];
{
int optchar;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
/* Set program name for messages. */
set_program_name (argv[0]);
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
while ((optchar = getopt_long (argc, argv, "D:hmV", long_options, NULL))
!= EOF)
switch (optchar)
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'm':
- multi_domain_mode = 1;
+ multi_domain_mode = true;
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
default:
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
compare_class_ty *this = (compare_class_ty *) that;
message_ty *mp;
#endif
;
static string_list_ty *read_name_from_file PARAMS ((const char *file_name));
-static int is_message_selected PARAMS ((const message_ty *mp));
+static bool is_message_selected PARAMS ((const message_ty *mp));
static void extract_constructor PARAMS ((po_ty *that));
static void extract_directive_domain PARAMS ((po_ty *that, char *name));
static void extract_directive_message PARAMS ((po_ty *that, char *msgid,
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
static void extract_parse_brief PARAMS ((po_ty *that));
static void extract_comment PARAMS ((po_ty *that, const char *s));
static void extract_comment_dot PARAMS ((po_ty *that, const char *s));
{
int cnt;
int optchar;
- int do_help = 0;
- int do_version = 0;
+ bool do_help = false;
+ bool do_version = false;
message_list_ty *mlp;
msgdomain_list_ty *result;
- int sort_by_msgid = 0;
- int sort_by_filepos = 0;
+ bool sort_by_msgid = false;
+ bool sort_by_filepos = false;
const char *files_from = NULL;
string_list_ty *file_list;
char *output_file = NULL;
dir_list_append (optarg);
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'f':
files_from = optarg;
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
message_print_style_indent ();
output_file = optarg;
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
message_print_style_uniforum ();
less_than = 2;
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
{
msgdomain_list_sort_by_msgid (result);
/* Write the PO file. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
}
-static int
+static bool
is_message_selected (mp)
const message_ty *mp;
{
string_list_ty *comment;
string_list_ty *comment_dot;
- int is_fuzzy;
+ bool is_fuzzy;
enum is_c_format is_c_format;
enum is_wrap do_wrap;
- int filepos_count;
+ size_t filepos_count;
lex_pos_ty *filepos;
};
this->mlp = NULL; /* actually set in read_po_file, below */
this->comment = NULL;
this->comment_dot = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
this->filepos_count = 0;
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
extract_class_ty *this = (extract_class_ty *)that;
message_ty *mp;
this->comment_dot = NULL;
this->filepos_count = 0;
this->filepos = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
return;
/* The ``obsolete'' flag is cleared before reading each PO file.
If thisflag is clear, set it, and increment the ``used'' counter.
This allows us to count how many of the PO files use the message. */
- if (mp->obsolete == 0)
+ if (!mp->obsolete)
{
- mp->obsolete = 1;
+ mp->obsolete = true;
mp->used++;
}
free (this->filepos);
this->filepos_count = 0;
this->filepos = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
}
extract_parse_brief (that)
po_ty *that;
{
- po_lex_pass_comments (1);
+ po_lex_pass_comments (true);
}
extract_class_ty *this = (extract_class_ty *) that;
if (strstr (s, "fuzzy") != NULL)
- this->is_fuzzy = 1;
+ this->is_fuzzy = true;
if (strstr (s, "c-format") != NULL)
this->is_c_format = yes;
if (strstr (s, "no-c-format") != NULL)
is clear, it is set, and increment the ``used'' counter. This
allows us to count how many of the PO files use each message. */
for (j = 0; j < mlp->nitems; ++j)
- mlp->item[j]->obsolete = 0;
+ mlp->item[j]->obsolete = false;
}
char **argv;
{
int opt;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
char *output_file;
const char *input_file;
msgdomain_list_ty *result;
- int sort_by_filepos = 0;
- int sort_by_msgid = 0;
+ bool sort_by_filepos = false;
+ bool sort_by_msgid = false;
/* Set program name for messages. */
program_name = argv[0];
textdomain (PACKAGE);
/* Set default values for variables. */
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
output_file = NULL;
input_file = NULL;
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
char **argv;
{
int opt;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
char *output_file;
msgdomain_list_ty *result;
- int sort_by_filepos = 0;
- int sort_by_msgid = 0;
+ bool sort_by_filepos = false;
+ bool sort_by_msgid = false;
/* Set program name for messages. */
program_name = argv[0];
textdomain (PACKAGE);
/* Set default values for variables. */
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
output_file = NULL;
while ((opt = getopt_long (argc, argv, "D:eEFhio:sVw:", long_options, NULL))
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
/* inherited instance variables, etc */
PO_BASE_TY
- int is_fuzzy;
+ bool is_fuzzy;
enum is_c_format is_c_format;
enum is_wrap do_wrap;
- int has_header_entry;
+ bool has_header_entry;
};
/* Alignment of strings in resulting .mo file. */
/* Contains exit status for case in which no premature exit occurs. */
static int exit_status;
-/* If nonzero include even fuzzy translations in output file. */
-static int include_all;
+/* If true include even fuzzy translations in output file. */
+static bool include_all = false;
/* Nonzero if no hash table in .mo is wanted. */
static int no_hash_table;
/* If not zero list duplicate message identifiers. */
static int verbose_level;
-/* If not zero check strings according to format string rules for the
+/* If true check strings according to format string rules for the
language. */
-static int do_check;
+static bool do_check = false;
/* Counters for statistics on translations for the processed files. */
static int msgs_translated;
static const struct option long_options[] =
{
{ "alignment", required_argument, NULL, 'a' },
- { "check", no_argument, &do_check, 1 },
+ { "check", no_argument, NULL, 'c' },
{ "directory", required_argument, NULL, 'D' },
{ "help", no_argument, NULL, 'h' },
{ "no-hash", no_argument, &no_hash_table, 1 },
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
static void format_comment_special PARAMS ((po_ty *pop, const char *s));
static void format_debrief PARAMS ((po_ty *));
static struct msg_domain *new_domain PARAMS ((const char *name,
char *argv[];
{
int opt;
- int do_help = 0;
- int do_version = 0;
- int strict_uniforum = 0;
+ bool do_help = false;
+ bool do_version = false;
+ bool strict_uniforum = false;
struct msg_domain *domain;
/* Set default value for global variables. */
}
break;
case 'c':
- do_check = 1;
+ do_check = true;
break;
case 'D':
dir_list_append (optarg);
break;
case 'f':
- include_all = 1;
+ include_all = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'o':
output_file_name = optarg;
break;
case 'S':
- strict_uniforum = 1;
+ strict_uniforum = true;
break;
case 'v':
++verbose_level;
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
default:
usage (EXIT_FAILURE);
/* Prepare PO file reader. We need to see the comments because inexact
translations must be reported. */
- po_lex_pass_comments (1);
+ po_lex_pass_comments (true);
/* Now write out all domains. */
/* Process all given .po files. */
{
msgfmt_class_ty *this = (msgfmt_class_ty *) that;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
- this->has_header_entry = 0;
+ this->has_header_entry = false;
}
/* Test whether header entry was found.
FIXME: Should do this even if not in verbose mode, because the
consequences are not harmless. But it breaks the test suite. */
- if (verbose_level > 0 && this->has_header_entry == 0)
+ if (verbose_level > 0 && !this->has_header_entry)
{
multiline_error (xasprintf ("%s: ", gram_pos.file_name),
xasprintf (_("\
char *msgstr_string;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
msgfmt_class_ty *this = (msgfmt_class_ty *) that;
struct hashtable_entry *entry;
{
/* We don't change the exit status here because this is really
only an information. */
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgstr_pos->file_name, msgstr_pos->line_number,
(msgstr_string[0] == '\0'
? _("empty `msgstr' entry ignored")
: _("fuzzy `msgstr' entry ignored")));
- error_with_progname = 1;
+ error_with_progname = true;
}
/* Increment counter for fuzzy/untranslated messages. */
/* Test for header entry. */
if (msgid_string[0] == '\0')
{
- this->has_header_entry = 1;
+ this->has_header_entry = true;
/* Do some more tests on test contents of the header entry. */
if (verbose_level > 0)
free (msgid_string);
/* Prepare for next message. */
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
}
if (strstr (s, "fuzzy") != NULL)
{
- static int warned = 0;
+ static bool warned = false;
- if (!include_all && verbose_level > 1 && warned == 0)
+ if (!include_all && verbose_level > 1 && !warned)
{
- warned = 1;
+ warned = true;
error (0, 0, _("\
%s: warning: source file contains fuzzy translation"),
gram_pos.file_name);
}
- this->is_fuzzy = 1;
+ this->is_fuzzy = true;
}
this->is_c_format = parse_c_format_description_string (s);
this->do_wrap = parse_c_width_description_string (s);
{
if (TEST_NEWLINE(msgid_plural) != has_newline)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
`msgid' and `msgid_plural' entries do not both begin with '\\n'"));
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
for (p = msgstr, i = 0; p < msgstr + msgstr_len; p += strlen (p) + 1, i++)
if (TEST_NEWLINE(p) != has_newline)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
`msgid' and `msgstr[%u]' entries do not both begin with '\\n'"), i);
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
}
{
if (TEST_NEWLINE(msgstr) != has_newline)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
`msgid' and `msgstr' entries do not both begin with '\\n'"));
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
}
{
if (TEST_NEWLINE(msgid_plural) != has_newline)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
`msgid' and `msgid_plural' entries do not both end with '\\n'"));
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
for (p = msgstr, i = 0; p < msgstr + msgstr_len; p += strlen (p) + 1, i++)
if (TEST_NEWLINE(p) != has_newline)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
`msgid' and `msgstr[%u]' entries do not both end with '\\n'"), i);
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
}
{
if (TEST_NEWLINE(msgstr) != has_newline)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
`msgid' and `msgstr' entries do not both end with '\\n'"));
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
}
nstrfmts = parse_printf_format (msgstr, 0, NULL);
if (nidfmts != nstrfmts)
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name, msgid_pos->line_number,
_("\
number of format specifications in `msgid' and `msgstr' does not match"));
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
else
for (cnt = 0; cnt < nidfmts; ++cnt)
if (id_args[cnt] != str_args[cnt])
{
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, msgid_pos->file_name,
msgid_pos->line_number, _("\
format specifications for argument %lu are not the same"),
(unsigned long) (cnt + 1));
- error_with_progname = 1;
+ error_with_progname = true;
exit_status = EXIT_FAILURE;
}
}
#ifdef EINTR
static inline int nonintr_close PARAMS ((int fd));
#endif
-static int is_string_selected PARAMS ((int grep_pass, const char *str,
- size_t len));
-static int is_message_selected PARAMS ((const message_ty *mp));
+static bool is_string_selected PARAMS ((int grep_pass, const char *str,
+ size_t len));
+static bool is_message_selected PARAMS ((const message_ty *mp));
static void process_message_list PARAMS ((const char *domain,
message_list_ty *mlp));
static msgdomain_list_ty *
char **argv;
{
int opt;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
char *output_file;
const char *input_file;
int grep_pass;
msgdomain_list_ty *result;
- int sort_by_filepos = 0;
- int sort_by_msgid = 0;
+ bool sort_by_filepos = false;
+ bool sort_by_msgid = false;
size_t i;
/* Set program name for messages. */
textdomain (PACKAGE);
/* Set default values for variables. */
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
output_file = NULL;
input_file = NULL;
grep_pass = -1;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
break;
case CHAR_MAX + 1:
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case CHAR_MAX + 2:
break;
case CHAR_MAX + 3:
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case CHAR_MAX + 4:
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case CHAR_MAX + 5:
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
default:
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
#endif
-/* Process a string STR of size LEN bytes through grep, and return nonzero
+/* Process a string STR of size LEN bytes through grep, and return true
if it matches. */
-static int
+static bool
is_string_selected (grep_pass, str, len)
int grep_pass;
const char *str;
}
-/* Return nonzero if a message matches. */
-static int
+/* Return true if a message matches. */
+static bool
is_message_selected (mp)
const message_ty *mp;
{
/* Always keep the header entry. */
if (mp->msgid[0] == '\0')
- return 1;
+ return true;
/* Test whether one of mp->filepos[] is selected. */
for (i = 0; i < mp->filepos_count; i++)
if (string_list_member (location_files, mp->filepos[i].file_name))
- return 1;
+ return true;
/* Test msgid and msgid_plural using the --msgid arguments. */
if (is_string_selected (0, mp->msgid, strlen (mp->msgid)))
- return 1;
+ return true;
if (mp->msgid_plural != NULL
&& is_string_selected (0, mp->msgid_plural, strlen (mp->msgid_plural)))
- return 1;
+ return true;
/* Test msgstr using the --msgstr arguments. */
msgstr = mp->msgstr;
size_t length = strlen (p);
if (is_string_selected (1, p, length))
- return 1;
+ return true;
p += length + 1;
}
- return 0;
+ return false;
}
{
const char *locale_code;
const char *canon_locale_code;
- int warned;
+ bool warned;
size_t j, k;
/* Check whether the locale encoding and the PO file's encoding are the
same. Otherwise emit a warning. */
locale_code = locale_charset ();
canon_locale_code = po_charset_canonicalize (locale_code);
- warned = 0;
+ warned = false;
for (k = 0; k < mdlp->nitems; k++)
{
const message_list_ty *mlp = mdlp->item[k]->messages;
for (j = 0; j < mlp->nitems; j++)
- if (mlp->item[j]->msgid[0] == '\0' && mlp->item[j]->obsolete == 0)
+ if (mlp->item[j]->msgid[0] == '\0' && !mlp->item[j]->obsolete)
{
const char *header = mlp->item[j]->msgstr;
then apply '%s',\n\
then convert back to %s using 'msgconv'.\n\
"), "UTF-8", "UTF-8", basename (program_name), canon_charset));
- warned = 1;
+ warned = true;
}
}
}
/* Search the header entry, and extract and replace the charset name. */
canon_from_code = NULL;
for (j = 0; j < mlp->nitems; j++)
- if (mlp->item[j]->msgid[0] == '\0' && mlp->item[j]->obsolete == 0)
+ if (mlp->item[j]->msgid[0] == '\0' && !mlp->item[j]->obsolete)
{
const char *header = mlp->item[j]->msgstr;
#define _(str) gettext (str)
-/* If non-zero do not print unneeded messages. */
-static int quiet;
+/* If true do not print unneeded messages. */
+static bool quiet;
/* Verbosity level. */
static int verbosity_level;
static int force_po;
/* Apply the .pot file to each of the domains in the PO file. */
-static int multi_domain_mode;
+static bool multi_domain_mode = false;
/* List of user-specified compendiums. */
static message_list_list_ty *compendiums;
char **argv;
{
int opt;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
char *output_file;
msgdomain_list_ty *result;
- int sort_by_filepos = 0;
- int sort_by_msgid = 0;
+ bool sort_by_filepos = false;
+ bool sort_by_msgid = false;
/* Set program name for messages. */
set_program_name (argv[0]);
error_print_progname = maybe_print_progname;
verbosity_level = 0;
- quiet = 0;
+ quiet = false;
gram_max_allowed_errors = UINT_MAX;
#ifdef HAVE_SETLOCALE
textdomain (PACKAGE);
/* Set default values for variables. */
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
output_file = NULL;
while ((opt
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 'm':
- multi_domain_mode = 1;
+ multi_domain_mode = true;
break;
case 'o':
break;
case 'q':
- quiet = 1;
+ quiet = true;
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
this merged entry to the output message list. */
mp = message_merge (defmsg, refmsg);
- mp->is_fuzzy = 1;
+ mp->is_fuzzy = true;
message_list_append (resultmlp, mp);
{
/* Remember the old translation although it is not used anymore.
But we mark it as obsolete. */
- defmsg->obsolete = 1;
+ defmsg->obsolete = true;
message_list_append (msgdomain_list_sublist (result, domain, 1),
defmsg);
char **argv;
{
int opt;
- int do_help;
- int do_version;
+ bool do_help;
+ bool do_version;
char *output_file;
const char *input_file;
msgdomain_list_ty *result;
- int sort_by_filepos = 0;
- int sort_by_msgid = 0;
+ bool sort_by_filepos = false;
+ bool sort_by_msgid = false;
size_t i;
/* Set program name for messages. */
textdomain (PACKAGE);
/* Set default values for variables. */
- do_help = 0;
- do_version = 0;
+ do_help = false;
+ do_version = false;
output_file = NULL;
input_file = NULL;
sed_args = string_list_alloc ();
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'f':
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
break;
case CHAR_MAX + 1:
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
default:
msgdomain_list_sort_by_msgid (result);
/* Write the merged message list out. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
exit (EXIT_SUCCESS);
}
char **argv;
{
int optchar;
- int do_help = 0;
- int do_version = 0;
+ bool do_help = false;
+ bool do_version = false;
const char *output_file = "-";
message_list_ty *mlp;
msgdomain_list_ty *result;
- int sort_by_msgid = 0;
+ bool sort_by_msgid = false;
/* Set program name for messages. */
set_program_name (argv[0]);
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
msgdomain_list_sort_by_msgid (result);
/* Write the resulting message list to the given .po file. */
- msgdomain_list_print (result, output_file, force_po, 0);
+ msgdomain_list_print (result, output_file, force_po, false);
/* No problems. */
exit (EXIT_SUCCESS);
#line 103 "po-gram-gen.y"
typedef union
{
- struct { char *string; lex_pos_ty pos; int obsolete; } string;
- struct { string_list_ty stringlist; lex_pos_ty pos; int obsolete; } stringlist;
- struct { long number; lex_pos_ty pos; int obsolete; } number;
- struct { lex_pos_ty pos; int obsolete; } pos;
- struct { struct msgstr_def rhs; lex_pos_ty pos; int obsolete; } rhs;
+ struct { char *string; lex_pos_ty pos; bool obsolete; } string;
+ struct { string_list_ty stringlist; lex_pos_ty pos; bool obsolete; } stringlist;
+ struct { long number; lex_pos_ty pos; bool obsolete; } number;
+ struct { lex_pos_ty pos; bool obsolete; } pos;
+ struct { struct msgstr_def rhs; lex_pos_ty pos; bool obsolete; } rhs;
} YYSTYPE;
#include <stdio.h>
typedef union
{
- struct { char *string; lex_pos_ty pos; int obsolete; } string;
- struct { string_list_ty stringlist; lex_pos_ty pos; int obsolete; } stringlist;
- struct { long number; lex_pos_ty pos; int obsolete; } number;
- struct { lex_pos_ty pos; int obsolete; } pos;
- struct { struct msgstr_def rhs; lex_pos_ty pos; int obsolete; } rhs;
+ struct { char *string; lex_pos_ty pos; bool obsolete; } string;
+ struct { string_list_ty stringlist; lex_pos_ty pos; bool obsolete; } stringlist;
+ struct { long number; lex_pos_ty pos; bool obsolete; } number;
+ struct { lex_pos_ty pos; bool obsolete; } pos;
+ struct { struct msgstr_def rhs; lex_pos_ty pos; bool obsolete; } rhs;
} YYSTYPE;
#define COMMENT 257
#define DOMAIN 258
%union
{
- struct { char *string; lex_pos_ty pos; int obsolete; } string;
- struct { string_list_ty stringlist; lex_pos_ty pos; int obsolete; } stringlist;
- struct { long number; lex_pos_ty pos; int obsolete; } number;
- struct { lex_pos_ty pos; int obsolete; } pos;
- struct { struct msgstr_def rhs; lex_pos_ty pos; int obsolete; } rhs;
+ struct { char *string; lex_pos_ty pos; bool obsolete; } string;
+ struct { string_list_ty stringlist; lex_pos_ty pos; bool obsolete; } stringlist;
+ struct { long number; lex_pos_ty pos; bool obsolete; } number;
+ struct { lex_pos_ty pos; bool obsolete; } pos;
+ struct { struct msgstr_def rhs; lex_pos_ty pos; bool obsolete; } rhs;
}
%type <string> STRING COMMENT NAME msgid_pluralform
static FILE *fp;
lex_pos_ty gram_pos;
unsigned int gram_max_allowed_errors = 20;
-static int po_lex_obsolete;
-static int pass_comments = 0;
-int pass_obsolete_entries = 0;
+static bool po_lex_obsolete;
+static bool pass_comments = false;
+bool pass_obsolete_entries = false;
/* Prototypes for local functions. Needed to ensure compiler checking of
_("error while opening \"%s\" for reading"), fname);
gram_pos.line_number = 1;
- po_lex_obsolete = 0;
+ po_lex_obsolete = false;
po_lex_charset_init ();
}
if (fp != stdin)
fclose (fp);
fp = NULL;
- gram_pos.file_name = 0;
+ gram_pos.file_name = NULL;
gram_pos.line_number = 0;
error_message_count = 0;
- po_lex_obsolete = 0;
+ po_lex_obsolete = false;
po_lex_charset_close ();
}
vasprintf (&buffer, fmt, ap);
va_end (ap);
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, gram_pos.file_name, gram_pos.line_number, "%s", buffer);
- error_with_progname = 1;
+ error_with_progname = true;
# else
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, gram_pos.file_name, gram_pos.line_number, fmt,
a1, a2, a3, a4, a5, a6, a7, a8);
- error_with_progname = 1;
+ error_with_progname = true;
# endif
/* Some messages need more than one line. Continuation lines are
vasprintf (&buffer, fmt, ap);
va_end (ap);
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, pp->file_name, pp->line_number, "%s", buffer);
- error_with_progname = 1;
+ error_with_progname = true;
# else
- error_with_progname = 0;
+ error_with_progname = false;
error_at_line (0, 0, pp->file_name, pp->line_number, fmt,
a1, a2, a3, a4, a5, a6, a7, a8);
- error_with_progname = 1;
+ error_with_progname = true;
# endif
/* Some messages need more than one line, or more than one location.
return 0;
case '\n':
- po_lex_obsolete = 0;
+ po_lex_obsolete = false;
break;
case ' ':
We simply discard the "#~" prefix. The following
characters are expected to be well formed. */
{
- po_lex_obsolete = 1;
+ po_lex_obsolete = true;
break;
}
po_gram_lval.string.string = buf;
po_gram_lval.string.pos = gram_pos;
po_gram_lval.string.obsolete = po_lex_obsolete;
- po_lex_obsolete = 0;
+ po_lex_obsolete = false;
return COMMENT;
}
else
is not very effective. */
while (c != EOF && c != '\n')
c = lex_getc ();
- po_lex_obsolete = 0;
+ po_lex_obsolete = false;
}
break;
/* po_gram_lex() can return comments as COMMENT. Switch this on or off. */
void
po_lex_pass_comments (flag)
- int flag;
+ bool flag;
{
- pass_comments = (flag != 0);
+ pass_comments = flag;
}
Switch this on or off. */
void
po_lex_pass_obsolete_entries (flag)
- int flag;
+ bool flag;
{
- pass_obsolete_entries = (flag != 0);
+ pass_obsolete_entries = flag;
}
#define _PO_LEX_H
#include <sys/types.h>
+#include <stdbool.h>
#include "error.h"
#include "progname.h"
#include "pos.h"
terminate. Cf. error_message_count, declared in <error.h>. */
extern unsigned int gram_max_allowed_errors;
-/* Nonzero if obsolete entries shall be considered as valid. */
-extern int pass_obsolete_entries;
+/* True if obsolete entries shall be considered as valid. */
+extern bool pass_obsolete_entries;
/* Open the PO file FNAME and prepare its lexical analysis. */
extern int po_gram_lex PARAMS ((void));
/* po_gram_lex() can return comments as COMMENT. Switch this on or off. */
-extern void po_lex_pass_comments PARAMS ((int flag));
+extern void po_lex_pass_comments PARAMS ((bool flag));
/* po_gram_lex() can return obsolete entries as if they were normal entries.
Switch this on or off. */
-extern void po_lex_pass_obsolete_entries PARAMS ((int flag));
+extern void po_lex_pass_obsolete_entries PARAMS ((bool flag));
/* ISO C 99 is smart enough to allow optimizations like this. */
# define po_gram_error(fmt, ...) \
do { \
- error_with_progname = 0; \
+ error_with_progname = false; \
error_at_line (0, 0, gram_pos.file_name, gram_pos.line_number, \
fmt, __VA_ARGS__); \
- error_with_progname = 1; \
+ error_with_progname = true; \
if (*fmt == '.') \
--error_message_count; \
else if (error_message_count >= gram_max_allowed_errors) \
# define po_gram_error_at_line(pos, fmt, ...) \
do { \
- error_with_progname = 0; \
+ error_with_progname = false; \
error_at_line (0, 0, (pos)->file_name, (pos)->line_number, \
fmt, __VA_ARGS__); \
- error_with_progname = 1; \
+ error_with_progname = true; \
if (*fmt == '.') \
--error_message_count; \
else if (error_message_count >= gram_max_allowed_errors) \
# define po_gram_error(fmt, args...) \
do { \
- error_with_progname = 0; \
+ error_with_progname = false; \
error_at_line (0, 0, gram_pos.file_name, gram_pos.line_number, \
fmt, ## args); \
- error_with_progname = 1; \
+ error_with_progname = true; \
if (*fmt == '.') \
--error_message_count; \
else if (error_message_count >= gram_max_allowed_errors) \
# define po_gram_error_at_line(pos, fmt, args...) \
do { \
- error_with_progname = 0; \
+ error_with_progname = false; \
error_at_line (0, 0, (pos)->file_name, (pos)->line_number, \
fmt, ## args); \
- error_with_progname = 1; \
+ error_with_progname = true; \
if (*fmt == '.') \
--error_message_count; \
else if (error_message_count >= gram_max_allowed_errors) \
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
static void po_comment PARAMS ((po_ty *pop, const char *s));
static void po_comment_dot PARAMS ((po_ty *pop, const char *s));
static void po_comment_filepos PARAMS ((po_ty *pop, const char *name,
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
if (pop->method->directive_message)
pop->method->directive_message (pop, msgid, msgid_pos, msgid_plural,
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
/* assert(callback_arg); */
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
/* This method is invoked before the parse, but after the file is
opened by the lexer. */
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
extern void po_callback_comment PARAMS ((const char *s));
extern void po_callback_comment_dot PARAMS ((const char *s));
extern void po_callback_comment_filepos PARAMS ((const char *s, int line));
string_list_ty *comment_dot;
/* Flags transported in special comments. */
- int is_fuzzy;
+ bool is_fuzzy;
enum is_c_format is_c_format;
enum is_wrap do_wrap;
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
static void readall_parse_brief PARAMS ((po_ty *that));
static void readall_comment PARAMS ((po_ty *that, const char *s));
static void readall_comment_dot PARAMS ((po_ty *that, const char *s));
this->comment_dot = NULL;
this->filepos_count = 0;
this->filepos = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
}
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
readall_class_ty *this = (readall_class_ty *) that;
message_ty *mp;
free (this->filepos);
this->filepos_count = 0;
this->filepos = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
}
readall_parse_brief (that)
po_ty *that;
{
- po_lex_pass_comments (1);
+ po_lex_pass_comments (true);
}
readall_class_ty *this = (readall_class_ty *) that;
if (strstr (s, "fuzzy") != NULL)
- this->is_fuzzy = 1;
+ this->is_fuzzy = true;
this->is_c_format = parse_c_format_description_string (s);
this->do_wrap = parse_c_width_description_string (s);
msgdomain_list_ty *mdlp;
pop = po_alloc (&readall_methods);
- po_lex_pass_obsolete_entries (1);
+ po_lex_pass_obsolete_entries (true);
po_scan (pop, filename);
mdlp = ((readall_class_ty *) pop)->mdlp;
po_free (pop);
/* Return 1 if s is contained in the list of strings, 0 otherwise. */
-int
+bool
string_list_member (slp, s)
const string_list_ty *slp;
const char *s;
for (j = 0; j < slp->nitems; ++j)
if (strcmp (slp->item[j], s) == 0)
- return 1;
- return 0;
+ return true;
+ return false;
}
/* Get size_t and NULL. */
#include <stddef.h>
+/* Get bool. */
+#include <stdbool.h>
+
/* Type describing list of immutable strings,
implemented using a dynamic array. */
typedef struct string_list_ty string_list_ty;
extern char *string_list_join PARAMS ((const string_list_ty *slp));
/* Return 1 if s is contained in the list of strings, 0 otherwise. */
-extern int string_list_member PARAMS ((const string_list_ty *slp,
- const char *s));
+extern bool string_list_member PARAMS ((const string_list_ty *slp,
+ const char *s));
#endif /* _STR_LIST_H */
/* Prototypes for local functions. Needed to ensure compiler checking of
function argument counts despite of K&R C function definition syntax. */
static const char *make_c_format_description_string PARAMS ((enum is_c_format,
- int debug));
+ bool debug));
static int significant_c_format_p PARAMS ((enum is_c_format is_c_format));
static const char *make_c_width_description_string PARAMS ((enum is_c_format));
static void wrap PARAMS ((FILE *fp, const char *line_prefix, const char *name,
const char *charset));
static void print_blank_line PARAMS ((FILE *fp));
static void message_print PARAMS ((const message_ty *mp, FILE *fp,
- const char *charset, int blank_line,
- int debug));
+ const char *charset, bool blank_line,
+ bool debug));
static void message_print_obsolete PARAMS ((const message_ty *mp, FILE *fp,
const char *charset,
- int blank_line));
+ bool blank_line));
static int msgid_cmp PARAMS ((const void *va, const void *vb));
static int filepos_cmp PARAMS ((const void *va, const void *vb));
/* These three variables control the output style of the message_print
function. Interface functions for them are to be used. */
-static int indent;
-static int uniforum;
-static int escape;
+static bool indent = false;
+static bool uniforum = false;
+static bool escape = false;
void
message_print_style_indent ()
{
- indent = 1;
+ indent = true;
}
void
message_print_style_uniforum ()
{
- uniforum = 1;
+ uniforum = true;
}
void
message_print_style_escape (flag)
- int flag;
+ bool flag;
{
- escape = (flag != 0);
+ escape = flag;
}
static const char *
make_c_format_description_string (is_c_format, debug)
enum is_c_format is_c_format;
- int debug;
+ bool debug;
{
const char *result = NULL;
const char *charset;
{
const char *s;
- int first_line;
+ bool first_line;
#if HAVE_ICONV
const char *envval;
iconv_t conv;
/* Loop over the '\n' delimited portions of value. */
s = value;
- first_line = 1;
+ first_line = true;
do
{
/* The \a and \v escapes were added by the ANSI C Standard.
fputs (line_prefix, fp);
fputs (name, fp);
fputs (" \"\"\n", fp);
- first_line = 0;
+ first_line = false;
/* Recompute startcol and linebreaks. */
goto recompute;
}
{
fputs (name, fp);
putc (indent ? '\t' : ' ', fp);
- first_line = 0;
+ first_line = false;
}
else
{
const message_ty *mp;
FILE *fp;
const char *charset;
- int blank_line;
- int debug;
+ bool blank_line;
+ bool debug;
{
size_t j;
|| significant_c_format_p (mp->is_c_format)
|| mp->do_wrap == no)
{
- int first_flag = 1;
+ bool first_flag = true;
putc ('#', fp);
putc (',', fp);
if (mp->is_fuzzy && mp->msgstr[0] != '\0')
{
fputs (" fuzzy", fp);
- first_flag = 0;
+ first_flag = false;
}
if (significant_c_format_p (mp->is_c_format))
fputs (make_c_format_description_string (mp->is_c_format, debug),
fp);
- first_flag = 0;
+ first_flag = false;
}
if (mp->do_wrap == no)
putc (',', fp);
fputs (make_c_width_description_string (mp->do_wrap), fp);
- first_flag = 0;
+ first_flag = false;
}
putc ('\n', fp);
const message_ty *mp;
FILE *fp;
const char *charset;
- int blank_line;
+ bool blank_line;
{
size_t j;
/* Print flag information in special comment. */
if (mp->is_fuzzy)
{
- int first = 1;
+ bool first = true;
putc ('#', fp);
putc (',', fp);
if (mp->is_fuzzy)
{
fputs (" fuzzy", fp);
- first = 0;
+ first = false;
}
putc ('\n', fp);
msgdomain_list_print (mdlp, filename, force, debug)
msgdomain_list_ty *mdlp;
const char *filename;
- int force;
- int debug;
+ bool force;
+ bool debug;
{
FILE *fp;
size_t j, k;
- int blank_line;
+ bool blank_line;
/* We will not write anything if, for every domain, we have no message
or only the header entry. */
if (!force)
{
- int found_nonempty = 0;
+ bool found_nonempty = false;
for (k = 0; k < mdlp->nitems; k++)
{
if (!(mlp->nitems == 0
|| (mlp->nitems == 1 && mlp->item[0]->msgid[0] == '\0')))
{
- found_nonempty = 1;
+ found_nonempty = true;
break;
}
}
}
/* Write out the messages for each domain. */
- blank_line = 0;
+ blank_line = false;
for (k = 0; k < mdlp->nitems; k++)
{
message_list_ty *mlp;
if (blank_line)
print_blank_line (fp);
fprintf (fp, "domain \"%s\"\n", mdlp->item[k]->domain);
- blank_line = 1;
+ blank_line = true;
}
mlp = mdlp->item[k]->messages;
/* Search the header entry. */
header = NULL;
for (j = 0; j < mlp->nitems; ++j)
- if (mlp->item[j]->msgid[0] == '\0' && mlp->item[j]->obsolete == 0)
+ if (mlp->item[j]->msgid[0] == '\0' && !mlp->item[j]->obsolete)
{
header = mlp->item[j]->msgstr;
break;
/* Write out each of the messages for this domain. */
for (j = 0; j < mlp->nitems; ++j)
- if (mlp->item[j]->obsolete == 0)
+ if (!mlp->item[j]->obsolete)
{
message_print (mlp->item[j], fp, charset, blank_line, debug);
- blank_line = 1;
+ blank_line = true;
}
/* Write out each of the obsolete messages for this domain. */
for (j = 0; j < mlp->nitems; ++j)
- if (mlp->item[j]->obsolete != 0)
+ if (mlp->item[j]->obsolete)
{
message_print_obsolete (mlp->item[j], fp, charset, blank_line);
- blank_line = 1;
+ blank_line = true;
}
}
extern void
message_print_style_uniforum PARAMS ((void));
extern void
- message_print_style_escape PARAMS ((int flag));
+ message_print_style_escape PARAMS ((bool flag));
extern void
msgdomain_list_print PARAMS ((msgdomain_list_ty *mdlp,
const char *filename,
- int force, int debug));
+ bool force, bool debug));
extern void
msgdomain_list_sort_by_msgid PARAMS ((msgdomain_list_ty *mdlp));
extern void
static char *logical_file_name;
static int line_number;
static FILE *fp;
-static int trigraphs;
+static bool trigraphs = false;
static string_list_ty *comment;
static hash_table keywords;
-static int default_keywords = 1;
+static bool default_keywords = true;
/* These are for tracking whether comments count as immediately before
keyword. */
*tp = phase5_pushback[--phase5_pushback_length];
return;
}
- tp->string = 0;
+ tp->string = NULL;
tp->number = 0;
tp->line_number = line_number;
c = phase4_getc ();
c = phase7_getc ();
if (c == P7_NEWLINE)
{
- error_with_progname = 0;
+ error_with_progname = false;
error (0, 0, _("%s:%d: warning: unterminated character constant"),
logical_file_name, line_number - 1);
- error_with_progname = 1;
+ error_with_progname = true;
phase7_ungetc ('\n');
break;
}
c = phase7_getc ();
if (c == P7_NEWLINE)
{
- error_with_progname = 0;
+ error_with_progname = false;
error (0, 0, _("%s:%d: warning: unterminated string literal"),
logical_file_name, line_number - 1);
- error_with_progname = 1;
+ error_with_progname = true;
phase7_ungetc ('\n');
break;
}
phaseX_get (tp)
token_ty *tp;
{
- static int middle; /* 0 at the beginning of a line, 1 otherwise. */
+ static bool middle; /* false at the beginning of a line, true otherwise. */
phase5_get (tp);
if (tp->type == token_type_eoln || tp->type == token_type_eof)
- middle = 0;
+ middle = false;
else
{
if (middle)
else
phase5_unget (&next);
}
- middle = 1;
+ middle = true;
}
}
}
xgettext_lex_keyword ("dngettext:2,3");
xgettext_lex_keyword ("dcngettext:2,3");
xgettext_lex_keyword ("gettext_noop");
- default_keywords = 0;
+ default_keywords = false;
}
if (find_entry (&keywords, token.string, strlen (token.string) + 1,
const char *name;
{
if (name == NULL)
- default_keywords = 0;
+ default_keywords = false;
else
{
int argnum1;
}
-int
+bool
xgettext_any_keywords ()
{
return (keywords.filled > 0) || default_keywords;
void
xgettext_lex_trigraphs ()
{
- trigraphs = 1;
+ trigraphs = true;
}
void xgettext_lex_comment_reset PARAMS ((void));
/* void xgettext_lex_filepos PARAMS ((char **, int *)); FIXME needed? */
void xgettext_lex_keyword PARAMS ((const char *name));
-int xgettext_any_keywords PARAMS ((void));
+bool xgettext_any_keywords PARAMS ((void));
void xgettext_lex_trigraphs PARAMS ((void));
#endif /* _XGET_LEX_H */
/* If nonzero add all comments immediately preceding one of the keywords. */
-static int add_all_comments;
+static bool add_all_comments = false;
/* If nonzero add comments for file name and line number for each msgid. */
static int line_comment;
/* Content of .po files with symbols to be excluded. */
static message_list_ty *exclude;
-/* If nonzero extract all strings. */
-static int extract_all;
+/* If true extract all strings. */
+static bool extract_all = false;
/* Force output of PO file even if empty. */
static int force_po;
{ "directory", required_argument, NULL, 'D' },
{ "escape", no_argument, NULL, 'E' },
{ "exclude-file", required_argument, NULL, 'x' },
- { "extract-all", no_argument, &extract_all, 1 },
+ { "extract-all", no_argument, NULL, 'a' },
{ "files-from", required_argument, NULL, 'f' },
{ "force-po", no_argument, &force_po, 1 },
{ "foreign-user", no_argument, &foreign_user, 1 },
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
static void read_exclusion_file PARAMS ((char *file_name));
static message_ty *remember_a_message PARAMS ((message_list_ty *mlp,
xgettext_token_ty *tp));
char *msgid_plural,
char *msgstr, size_t msgstr_len,
lex_pos_ty *msgstr_pos,
- int obsolete));
+ bool obsolete));
static void extract_parse_brief PARAMS ((po_ty *that));
static void extract_comment PARAMS ((po_ty *that, const char *s));
static void extract_comment_dot PARAMS ((po_ty *that, const char *s));
{
int cnt;
int optchar;
- int do_help = 0;
- int do_version = 0;
+ bool do_help = false;
+ bool do_version = false;
msgdomain_list_ty *mdlp;
- int join_existing = 0;
- int sort_by_msgid = 0;
- int sort_by_filepos = 0;
+ bool join_existing = false;
+ bool sort_by_msgid = false;
+ bool sort_by_filepos = false;
const char *file_name;
const char *files_from = NULL;
string_list_ty *file_list;
case '\0': /* Long option. */
break;
case 'a':
- extract_all = 1;
+ extract_all = true;
break;
case 'c':
if (optarg == NULL)
{
- add_all_comments = 1;
+ add_all_comments = true;
comment_tag = NULL;
}
else
{
- add_all_comments = 0;
+ add_all_comments = false;
comment_tag = optarg;
/* We ignore leading white space. */
while (isspace (*comment_tag))
dir_list_append (optarg);
break;
case 'e':
- message_print_style_escape (0);
+ message_print_style_escape (false);
break;
case 'E':
- message_print_style_escape (1);
+ message_print_style_escape (true);
break;
case 'f':
files_from = optarg;
break;
case 'F':
- sort_by_filepos = 1;
+ sort_by_filepos = true;
break;
case 'h':
- do_help = 1;
+ do_help = true;
break;
case 'i':
message_print_style_indent ();
break;
case 'j':
- join_existing = 1;
+ join_existing = true;
break;
case 'k':
if (optarg == NULL || *optarg != '\0')
}
break;
case 's':
- sort_by_msgid = 1;
+ sort_by_msgid = true;
break;
case 'S':
message_print_style_uniforum ();
xgettext_lex_trigraphs ();
break;
case 'V':
- do_version = 1;
+ do_version = true;
break;
case 'w':
{
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
message_ty *mp;
{
if (commas_to_skip == 0)
{
- error_with_progname = 0;
+ error_with_progname = false;
error (0, 0,
_("%s:%d: warning: keyword nested in keyword arg"),
token.file_name, token.line_number);
- error_with_progname = 1;
+ error_with_progname = true;
continue;
}
potentially unbounded stack. We haven't run across an
example that needs this functionality yet. For now,
we punt and forget the outer keyword. */
- error_with_progname = 0;
+ error_with_progname = false;
error (0, 0,
_("%s:%d: warning: keyword between outer keyword and its arg"),
token.file_name, token.line_number);
- error_with_progname = 1;
+ error_with_progname = true;
}
commas_to_skip = token.argnum1 - 1;
plural_commas = (token.argnum2 > token.argnum1
string_list_ty *comment;
string_list_ty *comment_dot;
- int is_fuzzy;
+ bool is_fuzzy;
enum is_c_format is_c_format;
enum is_wrap do_wrap;
- int filepos_count;
+ size_t filepos_count;
lex_pos_ty *filepos;
};
this->mlp = NULL; /* actually set in read_po_file, below */
this->comment = NULL;
this->comment_dot = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
this->filepos_count = 0;
char *msgstr;
size_t msgstr_len;
lex_pos_ty *msgstr_pos;
- int obsolete;
+ bool obsolete;
{
extract_class_ty *this = (extract_class_ty *)that;
message_ty *mp;
this->comment_dot = NULL;
this->filepos_count = 0;
this->filepos = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
return;
free (this->filepos);
this->filepos_count = 0;
this->filepos = NULL;
- this->is_fuzzy = 0;
+ this->is_fuzzy = false;
this->is_c_format = undecided;
this->do_wrap = undecided;
}
extract_parse_brief (that)
po_ty *that;
{
- po_lex_pass_comments (1);
+ po_lex_pass_comments (true);
}
extract_class_ty *this = (extract_class_ty *) that;
if (strstr (s, "fuzzy") != NULL)
- this->is_fuzzy = 1;
+ this->is_fuzzy = true;
this->is_c_format = parse_c_format_description_string (s);
this->do_wrap = parse_c_width_description_string (s);
}
Copyright (C) YEAR Free Software Foundation, Inc.\n\
FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n");
- mp->is_fuzzy = 1;
+ mp->is_fuzzy = true;
return mp;
}