dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
gedcom-parse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Template file for 0.11.
[gedcom-parse.git]
/
gedcom
/
gedcom_lex_common.c
diff --git
a/gedcom/gedcom_lex_common.c
b/gedcom/gedcom_lex_common.c
index f9fa955d5216a3240377ba3b39625d7038963bce..e1c17bb78b12dfb89b510a086d4cdc5d1282d7f4 100644
(file)
--- a/
gedcom/gedcom_lex_common.c
+++ b/
gedcom/gedcom_lex_common.c
@@
-46,11
+46,17
@@
int line_no = 1;
int gedcom_lex();
int gedcom_lex();
+void message_handler(Gedcom_msg_type type, char *msg)
+{
+ fprintf(stderr, msg);
+}
+
int test_loop(ENCODING enc, char* code)
{
int tok, res;
init_encodings();
set_encoding_width(enc);
int test_loop(ENCODING enc, char* code)
{
int tok, res;
init_encodings();
set_encoding_width(enc);
+ gedcom_set_message_handler(message_handler);
res = open_conv_to_internal(code);
if (!res) {
gedcom_error("Unable to open conversion context: %s",
res = open_conv_to_internal(code);
if (!res) {
gedcom_error("Unable to open conversion context: %s",
@@
-91,7
+97,7
@@
int test_loop(ENCODING enc, char* code)
{ if (line_len != (size_t)-1) { \
line_len += strlen(yytext); \
if (line_len > MAXGEDCLINELEN * encoding_width) { \
{ if (line_len != (size_t)-1) { \
line_len += strlen(yytext); \
if (line_len > MAXGEDCLINELEN * encoding_width) { \
- gedcom_error(
"Line too long, max %d characters",
\
+ gedcom_error(
_("Line too long, max %d characters allowed"),
\
MAXGEDCLINELEN); \
line_len = (size_t)-1; \
return BADTOKEN; \
MAXGEDCLINELEN); \
line_len = (size_t)-1; \
return BADTOKEN; \
@@
-164,7
+170,7
@@
int test_loop(ENCODING enc, char* code)
#define ACTION_0_DIGITS \
#define ACTION_0_DIGITS \
- { gedcom_error (
"Level number with leading zero");
\
+ { gedcom_error (
_("Level number with leading zero not allowed"));
\
return BADTOKEN; \
}
return BADTOKEN; \
}
@@
-173,7
+179,7
@@
int test_loop(ENCODING enc, char* code)
{ int level = atoi(TO_INTERNAL(yytext, str_buf)); \
CHECK_LINE_LEN; \
if ((level < 0) || (level > MAXGEDCLEVEL)) { \
{ int level = atoi(TO_INTERNAL(yytext, str_buf)); \
CHECK_LINE_LEN; \
if ((level < 0) || (level > MAXGEDCLEVEL)) { \
- gedcom_error (
"Level number out of range [0..%d]",
\
+ gedcom_error (
_("Level number out of range [0..%d]"),
\
MAXGEDCLEVEL); \
return BADTOKEN; \
} \
MAXGEDCLEVEL); \
return BADTOKEN; \
} \
@@
-191,8
+197,7
@@
int test_loop(ENCODING enc, char* code)
} \
else { \
/* should never happen (error to GEDCOM spec) */ \
} \
else { \
/* should never happen (error to GEDCOM spec) */ \
- gedcom_error ("GEDCOM level number is %d higher than " \
- "previous", \
+ gedcom_error (_("GEDCOM level number is %d higher than previous"), \
level_diff); \
return BADTOKEN; \
} \
level_diff); \
return BADTOKEN; \
} \
@@
-201,7
+206,7
@@
int test_loop(ENCODING enc, char* code)
#define ACTION_ALPHANUM \
{ if (strlen(yytext) > MAXGEDCTAGLEN * encoding_width) { \
#define ACTION_ALPHANUM \
{ if (strlen(yytext) > MAXGEDCTAGLEN * encoding_width) { \
- gedcom_error(
"Tag '%s' too long, max %d characters",
\
+ gedcom_error(
_("Tag '%s' too long, max %d characters allowed"),
\
yytext, MAXGEDCTAGLEN); \
return BADTOKEN; \
} \
yytext, MAXGEDCTAGLEN); \
return BADTOKEN; \
} \
@@
-243,7
+248,7
@@
int test_loop(ENCODING enc, char* code)
#define ACTION_POINTER \
{ CHECK_LINE_LEN; \
if (strlen(yytext) > MAXGEDCPTRLEN * encoding_width) { \
#define ACTION_POINTER \
{ CHECK_LINE_LEN; \
if (strlen(yytext) > MAXGEDCPTRLEN * encoding_width) { \
- gedcom_error(
"Pointer '%s' too long, max %d characters",
\
+ gedcom_error(
_("Pointer '%s' too long, max %d characters allowed"),
\
yytext, MAXGEDCPTRLEN); \
return BADTOKEN; \
} \
yytext, MAXGEDCPTRLEN); \
return BADTOKEN; \
} \
@@
-287,7
+292,7
@@
int test_loop(ENCODING enc, char* code)
#define ACTION_UNEXPECTED \
#define ACTION_UNEXPECTED \
- { gedcom_error(
"Unexpected character: '%s' (0x%02x)",
\
+ { gedcom_error(
_("Unexpected character: '%s' (0x%02x)"),
\
yytext, yytext[0]); \
return BADTOKEN; \
}
yytext, yytext[0]); \
return BADTOKEN; \
}