From f79d79e926e89b151a162dc27d50381e1e757d46 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 22 May 2009 21:51:48 -0500 Subject: [PATCH] replace TYPE_ERROR_VARIABLE for attributes #57 --- C/attvar.c | 26 +++++++++++++------------- C/errors.c | 6 +++--- C/exec.c | 4 ++-- H/Yap.h | 1 + pl/messages.yap | 2 ++ 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/C/attvar.c b/C/attvar.c index e8edf0106..bca0a643c 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -482,8 +482,8 @@ p_put_att(void) { PutAtt(IntegerOfTerm(Deref(ARG4)), tatts, Deref(ARG5)); return TRUE; } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"put_attributes/2"); - return(FALSE); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of put_attributes/2"); + return FALSE; } } @@ -516,7 +516,7 @@ p_put_att_term(void) { } return TRUE; } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"put_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of put_att_term/2"); return(FALSE); } } @@ -561,7 +561,7 @@ p_rm_att(void) { } return TRUE; } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"put_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of rm_att/2"); return(FALSE); } } @@ -599,7 +599,7 @@ p_put_atts(void) { } return TRUE; } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"put_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of put_att/2"); return FALSE; } } @@ -655,7 +655,7 @@ p_get_att(void) { return FALSE; } } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"put_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of get_att/2"); return(FALSE); } } @@ -682,7 +682,7 @@ p_free_att(void) { return TRUE; } } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"put_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of free_att/2"); return(FALSE); } } @@ -723,7 +723,7 @@ p_get_atts(void) { return FALSE; } } else { - // Yap_Error(TYPE_ERROR_VARIABLE,inp,"get_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of get_att/2"); return(FALSE); } } @@ -747,7 +747,7 @@ p_has_atts(void) { return FALSE; } } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"has_attributes/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of has_atts/2"); return(FALSE); } } @@ -764,7 +764,7 @@ p_bind_attvar(void) { } return(TRUE); } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"bind_att/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of bind_attvar/2"); return(FALSE); } } @@ -781,7 +781,7 @@ p_get_all_atts(void) { } return TRUE; } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"get_att/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of get_all_atts/2"); return FALSE; } } @@ -829,7 +829,7 @@ p_modules_with_atts(void) { } return Yap_unify(ARG2,TermNil); } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"get_att/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of modules_with_attributes/2"); return FALSE; } } @@ -869,7 +869,7 @@ p_swi_all_atts(void) { } return Yap_unify(ARG2,TermNil); } else { - Yap_Error(TYPE_ERROR_VARIABLE,inp,"get_att/2"); + Yap_Error(REPRESENTATION_ERROR_VARIABLE,inp,"first argument of get_all_swi_atts/2"); return FALSE; } } diff --git a/C/errors.c b/C/errors.c index 14fe9eb93..c36b0677a 100644 --- a/C/errors.c +++ b/C/errors.c @@ -1323,14 +1323,14 @@ Yap_Error(yap_error_number type, Term where, char *format,...) serious = TRUE; } break; - case RESOURCE_ERROR_MAX_THREADS: + case REPRESENTATION_ERROR_VARIABLE: { int i; Term ti[1]; i = strlen(tmpbuf); - ti[0] = MkAtomTerm(AtomThreads); - nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti); + ti[0] = MkAtomTerm(AtomVariable); + nt[0] = Yap_MkApplTerm(FunctorRepresentationError, 1, ti); tp = tmpbuf+i; psize -= i; fun = FunctorError; diff --git a/C/exec.c b/C/exec.c index 7273dde00..ca5c640b5 100644 --- a/C/exec.c +++ b/C/exec.c @@ -1540,8 +1540,8 @@ JumpToEnv(Term t) { B->cp_cp = (yamop *)env[E_CP]; B->cp_env = (CELL *)env[E_E]; B->cp_ap = NEXTOP(PredHandleThrow->CodeOfPred,l); - /* cannot recover Heap because of copy term :-( */ - B->cp_h = H; + /* can recover Heap thanks to copy term :-( */ + /* B->cp_h = H; */ /* I could backtrack here, but it is easier to leave the unwinding to the emulator */ B->cp_a3 = t; diff --git a/H/Yap.h b/H/Yap.h index 49042ec5e..64156f425 100644 --- a/H/Yap.h +++ b/H/Yap.h @@ -478,6 +478,7 @@ typedef enum REPRESENTATION_ERROR_CHARACTER, REPRESENTATION_ERROR_CHARACTER_CODE, REPRESENTATION_ERROR_MAX_ARITY, + REPRESENTATION_ERROR_VARIABLE, RESOURCE_ERROR_HUGE_INT, RESOURCE_ERROR_MAX_STREAMS, RESOURCE_ERROR_MAX_THREADS, diff --git a/pl/messages.yap b/pl/messages.yap index 456ea1d60..665844119 100644 --- a/pl/messages.yap +++ b/pl/messages.yap @@ -244,6 +244,8 @@ system_message(error(representation_error(character_code), Where)) --> [ 'REPRESENTATION ERROR- ~w: expected character code' - [Where] ]. system_message(error(representation_error(max_arity), Where)) --> [ 'REPRESENTATION ERROR- ~w: number too big' - [Where] ]. +system_message(error(representation_error(variable), Where)) --> + [ 'REPRESENTATION ERROR- ~w: should be a variable' - [Where] ]. system_message(error(resource_error(code_space), Where)) --> [ 'RESOURCE ERROR- not enough code space' - [Where] ]. system_message(error(resource_error(huge_int), Where)) -->