diff options
author | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2012-09-26 19:56:12 +0100 |
---|---|---|
committer | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2012-09-26 19:56:12 +0100 |
commit | 1186c51cc953d95ffb0d1029d735ae7ff269d7a2 (patch) | |
tree | e039285e1e87957419fb363577c32949d0145880 | |
parent | caf565eb318cdf19a1d5e4b4bab7cd462301efef (diff) | |
download | nsgenbind-1186c51cc953d95ffb0d1029d735ae7ff269d7a2.tar.gz nsgenbind-1186c51cc953d95ffb0d1029d735ae7ff269d7a2.tar.bz2 |
add private struct output
-rw-r--r-- | src/jsapi-libdom.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c index 8a30854..4a1950b 100644 --- a/src/jsapi-libdom.c +++ b/src/jsapi-libdom.c @@ -314,6 +314,8 @@ output_function_spec(FILE *outfile, return res; } + + static int webidl_function_body_cb(struct webidl_node *node, void *ctx) { FILE *outfile = ctx; @@ -329,10 +331,21 @@ static int webidl_function_body_cb(struct webidl_node *node, void *ctx) * http://www.w3.org/TR/WebIDL/#idl-operations */ } else { + /* normal operation with identifier */ + fprintf(outfile, "static JSBool JSAPI_NATIVE(%s, JSContext *cx, uintN argc, jsval *vp)\n", webidl_node_gettext(ident_node)); fprintf(outfile, "{\n"); +/* struct JSCLASS_TYPE *priv; + + priv = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL); + if (priv == NULL) + return JS_FALSE; + + + JSAPI_SET_RVAL(cx, vp, JSVAL_VOID); +*/ fprintf(outfile, "}\n\n"); } @@ -529,6 +542,58 @@ output_property_body(FILE *outfile, return res; } +static int +output_private_declaration(FILE *outfile, + struct binding *binding, + struct genbind_node *genbind_ast, + struct webidl_node *webidl_ast) +{ +/* +struct jsclass_document_priv { + struct html_content *htmlc; + dom_document *node; +}; +*/ + struct genbind_node *binding_node; + struct genbind_node *type_node; + + binding_node = genbind_node_find(genbind_ast, + NULL, + genbind_cmp_node_type, + (void *)GENBIND_NODE_TYPE_BINDING); + + if (binding_node == NULL) { + return -1; + } + + type_node = genbind_node_find(genbind_node_getnode(binding_node), + NULL, + genbind_cmp_node_type, + (void *)GENBIND_NODE_TYPE_TYPE); + + if (type_node == NULL) { + return -1; + } + + + + fprintf(outfile, + "struct jsclass_private {\n" + "\n" + "};"); + + + return 0; +} + +static int +output_jsclass(FILE *outfile, + struct binding *binding, + struct webidl_node *webidl_ast) +{ + return 0; +} + static struct binding *binding_new(struct genbind_node *genbind_ast) { struct binding *nb; @@ -606,6 +671,16 @@ int jsapi_libdom_output(char *outfilename, struct genbind_node *genbind_ast) output_preamble(outfile, genbind_ast); + res = output_private_declaration(outfile, binding, genbind_ast, webidl_ast); + if (res) { + return 5; + } + + res = output_jsclass(outfile, binding, webidl_ast); + if (res) { + return 5; + } + res = output_function_body(outfile, binding, webidl_ast); if (res) { return 5; |