Commit Graph

141 Commits

Author SHA1 Message Date
Oliver Buchtala 74825d2d1a Fix regression of 226da4. 2014-04-26 22:47:57 +02:00
Oliver Buchtala 226da453fc Print error when specified multiple js engines.
Plus, consolidated names: EmitterType, mode, engine -> engine.
2014-04-26 22:27:12 +02:00
William S Fulton 4edb618501 beautify javascript.cxx 2014-04-25 07:26:27 +01:00
William S Fulton a80f4551db Javascript variable naming convention corrections
Also rename global -> globals just to placate the beautifier
2014-04-25 07:21:32 +01:00
William S Fulton a5e91f26a1 Cosmetic code changes in javascript.cxx 2014-04-24 21:54:44 +01:00
Oliver Buchtala fe3f00837c Fix regression in Javascript generator for enums. 2014-04-23 03:46:46 +02:00
Oliver Buchtala 953f2f91dc Fix generator for Javascript enums. 2014-04-23 02:26:47 +02:00
Oliver Buchtala 3c593f56de Turn on Swig_cparse_cplusplusout for Javascript/v8. 2014-04-23 02:26:24 +02:00
William S Fulton 4837c5c9eb Add missing license info 2014-04-16 07:50:28 +01:00
William S Fulton d8b3b4e474 Improve missing JS engine error message 2014-04-16 07:39:25 +01:00
Oliver Buchtala 89610e984e Beautified Javascript module. 2014-03-05 01:39:26 +01:00
Oliver Buchtala b5bc87667d Fix regressions.
- Adapted to changes in UTL
- Fixed detection of setters and getters.
2014-03-05 01:10:55 +01:00
Oliver Buchtala 70385842df Add missing copy ctor for Javascript Code Template class. 2014-02-28 10:40:41 +01:00
Oliver Buchtala 16a702c0aa Added a comment. 2014-02-26 10:48:38 +01:00
Oliver Buchtala 15550dab45 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.
2014-02-25 20:16:15 +01:00
Oliver Buchtala 8e65414a76 Add an extra argument for enabling nodejs support.
This is essentially using the v8 emitter plus setting a #define.
2014-02-20 11:37:15 +01:00
Oliver Buchtala 48e7df8eb2 Better error message when no Javascript emitter is specified. 2014-02-20 11:15:18 +01:00
Oliver Buchtala 915b709433 Not a real change.
Using a macro to reset JSEmitterStates for the sake of readability.
2014-02-14 00:02:05 +01:00
Oliver Buchtala 1e34ecdc31 Next iteration on creating a documentation for the Javascript module. 2014-02-13 19:25:16 +01:00
Oliver Buchtala 6a366cc050 Fix regression. 2013-09-27 03:24:50 +02:00
Oliver Buchtala 51b36d1a1f Add non pretty printing function to Templates. 2013-09-24 03:55:51 +02:00
Oliver Buchtala dc62a69775 Fix bug with typedefd function pointers. 2013-09-24 03:55:10 +02:00
Oliver Buchtala b9ecf75f17 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.
2013-09-24 01:50:13 +02:00
Oliver Buchtala 8bf966a65c Fix %nspace support and activated relevant tests. 2013-09-24 01:47:13 +02:00
Oliver Buchtala b3c198ccee Fix regression. 2013-09-16 22:28:14 +02:00
Oliver Buchtala b99e8613ad Bugfix in argument marshalling. 2013-09-16 21:56:52 +02:00
Oliver Buchtala 0528fd3ac3 Bugfix for Javascript generator. 2013-09-16 11:46:00 +02:00
Oliver Buchtala 147cec70f1 Replace $symname in generated function wrappers. 2013-09-16 04:54:57 +02:00
Oliver Buchtala 1f07195812 Rearrange generation of init block to have custom init code within the initializer body. 2013-09-16 03:53:00 +02:00
Oliver Buchtala 80ce36c445 Make JSC inheritance definition more robust. 2013-09-16 02:27:51 +02:00
Oliver Buchtala 973042302b Removed dead code. 2013-09-16 01:57:55 +02:00
Oliver Buchtala bb7bd50eab Add support for IN/OUTPUT typemaps. 2013-09-16 00:55:43 +02:00
Oliver Buchtala acfed20eba Bugfix Javascript generator: valid name for dispatcher functions. 2013-09-12 05:10:23 +02:00
Oliver Buchtala 1a04e488bc Fix Javascript generator for smartpointeraccessed variables. 2013-09-12 05:40:59 +03:00
Oliver Buchtala 8bf95c4356 Bugfix for Javascript generator: avoid duplicate action code generation. 2013-09-12 05:09:35 +03:00
Oliver Buchtala 09a210e037 Bugfix in Javascript generator: detect member setter/getters correctly. 2013-09-12 04:09:21 +03:00
Oliver Buchtala dd84e6f9e0 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.
2013-09-10 14:16:36 +03:00
Oliver Buchtala 001f38c6a9 Fix settings for building nodejs tests.
Removed the `-node` command line flag.
Instead one has to use `-v8 -DBUILDING_NODE_EXTENSION=1`.
2013-09-10 13:29:16 +03:00
Oliver Buchtala 571c516a0b Some fixes for the Javascript generator.
- added missing `exception.i`
- added missing generator block `wrappers` for v8
2013-09-09 22:25:51 +03:00
Oliver Buchtala b6c9c97b96 Fix Javascript generator to use %renamed variable names. 2013-09-09 15:05:11 +03:00
Oliver Buchtala 1729fac360 Bug-fix for static variables as proposed by Kota Iguchi.
Fixes #20.
2013-09-09 12:46:07 +03:00
Oliver Buchtala 29ccb270af Renamed object provided to JS initializers.
JSC initializer create a new module object.
V8 initializer fill a provided 'exports' object.
2013-09-06 00:40:29 +03:00
Kota Iguchi 78a3cc9e3e Added the finalize callback (JSObjectFinalizeCallback) 2013-09-03 13:49:36 +02:00
Oliver Buchtala 5228c0eeab Add a dedicated mode for creating node modules. 2013-09-03 05:36:41 +02:00
Kota Iguchi 0732592ed9 Patch to support argout typemap for your swig-v8 branch. 2013-08-31 03:47:49 +02:00
Oliver Buchtala 32f9cce600 Merged whoozle branch with ewmailing branch.
Conflicts:
	Lib/javascript/v8/javascriptcode.swg
2013-08-31 03:47:43 +02:00
Oliver Buchtala 306b265af9 Merge branch 'devel' of git://github.com/oliver----/swig-v8 into devel
Conflicts:
	Lib/javascript/v8/javascriptcode.swg
2013-08-31 03:47:08 +02:00
Eric Wing ed729f7d3a 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;
2013-08-31 03:46:07 +02:00
Oliver Buchtala 868803ce2a Merge replayed as done by c778d16abed35829b103d607a53c8f88e3b2d595 2013-08-31 03:44:44 +02:00
Vladimir Menshakov a190288e66 fixed overloaded functions multiplication 2013-08-31 03:34:39 +02:00
Oliver Buchtala a4036deda8 Add pre-processor defines to detect the javascript engine. 2013-08-31 03:34:38 +02:00
Oliver Buchtala 8b10c47ed8 Fix regression: add an include for Node.js header. 2013-08-31 03:34:37 +02:00
Oliver Buchtala caa92740d3 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.
2013-08-31 03:23:12 +02:00
Oliver Buchtala 4fea3a403e Generate an extra file part after the initializer for v8 modules.
E.g., this is useful for creating node.js modules.
2013-08-31 03:23:12 +02:00
Oliver Buchtala 2c4a90a37d Generate defines for initializer function. 2013-08-31 03:23:11 +02:00
Oliver Buchtala 6754bf2b49 Generate cleanup code for %newobject. 2013-08-31 03:23:10 +02:00
Oliver Buchtala 57980975a0 Generate cleanup code. 2013-08-31 03:23:10 +02:00
Oliver Buchtala 94730dad7a 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
2012-09-08 01:16:54 +00:00
Oliver Buchtala 217ffb11d0 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
2012-09-08 01:16:26 +00:00
Oliver Buchtala 9b06144d39 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
2012-09-08 01:16:09 +00:00
Oliver Buchtala 131a106204 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
2012-09-08 01:15:51 +00:00
Oliver Buchtala 7c7d1cf3b9 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
2012-09-08 01:15:12 +00:00
Oliver Buchtala f814a8e702 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
2012-09-08 01:14:02 +00:00
Oliver Buchtala 91fc0ff205 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
2012-09-08 01:13:03 +00:00
Oliver Buchtala d13289cc91 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
2012-09-08 01:12:18 +00:00
Oliver Buchtala da6307a19e 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
2012-09-08 01:11:32 +00:00
Oliver Buchtala 2893df9f73 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
2012-09-08 01:10:27 +00:00
Oliver Buchtala c4ab879027 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
2012-09-08 01:10:10 +00:00
Oliver Buchtala f1e9b21dfd 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
2012-09-08 01:08:50 +00:00
Oliver Buchtala 21bdb78f1c 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
2012-09-08 01:08:33 +00:00
Oliver Buchtala 46cff47ada 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
2012-09-08 01:08:03 +00:00
Oliver Buchtala cda09239ad 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
2012-09-08 01:06:58 +00:00
Oliver Buchtala 0cae8fccd0 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
2012-09-08 01:06:39 +00:00
Oliver Buchtala 9b0c8dae83 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
2012-09-08 01:06:26 +00:00
Oliver Buchtala d5c5f7ebee Generalize ctor overloading.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13790 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 01:06:08 +00:00
Oliver Buchtala 78442b2764 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
2012-09-08 01:05:37 +00:00
Oliver Buchtala 8d72616e65 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
2012-09-08 01:05:11 +00:00
Oliver Buchtala 07d5ec24ce 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
2012-09-08 01:02:16 +00:00
Oliver Buchtala 4d9ca620ab 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
2012-09-08 01:00:15 +00:00
Oliver Buchtala 387da69e84 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
2012-09-08 00:59:55 +00:00
Oliver Buchtala 66ead9afb2 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
2012-09-08 00:59:43 +00:00
Oliver Buchtala 16077503c8 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
2012-09-08 00:59:18 +00:00
Oliver Buchtala c470864d12 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
2012-09-08 00:59:03 +00:00
Oliver Buchtala 46624e24e5 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
2012-09-08 00:58:49 +00:00
Oliver Buchtala 8577ae4179 Minor clean up.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13769 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-09-08 00:58:37 +00:00
Oliver Buchtala b778c4816b 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
2012-09-08 00:58:23 +00:00
Oliver Buchtala 9af3c4879b 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
2012-09-08 00:58:11 +00:00
Oliver Buchtala b39e2bfff0 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
2012-09-08 00:57:57 +00:00
Oliver Buchtala 050219d998 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
2012-09-08 00:56:48 +00:00
Oliver Buchtala 3c30e2d382 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
2012-09-08 00:47:19 +00:00
Oliver Buchtala d71a5f483a 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
2012-09-08 00:44:54 +00:00