error_xsb.h

00001 /* File:      error_xsb.h
00002 ** Author(s): Kostis F. Sagonas
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 1986, 1993-1998
00006 ** 
00007 ** XSB is free software; you can redistribute it and/or modify it under the
00008 ** terms of the GNU Library General Public License as published by the Free
00009 ** Software Foundation; either version 2 of the License, or (at your option)
00010 ** any later version.
00011 ** 
00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00015 ** more details.
00016 ** 
00017 ** You should have received a copy of the GNU Library General Public License
00018 ** along with XSB; if not, write to the Free Software Foundation,
00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 **
00021 ** $Id: error_xsb.h,v 1.28 2006/05/31 21:28:09 crojo Exp $
00022 ** 
00023 */
00024 
00025 #include "basictypes.h"
00026 #include "setjmp_xsb.h"
00027 #include "export.h"
00028 #include "context.h"
00029 #include "psc_xsb.h"
00030 
00031 /*----------------------------------------------------------------------*/
00032 /* The following is a list of errors as defined by the Prolog ISO       */
00033 /* standard.  It is clear that today (October 1993), XSB does NOT       */
00034 /* catch all of them.  In fact it does not even report half of them.    */
00035 /* However, one fine day it might!  The following list tries to become  */
00036 /* a first step towards the uniform treatment of errors by XSB.         */
00037 /*----------------------------------------------------------------------*/
00038 
00039 #define CALCULATION      0
00040 #define DATABASE         1
00041 #define EVALUATION       2
00042 #define IMPLEMENTATION   3
00043 #define INSTANTIATION    4
00044 #define IO_CONTROL       5
00045 #define IO_END_OF_FILE   6
00046 #define IO_FORMATTING    7
00047 #define OPERATOR         8
00048 #define XSBOVERFLOW      9  /* renamed from OVERFLOW. This def isn't used, but
00049                                OVERFLOW clashes with some C compilers */
00050 #define RANGE           10
00051 #define SYNTAX          11
00052 #define TYPE            12
00053 #define UNDEFINED_PRED  13
00054 #define UNDEFINED_VAL   14
00055 #define XSBUNDERFLOW    15  /* renamed from UNDERFLOW. This def isn't used, but
00056                                UNDERFLOW clashes with some C compilers */
00057 #define ZERO_DIVIDE     16 
00058 
00059 /* TLS: used for determing the offset of a putpvar + call so that
00060    the pc register can be saved so that the proper choice point can be
00061    (in a necessarily roundabout manner) determined. 
00062 */
00063 #ifdef BITS64
00064 #define THROWPAD 24
00065 #else 
00066 #define THROWPAD 12
00067 #endif 
00068 
00069 
00070 DllExport extern void call_conv xsb_exit(char *, ...);
00071 DllExport extern void call_conv exit_xsb(char *);
00072 
00073 DllExport extern void call_conv xsb_abort(char *, ...);
00074 DllExport extern void call_conv abort_xsb(char *);
00075 
00076 DllExport extern void call_conv xsb_bug(char *, ...);
00077 DllExport extern void call_conv bug_xsb(char *);
00078 void call_conv xsb_basic_abort(char *);
00079 
00080 DllExport extern void call_conv xsb_warn(char *, ...);
00081 DllExport extern void call_conv warn_xsb(char *);
00082 
00083 DllExport extern void call_conv xsb_mesg(char *, ...);
00084 DllExport extern void call_conv mesg_xsb(char *);
00085 
00086 DllExport extern void call_conv xsb_error(char *, ...);
00087 DllExport extern void call_conv error_xsb(char *);
00088 
00089 DllExport extern void call_conv xsb_dbgmsg1(int, char *, ...);
00090 DllExport extern void call_conv dbgmsg1_xsb(int, char *);
00091 
00092 extern void arithmetic_abort1(CTXTdeclc char *, Cell);
00093 extern void arithmetic_abort(CTXTdeclc Cell, char *, Cell);
00094 extern void arithmetic_comp_abort(CTXTdeclc Cell, char *, int);
00095 extern void err_handle(CTXTdeclc int, int, char *, int, char *, Cell);
00096 
00097 extern FILE *stdmsg;            /* Stream for XSB messages               */
00098 extern FILE *stdwarn;           /* Stream for XSB warnings               */
00099 extern FILE *stddbg;            /* Stream for XSB debugging msgs         */
00100 extern FILE *stdfdbk;           /* Stream for XSB feedback msgs         */
00101 
00102 #define err(d, a, f, ar)        err_handle(CTXTc d, a, f, ar, NULL, (Cell)NULL)
00103 
00104 extern char *xsb_default_segfault_msg;
00105 
00106 extern char *xsb_segfault_message; /* Put your segfault message here prior to
00107                                       executing the command that might
00108                                       segfault. Then restore it to
00109                                       xsb_default_segfault_message */ 
00110 
00111 extern void (*xsb_default_segfault_handler)(int); /* where the previous value
00112                                                      of the SIGSEGV handler is
00113                                                      saved */ 
00114 
00115 extern int print_xsb_backtrace(CTXTdecl);
00116 
00117 /* SIGSEGV handler that catches segfaults; used unless configured with DEBUG */
00118 extern void xsb_segfault_catcher (int);
00119 extern void xsb_segfault_quitter(int);
00120 
00121 int unwind_stack(CTXTdecl);
00122 
00123 void call_conv xsb_domain_error(CTXTdeclc char *, Cell, char *, int, int) ;
00124 void call_conv xsb_existence_error(CTXTdeclc char *,Cell, char *,int, int) ;
00125 void call_conv xsb_instantiation_error(CTXTdeclc char *, int, int, char *) ;
00126 void call_conv xsb_permission_error(CTXTdeclc char *,char *,Cell,char *,int) ;
00127 void call_conv xsb_resource_error(CTXTdeclc char *,char *, int) ;
00128 void call_conv xsb_resource_error_nopred(CTXTdeclc char *,char *) ;
00129 void call_conv xsb_table_error(CTXTdeclc char *) ;
00130 void call_conv xsb_type_error(CTXTdeclc char *,Cell , char *,int, int) ;
00131 
00132 extern void call_conv xsb_memory_error(char *, char *);
00133 
00134 DllExport void call_conv xsb_throw(CTXTdeclc prolog_term, unsigned long);
00135 
00136 extern prolog_term build_xsb_backtrace(CTXTdecl);

Generated on Wed Jul 26 13:30:40 2006 for XSB by  doxygen 1.4.5