Add JS Native Wrapper API
This commit is contained in:
parent
f06330e720
commit
ff19363abf
1 changed files with 29 additions and 0 deletions
|
|
@ -197,6 +197,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int emitWrapperFunction(Node *n);
|
virtual int emitWrapperFunction(Node *n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked by nativeWrapper callback
|
||||||
|
*/
|
||||||
|
virtual int emitNativeFunction(Node *n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked from constantWrapper after call to Language::constantWrapper.
|
* Invoked from constantWrapper after call to Language::constantWrapper.
|
||||||
**/
|
**/
|
||||||
|
|
@ -311,6 +316,7 @@ public:
|
||||||
virtual int classHandler(Node *n);
|
virtual int classHandler(Node *n);
|
||||||
virtual int functionWrapper(Node *n);
|
virtual int functionWrapper(Node *n);
|
||||||
virtual int constantWrapper(Node *n);
|
virtual int constantWrapper(Node *n);
|
||||||
|
virtual int nativeWrapper(Node *n);
|
||||||
virtual void main(int argc, char *argv[]);
|
virtual void main(int argc, char *argv[]);
|
||||||
virtual int top(Node *n);
|
virtual int top(Node *n);
|
||||||
|
|
||||||
|
|
@ -441,6 +447,18 @@ int JAVASCRIPT::constantWrapper(Node *n) {
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------
|
||||||
|
* nativeWrapper()
|
||||||
|
*
|
||||||
|
* Function wrapper for generating placeholders for native functions
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int JAVASCRIPT::nativeWrapper(Node *n) {
|
||||||
|
emitter->emitNativeFunction(n);
|
||||||
|
|
||||||
|
return SWIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* classHandler()
|
* classHandler()
|
||||||
*
|
*
|
||||||
|
|
@ -768,6 +786,17 @@ int JSEmitter::emitWrapperFunction(Node *n) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int JSEmitter::emitNativeFunction(Node *n) {
|
||||||
|
String *wrap_name = Getattr(n, "wrap:name");
|
||||||
|
|
||||||
|
Setattr(n, "feature:extend", "last");
|
||||||
|
enterFunction(n);
|
||||||
|
state.function(WRAPPER_NAME, wrap_name);
|
||||||
|
exitFunction(n);
|
||||||
|
|
||||||
|
return SWIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
int JSEmitter::enterClass(Node *n) {
|
int JSEmitter::enterClass(Node *n) {
|
||||||
state.clazz(RESET);
|
state.clazz(RESET);
|
||||||
state.clazz(NAME, Getattr(n, "sym:name"));
|
state.clazz(NAME, Getattr(n, "sym:name"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue