summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Buchtala <oliver.buchtala@googlemail.com>2012-09-08 00:57:42 +0000
committerOliver Buchtala <oliver.buchtala@googlemail.com>2012-09-08 00:57:42 +0000
commit35e6b73d2acbcc010bd239a83fbf16cecefe7b70 (patch)
tree279ce21970caaf6758cee0993172224c03321da9
parent050219d998c0a518b54366c6c543fa926e601e5b (diff)
downloadswig-35e6b73d2acbcc010bd239a83fbf16cecefe7b70.tar.gz
Add swig configuration files for v8.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13765 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--Lib/javascript/jsc/ccomplex.i2
-rw-r--r--Lib/javascript/jsc/javascriptfragments.swg0
-rw-r--r--Lib/javascript/jsc/javascripttypemaps.swg5
-rw-r--r--Lib/javascript/jsc/javascriptvaltypes.swg1
-rw-r--r--Lib/javascript/v8/ccomplex.i26
-rw-r--r--Lib/javascript/v8/complex.i6
-rw-r--r--Lib/javascript/v8/javascript.swg (renamed from Lib/javascript/javascript.swg)8
-rw-r--r--Lib/javascript/v8/javascriptcomplex.swg146
-rw-r--r--Lib/javascript/v8/javascriptinit.swg15
-rw-r--r--Lib/javascript/v8/javascriptkw.swg (renamed from Lib/javascript/javascriptkw.swg)0
-rw-r--r--Lib/javascript/v8/javascriptprimitives.swg280
-rw-r--r--Lib/javascript/v8/javascriptruntime.swg90
-rw-r--r--Lib/javascript/v8/javascripttypemaps.swg16
-rwxr-xr-xLib/javascript/v8/std_common.i5
-rw-r--r--Lib/javascript/v8/std_complex.i19
-rw-r--r--Lib/javascript/v8/std_except.i1
-rwxr-xr-xLib/javascript/v8/std_map.i74
-rwxr-xr-xLib/javascript/v8/std_pair.i34
-rwxr-xr-xLib/javascript/v8/std_vector.i85
-rwxr-xr-xLib/javascript/v8/stl.i10
20 files changed, 630 insertions, 193 deletions
diff --git a/Lib/javascript/jsc/ccomplex.i b/Lib/javascript/jsc/ccomplex.i
index 8eda920bb..50f0f95fe 100644
--- a/Lib/javascript/jsc/ccomplex.i
+++ b/Lib/javascript/jsc/ccomplex.i
@@ -6,7 +6,7 @@
* ----------------------------------------------------------------------------- */
-%include <javscriptcomplex.swg>
+%include <javascriptcomplex.swg>
%{
#include <complex.h>
diff --git a/Lib/javascript/jsc/javascriptfragments.swg b/Lib/javascript/jsc/javascriptfragments.swg
deleted file mode 100644
index e69de29bb..000000000
--- a/Lib/javascript/jsc/javascriptfragments.swg
+++ /dev/null
diff --git a/Lib/javascript/jsc/javascripttypemaps.swg b/Lib/javascript/jsc/javascripttypemaps.swg
index e8711cfc5..9bde8eb2a 100644
--- a/Lib/javascript/jsc/javascripttypemaps.swg
+++ b/Lib/javascript/jsc/javascripttypemaps.swg
@@ -9,17 +9,12 @@
#define SWIG_SetConstant(name, obj)
#define SWIG_Raise(obj, type, desc) SWIG_Javascript_Raise(context, exception, type)
-%include <javascriptfragments.swg>
-
/* Include fundamental fragemt definitions */
%include <typemaps/fragments.swg>
/* Python fragments for fundamental types */
%include <javascriptprimitives.swg>
-/* override some of the macros in global valtypes.swg */
-%include <javascriptvaltypes.swg>
-
%include <javascriptstrings.swg>
/* Include the unified typemap library */
diff --git a/Lib/javascript/jsc/javascriptvaltypes.swg b/Lib/javascript/jsc/javascriptvaltypes.swg
deleted file mode 100644
index 8b1378917..000000000
--- a/Lib/javascript/jsc/javascriptvaltypes.swg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/Lib/javascript/v8/ccomplex.i b/Lib/javascript/v8/ccomplex.i
new file mode 100644
index 000000000..8eda920bb
--- /dev/null
+++ b/Lib/javascript/v8/ccomplex.i
@@ -0,0 +1,26 @@
+/* -----------------------------------------------------------------------------
+ * ccomplex.i
+ *
+ * C complex typemaps
+ * ISO C99: 7.3 Complex arithmetic <complex.h>
+ * ----------------------------------------------------------------------------- */
+
+
+%include <javscriptcomplex.swg>
+
+%{
+#include <complex.h>
+%}
+
+
+/* C complex constructor */
+#define CCplxConst(r, i) ((r) + I*(i))
+
+%swig_cplxflt_convn(float complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(double complex, CCplxConst, creal, cimag);
+%swig_cplxdbl_convn(complex, CCplxConst, creal, cimag);
+
+/* declaring the typemaps */
+%typemaps_primitive(SWIG_TYPECHECK_CPLXFLT, float complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, double complex);
+%typemaps_primitive(SWIG_TYPECHECK_CPLXDBL, complex);
diff --git a/Lib/javascript/v8/complex.i b/Lib/javascript/v8/complex.i
new file mode 100644
index 000000000..4c3b3c5e2
--- /dev/null
+++ b/Lib/javascript/v8/complex.i
@@ -0,0 +1,6 @@
+#ifdef __cplusplus
+%include <std_complex.i>
+#else
+%include <ccomplex.i>
+#endif
+
diff --git a/Lib/javascript/javascript.swg b/Lib/javascript/v8/javascript.swg
index fb01a63bb..3a83b6495 100644
--- a/Lib/javascript/javascript.swg
+++ b/Lib/javascript/v8/javascript.swg
@@ -4,12 +4,16 @@
* Javascript typemaps
* ----------------------------------------------------------------------------- */
+%include <typemaps/swigmacros.swg>
+
+%include <javascripttypemaps.swg>
+
%include <javascriptruntime.swg>
%include <javascripthelpers.swg>
-%include <javascriptprimitives.swg>
-
%include <javascriptkw.swg>
%include <javascriptcode.swg>
+
+%include <javascriptinit.swg>
diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
new file mode 100644
index 000000000..7d165dce4
--- /dev/null
+++ b/Lib/javascript/v8/javascriptcomplex.swg
@@ -0,0 +1,146 @@
+/*
+ Defines the As/From converters for double/float complex, you need to
+ provide complex Type, the Name you want to use in the converters,
+ the complex Constructor method, and the Real and Imag complex
+ accessor methods.
+
+ See the std_complex.i and ccomplex.i for concret examples.
+*/
+
+/* the common from converter */
+%define %swig_fromcplx_conv(Type, Real, Imag)
+%fragment(SWIG_From_frag(Type),"header",
+ fragment=SWIG_From_frag(double))
+{
+SWIGINTERNINLINE JSObjectRef
+SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
+{
+ JSValueRef vals[2];
+ vals[0] = SWIG_From(double)(Real(c));
+ vals[1] = SWIG_From(double)(Imag(c));
+ return JSObjectMakeArray(context, 2, vals, NULL);
+}
+}
+%enddef
+
+/* the double case */
+%define %swig_cplxdbl_conv(Type, Constructor, Real, Imag)
+%fragment(SWIG_AsVal_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(double))
+{
+SWIGINTERN int
+SWIG_AsVal_dec(Type) (JSValueRef o, Type* val)
+{
+ if (JSValueIsObject(context, o)) {
+ JSObjectRef array;
+ JSValueRef exception, js_re, js_im;
+ double re, im;
+ int res;
+
+ exception = 0;
+ res = 0;
+
+ array = JSValueToObject(context, o, &exception);
+ if(exception != 0)
+ return SWIG_TypeError;
+
+ js_re = JSObjectGetPropertyAtIndex(context, array, 0, &exception);
+ if(exception != 0)
+ return SWIG_TypeError;
+
+ js_im = JSObjectGetPropertyAtIndex(context, array, 1, &exception);
+ if(exception != 0)
+ return SWIG_TypeError;
+
+ res = SWIG_AsVal(double)(js_re, &re);
+ if(!SWIG_IsOK(res)) {
+ return SWIG_TypeError;
+ }
+
+ res = SWIG_AsVal(double)(js_im, &im);
+ if(!SWIG_IsOK(res)) {
+ return SWIG_TypeError;
+ }
+
+ if (val) *val = Constructor(re, im);
+ return SWIG_OK;
+ } else {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d));
+ if (SWIG_IsOK(res)) {
+ if (val) *val = Constructor(d, 0.0);
+ return res;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+%swig_fromcplx_conv(Type, Real, Imag);
+%enddef
+
+/* the float case */
+%define %swig_cplxflt_conv(Type, Constructor, Real, Imag)
+%fragment(SWIG_AsVal_frag(Type),"header",
+ fragment=SWIG_AsVal_frag(float)) {
+SWIGINTERN int
+SWIG_AsVal_dec(Type)(JSValueRef o, Type *val)
+{
+ if (JSValueIsObject(context, o)) {
+ JSObjectRef array;
+ JSValueRef exception, js_re, js_im;
+ double re, im;
+ int res;
+
+ exception = 0;
+ res = 0;
+
+ array = JSValueToObject(context, o, &exception);
+ if(exception != 0)
+ return SWIG_TypeError;
+
+ js_re = JSObjectGetPropertyAtIndex(context, array, 0, &exception);
+ if(exception != 0)
+ return SWIG_TypeError;
+
+ js_im = JSObjectGetPropertyAtIndex(context, array, 1, &exception);
+ if(exception != 0)
+ return SWIG_TypeError;
+
+ res = SWIG_AsVal(double)(js_re, &re);
+ if(!SWIG_IsOK(res)) {
+ return SWIG_TypeError;
+ }
+
+ res = SWIG_AsVal(double)(js_im, &im);
+ if(!SWIG_IsOK(res)) {
+ return SWIG_TypeError;
+ }
+
+ if ((-FLT_MAX <= re && re <= FLT_MAX) && (-FLT_MAX <= im && im <= FLT_MAX)) {
+ if (val) *val = Constructor(%numeric_cast(re, float),
+ %numeric_cast(im, float));
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
+ } else {
+ float re;
+ int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re));
+ if (SWIG_IsOK(res)) {
+ if (val) *val = Constructor(re, 0.0);
+ return res;
+ }
+ }
+ return SWIG_TypeError;
+}
+}
+
+%swig_fromcplx_conv(Type, Real, Imag);
+%enddef
+
+#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \
+%swig_cplxflt_conv(Type, Constructor, Real, Imag)
+
+
+#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \
+%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
new file mode 100644
index 000000000..1186b33bc
--- /dev/null
+++ b/Lib/javascript/v8/javascriptinit.swg
@@ -0,0 +1,15 @@
+%insert(init) %{
+SWIGRUNTIME void
+SWIG_V8_SetModule(swig_module_info *swig_module) {}
+
+SWIGRUNTIME swig_module_info *
+SWIG_V8_GetModule(void) {
+ return 0;
+}
+
+#define SWIG_GetModule(clientdata) SWIG_V8_GetModule()
+#define SWIG_SetModule(clientdata, pointer) SWIG_V8_SetModule(pointer)
+
+%}
+
+%insert(init) "swiginit.swg"
diff --git a/Lib/javascript/javascriptkw.swg b/Lib/javascript/v8/javascriptkw.swg
index c3c118391..c3c118391 100644
--- a/Lib/javascript/javascriptkw.swg
+++ b/Lib/javascript/v8/javascriptkw.swg
diff --git a/Lib/javascript/v8/javascriptprimitives.swg b/Lib/javascript/v8/javascriptprimitives.swg
index b8eb1e569..09e1ae9f9 100644
--- a/Lib/javascript/v8/javascriptprimitives.swg
+++ b/Lib/javascript/v8/javascriptprimitives.swg
@@ -1,119 +1,109 @@
-%typemap(in) bool
-%{ $1 = ($1_ltype) $input->BooleanValue();%}
-
-// Primitive types
-%typemap(in) char,
- signed char,
- unsigned char,
- short,
- unsigned short,
- int
-%{ $1 = ($1_ltype) $input->Int32Value();%}
-
-%typemap(in) unsigned int,
- long,
- unsigned long,
- long long,
- unsigned long long
-%{ $1 = ($1_ltype) $input->UInt32Value();%}
-
-%typemap(in) float, double
-%{ $1 = ($1_ltype) $input->NumberValue();%}
-
-
-%typemap(in) const bool &, bool &,
- const char &, char &,
- const signed char &, signed char &,
- const unsigned char &, unsigned char &,
- const short &, short &,
- const unsigned short &, unsigned short &,
- const int &, int &,
- const unsigned int &, unsigned int &,
- const long &, long &,
- const unsigned long &, unsigned long &,
- const long long &, long long &,
- const unsigned long long &, unsigned long long &,
- const float &, float &,
- const double &, double &
-%{
- // TODO: typemap(in) const bool& at al
+%fragment(SWIG_From_frag(bool),"header") {
+SWIGINTERNINLINE
+v8::Handle<v8::Value>
+SWIG_From_dec(bool)(bool value)
+{
+ return v8::Boolean::New(value);
+}
}
-%typemap(out) bool
-%{ $result = v8::Boolean::New($1);%}
-
-%typemap(out) char,
- signed char,
- unsigned char,
- short,
- unsigned short,
- int
-%{ $result = v8::Int32::New($1);%}
-
-%typemap(out) unsigned int,
- long,
- unsigned long,
- long long,
- unsigned long long
-%{ $result = v8::UInt32::New($1);%}
-
-%typemap(out) float, double
-%{ $result = v8::Number::New($1); %}
+%fragment(SWIG_AsVal_frag(bool),"header",
+ fragment=SWIG_AsVal_frag(long)) {
+SWIGINTERN
+int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
+{
+ if(!obj->IsBoolean()) {
+ return SWIG_ERROR;
+ }
+
+ if (val) *val = obj->BooleanValue();
+ return SWIG_OK;
+}
+}
-%typemap(out) const bool &, bool &
-%{ $result = v8::Boolean::New((*$1);%}
+%fragment(SWIG_From_frag(int),"header") {
+SWIGINTERNINLINE
+v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
+{
+ return v8::Int32::New(value);
+}
+}
-%typemap(out) const char &, char &,
- const signed char &, signed char &,
- const unsigned char &, unsigned char &,
- const short &, short &,
- const unsigned short &, unsigned short &,
- const int &, int &
-%{ $result = v8::Int32::New((*$1);%}
-
-%typemap(out) const unsigned int &, unsigned int &,
- const long &, long &,
- const unsigned long &, unsigned long &,
- const long long &, long long &,
- const unsigned long long &, unsigned long long &
-%{ $result = v8::UInt32::New(*$1);%}
+%fragment(SWIG_From_frag(long),"header") {
+SWIGINTERNINLINE
+v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
+{
+ return v8::Integer::New(value);
+}
+}
-%typemap(out) const float &, float &,
- const double &, double &
-%{ $result = v8::Number::New(*$1);%}
+%fragment(SWIG_AsVal_frag(long),"header",
+ fragment="SWIG_CanCastAsInteger") {
+SWIGINTERN
+int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
+{
+ if (!obj->IsInteger()) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = (long) obj->IntegerValue();
+
+ return SWIG_OK;
+}
+}
-%typemap(in) short *,
- unsigned short *,
- int *,
- unsigned int *,
- long *,
- unsigned long *,
- long long *,
- unsigned long long *,
- float *,
- double *
-%{
- // TODO: typemap(in): short* et al.
-%}
+/* unsigned long */
+%fragment(SWIG_From_frag(unsigned long),"header",
+ fragment=SWIG_From_frag(long)) {
+SWIGINTERNINLINE
+v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
+{
+ return (value > LONG_MAX) ?
+ v8::Integer::NewFromUnsigned(value) : v8::Integer::New(%numeric_cast(value,long));
+}
+}
-%typemap(out) short *,
- unsigned short *,
- int *,
- unsigned int *,
- long *,
- unsigned long *,
- long long *,
- unsigned long long *,
- float *,
- double *
-%{
- // TODO: typemap(out) short* et al.
-%}
+%fragment(SWIG_AsVal_frag(unsigned long),"header",
+ fragment="SWIG_CanCastAsInteger") {
+SWIGINTERN
+int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
+{
+ if(!obj->IsNumber()) {
+ return SWIG_TypeError;
+ }
+
+ long longVal = (long) obj->NumberValue();
+
+ if(longVal < 0) {
+ return SWIG_OverflowError;
+ }
+
+ if(val) *val = longVal;
+
+ return SWIG_OK;
+}
+}
-%typemap(out) void
-%{ $result = v8::Undefined(); %}
+%fragment(SWIG_From_frag(double),"header") {
+SWIGINTERN
+v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
+{
+ return v8::Number::New(val);
+}
+}
+%fragment(SWIG_AsVal_frag(double),"header") {
+SWIGINTERN
+int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
+{
+ if(!obj->IsNumber()) {
+ return SWIG_TypeError;
+ }
+ if(val) *val = obj->NumberValue();
+
+ return SWIG_OK;
+}
+}
%typemap(in) char *
%{
@@ -121,81 +111,3 @@
$1 = *_$1;
%}
-%typemap(out) char *
-%{
- // TODO: output typemap for char*
-%}
-
-%typemap(in) char *& ($*1_ltype temp = 0) %{
- // TODO: input typemap for char*&
-%}
-
-%typemap(out) char *&
-%{
- // TODO: output typemap for char*&
-%}
-
-/* char arrays - treat as String */
-%typemap(in) char[ANY], char[] %{
- // TODO: input typemap for char[]
-%}
-
-%typemap(out) char[ANY], char[]
-%{
- // TODO: output typemap for char[]
-%}
-
-%typemap(freearg) char *, char *&, char[ANY], char[] //TODO: Not working: A memory leak
-%{
- // TODO: freearg char* et al
-%}
-
-/* Typemaps for composite types */
-%typemap(in) SWIGTYPE ($&1_type argp) // Objects passed by value, convert to a pointer
-%{
- // TODO: input typemap for composite types
-%}
-
-%typemap(out) SWIGTYPE ($&1_type temp)
-%{
- // TODO: output typemap for composite types
-%}
-
-%typemap(in) SWIGTYPE *, SWIGTYPE &
-%{
- // TODO: input typemap for ptr types
-%}
-
-%typemap(out) SWIGTYPE *, SWIGTYPE &
-%{
- // TODO: output typemap for ptr types
-%}
-
-// TODO: sanity check?
-%typemap(arginit) SWIGTYPE *
-%{%}
-
-%typemap(in) SWIGTYPE (CLASS::*) ""
-
-%typemap(out) SWIGTYPE (CLASS::*)
-%{
- // TODO: output typemap for CLASS::*
-%}
-
-// Default array handling
-%typemap(in) SWIGTYPE [] %{
- // TODO: typemap for arrays;
-%}
-
-%typemap(out) SWIGTYPE [] %{ $result = $1; %}
-
-// Some ANSI C typemaps */
-%apply unsigned long { size_t };
-
-%apply const unsigned long & { const size_t & };
-
-// Array reference typemaps
-%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
-
-// const pointers
-%apply SWIGTYPE * { SWIGTYPE *const }
diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg
index ad34b6df2..4440fa6d6 100644
--- a/Lib/javascript/v8/javascriptruntime.swg
+++ b/Lib/javascript/v8/javascriptruntime.swg
@@ -7,3 +7,93 @@
%insert(runtime) %{
#include <v8.h>
%}
+
+%insert(runtime) "swigrun.swg"; /* SWIG API */
+%insert(runtime) "swigerrors.swg"; /* SWIG errors */
+
+%insert(runtime) %{
+#define SWIG_Error(code, msg) SWIG_V8_exception(code, msg)
+#define SWIG_exception(code, msg) SWIG_V8_exception(code, msg)
+#define SWIG_fail goto fail
+%}
+
+%insert(runtime) %{
+typedef struct {
+ bool swigCMemOwn;
+ void *swigCObject;
+ swig_type_info *info;
+}SWIG_PRV_DATA;
+%}
+
+%insert(runtime) %{
+
+void SWIG_V8_Raise(const char* type) {
+ // TODO: throw v8 exception
+}
+
+void SWIG_V8_exception(int code, const char* msg) {
+ SWIG_V8_Raise(msg);
+}
+
+%}
+
+
+%insert(runtime) %{
+int SWIG_JSC_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void** ptr, swig_type_info *info, int flags) {
+
+ if(objRef->InternalFieldCount() < 1) {
+ return SWIG_ERROR;
+ }
+ Handle<Value> cdataRef = objRef->GetInternalField(0);
+
+ SWIG_PRV_DATA *cdata = (SWIG_PRV_DATA *) v8::External::Unwrap(cdataRef);
+ if(cdata == NULL) {
+ return SWIG_ERROR;
+ }
+
+ if(cdata->info != info) {
+ bool type_valid = false;
+ swig_cast_info *t = info->cast;
+ while(t != NULL) {
+ if(t->type == cdata->info) {
+ type_valid = true;
+ break;
+ }
+ t = t->next;
+ }
+ if(!type_valid) {
+ return SWIG_TypeError;
+ }
+ }
+
+ *ptr = cdata->swigCObject;
+
+ if(flags & SWIG_POINTER_DISOWN) {
+ cdata->swigCMemOwn = false;
+ }
+
+ return SWIG_OK;
+}
+
+int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void** ptr, swig_type_info *info, int flags) {
+ if(!valRef->IsObject()) {
+ return SWIG_TypeError;
+ }
+
+ v8::Handle<v8::object> objRef = valRef->ToObject();
+
+ return SWIG_V8_ConvertInstancePtr(context, objRef, ptr, info, flags);
+}
+
+v8::Handle<v8::Object> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
+ // TODO: wrap ptr into an v8 object
+ return 0;
+}
+
+#define SWIG_ConvertPtr(obj, ptr, info, flags) SWIG_V8_ConvertPtr(obj, ptr, info, flags)
+#define SWIG_NewPointerObj(ptr, info, flags) SWIG_V8_NewPointerObj(ptr, info, flags)
+
+#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_V8_ConvertInstancePtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(thisvalue, type, flags) SWIG_V8_NewPointerObj(thisvalue, type, flags)
+
+%}
diff --git a/Lib/javascript/v8/javascripttypemaps.swg b/Lib/javascript/v8/javascripttypemaps.swg
new file mode 100644
index 000000000..479a1f076
--- /dev/null
+++ b/Lib/javascript/v8/javascripttypemaps.swg
@@ -0,0 +1,16 @@
+#define SWIG_Object v8::Handle<v8::Value>
+#define VOID_Object v8::Undefined()
+#define SWIG_AppendOutput(result, obj)
+#define SWIG_SetConstant(name, obj)
+#define SWIG_Raise(obj, type, desc) SWIG_V8_Raise(type)
+
+/* Include fundamental fragemt definitions */
+%include <typemaps/fragments.swg>
+
+/* Python fragments for fundamental types */
+%include <javascriptprimitives.swg>
+
+%include <javascriptstrings.swg>
+
+/* Include the unified typemap library */
+%include <typemaps/swigtypemaps.swg>
diff --git a/Lib/javascript/v8/std_common.i b/Lib/javascript/v8/std_common.i
new file mode 100755
index 000000000..cee11e8ca
--- /dev/null
+++ b/Lib/javascript/v8/std_common.i
@@ -0,0 +1,5 @@
+%include <std_except.i>
+
+%apply size_t { std::size_t };
+%apply const size_t& { const std::size_t& };
+
diff --git a/Lib/javascript/v8/std_complex.i b/Lib/javascript/v8/std_complex.i
new file mode 100644
index 000000000..088a4fe7b
--- /dev/null
+++ b/Lib/javascript/v8/std_complex.i
@@ -0,0 +1,19 @@
+/*
+ * STD C++ complex typemaps
+ */
+
+%include <javascriptcomplex.swg>
+
+%{
+#include <complex>
+%}
+
+/* defining the complex as/from converters */
+
+%swig_cplxdbl_convn(std::complex<double>, std::complex<double>, std::real, std::imag)
+%swig_cplxflt_convn(std::complex<float>, std::complex<float>, std::real, std::imag)
+
+/* defining the typemaps */
+
+%typemaps_primitive(%checkcode(CPLXDBL), std::complex<double>);
+%typemaps_primitive(%checkcode(CPLXFLT), std::complex<float>);
diff --git a/Lib/javascript/v8/std_except.i b/Lib/javascript/v8/std_except.i
new file mode 100644
index 000000000..af98428f6
--- /dev/null
+++ b/Lib/javascript/v8/std_except.i
@@ -0,0 +1 @@
+%include <typemaps/std_except.swg>
diff --git a/Lib/javascript/v8/std_map.i b/Lib/javascript/v8/std_map.i
new file mode 100755
index 000000000..e7812f38a
--- /dev/null
+++ b/Lib/javascript/v8/std_map.i
@@ -0,0 +1,74 @@
+/* -----------------------------------------------------------------------------
+ * std_map.i
+ *
+ * SWIG typemaps for std::map
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::map
+// ------------------------------------------------------------------------
+
+%{
+#include <map>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+// exported class
+
+namespace std {
+
+ template<class K, class T> class map {
+ // add typemaps here
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef K key_type;
+ typedef T mapped_type;
+ map();
+ map(const map<K,T> &);
+
+ unsigned int size() const;
+ bool empty() const;
+ void clear();
+ %extend {
+ const T& get(const K& key) throw (std::out_of_range) {
+ std::map<K,T >::iterator i = self->find(key);
+ if (i != self->end())
+ return i->second;
+ else
+ throw std::out_of_range("key not found");
+ }
+ void set(const K& key, const T& x) {
+ (*self)[key] = x;
+ }
+ void del(const K& key) throw (std::out_of_range) {
+ std::map<K,T >::iterator i = self->find(key);
+ if (i != self->end())
+ self->erase(i);
+ else
+ throw std::out_of_range("key not found");
+ }
+ bool has_key(const K& key) {
+ std::map<K,T >::iterator i = self->find(key);
+ return i != self->end();
+ }
+ }
+ };
+
+// Legacy macros (deprecated)
+%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
+#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
+%enddef
+
+%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
+#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
+%enddef
+
+%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
+#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
+%enddef
+
+}
diff --git a/Lib/javascript/v8/std_pair.i b/Lib/javascript/v8/std_pair.i
new file mode 100755
index 000000000..fe45ee676
--- /dev/null
+++ b/Lib/javascript/v8/std_pair.i
@@ -0,0 +1,34 @@
+/* -----------------------------------------------------------------------------
+ * std_pair.i
+ *
+ * SWIG typemaps for std::pair
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+%include <exception.i>
+
+// ------------------------------------------------------------------------
+// std::pair
+// ------------------------------------------------------------------------
+
+%{
+#include <utility>
+%}
+
+namespace std {
+
+ template<class T, class U> struct pair {
+
+ pair();
+ pair(T first, U second);
+ pair(const pair& p);
+
+ template <class U1, class U2> pair(const pair<U1, U2> &p);
+
+ T first;
+ U second;
+ };
+
+ // add specializations here
+
+}
diff --git a/Lib/javascript/v8/std_vector.i b/Lib/javascript/v8/std_vector.i
new file mode 100755
index 000000000..3f29b19c7
--- /dev/null
+++ b/Lib/javascript/v8/std_vector.i
@@ -0,0 +1,85 @@
+/* -----------------------------------------------------------------------------
+ * std_vector.i
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+%{
+#include <vector>
+#include <stdexcept>
+%}
+
+namespace std {
+
+ template<class T> class vector {
+ public:
+ typedef size_t size_type;
+ typedef T value_type;
+ typedef const value_type& const_reference;
+ vector();
+ vector(size_type n);
+ size_type size() const;
+ size_type capacity() const;
+ void reserve(size_type n);
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ %rename(add) push_back;
+ void push_back(const value_type& x);
+ %extend {
+ const_reference get(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ void set(int i, const value_type& val) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ (*self)[i] = val;
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+ };
+
+ // bool specialization
+ template<> class vector<bool> {
+ public:
+ typedef size_t size_type;
+ typedef bool value_type;
+ typedef bool const_reference;
+ vector();
+ vector(size_type n);
+ size_type size() const;
+ size_type capacity() const;
+ void reserve(size_type n);
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ %rename(add) push_back;
+ void push_back(const value_type& x);
+ %extend {
+ const_reference get(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ return (*self)[i];
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ void set(int i, const value_type& val) throw (std::out_of_range) {
+ int size = int(self->size());
+ if (i>=0 && i<size)
+ (*self)[i] = val;
+ else
+ throw std::out_of_range("vector index out of range");
+ }
+ }
+ };
+}
+
+%define specialize_std_vector(T)
+#warning "specialize_std_vector - specialization for type T no longer needed"
+%enddef
+
diff --git a/Lib/javascript/v8/stl.i b/Lib/javascript/v8/stl.i
new file mode 100755
index 000000000..04f86014f
--- /dev/null
+++ b/Lib/javascript/v8/stl.i
@@ -0,0 +1,10 @@
+/* -----------------------------------------------------------------------------
+ * stl.i
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+%include <std_string.i>
+%include <std_vector.i>
+%include <std_map.i>
+%include <std_pair.i>
+