Merged branch 'devel' from https://github.com/oliver----/swig-v8 (squashed commit):

commit fe10555229
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Mar 5 01:51:29 2014 +0100

    Add check to skip javascript test-suite if default interpreter is not installed.

commit 0e0ac02192
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Mar 5 01:50:46 2014 +0100

    Activate travis matrix for different Javascript interpreters.

commit 89610e984e
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Mar 5 01:39:26 2014 +0100

    Beautified Javascript module.

commit b5bc87667d
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Mar 5 01:10:55 2014 +0100

    Fix regressions.

    - Adapted to changes in UTL
    - Fixed detection of setters and getters.

commit a234542543
Merge: 8c05fe3 c99417a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Mar 5 01:09:26 2014 +0100

    Merge branch 'master' into tmp

    Conflicts:
    	.travis.yml
    	Examples/Makefile.in
    	Examples/test-suite/director_nspace.i
    	Examples/test-suite/nspace.i
    	Examples/test-suite/nspace_extend.i
    	Source/Modules/lang.cxx
    	configure.ac

commit 8c05fe37af
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Mar 4 22:55:32 2014 +0100

    Removed obsolete paragraph from Javascript documentation.

commit 924f373a2f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Mar 4 22:51:19 2014 +0100

    Fix pandoc filter.

    And add a script that helps to run pandoc with appropriate
    command line flags.

commit 6b82dff8f3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Mar 4 22:50:23 2014 +0100

    Minor tweaks in Javascript documentation.

commit 1a7e12911a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Mar 4 12:00:13 2014 +0100

    Adding a chapter about Javascript tests and examples.

commit a9b8b85c1c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Mar 4 11:00:26 2014 +0100

    Minor change in Javascript configuration.

commit dbd61e40e1
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Mar 4 10:41:35 2014 +0100

    Fix issues that were observed with newer JavascriptCore.

commit 70385842df
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 28 10:40:41 2014 +0100

    Add missing copy ctor for Javascript Code Template class.

commit b20b0f4e4b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Feb 27 01:02:06 2014 +0100

    Removed CMake.

    Started a separate project which acts as a CMake shell around SWIG.

commit 7e015e4acf
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 23:26:19 2014 +0100

    Fix regression in Javascript configuration.

commit 348cb2026e
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 22:56:31 2014 +0100

    Fix regressions in configuration of some Javascript examples.

commit 94869c9228
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 22:47:29 2014 +0100

    More gitignores filtering Javascript related files.

commit 424e3f4712
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 22:46:24 2014 +0100

    Fix custom javascript interpreter configuration for OSX.

commit 15f12d9b59
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 22:44:37 2014 +0100

    Make examples work with node.js and the custom interpreter.

commit b216a739c4
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 20:51:38 2014 +0100

    Introduced an extra Makefile for the custom javascript interpreter.

commit bf1606c0f9
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 11:10:09 2014 +0100

    Fix travis configuration.

commit 16a702c0aa
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 10:48:38 2014 +0100

    Added a comment.

commit e62c6126e9
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Feb 26 10:47:48 2014 +0100

    Fix regressions in Javascript example configuration.

commit 15550dab45
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Feb 25 20:16:15 2014 +0100

    Fix issue with strange constants under OSX.

    Receiving strange constant nodes before the real tree
    under OSX 10.8. Not so under Ubuntu 12.04.

commit 84ba91dc63
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 12:38:53 2014 +0100

    Some fixes in example section of Javascript documentation.

commit 1ffacaab5b
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 12:30:57 2014 +0100

    Add note about '-node' command line flag for Node.js code generation.

commit 462674ea11
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 12:28:06 2014 +0100

    Added examples to Javascript module documentation.

commit 3f22a3d639
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 11:37:40 2014 +0100

    Simplification in common javascript example Makefile.

commit 8e65414a76
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 11:37:15 2014 +0100

    Add an extra argument for enabling nodejs support.

    This is essentially using the v8 emitter plus setting a #define.

commit 7c1f66c29e
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 11:15:46 2014 +0100

    Add more notes about how to install node.

commit 48e7df8eb2
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 11:15:18 2014 +0100

    Better error message when no Javascript emitter is specified.

commit fd0e75843d
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 11:14:48 2014 +0100

    Deactivated broken JS examples.

commit 77ead7017c
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 20 11:13:57 2014 +0100

    Refactored configuration for javascript examples.

commit 8df34d54d0
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 13:21:52 2014 +0100

    Beginning to document v8 integration.

commit 05146e2aed
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 13:04:21 2014 +0100

    Documented extending Node.js and Webkit's Javascript engine.

commit 6847280272
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 09:02:37 2014 +0100

    Pandoc filter detects shell blocks when not explicitely given.

    Considered as shell if the first character is '$', as in

        $ swig -javascript

    Alternatively you can specify the class explicitely:

    ```shell
    swig -javascript
    ```

commit 1fca61c59a
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 09:00:04 2014 +0100

    Conitnued documenting the Javascript module.

commit 915b709433
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 00:02:05 2014 +0100

    Not a real change.

    Using a macro to reset JSEmitterStates for the sake of readability.

commit 8148b017f8
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 00:01:15 2014 +0100

    Add a pandoc filter to create compatible html.

commit e829ea601f
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 00:00:37 2014 +0100

    Add Javascript to chapters.

commit fa8b350cd6
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Fri Feb 14 00:00:12 2014 +0100

    More Javascript module documentation.

commit 02c55fc52f
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 13 21:18:06 2014 +0100

    Next iteration on creating a documentation for the Javascript module.

commit 1e34ecdc31
Author: Oliver Buchtala <oliver.buchtala@gmail.com>
Date:   Thu Feb 13 19:25:16 2014 +0100

    Next iteration on creating a documentation for the Javascript module.

commit 41ec3fb67e
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 27 02:54:42 2013 +0200

    Travis configuration for Javascript branch.

commit 48af60d829
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 27 02:46:11 2013 +0200

    Javascript examples.

commit ecf9f96079
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 27 02:45:22 2013 +0200

    Javascript documentation.

commit 00053169cd
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 27 02:44:53 2013 +0200

    CMake configuration.

commit 6a366cc050
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 27 03:23:37 2013 +0200

    Fix regression.

commit 6dcbbf07db
Merge: 4492a3d c2d3da2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 27 02:29:02 2013 +0200

    Conflicts:
    	.gitignore
    	.project
    	.travis.yml
    	Examples/Makefile.in
    	Examples/test-suite/director_nspace.i

commit c2d3da2eec
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 26 05:14:34 2013 +0200

    Fix test configuration.

commit 582bd29769
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 26 04:55:34 2013 +0200

    Trying to install former working version of nodejs.

commit 7adf93ef0f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 26 04:13:32 2013 +0200

    Fix test configuration for nodejs.

commit 335d926c44
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 24 03:56:19 2013 +0200

    Add stub std_deque.i files.

commit 51b36d1a1f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 24 03:55:51 2013 +0200

    Add non pretty printing function to Templates.

commit dc62a69775
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 24 03:55:10 2013 +0200

    Fix bug with typedefd function pointers.

commit 2efe63ebb2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 24 01:50:33 2013 +0200

    Add some test runners.

commit b9ecf75f17
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 24 01:50:13 2013 +0200

    Fix emitter for member pointer constants.

    However, I am not happy with the constant emitter in general.
    Should not return dynamic values but register constant wrappers statically.

commit 8bf966a65c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 24 01:47:13 2013 +0200

    Fix %nspace support and activated relevant tests.

commit d34a6da08c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 17 01:53:22 2013 +0200

    Disable warnings for some v8 test-cases.

commit b3c198ccee
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 22:28:14 2013 +0200

    Fix regression.

commit b99e8613ad
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 21:56:52 2013 +0200

    Bugfix in argument marshalling.

commit dd4ed7f3d6
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 11:46:52 2013 +0200

    Disable testcase 'typemap_variables' for v8.

    It uses output typemaps that are not compatible with the
    v8 API.

commit 0528fd3ac3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 11:46:00 2013 +0200

    Bugfix for Javascript generator.

commit 147cec70f1
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 04:54:57 2013 +0200

    Replace $symname in generated function wrappers.

commit eb9523b5ca
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 04:12:55 2013 +0200

    Add missing macros.

commit 3e28d1e28f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 04:12:42 2013 +0200

    Let v8 generated code include stdlib.h

commit b6426bde25
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 04:12:06 2013 +0200

    Add cdata.i typemaps.

commit 1f07195812
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 03:53:00 2013 +0200

    Rearrange generation of init block to have custom init code within the initializer body.

commit 80ce36c445
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 02:27:51 2013 +0200

    Make JSC inheritance definition more robust.

commit 973042302b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 01:57:55 2013 +0200

    Removed dead code.

commit bf416876dd
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 01:33:19 2013 +0200

    Bugfix for JSC %typemap(out) std::string&.

commit b7f827e42c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 01:23:03 2013 +0200

    Fix typemap declarations for (unsigned) long long.

commit 68eff3e81e
Merge: bb7bd50 018847b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 00:55:57 2013 +0200

    Merge branch 'devel' of github.com:oliver----/swig-v8 into devel

commit bb7bd50eab
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 16 00:55:43 2013 +0200

    Add support for IN/OUTPUT typemaps.

commit 018847b000
Merge: acfed20 325b544
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sun Sep 15 06:00:06 2013 -0700

    Merge pull request #28 from whoozle/devel

    fixed newer v8 compilation

commit 325b5445d6
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Sat Sep 14 16:19:47 2013 +0400

    removed Clear before Dispose from newer v8 code, consider the following code:
    template <class T>
    void Persistent<T>::Dispose() {
      if (this->IsEmpty()) return; //Clear will trigger this
      V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
      ...
    }

commit 89fd7ed9c1
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Sat Sep 14 16:17:21 2013 +0400

    fixed newer v8 compilation

commit 477b2393b1
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 12 05:26:22 2013 +0200

    Add stub 'typemaps.i' files.

commit acfed20eba
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 12 05:10:23 2013 +0200

    Bugfix Javascript generator: valid name for dispatcher functions.

commit 1a04e488bc
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 12 05:40:59 2013 +0300

    Fix Javascript generator for smartpointeraccessed variables.

commit 8bf95c4356
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 12 05:09:35 2013 +0300

    Bugfix for Javascript generator: avoid duplicate action code generation.

commit 09a210e037
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Sep 12 04:09:21 2013 +0300

    Bugfix in Javascript generator: detect member setter/getters correctly.

commit c53e3e4dab
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 10 14:45:33 2013 +0300

    Fix configuration for nodejs based tests.

    - use $(SWIGOPT)
    - less verbose

commit dd84e6f9e0
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 10 14:16:36 2013 +0300

    Some fixes and cleanup in Javascript generator.

    - v8 generator uses the correct mangled name for class templates
    - removed symbols for template variables in favor of using the string
      literals directly, as it is easier to understand when debugging.

commit 001f38c6a9
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 10 13:29:16 2013 +0300

    Fix settings for building nodejs tests.

    Removed the `-node` command line flag.
    Instead one has to use `-v8 -DBUILDING_NODE_EXTENSION=1`.

commit be35d94fdb
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 10 11:53:12 2013 +0300

    Add support for PackedData to Javascript generator.

commit e5ad9cdc05
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 22:26:30 2013 +0300

    Added two more Javascript tests.

    - `abstract_inherit`
    - `char_strings`

commit 571c516a0b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 22:25:51 2013 +0300

    Some fixes for the Javascript generator.

    - added missing `exception.i`
    - added missing generator block `wrappers` for v8

commit 3c5946d998
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 17:38:44 2013 +0300

    Redefined set of Javascript smoke tests.

commit 407d8ef5ac
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 17:34:53 2013 +0300

    Clean up in `javascripttypemaps.swg`.

    - following the same layout/order as pytypemaps
    - added typemaps for `long long` and `unsigned long long`, which are
      only copies of those for `long` and `unsigned long` and hence are
      just experimental.

commit fc4d9b665c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 16:28:29 2013 +0300

    Fix v8 generator to use a non clashing name for built-in 'equals' method.

commit b6c9c97b96
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 15:05:11 2013 +0300

    Fix Javascript generator to use %renamed variable names.

commit 108143951d
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 13:55:08 2013 +0300

    Activate Javascript test-cases `rename_simple` and `rename_scope`.

    These reveal current deficiencies in the Javascript generator with `%rename`ing.

commit 64da1173dd
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 13:23:47 2013 +0300

    Activate Javascript testcases `rename1-4`.

commit 1438d0cfb4
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 13:17:38 2013 +0300

    Add `infinity` test-case to list of smoke tests.

commit e01e337d75
Author: Eric Wing <ewing -dot- public |-at-| gmail.com>
Date:   Thu Sep 5 14:50:15 2013 -0700

    Added unit test using C99 INFINITY. This test actually tests a float
    conversion bug where converting to float imposed overflow checking which
    should not be there and causes this program to error out. This was seen
    originally in Javascript, but it turns out Python has the same bug. Lua
    does not have this bug. Other generators have not been tested.

    This test also tests the rename feature. The Javascript generator was
    not renaming the variable correctly.

commit 1729fac360
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Mon Sep 9 12:46:07 2013 +0300

    Bug-fix for static variables as proposed by Kota Iguchi.

    Fixes #20.

commit 8408e9b193
Merge: 6b35c2d b49da78
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 19:50:51 2013 -0700

    Merge pull request #19 from whoozle/devel

    fixed deprecation warnings for v8-3.21

commit 6b35c2d419
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 16:26:02 2013 +0300

    Let Travis test all three targets.

    - nodejs: 0.10.12
    - libwebgitgtk 1.0
    - libv8 3.7.12

    We should soon switch to a new v8 version or add an extra runner.

commit 0facc7ecf9
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 15:59:43 2013 +0300

    Allow to run the test suite with our list of smoke tests.

    The javascript generator can not deal with the whole test-suite.
    Moreover, during development I want to have immediate feedback using
    a set of smoke tests.

commit 492d3010ff
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 01:40:23 2013 +0300

    Javascript V8 test-cases always create cpp wrappers.

commit 26b5acbbe8
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 00:42:56 2013 +0300

    Test-suite Makefile now supports testing for all three Javascript variants.

    - node.js
    - custom JavascriptCore interpreter
    - custom V8 interpreter

commit 962207e0f3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 00:41:18 2013 +0300

    Rewritten Javascript autoconfiguration.

commit 29ccb270af
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 00:40:29 2013 +0300

    Renamed object provided to JS initializers.

    JSC initializer create a new module object.
    V8 initializer fill a provided 'exports' object.

commit 4794fa1884
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Sep 6 00:38:07 2013 +0300

    Refactored custom javascript engines to support primitive 'require' statements.

commit b49da78b0a
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Sep 5 19:50:15 2013 +0400

    fixed deprecation warnings for v8-3.21

commit 740da9c733
Merge: 8b0ee54 2a39abe
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 09:18:42 2013 -0700

    Merge pull request #17 from whoozle/devel

    fixed v8-3.20+ compilation and deprecation warnings.

commit 2a39abebb6
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Wed Sep 4 20:10:42 2013 +0400

    moved common swig v8 definitions in javascriptruntime.swg, fixed obsoleted api calls

commit 8b0ee5491a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 18:04:40 2013 +0200

    Added missing template configuration files for nodejs based tests.

commit 315287b656
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 17:55:44 2013 +0200

    Put the SWIG_V8_VERSION macro into "runtime" block.

commit 4068f31c6b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 17:54:35 2013 +0200

    Use a diffent name for the V8_VERSION provided via command line.

commit b7db2a84c9
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Wed Sep 4 19:33:48 2013 +0400

    fixed return values and added missing newer v8 dtor wrapper.

commit fec11a8def
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 13:07:07 2013 +0200

    Allow exceptions in generated example/test node extensions.

commit 54dd7e96c0
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 12:47:24 2013 +0200

    Fix cleanup configuration for javascript test-suite.

commit 8778146b4b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Sep 4 12:10:08 2013 +0200

    Relax type check in SWIG_AsVal_int.

    The array_member test-case revealed that integers
    come in as `Numbers`.

commit 0e78fc0ad7
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 18:50:46 2013 +0200

    Fixing travis configuration.

commit da48f3307f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 18:24:19 2013 +0200

    Remove javascript autoconf detection (Temporarily).

    I want to cut it down to a minimum having only nodejs.
    We will activate the others (native JSC and V8) later.

commit 262aca8ead
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 17:16:40 2013 +0200

    Fix in travis config.

commit 83e6aa85b6
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 17:13:38 2013 +0200

    Not a real change.

commit 0aabfeb231
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 17:07:49 2013 +0200

    Slight modification to travis config.

commit fa27ff2976
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 17:03:08 2013 +0200

    Add a travis configuration (experimental).

commit 8bbd928831
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 16:57:40 2013 +0200

    Make javascript test-suite work with nodejs.

commit cef82c720f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 14:41:35 2013 +0200

    Replace old style v8 version switches.

commit d3074ba4c1
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 14:02:52 2013 +0200

    Fix error in SWIG_V8_GetInstancePtr.

commit f70c0e16f2
Author: Kota Iguchi <infosia.jp@gmail.com>
Date:   Wed Aug 28 15:08:50 2013 +0900

    Add "equals" to compare between pointers
    Add "getCPtr" to retrieve pointer value

commit a29975c69a
Author: Kota Iguchi <infosia.jp@gmail.com>
Date:   Fri Aug 16 16:08:47 2013 +0900

    Typemap for natural support for arrays

commit 78a3cc9e3e
Author: Kota Iguchi <infosia.jp@gmail.com>
Date:   Fri Aug 16 10:15:37 2013 +0900

    Added the finalize callback (JSObjectFinalizeCallback)

commit 14a137adca
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 06:27:14 2013 +0200

    Fix regression.

commit 5da54ca435
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 06:26:54 2013 +0200

    Convert javascript examples to nodejs.

commit dbf2b1fe94
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 05:46:19 2013 +0200

    Ignore javascript Example build files.

commit 11e2179dd3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 05:40:22 2013 +0200

    First example that addresses node.js as primary execution environment.

commit a48438c562
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 05:39:37 2013 +0200

    Better v8 version handling.

    You should start to specify a version on command line, e.g.,

        swig -javascript -v8 -DSWIG_V8_VERSION=0x032007

commit 5228c0eeab
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 05:36:41 2013 +0200

    Add a dedicated mode for creating node modules.

commit 5aba4c7ea6
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Sep 3 05:35:03 2013 +0200

    Starting from scratch with Examples configuration.

commit cb5f4dc47e
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Aug 15 14:33:00 2013 +0400

    ported to newer, more efficient v8 api

commit c291675cce
Merge: 046ca76 0732592
Author: Jason Turner <jason@emptycrate.com>
Date:   Fri Aug 9 14:09:43 2013 -0600

    Merge branch 'devel' of https://github.com/ewmailing/swig-v8 into devel

commit 0732592ed9
Author: Kota Iguchi <kota@lanica.co>
Date:   Wed Aug 7 18:10:53 2013 -0700

    Patch to support argout typemap for your swig-v8 branch.

commit 32f9cce600
Merge: 4503c53 306b265
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Aug 31 03:47:43 2013 +0200

    Merged whoozle branch with ewmailing branch.

    Conflicts:
    	Lib/javascript/v8/javascriptcode.swg

commit 306b265af9
Merge: 65a0be8 b511e33
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Aug 31 03:47:08 2013 +0200

    Merge branch 'devel' of git://github.com/oliver----/swig-v8 into devel

    Conflicts:
    	Lib/javascript/v8/javascriptcode.swg

commit 4503c53903
Author: Eric Wing <ewing -dot- public |-at-| gmail.com>
Date:   Wed Aug 7 15:12:36 2013 -0700

    Since this code uses assert, #include <assert.h> is needed.

commit 65a0be8876
Author: Eric Wing <ewing -dot- public |-at-| gmail.com>
Date:   Thu Jul 11 20:04:01 2013 -0700

    v8: variable name bug fix in my template modifications for pointers to structs.

commit f8feeacb68
Author: Eric Wing <ewing -dot- public |-at-| gmail.com>
Date:   Thu Jul 11 19:11:56 2013 -0700

    v8: Removed the extern "C" around the initialize function because it makes no sense since it requires a C++ templates object as a parameter.

commit ed729f7d3a
Author: Eric Wing <ewing -dot- public |-at-| gmail.com>
Date:   Thu Jul 11 19:09:17 2013 -0700

    This brings over the memory leak fixes for pointers to structs with a %extend destructor from my Neha fork.  The generator was not generating and connecting the needed code for the requested destructor to the v8 dtor finalizer.

    I did not realize this branch has some JavaScriptCore stuff in it too. Unfortunately, it seems to have its own unique problems (like creating C++ files when it should be generating C files). My changes are targeted for v8, and I don't think my JSCore changes fully reach in this JSCore implementation so more work would need to be done to get this branch working. I think my Neha fork is in better shape at the moment.

    Also, I did port over the 'NULL out the dtor function pointer' in the %nodefaultdtor fix to v8.

    Usage case:
    struct MyData {
    %extend {
    ~MyData() {
    FreeData($self);
    }
    }
    };
    %newobject CreateData;
    struct MyData* CreateData(void);
    %delobject FreeData;
    void FreeData(struct MyData* the_data);

    where the use case is something like:
    var my_data = example.CreateData();
    my_data = null;

commit 046ca7686b
Author: Jason Turner <jason@emptycrate.com>
Date:   Sat Jul 27 12:35:36 2013 -0600

    Adjust for v8::Persistent API which was deprecated @ 3.19.16

    https://groups.google.com/forum/#!topic/v8-users/oBE_DTpRC08

commit d5df0bb721
Author: Eric Wing <ewing -dot- public |-at-| gmail.com>
Date:   Wed Aug 7 15:11:49 2013 -0700

    Added #if defined guard for V8_3_14 to allow users from the original SWIG v8 implementation to continue using the new changes. It works similarly to the BUILDING_NODE_EXTENSION in all but two places. This define must be explicitly set by users  because there is no way to auto detect. (Perhaps a command line switch can be added to generate this on request?)

commit cf9b7e89ac
Author: Jason Turner <jason@emptycrate.com>
Date:   Sat Jul 27 09:50:03 2013 -0600

    Get memory updates working with Node.js again.

commit 3af7d543cb
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Wed Aug 7 16:11:59 2013 +0400

    fixed crash while instantiating generic-wrapped objects from external code, please review

commit 9e74bdb97e
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Tue Aug 6 15:50:43 2013 +0400

    added virtual dtor to V8ErrorHandler

commit 868803ce2a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Aug 31 03:44:44 2013 +0200

    Merge replayed as done by c778d16abed35829b103d607a53c8f88e3b2d595

commit a190288e66
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Jul 18 21:03:56 2013 +0400

    fixed overloaded functions multiplication

commit 45bfc97ef4
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Jul 18 19:15:38 2013 +0400

    converted function templates to the persistent ones (fixed crash on large wrappers)

commit 9b6a4870dd
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Jul 18 18:53:15 2013 +0400

    added missing scope.Close()

commit fe25e2dfc8
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Jul 18 18:42:03 2013 +0400

    replaced GetInternalField with GetAlignedPointer (it does not work with SetAlignedPointer, btw)

commit 9111773400
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Jul 11 16:41:40 2013 +0400

    generate v8-3.19.x compatible code

commit 26a4f84948
Author: Vladimir Menshakov <menshakov@spb.gs.ru>
Date:   Thu Jul 11 15:06:08 2013 +0400

    added missing javascript/v8 dir

commit b511e33121
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri May 3 18:23:36 2013 +0200

    Remove std::iostream relicts from generated v8 wrapper code.

commit d3aa8e06fb
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Jan 30 18:50:03 2013 +0100

    Bugfix: treat persistent V8 references correctly.

    V8 is somewhat inconvenient regarding invoke of destructors for C++ proxies.

commit 827cef75a3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 25 17:09:13 2013 +0100

    Add an ifndef-guard to resolve a warning when building nodejs extension.

commit 31feff8586
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 25 17:03:23 2013 +0100

    Add missing return statement in v8 code template.

commit 5da4f5794c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 25 14:20:51 2013 +0100

    Add preprocessor define for building node.js extensions.

commit 65560a8664
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 25 14:07:06 2013 +0100

    Fix v8 string conversion in case of null arguments.

commit e3da21ee44
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 22 19:28:44 2013 +0100

    Add more ignores.

commit a4036deda8
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 22 19:26:29 2013 +0100

    Add pre-processor defines to detect the javascript engine.

commit b0cb875ac1
Merge: 8b10c47 2252524
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 22 19:24:12 2013 +0100

    Merge branch 'devel' of github.com:oliver----/swig-v8 into devel

commit 8b10c47ed8
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 22 19:23:11 2013 +0100

    Fix regression: add an include for Node.js header.

commit 22525249f2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 22 15:54:08 2013 +0100

    Resolve compile warnings in v8_shell.

commit 8eb9aa9e73
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 22 15:53:39 2013 +0100

    Add gitignore file.

commit 04c0803f73
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 18 15:35:45 2013 +0100

    Fixes in configuration to detect JavascriptCore on MacOSX correctly.

commit 4ac7065c3b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 18 15:34:11 2013 +0100

    Bugfix: in javascript interpreter load extensions on MacOSX correctly.

commit 04cdde0563
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Jan 18 15:33:04 2013 +0100

    Add test to check javascript unicode strings.

commit caa92740d3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Wed Jan 9 00:33:09 2013 +0100

    Add an option to deactivate creation of an extra module object in javascript.

    This is useful, if the extension host calls the initializer with custom
    local variables.
    E.g., this is the case with node.js.

commit 213c107b7f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 8 22:37:16 2013 +0100

    Add a swig macro to register node.js extensions.

commit 4fea3a403e
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 8 22:36:32 2013 +0100

    Generate an extra file part after the initializer for v8 modules.

    E.g., this is useful for creating node.js modules.

commit 31844ac72a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 8 22:34:38 2013 +0100

    Simplify the signature of the v8 module intializer.

commit 9d630ab930
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Jan 8 21:48:22 2013 +0100

    Fix std::string support for v8.

commit 2c4a90a37d
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Tue Dec 4 01:36:51 2012 +0100

    Generate defines for initializer function.

commit be06ceea26
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sun Dec 2 23:51:47 2012 +0100

    Fixes in std_string for JSC generator.

commit 7fffd801e4
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Dec 1 13:21:22 2012 +0100

    Fix std_string.i which generated compile errors in certain cases.

commit fb9c4955fb
Author: Oliver Buchtala <oliver@Olivers-Mac-mini.local>
Date:   Thu Nov 29 03:20:49 2012 +0100

    Not a real change: removed some trailing spaces.

commit f9d6afbdfe
Author: Oliver Buchtala <oliver@Olivers-Mac-mini.local>
Date:   Thu Nov 29 03:19:00 2012 +0100

    Add a missing return statement in JS shell.

commit 9d22644563
Author: Oliver Buchtala <oliver@Olivers-Mac-mini.local>
Date:   Thu Nov 29 03:17:27 2012 +0100

    Rename a argument variable to avoid errors with overloaded functions.

commit bad64925ed
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Nov 23 01:59:54 2012 +0100

    Configuration is now easier for building and running examples and tests using v8.

commit caa6827daf
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Nov 23 01:09:11 2012 +0100

    Javascript interpreter supports for JSC and V8 simultaneously.

    Before, one had to build two different versions.

commit 008adca72f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Thu Nov 22 22:50:50 2012 +0100

    Provide more control about the target object/namespace where a v8 module is registered to.

commit 6754bf2b49
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Nov 17 03:41:22 2012 +0100

    Generate cleanup code for %newobject.

commit 058a27bf32
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Nov 17 02:12:12 2012 +0100

    Simplify creation of a Javascript shell.

commit 57980975a0
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri Nov 16 22:10:02 2012 +0100

    Generate cleanup code.

commit 94730dad7a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:16:54 2012 +0000

    Beautify output of v8 emitter.

    Trimming some of the code templates.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13830 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 86cb621466
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:16:42 2012 +0000

    Add comments to v8 code templates.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13829 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 217ffb11d0
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:16:26 2012 +0000

    Fix regressions of latest commits.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13828 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 9b06144d39
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:16:09 2012 +0000

    Fix handling of overloaded ctors in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13827 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 131a106204
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:15:51 2012 +0000

    Improve names and comments of code templates for javascript emitters.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13826 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8b7a9fec25
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:15:29 2012 +0000

    Add complex support to v8 module.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13825 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 7c7d1cf3b9
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:15:12 2012 +0000

    Fix errors related to wrapping and destruction of (undefined) SWIG_TYPES.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13824 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 296a5d0285
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:14:48 2012 +0000

    Minor change in javascript example Makefile configuration.

    Propagate global CFLAGS and CXXFLAGS to inner javascript targets.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13823 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 4616f9643f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:14:37 2012 +0000

    Adapt test-suite configuration to allow switching between js engines.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13822 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8948360725
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:14:23 2012 +0000

    Fix configuration_in for detecting v8 include and lib.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13821 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 2092793868
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:14:14 2012 +0000

    Make v8 shell more quiet.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13820 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit f814a8e702
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:14:02 2012 +0000

    Fix errors concerning object wrapping and cleanup in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13819 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8db76ddee1
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:13:42 2012 +0000

    Remove generated file from repository.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13818 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 5425edc508
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:13:29 2012 +0000

    Add library flag for building v8 shell.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13817 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit da109ee764
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:13:17 2012 +0000

    Fix input string handling in v8 typemaps.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13816 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 91fc0ff205
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:13:03 2012 +0000

    Use a throwing default setter in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13815 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit a82e0a6e8f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:12:46 2012 +0000

    Fix c++ linking problem in example 'variables'.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13814 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 843c8a408c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:12:33 2012 +0000

    Fix AsVal macros of long and int for v8.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13813 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit d13289cc91
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:12:18 2012 +0000

    Fix function dispatching for v8.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13812 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 68f0f859f8
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:11:51 2012 +0000

    Fix name collision in generated v8 initializer.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13811 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit da6307a19e
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:11:32 2012 +0000

    Enable overloading ctors for v8.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13810 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 70383a1b61
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:11:11 2012 +0000

    Enable string exceptions in v8.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13809 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 84e5476147
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:10:57 2012 +0000

    Add std::string support to v8 typemaps.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13808 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit a4f8e4c1c3
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:10:42 2012 +0000

    Fix bug in v8 ctor emitter.

    This bug leaded to flaky crashes of v8 engine.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13807 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 2893df9f73
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:10:27 2012 +0000

    Several fixes in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13806 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit c4ab879027
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:10:10 2012 +0000

    Fix string warnings of for char* constants in CPP wrappers.

    This has been done by changing the implementation of marshalOutputArgs,
    which now does not create a local result variable in this case, and
    uses the constant inline in the output typemap.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13805 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 58e4f9703c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:09:57 2012 +0000

    Fix handling of Char constants in JSC typemaps.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13804 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 915e65135c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:09:43 2012 +0000

    Minor fix in v8 shell.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13803 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit c3918f3f82
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:09:31 2012 +0000

    Add string support to v8 typemaps.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13802 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit bd752ff86b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:09:18 2012 +0000

    In example Makefiles for v8 forward to CPP target.

    As v8 is C++ it is not possible to build wrappers in C.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13801 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 1862f43cfc
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:09:05 2012 +0000

    Minor clean up in class example.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13800 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit f1e9b21dfd
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:08:50 2012 +0000

    Add missing swig_type_info registration in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13799 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 21bdb78f1c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:08:33 2012 +0000

    Activate SwigModuleInitializer for in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13798 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 9a914af2b7
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:08:16 2012 +0000

    Fix v8 shell to initialize v8 context in proper order.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13797 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 46cff47ada
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:08:03 2012 +0000

    Several fixes in generator for v8 initializer function.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13796 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 78f5b46381
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:07:43 2012 +0000

    Fix class example.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13795 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 022c274256
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:07:21 2012 +0000

    Minor fixes in v8 javascript shell.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13794 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit cda09239ad
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:06:58 2012 +0000

    Several fixes in v8 emitter and code templates.

    Achieves first compile of example "class" after re-integration.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13793 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 0cae8fccd0
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:06:39 2012 +0000

    Minor refactor of marshalInputArgs for generalization.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13792 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 9b0c8dae83
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:06:26 2012 +0000

    Add argcount checking to functions and ctors.

    Before argument counts were only checked for overloaded functions/ctors.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13791 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit d5c5f7ebee
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:06:08 2012 +0000

    Generalize ctor overloading.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13790 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 7200239277
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:05:51 2012 +0000

    Fix regression in javascript's test-suite configuration.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13789 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 78442b2764
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:05:37 2012 +0000

    Several adaptations and fixes on the way to get V8 emitter running.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13788 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8d72616e65
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:05:11 2012 +0000

    Refactor emitter and code templates to use defined template variables.

    Also switched from "${...}" to $..., which is swig's common notation
    of typemap variables.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13787 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit cdd450fbe4
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:04:51 2012 +0000

    Delete obsolete source file.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13786 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 5fab9c8a38
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:04:40 2012 +0000

    Minor cleanup in javascript shell implementation.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13785 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 0341e6b14c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:04:26 2012 +0000

    Clean up example Makefiles.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13784 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 10dc758cad
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:03:42 2012 +0000

    Refactored javascript shell implementation to support JSC and v8.

    Also changed configuration in examples Makefile.in to allow switching modes.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13783 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 672208d8d2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:03:17 2012 +0000

    Adapt overload example to reflect changes in module.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13782 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit cbb5b711ab
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:03:00 2012 +0000

    Fix examples after regressions.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13781 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 52aef26997
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:02:30 2012 +0000

    Add examples check list for batch runs.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13780 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 07d5ec24ce
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:02:16 2012 +0000

    Add support for type-based dispatching of overloaded functions.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13779 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit eff094ef39
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:01:57 2012 +0000

    Add test "constructor_copy".

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13778 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 548287c600
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:01:41 2012 +0000

    Update configuration to detect V8 and allow testing with V8.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13777 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 4d9ca620ab
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 01:00:15 2012 +0000

    Refactored JSEmitters to share unified code.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13776 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 387da69e84
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:59:55 2012 +0000

    Pull namespace implementation up to be shared between js emitters.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13775 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 66ead9afb2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:59:43 2012 +0000

    Simplify implementation using new issetter flag.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13774 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit d2debe3270
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:59:31 2012 +0000

    Add more verbose temporary flags for setters in variable wrappers.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13773 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 16077503c8
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:59:18 2012 +0000

    Fix former workaround by concerning static member functions.

    "storage" attribute is removed by Language::staticmemberfunctionHandler
    which was resolved by a workaround before.
    Now, the implementation relies completely on state flags retrieved at
    a proper point.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13772 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit c470864d12
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:59:03 2012 +0000

    Remove some dead code and an obsolete member variable from JSEmitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13771 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 46624e24e5
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:58:49 2012 +0000

    Remove member variable current_wrapper from JSEmitter.

    Instead each emitting function creates local wrapper instance.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13770 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8577ae4179
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:58:37 2012 +0000

    Minor clean up.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13769 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit b778c4816b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:58:23 2012 +0000

    Remove a global variable from JSEmitter by making use of JSEmitterState.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13768 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 9af3c4879b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:58:11 2012 +0000

    Switch to global variable for enabling code template debug information.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13767 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit b39e2bfff0
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:57:57 2012 +0000

    Refactor JSC emitter to reduce global state variables.

    Also meld v8 emitter into javascript.cxx (provisional).

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13766 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 35e6b73d2a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:57:42 2012 +0000

    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

commit 050219d998
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:56:48 2012 +0000

    Merge branch 'devel' of https://github.com/Neha03/gsoc2012-javascript into devel

    Conflicts:
    	.project
    	COPYRIGHT
    	Doc/Manual/style.css
    	Examples/Makefile.in
    	Examples/test-suite/common.mk
    	Lib/typemaps/strings.swg
    	Makefile.in
    	Source/DOH/fio.c
    	Source/Makefile.am
    	Source/Modules/emit.cxx
    	Source/Modules/javascript.cxx
    	configure.in

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13764 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 360ef44e09
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:52:41 2012 +0000

    Clean up in v8 helper functions.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13763 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 229f2d0fa5
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:52:28 2012 +0000

    Add v8 input typemap for cstrings.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13762 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8168750c1b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:52:16 2012 +0000

    Add example for string marshalling to v8 specification.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13761 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 67a3de9a93
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:52:02 2012 +0000

    Add example for inheritance to v8 specification.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13760 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 32a32633ba
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:51:47 2012 +0000

    Add support for static member variables and functions to v8 module.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13759 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit e8dd979d16
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:51:29 2012 +0000

    Update v8 specification.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13758 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 0fd30dc60f
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:51:16 2012 +0000

    Add examples to specification of v8 code generator.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13757 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit badf090cb5
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:51:00 2012 +0000

    Extend and rename v8 helper functions.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13756 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 65d4769af8
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:50:41 2012 +0000

    Add initial support for argument marshalling using typemaps to v8 module.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13755 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 0e60acfebd
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:50:19 2012 +0000

    Minor restructuring in v8 generator.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13754 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 71bee1e78c
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:50:06 2012 +0000

    Complement variable processing in v8 generator.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13753 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 8e0711cbc6
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:49:44 2012 +0000

    Fix memory related bug in generalized javascript emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13752 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 285badb95b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:49:32 2012 +0000

    Improve v8 generator regarding registration of function wrappers.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13751 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 7ba26c8a26
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:49:15 2012 +0000

    Minor change in v8 emitter.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13750 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 9a599be8ab
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:49:02 2012 +0000

    Fix order of registration in v8 generator.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13749 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 886f17c343
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:48:43 2012 +0000

    Implement namespace support for v8 generator.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13748 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 90bbc6430b
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:48:24 2012 +0000

    Update v8 specification.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13747 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 6c90d1eb6d
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:48:11 2012 +0000

    Minor improvements in v8 emitter implementation

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13746 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 83ac719315
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:47:51 2012 +0000

    Add manual generated v8 wrapper examples to v8 specification.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13745 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit a0b71935f2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:47:38 2012 +0000

    Update v8 code generator specification.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13744 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 3c30e2d382
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:47:19 2012 +0000

    Add initial Javascript V8 emitter implementation.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13743 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 4bcfca05dd
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:46:31 2012 +0000

    Add some implementation details to specification of v8 code generator.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13742 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit e888d7a892
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:46:18 2012 +0000

    Add a document about mapping C++ language features to Javascript.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13741 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 5b5fdb171e
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:46:03 2012 +0000

    Add a paragraph about control flow analysis to V8 specification.

    Control flow analysis for use cases:
    - static variables
    - simple class
    - class properties
    - class methods
    - static class variables and functions
    - inheritance.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13740 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit 5c3fef6367
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:45:49 2012 +0000

    Add initial version of a CMake configuration.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13739 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit ba40fffd91
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:45:35 2012 +0000

    Add initial specification of code generator templates for V8 module.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13738 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit d71a5f483a
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Sat Sep 8 00:44:54 2012 +0000

    Add module for Javascript target.

    This module comes with a design that allows different code emitter implementations.
    For the the phase of development the module is split into multiple files
    which will be merged together when development converges.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13737 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit c86ce942c2
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri May 11 19:20:07 2012 +0000

    Correct place of copyright entry.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13070 626c5289-ae23-0410-ae9c-e8d60b6d4f22

commit d6060ceced
Author: Oliver Buchtala <oliver.buchtala@googlemail.com>
Date:   Fri May 11 13:55:16 2012 +0000

    Add copyright entry for Oliver Buchtala.

    git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13067 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Oliver Buchtala 2014-03-05 02:00:25 +01:00
commit cb2627ac03
228 changed files with 12567 additions and 16 deletions

8
.gitignore vendored
View file

@ -5,6 +5,8 @@
# Editor files and various other junk
.*.sw?
*.bak
*.log
.DS_Store
# Local PCRE
pcre
@ -23,6 +25,7 @@ pcre
*.so
*.so.*
*.dylib
*.bundle
# C/C++ static libraries, based on:
# https://github.com/github/gitignore/blob/master/C.gitignore
@ -71,6 +74,7 @@ Examples/xml/Makefile
Source/Include/stamp-h1
Source/Include/swigconfig.h
Source/Makefile
Tools/javascript/Makefile
.deps
config.log
config.status
@ -85,6 +89,7 @@ Source/CParse/parser.c
Source/CParse/parser.h
Source/eswig
swig
Tools/javascript/javascript
# Generated documentation
Doc/Manual/CCache.html
@ -102,6 +107,7 @@ Examples/test-suite/d/*/
Examples/test-suite/go/*/
Examples/test-suite/guile/*/
Examples/test-suite/java/*/
Examples/test-suite/javascript/*/
Examples/test-suite/lua/*/
Examples/test-suite/mzscheme/*/
Examples/test-suite/ocaml/*/
@ -114,6 +120,8 @@ Examples/test-suite/r/*/
Examples/test-suite/ruby/*/
Examples/test-suite/tcl/*/
Examples/test-suite/uffi/*/
*_wrap.c
*_wrap.cxx
# Python generated files, based on:
# https://github.com/github/gitignore/blob/master/Python.gitignore

View file

@ -1,6 +1,5 @@
language: cpp
language: c
compiler:
- clang
- gcc
env:
- SWIGLANG=
@ -14,6 +13,12 @@ matrix:
env: SWIGLANG=guile
- compiler: gcc
env: SWIGLANG=java
- compiler: gcc
env: SWIGLANG=javascript ENGINE=node
- compiler: gcc
env: SWIGLANG=javascript ENGINE=jsc
- compiler: gcc
env: SWIGLANG=javascript ENGINE=v8
- compiler: gcc
env: SWIGLANG=lua
- compiler: gcc
@ -43,6 +48,7 @@ before_install:
- if test -z "$SWIGLANG"; then sudo apt-get -qq install yodl; fi
- if test "$SWIGLANG" = "csharp"; then sudo apt-get -qq install mono-devel; fi
- if test "$SWIGLANG" = "go"; then go env | sed -e 's/^/export /' > goenvsetup && source goenvsetup && rm -f goenvsetup; fi # Until configure.ac is fixed
- if test "$SWIGLANG" = "javascript"; then sudo apt-get install -qq rlwrap python-software-properties && echo 'yes' | sudo add-apt-repository ppa:chris-lea/node.js && sudo apt-get -qq update && sudo apt-get install -qq nodejs libv8-dev libwebkitgtk-dev && sudo npm install -g node-gyp; fi
- if test "$SWIGLANG" = "guile"; then sudo apt-get -qq install guile-2.0-dev; fi
- if test "$SWIGLANG" = "lua"; then sudo apt-get -qq install lua5.1 liblua5.1-dev; fi
- if test "$SWIGLANG" = "octave"; then sudo apt-get -qq install octave3.2 octave3.2-headers; fi

View file

@ -15,7 +15,9 @@ Active SWIG Developers:
Olly Betts (olly@survex.com) (PHP)
Joseph Wang (joequant@gmail.com) (R)
Xavier Delacour (xavier.delacour@gmail.com) (Octave)
David Nadlinger (code@klickverbot.at) (D)
David Nadlinger (code@klickverbot.at)
Oliver Buchtala (oliver.buchtala@gmail.com) (Javascript)
Neha Narang (narangneha03@gmail.com) (Javascript)
Past SWIG developers and major contributors include:
Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)

770
Doc/Manual/Javascript.html Normal file
View file

@ -0,0 +1,770 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title>SWIG AND JAVASCRIPT</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
<h1 class="title">SWIG AND JAVASCRIPT</h1>
</div>
<div class="sectiontoc">
<div id="TOC">
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#preliminaries">Preliminaries</a><ul>
<li><a href="#using-the-module">Using the module</a></li>
<li><a href="#how-does-javascript-talk-to-c">How does Javascript talk to C++?</a></li>
<li><a href="#wrapper-functions">Wrapper functions</a></li>
<li><a href="#variable-linking">Variable Linking</a></li>
</ul></li>
<li><a href="#a-tour-of-basic-cc-wrapping">A tour of basic C/C++ wrapping</a><ul>
<li><a href="#modules">Modules</a></li>
<li><a href="#global-variables">Global variables</a></li>
<li><a href="#constants-and-enums">Constants and enums</a><ul>
<li><a href="#inside-the-class">Inside the class</a></li>
</ul></li>
<li><a href="#pointers">Pointers</a><ul>
<li><a href="#c-classes">C++ classes</a></li>
</ul></li>
<li><a href="#c-inheritance">C++ inheritance</a></li>
<li><a href="#c-overloaded-functions">C++ overloaded functions</a></li>
<li><a href="#c-operators">C++ operators</a></li>
<li><a href="#c-namespaces">C++ namespaces:</a></li>
<li><a href="#c-templates">C++ templates</a></li>
<li><a href="#exception-handling">Exception handling</a></li>
<li><a href="#how-to-use-generated-modules">How to use generated modules?</a><ul>
<li><a href="#basic-mechanism">Basic Mechanism</a><ul>
<li><a href="#creating-the-context">Creating the context</a></li>
</ul></li>
<li><a href="#calling-module-initializer">Calling module initializer</a></li>
<li><a href="#evaluate-javascript">Evaluate Javascript</a></li>
</ul></li>
<li><a href="#typemaps">Typemaps</a></li>
<li><a href="#javascript-typemaps">Javascript typemaps</a></li>
<li><a href="#typemap-variables">Typemap variables</a></li>
</ul></li>
<li><a href="#javascript-specification-of-a-code-generator-for-jsc">Javascript: Specification of a Code Generator for JSC</a></li>
<li><a href="#top-level-structure">Top Level structure</a><ul>
<li><a href="#includes">INCLUDES</a></li>
<li><a href="#helper_functions"><code>HELPER_FUNCTIONS</code></a></li>
<li><a href="#function_wrappers"><code>FUNCTION_WRAPPERS</code></a></li>
<li><a href="#member-functions">Member Functions</a></li>
<li><a href="#setproperty">Setproperty</a></li>
<li><a href="#getproperty">Getproperty</a></li>
<li><a href="#global-functions">Global Functions</a></li>
<li><a href="#variable-declaration">Variable declaration</a></li>
<li><a href="#constructor">Constructor</a></li>
</ul></li>
</ul>
</div>
</div>
<div>
<h1 id="overview"><a href="#TOC">Overview</a></h1>
<p>This chapter describes SWIG support for Javascript. The module is designed to support JavascriptCore and V8 as target engine. Currently only JavascriptCore support is implemented. JavaScriptCore is the built-in JavaScript engine for WebKit, whereas V8 is the engine used by Chromium.</p>
<p>JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. Its arguably the most popular language for web development. C++, on the other hand, is statically typed, compiled, general purpose programming language. The approach I followed here is &quot;Test driven&quot; where I have written the examples/test-cases to be supported for Javascript one-by-one and implemented the required module files in parallel. The support for Javascript would be added similar to other supported target languages in swig. Swig comes with an &quot;Examples&quot; directory for Javascript like other supported language. The directory contains examples for every supported feature of the target language. There is also a test-suite directory for javascript which contains additional tests.</p>
<h1 id="preliminaries"><a href="#TOC">Preliminaries</a></h1>
<p>In order to use this module, you will need to have installed javascriptcore and you can install it by installing package libwebkit-dev You can find out some necessary compiler/linker flag by</p>
<pre><code>pkg-config javascriptcoregtk-1.0 --cflags --libs
</code></pre>
<h2 id="using-the-module"><a href="#TOC">Using the module</a></h2>
<p>To generate an extension for JavascriptCore one would call swig as follows</p>
<pre><code><br />swig -c++ -javascript -jsc example.i
</code></pre>
<p>This generates a C++ source file containing the wrapper.</p>
<h2 id="how-does-javascript-talk-to-c"><a href="#TOC">How does Javascript talk to C++?</a></h2>
<p>JavascriptCore provides a C-API which allows to extend a Javascript interpreter with native methods and structures. Normally, this is used to implement the builtin features of the language. However, by extending the interpreter, it is also possible to add your own commands and variables. A reference manual of this API can be found <a href="http://developer.apple.com/library/mac/#documentation/Carbon/Reference/WebKit_JavaScriptCore_Ref/_index.html">here</a>.</p>
<p>Typically, when you add a new command to the javascript interpreter you need to do two things: first you need to write a special &quot;wrapper&quot; function that serves as the glue between the interpreter and the underlying C function. Then you need to give the interpreter information about the wrapper by providing details about the name of the function, arguments, and so forth. The next few sections illustrate the process.</p>
<h2 id="wrapper-functions"><a href="#TOC">Wrapper functions</a></h2>
<p>Suppose you have an ordinary C function like this :</p>
<pre><code><br />int fact(int n) {
if (n &lt;= 1) return 1;
else return n*fact(n-1);
}
</code></pre>
<p>In order to access this function from a scripting language, it is necessary to write a special &quot;wrapper&quot; function that serves as the glue between the scripting language and the underlying C function. A wrapper function must do three things :</p>
<ul>
<li>Gather function arguments and make sure they are valid.</li>
<li>Call the C function.</li>
<li>Convert the return value into a form recognized by the javascript.</li>
</ul>
<p>As an example, the javascript wrapper function for the fact() function above example might look like the following :</p>
<pre><code><br />JSValueRef wrap_fact(JSContextRef context, JSObjectRef function, JSObjectRef globalobj, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
int arg1 = (int)JSValueToNumber(context, argv[0], NULL);
int arg2 = (int)JSValueToNumber(context, argv[1], NULL);
int result = (int)fact(arg1,arg2);
JSValueRef jsresult = JSValueMakeNumber(context, result);
return jsresult;
}
</code></pre>
<p>Once you have created a wrapper function, the final step is to tell the javascript about the new function. This is done by register function called by the javascript when the module is loaded. For example, adding the above function to the javascript interpreter requires code like the following :</p>
<pre><code><br />bool jsc_registerFunction(JSGlobalContextRef context, JSObjectRef object,
const char* functionName, JSObjectCallAsFunctionCallback callback)
{
JSStringRef js_globalvarsclassname = JSStringCreateWithUTF8CString(globalvarsclassname);
JSObjectSetProperty(context,js_globalvarsclassname,JSObjectMakeFunctionWithCallback(context,
js_globalvarsclassname, callback), kJSPropertyAttributeNone,NULL);
JSStringRelease(jsstring);
return true;
}
int example_init(JSContextRef context) {
JSObjectRef global;
...
jsc_registerFunction(context, global, &quot;fact&quot;, wrap_fact);
...
}
</code></pre>
<p>When executed, javascript will now have a new command called &quot;fact&quot; that you can use like any other Javascript command. Although the process of adding a new function to javascript has been illustrated, the procedure is almost identical for Perl and Python. Both require special wrappers to be written and both need additional initialization code.</p>
<h2 id="variable-linking"><a href="#TOC">Variable Linking</a></h2>
<p>Variable linking refers to the problem of mapping a C/C++ global variable to a variable in the scripting language interpreter. For example, suppose you had the following variable:</p>
<pre><code><br />double Foo = 3.5;
</code></pre>
<p>To provide such access, variables are commonly manipulated using a pair of get/set functions. For example, whenever the value of a variable is read, a &quot;get&quot; function is invoked. Similarly, whenever the value of a variable is changed, a &quot;set&quot; function is called.</p>
<pre><code><br />bool Foo_set(JSContextRef context, JSObjectRef globalobj, JSStringRef propertyName, JSValueRef value,
JSValueRef* exception)
{
JSValueRef jsresult;
double arg1 = (double)JSValueToNumber(context, value, NULL);
Foo = arg1;
jscresult = JSValueMakeUndefined(context);
return jsresult;
}
JSValueRef Foo_get(JSContextRef context, JSObjectRef globalobj, JSStringRef propertyName, JSValueRef* exception)
{
JSValueRef jsresult;
double result = (double)Foo;
jsresult = JSValueMakeNumber(context, result);
return jsresult;
}
</code></pre>
<p>In many languages, calls to the get/set functions can be attached to evaluation and assignment operators. Therefore, evaluating a variable such as Foo might implicitly call the get function. Similarly, typing Foo = 4 would call the underlying set function to change the value.</p>
<h1 id="a-tour-of-basic-cc-wrapping"><a href="#TOC">A tour of basic C/C++ wrapping</a></h1>
<p>By default, SWIG tries to build a very natural javascript interface to your C/C++ code. Functions are wrapped as functions, classes are wrapped as classes, and so forth. This section briefly covers the essential aspects of this wrapping.</p>
<h2 id="modules"><a href="#TOC">Modules</a></h2>
<p>The SWIG %module directive specifies the name of the Javascript module. If you specify <code>%module example</code>, then everything is wrapped into a Javascript 'example' module. Underneath the covers, this module consists of a cpp source file example.cpp. When choosing a module name, make sure you don't use the same name as a built-in Javascript command or standard module name.</p>
<h2 id="global-variables"><a href="#TOC">Global variables</a></h2>
<p>C/C++ global variables are fully supported by SWIG. However, the underlying mechanism is somewhat different than you might expect due to the way that javascript works.</p>
<pre><code><br />// SWIG interface file with global variables
%module example
...
%inline %{
extern double Foo;
extern int gcd(int x, int y);
%}
...
</code></pre>
<p>Now look at the javascript:</p>
<pre><code><br />print(&quot;Global variable Foo=&quot; + example.Foo);
example.Foo = 3.1415926;
print(&quot;Variable Foo changed to=&quot; + example.Foo);
print(&quot;GCD of x and y is=&quot; + example.gcd(x,y));
</code></pre>
<h2 id="constants-and-enums"><a href="#TOC">Constants and enums</a></h2>
<p>C/C++ constants are installed as javascript objects containing the appropriate value. To create a constant, use #define, enum, or the %constant directive. For example:</p>
<pre><code><br />#define ICONST 42
#define FCONST 2.1828
%constant int iconst = 37;
</code></pre>
<p>In javascript they are treated as:</p>
<pre><code><br />print(&quot;ICONST = &quot; + example.ICONST + &quot; (should be 42)\n&quot;);
print(&quot;FCONST = &quot; + example.FCONST + &quot; (should be 2.1828)\n&quot;);
print(&quot;iconst = &quot; + example.iconst + &quot; (should be 37)\n&quot;);
</code></pre>
<p>For enums, make sure that the definition of the enumeration actually appears in a header file or in the wrapper file somehow---if you just stick an enum in a SWIG interface without also telling the C compiler about it, the wrapper code won't compile. Enums are treated as constants.So if we have enums in c++ as:</p>
<pre><code><br />void enum_test(color c, Foo::speed s);
</code></pre>
<p>In javascript they are treated as:</p>
<pre><code><br />example.enum_test(example.RED, example.Foo.IMPULSE);
example.enum_test(example.BLUE, example.Foo.WARP);
example.enum_test(example.GREEN, example.Foo.LUDICROUS);
</code></pre>
<h3 id="inside-the-class"><a href="#TOC">Inside the class</a></h3>
<p>For class enums as below:</p>
<pre><code><br />class Foo {
public:
Foo() { }
enum speed { IMPULSE, WARP, LUDICROUS };
}
</code></pre>
<p>In javascript they are treated as:</p>
<pre><code><br />print(&quot; Foo_IMPULSE =&quot; + example.Foo.IMPULSE);
print(&quot; Foo_WARP =&quot; + example.Foo.WARP);
print(&quot; Foo_LUDICROUS =&quot; + example.Foo.LUDICROUS);
</code></pre>
<h2 id="pointers"><a href="#TOC">Pointers</a></h2>
<p>C/C++ pointers are fully supported by SWIG. Furthermore, SWIG has no problem working with incomplete type information. Here is a rather simple interface</p>
<pre><code><br />/* File : example.i */
%module example
%{
extern void add(int *, int *, int *);
%}
</code></pre>
<p>When wrapped, you will be able to use the functions in a natural way from javascript. For example:</p>
<pre><code><br />// Call the add() function with some pointers
example.add(a, b, c);
</code></pre>
<p>// In javascript the code look like as:</p>
<pre><code><br />a = example.new_intp();
example.intp_assign(a,37);
</code></pre>
<ul>
<li>The first one creates an int-pointer instance.</li>
<li>The second one assigns it the value 37.</li>
</ul>
<h3 id="c-classes"><a href="#TOC">C++ classes</a></h3>
<p>C++ classes are wrapped by javascript classes as well. For example, if you have this class,</p>
<pre><code><br />class Circle
{
public:
Circle();
Circle(double r);
double area();
double radius;
};
</code></pre>
<p>you can use it in javascript like this:</p>
<pre><code><br />print(&quot;Creating some objects:&quot;);
c = new example.Circle(10);
print(&quot;area = &quot; + c.area());
</code></pre>
<p>Class data members are accessed in the same manner as C structures.</p>
<p>Static class members and functions are mapped to javascript in a straight-forward manner:</p>
<pre><code><br />class Spam {
public:
static void foo();
static int bar;
};
</code></pre>
<p>In javascript, the static member can be access in this way:</p>
<pre><code><br />// ----- Access a static member -----
print(&quot;\nA access of static member is&quot; + example.Spam.Foo); // access static member as properties of the class object.
</code></pre>
<h2 id="c-inheritance"><a href="#TOC">C++ inheritance</a></h2>
<p>SWIG is fully aware of issues related to C++ inheritance. Therefore, if you have classes like this</p>
<pre><code><br />class A {
public:
void foo();
virtual void bar();
};
class B: public A {
public:
virtual void bar();
};
</code></pre>
<p>Those classes are wrapped into a hierarchy of javascript classes that reflect the same inheritance structure. All of the usual javascript utility functions work normally:</p>
<pre><code><br />var a = new example.A();
a.foo();
a.bar();
var b = new example.B();
b.foo();
b.bar();
print(&quot;b.cPtr = &quot; + b.getCPtr());
</code></pre>
<h2 id="c-overloaded-functions"><a href="#TOC">C++ overloaded functions</a></h2>
<p>C++ overloaded functions, methods, and constructors are mostly supported by SWIG. For example, if you have two functions like this:</p>
<pre><code><br />void f(int val) {
std::cout &lt;&lt; &quot;Called f(int).&quot; &lt;&lt; std::endl;
}
void f(int val1, int val2) {
std::cout &lt;&lt; &quot;Called f(int, int).&quot; &lt;&lt; std::endl;
}
void f(const char* s) {
std::cout &lt;&lt; &quot;Called f(const char*).&quot; &lt;&lt; std::endl;
}
</code></pre>
<p>You can use them in javascript in a straightforward manner:</p>
<pre><code><br />example.f(1);
example.f(1, 2);
example.f(&quot;bla&quot;);
</code></pre>
<h2 id="c-operators"><a href="#TOC">C++ operators</a></h2>
<p>Certain C++ overloaded operators can be handled automatically by SWIG. Though, in javascript operator overloading is not possible. Instead one has to make use of the <code>%rename</code> feature.</p>
<p>For example, consider a class like this:</p>
<pre><code><br />/* File : example.h */
#include &lt;math.h&gt;
class Complex {
private:
double rpart, ipart;
public:
Complex(double r = 0, double i = 0) : rpart(r), ipart(i) { }
Complex(const Complex &amp;c) : rpart(c.rpart), ipart(c.ipart) { }
Complex &amp;operator=(const Complex &amp;c) {
rpart = c.rpart;
ipart = c.ipart;
return *this;
}
Complex operator+(const Complex &amp;c) const {
return Complex(rpart+c.rpart, ipart+c.ipart);
}
Complex operator-(const Complex &amp;c) const {
return Complex(rpart-c.rpart, ipart-c.ipart);
}
Complex operator*(const Complex &amp;c) const {
return Complex(rpart*c.rpart - ipart*c.ipart,
rpart*c.ipart + c.rpart*ipart);
}
Complex operator-() const {
return Complex(-rpart, -ipart);
}
double re() const { return rpart; }
double im() const { return ipart; }
};
</code></pre>
<p>When wrapped, it works like you expect:</p>
<pre><code><br />a = new example.Complex(2,3);
b = new example.Complex(-5,10);
print (&quot;a =&quot; + a);
print (&quot;b =&quot; + b);
c = a.plus(b);
print(&quot;c =&quot; + c);
print(&quot;a*b =&quot; + a.times(b));
print(&quot;a-c =&quot; + a.minus(c));
e = example.Complex.copy(a.minus(c));
print(&quot;e =&quot; + e);
// Big expression
f = a.plus(b).times(c.plus(b.times(e))).plus(a.uminus());
print(&quot;f =&quot; + f);
</code></pre>
<p>One restriction with operator overloading support is that SWIG is not able to fully handle operators that aren't defined as part of the class. For example, if you had code like this</p>
<pre><code><br />class Complex {
...
friend Complex operator+(double, const Complex &amp;c);
...
};
</code></pre>
<p>then SWIG ignores it and issues a warning. You can still wrap the operator, but you may have to encapsulate it in a special function. For example:</p>
<p>%rename(Complex_add_dc) operator+(double, const Complex &amp;);</p>
<p>There are ways to make this operator appear as part of the class using the %extend directive.</p>
<h2 id="c-namespaces"><a href="#TOC">C++ namespaces:</a></h2>
<p>SWIG is aware of C++ namespaces, but namespace names do not appear in the module nor do namespaces result in a module that is broken up into submodules or packages. For example, if you have a file like this,</p>
<pre><code><br />%module example
namespace nspace {
extern int gcd(int x, int y);
extern double Foo;
class Circle
{
public:
Circle();
Circle(double r);
double area();
double radius;
};
}
</code></pre>
<p>for namespaces, you use the %feature directive in interface file. %feature attaches a new attribute to any parse tree node that matches given prototype.</p>
<pre><code><br />/* File : example.i */
%module example
%{
#include &quot;example.h&quot;
%}
%feature(&quot;nspace&quot;, 1);
%include &quot;example.h&quot;
</code></pre>
<p>it works in javascript as follows:</p>
<pre><code><br />print(&quot;Global variable Foo=&quot; + example.nspace.Foo);
example.nspace.Foo = 5;
print(&quot;Variable Foo changed to &quot; + example.nspace.Foo);
print(&quot;GCD of number 6,18 is &quot; + example.nspace.gcd(6,18));
print(&quot;Creating some objects:&quot;);
c = new example.nspace.Circle(10);
print(&quot;area = &quot; + c.area());
</code></pre>
<p>If your program has more than one namespace, name conflicts (if any) can be resolved using %rename For example:</p>
<pre><code><br />%rename(Bar_spam) Bar::spam;
namespace Foo {
int spam();
}
namespace Bar {
int spam();
}
</code></pre>
<p>If you have more than one namespace and your want to keep their symbols separate, consider wrapping them as separate SWIG modules. For example, make the module name the same as the namespace and create extension modules for each namespace separately. If your program utilizes thousands of small deeply nested namespaces each with identical symbol names, well, then you get what you deserve. SWIG resolves overloaded functions and methods using a disambiguation scheme that ranks and sorts declarations according to a set of type-precedence rules. The order in which declarations appear in the input does not matter except in situations where ambiguity arises--in this case, the first declaration takes precedence.</p>
<h2 id="c-templates"><a href="#TOC">C++ templates</a></h2>
<p>C++ templates don't present a huge problem for SWIG. However, in order to create wrappers, you have to tell SWIG to create wrappers for a particular template instantiation. To do this, you use the %template directive. For example:</p>
<pre><code><br />/* File : example.i */
%module example
%{
#include &quot;example.h&quot;
%}
/* Let's just grab the original header file here */
%include &quot;example.h&quot;
/* Now instantiate some specific template declarations */
%template(maxint) max&lt;int&gt;;
%template(maxdouble) max&lt;double&gt;;
%template(vecint) vector&lt;int&gt;;
%template(vecdouble) vector&lt;double&gt;;
</code></pre>
<p>In javascript:</p>
<pre><code><br />//Call some templated functions
print(example.maxint(3,7));
print(example.maxdouble(3.14,2.18));
// Create some class
iv = new example.vecint(100);
dv = new example.vecdouble(1000);
for(i=0;i&lt;=100;i++)
iv.setitem(i,2*i);
for(i=0;i&lt;=1000;i++)
dv.setitem(i, 1.0/(i+1));
sum = 0;
for(i=0;i&lt;=100;i++)
sum = sum + iv.getitem(i);
print(sum);
sum = 0.0;
for(i=0;i&lt;=1000;i++)
sum = sum + dv.getitem(i);
print(sum);
</code></pre>
<h2 id="exception-handling"><a href="#TOC">Exception handling</a></h2>
<p>The SWIG %exception directive can be used to create a user-definable exception handler for converting exceptions in your C/C++ program into javascript exceptions. The chapter on customization features contains more details, but suppose you have a C++ class like the following:</p>
<p>Since several methods in this class can throw an exception for an out-of-bounds access, you might want to catch this in the javascript extension by writing the following in an interface file:</p>
<pre><code><br />/* File : example.i */
%module example
%{
#include &quot;example.h&quot;
%}
%include &quot;std_string.i&quot;
/* Let's just grab the original header file here */
%include &quot;example.h&quot;
</code></pre>
<p>Actually in JS there is no support for typed exceptions.For now there is support for integer and string exception. Example for integer exception</p>
<pre><code><br />JSValueRef jsc_gcd(JSContextRef context, JSObjectRef function, JSObjectRef globalobj, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
int arg1 = (int)JSValueToNumber(context, argv[0], NULL);
int arg2 = (int)JSValueToNumber(context, argv[1], NULL);
*exception = JSValueMakeNumber(context, 13);
int result = (int)gcd(arg1,arg2);
JSValueRef jsresult = JSValueMakeNumber(context, result);
</code></pre>
<p>and for string exception:</p>
<pre><code><br />JSValueRef wrap_gcd(JSContextRef context, JSObjectRef function, JSObjectRef globalobj, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
int arg1 = (int)JSValueToNumber(context, argv[0], NULL);
int arg2 = (int)JSValueToNumber(context, argv[1], NULL);
JSStringRef message = JSStringCreateWithUTF8CString(&quot;This is a test error.&quot;);
*exception = JSValueMakeString(context, message);
JSStringRelease(message);
int result = (int)gcd(arg1,arg2);
JSValueRef jscresult = JSValueMakeNumber(context, result);
return jsresult;
}
</code></pre>
<h2 id="how-to-use-generated-modules"><a href="#TOC">How to use generated modules?</a></h2>
<p>Basically there is no standard extension mechanism in Javascript. We provided a custom interpreter with extension abilities. If JSC is embedded into a custom application, one has to make use of a generated module initializer function that allows easy extension of interpreter. The basic approach is as follows:</p>
<h3 id="basic-mechanism"><a href="#TOC">Basic Mechanism</a></h3>
<ul>
<li>Creating the context</li>
<li>Calling module initializer</li>
<li>Evaluate Javascript</li>
</ul>
<h4 id="creating-the-context"><a href="#TOC">Creating the context</a></h4>
<pre><code><br />JSGlobalContextRef context = JSGlobalContextCreate(NULL);
JSObjectRef globalObject = JSContextGetGlobalObject(context);
...
</code></pre>
<h3 id="calling-module-initializer"><a href="#TOC">Calling module initializer</a></h3>
<pre><code><br /> extern int example_init(JSGlobalContextRef context);
...
example_init(context);
...
</code></pre>
<h3 id="evaluate-javascript"><a href="#TOC">Evaluate Javascript</a></h3>
<pre><code><br />// Evaluate the javascript
char* scriptContent = jsccreateStringWithContentsOfFile(scriptPath.c_str());
JSStringRef jsScript;
if(!scriptContent) {
printf(&quot;FAIL: runme script could not be loaded.\n&quot;);
failed = 1;
}
else {
JSValueRef ex;
jsScript = JSStringCreateWithUTF8CString(scriptContent);
JSValueRef jsResult = JSEvaluateScript(context, jsScript, 0, 0, 0, &amp;ex);
if (!jsResult &amp;&amp; ex) {
jsc_printError(context, ex, scriptPath);
failed = 1;
}
}
if (scriptContent != NULL) {
free(scriptContent);
}
JSStringRelease(jsScript);
JSGlobalContextRelease(context);
globalObject = 0;
for(std::vector&lt;HANDLE&gt;::iterator it = loaded_modules.begin();
it != loaded_modules.end(); ++it) {
HANDLE handle = *it;
dlclose(handle);
}
if (failed) {
printf(&quot;FAIL: Some tests failed.\n&quot;);
return 1;
}
}
</code></pre>
<h2 id="typemaps"><a href="#TOC">Typemaps</a></h2>
<p>A typemap is nothing more than a code generation rule that is attached to a specific C datatype. For example, to convert integers from javascript to C, you might define a typemap like this:</p>
<pre><code><br />%typemap(in) int {
$1 = ($1_ltype)JSValueToNumber(context, $input, NULL); %}
printf(&quot;Received an integer : %d\n&quot;,$1);
}
</code></pre>
<p>Typemaps are always associated with some specific aspect of code generation. In this case, the &quot;in&quot; method refers to the conversion of input arguments to C/C++. The datatype int is the datatype to which the typemap will be applied. The supplied C code is used to convert values. In this code a number of special variable prefaced by a $ are used. The $1 variable is placeholder for a local variable of type int.</p>
<h2 id="javascript-typemaps"><a href="#TOC">Javascript typemaps</a></h2>
<p>The previous section illustrated an &quot;in&quot; typemap for converting javascript objects to C. A variety of different typemap methods are defined by the javascript module. For example, to convert a C integer back into a javascript object, you might define an &quot;out&quot; typemap like this:</p>
<pre><code><br />%typemap(out) int {
$result = JSValueMakeNumber(context, $1);
}
</code></pre>
<p>The Javascript module makes use of Swig's unified template library.</p>
<h2 id="typemap-variables"><a href="#TOC">Typemap variables</a></h2>
<p>Within typemap code, a number of special variables prefaced with a $ may appear. A full list of variables can be found in the &quot;Typemaps&quot; chapter. This is a list of the most common variables:</p>
<p><code>$1</code>: A C local variable corresponding to the actual type specified in the %typemap directive. For input values, this is a C local variable that's supposed to hold an argument value. For output values, this is the raw result that's supposed to be returned to Javascript.</p>
<p><code>$input</code>: A javascript Object * holding a raw javascript object with an argument or variable value.</p>
<p><code>$result</code>: A javascript Object * that holds the result to be returned to javascript.</p>
<p><code>$1_name</code>: The parameter name that was matched.</p>
<p><code>$1_type</code>: The actual C datatype matched by the typemap.</p>
<p><code>$1_ltype</code>: An assignable version of the datatype matched by the typemap (a type that can appear on the left-hand-side of a C assignment operation). This type is stripped of qualifiers and may be an altered version of <code>$1_type</code>. All arguments and local variables in wrapper functions are declared using this type so that their values can be properly assigned.</p>
<p><code>$symname</code>: The javascript name of the wrapper function being created.</p>
<h1 id="javascript-specification-of-a-code-generator-for-jsc"><a href="#TOC">Javascript: Specification of a Code Generator for JSC</a></h1>
<p>The module implementation tries to accomplish a separation of logic and code generation by making use of code templates. In the following, the templates are explained.</p>
<h1 id="top-level-structure"><a href="#TOC">Top Level structure</a></h1>
<p>The generated code consists of the following blocks:</p>
<pre><code><br />&lt;RUNTIME&gt;
&lt;INCLUDES&gt;
&lt;HELPER_FUNCTIONS&gt;
&lt;FUNCTION_WRAPPERS&gt;
&lt;INITIALIZER&gt;
</code></pre>
<ul>
<li><code>RUNTIME</code>: runtime code generated by swig</li>
<li><code>HELPER_FUNCTIONS</code>: static, from swg-file</li>
<li><code>INCLUDES</code>: static, module property</li>
<li><code>FUNCTION_WRAPPERS</code>: dynamically growing, on method declarations</li>
<li><code>INITIALIZER</code>: dynamically growing, aggregates everything</li>
</ul>
<h2 id="includes"><a href="#TOC">INCLUDES</a></h2>
<pre><code><br />#include &lt;JavaScriptCore/JavaScript.h&gt;
&lt;USER_DEFINED_INCLUDES&gt;
</code></pre>
<p><code>USER_DEFINED_INCLUDES</code>: a module property</p>
<h2 id="helper_functions"><a href="#TOC"><code>HELPER_FUNCTIONS</code></a></h2>
<p>A lot of boiler-plate code can be shifted into static helper functions:</p>
<pre><code><br />bool JS_registerClass(JSGlobalContextRef&amp; context, JSObjectRef&amp; parentObject,const char* className,
JSClassDefinition* definition) {
JSStringRef js_className = JSStringCreateWithUTF8CString(className);
JSObjectRef classObject = JSObjectMake(context, JSClassCreate(definition), NULL);
JSObjectSetProperty(context, parentObject,js_className, classObject,kJSPropertyAttributeNone, NULL);
JSStringRelease(js_className);
return true;
}
bool JS_registerNamespace(JSGlobalContextRef&amp; context,JSObjectRef&amp; namespaceObj,JSObjectRef&amp; parentNamespace,const char* name)
{
JSStringRef js_name = JSStringCreateWithUTF8CString(name);
JSObjectSetProperty(context, parentNamespace,js_name, namespaceObj,kJSPropertyAttributeNone, NULL);
JSStringRelease(js_name);
return true;
}
bool JS_registerFunction(JSGlobalContextRef context, JSObjectRef object, const char* functionName, JSObjectCallAsFunctionCallback callback)
{
JSStringRef js_functionName = JSStringCreateWithUTF8CString(functionName);
JSObjectSetProperty(context,object,js_functionName,JSObjectMakeFunctionWithCallback(context,
js_functionName, callback), kJSPropertyAttributeNone, NULL);
JSStringRelease(js_functionName);
return true;
}
bool JS_veto_set_variable(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
char buffer[256];
char msg[512];
int res;
JSStringGetUTF8CString(propertyName, buffer, 256);
res = sprintf(msg, &quot;Tried to write read-only variable: %s.&quot;, buffer);
if(res&lt;0) {
SWIG_exception(SWIG_ERROR, &quot;Tried to write read-only variable.&quot;);
} else {
SWIG_exception(SWIG_ERROR, msg);
}
return false;
}
JSValueRef JS_CharPtrToJSValue(JSContextRef context, char* cstr) {
JSValueRef val;
JSStringRef jsstring = JSStringCreateWithUTF8CString((char*) cstr);
val = JSValueMakeString(context, jsstring);
JSStringRelease(jsstring);
return val;
}
</code></pre>
<h2 id="function_wrappers"><a href="#TOC"><code>FUNCTION_WRAPPERS</code></a></h2>
<p>There are different types of function wrappers: - Member Functions - Getproperty / Setproperty - Global Functions (global/namespace/class) - Constructors / Destructors</p>
<h2 id="member-functions"><a href="#TOC">Member Functions</a></h2>
<pre><code><br />JSValueRef ${functionname}(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception)
{
${LOCALS}
${CODE}
return jsresult;
goto fail;
fail:
return NULL;
}
</code></pre>
<ul>
<li><code>functionname</code>: the name of generated wrapper for function</li>
<li><code>LOCALS</code>: declarations for input arguments</li>
<li><code>CODE</code>: contains input marshalling, the action, and output marshalling</li>
</ul>
<h2 id="setproperty"><a href="#TOC">Setproperty</a></h2>
<pre><code><br />bool ${setname}(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
${LOCALS}
${CODE}
return jsresult;
goto fail;
fail:
return NULL;
}
</code></pre>
<ul>
<li><code>setname</code>: the name of the generated wrapper for setproperty.</li>
<li><code>LOCALS</code>: declarations for input arguments</li>
<li><code>CODE</code>: contains input marshalling, and the action</li>
</ul>
<h2 id="getproperty"><a href="#TOC">Getproperty</a></h2>
<pre><code><br />JSValueRef ${getname}(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{
${LOCALS}
${CODE}
return jsresult;
goto fail;
fail:
return NULL;
}
</code></pre>
<ul>
<li><code>getname</code>: the name of the generated wrapper for the getproperty</li>
<li><code>LOCALS</code>: declarations for output arguments</li>
<li><code>CODE</code>: contains the action, and output marshalling</li>
</ul>
<h2 id="global-functions"><a href="#TOC">Global Functions</a></h2>
<pre><code><br />JSStaticValue ${namespace}_values[] = {
${jsglobalvariables}
{ 0, 0, 0, 0 }
};
JSStaticFunction ${namespace}_functions[] = {
${jsglobalfunctions}
{ 0, 0, 0 }
};
JSClassDefinition ${namespace}_classDefinition;
</code></pre>
<h2 id="variable-declaration"><a href="#TOC">Variable declaration</a></h2>
<pre><code><br />{&quot;${propertyname}&quot;,${getname}, ${setname}, kJSPropertyAttributeNone}
</code></pre>
<p>This is used to fill variable definition tables. <code>kJSPropertyAttributeNone</code> is JSC specific and means that the variable has a getter and setter. Even for read-only variables a setter is used which throws an exception.</p>
<h2 id="constructor"><a href="#TOC">Constructor</a></h2>
<p>~<sub>~</sub></p>
<p>JSObjectRef <em>wrap_create</em><span class="math"><em>c</em><em>l</em><em>a</em><em>s</em><em>s</em><em>n</em><em>a</em><em>m</em><em>e</em><sub><em>m</em></sub><em>a</em><em>n</em><em>g</em><em>l</em><em>e</em><em>d</em></span>{overloadext}(JSContextRef context, JSObjectRef thisObject, size_t argc, const JSValueRef argv[], JSValueRef* exception) { ${LOCALS} <span class="math">${CODE} return SWIG_JSC_NewPointerObj(context, result, SWIGTYPE_$</span>{type_mangled}, SWIG_POINTER_OWN);</p>
<pre><code>goto fail;
fail:
return NULL;
</code></pre>
<p>}</p>
<pre><code>- `classname_mangled` is the mangled qualified class name, e.g., `foo::A -&gt; foo_A`
- `LOCALS`: declarations for input arguments
- `CODE`: contains input marshalling, and the action
## Destructors
</code></pre>
<p>void <em>wrap</em><span class="math">${classname_mangled}_finalize(JSObjectRef thisObject) { SWIG_PRV_DATA* t = (SWIG_PRV_DATA*)JSObjectGetPrivate(thisObject); if(t &amp;&amp; t-&gt;swigCMemOwn) delete ($</span>{type}*)(t-&gt;swigCObject); if(t) delete t; }</p>
<pre><code><br />- `classname_mangled` is the mangled qualified class name, e.g., `foo::A -&gt; foo_A`
## Initializer
</code></pre>
<p>bool ${modulename}_initialize(JSGlobalContextRef context) { SWIG_InitializeModule(0);</p>
<pre><code>JSObjectRef global_object = JSContextGetGlobalObject(context);
/* Initialize the base swig type object */
_SwigObject_objectDefinition.staticFunctions = _SwigObject_functions;
_SwigObject_objectDefinition.staticValues = _SwigObject_values;
_SwigObject_classRef = JSClassCreate(&amp;_SwigObject_objectDefinition);
/* Create objects for namespaces */
${create_namespaces}
/* Create classes */
${initializercode}
/* Register namespaces */
${register_namespaces}
return true;
</code></pre>
<p>}</p>
<pre><code><br />## Class template defintions
A class is specified by a static part (`*_classDefinition`) and a dynamic part (`*_objectDefinition`).
</code></pre>
<p>${classname_mangled}_classDefinition.staticFunctions = ${classname_mangled}_staticFunctions; ${classname_mangled}_classDefinition.staticValues = ${classname_mangled}_staticValues; <span class="math">${classname_mangled}_classDefinition.callAsConstructor = _wrap_create_$</span>{classname_mangled}; ${classname_mangled}_objectDefinition.staticValues = ${classname_mangled}_values; ${classname_mangled}_objectDefinition.staticFunctions = ${classname_mangled}_functions; ${classname_mangled}_objectDefinition.parentClass = ${base_classname}_classRef; JSClassRef <span class="math">${classname_mangled}_classRef = JSClassCreate(&amp;$</span>{classname_mangled}<em>objectDefinition); SWIGTYPE</em>${classtype_mangled}-&gt;clientdata = ${classname_mangled}_classRef;%}</p>
<pre><code><br />Notes:
- `classname_mangled` is the mangled qualified class name, e.g., `foo::A -&gt; foo_A`
which is retrieved by `Swig_name_mangle(Getattr(n, &quot;name&quot;))`
- ClassDefinitions are built using the staticValues array and the staticFunction array. The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties to the class object.
## Inheritance
</code></pre>
<p>{${classname_mangled}_objectDefinition.parentClass = ${base_classname}_classRef};</p>
<pre><code><br />- `classname_mangled` is the mangled qualified class name, e.g., `foo::A -&gt; foo_A`
- Note: multiple inheritance is not possible; thus we will always take the first parent class
## Namespaces
Namespaces are objects without class templates. i.e., instances are created, referenced locally, used as contexts for other registrations, and stored in the according parent contexts.
</code></pre>
<p>${namespace}_classDefinition.staticFunctions = ${namespace}_functions; ${namespace}_classDefinition.staticValues = ${namespace}_values; JSObjectRef <span class="math">${namespace}_object = JSObjectMake(context, JSClassCreate(&amp;$</span>{namespace}_classDefinition), NULL);</p>
<pre><code><br />## Registration
The registration part consists of registering classes at contexts (i.e., global or namespace), methods and properties at classes or contexts, and namespaces as objects at parent contexts.
* Global functions
</code></pre>
<p>JS_registerFunction(${context}, <span class="math">${context_object}, &quot;$</span>{functionname}&quot;, ${functionwrapper}</p>
<pre><code><br />* Classes
</code></pre>
<p>JS_registerClass(context, <span class="math">${namespace}_object, &quot;$</span>{classname}&quot;, &amp;${classname_mangled}_classDefinition)</p>
<pre><code><br />Note: every class template has an associated constructor function wrapper, which is registered here
* Namespaces
</code></pre>
<p>${namespace}_classDefinition.staticFunctions = ${namespace}_functions; ${namespace}_classDefinition.staticValues = ${namespace}_values; JSObjectRef <span class="math">${namespace}_object = JSObjectMake(context, JSClassCreate(&amp;$</span>{namespace}_classDefinition), NULL);</p>
<pre><code><br />Namespaces are registered using:
</code></pre>
<p>JS_registerNamespace(context, ${namespace}_object, <span class="math">${parent_namespace}_object, &quot;$</span>{namespace}&quot;);</p>
<p>~<sub>~</sub></p>
</div>
</body>
</html>

View file

@ -23,6 +23,7 @@ D.html
Go.html
Guile.html
Java.html
Javascript.html
Lisp.html
Lua.html
Modula3.html

View file

@ -25,7 +25,7 @@ div.indent {
margin-right: 4em;
}
div.code {
div.code, div:not(.code) pre {
border-style: solid;
border-width: 1px;
padding: 2pt;
@ -82,3 +82,7 @@ div.indent p {
margin-right: 0;
}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
text-decoration:none;
color: #000000;
}

View file

@ -589,6 +589,86 @@ java_clean:
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@JAVASO@
##################################################################
##### JAVASCRIPT ######
##################################################################
# Note: These targets are also from within Makefiles in the Example directories.
# There is a common makefile, 'Examples/javascript/js_example.mk' to simplify
# create a configuration for a new example.
ROOT_DIR = @ROOT_DIR@
JSCFLAGS = @JSCFLAGS@
JSCXXFLAGS = @JSCXXFLAGS@
JSINCLUDES = @JSCOREINC@ @JSV8INC@
JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@
JSLIBRARYPREFIX = @JSLIBRARYPREFIX@
JSSO =@JSSO@
JSLDSHARED = @JSLDSHARED@
JSCXXSHARED = @JSCXXSHARED@
SWIGJS = $(SWIG) -javascript
# ----------------------------------------------------------------
# Creating and building Javascript wrappers
# ----------------------------------------------------------------
javascript_wrapper:
$(SWIGJS) $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH)
javascript_wrapper_cpp: $(SRCS)
$(SWIGJS) -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH)
javascript_build: $(SRCS)
$(CC) -c $(CCSHARED) $(CFLAGS) $(JSCFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(JSINCLUDES)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
javascript_build_cpp:: $(SRCS)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(JSCFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES)
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
# TODO: make node-gyp configurable and detected via ./configure
javascript_build_node: $(SRCS)
node-gyp --loglevel=silent configure build 1>>/dev/null
# These targets are used by the test-suite:
javascript: $(SRCS) javascript_custom_interpreter
$(SWIGJS) $(SWIGOPT) $(INTERFACEPATH)
$(CC) -c $(CCSHARED) $(CFLAGS) $(JSCFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(JSINCLUDES)
$(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
javascript_cpp: $(SRCS) javascript_custom_interpreter
$(SWIGJS) -c++ $(SWIGOPT) $(INTERFACEPATH)
$(CXX) -c $(CCSHARED) $(CFLAGS) $(JSCFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES)
$(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO)
# -----------------------------------------------------------------
# Running a javascript example
# -----------------------------------------------------------------
javascript_custom_interpreter:
(cd $(ROOT_DIR)/Tools/javascript && $(MAKE) JSENGINE='$(JSENGINE)')
javascript_run: javascript_custom_interpreter
$(ROOT_DIR)/Tools/javascript/javascript -$(JSENGINE) -L $(TARGET) runme.js
# TODO: make node configurable and detected via ./configure
javascript_run_node:
node runme.js
# -----------------------------------------------------------------
# Cleaning the javascript examples
# -----------------------------------------------------------------
javascript_clean:
rm -rf build
rm -f *_wrap* runme
rm -f core @EXTRA_CLEAN@
rm -f *.@OBJEXT@ *@JSSO@ *.$(SO)
(cd $(ROOT_DIR)/Tools/javascript && $(MAKE) -s clean)
##################################################################
##### ANDROID ######
##################################################################

View file

@ -0,0 +1,13 @@
class
constant
enum
#exception
functor
#namespace
operator
overload
pointer
#reference
simple
template
variables

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,28 @@
/* File : example.c */
#include <iostream>
#include "example.h"
#define M_PI 3.14159265358979323846
/* Move the shape to a new location */
void Shape::move(double dx, double dy) {
x += dx;
y += dy;
}
int Shape::nshapes = 0;
double Circle::area(void) {
return M_PI*radius*radius;
}
double Circle::perimeter(void) {
return 2*M_PI*radius;
}
double Square::area(void) {
return width*width;
}
double Square::perimeter(void) {
return 4*width;
}

View file

@ -0,0 +1,34 @@
/* File : example.h */
class Shape {
public:
Shape() {
nshapes++;
}
virtual ~Shape() {
nshapes--;
};
double x, y;
void move(double dx, double dy);
virtual double area(void) = 0;
virtual double perimeter(void) = 0;
static int nshapes;
};
class Circle : public Shape {
private:
double radius;
public:
Circle(double r) : radius(r) { };
virtual double area(void);
virtual double perimeter(void);
};
class Square : public Shape {
private:
double width;
public:
Square(double w) : width(w) { };
virtual double area(void);
virtual double perimeter(void);
};

View file

@ -0,0 +1,10 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,46 @@
var example = require("./example");
// ----- Object creation -----
console.log("Creating some objects:");
c = new example.Circle(10);
console.log("Created circle " + c);
s = new example.Square(10);
console.log("Created square " + s);
// ----- Access a static member -----
console.log("\nA total of " + example.Shape.nshapes + " shapes were created"); // access static member as properties of the class object
// ----- Member data access -----
// Set the location of the object.
// Note: methods in the base class Shape are used since
// x and y are defined there.
c.x = 20;
c.y = 30;
s.x = -10;
s.y = 5;
console.log("\nHere is their new position:");
console.log("Circle = (" + c.x + "," + c.y + ")");
console.log("Square = (" + s.x + "," + s.y + ")");
// ----- Call some methods -----
console.log("\nHere are some properties of the shapes:");
console.log("Circle:");
console.log("area = " + c.area() + "");
console.log("perimeter = " + c.perimeter() + "");
console.log("\n");
console.log("Square:");
console.log("area = " + s.area() + "");
console.log("perimeter = " + s.perimeter() + "");
// ----- Delete everything -----
console.log("\nGuess I'll clean up now");
// Note: this invokes the virtual destructor
delete c;
delete s;
console.log(example.Shape.nshapes + " shapes remain");
console.log("Goodbye");

View file

@ -0,0 +1,3 @@
SRCS =
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,8 @@
#define ICONST 42
#define FCONST 2.1828
#define CCONST 'x'
#define CCONST2 '\n'
#define SCONST "Hello World"
#define SCONST2 "\"Hello World\""
#define EXTERN extern
#define FOO (ICONST + BAR)

View file

@ -0,0 +1,24 @@
/* File : example.i */
%module example
/* A few preprocessor macros */
#define ICONST 42
#define FCONST 2.1828
#define CCONST 'x'
#define CCONST2 '\n'
#define SCONST "Hello World"
#define SCONST2 "\"Hello World\""
/* This should work just fine */
#define EXPR ICONST + 3*(FCONST)
/* This shouldn't do anything */
#define EXTERN extern
/* Neither should this (BAR isn't defined) */
#define FOO (ICONST + BAR)
/* The following directives also produce constants */
%constant int iconst = 37;
%constant double fconst = 3.14;

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,14 @@
var example = require("./example");
console.log("ICONST = " + example.ICONST + " (should be 42)\n");
console.log("FCONST = " + example.FCONST + " (should be 2.1828)\n");
console.log("CCONST = " + example.CCONST + " (should be 'x')\n");
console.log("CCONST2 = " + example.CCONST2 + " (this should be on a new line)\n");
console.log("SCONST = " + example.SCONST + " (should be 'Hello World')\n");
console.log("SCONST2 = " + example.SCONST2 + " (should be '\"Hello World\"')\n");
console.log("EXPR = " + example.EXPR + " (should be 48.5484)\n");
console.log("iconst = " + example.iconst + " (should be 37)\n");
console.log("fconst = " + example.fconst + " (should be 3.14)\n");
console.log("EXTERN = " + example.EXTERN + " (should be undefined)\n");
console.log("FOO = " + example.FOO + " (should be undefined)\n");

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,37 @@
/* File : example.c */
#include "example.h"
#include <stdio.h>
void Foo::enum_test(speed s) {
if (s == IMPULSE) {
printf("IMPULSE speed\n");
} else if (s == WARP) {
printf("WARP speed\n");
} else if (s == LUDICROUS) {
printf("LUDICROUS speed\n");
} else {
printf("Unknown speed\n");
}
}
void enum_test(color c, Foo::speed s) {
if (c == RED) {
printf("color = RED, ");
} else if (c == BLUE) {
printf("color = BLUE, ");
} else if (c == GREEN) {
printf("color = GREEN, ");
} else {
printf("color = Unknown color!, ");
}
if (s == Foo::IMPULSE) {
printf("speed = IMPULSE speed\n");
} else if (s == Foo::WARP) {
printf("speed = WARP speed\n");
} else if (s == Foo::LUDICROUS) {
printf("speed = LUDICROUS speed\n");
} else {
printf("speed = Unknown speed!\n");
}
}

View file

@ -0,0 +1,13 @@
/* File : example.h */
enum color { RED, BLUE, GREEN };
class Foo {
public:
Foo() { }
enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 };
void enum_test(speed s);
};
void enum_test(color c, Foo::speed s);

View file

@ -0,0 +1,11 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,34 @@
var example = require("./example");
// ----- Object creation -----
// Print out the value of some enums
console.log("*** color ***");
console.log(" RED =" + example.RED);
console.log(" BLUE =" + example.BLUE);
console.log(" GREEN =" + example.GREEN);
console.log("\n*** Foo::speed ***");
console.log(" Foo_IMPULSE =" + example.Foo.IMPULSE);
console.log(" Foo_WARP =" + example.Foo.WARP);
console.log(" Foo_LUDICROUS =" + example.Foo.LUDICROUS);
console.log("\nTesting use of enums with functions\n");
example.enum_test(example.RED, example.Foo.IMPULSE);
example.enum_test(example.BLUE, example.Foo.WARP);
example.enum_test(example.GREEN, example.Foo.LUDICROUS);
example.enum_test(1234,5678);
console.log("\nTesting use of enum with class method");
f = new example.Foo();
f.enum_test(example.Foo.IMPULSE);
f.enum_test(example.Foo.WARP);
f.enum_test(example.Foo.LUDICROUS);
// enum value BLUE of enum color is accessed as property of cconst
console.log("example.BLUE= " + example.BLUE);
// enum value LUDICROUS of enum Foo::speed is accessed as as property of cconst
console.log("example.speed.LUDICROUS= " + example.Foo.LUDICROUS);

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,53 @@
/* File : example.h */
#include <string.h>
#ifndef SWIG
struct A {
};
#endif
class Exc {
public:
Exc(int c, const char *m) {
code = c;
strncpy(msg,m,256);
}
int code;
char msg[256];
};
#if defined(_MSC_VER)
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif
class Test {
public:
int simple() throw(int) {
throw(37);
return 1;
}
int message() throw(const char *) {
throw("I died.");
return 1;
}
int hosed() throw(Exc) {
throw(Exc(42,"Hosed"));
return 1;
}
int unknown() throw(A*) {
static A a;
throw &a;
return 1;
}
int multi(int x) throw(int, const char *, Exc) {
if (x == 1) throw(37);
if (x == 2) throw("Bleah!");
if (x == 3) throw(Exc(42,"No-go-diggy-die"));
return 1;
}
};
#if defined(_MSC_VER)
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
#endif

View file

@ -0,0 +1,12 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
%include "std_string.i"
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,64 @@
var example = require("./example");
console.log("Trying to catch some exceptions.");
t = new example.Test();
try{
t.unknown();
throw -1;
} catch(error)
{
if(error == -1) {
console.log("t.unknown() didn't throw");
} else {
console.log("successfully catched throw in Test::unknown().");
}
}
try{
t.simple();
throw -1;
}
catch(error){
if(error == -1) {
console.log("t.simple() did not throw");
} else {
console.log("successfully catched throw in Test::simple().");
}
}
try{
t.message();
throw -1;
} catch(error){
if(error == -1) {
console.log("t.message() did not throw");
} else {
console.log("successfully catched throw in Test::message().");
}
}
try{
t.hosed();
throw -1;
}
catch(error){
if(error == -1) {
console.log("t.hosed() did not throw");
} else {
console.log("successfully catched throw in Test::hosed().");
}
}
for (var i=1; i<4; i++) {
try{
t.multi(i);
throw -1;
}
catch(error){
if(error == -1) {
console.log("t.multi(" + i + ") did not throw");
} else {
console.log("successfully catched throw in Test::multi().");
}
}
}

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

View file

@ -0,0 +1,25 @@
/* File : example.i */
%module example
%inline %{
// From B. Strousjoup, "The C++ Programming Language, Third Edition", p. 514
template<class T> class Sum {
T res;
public:
Sum(T i = 0) : res(i) { }
void operator() (T x) { res += x; }
T result() const { return res; }
};
%}
%rename(call) *::operator(); // the fn call operator
// Instantiate a few versions
%template(intSum) Sum<int>;
%template(doubleSum) Sum<double>;

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,15 @@
var example = require("./example");
a = new example.intSum(0);
b = new example.doubleSum(100.0);
// Use the objects. They should be callable just like a normal
// javascript function.
for (i=1;i<=100;i++)
a.call(i); // Note: function call
b.call(Math.sqrt(i)); // Note: function call
console.log(a.result());
console.log(b.result());

View file

@ -0,0 +1,52 @@
# Note: as a convention an example must be in a child directory of this.
# These paths are relative to such an example directory
EXAMPLES_TOP=../..
SWIG_TOP=../../..
SWIG = $(SWIG_TOP)/preinst-swig
# TODO: we could only set these only if not yet set...
JS_SCRIPT = runme.js
TARGET = example
INTERFACE = example.i
ifneq (, $(ENGINE))
JSENGINE=$(ENGINE)
else
JSENGINE=node
endif
SWIGOPT=-$(JSENGINE)
ifeq (node,$(JSENGINE))
build: wrapper
$(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' JSENGINE='$(JSENGINE)' javascript_build_node
else
build: wrapper
$(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' JSENGINE='$(JSENGINE)' javascript_build_cpp
endif
wrapper:
$(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper_cpp
ifeq (node,$(JSENGINE))
check: build
$(MAKE) -f $(EXAMPLES_TOP)/Makefile JSENGINE='$(JSENGINE)' javascript_run_node
else
check: build
$(MAKE) -f $(EXAMPLES_TOP)/Makefile JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run
endif
clean:
$(MAKE) -f $(EXAMPLES_TOP)/Makefile javascript_clean

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,36 @@
/* File : example.c */
#include <iostream>
#include "example.h"
#define M_PI 3.14159
/* A global variable */
namespace nspace
{
double Foo = 3.0;
/* Compute the greatest common divisor of positive integers */
int gcd(int x, int y) {
int g;
g = y;
while (x > 0) {
g = x;
x = y % x;
y = g;
}
return g;
}
Circle::Circle(): radius(1.0) {}
Circle::Circle(double r): radius(r) {
std::cout << "created Circle with r=" << radius << std::endl;
}
double Circle::area() {
std::cout << "Circle::area called, r=" << radius << std::endl;
return M_PI*radius*radius;
}
}

View file

@ -0,0 +1,20 @@
namespace nspace {
extern int gcd(int x, int y);
extern double Foo;
class Circle
{
public:
Circle();
Circle(double r);
double area();
double radius;
};
}

View file

@ -0,0 +1,10 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
%feature("nspace", 1);
%include "example.h"

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,10 @@
var example = require("./example");
console.log("Global variable Foo=" + example.nspace.Foo);
example.nspace.Foo = 5;
console.log("Variable Foo changed to " + example.nspace.Foo);
console.log("GCD of number 6,18 is " + example.nspace.gcd(6,18));
console.log("Creating some objects:");
c = new example.nspace.Circle(10);
console.log("area = " + c.area());

View file

@ -0,0 +1,3 @@
SRCS =
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,36 @@
/* File : example.h */
#include <math.h>
class Complex {
private:
double rpart, ipart;
public:
Complex(double r = 0, double i = 0) : rpart(r), ipart(i) { }
Complex(const Complex &c) : rpart(c.rpart), ipart(c.ipart) { }
Complex &operator=(const Complex &c) {
rpart = c.rpart;
ipart = c.ipart;
return *this;
}
Complex operator+(const Complex &c) const {
return Complex(rpart+c.rpart, ipart+c.ipart);
}
Complex operator-(const Complex &c) const {
return Complex(rpart-c.rpart, ipart-c.ipart);
}
Complex operator*(const Complex &c) const {
return Complex(rpart*c.rpart - ipart*c.ipart,
rpart*c.ipart + c.rpart*ipart);
}
Complex operator-() const {
return Complex(-rpart, -ipart);
}
double re() const { return rpart; }
double im() const { return ipart; }
};

View file

@ -0,0 +1,34 @@
/* File : example.i */
%module example
#pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ
%{
#include "example.h"
%}
/* This header file is a little tough to handle because it has overloaded
operators and constructors. We're going to try and deal with that here */
/* This turns the copy constructor in a function ComplexCopy() that can
be called */
%rename(assign) Complex::operator=;
%rename(plus) Complex::operator+;
%rename(minus) Complex::operator-(const Complex &) const;
%rename(uminus) Complex::operator-() const;
%rename(times) Complex::operator*;
/* Now grab the original header file */
%include "example.h"
/* An output method that turns a complex into a short string */
%extend Complex {
char *toString() {
static char temp[512];
sprintf(temp,"(%g,%g)", $self->re(), $self->im());
return temp;
}
static Complex* copy(const Complex& c) {
return new Complex(c);
}
};

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,25 @@
var example = require("./example");
a = new example.Complex(2,3);
b = new example.Complex(-5,10);
console.log ("a =" + a);
console.log ("b =" + b);
c = a.plus(b);
console.log("c =" + c);
console.log("a*b =" + a.times(b));
console.log("a-c =" + a.minus(c));
e = example.Complex.copy(a.minus(c));
console.log("e =" + e);
// Big expression
f = a.plus(b).times(c.plus(b.times(e))).plus(a.uminus());
console.log("f =" + f);

View file

@ -0,0 +1,3 @@
SRCS =
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,28 @@
#include <iostream>
void f() {
std::cout << "Called f()." << std::endl;
}
void f(int val) {
std::cout << "Called f(int)." << std::endl;
}
void f(int val1, int val2) {
std::cout << "Called f(int, int)." << std::endl;
}
void f(const char* s) {
std::cout << "Called f(const char*)." << std::endl;
}
void f(bool val) {
std::cout << "Called f(bool)." << std::endl;
}
void f(long val) {
std::cout << "Called f(long)." << std::endl;
}
void f(double val) {
std::cout << "Called f(double)." << std::endl;
}

View file

@ -0,0 +1,16 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
/*
Note: overloading is implemented in a sloppy way currently
i.e., only the number of arguments is taken into conideration
for dispatching.
To solve the problem one has to rename such conflicting methods.
*/
%rename(f_double) f(double val);
%include "example.h"

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,9 @@
var example = require("./example");
example.f();
example.f(1);
example.f(1, 2);
example.f("bla");
example.f(false);
example.f(11111111111);
example.f_double(1.0);

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,16 @@
/* File : example.c */
void add(int *x, int *y, int *result) {
*result = *x + *y;
}
void subtract(int *x, int *y, int *result) {
*result = *x - *y;
}
int divide(int n, int d, int *r) {
int q;
q = n/d;
*r = n - q*d;
return q;
}

View file

@ -0,0 +1,30 @@
/* File : example.i */
%module example
%{
extern void add(int *, int *, int *);
extern void subtract(int *, int *, int *);
extern int divide(int, int, int *);
%}
/* This example illustrates a couple of different techniques
for manipulating C pointers */
/* First we'll use the pointer library */
extern void add(int *x, int *y, int *result);
%include cpointer.i
%pointer_functions(int, intp);
/* Next we'll use some typemaps */
%include typemaps.i
extern void subtract(int *INPUT, int *INPUT, int *OUTPUT);
/* Next we'll use typemaps and the %apply directive */
%apply int *OUTPUT { int *r };
extern int divide(int n, int d, int *r);

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,35 @@
var example = require("./example");
// First create some objects using the pointer library.
console.log("Testing the pointer library\n");
a = example.new_intp();
b = example.new_intp();
c = example.new_intp();
example.intp_assign(a,37);
example.intp_assign(b,42);
console.log(" a = " + example.intp_value(a) + "\n");
console.log(" b = " + example.intp_value(b) + "\n");
console.log(" c = " + example.intp_value(c) + "\n");
//// Call the add() function with some pointers
example.add(a, b, c);
//
//// Now get the result
r = example.intp_value(c);
console.log(" 37 + 42 = " + r + "\n");
// Clean up the pointers
example.delete_intp(a);
example.delete_intp(b);
example.delete_intp(c);
//// Now try the typemap library
//// This should be much easier. Now how it is no longer
//// necessary to manufacture pointers.
//"OUTPUT" Mapping is not supported
//console.log("Trying the typemap library");
//r = example.subtract(37,42);
//console.log("37 - 42 =" + r);

View file

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,46 @@
/* File : example.cxx */
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif
#include "example.h"
#include <stdio.h>
#include <stdlib.h>
Vector operator+(const Vector &a, const Vector &b) {
Vector r;
r.x = a.x + b.x;
r.y = a.y + b.y;
r.z = a.z + b.z;
return r;
}
char *Vector::print() {
static char temp[512];
sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);
return temp;
}
VectorArray::VectorArray(int size) {
items = new Vector[size];
maxsize = size;
}
VectorArray::~VectorArray() {
delete [] items;
}
Vector &VectorArray::operator[](int index) {
if ((index < 0) || (index >= maxsize)) {
printf("Panic! Array index out of bounds.\n");
exit(1);
}
return items[index];
}
int VectorArray::size() {
return maxsize;
}

View file

@ -0,0 +1,26 @@
/* File : example.h */
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) { };
friend Vector operator+(const Vector &a, const Vector &b);
char *print();
};
class VectorArray {
private:
Vector *items;
int maxsize;
public:
VectorArray(int maxsize);
~VectorArray();
Vector &operator[](int);
int size();
};

View file

@ -0,0 +1,42 @@
/* File : example.i */
/* This file has a few "typical" uses of C++ references. */
%module example
%{
#include "example.h"
%}
class Vector {
public:
Vector(double x, double y, double z);
~Vector();
char *print();
};
/* This helper function calls an overloaded operator */
%inline %{
Vector addv(Vector &a, Vector &b) {
return a+b;
}
%}
/* Wrapper around an array of vectors class */
class VectorArray {
public:
VectorArray(int maxsize);
~VectorArray();
int size();
/* This wrapper provides an alternative to the [] operator */
%extend {
Vector &get(int index) {
return (*$self)[index];
}
void set(int index, Vector &a) {
(*$self)[index] = a;
}
}
};

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,67 @@
// This file illustrates the manipulation of C++ references in Javascript.
var example = require("./example");
// ----- Object creation -----
console.log("Creating some objects:\n");
a = new example.Vector(3,4,5);
b = new example.Vector(10,11,12);
console.log(" created" + a.print());
console.log(" created" + b.print());
// ----- Call an overloaded operator -----
// This calls the wrapper we placed around operator+(const Vector &a, const Vector &)
// It returns a new allocated object.
console.log("Adding a+b\n");
c = example.addv(a, b);
console.log("a+b = " + c.print());
// TODO: Note: Unless we free the result, a memory leak will occur
//delete_Vector(c);
// ----- Create a vector array -----
// Note: Using the high-level interface here
console.log("Creating an array of vectors\n");
va = new example.VectorArray(10);
console.log("va = " + va + "\n");
// ----- Set some values in the array -----
// These operators copy the value of a and b to the vector array
va.set(0,a);
va.set(1,b);
// This will work, but it will cause a memory leak!
va.set(2,example.addv(a,b));
// The non-leaky way to do it
//c = addv(a,b);
//va.set(3,c);
//delete_Vector(c);
// Get some values from the array
console.log("Getting some array values\n");
for (i = 0; i < 5; i++) {
temp = va.get(i);
console.log(i,temp.print());
}
// Watch under resource meter to check on this
console.log("Making sure we don't leak memory.\n");
for (i = 0; i < 1000000; i++) {
c = va.get(i % 10);
}
//---------TODO---------
//----- Clean up -----
//console.log("Cleaning up\n");
//example.delete_VectorArray(va);
//example.delete_Vector(a);
//example.delete_Vector(b);

View file

@ -0,0 +1,22 @@
Loaded swig printers
SwigStringPrinter: Could not convert const char* to string
SwigListIterator: Construction failed.
Cannot access memory at address 0x7d894828ec834853.
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigListIterator: Construction failed.
Cannot access memory at address 0x7d894828ec834853.
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not dereference struct String*
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not dereference struct String*
SwigStringPrinter: Could not dereference struct String*
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not dereference struct String*
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not dereference struct String*
SwigStringPrinter: Could not dereference struct String*

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,18 @@
/* File : example.c */
/* A global variable */
double Foo = 3.0;
/* Compute the greatest common divisor of positive integers */
int gcd(int x, int y) {
int g;
g = y;
while (x > 0) {
g = x;
x = y % x;
y = g;
}
return g;
}

View file

@ -0,0 +1,7 @@
/* File : example.i */
%module example
%inline %{
extern int gcd(int x, int y);
extern double Foo;
%}

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,26 @@
var example = require("./example");
/* Call our gcd() function */
x = 42;
y = 105;
g = example.gcd(x,y);
console.log("GCD of x and y is=" + g);
/* Manipulate the Foo global variable */
/* Output its current value */
console.log("Global variable Foo=" + example.Foo);
/* Change its value */
example.Foo = 3.1415926;
/* See if the change took effect */
console.log("Variable Foo changed to=" + example.Foo);

View file

@ -0,0 +1,3 @@
SRCS =
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,32 @@
/* File : example.h */
// Some template definitions
template<class T> T max(T a, T b) { return a>b ? a : b; }
template<class T> class vector {
T *v;
int sz;
public:
vector(int _sz) {
v = new T[_sz];
sz = _sz;
}
T &get(int index) {
return v[index];
}
void set(int index, T &val) {
v[index] = val;
}
#ifdef SWIG
%extend {
T getitem(int index) {
return $self->get(index);
}
void setitem(int index, T val) {
$self->set(index,val);
}
}
#endif
};

View file

@ -0,0 +1,17 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
/* Let's just grab the original header file here */
%include "example.h"
/* Now instantiate some specific template declarations */
%template(maxint) max<int>;
%template(maxdouble) max<double>;
%template(vecint) vector<int>;
%template(vecdouble) vector<double>;

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,30 @@
var example = require("./example");
//Call some templated functions
console.log(example.maxint(3,7));
console.log(example.maxdouble(3.14,2.18));
// Create some class
iv = new example.vecint(100);
dv = new example.vecdouble(1000);
for(i=0;i<=100;i++)
iv.setitem(i,2*i);
for(i=0;i<=1000;i++)
dv.setitem(i, 1.0/(i+1));
sum = 0;
for(i=0;i<=100;i++)
sum = sum + iv.getitem(i);
console.log(sum);
sum = 0.0;
for(i=0;i<=1000;i++)
sum = sum + dv.getitem(i);
console.log(sum);
delete iv;
delete dv;

View file

@ -0,0 +1,3 @@
SRCS = example.cxx
include ../js_example.mk

View file

@ -0,0 +1,8 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example.cxx", "example_wrap.cxx" ]
}
]
}

View file

@ -0,0 +1,96 @@
/* File : example.c */
/* I'm a file containing some C global variables */
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif
#include <stdio.h>
#include <stdlib.h>
#include "example.h"
int ivar = 0;
short svar = 0;
long lvar = 0;
unsigned int uivar = 0;
unsigned short usvar = 0;
unsigned long ulvar = 0;
signed char scvar = 0;
unsigned char ucvar = 0;
char cvar = 0;
float fvar = 0;
double dvar = 0;
char *strvar = 0;
#ifdef __cplusplus // Note: for v8 this must be linkable with g++, without extern cstrvar is mangled
extern const char cstrvar[] = "Goodbye";
#else
const char cstrvar[] = "Goodbye";
#endif
const
int *iptrvar = 0;
char name[256] = "Dave";
char path[256] = "/home/beazley";
/* Global variables involving a structure */
Point *ptptr = 0;
Point pt = { 10, 20 };
/* A variable that we will make read-only in the interface */
int status = 1;
/* A debugging function to print out their values */
void print_vars() {
printf("ivar = %d\n", ivar);
printf("svar = %d\n", svar);
printf("lvar = %ld\n", lvar);
printf("uivar = %u\n", uivar);
printf("usvar = %u\n", usvar);
printf("ulvar = %lu\n", ulvar);
printf("scvar = %d\n", scvar);
printf("ucvar = %u\n", ucvar);
printf("fvar = %g\n", fvar);
printf("dvar = %g\n", dvar);
printf("cvar = %c\n", cvar);
printf("strvar = %s\n", strvar ? strvar : "(null)");
printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)");
printf("iptrvar = %p\n", iptrvar);
printf("name = %s\n", name);
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
printf("pt = (%d, %d)\n", pt.x, pt.y);
printf("status = %d\n", status);
}
/* A function to create an integer (to test iptrvar) */
int *new_int(int value) {
int *ip = (int *) malloc(sizeof(int));
*ip = value;
return ip;
}
/* A function to create a point */
Point *new_Point(int x, int y) {
Point *p = (Point *) malloc(sizeof(Point));
p->x = x;
p->y = y;
return p;
}
char * Point_print(Point *p) {
static char buffer[256];
if (p) {
sprintf(buffer,"(%d,%d)", p->x,p->y);
} else {
sprintf(buffer,"null");
}
return buffer;
}
void pt_print() {
printf("(%d, %d)\n", pt.x, pt.y);
}

View file

@ -0,0 +1,6 @@
/* File: example.h */
typedef struct {
int x,y;
} Point;

View file

@ -0,0 +1,49 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
/* Some global variable declarations */
%inline %{
extern int ivar;
extern short svar;
extern long lvar;
extern unsigned int uivar;
extern unsigned short usvar;
extern unsigned long ulvar;
extern signed char scvar;
extern unsigned char ucvar;
extern char cvar;
extern float fvar;
extern double dvar;
extern char *strvar;
extern const char cstrvar[];
extern int *iptrvar;
extern char name[256];
extern Point *ptptr;
extern Point pt;
%}
/* Some read-only variables */
%immutable;
%inline %{
extern int status;
extern char path[256];
%}
%mutable;
/* Some helper functions to make it easier to test */
%inline %{
extern void print_vars();
extern int *new_int(int value);
extern Point *new_Point(int x, int y);
extern char *Point_print(Point *p);
extern void pt_print();
%}

View file

@ -0,0 +1 @@
module.exports = require("./build/Release/example");

View file

@ -0,0 +1,68 @@
var example = require("./example");
// Try to set the values of some global variables
example.ivar = 42;
example.svar = -31000;
example.lvar = 65537;
example.uivar = 123456;
example.usvar = 61000;
example.ulvar = 654321;
example.scvar = -13;
example.ucvar = 251;
example.cvar = "S";
example.fvar = 3.14159;
example.dvar = 2.1828;
example.strvar = "Hello World";
example.iptrvar= example.new_int(37);
example.ptptr = example.new_Point(37,42);
example.name = "Bill";
// Now console.log out the values of the variables
console.log("Variables (values console.loged from Python)" + "\n");
console.log("ivar = " + example.ivar + "\n");
console.log("svar = " + example.svar + "\n");
console.log("lvar = " + example.lvar + "\n");
console.log("uivar = " + example.uivar + "\n");
console.log("usvar = " + example.usvar + "\n");
console.log("ulvar = " + example.ulvar + "\n");
console.log("scvar = " + example.scvar + "\n");
console.log("ucvar = " + example.ucvar + "\n");
console.log("fvar = " + example.fvar + "\n");
console.log("dvar = " + example.dvar + "\n");
console.log("cvar = " + example.cvar + "\n");
console.log("strvar = " + example.strvar+ "\n");
console.log("cstrvar = " + example.cstrvar+ "\n");
console.log("iptrvar = " + example.iptrvar+ "\n");
console.log("name = " + example.name + "\n");
console.log("ptptr = " + example.ptptr + ": " + example.Point_print(example.ptptr) + "\n");
console.log("pt = " + example.pt + ": " + example.Point_print(example.pt) + "\n");
console.log("\nVariables (values console.loged from C)");
example.print_vars();
console.log("\nNow I'm going to try and modify some read only variables");
console.log("Tring to set 'path'");
try{
example.path = "Whoa!";
console.log("Hey, what's going on?!?! This shouldn't work");
}
catch(e){
console.log("Good.");
}
console.log("Trying to set 'status'");
try{
example.status = 0;
console.log("Hey, what's going on?!?! This shouldn't work");
} catch(e){
console.log("Good.");
}
console.log("\nI'm going to try and update a structure variable.\n");
example.pt = example.ptptr;
console.log("The new value is: ");
example.pt_print();
console.log("You should see the value: " + example.Point_print(example.ptptr));

View file

@ -0,0 +1,9 @@
Loaded swig printers
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string
SwigStringPrinter: Could not convert const char* to string

View file

@ -98,6 +98,7 @@ C_TEST_BROKEN += \
tag_no_clash_with_variable
# C++ test cases. (Can be run individually using: make testcase.cpptest)
ifndef SKIP_CPP_CASES
CPP_TEST_CASES += \
abstract_access \
abstract_inherit \
@ -489,6 +490,7 @@ CPP_TEST_CASES += \
voidtest \
wallkw \
wrapmacro
endif
# C++11 test cases.
CPP11_TEST_CASES = \
@ -562,6 +564,7 @@ CPP_TEST_CASES += $(CPP11_TEST_CASES)
endif
# C test cases. (Can be run individually using: make testcase.ctest)
ifndef SKIP_C_CASES
C_TEST_CASES += \
arrays \
bom_utf8 \
@ -612,9 +615,10 @@ C_TEST_CASES += \
typemap_subst \
union_parameter \
unions
endif
# Multi-module C++ test cases . (Can be run individually using make testcase.multicpptest)
ifndef SKIP_MULTI_CPP_CASES
MULTI_CPP_TEST_CASES += \
clientdata_prop \
imports \
@ -623,6 +627,7 @@ MULTI_CPP_TEST_CASES += \
mod \
template_typedef_import \
multi_import
endif
# Custom tests - tests with additional commandline options
wallkw.cpptest: SWIGOPT += -Wallkw

View file

@ -73,7 +73,7 @@ public:
%include "std_vector.i"
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY) || defined(SWIGJAVASCRIPT)
#define SWIG_GOOD_VECTOR
%ignore std::vector<Space::Flow>::vector(size_type);
%ignore std::vector<Space::Flow>::resize(size_type);

View file

@ -40,7 +40,7 @@ namespace TopLevel
%include <std_string.i>
// nspace feature only supported by these languages
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA)
#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGD) || defined(SWIGLUA) || defined(SWIGJAVASCRIPT)
%nspace TopLevel::Bar::Foo;
%nspace TopLevel::Bar::FooBar;
#else

View file

@ -0,0 +1,48 @@
%module infinity
#include <math.h>
/* C99 defines INFINITY
Because INFINITY may be defined by compiler built-ins, we can't use #define.
Instead, expose the variable MYINFINITY and then use %rename to make it INFINITY in the scripting language.
*/
%rename(INFINITY) MYINFINITY;
%inline %{
#include <math.h>
/* C99 math.h defines INFINITY. If not available, this is the fallback. */
#ifndef INFINITY
#ifdef _MSC_VER
union MSVC_EVIL_FLOAT_HACK
{
unsigned __int8 Bytes[4];
float Value;
};
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
#endif
#ifdef __GNUC__
#define INFINITY (__builtin_inf())
#elif defined(__clang__)
#if __has_builtin(__builtin_inf)
#define INFINITY (__builtin_inf())
#endif
#endif
#ifndef INFINITY
#define INFINITY (1e1000)
#endif
#endif
/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */
const double MYINFINITY = INFINITY;
/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */
float use_infinity(float inf_val)
{
return inf_val;
}
%}

Some files were not shown because too many files have changed in this diff Show more