Error Handler

This commit is contained in:
Vítor Santos Costa 2015-09-29 23:43:02 +01:00
parent 4c368a59d3
commit 34fe3e6ded
5 changed files with 23 additions and 6 deletions

View File

@ -38,9 +38,10 @@
struct yami *Yap_Error__(const char *file, const char *function, int lineno, yap_error_number err,YAP_Term wheret, ...);
#define Yap_Error( id, t, ...) Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
#define Yap_NilError( id, ...) Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__)
#define Yap_Error( id, inp, ...) Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, inp, __VA_ARGS__)
#define JMP_LOCAL_ERROR(v, LAB) \
if (H + 2 * (v) > ASP - 1024) { \

View File

@ -1899,9 +1899,9 @@ extern X_API void YAP_Write(YAP_Term t,FILE *s,int);
extern X_API FILE * YAP_TermToStream(YAP_Term t);
extern X_API int YAP_InitConsult(int mode, const char *filename);
extern X_API int YAP_InitConsult(int mode, const char *filename, int *previous_sno);
extern X_API void YAP_EndConsult(int s);
extern X_API void YAP_EndConsult(int s, int *previous_sno);
#ifndef _PL_STREAM_H
// if we don't know what a stream is, just don't assume nothing about the pointer

View File

@ -193,7 +193,10 @@ ADDR TrailTop void
char* ErrorMessage void
Term Error_Term void
yap_error_number Error_TYPE void
UInt Error_Size void
const char* Error_File void
const char* Error_Function void
int Error_Lineno void
size_t Error_Size void
char ErrorSay[MAX_ERROR_MSG_SIZE] void
jmp_buf IOBotch void
TokEntry* tokptr void

View File

@ -68,6 +68,9 @@ gen_struct(Inp,Out) :-
gen_struct(Inp,Out) :-
split(Inp," ",["union",Type, Field|_]), !,
append([" union ",Type," ",Field,"_",";"], Out).
gen_struct(Inp,Out) :-
split(Inp," ",["const",Type, Field|_]), !,
append(["const ", Type," ",Field,"_",";"], Out).
gen_struct(Inp,"") :-
split(Inp," ",["void","void"|_]), !.
gen_struct(Inp,Out) :-
@ -112,6 +115,10 @@ gen_dstruct(Inp,Out) :-
split(Inp," ",["union"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_dstruct(Inp3, Out).
gen_dstruct(Inp,Out) :-
split(Inp," ",["const"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_dstruct(Inp3, Out).
gen_dstruct(Inp,Out) :-
split(Inp," ",[".", Field,_|_]), !,
cut_c_stuff(Field, RField),
@ -197,6 +204,10 @@ gen_hstruct(Inp,Out) :-
split(Inp," ",["struct"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_hstruct(Inp3,Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",["const"|Inp2]), !,
glue(Inp2, " ", Inp3),
gen_hstruct(Inp3,Out).
gen_hstruct(Inp,Out) :-
split(Inp," ",["union"|Inp2]), !,
glue(Inp2, " ", Inp3),
@ -280,6 +291,8 @@ gen_init(Inp,Out) :-
gen_init(Inp3, Out).
gen_init(Inp,"") :-
split(Inp," ",[_, _, "void"|_]), !.
gen_init(Inp,"") :-
split(Inp," ",["const"|_]), !.
gen_init(Inp,Init) :-
split(Inp," ",[_, _, Init0| _]),
append("Init",_,Init0), !,

View File

@ -391,9 +391,9 @@ output_walk(C,"Osblp",_) :- !,
output_walk(C,"Osbpp",[Op|_]) :-
c_call_op(Op), !,
walk_to_c_code(C,"Osbpp","p").
output_walk(C,"slp",[Op|_]) :-
output_walk(C,"slpp",[Op|_]) :-
c_call_op(Op), !,
walk_to_c_code(C,"slp","p").
walk_to_c_code(C,"slpp","p").
output_walk(C,"Osbpp",[Op|_]) :-
special_walk_op(Op), !,
walk_to_meta_call(C).