more exception handling.

This commit is contained in:
Vitor Santos Costa
2018-04-16 14:54:53 +01:00
parent df961cbd62
commit abb328abf0
15 changed files with 262 additions and 283 deletions

View File

@@ -735,21 +735,21 @@ static size_t write_length(const unsigned char *s0, seq_tv_t *out USES_REGS) {
static Term write_number(unsigned char *s, seq_tv_t *out,
bool error_on USES_REGS) {
Term t;
yap_error_descriptor_t new_error;
yap_error_descriptor_t new_error;
int i = push_text_stack();
Yap_pushErrorContext(&new_error);
bool new_rec = Yap_pushErrorContext(true,&new_error);
t = Yap_StringToNumberTerm((char *)s, &out->enc,true);
pop_text_stack(i);
Yap_popErrorContext(error_on);
Yap_popErrorContext(new_rec , true);
return t;
}
static Term string_to_term(void *s, seq_tv_t *out USES_REGS) {
Term o;
yap_error_descriptor_t new_error;
Yap_pushErrorContext(&new_error);
yap_error_descriptor_t new_error;
bool mdnew = Yap_pushErrorContext(true, &new_error);
o = out->val.t = Yap_BufferToTerm(s, TermNil);
Yap_popErrorContext(true);
Yap_popErrorContext(mdnew, true);
return o;
}