upm/src/upm.i
Jon Trulson 84f795e453 upm: add facility for exception handling in upm
We add a new src/upm_exception.i interface file for SWIG to catch
common exceptions and propagate them through SWIG.

src/upm.i is modified to include this interface file, so all UPM
drivers have it.

In theory, this should be language agnostic - if the target language
supports exceptions, then it should just work.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2015-08-13 14:52:01 -07:00

25 lines
627 B
OpenEdge ABL

%include "std_string.i"
%include "stdint.i"
%include "upm_exception.i"
%typemap(out) mraa_result_t = int;
#if (SWIG_JAVASCRIPT_V8)
%{
// Because there's no guarantee that v8 will ever call garbage collection,
// we're adding a function that will allow a user to call it manually
void cleanUp()
{
// Call the v8 garbage collector as long as there is memory to clean up
// See https://codereview.chromium.org/412163003 for this API change
#if (SWIG_V8_VERSION < 0x032838)
while (!v8::V8::IdleNotification())
#else
while (!v8::Isolate::GetCurrent()->IdleNotification(1000))
#endif
{;}
}
%}
void cleanUp();
#endif