YAP 7.1.0
yapie.hh
Go to the documentation of this file.
1
23#ifndef YAPIE_HH
24#define YAPIE_HH
25
26class X_API YAPPPredicate;
27
28
29
31class X_API YAPError {
32 //int swigcode;
34
35public:
38 info = LOCAL_ActiveError;
39 if (!info)
40 LOCAL_ActiveError = info = (yap_error_descriptor_t *)calloc( sizeof( yap_error_descriptor_t ), 1);
41 // if (info->errorNo != YAP_NO_ERROR) {};
42 //std::cerr << "Error detected" << info->errorNo << "\n";
43 }
47 if (des)
48 info= des;
49 else info = (yap_error_descriptor_t *)calloc( sizeof( yap_error_descriptor_t ), 1);
50 // if (info->errorNo != YAP_NO_ERROR) {};
51 //std::cerr << "Error detected" << info->errorNo << "\n";
52
53 }
54
55
57 // YAPError( std::string file, std::string function, int lineno,
58 // yap_error_number id, YAPTerm culprit, std::string txt) {
59 // info = new yap_error_descriptor_t;
60 // Yap_MkErrorRecord(info, file.c_str(), function.c_str(), lineno, id, culprit.term(), txt.c_str());
61 //}
62
64 YAPError( const char * file, const char * function, int lineno,
65 yap_error_number id, YAP_Term culprit, const char * txt) {
66 info = (yap_error_descriptor_t *)calloc( sizeof( yap_error_descriptor_t ), 1);
67 Yap_MkErrorRecord(info, file, function, lineno, id, culprit, txt);
68 }
69
71#define SOURCE() __FILE__, __FUNCTION__, __LINE__
72
75 yap_error_number getID() { return info->errorNo; };
77 yap_error_class_number getErrorClass() {
78 return Yap_errorClass(info->errorNo);
79 };
81 const char *getFile() { return info->errorFile; };
83 Int getLine() { return info->errorLine; };
85 // YAPTerm getCulprit(info->errorFile){};
87 std::string text();
88};
89
90#endif
91
bool Yap_MkErrorRecord(yap_error_descriptor_t *r, const char *file, const char *function, int lineno, yap_error_number type, Term where, const char *s)
complete an error descriptor:
Definition: errors.c:882
const char * getFile()
where in the code things happened;
Definition: yapie.hh:81
YAPError(yap_error_descriptor_t *des)
if des != nullptr, wrap a preexisting error descriptor; otherwise, generate a new one
Definition: yapie.hh:46
YAPError(const char *file, const char *function, int lineno, yap_error_number id, YAP_Term culprit, const char *txt)
error handler object with initial data when receiving the error term
Definition: yapie.hh:64
yap_error_number getID()
we just know the error number exact error ID
Definition: yapie.hh:75
yap_error_class_number getErrorClass()
class of error
Definition: yapie.hh:77
YAPError()
wraps the default error descriptor
Definition: yapie.hh:37
Int getLine()
predicate things happened;
Definition: yapie.hh:83
take information on a Prolog error:
Definition: yapie.hh:31
all we need to know about an error/throw
Definition: YapError.h:205