Rearrange generation of init block to have custom init code within the initializer body.
This commit is contained in:
parent
80ce36c445
commit
1f07195812
5 changed files with 137 additions and 125 deletions
|
|
@ -263,56 +263,6 @@ int $jswrapper(JSContextRef context, JSObjectRef function, JSObjectRef thisObjec
|
|||
}
|
||||
%}
|
||||
|
||||
%fragment ("js_initializer_define", "templates") %{
|
||||
#define SWIGJSC_INIT $jsname_initialize
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* js_initializer: template for the module initializer function
|
||||
* - $jsname: module name
|
||||
* - $jscreatenamespaces: part with code for creating namespace objects
|
||||
* - $jscreateclasses: part with code for creating classes
|
||||
* - $jsregisternamespaces: part with code for registration of namespaces
|
||||
* ----------------------------------------------------------------------------- */
|
||||
%fragment ("js_initializer", "templates") %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool SWIGJSC_INIT (JSGlobalContextRef context, JSObjectRef *exports) {
|
||||
SWIG_InitializeModule(0);
|
||||
|
||||
/* Initialize the base swig type object */
|
||||
_SwigObject_objectDefinition.staticFunctions = _SwigObject_functions;
|
||||
_SwigObject_objectDefinition.staticValues = _SwigObject_values;
|
||||
_SwigObject_classRef = JSClassCreate(&_SwigObject_objectDefinition);
|
||||
|
||||
/* Initialize the PackedData class */
|
||||
_SwigPackedData_objectDefinition.staticFunctions = _SwigPackedData_functions;
|
||||
_SwigPackedData_objectDefinition.staticValues = _SwigPackedData_values;
|
||||
_SwigPackedData_objectDefinition.finalize = _wrap_SwigPackedData_delete;
|
||||
_SwigPackedData_classRef = JSClassCreate(&_SwigPackedData_objectDefinition);
|
||||
|
||||
/* Create objects for namespaces */
|
||||
$jscreatenamespaces
|
||||
|
||||
/* Register classes */
|
||||
$jsregisterclasses
|
||||
|
||||
/* Register namespaces */
|
||||
$jsregisternamespaces
|
||||
|
||||
*exports = exports_object;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* jsc_variable_declaration: template for a variable table entry
|
||||
* - $jsname: name of the variable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue