YAP 7.1.0
errors.c File Reference

low-level error handling More...

#include "Yap.h"
#include "YapDefs.h"
#include "YapInterface.h"
#include "YapStreams.h"
#include "YapTags.h"
#include "Yapproto.h"
#include "absmi.h"
#include "yapio.h"
#include <stdlib.h>
#include "Foreign.h"
#include "YapErrors.h"
#include <iopreds.h>

Go to the source code of this file.

Macros

#define set_key_b(k, ks, q, i, t)
 
#define set_key_i(k, ks, q, i, t)
 
#define set_key_s(k, ks, q, i, t)
 
#define set_key_t(k, ks, q, i, t)
 
#define query_key_b(k, ks, q, i)
 
#define query_key_i(k, ks, q, i)
 
#define query_key_s(k, ks, q, i)
 
#define query_key_t(k, ks, q, i)
 
#define YAP_BUF_SIZE   512
 
#define BEGIN_ERROR_CLASSES()
 
#define ECLASS(CL, A, B)
 
#define END_ERROR_CLASSES()
 
#define BEGIN_ERRORS()
 
#define E0(A, B, C)
 
#define E(A, B, C)
 
#define E1(A, B, C)
 
#define E2(A, B, C, D)
 
#define END_ERRORS()
 
#define BEGIN_ERROR_CLASSES()
 
#define ECLASS(CL, A, B)   CL##__,
 
#define END_ERROR_CLASSES()
 
#define BEGIN_ERRORS()
 
#define E0(X, Y, Z)
 
#define E(X, Y, Z)
 
#define E1(X, Y, Z)
 
#define E2(X, Y, Z, W)
 
#define END_ERRORS()
 
#define BEGIN_ERROR_CLASSES()   static const char *c_error_class_name[] = {
 
#define ECLASS(CL, A, B)   A,
 
#define END_ERROR_CLASSES()
 
#define BEGIN_ERRORS()   static struct c_error_info c_error_list[] = {
 
#define E0(X, Y, Z)   {X, Y##__, Z},
 
#define E(X, Y, Z)   {X, Y##__, Z},
 
#define E1(X, Y, Z)   {X, Y##__, Z},
 
#define E2(X, Y, Z, W)   {X, Y##__, Z " " W},
 
#define END_ERRORS()
 

Typedefs

typedef struct c_error_info c_error_t
 

Functions

void Yap_RestartYap (int flag)
 
Term MkErrorTerm (yap_error_descriptor_t *t)
 
void Yap_do_warning__ (const char *file, const char *function, int line, yap_error_number type, Term t,...)
 
bool Yap_Warning (const char *s,...)
 
void Yap_InitError__ (const char *file, const char *function, int lineno, yap_error_number e, Term t,...)
 
bool Yap_PrintWarning (Term twarning)
 
bool Yap_HandleError__ (const char *file, const char *function, int lineno, const char *s,...)
 
int Yap_SWIHandleError (const char *s,...)
 
yap_error_descriptor_tYap_pushErrorContext (bool link, yap_error_descriptor_t *new_error, yap_error_descriptor_t *old_error)
 add a new error descriptor, either to the top of the stack, or as the top; More...
 
yap_error_descriptor_tYap_popErrorContext (bool mdnew, bool pass, yap_error_descriptor_t *old_error)
 
void Yap_ThrowError__ (const char *file, const char *function, int lineno, yap_error_number type, Term where, const char *msg,...)
 Throw an error directly to the error handler. More...
 
void Yap_ThrowExistingError (void)
 
Term MkSysError (yap_error_descriptor_t *i)
 Wrap the error descriptor as exception/2. More...
 
Term Yap_MkFullError (yap_error_descriptor_t *i)
 convert a C-error to a Prolog term: More...
 
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: More...
 
yamopYap_Error__ (bool throw, const char *file, const char *function, int lineno, yap_error_number type, Term where,...)
 Yap_Error This function handles errors in the C code. More...
 
yap_error_class_number Yap_errorClass (yap_error_number e)
 
yap_error_class_number Yap_errorClassNumber (const char *s)
 
char * Yap_errorClassName (yap_error_class_number e)
 
Term Yap_MkPrologError (Term t, yap_error_descriptor_t *i)
 
yap_error_descriptor_tYap_PeekException (void)
 is an error active? More...
 
yap_error_descriptor_tYap_GetException (void)
 clone Active Error More...
 
void Yap_PrintException (yap_error_descriptor_t *i)
 print descriptor to user_output/stdout More...
 
bool Yap_RaiseException ()
 let's go More...
 
bool Yap_ResetException (yap_error_descriptor_t *i)
 clean up (notice that the code ensures ActiveError exists on exit More...
 
bool Yap_RestartException (yap_error_descriptor_t *i)
 clean up (notice that the code ensures ActiveError exists on exit More...
 
bool Yap_get_exception (USES_REGS1)
 
yap_error_number Yap_errorNumber (yap_error_class_number c, const char *s)
 given a string(s, lookup for a corresponding error class r numbe More...
 
char * Yap_errorName (yap_error_number e)
 
yap_error_descriptor_tevent (Term t, yap_error_descriptor_t *i)
 
Int is_nonvar__ (const char *file, const char *function, int lineno, Term t USES_REGS)
 
bool is_boolean__ (const char *file, const char *function, int lineno, Term t USES_REGS)
 
bool must_be_boolean__ (const char *file, const char *function, int lineno, Term t USES_REGS)
 
bool is_atom__ (const char *file, const char *function, int lineno, Term t USES_REGS)
 
bool must_be_atom__ (const char *file, const char *function, int lineno, Term t USES_REGS)
 
bool is_list__ (const char *file, const char *function, int lineno, Term list USES_REGS)
 
bool must_be_list__ (const char *file, const char *function, int lineno, Term list USES_REGS)
 
Int callable (USES_REGS1)
 
bool is_callable__ (const char *file, const char *function, int lineno, Term t USES_REGS)
 
bool Yap_callable (Term t)
 
void Yap_must_be_list (Term t)
 Dereferenced term t must start as a list: More...
 
void Yap_InitErrorPreds (void)
 

Detailed Description

low-level error handling

Definition in file errors.c.

Function Documentation

◆ callable()

Int callable ( USES_REGS1  )

Definition at line 1771 of file errors.c.

◆ is_atom__()

bool is_atom__ ( const char *  file,
const char *  function,
int  lineno,
Term t  USES_REGS 
)

Definition at line 1678 of file errors.c.

◆ is_boolean__()

bool is_boolean__ ( const char *  file,
const char *  function,
int  lineno,
Term t  USES_REGS 
)

Definition at line 1637 of file errors.c.

◆ is_callable__()

bool is_callable__ ( const char *  file,
const char *  function,
int  lineno,
Term t  USES_REGS 
)

Definition at line 1825 of file errors.c.

◆ is_list__()

bool is_list__ ( const char *  file,
const char *  function,
int  lineno,
Term list  USES_REGS 
)

Definition at line 1724 of file errors.c.

◆ is_nonvar__()

Int is_nonvar__ ( const char *  file,
const char *  function,
int  lineno,
Term t  USES_REGS 
)

Definition at line 1614 of file errors.c.

◆ must_be_atom__()

bool must_be_atom__ ( const char *  file,
const char *  function,
int  lineno,
Term t  USES_REGS 
)

Definition at line 1696 of file errors.c.

◆ must_be_boolean__()

bool must_be_boolean__ ( const char *  file,
const char *  function,
int  lineno,
Term t  USES_REGS 
)

Definition at line 1654 of file errors.c.

◆ must_be_list__()

bool must_be_list__ ( const char *  file,
const char *  function,
int  lineno,
Term list  USES_REGS 
)

Definition at line 1744 of file errors.c.

◆ Yap_callable()

bool Yap_callable ( Term  t)

Definition at line 1880 of file errors.c.

◆ Yap_InitErrorPreds()

void Yap_InitErrorPreds ( void  )

Definition at line 2096 of file errors.c.

◆ Yap_must_be_list()

void Yap_must_be_list ( Term  t)

Dereferenced term t must start as a list:

  • []
  • [_|_]

no effort is made to verify if a true list

Definition at line 1977 of file errors.c.