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
Update of i18n.
[gedcom-parse.git]
/
gedcom
/
gedcom.y
diff --git
a/gedcom/gedcom.y
b/gedcom/gedcom.y
index 395db23646f78b877c851977832f9e86ad3a25f3..702d1256dcba2c8f921ce3074776e0bc1f2c91d0 100644
(file)
--- a/
gedcom/gedcom.y
+++ b/
gedcom/gedcom.y
@@
-157,13
+157,14
@@
int gedcom_high_level_debug = 0;
Gedcom_err_mech error_mechanism = IMMED_FAIL;
Gedcom_val_struct val1;
Gedcom_val_struct val2;
Gedcom_err_mech error_mechanism = IMMED_FAIL;
Gedcom_val_struct val1;
Gedcom_val_struct val2;
-
-char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1];
-char *line_item_buf_ptr;
-void cleanup_concat_buffer();
-struct safe_buffer concat_buffer = { NULL, 0, cleanup_concat_buffer };
+void cleanup_line_item_buffer();
+struct safe_buffer line_item_buffer = { NULL, 0, NULL, 0,
+ cleanup_line_item_buffer };
+void cleanup_concat_buffer();
+struct safe_buffer concat_buffer = { NULL, 0, NULL, 0, cleanup_concat_buffer };
+
/* These are defined at the bottom of the file */
void push_countarray(int level);
void set_parenttag(const char* tag);
/* These are defined at the bottom of the file */
void push_countarray(int level);
void set_parenttag(const char* tag);
@@
-175,9
+176,6
@@
int count_tag(int tag);
int check_occurrence(int tag);
void clean_up();
int check_occurrence(int tag);
void clean_up();
-#define CLEAR_BUFFER(BUF) \
- memset(BUF, 0, sizeof(BUF));
-
#define HANDLE_ERROR \
{ if (error_mechanism == IMMED_FAIL) { \
clean_up(); YYABORT; \
#define HANDLE_ERROR \
{ if (error_mechanism == IMMED_FAIL) { \
clean_up(); YYABORT; \
@@
-1331,7
+1329,6
@@
obje_blob_sect : OPEN DELIM TAG_BLOB
PARENT, $1, $3, NULL,
GEDCOM_MAKE_NULL(val1));
reset_buffer(&concat_buffer);
PARENT, $1, $3, NULL,
GEDCOM_MAKE_NULL(val1));
reset_buffer(&concat_buffer);
- safe_buf_append(&concat_buffer, "");
START(BLOB, $1, $<ctxt>$)
}
obje_blob_subs
START(BLOB, $1, $<ctxt>$)
}
obje_blob_subs
@@
-1994,7
+1991,7
@@
addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
{ $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
PARENT, $1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
{ $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
PARENT, $1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
-
safe_buf_append(&concat_buffer, "\n"
);
+
SAFE_BUF_ADDCHAR(&concat_buffer, '\n'
);
safe_buf_append(&concat_buffer, $4);
START(CONT, $1, $<ctxt>$)
}
safe_buf_append(&concat_buffer, $4);
START(CONT, $1, $<ctxt>$)
}
@@
-2272,7
+2269,7
@@
cont_sect : OPEN DELIM TAG_CONT mand_line_item
{ $<ctxt>$ = start_element(ELT_SUB_CONT,
PARENT, $1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
{ $<ctxt>$ = start_element(ELT_SUB_CONT,
PARENT, $1, $3, $4,
GEDCOM_MAKE_STRING(val1, $4));
-
safe_buf_append(&concat_buffer, "\n"
);
+
SAFE_BUF_ADDCHAR(&concat_buffer, '\n'
);
safe_buf_append(&concat_buffer, $4);
START(CONT, $1, $<ctxt>$)
}
safe_buf_append(&concat_buffer, $4);
START(CONT, $1, $<ctxt>$)
}
@@
-3717,38
+3714,36
@@
opt_line_item : /* empty */ { $$ = NULL; }
;
line_item : anychar { size_t i;
;
line_item : anychar { size_t i;
- CLEAR_BUFFER(line_item_buf);
- line_item_buf_ptr = line_item_buf;
- /* The following also takes care of '@@' */
+ reset_buffer(&line_item_buffer);
+ /* The following also takes care of '@@' */
if (!strncmp($1, "@@", 3))
if (!strncmp($1, "@@", 3))
- *line_item_buf_ptr++ = '@';
+ SAFE_BUF_ADDCHAR(&line_item_buffer, '@')
else
for (i=0; i < strlen($1); i++)
else
for (i=0; i < strlen($1); i++)
- *line_item_buf_ptr++ = $1[i];
- $$ =
line_item_buf
;
+ SAFE_BUF_ADDCHAR(&line_item_buffer, $1[i])
+ $$ =
get_buf_string(&line_item_buffer)
;
}
| ESCAPE { size_t i;
}
| ESCAPE { size_t i;
- CLEAR_BUFFER(line_item_buf);
- line_item_buf_ptr = line_item_buf;
- for (i=0; i < strlen($1); i++)
- *line_item_buf_ptr++ = $1[i];
- $$ = line_item_buf;
+ reset_buffer(&line_item_buffer);
+ for (i=0; i < strlen($1); i++)
+ SAFE_BUF_ADDCHAR(&line_item_buffer, $1[i])
+ $$ = get_buf_string(&line_item_buffer);
}
| line_item anychar
{ size_t i;
/* The following also takes care of '@@' */
if (!strncmp($2, "@@", 3))
}
| line_item anychar
{ size_t i;
/* The following also takes care of '@@' */
if (!strncmp($2, "@@", 3))
- *line_item_buf_ptr++ = '@';
+ SAFE_BUF_ADDCHAR(&line_item_buffer, '@')
else
for (i=0; i < strlen($2); i++)
else
for (i=0; i < strlen($2); i++)
- *line_item_buf_ptr++ = $2[i];
- $$ =
line_item_buf
;
+ SAFE_BUF_ADDCHAR(&line_item_buffer, $2[i])
+ $$ =
get_buf_string(&line_item_buffer)
;
}
| line_item ESCAPE
{ size_t i;
for (i=0; i < strlen($2); i++)
}
| line_item ESCAPE
{ size_t i;
for (i=0; i < strlen($2); i++)
- *line_item_buf_ptr++ = $2[i];
- $$ =
line_item_buf
;
+ SAFE_BUF_ADDCHAR(&line_item_buffer, $2[i])
+ $$ =
get_buf_string(&line_item_buffer)
;
}
| line_item error anychar { HANDLE_ERROR; }
| line_item error ESCAPE { HANDLE_ERROR; }
}
| line_item error anychar { HANDLE_ERROR; }
| line_item error ESCAPE { HANDLE_ERROR; }
@@
-4029,6
+4024,11
@@
void cleanup_concat_buffer()
cleanup_buffer(&concat_buffer);
}
cleanup_buffer(&concat_buffer);
}
+void cleanup_line_item_buffer()
+{
+ cleanup_buffer(&line_item_buffer);
+}
+
/* Enabling debug mode */
/* level 0: no debugging */
/* level 1: only internal */
/* Enabling debug mode */
/* level 0: no debugging */
/* level 1: only internal */