Update v8 specification.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13758 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0fd30dc60f
commit
e8dd979d16
1 changed files with 21 additions and 23 deletions
|
|
@ -66,16 +66,15 @@ There are different types of function wrappers:
|
|||
v8::Handle<v8::Value> wrap_${NAME_MANGLED}(const v8::Arguments &args) {
|
||||
v8::HandleScope scope;
|
||||
v8::Handle<v8::Value> ret;
|
||||
|
||||
${LOCALS}
|
||||
${MARSHAL_INPUT}
|
||||
${ACTION}
|
||||
${MARSHAL_OUTPUT}
|
||||
|
||||
${CODE}
|
||||
return scope.Close(ret);
|
||||
}
|
||||
~~~~
|
||||
|
||||
- `LOCALS`: declarations for input and output arguments
|
||||
- `CODE` contains input marshalling, the action, and output marshalling
|
||||
|
||||
### Constructors
|
||||
|
||||
~~~~
|
||||
|
|
@ -83,16 +82,14 @@ v8::Handle<v8::Value> ${NAME_MANGLED}_new(const v8::Arguments& args) {
|
|||
v8::HandleScope scope;
|
||||
v8::Handle<v8::Object> self = args.Holder();
|
||||
${LOCALS}
|
||||
${MARSHAL_INPUT}
|
||||
${ACTION}
|
||||
${CODE}
|
||||
self->SetInternalField(0, v8::External::New(ptr));
|
||||
return self;
|
||||
}
|
||||
~~~~
|
||||
|
||||
- `LOCALS`: declaration and marshalling for input arguments
|
||||
- `MARSHAL_INPUT`: code is generated by applying input typemaps
|
||||
- `ACTION`: the C/C++ ctor to be executed
|
||||
- `LOCALS`: declarations for input arguments
|
||||
- `CODE` contains input marshalling, and the action
|
||||
|
||||
### Destructors
|
||||
|
||||
|
|
@ -105,28 +102,26 @@ v8::Handle<v8::Value> ${NAME_MANGLED}_get(v8::Local<v8::String> property, const
|
|||
v8::HandleScope scope;
|
||||
v8::Handle<v8::Object> ret;
|
||||
${LOCALS}
|
||||
${ACTION}
|
||||
${MARSHAL_OUTPUT}
|
||||
${CODE}
|
||||
return scope.Close(ret);
|
||||
}
|
||||
~~~~
|
||||
|
||||
- `NAME_MANGLED`: the qualified mangled name of the variable, E.g., `foo::x -> foo_x`, `A.x -> A_x`
|
||||
- `LOCALS`: declare C return variable
|
||||
- `MARSHAL_OUTPUT`: code is generated by applying output typemaps
|
||||
- `LOCALS`: declarations for output arguments
|
||||
- `CODE` contains the action, and output marshalling
|
||||
|
||||
### Setters
|
||||
|
||||
~~~~
|
||||
void ${NAME_MANGLED}_set(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
|
||||
${LOCALS}
|
||||
${MARSHAL_INPUT}
|
||||
${ACTION}
|
||||
${CODE}
|
||||
}
|
||||
~~~~
|
||||
- `NAME_MANGLED`: the qualified mangled name of the variable, E.g., `foo::x -> foo_x`, `A.x -> A_x`
|
||||
- `LOCALS`: declarations for input arguments
|
||||
- `MARSHAL_INPUT`: code is generated by applying input typemaps
|
||||
- `CODE` contains input marshalling, and the action
|
||||
|
||||
### Functions
|
||||
|
||||
|
|
@ -135,14 +130,15 @@ v8::Handle<v8::Value> ${NAME_MANGLED}(const Arguments &args) {
|
|||
v8::HandleScope scope;
|
||||
v8::Handle<v8::Object> ret;
|
||||
${LOCALS}
|
||||
${MARSHAL_INPUT}
|
||||
${ACTION}
|
||||
${MARSHAL_OUTPUT}
|
||||
${CODE}
|
||||
return scope.Close(ret);
|
||||
}
|
||||
~~~~
|
||||
|
||||
- if the function does not have a return value, return v8::Undefined
|
||||
- `NAME_MANGLED`: the qualified mangled name of the variable, E.g., `foo::x -> foo_x`, `A.x -> A_x`
|
||||
- `LOCALS`: declarations for input arguments
|
||||
- `CODE` contains input marshalling, the action, and output marshalling
|
||||
|
||||
|
||||
### Overloading
|
||||
|
||||
|
|
@ -169,7 +165,9 @@ void ${MODULE}_Initialize(v8::Handle<v8::Context> context)
|
|||
|
||||
${PART_INHERITANCE}
|
||||
|
||||
${PART_REGISTER}
|
||||
${PART_REGISTER_CLASSES}
|
||||
|
||||
${PART_REGISTER_NS}
|
||||
}
|
||||
~~~~
|
||||
|
||||
|
|
@ -217,7 +215,7 @@ ${CONTEXT}->SetAccessor(v8::String::NewSymbol("${NAME_UNQUALIFIED}"), ${GETTER},
|
|||
#### Global Function
|
||||
|
||||
~~~~
|
||||
${CONTEXT}->Set(v8::String::NewSymbol("${NAME_UNQUALIFIED}"), v8::FunctionTemplate::New(wrap_${NAME_QUALIFIED})->GetFunction());
|
||||
SWIGV8_AddGlobalFunction(${CONTEXT}, "${NAME_UNQUALIFIED}", wrap_${NAME_QUALIFIED});
|
||||
~~~~
|
||||
|
||||
- `CONTEXT`: either global, or the according namespace template
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue