summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2013-01-22 19:35:11 +0000
committerVincent Sanders <vince@kyllikki.org>2013-01-22 19:35:11 +0000
commitfb67cea0bf74267bdb614543b693551830dddc24 (patch)
treed500b9015b171bc0ecdd57d1ab9773a7503e0241
parenteb174c9f572f45695f3da6fe1aff37d1c793e9fa (diff)
downloadnsgenbind-fb67cea0bf74267bdb614543b693551830dddc24.tar.gz
nsgenbind-fb67cea0bf74267bdb614543b693551830dddc24.tar.bz2
generate the class property operators and the enumerate operator implementations
-rw-r--r--src/jsapi-libdom.c79
1 files changed, 75 insertions, 4 deletions
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 29994b6..899cbb8 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -239,7 +239,8 @@ output_api_operations(struct binding *binding)
binding->interface);
if (binding->finalise != NULL) {
- output_code_block(binding, genbind_node_getnode(binding->finalise));
+ output_code_block(binding,
+ genbind_node_getnode(binding->finalise));
}
fprintf(binding->outfile,
@@ -253,15 +254,85 @@ output_api_operations(struct binding *binding)
"static void jsclass_finalize(JSContext *cx, JSObject *obj)\n"
"{\n");
- output_code_block(binding, genbind_node_getnode(binding->finalise));
+ output_code_block(binding,
+ genbind_node_getnode(binding->finalise));
fprintf(binding->outfile,
"}\n\n");
}
+ /* generate class default property add implementation */
+ if (binding->addproperty != NULL) {
+ fprintf(binding->outfile,
+ "static JSBool JSAPI_PROP(add, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "{\n");
+
+ output_code_block(binding,
+ genbind_node_getnode(binding->addproperty));
+
+ fprintf(binding->outfile,
+ "\treturn JS_TRUE;\n"
+ "}\n\n");
+ }
+
+ /* generate class default property delete implementation */
+ if (binding->delproperty != NULL) {
+ fprintf(binding->outfile,
+ "static JSBool JSAPI_PROP(del, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "{\n");
+
+ output_code_block(binding,
+ genbind_node_getnode(binding->delproperty));
+
+ fprintf(binding->outfile,
+ "\treturn JS_TRUE;\n"
+ "}\n\n");
+ }
+
+ /* generate class default property get implementation */
+ if (binding->getproperty != NULL) {
+ fprintf(binding->outfile,
+ "static JSBool JSAPI_PROP(get, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "{\n");
+
+ output_code_block(binding,
+ genbind_node_getnode(binding->getproperty));
+
+ fprintf(binding->outfile,
+ "\treturn JS_TRUE;\n"
+ "}\n\n");
+ }
+
+ /* generate class default property set implementation */
+ if (binding->setproperty != NULL) {
+ fprintf(binding->outfile,
+ "static JSBool JSAPI_STRICTPROP(set, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "{\n");
+
+ output_code_block(binding,
+ genbind_node_getnode(binding->setproperty));
+
+ fprintf(binding->outfile,
+ "\treturn JS_TRUE;\n"
+ "}\n\n");
+ }
+
+ /* generate class enumerate implementation */
+ if (binding->enumerate != NULL) {
+ fprintf(binding->outfile,
+ "static JSBool jsclass_enumerate(JSContext *cx, JSObject *obj)\n"
+ "{\n");
+
+ output_code_block(binding, genbind_node_getnode(binding->enumerate));
+
+ fprintf(binding->outfile,
+ "\treturn JS_TRUE;\n"
+ "}\n\n");
+ }
+
+ /* generate class resolver implementation */
if (binding->resolve != NULL) {
- /* generate resolver entry */
fprintf(binding->outfile,
"static JSBool jsclass_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp)\n"
"{\n");
@@ -541,7 +612,7 @@ output_jsclass(struct binding *binding)
/* forward declare the enumerate */
if (binding->enumerate != NULL) {
fprintf(binding->outfile,
- "static JSBool jsclass_enumerate(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp);\n\n");
+ "static JSBool jsclass_enumerate(JSContext *cx, JSObject *obj);\n\n");
}
/* forward declare the resolver */