summaryrefslogtreecommitdiff
path: root/Examples/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/javascript')
-rw-r--r--[-rwxr-xr-x]Examples/javascript/class/Makefile2
-rw-r--r--Examples/javascript/class/binding.gyp8
-rw-r--r--Examples/javascript/class/binding.gyp.in9
-rw-r--r--[-rwxr-xr-x]Examples/javascript/class/example.cxx12
-rw-r--r--[-rwxr-xr-x]Examples/javascript/class/example.h18
-rw-r--r--[-rwxr-xr-x]Examples/javascript/class/example.i1
-rw-r--r--Examples/javascript/class/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/class/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/constant/Makefile2
-rw-r--r--Examples/javascript/constant/binding.gyp8
-rw-r--r--Examples/javascript/constant/binding.gyp.in9
-rw-r--r--[-rwxr-xr-x]Examples/javascript/constant/example.i0
-rw-r--r--Examples/javascript/constant/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/constant/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/enum/Makefile2
-rw-r--r--Examples/javascript/enum/binding.gyp8
-rw-r--r--Examples/javascript/enum/binding.gyp.in9
-rw-r--r--[-rwxr-xr-x]Examples/javascript/enum/example.cxx0
-rw-r--r--[-rwxr-xr-x]Examples/javascript/enum/example.h0
-rw-r--r--[-rwxr-xr-x]Examples/javascript/enum/example.i0
-rw-r--r--Examples/javascript/enum/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/enum/runme.js2
-rw-r--r--Examples/javascript/example.mk16
-rw-r--r--[-rwxr-xr-x]Examples/javascript/exception/Makefile2
-rw-r--r--Examples/javascript/exception/binding.gyp.in (renamed from Examples/javascript/exception/binding.gyp)3
-rw-r--r--Examples/javascript/exception/example.js2
-rw-r--r--Examples/javascript/exception/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/functor/Makefile4
-rw-r--r--Examples/javascript/functor/binding.gyp8
-rw-r--r--Examples/javascript/functor/binding.gyp.in9
-rw-r--r--Examples/javascript/functor/example.cxx0
-rw-r--r--Examples/javascript/functor/example.js2
-rw-r--r--Examples/javascript/functor/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/nspace/Makefile2
-rw-r--r--Examples/javascript/nspace/binding.gyp8
-rw-r--r--Examples/javascript/nspace/binding.gyp.in9
-rw-r--r--Examples/javascript/nspace/example.js2
-rw-r--r--Examples/javascript/nspace/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/operator/Makefile2
-rw-r--r--Examples/javascript/operator/binding.gyp8
-rw-r--r--Examples/javascript/operator/binding.gyp.in9
-rw-r--r--Examples/javascript/operator/example.js2
-rw-r--r--Examples/javascript/operator/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/overload/Makefile2
-rw-r--r--Examples/javascript/overload/binding.gyp8
-rw-r--r--Examples/javascript/overload/binding.gyp.in9
-rw-r--r--Examples/javascript/overload/example.js2
-rw-r--r--Examples/javascript/overload/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/pointer/Makefile2
-rw-r--r--Examples/javascript/pointer/binding.gyp8
-rw-r--r--Examples/javascript/pointer/binding.gyp.in9
-rw-r--r--[-rwxr-xr-x]Examples/javascript/pointer/example.cxx0
-rw-r--r--[-rwxr-xr-x]Examples/javascript/pointer/example.i0
-rw-r--r--Examples/javascript/pointer/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/pointer/runme.js2
-rw-r--r--Examples/javascript/pointer/typemaps.i0
-rw-r--r--[-rwxr-xr-x]Examples/javascript/reference/Makefile2
-rw-r--r--Examples/javascript/reference/binding.gyp8
-rw-r--r--Examples/javascript/reference/binding.gyp.in9
-rw-r--r--[-rwxr-xr-x]Examples/javascript/reference/example.cxx2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/reference/example.h8
-rw-r--r--[-rwxr-xr-x]Examples/javascript/reference/example.i2
-rw-r--r--Examples/javascript/reference/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/reference/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/simple/Makefile2
-rw-r--r--Examples/javascript/simple/binding.gyp8
-rw-r--r--Examples/javascript/simple/binding.gyp.in9
-rw-r--r--Examples/javascript/simple/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/simple/runme.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/template/Makefile2
-rw-r--r--Examples/javascript/template/binding.gyp8
-rw-r--r--Examples/javascript/template/binding.gyp.in9
-rw-r--r--Examples/javascript/template/example.js2
-rw-r--r--Examples/javascript/template/runme.js10
-rw-r--r--[-rwxr-xr-x]Examples/javascript/variables/Makefile2
-rw-r--r--Examples/javascript/variables/binding.gyp8
-rw-r--r--Examples/javascript/variables/binding.gyp.in9
-rw-r--r--[-rwxr-xr-x]Examples/javascript/variables/example.cxx4
-rw-r--r--[-rwxr-xr-x]Examples/javascript/variables/example.h0
-rw-r--r--[-rwxr-xr-x]Examples/javascript/variables/example.i0
-rw-r--r--Examples/javascript/variables/example.js2
-rw-r--r--[-rwxr-xr-x]Examples/javascript/variables/runme.js2
82 files changed, 186 insertions, 172 deletions
diff --git a/Examples/javascript/class/Makefile b/Examples/javascript/class/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/class/Makefile
+++ b/Examples/javascript/class/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/class/binding.gyp b/Examples/javascript/class/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/class/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/class/binding.gyp.in b/Examples/javascript/class/binding.gyp.in
new file mode 100644
index 000000000..cb2b45e8f
--- /dev/null
+++ b/Examples/javascript/class/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/class/example.cxx b/Examples/javascript/class/example.cxx
index e23fa6f73..046304519 100755..100644
--- a/Examples/javascript/class/example.cxx
+++ b/Examples/javascript/class/example.cxx
@@ -1,5 +1,5 @@
-/* File : example.c */
-#include <iostream>
+/* File : example.cxx */
+
#include "example.h"
#define M_PI 3.14159265358979323846
@@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) {
int Shape::nshapes = 0;
-double Circle::area(void) {
+double Circle::area() {
return M_PI*radius*radius;
}
-double Circle::perimeter(void) {
+double Circle::perimeter() {
return 2*M_PI*radius;
}
-double Square::area(void) {
+double Square::area() {
return width*width;
}
-double Square::perimeter(void) {
+double Square::perimeter() {
return 4*width;
}
diff --git a/Examples/javascript/class/example.h b/Examples/javascript/class/example.h
index 64b7684fa..642130cd0 100755..100644
--- a/Examples/javascript/class/example.h
+++ b/Examples/javascript/class/example.h
@@ -7,11 +7,11 @@ public:
}
virtual ~Shape() {
nshapes--;
- };
+ }
double x, y;
void move(double dx, double dy);
- virtual double area(void) = 0;
- virtual double perimeter(void) = 0;
+ virtual double area() = 0;
+ virtual double perimeter() = 0;
static int nshapes;
};
@@ -19,16 +19,16 @@ class Circle : public Shape {
private:
double radius;
public:
- Circle(double r) : radius(r) { };
- virtual double area(void);
- virtual double perimeter(void);
+ Circle(double r) : radius(r) { }
+ virtual double area();
+ virtual double perimeter();
};
class Square : public Shape {
private:
double width;
public:
- Square(double w) : width(w) { };
- virtual double area(void);
- virtual double perimeter(void);
+ Square(double w) : width(w) { }
+ virtual double area();
+ virtual double perimeter();
};
diff --git a/Examples/javascript/class/example.i b/Examples/javascript/class/example.i
index 75700b305..fbdf7249f 100755..100644
--- a/Examples/javascript/class/example.i
+++ b/Examples/javascript/class/example.i
@@ -7,4 +7,3 @@
/* Let's just grab the original header file here */
%include "example.h"
-
diff --git a/Examples/javascript/class/example.js b/Examples/javascript/class/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/class/example.js
+++ b/Examples/javascript/class/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/class/runme.js b/Examples/javascript/class/runme.js
index e1d5d9797..6a77b8d8e 100755..100644
--- a/Examples/javascript/class/runme.js
+++ b/Examples/javascript/class/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
// ----- Object creation -----
diff --git a/Examples/javascript/constant/Makefile b/Examples/javascript/constant/Makefile
index ea04c7df8..0402f8d09 100755..100644
--- a/Examples/javascript/constant/Makefile
+++ b/Examples/javascript/constant/Makefile
@@ -1,3 +1,3 @@
SRCS =
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/constant/binding.gyp b/Examples/javascript/constant/binding.gyp
deleted file mode 100644
index 69af46b22..000000000
--- a/Examples/javascript/constant/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/constant/binding.gyp.in b/Examples/javascript/constant/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/constant/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/constant/example.i b/Examples/javascript/constant/example.i
index a6d28e7c9..a6d28e7c9 100755..100644
--- a/Examples/javascript/constant/example.i
+++ b/Examples/javascript/constant/example.i
diff --git a/Examples/javascript/constant/example.js b/Examples/javascript/constant/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/constant/example.js
+++ b/Examples/javascript/constant/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/constant/runme.js b/Examples/javascript/constant/runme.js
index f4b55881e..f29d1a850 100755..100644
--- a/Examples/javascript/constant/runme.js
+++ b/Examples/javascript/constant/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
console.log("ICONST = " + example.ICONST + " (should be 42)");
console.log("FCONST = " + example.FCONST + " (should be 2.1828)");
diff --git a/Examples/javascript/enum/Makefile b/Examples/javascript/enum/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/enum/Makefile
+++ b/Examples/javascript/enum/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/enum/binding.gyp b/Examples/javascript/enum/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/enum/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/enum/binding.gyp.in b/Examples/javascript/enum/binding.gyp.in
new file mode 100644
index 000000000..cb2b45e8f
--- /dev/null
+++ b/Examples/javascript/enum/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/enum/example.cxx b/Examples/javascript/enum/example.cxx
index 6785e57ac..6785e57ac 100755..100644
--- a/Examples/javascript/enum/example.cxx
+++ b/Examples/javascript/enum/example.cxx
diff --git a/Examples/javascript/enum/example.h b/Examples/javascript/enum/example.h
index 9119cd9fc..9119cd9fc 100755..100644
--- a/Examples/javascript/enum/example.h
+++ b/Examples/javascript/enum/example.h
diff --git a/Examples/javascript/enum/example.i b/Examples/javascript/enum/example.i
index 23ee8a822..23ee8a822 100755..100644
--- a/Examples/javascript/enum/example.i
+++ b/Examples/javascript/enum/example.i
diff --git a/Examples/javascript/enum/example.js b/Examples/javascript/enum/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/enum/example.js
+++ b/Examples/javascript/enum/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/enum/runme.js b/Examples/javascript/enum/runme.js
index d4e89e8c8..851d43c4b 100755..100644
--- a/Examples/javascript/enum/runme.js
+++ b/Examples/javascript/enum/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
// ----- Object creation -----
diff --git a/Examples/javascript/example.mk b/Examples/javascript/example.mk
index 274eff1a3..cb8a33efd 100644
--- a/Examples/javascript/example.mk
+++ b/Examples/javascript/example.mk
@@ -7,21 +7,27 @@ else
JSENGINE=node
endif
+ifneq (, $(V8_VERSION))
+ JSV8_VERSION=$(V8_VERSION)
+else
+ JSV8_VERSION=0x031110
+endif
+
EXAMPLES_TOP=../..
SWIG_TOP=../../..
SWIG = $(SWIG_TOP)/preinst-swig
TARGET = example
INTERFACE = example.i
-SWIGOPT=-$(JSENGINE)
+SWIGOPT=-$(JSENGINE) -DV8_VERSION=$(JSV8_VERSION)
check: build
- $(MAKE) -f $(EXAMPLES_TOP)/Makefile JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run
build:
- $(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper_cpp
- $(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' JSENGINE='$(JSENGINE)' javascript_build_cpp
clean:
- $(MAKE) -f $(EXAMPLES_TOP)/Makefile javascript_clean
+ $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' javascript_clean
diff --git a/Examples/javascript/exception/Makefile b/Examples/javascript/exception/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/exception/Makefile
+++ b/Examples/javascript/exception/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/exception/binding.gyp b/Examples/javascript/exception/binding.gyp.in
index 2be0a17a2..2e97d9757 100644
--- a/Examples/javascript/exception/binding.gyp
+++ b/Examples/javascript/exception/binding.gyp.in
@@ -2,7 +2,8 @@
"targets": [
{
"target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ],
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"],
'defines': [
'BUILDING_NODE_EXTENSION=1',
],
diff --git a/Examples/javascript/exception/example.js b/Examples/javascript/exception/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/exception/example.js
+++ b/Examples/javascript/exception/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/exception/runme.js b/Examples/javascript/exception/runme.js
index 977f51ebc..43ce66d6d 100644
--- a/Examples/javascript/exception/runme.js
+++ b/Examples/javascript/exception/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
console.log("Trying to catch some exceptions.");
t = new example.Test();
diff --git a/Examples/javascript/functor/Makefile b/Examples/javascript/functor/Makefile
index 31846faae..0402f8d09 100755..100644
--- a/Examples/javascript/functor/Makefile
+++ b/Examples/javascript/functor/Makefile
@@ -1,3 +1,3 @@
-SRCS = example.cxx
+SRCS =
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/functor/binding.gyp b/Examples/javascript/functor/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/functor/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/functor/binding.gyp.in b/Examples/javascript/functor/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/functor/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/functor/example.cxx b/Examples/javascript/functor/example.cxx
deleted file mode 100644
index e69de29bb..000000000
--- a/Examples/javascript/functor/example.cxx
+++ /dev/null
diff --git a/Examples/javascript/functor/example.js b/Examples/javascript/functor/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/functor/example.js
+++ b/Examples/javascript/functor/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/functor/runme.js b/Examples/javascript/functor/runme.js
index dc12470f4..28dc64320 100644
--- a/Examples/javascript/functor/runme.js
+++ b/Examples/javascript/functor/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
a = new example.intSum(0);
b = new example.doubleSum(100.0);
diff --git a/Examples/javascript/nspace/Makefile b/Examples/javascript/nspace/Makefile
index ea04c7df8..0402f8d09 100755..100644
--- a/Examples/javascript/nspace/Makefile
+++ b/Examples/javascript/nspace/Makefile
@@ -1,3 +1,3 @@
SRCS =
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/nspace/binding.gyp b/Examples/javascript/nspace/binding.gyp
deleted file mode 100644
index 69af46b22..000000000
--- a/Examples/javascript/nspace/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/nspace/binding.gyp.in b/Examples/javascript/nspace/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/nspace/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/nspace/example.js b/Examples/javascript/nspace/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/nspace/example.js
+++ b/Examples/javascript/nspace/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/nspace/runme.js b/Examples/javascript/nspace/runme.js
index d6a49d8d4..fad73477d 100644
--- a/Examples/javascript/nspace/runme.js
+++ b/Examples/javascript/nspace/runme.js
@@ -3,7 +3,7 @@
// This file illustrates class C++ interface generated
// by SWIG.
-var example = require("./example");
+var example = require("example");
// Calling a module function ( aka global function )
if (example.module_function() !== 7) {
diff --git a/Examples/javascript/operator/Makefile b/Examples/javascript/operator/Makefile
index ea04c7df8..0402f8d09 100755..100644
--- a/Examples/javascript/operator/Makefile
+++ b/Examples/javascript/operator/Makefile
@@ -1,3 +1,3 @@
SRCS =
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/operator/binding.gyp b/Examples/javascript/operator/binding.gyp
deleted file mode 100644
index 69af46b22..000000000
--- a/Examples/javascript/operator/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/operator/binding.gyp.in b/Examples/javascript/operator/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/operator/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/operator/example.js b/Examples/javascript/operator/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/operator/example.js
+++ b/Examples/javascript/operator/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/operator/runme.js b/Examples/javascript/operator/runme.js
index a700918d6..f72ca1c28 100644
--- a/Examples/javascript/operator/runme.js
+++ b/Examples/javascript/operator/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
a = new example.Complex(2,3);
b = new example.Complex(-5,10);
diff --git a/Examples/javascript/overload/Makefile b/Examples/javascript/overload/Makefile
index ea04c7df8..0402f8d09 100755..100644
--- a/Examples/javascript/overload/Makefile
+++ b/Examples/javascript/overload/Makefile
@@ -1,3 +1,3 @@
SRCS =
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/overload/binding.gyp b/Examples/javascript/overload/binding.gyp
deleted file mode 100644
index 69af46b22..000000000
--- a/Examples/javascript/overload/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/overload/binding.gyp.in b/Examples/javascript/overload/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/overload/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/overload/example.js b/Examples/javascript/overload/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/overload/example.js
+++ b/Examples/javascript/overload/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/overload/runme.js b/Examples/javascript/overload/runme.js
index 1e6c861a6..1c23e3b6b 100644
--- a/Examples/javascript/overload/runme.js
+++ b/Examples/javascript/overload/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
example.f();
example.f(1);
diff --git a/Examples/javascript/pointer/Makefile b/Examples/javascript/pointer/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/pointer/Makefile
+++ b/Examples/javascript/pointer/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/pointer/binding.gyp b/Examples/javascript/pointer/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/pointer/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/pointer/binding.gyp.in b/Examples/javascript/pointer/binding.gyp.in
new file mode 100644
index 000000000..cb2b45e8f
--- /dev/null
+++ b/Examples/javascript/pointer/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/pointer/example.cxx b/Examples/javascript/pointer/example.cxx
index 8762329fe..8762329fe 100755..100644
--- a/Examples/javascript/pointer/example.cxx
+++ b/Examples/javascript/pointer/example.cxx
diff --git a/Examples/javascript/pointer/example.i b/Examples/javascript/pointer/example.i
index 38c67d7d2..38c67d7d2 100755..100644
--- a/Examples/javascript/pointer/example.i
+++ b/Examples/javascript/pointer/example.i
diff --git a/Examples/javascript/pointer/example.js b/Examples/javascript/pointer/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/pointer/example.js
+++ b/Examples/javascript/pointer/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/pointer/runme.js b/Examples/javascript/pointer/runme.js
index fb8cf0c74..e9fa9a0bc 100755..100644
--- a/Examples/javascript/pointer/runme.js
+++ b/Examples/javascript/pointer/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
// First create some objects using the pointer library.
console.log("Testing the pointer library");
diff --git a/Examples/javascript/pointer/typemaps.i b/Examples/javascript/pointer/typemaps.i
deleted file mode 100644
index e69de29bb..000000000
--- a/Examples/javascript/pointer/typemaps.i
+++ /dev/null
diff --git a/Examples/javascript/reference/Makefile b/Examples/javascript/reference/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/reference/Makefile
+++ b/Examples/javascript/reference/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/reference/binding.gyp b/Examples/javascript/reference/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/reference/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/reference/binding.gyp.in b/Examples/javascript/reference/binding.gyp.in
new file mode 100644
index 000000000..cb2b45e8f
--- /dev/null
+++ b/Examples/javascript/reference/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/reference/example.cxx b/Examples/javascript/reference/example.cxx
index 8a513bf49..9dbaed2ee 100755..100644
--- a/Examples/javascript/reference/example.cxx
+++ b/Examples/javascript/reference/example.cxx
@@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) {
char *Vector::print() {
static char temp[512];
- sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);
+ sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z);
return temp;
}
diff --git a/Examples/javascript/reference/example.h b/Examples/javascript/reference/example.h
index 4915adb1b..bcfcfb72f 100755..100644
--- a/Examples/javascript/reference/example.h
+++ b/Examples/javascript/reference/example.h
@@ -4,8 +4,8 @@ class Vector {
private:
double x,y,z;
public:
- Vector() : x(0), y(0), z(0) { };
- Vector(double x, double y, double z) : x(x), y(y), z(z) { };
+ Vector() : x(0), y(0), z(0) { }
+ Vector(double x, double y, double z) : x(x), y(y), z(z) { }
friend Vector operator+(const Vector &a, const Vector &b);
char *print();
};
@@ -20,7 +20,3 @@ public:
Vector &operator[](int);
int size();
};
-
-
-
-
diff --git a/Examples/javascript/reference/example.i b/Examples/javascript/reference/example.i
index 1cf19c82c..173143d79 100755..100644
--- a/Examples/javascript/reference/example.i
+++ b/Examples/javascript/reference/example.i
@@ -29,7 +29,7 @@ public:
VectorArray(int maxsize);
~VectorArray();
int size();
-
+
/* This wrapper provides an alternative to the [] operator */
%extend {
Vector &get(int index) {
diff --git a/Examples/javascript/reference/example.js b/Examples/javascript/reference/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/reference/example.js
+++ b/Examples/javascript/reference/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/reference/runme.js b/Examples/javascript/reference/runme.js
index 88c108314..04f732520 100755..100644
--- a/Examples/javascript/reference/runme.js
+++ b/Examples/javascript/reference/runme.js
@@ -1,5 +1,5 @@
// This file illustrates the manipulation of C++ references in Javascript.
-var example = require("./example");
+var example = require("example");
// ----- Object creation -----
diff --git a/Examples/javascript/simple/Makefile b/Examples/javascript/simple/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/simple/Makefile
+++ b/Examples/javascript/simple/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/simple/binding.gyp b/Examples/javascript/simple/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/simple/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/simple/binding.gyp.in b/Examples/javascript/simple/binding.gyp.in
new file mode 100644
index 000000000..cb2b45e8f
--- /dev/null
+++ b/Examples/javascript/simple/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/simple/example.js b/Examples/javascript/simple/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/simple/example.js
+++ b/Examples/javascript/simple/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/simple/runme.js b/Examples/javascript/simple/runme.js
index be2c18669..4abff0e2a 100755..100644
--- a/Examples/javascript/simple/runme.js
+++ b/Examples/javascript/simple/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
/* Call our gcd() function */
diff --git a/Examples/javascript/template/Makefile b/Examples/javascript/template/Makefile
index ea04c7df8..0402f8d09 100755..100644
--- a/Examples/javascript/template/Makefile
+++ b/Examples/javascript/template/Makefile
@@ -1,3 +1,3 @@
SRCS =
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/template/binding.gyp b/Examples/javascript/template/binding.gyp
deleted file mode 100644
index 69af46b22..000000000
--- a/Examples/javascript/template/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/template/binding.gyp.in b/Examples/javascript/template/binding.gyp.in
new file mode 100644
index 000000000..59779aef4
--- /dev/null
+++ b/Examples/javascript/template/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/template/example.js b/Examples/javascript/template/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/template/example.js
+++ b/Examples/javascript/template/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/template/runme.js b/Examples/javascript/template/runme.js
index 55894dfd5..6a29fa77c 100644
--- a/Examples/javascript/template/runme.js
+++ b/Examples/javascript/template/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
//Call some templated functions
console.log(example.maxint(3,7));
@@ -9,20 +9,20 @@ console.log(example.maxdouble(3.14,2.18));
iv = new example.vecint(100);
dv = new example.vecdouble(1000);
-for(i=0;i<=100;i++)
+for(i=0;i<100;i++)
iv.setitem(i,2*i);
-for(i=0;i<=1000;i++)
+for(i=0;i<1000;i++)
dv.setitem(i, 1.0/(i+1));
sum = 0;
-for(i=0;i<=100;i++)
+for(i=0;i<100;i++)
sum = sum + iv.getitem(i);
console.log(sum);
sum = 0.0;
-for(i=0;i<=1000;i++)
+for(i=0;i<1000;i++)
sum = sum + dv.getitem(i);
console.log(sum);
diff --git a/Examples/javascript/variables/Makefile b/Examples/javascript/variables/Makefile
index 31846faae..54a8f7b03 100755..100644
--- a/Examples/javascript/variables/Makefile
+++ b/Examples/javascript/variables/Makefile
@@ -1,3 +1,3 @@
SRCS = example.cxx
-include ../example.mk
+include $(SRCDIR)../example.mk
diff --git a/Examples/javascript/variables/binding.gyp b/Examples/javascript/variables/binding.gyp
deleted file mode 100644
index 54eebfaa0..000000000
--- a/Examples/javascript/variables/binding.gyp
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "targets": [
- {
- "target_name": "example",
- "sources": [ "example.cxx", "example_wrap.cxx" ]
- }
- ]
-}
diff --git a/Examples/javascript/variables/binding.gyp.in b/Examples/javascript/variables/binding.gyp.in
new file mode 100644
index 000000000..cb2b45e8f
--- /dev/null
+++ b/Examples/javascript/variables/binding.gyp.in
@@ -0,0 +1,9 @@
+{
+ "targets": [
+ {
+ "target_name": "example",
+ "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ],
+ "include_dirs": ["$srcdir"]
+ }
+ ]
+}
diff --git a/Examples/javascript/variables/example.cxx b/Examples/javascript/variables/example.cxx
index f10390a9e..15314b383 100755..100644
--- a/Examples/javascript/variables/example.cxx
+++ b/Examples/javascript/variables/example.cxx
@@ -57,9 +57,9 @@ void print_vars() {
printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar);
- printf("iptrvar = %p\n", iptrvar);
+ printf("iptrvar = %p\n", (void *)iptrvar);
printf("name = %s\n", name);
- printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
+ printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status);
}
diff --git a/Examples/javascript/variables/example.h b/Examples/javascript/variables/example.h
index 0f7e89594..0f7e89594 100755..100644
--- a/Examples/javascript/variables/example.h
+++ b/Examples/javascript/variables/example.h
diff --git a/Examples/javascript/variables/example.i b/Examples/javascript/variables/example.i
index 591b871ed..591b871ed 100755..100644
--- a/Examples/javascript/variables/example.i
+++ b/Examples/javascript/variables/example.i
diff --git a/Examples/javascript/variables/example.js b/Examples/javascript/variables/example.js
index 79cd3913f..2e7f83a06 100644
--- a/Examples/javascript/variables/example.js
+++ b/Examples/javascript/variables/example.js
@@ -1 +1 @@
-module.exports = require("./build/Release/example");
+module.exports = require("build/Release/example");
diff --git a/Examples/javascript/variables/runme.js b/Examples/javascript/variables/runme.js
index 537e17296..a2b5f791c 100755..100644
--- a/Examples/javascript/variables/runme.js
+++ b/Examples/javascript/variables/runme.js
@@ -1,4 +1,4 @@
-var example = require("./example");
+var example = require("example");
// Try to set the values of some global variables
example.ivar = 42;