mraajs: update for node.js 0.12 API differences
This requires setting #define SWIG_V8_VERSION 0x032873 in the mraajsJAVASCRIPT_wrap.cxx file. Note most v8 APIs now require v8::Isolate and v8::Persistent is no longer a v8::Handle so the gpio.hpp for ISR support is also modified by this change Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
%module (docstring="Javascript interface to libmraa") mraa
|
||||
|
||||
%feature("autodoc", "3");
|
||||
#define NODE012
|
||||
|
||||
%include carrays.i
|
||||
%include cpointer.i
|
||||
@@ -28,7 +29,11 @@ namespace mraa {
|
||||
class Spi;
|
||||
%typemap(out) uint8_t*
|
||||
{
|
||||
#ifdef NODE012
|
||||
$result = node::Buffer::New((char*) $1, arg3);
|
||||
#else
|
||||
$result = node::Buffer::New((char*) $1, arg3)->handle_;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +49,7 @@ class Spi;
|
||||
$2 = x;
|
||||
if ($2 < 0) {
|
||||
SWIG_exception_fail(SWIG_ERROR, "Positive integer expected");
|
||||
SWIGV8_RETURN(v8::Undefined());
|
||||
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
||||
}
|
||||
$1 = (uint8_t*) malloc($2 * sizeof(uint8_t));
|
||||
}
|
||||
@@ -53,9 +58,13 @@ class Spi;
|
||||
if (result < 0) { /* Check for I/O error */
|
||||
free($1);
|
||||
SWIG_exception_fail(SWIG_ERROR, "I2c write failed");
|
||||
SWIGV8_RETURN(v8::Undefined());
|
||||
SWIGV8_RETURN(SWIGV8_UNDEFINED());
|
||||
}
|
||||
#ifdef NODE012
|
||||
$result = node::Buffer::New((char*) $1, result);
|
||||
#else
|
||||
$result = node::Buffer::New((char*) $1, result)->handle_;
|
||||
#endif
|
||||
free($1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user