2014-04-28 11:57:09 +01:00
|
|
|
/* example.i */
|
2014-06-11 19:31:24 +01:00
|
|
|
%module(directors="1") yap
|
2014-04-28 11:57:09 +01:00
|
|
|
|
2014-07-15 06:54:45 +01:00
|
|
|
// Language independent exception handler
|
2015-04-13 13:28:17 +01:00
|
|
|
%include exception.i
|
2014-07-15 06:54:45 +01:00
|
|
|
|
|
|
|
class YAPPredicate;
|
|
|
|
class YAPEngine;
|
|
|
|
|
|
|
|
#ifdef SWIGPYTHON
|
|
|
|
%exception YAPPredicate {
|
|
|
|
try {
|
|
|
|
$action
|
|
|
|
} catch (...) {
|
|
|
|
PyErr_SetString(PyExc_SyntaxError, "syntax error");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
%exception query {
|
|
|
|
try {
|
|
|
|
$action
|
2015-04-13 13:28:17 +01:00
|
|
|
}
|
2014-07-15 06:54:45 +01:00
|
|
|
catch (YAPError YAP_SYMTAX_ERROR) {
|
|
|
|
SWIG_exception(SWIG_SyntaxError,"Syntax Error exception");
|
|
|
|
}
|
|
|
|
catch (...) {
|
|
|
|
SWIG_exception(SWIG_RuntimeError,"Unknown exception");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
%exception next {
|
|
|
|
try {
|
|
|
|
$action
|
2015-04-13 13:28:17 +01:00
|
|
|
}
|
2014-07-15 06:54:45 +01:00
|
|
|
catch (...) {
|
|
|
|
SWIG_exception(SWIG_RuntimeError,"Unknown exception");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-28 11:57:09 +01:00
|
|
|
%{
|
|
|
|
/* Put header files here or function declarations like below */
|
2015-04-13 13:28:17 +01:00
|
|
|
|
2014-06-11 19:31:24 +01:00
|
|
|
#define YAP_CPP_INTERFACE 1
|
2015-04-13 13:28:17 +01:00
|
|
|
|
|
|
|
|
2014-04-29 11:49:09 +01:00
|
|
|
#include "yapi.hh"
|
2014-04-28 11:57:09 +01:00
|
|
|
|
2015-02-07 01:11:52 +00:00
|
|
|
extern "C" {
|
|
|
|
|
2014-06-11 19:31:24 +01:00
|
|
|
#if THREADS
|
|
|
|
#define Yap_regp regcache
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// we cannot consult YapInterface.h, that conflicts with what we declare, though
|
|
|
|
// it shouldn't
|
|
|
|
}
|
|
|
|
|
2014-04-28 11:57:09 +01:00
|
|
|
%}
|
2015-04-13 13:28:17 +01:00
|
|
|
|
|
|
|
|
2014-06-11 19:31:24 +01:00
|
|
|
/* turn on director wrapping Callback */
|
|
|
|
%feature("director") YAPCallback;
|
2015-04-13 13:28:17 +01:00
|
|
|
|
2014-04-29 11:49:09 +01:00
|
|
|
%include "yapi.hh"
|
2014-04-28 11:57:09 +01:00
|
|
|
|
2015-02-09 01:53:28 +00:00
|
|
|
%include "yapa.hh"
|
|
|
|
|
|
|
|
%include "yapie.hh"
|
|
|
|
|
|
|
|
%include "yapt.hh"
|
|
|
|
|
|
|
|
%include "yapdb.hh"
|
|
|
|
|
|
|
|
%include "yapq.hh"
|
|
|
|
|
2014-06-22 17:35:05 +01:00
|
|
|
#ifdef SWIGJAVA
|
|
|
|
%javaexception("java.text.ParseException") YAPPredicate {
|
|
|
|
try {
|
|
|
|
$action
|
|
|
|
} catch (YAPError::SYNTAX_ERROR &e) {
|
|
|
|
jclass clazz = jenv->FindClass("java/text/ParseException");
|
|
|
|
jenv->ThrowNew(clazz, "Syntax error");
|
|
|
|
return $null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|