-/* 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. *
-
- (C) 2001 by The Genes Development Team
- Original author: Peter Verthez (Peter.Verthez@advalvas.be)
-*/
+/* Parser for Gedcom.
+ Copyright (C) 2001 The Genes Development Team
+ This file is part of the Gedcom parser library.
+ Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
+
+ The Gedcom parser library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The Gedcom parser library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the Gedcom parser library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
/* $Id$ */
/* $Name$ */
#define CHK(TAG) \
{ if (!check_occurrence(TAG_##TAG)) { \
char* parenttag = get_parenttag(); \
- gedcom_error("The tag '%s' is mandatory within '%s', but missing", \
+ gedcom_error(_("The tag '%s' is mandatory within '%s', but missing"),\
#TAG, parenttag); \
HANDLE_ERROR; \
} \
{ int num = count_tag(TAG_##CHILDTAG); \
if (num > MAX) { \
char* parenttag = get_parenttag(); \
- gedcom_error("The tag '%s' can maximally occur %d " \
- "time(s) within '%s'", \
+ gedcom_error(_("The tag '%s' can maximally occur %d time(s) within '%s'"), \
#CHILDTAG, MAX, parenttag); \
HANDLE_ERROR; \
} \
}
#define INVALID_TAG(CHILDTAG) \
{ char* parenttag = get_parenttag(); \
- gedcom_error("The tag '%s' is not a valid tag within '%s'", \
+ gedcom_error(_("The tag '%s' is not a valid tag within '%s'"), \
CHILDTAG, parenttag); \
HANDLE_ERROR; \
}
#define INVALID_TOP_TAG(CHILDTAG) \
- { gedcom_error("The tag '%s' is not a valid top-level tag", \
+ { gedcom_error(_("The tag '%s' is not a valid top-level tag"), \
CHILDTAG); \
HANDLE_ERROR; \
}
note_line_item : /* empty */
{ if (!compat_mode(C_FTREE)) {
- gedcom_error("Missing value"); YYERROR;
+ gedcom_error(_("Missing value")); YYERROR;
}
}
| DELIM line_item
- { gedcom_debug_print("==Val: %s==\n", $2);
+ { gedcom_debug_print("==Val: %s==", $2);
$$ = $2; }
;
user_rec : OPEN DELIM opt_xref USERTAG
{ if ($4[0] != '_') {
- gedcom_error("Undefined tag (and not a valid user tag): %s",
+ gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
$4);
YYERROR;
}
;
user_sect : OPEN DELIM opt_xref USERTAG
{ if ($4[0] != '_') {
- gedcom_error("Undefined tag (and not a valid user tag): %s",
+ gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
$4);
YYERROR;
}
| line_item { $$ = $1; }
;
-mand_pointer : /* empty */ { gedcom_error("Missing pointer"); YYERROR; }
- | DELIM POINTER { gedcom_debug_print("==Ptr: %s==\n", $2);
- $$ = $2; }
+mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; }
+ | DELIM POINTER { gedcom_debug_print("==Ptr: %s==", $2);
+ $$ = $2; }
;
-mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; }
- | DELIM line_item { gedcom_debug_print("==Val: %s==\n", $2);
- $$ = $2; }
+mand_line_item : /* empty */ { gedcom_error(_("Missing value")); YYERROR; }
+ | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
+ $$ = $2; }
;
opt_line_item : /* empty */ { }
;
gen_rec_top : OPEN DELIM anytoptag
- { gedcom_error("Missing cross-reference"); YYERROR; }
+ { gedcom_error(_("Missing cross-reference")); YYERROR; }
opt_value opt_sects CLOSE
{ }
;
{
int *count = NULL;
if (count_level > MAXGEDCLEVEL) {
- gedcom_error("Internal error: count array overflow");
+ gedcom_error(_("Internal error: count array overflow"));
exit(1);
}
else {
count = (int *)calloc(YYNTOKENS, sizeof(int));
if (count == NULL) {
- gedcom_error("Internal error: count array calloc error");
+ gedcom_error(_("Internal error: count array calloc error"));
exit(1);
}
else {
{
int *count;
if (count_level < 0) {
- gedcom_error("Internal error: count array underflow");
+ gedcom_error(_("Internal error: count array underflow"));
exit(1);
}
else {
int gedcom_debug_print(char* s, ...)
{
- int res;
+ int res = 0;
if (gedcom_high_level_debug) {
va_list ap;
va_start(ap, s);
res = vfprintf(trace_output, s, ap);
va_end(ap);
+ fprintf(trace_output, "\n");
}
return(res);
}
void set_compatibility(char* program)
{
if (compat_enabled) {
- gedcom_debug_print("==== Program: %s\n", program);
if (! strncmp(program, "ftree", 6)) {
- gedcom_warning("Enabling compatibility with 'ftree'");
+ gedcom_warning(_("Enabling compatibility with 'ftree'"));
compatibility = C_FTREE;
}
else {