This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/swig/yap.i

58 lines
1020 B
OpenEdge ABL
Raw Normal View History

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
%{
/* Put header files here or function declarations like below */
2014-06-11 19:31:24 +01:00
#define YAP_CPP_INTERFACE 1
extern "C" {
2014-04-29 11:49:09 +01:00
#include "yapi.hh"
2014-04-28 11:57:09 +01:00
2014-06-11 19:31:24 +01:00
extern Term Yap_StringToTerm(const char *s, size_t len, term_t bindings);
#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
%}
2014-04-29 11:49:09 +01:00
2014-06-11 19:31:24 +01:00
/* turn on director wrapping Callback */
%feature("director") YAPCallback;
2014-06-22 17:35:05 +01:00
class YAPPredicate;
#ifdef SWIGPYTHON
%exception YAPPredicate {
try {
$action
} catch (...) {
fprintf(stderr,"here\n");
PyErr_SetString(PyExc_SyntaxError, "syntax error");
return NULL;
}
}
#endif
2014-04-29 11:49:09 +01:00
%include "yapi.hh"
2014-04-28 11:57:09 +01:00
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