nsgenjsbind: branch master updated. 35f2b9fc8120776bbd5e6f2aa3ddf68ddb46bf33
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/35f2b9fc8120776bb...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/35f2b9fc8120776bbd5...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/35f2b9fc8120776bbd5e6...
The branch, master has been updated
via 35f2b9fc8120776bbd5e6f2aa3ddf68ddb46bf33 (commit)
from 1186c51cc953d95ffb0d1029d735ae7ff269d7a2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/35f2b9fc8120776...
commit 35f2b9fc8120776bbd5e6f2aa3ddf68ddb46bf33
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
fix private data geenration and use
diff --git a/src/genjsbind-ast.c b/src/genjsbind-ast.c
index 32d5553..bcba958 100644
--- a/src/genjsbind-ast.c
+++ b/src/genjsbind-ast.c
@@ -130,8 +130,8 @@ char *genbind_node_gettext(struct genbind_node *node)
case GENBIND_NODE_TYPE_STRING:
case GENBIND_NODE_TYPE_PREAMBLE:
case GENBIND_NODE_TYPE_IDENT:
- case GENBIND_NODE_TYPE_TYPE_NODE:
- case GENBIND_NODE_TYPE_TYPE_INTERFACE:
+ case GENBIND_NODE_TYPE_BINDING_TYPE:
+ case GENBIND_NODE_TYPE_BINDING_INTERFACE:
return node->r.text;
default:
@@ -144,8 +144,7 @@ struct genbind_node *genbind_node_getnode(struct genbind_node *node)
switch(node->type) {
case GENBIND_NODE_TYPE_HDRCOMMENT:
case GENBIND_NODE_TYPE_BINDING:
- case GENBIND_NODE_TYPE_TYPE:
- case GENBIND_NODE_TYPE_TYPE_EXTRA:
+ case GENBIND_NODE_TYPE_BINDING_PRIVATE:
return node->r.node;
default:
@@ -177,16 +176,13 @@ static const char *genbind_node_type_to_str(enum genbind_node_type type)
case GENBIND_NODE_TYPE_BINDING:
return "Binding";
- case GENBIND_NODE_TYPE_TYPE:
+ case GENBIND_NODE_TYPE_BINDING_TYPE:
return "Type";
- case GENBIND_NODE_TYPE_TYPE_NODE:
- return "Node";
+ case GENBIND_NODE_TYPE_BINDING_PRIVATE:
+ return "Private";
- case GENBIND_NODE_TYPE_TYPE_EXTRA:
- return "Extra";
-
- case GENBIND_NODE_TYPE_TYPE_INTERFACE:
+ case GENBIND_NODE_TYPE_BINDING_INTERFACE:
return "Interface";
default:
diff --git a/src/genjsbind-ast.h b/src/genjsbind-ast.h
index 9d25aad..6256414 100644
--- a/src/genjsbind-ast.h
+++ b/src/genjsbind-ast.h
@@ -17,10 +17,9 @@ enum genbind_node_type {
GENBIND_NODE_TYPE_STRING,
GENBIND_NODE_TYPE_PREAMBLE,
GENBIND_NODE_TYPE_BINDING,
- GENBIND_NODE_TYPE_TYPE,
- GENBIND_NODE_TYPE_TYPE_NODE,
- GENBIND_NODE_TYPE_TYPE_EXTRA,
- GENBIND_NODE_TYPE_TYPE_INTERFACE,
+ GENBIND_NODE_TYPE_BINDING_TYPE,
+ GENBIND_NODE_TYPE_BINDING_PRIVATE,
+ GENBIND_NODE_TYPE_BINDING_INTERFACE,
};
diff --git a/src/genjsbind-lexer.l b/src/genjsbind-lexer.l
index 89796ad..dcd47d5 100644
--- a/src/genjsbind-lexer.l
+++ b/src/genjsbind-lexer.l
@@ -86,9 +86,7 @@ interface return TOK_INTERFACE;
type return TOK_TYPE;
-extra return TOK_EXTRA;
-
-node return TOK_NODE;
+private return TOK_PRIVATE;
{cblockopen} BEGIN(cblock);
diff --git a/src/genjsbind-parser.y b/src/genjsbind-parser.y
index de2bd10..3177c87 100644
--- a/src/genjsbind-parser.y
+++ b/src/genjsbind-parser.y
@@ -45,8 +45,7 @@ char *errtxt;
%token TOK_BINDING
%token TOK_INTERFACE
%token TOK_TYPE
-%token TOK_EXTRA
-%token TOK_NODE
+%token TOK_PRIVATE
%token <text> TOK_IDENTIFIER
%token <text> TOK_STRING_LITERAL
@@ -64,10 +63,8 @@ char *errtxt;
%type <node> BindingArgs
%type <node> BindingArg
%type <node> Type
-%type <node> TypeArgs
-%type <node> Extra
+%type <node> Private
%type <node> Interface
-%type <node> Node
%%
@@ -180,44 +177,24 @@ BindingArg
:
Type
|
- Extra
+ Private
|
Interface
;
Type
:
- TOK_TYPE TOK_IDENTIFIER '{' TypeArgs '}' ';'
+ TOK_TYPE TOK_IDENTIFIER ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT, $4, $2));
- }
- ;
-
-TypeArgs
- :
- /* empty */
- {
- $$ = NULL;
- }
- |
- Node
- ;
-
-Node
- :
- TOK_NODE TOK_IDENTIFIER ';'
- {
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE_NODE, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_TYPE, NULL, $2);
}
;
-Extra
+Private
:
- TOK_EXTRA Strings ';'
+ TOK_PRIVATE Strings ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE_EXTRA, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_PRIVATE, NULL, $2);
}
;
@@ -225,7 +202,7 @@ Interface
:
TOK_INTERFACE TOK_IDENTIFIER ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE_INTERFACE, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE, NULL, $2);
}
;
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 4a1950b..0ff1c58 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -336,13 +336,21 @@ static int webidl_function_body_cb(struct webidl_node *node, void *ctx)
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;
+ fprintf(outfile,
+ "{\n");
- priv = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL);
- if (priv == NULL)
- return JS_FALSE;
+ fprintf(outfile,
+ " struct jsclass_private *private;\n");
+ fprintf(outfile,
+ " private = JS_GetInstancePrivate(cx,\n"
+ " JS_THIS_OBJECT(cx,vp),\n"
+ " &jsclass_object,\n"
+ " NULL);\n"
+ " if (priv == NULL)\n"
+ " return JS_FALSE;\n");
+
+/*
JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
*/
@@ -542,20 +550,33 @@ output_property_body(FILE *outfile,
return res;
}
+static int webidl_privatestr_cb(struct genbind_node *node, void *ctx)
+{
+ FILE *outfile = ctx;
+ char *txt;
+ txt = genbind_node_gettext(node);
+ fprintf(outfile, " %s;\n", txt);
+ return 0;
+}
+
+static int webidl_private_cb(struct genbind_node *node, void *ctx)
+{
+ genbind_node_for_each_type(genbind_node_getnode(node),
+ GENBIND_NODE_TYPE_STRING,
+ webidl_privatestr_cb,
+ ctx);
+ return 0;
+}
+
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;
+ struct genbind_node *node_node;
binding_node = genbind_node_find(genbind_ast,
NULL,
@@ -569,18 +590,20 @@ struct jsclass_document_priv {
type_node = genbind_node_find(genbind_node_getnode(binding_node),
NULL,
genbind_cmp_node_type,
- (void *)GENBIND_NODE_TYPE_TYPE);
+ (void *)GENBIND_NODE_TYPE_BINDING_TYPE);
if (type_node == NULL) {
return -1;
}
+ fprintf(outfile, "struct jsclass_private {\n");
+ genbind_node_for_each_type(genbind_node_getnode(binding_node),
+ GENBIND_NODE_TYPE_BINDING_PRIVATE,
+ webidl_private_cb,
+ outfile);
- fprintf(outfile,
- "struct jsclass_private {\n"
- "\n"
- "};");
+ fprintf(outfile, "};\n\n");
return 0;
@@ -591,6 +614,21 @@ output_jsclass(FILE *outfile,
struct binding *binding,
struct webidl_node *webidl_ast)
{
+ fprintf(outfile,
+ "static JSClass jsclass_object =\n"
+ "{\n"
+ " \"%s\",\n"
+ " JSCLASS_NEW_RESOLVE | JSCLASS_HAS_PRIVATE,\n"
+ " JS_PropertyStub,\n"
+ " JS_PropertyStub,\n"
+ " JS_PropertyStub,\n"
+ " JS_StrictPropertyStub,\n"
+ " JS_EnumerateStub,\n"
+ " (JSResolveOp)jsresove_node,\n"
+ " JS_ConvertStub,\n"
+ " jsfinalize_document,\n"
+ " JSCLASS_NO_OPTIONAL_MEMBERS\n"
+ "};\n\n", binding->interface);
return 0;
}
@@ -622,7 +660,7 @@ static struct binding *binding_new(struct genbind_node *genbind_ast)
interface_node = genbind_node_find(genbind_node_getnode(binding_node),
NULL,
genbind_cmp_node_type,
- (void *)GENBIND_NODE_TYPE_TYPE_INTERFACE);
+ (void *)GENBIND_NODE_TYPE_BINDING_INTERFACE);
if (interface_node == NULL) {
return NULL;
diff --git a/test/data/bindings/htmldocument.bnd b/test/data/bindings/htmldocument.bnd
index 24699c1..6c470e4 100644
--- a/test/data/bindings/htmldocument.bnd
+++ b/test/data/bindings/htmldocument.bnd
@@ -54,15 +54,13 @@ static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
]]];
binding document {
- type js_libdom {
- node dom_document;
-
- }; /* the binding type and any instance specific extra data */
+ type js_libdom; /* the binding type */
- extra "struct html_content *htmlc"; /* extra parameters to constructor
- * value stored in private context
- * structure.
- */
+ /* parameters to constructor value stored in private
+ * context structure.
+ */
+ private "dom_document *node";
+ private "struct html_content *htmlc";
interface Document; /* Web IDL interface to generate */
-};
\ No newline at end of file
+};
-----------------------------------------------------------------------
Summary of changes:
src/genjsbind-ast.c | 18 +++-----
src/genjsbind-ast.h | 7 +--
src/genjsbind-lexer.l | 4 +-
src/genjsbind-parser.y | 41 ++++---------------
src/jsapi-libdom.c | 72 ++++++++++++++++++++++++++--------
test/data/bindings/htmldocument.bnd | 16 +++----
6 files changed, 82 insertions(+), 76 deletions(-)
diff --git a/src/genjsbind-ast.c b/src/genjsbind-ast.c
index 32d5553..bcba958 100644
--- a/src/genjsbind-ast.c
+++ b/src/genjsbind-ast.c
@@ -130,8 +130,8 @@ char *genbind_node_gettext(struct genbind_node *node)
case GENBIND_NODE_TYPE_STRING:
case GENBIND_NODE_TYPE_PREAMBLE:
case GENBIND_NODE_TYPE_IDENT:
- case GENBIND_NODE_TYPE_TYPE_NODE:
- case GENBIND_NODE_TYPE_TYPE_INTERFACE:
+ case GENBIND_NODE_TYPE_BINDING_TYPE:
+ case GENBIND_NODE_TYPE_BINDING_INTERFACE:
return node->r.text;
default:
@@ -144,8 +144,7 @@ struct genbind_node *genbind_node_getnode(struct genbind_node *node)
switch(node->type) {
case GENBIND_NODE_TYPE_HDRCOMMENT:
case GENBIND_NODE_TYPE_BINDING:
- case GENBIND_NODE_TYPE_TYPE:
- case GENBIND_NODE_TYPE_TYPE_EXTRA:
+ case GENBIND_NODE_TYPE_BINDING_PRIVATE:
return node->r.node;
default:
@@ -177,16 +176,13 @@ static const char *genbind_node_type_to_str(enum genbind_node_type type)
case GENBIND_NODE_TYPE_BINDING:
return "Binding";
- case GENBIND_NODE_TYPE_TYPE:
+ case GENBIND_NODE_TYPE_BINDING_TYPE:
return "Type";
- case GENBIND_NODE_TYPE_TYPE_NODE:
- return "Node";
+ case GENBIND_NODE_TYPE_BINDING_PRIVATE:
+ return "Private";
- case GENBIND_NODE_TYPE_TYPE_EXTRA:
- return "Extra";
-
- case GENBIND_NODE_TYPE_TYPE_INTERFACE:
+ case GENBIND_NODE_TYPE_BINDING_INTERFACE:
return "Interface";
default:
diff --git a/src/genjsbind-ast.h b/src/genjsbind-ast.h
index 9d25aad..6256414 100644
--- a/src/genjsbind-ast.h
+++ b/src/genjsbind-ast.h
@@ -17,10 +17,9 @@ enum genbind_node_type {
GENBIND_NODE_TYPE_STRING,
GENBIND_NODE_TYPE_PREAMBLE,
GENBIND_NODE_TYPE_BINDING,
- GENBIND_NODE_TYPE_TYPE,
- GENBIND_NODE_TYPE_TYPE_NODE,
- GENBIND_NODE_TYPE_TYPE_EXTRA,
- GENBIND_NODE_TYPE_TYPE_INTERFACE,
+ GENBIND_NODE_TYPE_BINDING_TYPE,
+ GENBIND_NODE_TYPE_BINDING_PRIVATE,
+ GENBIND_NODE_TYPE_BINDING_INTERFACE,
};
diff --git a/src/genjsbind-lexer.l b/src/genjsbind-lexer.l
index 89796ad..dcd47d5 100644
--- a/src/genjsbind-lexer.l
+++ b/src/genjsbind-lexer.l
@@ -86,9 +86,7 @@ interface return TOK_INTERFACE;
type return TOK_TYPE;
-extra return TOK_EXTRA;
-
-node return TOK_NODE;
+private return TOK_PRIVATE;
{cblockopen} BEGIN(cblock);
diff --git a/src/genjsbind-parser.y b/src/genjsbind-parser.y
index de2bd10..3177c87 100644
--- a/src/genjsbind-parser.y
+++ b/src/genjsbind-parser.y
@@ -45,8 +45,7 @@ char *errtxt;
%token TOK_BINDING
%token TOK_INTERFACE
%token TOK_TYPE
-%token TOK_EXTRA
-%token TOK_NODE
+%token TOK_PRIVATE
%token <text> TOK_IDENTIFIER
%token <text> TOK_STRING_LITERAL
@@ -64,10 +63,8 @@ char *errtxt;
%type <node> BindingArgs
%type <node> BindingArg
%type <node> Type
-%type <node> TypeArgs
-%type <node> Extra
+%type <node> Private
%type <node> Interface
-%type <node> Node
%%
@@ -180,44 +177,24 @@ BindingArg
:
Type
|
- Extra
+ Private
|
Interface
;
Type
:
- TOK_TYPE TOK_IDENTIFIER '{' TypeArgs '}' ';'
+ TOK_TYPE TOK_IDENTIFIER ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE,
- NULL,
- genbind_new_node(GENBIND_NODE_TYPE_IDENT, $4, $2));
- }
- ;
-
-TypeArgs
- :
- /* empty */
- {
- $$ = NULL;
- }
- |
- Node
- ;
-
-Node
- :
- TOK_NODE TOK_IDENTIFIER ';'
- {
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE_NODE, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_TYPE, NULL, $2);
}
;
-Extra
+Private
:
- TOK_EXTRA Strings ';'
+ TOK_PRIVATE Strings ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE_EXTRA, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_PRIVATE, NULL, $2);
}
;
@@ -225,7 +202,7 @@ Interface
:
TOK_INTERFACE TOK_IDENTIFIER ';'
{
- $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE_INTERFACE, NULL, $2);
+ $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE, NULL, $2);
}
;
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 4a1950b..0ff1c58 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -336,13 +336,21 @@ static int webidl_function_body_cb(struct webidl_node *node, void *ctx)
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;
+ fprintf(outfile,
+ "{\n");
- priv = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL);
- if (priv == NULL)
- return JS_FALSE;
+ fprintf(outfile,
+ " struct jsclass_private *private;\n");
+ fprintf(outfile,
+ " private = JS_GetInstancePrivate(cx,\n"
+ " JS_THIS_OBJECT(cx,vp),\n"
+ " &jsclass_object,\n"
+ " NULL);\n"
+ " if (priv == NULL)\n"
+ " return JS_FALSE;\n");
+
+/*
JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
*/
@@ -542,20 +550,33 @@ output_property_body(FILE *outfile,
return res;
}
+static int webidl_privatestr_cb(struct genbind_node *node, void *ctx)
+{
+ FILE *outfile = ctx;
+ char *txt;
+ txt = genbind_node_gettext(node);
+ fprintf(outfile, " %s;\n", txt);
+ return 0;
+}
+
+static int webidl_private_cb(struct genbind_node *node, void *ctx)
+{
+ genbind_node_for_each_type(genbind_node_getnode(node),
+ GENBIND_NODE_TYPE_STRING,
+ webidl_privatestr_cb,
+ ctx);
+ return 0;
+}
+
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;
+ struct genbind_node *node_node;
binding_node = genbind_node_find(genbind_ast,
NULL,
@@ -569,18 +590,20 @@ struct jsclass_document_priv {
type_node = genbind_node_find(genbind_node_getnode(binding_node),
NULL,
genbind_cmp_node_type,
- (void *)GENBIND_NODE_TYPE_TYPE);
+ (void *)GENBIND_NODE_TYPE_BINDING_TYPE);
if (type_node == NULL) {
return -1;
}
+ fprintf(outfile, "struct jsclass_private {\n");
+ genbind_node_for_each_type(genbind_node_getnode(binding_node),
+ GENBIND_NODE_TYPE_BINDING_PRIVATE,
+ webidl_private_cb,
+ outfile);
- fprintf(outfile,
- "struct jsclass_private {\n"
- "\n"
- "};");
+ fprintf(outfile, "};\n\n");
return 0;
@@ -591,6 +614,21 @@ output_jsclass(FILE *outfile,
struct binding *binding,
struct webidl_node *webidl_ast)
{
+ fprintf(outfile,
+ "static JSClass jsclass_object =\n"
+ "{\n"
+ " \"%s\",\n"
+ " JSCLASS_NEW_RESOLVE | JSCLASS_HAS_PRIVATE,\n"
+ " JS_PropertyStub,\n"
+ " JS_PropertyStub,\n"
+ " JS_PropertyStub,\n"
+ " JS_StrictPropertyStub,\n"
+ " JS_EnumerateStub,\n"
+ " (JSResolveOp)jsresove_node,\n"
+ " JS_ConvertStub,\n"
+ " jsfinalize_document,\n"
+ " JSCLASS_NO_OPTIONAL_MEMBERS\n"
+ "};\n\n", binding->interface);
return 0;
}
@@ -622,7 +660,7 @@ static struct binding *binding_new(struct genbind_node *genbind_ast)
interface_node = genbind_node_find(genbind_node_getnode(binding_node),
NULL,
genbind_cmp_node_type,
- (void *)GENBIND_NODE_TYPE_TYPE_INTERFACE);
+ (void *)GENBIND_NODE_TYPE_BINDING_INTERFACE);
if (interface_node == NULL) {
return NULL;
diff --git a/test/data/bindings/htmldocument.bnd b/test/data/bindings/htmldocument.bnd
index 24699c1..6c470e4 100644
--- a/test/data/bindings/htmldocument.bnd
+++ b/test/data/bindings/htmldocument.bnd
@@ -54,15 +54,13 @@ static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
]]];
binding document {
- type js_libdom {
- node dom_document;
-
- }; /* the binding type and any instance specific extra data */
+ type js_libdom; /* the binding type */
- extra "struct html_content *htmlc"; /* extra parameters to constructor
- * value stored in private context
- * structure.
- */
+ /* parameters to constructor value stored in private
+ * context structure.
+ */
+ private "dom_document *node";
+ private "struct html_content *htmlc";
interface Document; /* Web IDL interface to generate */
-};
\ No newline at end of file
+};
--
NetSurf Generator for JavaScript bindings
10 years, 8 months
nsgenjsbind: branch master updated. 1186c51cc953d95ffb0d1029d735ae7ff269d7a2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/1186c51cc953d95ff...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/1186c51cc953d95ffb0...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/1186c51cc953d95ffb0d1...
The branch, master has been updated
via 1186c51cc953d95ffb0d1029d735ae7ff269d7a2 (commit)
from caf565eb318cdf19a1d5e4b4bab7cd462301efef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/1186c51cc953d95...
commit 1186c51cc953d95ffb0d1029d735ae7ff269d7a2
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
add private struct output
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;
-----------------------------------------------------------------------
Summary of changes:
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;
--
NetSurf Generator for JavaScript bindings
10 years, 8 months
nsgenjsbind: branch master updated. caf565eb318cdf19a1d5e4b4bab7cd462301efef
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/caf565eb318cdf19a...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/caf565eb318cdf19a1d...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/caf565eb318cdf19a1d5e...
The branch, master has been updated
via caf565eb318cdf19a1d5e4b4bab7cd462301efef (commit)
from 74ea37fbd83a0d381ae928c7f7e30d0ded875cc0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/caf565eb318cdf1...
commit caf565eb318cdf19a1d5e4b4bab7cd462301efef
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
add modifier to allow setting of readonly or unsigned etc.
add property getter/setter body
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 00b56a9..8a30854 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -109,21 +109,33 @@ static int webidl_property_spec_cb(struct webidl_node *node, void *ctx)
{
FILE *outfile = ctx;
struct webidl_node *ident_node;
+ struct webidl_node *modifier_node;
ident_node = webidl_node_find(webidl_node_getnode(node),
NULL,
webidl_cmp_node_type,
(void *)WEBIDL_NODE_TYPE_IDENT);
+ modifier_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_MODIFIER);
+
if (ident_node == NULL) {
/* properties must have an operator
* http://www.w3.org/TR/WebIDL/#idl-attributes
*/
return 1;
} else {
+ if (webidl_node_getint(modifier_node) == WEBIDL_TYPE_READONLY) {
+ fprintf(outfile,
+ " JSAPI_PS_RO(%s, 0, JSPROP_ENUMERATE | JSPROP_SHARED),\n",
+ webidl_node_gettext(ident_node));
+ } else {
fprintf(outfile,
" JSAPI_PS(%s, 0, JSPROP_ENUMERATE | JSPROP_SHARED),\n",
webidl_node_gettext(ident_node));
+ }
}
return 0;
}
@@ -397,6 +409,125 @@ output_function_body(FILE *outfile,
}
+static int webidl_property_body_cb(struct webidl_node *node, void *ctx)
+{
+ FILE *outfile = ctx;
+ struct webidl_node *ident_node;
+ struct webidl_node *modifier_node;
+
+ ident_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_IDENT);
+
+ if (ident_node == NULL) {
+ /* properties must have an operator
+ * http://www.w3.org/TR/WebIDL/#idl-attributes
+ */
+ return 1;
+ }
+
+ modifier_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_MODIFIER);
+
+
+ if (webidl_node_getint(modifier_node) != WEBIDL_TYPE_READONLY) {
+ /* no readonly so a set function is required */
+
+ fprintf(outfile,
+ "static JSBool JSAPI_PROPERTYSET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
+ webidl_node_gettext(ident_node));
+ fprintf(outfile,
+ "{\n"
+ " return JS_FALSE;\n"
+ "}\n\n");
+ }
+
+ fprintf(outfile,
+ "static JSBool JSAPI_PROPERTYGET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
+ webidl_node_gettext(ident_node));
+ fprintf(outfile,
+ "{\n"
+ " JS_SET_RVAL(cx, vp, JSVAL_NULL);\n"
+ " return JS_TRUE;\n");
+ fprintf(outfile, "}\n\n");
+
+
+ return 0;
+}
+
+static int
+generate_property_body(FILE *outfile,
+ const char *interface,
+ struct webidl_node *webidl_ast)
+{
+ struct webidl_node *interface_node;
+ struct webidl_node *members_node;
+ struct webidl_node *inherit_node;
+
+
+ /* find interface in webidl with correct ident attached */
+ interface_node = webidl_node_find_type_ident(webidl_ast,
+ WEBIDL_NODE_TYPE_INTERFACE,
+ interface);
+
+ if (interface_node == NULL) {
+ fprintf(stderr,
+ "Unable to find interface %s in loaded WebIDL\n",
+ interface);
+ return -1;
+ }
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_LIST);
+
+ while (members_node != NULL) {
+
+ fprintf(outfile,"/**** %s ****/\n", interface);
+
+ /* for each function emit property body */
+ webidl_node_for_each_type(webidl_node_getnode(members_node),
+ WEBIDL_NODE_TYPE_ATTRIBUTE,
+ webidl_property_body_cb,
+ outfile);
+
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ members_node,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_LIST);
+
+ }
+ /* check for inherited nodes and insert them too */
+ inherit_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE);
+
+ if (inherit_node != NULL) {
+ return generate_property_body(outfile,
+ webidl_node_gettext(inherit_node),
+ webidl_ast);
+ }
+
+ return 0;
+}
+
+static int
+output_property_body(FILE *outfile,
+ struct binding *binding,
+ struct webidl_node *webidl_ast)
+{
+ int res;
+
+ res = generate_property_body(outfile, binding->interface, webidl_ast);
+
+ return res;
+}
static struct binding *binding_new(struct genbind_node *genbind_ast)
{
@@ -480,15 +611,19 @@ int jsapi_libdom_output(char *outfilename, struct genbind_node *genbind_ast)
return 5;
}
+ res = output_property_body(outfile, binding, webidl_ast);
+ if (res) {
+ return 6;
+ }
res = output_function_spec(outfile, binding, webidl_ast);
if (res) {
- return 5;
+ return 7;
}
res = output_property_spec(outfile, binding, webidl_ast);
if (res) {
- return 5;
+ return 8;
}
fclose(outfile);
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index a5f2d23..8160d55 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -189,6 +189,22 @@ char *webidl_node_gettext(struct webidl_node *node)
}
}
+int
+webidl_node_getint(struct webidl_node *node)
+{
+ if (node != NULL) {
+ switch(node->type) {
+ case WEBIDL_NODE_TYPE_MODIFIER:
+ case WEBIDL_NODE_TYPE_TYPE_BASE:
+ return node->r.number;
+
+ default:
+ break;
+ }
+ }
+ return -1;
+
+}
struct webidl_node *webidl_node_getnode(struct webidl_node *node)
{
if (node != NULL) {
@@ -249,7 +265,7 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_TYPE_BASE:
return "Base";
- case WEBIDL_NODE_TYPE_TYPE_MODIFIER:
+ case WEBIDL_NODE_TYPE_MODIFIER:
return "Modifier";
default:
@@ -267,8 +283,17 @@ int webidl_ast_dump(struct webidl_node *node, int indent)
txt = webidl_node_gettext(node);
if (txt == NULL) {
- printf("\n");
- webidl_ast_dump(webidl_node_getnode(node), indent + 2);
+ struct webidl_node *next;
+
+ next = webidl_node_getnode(node);
+
+ if (next != NULL) {
+ printf("\n");
+ webidl_ast_dump(next, indent + 2);
+ } else {
+ /* not txt or node has to be an int */
+ printf(": %d\n", webidl_node_getint(node));
+ }
} else {
printf(": \"%s\"\n", txt);
}
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index ac3586f..7f21df5 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -10,10 +10,16 @@
#define genjsbind_webidl_ast_h
enum webidl_node_type {
+ /* generic node types which define structure or attributes */
WEBIDL_NODE_TYPE_ROOT = 0,
WEBIDL_NODE_TYPE_IDENT,
+ /** access modifier e.g. for attributes or types */
+ WEBIDL_NODE_TYPE_MODIFIER,
+ /** a list of nodes (interface members, arguments) */
+ WEBIDL_NODE_TYPE_LIST,
+
+ /* non structural node types */
WEBIDL_NODE_TYPE_INTERFACE,
- WEBIDL_NODE_TYPE_LIST, /* a list of nodes (interface members, arguments) */
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
WEBIDL_NODE_TYPE_ATTRIBUTE,
WEBIDL_NODE_TYPE_OPERATION,
@@ -22,10 +28,10 @@ enum webidl_node_type {
WEBIDL_NODE_TYPE_ELLIPSIS,
WEBIDL_NODE_TYPE_TYPE,
WEBIDL_NODE_TYPE_TYPE_BASE,
- WEBIDL_NODE_TYPE_TYPE_MODIFIER,
};
enum webidl_type {
+ WEBIDL_TYPE_USER,
WEBIDL_TYPE_BOOL,
WEBIDL_TYPE_BYTE,
WEBIDL_TYPE_OCTET,
@@ -38,13 +44,13 @@ enum webidl_type {
WEBIDL_TYPE_SEQUENCE,
WEBIDL_TYPE_OBJECT,
WEBIDL_TYPE_DATE,
- WEBIDL_TYPE_USER,
WEBIDL_TYPE_VOID,
};
enum webidl_type_modifier {
WEBIDL_TYPE_MODIFIER_UNSIGNED,
WEBIDL_TYPE_MODIFIER_UNRESTRICTED,
+ WEBIDL_TYPE_READONLY,
};
struct webidl_node;
@@ -66,6 +72,7 @@ struct webidl_node *webidl_add_interface_member(struct webidl_node *list, struct
/* node contents acessors */
char *webidl_node_gettext(struct webidl_node *node);
struct webidl_node *webidl_node_getnode(struct webidl_node *node);
+int webidl_node_getint(struct webidl_node *node);
/* node searches */
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index fef57dd..81f0dfc 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -161,7 +161,9 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> UnsignedIntegerType
%type <node> IntegerType
+%type <isit> ReadOnly
%type <isit> OptionalLong
+%type <isit> Inherit
%%
@@ -522,23 +524,46 @@ Attribute:
Inherit ReadOnly TOK_ATTRIBUTE Type TOK_IDENTIFIER ';'
{
struct webidl_node *attribute;
+
attribute = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
+
+ /* add attributes type */
+ attribute = webidl_node_prepend(attribute, $4);
+
+ /* deal with readonly modifier */
+ if ($2) {
+ attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, attribute, (void *)WEBIDL_TYPE_READONLY);
+ }
+
$$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, attribute);
+
}
;
/* [33] */
Inherit:
/* empty */
+ {
+ $$ = false;
+ }
|
TOK_INHERIT
+ {
+ $$ = true;
+ }
;
/* [34] */
ReadOnly:
/* empty */
+ {
+ $$ = false;
+ }
|
TOK_READONLY
+ {
+ $$ = true;
+ }
;
/* [35] */
@@ -1036,7 +1061,7 @@ PrimitiveType:
UnrestrictedFloatType:
TOK_UNRESTRICTED FloatType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
$2,
(void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
}
@@ -1061,7 +1086,7 @@ FloatType:
UnsignedIntegerType:
TOK_UNSIGNED IntegerType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
$2,
(void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
}
-----------------------------------------------------------------------
Summary of changes:
src/jsapi-libdom.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++-
src/webidl-ast.c | 31 ++++++++++-
src/webidl-ast.h | 13 ++++-
src/webidl-parser.y | 29 ++++++++++-
4 files changed, 202 insertions(+), 10 deletions(-)
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 00b56a9..8a30854 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -109,21 +109,33 @@ static int webidl_property_spec_cb(struct webidl_node *node, void *ctx)
{
FILE *outfile = ctx;
struct webidl_node *ident_node;
+ struct webidl_node *modifier_node;
ident_node = webidl_node_find(webidl_node_getnode(node),
NULL,
webidl_cmp_node_type,
(void *)WEBIDL_NODE_TYPE_IDENT);
+ modifier_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_MODIFIER);
+
if (ident_node == NULL) {
/* properties must have an operator
* http://www.w3.org/TR/WebIDL/#idl-attributes
*/
return 1;
} else {
+ if (webidl_node_getint(modifier_node) == WEBIDL_TYPE_READONLY) {
+ fprintf(outfile,
+ " JSAPI_PS_RO(%s, 0, JSPROP_ENUMERATE | JSPROP_SHARED),\n",
+ webidl_node_gettext(ident_node));
+ } else {
fprintf(outfile,
" JSAPI_PS(%s, 0, JSPROP_ENUMERATE | JSPROP_SHARED),\n",
webidl_node_gettext(ident_node));
+ }
}
return 0;
}
@@ -397,6 +409,125 @@ output_function_body(FILE *outfile,
}
+static int webidl_property_body_cb(struct webidl_node *node, void *ctx)
+{
+ FILE *outfile = ctx;
+ struct webidl_node *ident_node;
+ struct webidl_node *modifier_node;
+
+ ident_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_IDENT);
+
+ if (ident_node == NULL) {
+ /* properties must have an operator
+ * http://www.w3.org/TR/WebIDL/#idl-attributes
+ */
+ return 1;
+ }
+
+ modifier_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_MODIFIER);
+
+
+ if (webidl_node_getint(modifier_node) != WEBIDL_TYPE_READONLY) {
+ /* no readonly so a set function is required */
+
+ fprintf(outfile,
+ "static JSBool JSAPI_PROPERTYSET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
+ webidl_node_gettext(ident_node));
+ fprintf(outfile,
+ "{\n"
+ " return JS_FALSE;\n"
+ "}\n\n");
+ }
+
+ fprintf(outfile,
+ "static JSBool JSAPI_PROPERTYGET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
+ webidl_node_gettext(ident_node));
+ fprintf(outfile,
+ "{\n"
+ " JS_SET_RVAL(cx, vp, JSVAL_NULL);\n"
+ " return JS_TRUE;\n");
+ fprintf(outfile, "}\n\n");
+
+
+ return 0;
+}
+
+static int
+generate_property_body(FILE *outfile,
+ const char *interface,
+ struct webidl_node *webidl_ast)
+{
+ struct webidl_node *interface_node;
+ struct webidl_node *members_node;
+ struct webidl_node *inherit_node;
+
+
+ /* find interface in webidl with correct ident attached */
+ interface_node = webidl_node_find_type_ident(webidl_ast,
+ WEBIDL_NODE_TYPE_INTERFACE,
+ interface);
+
+ if (interface_node == NULL) {
+ fprintf(stderr,
+ "Unable to find interface %s in loaded WebIDL\n",
+ interface);
+ return -1;
+ }
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_LIST);
+
+ while (members_node != NULL) {
+
+ fprintf(outfile,"/**** %s ****/\n", interface);
+
+ /* for each function emit property body */
+ webidl_node_for_each_type(webidl_node_getnode(members_node),
+ WEBIDL_NODE_TYPE_ATTRIBUTE,
+ webidl_property_body_cb,
+ outfile);
+
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ members_node,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_LIST);
+
+ }
+ /* check for inherited nodes and insert them too */
+ inherit_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE);
+
+ if (inherit_node != NULL) {
+ return generate_property_body(outfile,
+ webidl_node_gettext(inherit_node),
+ webidl_ast);
+ }
+
+ return 0;
+}
+
+static int
+output_property_body(FILE *outfile,
+ struct binding *binding,
+ struct webidl_node *webidl_ast)
+{
+ int res;
+
+ res = generate_property_body(outfile, binding->interface, webidl_ast);
+
+ return res;
+}
static struct binding *binding_new(struct genbind_node *genbind_ast)
{
@@ -480,15 +611,19 @@ int jsapi_libdom_output(char *outfilename, struct genbind_node *genbind_ast)
return 5;
}
+ res = output_property_body(outfile, binding, webidl_ast);
+ if (res) {
+ return 6;
+ }
res = output_function_spec(outfile, binding, webidl_ast);
if (res) {
- return 5;
+ return 7;
}
res = output_property_spec(outfile, binding, webidl_ast);
if (res) {
- return 5;
+ return 8;
}
fclose(outfile);
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index a5f2d23..8160d55 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -189,6 +189,22 @@ char *webidl_node_gettext(struct webidl_node *node)
}
}
+int
+webidl_node_getint(struct webidl_node *node)
+{
+ if (node != NULL) {
+ switch(node->type) {
+ case WEBIDL_NODE_TYPE_MODIFIER:
+ case WEBIDL_NODE_TYPE_TYPE_BASE:
+ return node->r.number;
+
+ default:
+ break;
+ }
+ }
+ return -1;
+
+}
struct webidl_node *webidl_node_getnode(struct webidl_node *node)
{
if (node != NULL) {
@@ -249,7 +265,7 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_TYPE_BASE:
return "Base";
- case WEBIDL_NODE_TYPE_TYPE_MODIFIER:
+ case WEBIDL_NODE_TYPE_MODIFIER:
return "Modifier";
default:
@@ -267,8 +283,17 @@ int webidl_ast_dump(struct webidl_node *node, int indent)
txt = webidl_node_gettext(node);
if (txt == NULL) {
- printf("\n");
- webidl_ast_dump(webidl_node_getnode(node), indent + 2);
+ struct webidl_node *next;
+
+ next = webidl_node_getnode(node);
+
+ if (next != NULL) {
+ printf("\n");
+ webidl_ast_dump(next, indent + 2);
+ } else {
+ /* not txt or node has to be an int */
+ printf(": %d\n", webidl_node_getint(node));
+ }
} else {
printf(": \"%s\"\n", txt);
}
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index ac3586f..7f21df5 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -10,10 +10,16 @@
#define genjsbind_webidl_ast_h
enum webidl_node_type {
+ /* generic node types which define structure or attributes */
WEBIDL_NODE_TYPE_ROOT = 0,
WEBIDL_NODE_TYPE_IDENT,
+ /** access modifier e.g. for attributes or types */
+ WEBIDL_NODE_TYPE_MODIFIER,
+ /** a list of nodes (interface members, arguments) */
+ WEBIDL_NODE_TYPE_LIST,
+
+ /* non structural node types */
WEBIDL_NODE_TYPE_INTERFACE,
- WEBIDL_NODE_TYPE_LIST, /* a list of nodes (interface members, arguments) */
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
WEBIDL_NODE_TYPE_ATTRIBUTE,
WEBIDL_NODE_TYPE_OPERATION,
@@ -22,10 +28,10 @@ enum webidl_node_type {
WEBIDL_NODE_TYPE_ELLIPSIS,
WEBIDL_NODE_TYPE_TYPE,
WEBIDL_NODE_TYPE_TYPE_BASE,
- WEBIDL_NODE_TYPE_TYPE_MODIFIER,
};
enum webidl_type {
+ WEBIDL_TYPE_USER,
WEBIDL_TYPE_BOOL,
WEBIDL_TYPE_BYTE,
WEBIDL_TYPE_OCTET,
@@ -38,13 +44,13 @@ enum webidl_type {
WEBIDL_TYPE_SEQUENCE,
WEBIDL_TYPE_OBJECT,
WEBIDL_TYPE_DATE,
- WEBIDL_TYPE_USER,
WEBIDL_TYPE_VOID,
};
enum webidl_type_modifier {
WEBIDL_TYPE_MODIFIER_UNSIGNED,
WEBIDL_TYPE_MODIFIER_UNRESTRICTED,
+ WEBIDL_TYPE_READONLY,
};
struct webidl_node;
@@ -66,6 +72,7 @@ struct webidl_node *webidl_add_interface_member(struct webidl_node *list, struct
/* node contents acessors */
char *webidl_node_gettext(struct webidl_node *node);
struct webidl_node *webidl_node_getnode(struct webidl_node *node);
+int webidl_node_getint(struct webidl_node *node);
/* node searches */
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index fef57dd..81f0dfc 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -161,7 +161,9 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> UnsignedIntegerType
%type <node> IntegerType
+%type <isit> ReadOnly
%type <isit> OptionalLong
+%type <isit> Inherit
%%
@@ -522,23 +524,46 @@ Attribute:
Inherit ReadOnly TOK_ATTRIBUTE Type TOK_IDENTIFIER ';'
{
struct webidl_node *attribute;
+
attribute = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
+
+ /* add attributes type */
+ attribute = webidl_node_prepend(attribute, $4);
+
+ /* deal with readonly modifier */
+ if ($2) {
+ attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, attribute, (void *)WEBIDL_TYPE_READONLY);
+ }
+
$$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, attribute);
+
}
;
/* [33] */
Inherit:
/* empty */
+ {
+ $$ = false;
+ }
|
TOK_INHERIT
+ {
+ $$ = true;
+ }
;
/* [34] */
ReadOnly:
/* empty */
+ {
+ $$ = false;
+ }
|
TOK_READONLY
+ {
+ $$ = true;
+ }
;
/* [35] */
@@ -1036,7 +1061,7 @@ PrimitiveType:
UnrestrictedFloatType:
TOK_UNRESTRICTED FloatType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
$2,
(void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
}
@@ -1061,7 +1086,7 @@ FloatType:
UnsignedIntegerType:
TOK_UNSIGNED IntegerType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER,
$2,
(void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
}
--
NetSurf Generator for JavaScript bindings
10 years, 8 months
nsgenjsbind: branch master updated. 74ea37fbd83a0d381ae928c7f7e30d0ded875cc0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/74ea37fbd83a0d381...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/74ea37fbd83a0d381ae...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/74ea37fbd83a0d381ae92...
The branch, master has been updated
via 74ea37fbd83a0d381ae928c7f7e30d0ded875cc0 (commit)
from 4b043613d1a20980b13a6e9b0c8a7ff91c035b2f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/74ea37fbd83a0d3...
commit 74ea37fbd83a0d381ae928c7f7e30d0ded875cc0
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
put return type in argument list so we can have multiple prototypes per operation (method)
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 13af77b..00b56a9 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -153,7 +153,7 @@ generate_property_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
NULL,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
while (members_node != NULL) {
@@ -170,7 +170,7 @@ generate_property_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
members_node,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
}
/* check for inherited nodes and insert them too */
@@ -253,7 +253,7 @@ generate_function_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
NULL,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
while (members_node != NULL) {
fprintf(outfile," /**** %s ****/\n", interface);
@@ -267,7 +267,7 @@ generate_function_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
members_node,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
}
/* check for inherited nodes and insert them too */
@@ -352,7 +352,7 @@ generate_function_body(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
NULL,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
while (members_node != NULL) {
fprintf(outfile,"/**** %s ****/\n", interface);
@@ -366,7 +366,7 @@ generate_function_body(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
members_node,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
}
/* check for inherited nodes and insert them too */
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index 91da839..a5f2d23 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -195,7 +195,7 @@ struct webidl_node *webidl_node_getnode(struct webidl_node *node)
switch (node->type) {
case WEBIDL_NODE_TYPE_ROOT:
case WEBIDL_NODE_TYPE_INTERFACE:
- case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
+ case WEBIDL_NODE_TYPE_LIST:
case WEBIDL_NODE_TYPE_ATTRIBUTE:
case WEBIDL_NODE_TYPE_OPERATION:
case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT:
@@ -225,8 +225,8 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_INTERFACE:
return "Interface";
- case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
- return "Members";
+ case WEBIDL_NODE_TYPE_LIST:
+ return "List";
case WEBIDL_NODE_TYPE_ATTRIBUTE:
return "Attribute";
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index c41149d..ac3586f 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -13,7 +13,7 @@ enum webidl_node_type {
WEBIDL_NODE_TYPE_ROOT = 0,
WEBIDL_NODE_TYPE_IDENT,
WEBIDL_NODE_TYPE_INTERFACE,
- WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
+ WEBIDL_NODE_TYPE_LIST, /* a list of nodes (interface members, arguments) */
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
WEBIDL_NODE_TYPE_ATTRIBUTE,
WEBIDL_NODE_TYPE_OPERATION,
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index 69fbef5..fef57dd 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -168,8 +168,8 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
/* default rule to add built AST to passed in one */
Input:
Definitions
- {
- *webidl_ast = webidl_node_prepend(*webidl_ast, $1);
+ {
+ *webidl_ast = webidl_node_prepend(*webidl_ast, $1);
}
|
error
@@ -235,8 +235,8 @@ Interface:
/* extend interface with additional members */
struct webidl_node *interface_node;
interface_node = webidl_node_find_type_ident(*webidl_ast,
- WEBIDL_NODE_TYPE_INTERFACE,
- $2);
+ WEBIDL_NODE_TYPE_INTERFACE,
+ $2);
if (interface_node == NULL) {
struct webidl_node *members;
struct webidl_node *ident;
@@ -246,7 +246,7 @@ Interface:
inheritance = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE, NULL, $3);
}
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS, inheritance, $5);
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, inheritance, $5);
ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2);
@@ -259,13 +259,13 @@ Interface:
inheritance = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE, inheritance, $3);
}
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST,
inheritance,
$5);
/* link member node into interfaces_node */
- webidl_node_set(interface_node,
- WEBIDL_NODE_TYPE_INTERFACE,
+ webidl_node_set(interface_node,
+ WEBIDL_NODE_TYPE_INTERFACE,
members);
$$ = NULL; /* updated existing interface do not add it again */
}
@@ -294,14 +294,14 @@ PartialInterface:
/* extend interface with additional members */
struct webidl_node *interface_node;
interface_node = webidl_node_find_type_ident(*webidl_ast,
- WEBIDL_NODE_TYPE_INTERFACE,
- $2);
+ WEBIDL_NODE_TYPE_INTERFACE,
+ $2);
if (interface_node == NULL) {
/* doesnt already exist so create it */
struct webidl_node *members;
struct webidl_node *ident;
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS, NULL, $4);
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, $4);
ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2);
@@ -309,13 +309,13 @@ PartialInterface:
} else {
struct webidl_node *members;
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST,
webidl_node_getnode(interface_node),
$4);
/* link member node into interfaces_node */
- webidl_node_set(interface_node,
- WEBIDL_NODE_TYPE_INTERFACE,
+ webidl_node_set(interface_node,
+ WEBIDL_NODE_TYPE_INTERFACE,
members);
$$ = NULL; /* updated existing interface do not add it again */
@@ -580,9 +580,14 @@ Special:
OperationRest:
ReturnType OptionalIdentifier '(' ArgumentList ')' ';'
{
- struct webidl_node *operation = $4; /* argument list */
+ struct webidl_node *operation;
+ struct webidl_node *arglist;
+
+ /* put return type in argument list */
+ arglist = webidl_node_prepend($4, $1);
- operation = webidl_node_prepend(operation, $1); /* return type */
+ /* argument list */
+ operation = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, arglist);
operation = webidl_node_prepend(operation, $2); /* identifier */
@@ -605,7 +610,7 @@ OptionalIdentifier:
/* [41] an empty list or a list of non empty comma separated arguments, note
- * this is right associative so the tree build is ass backwards
+ * this is right associative so the tree build is ass backwards
*/
ArgumentList:
/* empty */
@@ -922,7 +927,7 @@ OtherOrComma:
Type:
SingleType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
}
|
UnionType TypeSuffix
@@ -1031,8 +1036,8 @@ PrimitiveType:
UnrestrictedFloatType:
TOK_UNRESTRICTED FloatType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
- $2,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
(void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
}
|
@@ -1056,8 +1061,8 @@ FloatType:
UnsignedIntegerType:
TOK_UNSIGNED IntegerType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
- $2,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
(void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
}
|
@@ -1086,7 +1091,7 @@ OptionalLong:
/* empty */
{
$$ = false;
- }
+ }
|
TOK_LONG
{
@@ -1125,7 +1130,7 @@ ReturnType:
{
struct webidl_node *type;
type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID);
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
}
;
-----------------------------------------------------------------------
Summary of changes:
src/jsapi-libdom.c | 12 +++++-----
src/webidl-ast.c | 6 ++--
src/webidl-ast.h | 2 +-
src/webidl-parser.y | 53 +++++++++++++++++++++++++++-----------------------
4 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index 13af77b..00b56a9 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -153,7 +153,7 @@ generate_property_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
NULL,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
while (members_node != NULL) {
@@ -170,7 +170,7 @@ generate_property_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
members_node,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
}
/* check for inherited nodes and insert them too */
@@ -253,7 +253,7 @@ generate_function_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
NULL,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
while (members_node != NULL) {
fprintf(outfile," /**** %s ****/\n", interface);
@@ -267,7 +267,7 @@ generate_function_spec(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
members_node,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
}
/* check for inherited nodes and insert them too */
@@ -352,7 +352,7 @@ generate_function_body(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
NULL,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
while (members_node != NULL) {
fprintf(outfile,"/**** %s ****/\n", interface);
@@ -366,7 +366,7 @@ generate_function_body(FILE *outfile,
members_node = webidl_node_find(webidl_node_getnode(interface_node),
members_node,
webidl_cmp_node_type,
- (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ (void *)WEBIDL_NODE_TYPE_LIST);
}
/* check for inherited nodes and insert them too */
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index 91da839..a5f2d23 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -195,7 +195,7 @@ struct webidl_node *webidl_node_getnode(struct webidl_node *node)
switch (node->type) {
case WEBIDL_NODE_TYPE_ROOT:
case WEBIDL_NODE_TYPE_INTERFACE:
- case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
+ case WEBIDL_NODE_TYPE_LIST:
case WEBIDL_NODE_TYPE_ATTRIBUTE:
case WEBIDL_NODE_TYPE_OPERATION:
case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT:
@@ -225,8 +225,8 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_INTERFACE:
return "Interface";
- case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
- return "Members";
+ case WEBIDL_NODE_TYPE_LIST:
+ return "List";
case WEBIDL_NODE_TYPE_ATTRIBUTE:
return "Attribute";
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index c41149d..ac3586f 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -13,7 +13,7 @@ enum webidl_node_type {
WEBIDL_NODE_TYPE_ROOT = 0,
WEBIDL_NODE_TYPE_IDENT,
WEBIDL_NODE_TYPE_INTERFACE,
- WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
+ WEBIDL_NODE_TYPE_LIST, /* a list of nodes (interface members, arguments) */
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
WEBIDL_NODE_TYPE_ATTRIBUTE,
WEBIDL_NODE_TYPE_OPERATION,
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index 69fbef5..fef57dd 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -168,8 +168,8 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
/* default rule to add built AST to passed in one */
Input:
Definitions
- {
- *webidl_ast = webidl_node_prepend(*webidl_ast, $1);
+ {
+ *webidl_ast = webidl_node_prepend(*webidl_ast, $1);
}
|
error
@@ -235,8 +235,8 @@ Interface:
/* extend interface with additional members */
struct webidl_node *interface_node;
interface_node = webidl_node_find_type_ident(*webidl_ast,
- WEBIDL_NODE_TYPE_INTERFACE,
- $2);
+ WEBIDL_NODE_TYPE_INTERFACE,
+ $2);
if (interface_node == NULL) {
struct webidl_node *members;
struct webidl_node *ident;
@@ -246,7 +246,7 @@ Interface:
inheritance = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE, NULL, $3);
}
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS, inheritance, $5);
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, inheritance, $5);
ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2);
@@ -259,13 +259,13 @@ Interface:
inheritance = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE, inheritance, $3);
}
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST,
inheritance,
$5);
/* link member node into interfaces_node */
- webidl_node_set(interface_node,
- WEBIDL_NODE_TYPE_INTERFACE,
+ webidl_node_set(interface_node,
+ WEBIDL_NODE_TYPE_INTERFACE,
members);
$$ = NULL; /* updated existing interface do not add it again */
}
@@ -294,14 +294,14 @@ PartialInterface:
/* extend interface with additional members */
struct webidl_node *interface_node;
interface_node = webidl_node_find_type_ident(*webidl_ast,
- WEBIDL_NODE_TYPE_INTERFACE,
- $2);
+ WEBIDL_NODE_TYPE_INTERFACE,
+ $2);
if (interface_node == NULL) {
/* doesnt already exist so create it */
struct webidl_node *members;
struct webidl_node *ident;
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS, NULL, $4);
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, $4);
ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2);
@@ -309,13 +309,13 @@ PartialInterface:
} else {
struct webidl_node *members;
- members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_MEMBERS,
+ members = webidl_node_new(WEBIDL_NODE_TYPE_LIST,
webidl_node_getnode(interface_node),
$4);
/* link member node into interfaces_node */
- webidl_node_set(interface_node,
- WEBIDL_NODE_TYPE_INTERFACE,
+ webidl_node_set(interface_node,
+ WEBIDL_NODE_TYPE_INTERFACE,
members);
$$ = NULL; /* updated existing interface do not add it again */
@@ -580,9 +580,14 @@ Special:
OperationRest:
ReturnType OptionalIdentifier '(' ArgumentList ')' ';'
{
- struct webidl_node *operation = $4; /* argument list */
+ struct webidl_node *operation;
+ struct webidl_node *arglist;
+
+ /* put return type in argument list */
+ arglist = webidl_node_prepend($4, $1);
- operation = webidl_node_prepend(operation, $1); /* return type */
+ /* argument list */
+ operation = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, arglist);
operation = webidl_node_prepend(operation, $2); /* identifier */
@@ -605,7 +610,7 @@ OptionalIdentifier:
/* [41] an empty list or a list of non empty comma separated arguments, note
- * this is right associative so the tree build is ass backwards
+ * this is right associative so the tree build is ass backwards
*/
ArgumentList:
/* empty */
@@ -922,7 +927,7 @@ OtherOrComma:
Type:
SingleType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
}
|
UnionType TypeSuffix
@@ -1031,8 +1036,8 @@ PrimitiveType:
UnrestrictedFloatType:
TOK_UNRESTRICTED FloatType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
- $2,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
(void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
}
|
@@ -1056,8 +1061,8 @@ FloatType:
UnsignedIntegerType:
TOK_UNSIGNED IntegerType
{
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
- $2,
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
(void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
}
|
@@ -1086,7 +1091,7 @@ OptionalLong:
/* empty */
{
$$ = false;
- }
+ }
|
TOK_LONG
{
@@ -1125,7 +1130,7 @@ ReturnType:
{
struct webidl_node *type;
type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID);
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
}
;
--
NetSurf Generator for JavaScript bindings
10 years, 8 months
libnsfb: branch master updated. 1983c37933d2a753c4c913527c94392682bf7b98
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/1983c37933d2a753c4c91...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/1983c37933d2a753c4c9135...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/1983c37933d2a753c4c913527...
The branch, master has been updated
via 1983c37933d2a753c4c913527c94392682bf7b98 (commit)
from bde04d10347414251b40af574d1bc94962d23a5a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commitdiff/1983c37933d2a753c4c...
commit 1983c37933d2a753c4c913527c94392682bf7b98
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Improve 8bpp palette: 685 RGB levels instead of 884 RGB levels, with remainder set to true grays. Previous palette had no true grays. Upshot is much better rendering of grayscale images and better rendering of blues, with a bit of loss in reds.
diff --git a/src/surface/sdl.c b/src/surface/sdl.c
index 8908a21..d598b8a 100644
--- a/src/surface/sdl.c
+++ b/src/surface/sdl.c
@@ -6,6 +6,7 @@
* http://www.opensource.org/licenses/mit-license.php
*/
+#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <SDL/SDL.h>
@@ -355,20 +356,44 @@ set_palette(nsfb_t *nsfb)
int rloop, gloop, bloop;
int loop = 0;
- /* build a linear R:3 G:3 B:2 colour cube palette. */
- for (rloop = 0; rloop < 8; rloop++) {
- for (gloop = 0; gloop < 8; gloop++) {
- for (bloop = 0; bloop < 4; bloop++) {
- palette[loop].r = (rloop << 5) | (rloop << 2) | (rloop >> 1);
- palette[loop].g = (gloop << 5) | (gloop << 2) | (gloop >> 1);
- palette[loop].b = (bloop << 6) | (bloop << 4) | (bloop << 2) | (bloop);
+ /* Build a linear 6-8-5 levels RGB colour cube palette.
+ * This accounts for 240 colours */
+#define RLIM 6
+#define GLIM 8
+#define BLIM 5
+ for (rloop = 0; rloop < RLIM; rloop++) {
+ for (gloop = 0; gloop < GLIM; gloop++) {
+ for (bloop = 0; bloop < BLIM; bloop++) {
+ palette[loop].r = ((rloop * 255 * 2) + RLIM - 1) / (2 * (RLIM - 1));
+ palette[loop].g = ((gloop * 255 * 2) + GLIM - 1) / (2 * (GLIM - 1));
+ palette[loop].b = ((bloop * 255 * 2) + BLIM - 1) / (2 * (BLIM - 1));
+
nsfb->palette[loop] = palette[loop].r |
- palette[loop].g << 8 |
- palette[loop].b << 16;
+ palette[loop].g << 8 |
+ palette[loop].b << 16;
loop++;
}
}
}
+#undef RLIM
+#undef GLIM
+#undef BLIM
+
+ /* Should have 240 colours set */
+ assert(loop == 240);
+
+ /* Fill index 240 to index 255 with grayscales */
+ /* Note: already have full black and full white from RGB cube */
+ for (; loop < 256; loop++) {
+ int ngray = loop - 240 + 1;
+ palette[loop].r = ngray * 15; /* 17*15 = 255 */
+
+ palette[loop].g = palette[loop].b = palette[loop].r;
+
+ nsfb->palette[loop] = palette[loop].r |
+ palette[loop].g << 8 |
+ palette[loop].b << 16;
+ }
/* Set palette */
SDL_SetColors(sdl_screen, palette, 0, 256);
-----------------------------------------------------------------------
Summary of changes:
src/surface/sdl.c | 43 ++++++++++++++++++++++++++++++++++---------
1 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/src/surface/sdl.c b/src/surface/sdl.c
index 8908a21..d598b8a 100644
--- a/src/surface/sdl.c
+++ b/src/surface/sdl.c
@@ -6,6 +6,7 @@
* http://www.opensource.org/licenses/mit-license.php
*/
+#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <SDL/SDL.h>
@@ -355,20 +356,44 @@ set_palette(nsfb_t *nsfb)
int rloop, gloop, bloop;
int loop = 0;
- /* build a linear R:3 G:3 B:2 colour cube palette. */
- for (rloop = 0; rloop < 8; rloop++) {
- for (gloop = 0; gloop < 8; gloop++) {
- for (bloop = 0; bloop < 4; bloop++) {
- palette[loop].r = (rloop << 5) | (rloop << 2) | (rloop >> 1);
- palette[loop].g = (gloop << 5) | (gloop << 2) | (gloop >> 1);
- palette[loop].b = (bloop << 6) | (bloop << 4) | (bloop << 2) | (bloop);
+ /* Build a linear 6-8-5 levels RGB colour cube palette.
+ * This accounts for 240 colours */
+#define RLIM 6
+#define GLIM 8
+#define BLIM 5
+ for (rloop = 0; rloop < RLIM; rloop++) {
+ for (gloop = 0; gloop < GLIM; gloop++) {
+ for (bloop = 0; bloop < BLIM; bloop++) {
+ palette[loop].r = ((rloop * 255 * 2) + RLIM - 1) / (2 * (RLIM - 1));
+ palette[loop].g = ((gloop * 255 * 2) + GLIM - 1) / (2 * (GLIM - 1));
+ palette[loop].b = ((bloop * 255 * 2) + BLIM - 1) / (2 * (BLIM - 1));
+
nsfb->palette[loop] = palette[loop].r |
- palette[loop].g << 8 |
- palette[loop].b << 16;
+ palette[loop].g << 8 |
+ palette[loop].b << 16;
loop++;
}
}
}
+#undef RLIM
+#undef GLIM
+#undef BLIM
+
+ /* Should have 240 colours set */
+ assert(loop == 240);
+
+ /* Fill index 240 to index 255 with grayscales */
+ /* Note: already have full black and full white from RGB cube */
+ for (; loop < 256; loop++) {
+ int ngray = loop - 240 + 1;
+ palette[loop].r = ngray * 15; /* 17*15 = 255 */
+
+ palette[loop].g = palette[loop].b = palette[loop].r;
+
+ nsfb->palette[loop] = palette[loop].r |
+ palette[loop].g << 8 |
+ palette[loop].b << 16;
+ }
/* Set palette */
SDL_SetColors(sdl_screen, palette, 0, 256);
--
NetSurf Framebuffer library
10 years, 8 months
netsurf: branch master updated. 07f86cfc1de55028627f3cdca8138df43dc35b08
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/07f86cfc1de55028627f3...
...commit http://git.netsurf-browser.org/netsurf.git/commit/07f86cfc1de55028627f3cd...
...tree http://git.netsurf-browser.org/netsurf.git/tree/07f86cfc1de55028627f3cdca...
The branch, master has been updated
via 07f86cfc1de55028627f3cdca8138df43dc35b08 (commit)
from 00697c7fad138d241c26a670992cee2cbc6045b7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/07f86cfc1de55028627...
commit 07f86cfc1de55028627f3cdca8138df43dc35b08
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
Fix bug 3570980: extract link colours from body element.
diff --git a/css/select.c b/css/select.c
index 84b8550..042f123 100644
--- a/css/select.c
+++ b/css/select.c
@@ -2723,14 +2723,14 @@ node_presentational_hint_color(nscss_select_ctx *ctx,
return error;
if (is_visited) {
- err = dom_element_get_attribute(node,
+ err = dom_element_get_attribute(bodynode,
corestring_dom_vlink, &color);
if ((err != DOM_NO_ERR) || (color == NULL)) {
dom_string_unref(node_name);
return CSS_PROPERTY_NOT_SET;
}
} else {
- err = dom_element_get_attribute(node,
+ err = dom_element_get_attribute(bodynode,
corestring_dom_link, &color);
if ((err != DOM_NO_ERR) || (color == NULL)) {
dom_string_unref(node_name);
-----------------------------------------------------------------------
Summary of changes:
css/select.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/css/select.c b/css/select.c
index 84b8550..042f123 100644
--- a/css/select.c
+++ b/css/select.c
@@ -2723,14 +2723,14 @@ node_presentational_hint_color(nscss_select_ctx *ctx,
return error;
if (is_visited) {
- err = dom_element_get_attribute(node,
+ err = dom_element_get_attribute(bodynode,
corestring_dom_vlink, &color);
if ((err != DOM_NO_ERR) || (color == NULL)) {
dom_string_unref(node_name);
return CSS_PROPERTY_NOT_SET;
}
} else {
- err = dom_element_get_attribute(node,
+ err = dom_element_get_attribute(bodynode,
corestring_dom_link, &color);
if ((err != DOM_NO_ERR) || (color == NULL)) {
dom_string_unref(node_name);
--
NetSurf Browser
10 years, 8 months
nsgenjsbind: branch master updated. 4b043613d1a20980b13a6e9b0c8a7ff91c035b2f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/4b043613d1a20980b...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/4b043613d1a20980b13...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/4b043613d1a20980b13a6...
The branch, master has been updated
via 4b043613d1a20980b13a6e9b0c8a7ff91c035b2f (commit)
from b5c59d1138c704afd09c4716faabe79f04a80616 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/4b043613d1a2098...
commit 4b043613d1a20980b13a6e9b0c8a7ff91c035b2f
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
add interface function return type
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index 53ba7e6..91da839 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -25,8 +25,9 @@ struct webidl_node {
struct webidl_node *l;
union {
void *value;
- struct webidl_node *node;
- char *text;
+ struct webidl_node *node; /* node has a list of nodes */
+ char *text; /* node data is text */
+ int number; /* node data is an integer */
} r;
};
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index 7c32d82..c41149d 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -39,6 +39,7 @@ enum webidl_type {
WEBIDL_TYPE_OBJECT,
WEBIDL_TYPE_DATE,
WEBIDL_TYPE_USER,
+ WEBIDL_TYPE_VOID,
};
enum webidl_type_modifier {
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index c3bb609..69fbef5 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -151,6 +151,7 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> Ellipsis
%type <node> Type
+%type <node> ReturnType
%type <node> SingleType
%type <node> UnionType
%type <node> NonAnyType
@@ -581,6 +582,8 @@ OperationRest:
{
struct webidl_node *operation = $4; /* argument list */
+ operation = webidl_node_prepend(operation, $1); /* return type */
+
operation = webidl_node_prepend(operation, $2); /* identifier */
$$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, operation);
@@ -1119,6 +1122,12 @@ ReturnType:
Type
|
TOK_VOID
+ {
+ struct webidl_node *type;
+ type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
+ }
+
;
%%
-----------------------------------------------------------------------
Summary of changes:
src/webidl-ast.c | 5 +++--
src/webidl-ast.h | 1 +
src/webidl-parser.y | 9 +++++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index 53ba7e6..91da839 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -25,8 +25,9 @@ struct webidl_node {
struct webidl_node *l;
union {
void *value;
- struct webidl_node *node;
- char *text;
+ struct webidl_node *node; /* node has a list of nodes */
+ char *text; /* node data is text */
+ int number; /* node data is an integer */
} r;
};
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index 7c32d82..c41149d 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -39,6 +39,7 @@ enum webidl_type {
WEBIDL_TYPE_OBJECT,
WEBIDL_TYPE_DATE,
WEBIDL_TYPE_USER,
+ WEBIDL_TYPE_VOID,
};
enum webidl_type_modifier {
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index c3bb609..69fbef5 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -151,6 +151,7 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> Ellipsis
%type <node> Type
+%type <node> ReturnType
%type <node> SingleType
%type <node> UnionType
%type <node> NonAnyType
@@ -581,6 +582,8 @@ OperationRest:
{
struct webidl_node *operation = $4; /* argument list */
+ operation = webidl_node_prepend(operation, $1); /* return type */
+
operation = webidl_node_prepend(operation, $2); /* identifier */
$$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, operation);
@@ -1119,6 +1122,12 @@ ReturnType:
Type
|
TOK_VOID
+ {
+ struct webidl_node *type;
+ type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type);
+ }
+
;
%%
--
NetSurf Generator for JavaScript bindings
10 years, 8 months
nsgenjsbind: branch master updated. b5c59d1138c704afd09c4716faabe79f04a80616
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/b5c59d1138c704afd...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/b5c59d1138c704afd09...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/b5c59d1138c704afd09c4...
The branch, master has been updated
via b5c59d1138c704afd09c4716faabe79f04a80616 (commit)
from 20f9ab6b2c89a9a9edf00f052c912f139e7c4a38 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/b5c59d1138c704a...
commit b5c59d1138c704afd09c4716faabe79f04a80616
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
add interface function argument and type processing
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index d698fff..53ba7e6 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -30,21 +30,40 @@ struct webidl_node {
} r;
};
+/* insert node at beginning of a list */
+struct webidl_node *
+webidl_node_prepend(struct webidl_node *list, struct webidl_node *node)
+{
+ if (node == NULL) {
+ return list; /* no node to prepend - return existing list */
+ }
+ node->l = list;
+ return node;
+}
+
+/* append node at end of a list */
struct webidl_node *
-webidl_node_link(struct webidl_node *tgt, struct webidl_node *src)
+webidl_node_append(struct webidl_node *list, struct webidl_node *node)
{
- if (tgt != NULL) {
- tgt->l = src;
- return tgt;
- }
- return src;
+ struct webidl_node *cur = list;
+
+ if (cur == NULL) {
+ return node; /* no existing list so just return node */
+ }
+
+ while (cur->l != NULL) {
+ cur = cur->l;
+ }
+ cur->l = node;
+
+ return list;
}
struct webidl_node *
webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new)
{
- return webidl_node_link(new, list);
+ return webidl_node_prepend(list, new);
}
struct webidl_node *webidl_node_new(enum webidl_node_type type, struct webidl_node *l, void *r)
@@ -178,6 +197,9 @@ struct webidl_node *webidl_node_getnode(struct webidl_node *node)
case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
case WEBIDL_NODE_TYPE_ATTRIBUTE:
case WEBIDL_NODE_TYPE_OPERATION:
+ case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT:
+ case WEBIDL_NODE_TYPE_ARGUMENT:
+ case WEBIDL_NODE_TYPE_TYPE:
return node->r.node;
default:
break;
@@ -211,6 +233,24 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_OPERATION:
return "Operation";
+ case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT:
+ return "Argument(opt)";
+
+ case WEBIDL_NODE_TYPE_ARGUMENT:
+ return "Argument";
+
+ case WEBIDL_NODE_TYPE_ELLIPSIS:
+ return "Ellipsis";
+
+ case WEBIDL_NODE_TYPE_TYPE:
+ return "Type";
+
+ case WEBIDL_NODE_TYPE_TYPE_BASE:
+ return "Base";
+
+ case WEBIDL_NODE_TYPE_TYPE_MODIFIER:
+ return "Modifier";
+
default:
return "Unknown";
}
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index c86d59b..7c32d82 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -17,6 +17,33 @@ enum webidl_node_type {
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
WEBIDL_NODE_TYPE_ATTRIBUTE,
WEBIDL_NODE_TYPE_OPERATION,
+ WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT,
+ WEBIDL_NODE_TYPE_ARGUMENT,
+ WEBIDL_NODE_TYPE_ELLIPSIS,
+ WEBIDL_NODE_TYPE_TYPE,
+ WEBIDL_NODE_TYPE_TYPE_BASE,
+ WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+};
+
+enum webidl_type {
+ WEBIDL_TYPE_BOOL,
+ WEBIDL_TYPE_BYTE,
+ WEBIDL_TYPE_OCTET,
+ WEBIDL_TYPE_FLOAT,
+ WEBIDL_TYPE_DOUBLE,
+ WEBIDL_TYPE_SHORT,
+ WEBIDL_TYPE_LONG,
+ WEBIDL_TYPE_LONGLONG,
+ WEBIDL_TYPE_STRING,
+ WEBIDL_TYPE_SEQUENCE,
+ WEBIDL_TYPE_OBJECT,
+ WEBIDL_TYPE_DATE,
+ WEBIDL_TYPE_USER,
+};
+
+enum webidl_type_modifier {
+ WEBIDL_TYPE_MODIFIER_UNSIGNED,
+ WEBIDL_TYPE_MODIFIER_UNRESTRICTED,
};
struct webidl_node;
@@ -30,7 +57,8 @@ struct webidl_node *webidl_node_new(enum webidl_node_type, struct webidl_node *l
void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void *r);
-struct webidl_node *webidl_node_link(struct webidl_node *tgt, struct webidl_node *src);
+struct webidl_node *webidl_node_prepend(struct webidl_node *list, struct webidl_node *node);
+struct webidl_node *webidl_node_append(struct webidl_node *list, struct webidl_node *node);
struct webidl_node *webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new);
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index 9b3eb12..c3bb609 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -13,6 +13,8 @@
#include <stdio.h>
#include <string.h>
+#include <stdbool.h>
+#include <stdint.h>
#include "webidl-ast.h"
@@ -39,9 +41,9 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%union
{
int attr;
- char* text;
long value;
- struct ifmember_s **ifmember;
+ bool isit;
+ char* text;
struct webidl_node *node;
}
@@ -138,14 +140,36 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> Operation
%type <node> OperationRest
-%type <text> OptionalIdentifier
+%type <node> OptionalIdentifier
+
+%type <node> ArgumentList
+%type <node> Arguments
+%type <node> Argument
+%type <node> OptionalOrRequiredArgument
+%type <text> ArgumentName
+%type <text> ArgumentNameKeyword
+%type <node> Ellipsis
+
+%type <node> Type
+%type <node> SingleType
+%type <node> UnionType
+%type <node> NonAnyType
+%type <node> PrimitiveType
+%type <node> UnrestrictedFloatType
+%type <node> FloatType
+%type <node> UnsignedIntegerType
+%type <node> IntegerType
+
+%type <isit> OptionalLong
%%
/* default rule to add built AST to passed in one */
Input:
Definitions
- { *webidl_ast = webidl_node_link($1, *webidl_ast); }
+ {
+ *webidl_ast = webidl_node_prepend(*webidl_ast, $1);
+ }
|
error
{
@@ -164,7 +188,7 @@ Definitions:
|
Definitions ExtendedAttributeList Definition
{
- $$ = webidl_node_link($1, $3);
+ $$ = webidl_node_prepend($1, $3);
}
;
@@ -496,9 +520,9 @@ StringifierAttributeOrOperation:
Attribute:
Inherit ReadOnly TOK_ATTRIBUTE Type TOK_IDENTIFIER ';'
{
- struct webidl_node *ident;
- ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, ident);;
+ struct webidl_node *attribute;
+ attribute = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, attribute);
}
;
@@ -555,11 +579,11 @@ Special:
OperationRest:
ReturnType OptionalIdentifier '(' ArgumentList ')' ';'
{
- struct webidl_node *ident = NULL;
- if ($2 != NULL) {
- ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $2);
- }
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, ident);
+ struct webidl_node *operation = $4; /* argument list */
+
+ operation = webidl_node_prepend(operation, $2); /* identifier */
+
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, operation);
}
;
@@ -571,34 +595,67 @@ OptionalIdentifier:
}
|
TOK_IDENTIFIER
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $1);
+ }
;
- /* [41] */
+ /* [41] an empty list or a list of non empty comma separated arguments, note
+ * this is right associative so the tree build is ass backwards
+ */
ArgumentList:
/* empty */
+ {
+ $$ = NULL;
+ }
|
Argument Arguments
+ {
+ $$ = webidl_node_append($2, $1);
+ }
;
/* [42] */
Arguments:
/* empty */
+ {
+ $$ = NULL;
+ }
|
',' Argument Arguments
+ {
+ $$ = webidl_node_append($3, $2);
+ }
;
/* [43] */
Argument:
ExtendedAttributeList OptionalOrRequiredArgument
+ {
+ $$ = $2;
+ }
;
/* [44] */
OptionalOrRequiredArgument:
TOK_OPTIONAL Type ArgumentName Default
+ {
+ struct webidl_node *argument;
+ argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3);
+ argument = webidl_node_prepend(argument, $2); /* add type node */
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT, NULL, argument);
+ }
|
Type Ellipsis ArgumentName
+ {
+ struct webidl_node *argument;
+ argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3);
+ argument = webidl_node_prepend(argument, $2); /* ellipsis node */
+ argument = webidl_node_prepend(argument, $1); /* add type node */
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, argument);
+ }
;
/* [45] */
@@ -611,8 +668,14 @@ ArgumentName:
/* [46] */
Ellipsis:
/* empty */
+ {
+ $$ = NULL;
+ }
|
TOK_ELLIPSIS
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ELLIPSIS, NULL, NULL);
+ }
;
/* [47] */
@@ -750,42 +813,99 @@ Other:
/* [55] */
ArgumentNameKeyword:
TOK_ATTRIBUTE
+ {
+ $$ = strdup("attribute");
+ }
|
TOK_CALLBACK
+ {
+ $$ = strdup("callback");
+ }
|
TOK_CONST
+ {
+ $$ = strdup("const");
+ }
|
TOK_CREATOR
+ {
+ $$ = strdup("creator");
+ }
|
TOK_DELETER
+ {
+ $$ = strdup("deleter");
+ }
|
TOK_DICTIONARY
+ {
+ $$ = strdup("dictionary");
+ }
|
TOK_ENUM
+ {
+ $$ = strdup("enum");
+ }
|
TOK_EXCEPTION
+ {
+ $$ = strdup("exception");
+ }
|
TOK_GETTER
+ {
+ $$ = strdup("getter");
+ }
|
TOK_IMPLEMENTS
+ {
+ $$ = strdup("implements");
+ }
|
TOK_INHERIT
+ {
+ $$ = strdup("inherit");
+ }
|
TOK_INTERFACE
+ {
+ $$ = strdup("interface");
+ }
|
TOK_LEGACYCALLER
+ {
+ $$ = strdup("legacycaller");
+ }
|
TOK_PARTIAL
+ {
+ $$ = strdup("partial");
+ }
|
TOK_SETTER
+ {
+ $$ = strdup("setter");
+ }
|
TOK_STATIC
+ {
+ $$ = strdup("static");
+ }
|
TOK_STRINGIFIER
+ {
+ $$ = strdup("stringifier");
+ }
|
TOK_TYPEDEF
+ {
+ $$ = strdup("typedef");
+ }
|
TOK_UNRESTRICTED
+ {
+ $$ = strdup("unrestricted");
+ }
;
/* [56] as it says an other element or a comma */
@@ -798,8 +918,15 @@ OtherOrComma:
/* [57] */
Type:
SingleType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
+ }
|
UnionType TypeSuffix
+ {
+ /* todo handle suffix */
+ $$ = $1;
+ }
;
/* [58] */
@@ -807,11 +934,17 @@ SingleType:
NonAnyType
|
TOK_ANY TypeSuffixStartingWithArray
+ {
+ $$ = NULL; /* todo implement */
+ }
;
/* [59] */
UnionType:
'(' UnionMemberType TOK_OR UnionMemberType UnionMemberTypes ')'
+ {
+ $$ = NULL;
+ }
;
/* [60] */
@@ -835,14 +968,31 @@ NonAnyType:
PrimitiveType TypeSuffix
|
TOK_STRING TypeSuffix
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_STRING);
+ }
|
TOK_IDENTIFIER TypeSuffix
+ {
+ struct webidl_node *type;
+ type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_USER);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, $1);
+ }
|
TOK_SEQUENCE '<' Type '>' Null
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $3, (void *)WEBIDL_TYPE_SEQUENCE);
+ }
|
TOK_OBJECT TypeSuffix
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OBJECT);
+ }
|
TOK_DATE TypeSuffix
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DATE);
+ }
;
/* [63] */
@@ -859,15 +1009,29 @@ PrimitiveType:
UnrestrictedFloatType
|
TOK_BOOLEAN
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BOOL);
+ }
|
TOK_BYTE
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BYTE);
+ }
|
TOK_OCTET
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OCTET);
+ }
;
/* [65] */
UnrestrictedFloatType:
TOK_UNRESTRICTED FloatType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
+ (void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
+ }
|
FloatType
;
@@ -875,13 +1039,24 @@ UnrestrictedFloatType:
/* [66] */
FloatType:
TOK_FLOAT
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_FLOAT);
+ }
|
TOK_DOUBLE
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DOUBLE);
+ }
;
/* [67] */
UnsignedIntegerType:
TOK_UNSIGNED IntegerType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
+ (void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
+ }
|
IntegerType
;
@@ -889,15 +1064,31 @@ UnsignedIntegerType:
/* [68] */
IntegerType:
TOK_SHORT
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_SHORT);
+ }
|
TOK_LONG OptionalLong
+ {
+ if ($2) {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONGLONG);
+ } else {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONG);
+ }
+ }
;
/* [69] */
OptionalLong:
/* empty */
+ {
+ $$ = false;
+ }
|
TOK_LONG
+ {
+ $$ = true;
+ }
;
/* [70] */
-----------------------------------------------------------------------
Summary of changes:
src/webidl-ast.c | 54 +++++++++++--
src/webidl-ast.h | 30 +++++++-
src/webidl-parser.y | 219 +++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 281 insertions(+), 22 deletions(-)
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index d698fff..53ba7e6 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -30,21 +30,40 @@ struct webidl_node {
} r;
};
+/* insert node at beginning of a list */
+struct webidl_node *
+webidl_node_prepend(struct webidl_node *list, struct webidl_node *node)
+{
+ if (node == NULL) {
+ return list; /* no node to prepend - return existing list */
+ }
+ node->l = list;
+ return node;
+}
+
+/* append node at end of a list */
struct webidl_node *
-webidl_node_link(struct webidl_node *tgt, struct webidl_node *src)
+webidl_node_append(struct webidl_node *list, struct webidl_node *node)
{
- if (tgt != NULL) {
- tgt->l = src;
- return tgt;
- }
- return src;
+ struct webidl_node *cur = list;
+
+ if (cur == NULL) {
+ return node; /* no existing list so just return node */
+ }
+
+ while (cur->l != NULL) {
+ cur = cur->l;
+ }
+ cur->l = node;
+
+ return list;
}
struct webidl_node *
webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new)
{
- return webidl_node_link(new, list);
+ return webidl_node_prepend(list, new);
}
struct webidl_node *webidl_node_new(enum webidl_node_type type, struct webidl_node *l, void *r)
@@ -178,6 +197,9 @@ struct webidl_node *webidl_node_getnode(struct webidl_node *node)
case WEBIDL_NODE_TYPE_INTERFACE_MEMBERS:
case WEBIDL_NODE_TYPE_ATTRIBUTE:
case WEBIDL_NODE_TYPE_OPERATION:
+ case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT:
+ case WEBIDL_NODE_TYPE_ARGUMENT:
+ case WEBIDL_NODE_TYPE_TYPE:
return node->r.node;
default:
break;
@@ -211,6 +233,24 @@ static const char *webidl_node_type_to_str(enum webidl_node_type type)
case WEBIDL_NODE_TYPE_OPERATION:
return "Operation";
+ case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT:
+ return "Argument(opt)";
+
+ case WEBIDL_NODE_TYPE_ARGUMENT:
+ return "Argument";
+
+ case WEBIDL_NODE_TYPE_ELLIPSIS:
+ return "Ellipsis";
+
+ case WEBIDL_NODE_TYPE_TYPE:
+ return "Type";
+
+ case WEBIDL_NODE_TYPE_TYPE_BASE:
+ return "Base";
+
+ case WEBIDL_NODE_TYPE_TYPE_MODIFIER:
+ return "Modifier";
+
default:
return "Unknown";
}
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index c86d59b..7c32d82 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -17,6 +17,33 @@ enum webidl_node_type {
WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE,
WEBIDL_NODE_TYPE_ATTRIBUTE,
WEBIDL_NODE_TYPE_OPERATION,
+ WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT,
+ WEBIDL_NODE_TYPE_ARGUMENT,
+ WEBIDL_NODE_TYPE_ELLIPSIS,
+ WEBIDL_NODE_TYPE_TYPE,
+ WEBIDL_NODE_TYPE_TYPE_BASE,
+ WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+};
+
+enum webidl_type {
+ WEBIDL_TYPE_BOOL,
+ WEBIDL_TYPE_BYTE,
+ WEBIDL_TYPE_OCTET,
+ WEBIDL_TYPE_FLOAT,
+ WEBIDL_TYPE_DOUBLE,
+ WEBIDL_TYPE_SHORT,
+ WEBIDL_TYPE_LONG,
+ WEBIDL_TYPE_LONGLONG,
+ WEBIDL_TYPE_STRING,
+ WEBIDL_TYPE_SEQUENCE,
+ WEBIDL_TYPE_OBJECT,
+ WEBIDL_TYPE_DATE,
+ WEBIDL_TYPE_USER,
+};
+
+enum webidl_type_modifier {
+ WEBIDL_TYPE_MODIFIER_UNSIGNED,
+ WEBIDL_TYPE_MODIFIER_UNRESTRICTED,
};
struct webidl_node;
@@ -30,7 +57,8 @@ struct webidl_node *webidl_node_new(enum webidl_node_type, struct webidl_node *l
void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void *r);
-struct webidl_node *webidl_node_link(struct webidl_node *tgt, struct webidl_node *src);
+struct webidl_node *webidl_node_prepend(struct webidl_node *list, struct webidl_node *node);
+struct webidl_node *webidl_node_append(struct webidl_node *list, struct webidl_node *node);
struct webidl_node *webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new);
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index 9b3eb12..c3bb609 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -13,6 +13,8 @@
#include <stdio.h>
#include <string.h>
+#include <stdbool.h>
+#include <stdint.h>
#include "webidl-ast.h"
@@ -39,9 +41,9 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%union
{
int attr;
- char* text;
long value;
- struct ifmember_s **ifmember;
+ bool isit;
+ char* text;
struct webidl_node *node;
}
@@ -138,14 +140,36 @@ webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str)
%type <node> Operation
%type <node> OperationRest
-%type <text> OptionalIdentifier
+%type <node> OptionalIdentifier
+
+%type <node> ArgumentList
+%type <node> Arguments
+%type <node> Argument
+%type <node> OptionalOrRequiredArgument
+%type <text> ArgumentName
+%type <text> ArgumentNameKeyword
+%type <node> Ellipsis
+
+%type <node> Type
+%type <node> SingleType
+%type <node> UnionType
+%type <node> NonAnyType
+%type <node> PrimitiveType
+%type <node> UnrestrictedFloatType
+%type <node> FloatType
+%type <node> UnsignedIntegerType
+%type <node> IntegerType
+
+%type <isit> OptionalLong
%%
/* default rule to add built AST to passed in one */
Input:
Definitions
- { *webidl_ast = webidl_node_link($1, *webidl_ast); }
+ {
+ *webidl_ast = webidl_node_prepend(*webidl_ast, $1);
+ }
|
error
{
@@ -164,7 +188,7 @@ Definitions:
|
Definitions ExtendedAttributeList Definition
{
- $$ = webidl_node_link($1, $3);
+ $$ = webidl_node_prepend($1, $3);
}
;
@@ -496,9 +520,9 @@ StringifierAttributeOrOperation:
Attribute:
Inherit ReadOnly TOK_ATTRIBUTE Type TOK_IDENTIFIER ';'
{
- struct webidl_node *ident;
- ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, ident);;
+ struct webidl_node *attribute;
+ attribute = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, attribute);
}
;
@@ -555,11 +579,11 @@ Special:
OperationRest:
ReturnType OptionalIdentifier '(' ArgumentList ')' ';'
{
- struct webidl_node *ident = NULL;
- if ($2 != NULL) {
- ident = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $2);
- }
- $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, ident);
+ struct webidl_node *operation = $4; /* argument list */
+
+ operation = webidl_node_prepend(operation, $2); /* identifier */
+
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, operation);
}
;
@@ -571,34 +595,67 @@ OptionalIdentifier:
}
|
TOK_IDENTIFIER
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $1);
+ }
;
- /* [41] */
+ /* [41] an empty list or a list of non empty comma separated arguments, note
+ * this is right associative so the tree build is ass backwards
+ */
ArgumentList:
/* empty */
+ {
+ $$ = NULL;
+ }
|
Argument Arguments
+ {
+ $$ = webidl_node_append($2, $1);
+ }
;
/* [42] */
Arguments:
/* empty */
+ {
+ $$ = NULL;
+ }
|
',' Argument Arguments
+ {
+ $$ = webidl_node_append($3, $2);
+ }
;
/* [43] */
Argument:
ExtendedAttributeList OptionalOrRequiredArgument
+ {
+ $$ = $2;
+ }
;
/* [44] */
OptionalOrRequiredArgument:
TOK_OPTIONAL Type ArgumentName Default
+ {
+ struct webidl_node *argument;
+ argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3);
+ argument = webidl_node_prepend(argument, $2); /* add type node */
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT, NULL, argument);
+ }
|
Type Ellipsis ArgumentName
+ {
+ struct webidl_node *argument;
+ argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3);
+ argument = webidl_node_prepend(argument, $2); /* ellipsis node */
+ argument = webidl_node_prepend(argument, $1); /* add type node */
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, argument);
+ }
;
/* [45] */
@@ -611,8 +668,14 @@ ArgumentName:
/* [46] */
Ellipsis:
/* empty */
+ {
+ $$ = NULL;
+ }
|
TOK_ELLIPSIS
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ELLIPSIS, NULL, NULL);
+ }
;
/* [47] */
@@ -750,42 +813,99 @@ Other:
/* [55] */
ArgumentNameKeyword:
TOK_ATTRIBUTE
+ {
+ $$ = strdup("attribute");
+ }
|
TOK_CALLBACK
+ {
+ $$ = strdup("callback");
+ }
|
TOK_CONST
+ {
+ $$ = strdup("const");
+ }
|
TOK_CREATOR
+ {
+ $$ = strdup("creator");
+ }
|
TOK_DELETER
+ {
+ $$ = strdup("deleter");
+ }
|
TOK_DICTIONARY
+ {
+ $$ = strdup("dictionary");
+ }
|
TOK_ENUM
+ {
+ $$ = strdup("enum");
+ }
|
TOK_EXCEPTION
+ {
+ $$ = strdup("exception");
+ }
|
TOK_GETTER
+ {
+ $$ = strdup("getter");
+ }
|
TOK_IMPLEMENTS
+ {
+ $$ = strdup("implements");
+ }
|
TOK_INHERIT
+ {
+ $$ = strdup("inherit");
+ }
|
TOK_INTERFACE
+ {
+ $$ = strdup("interface");
+ }
|
TOK_LEGACYCALLER
+ {
+ $$ = strdup("legacycaller");
+ }
|
TOK_PARTIAL
+ {
+ $$ = strdup("partial");
+ }
|
TOK_SETTER
+ {
+ $$ = strdup("setter");
+ }
|
TOK_STATIC
+ {
+ $$ = strdup("static");
+ }
|
TOK_STRINGIFIER
+ {
+ $$ = strdup("stringifier");
+ }
|
TOK_TYPEDEF
+ {
+ $$ = strdup("typedef");
+ }
|
TOK_UNRESTRICTED
+ {
+ $$ = strdup("unrestricted");
+ }
;
/* [56] as it says an other element or a comma */
@@ -798,8 +918,15 @@ OtherOrComma:
/* [57] */
Type:
SingleType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1);
+ }
|
UnionType TypeSuffix
+ {
+ /* todo handle suffix */
+ $$ = $1;
+ }
;
/* [58] */
@@ -807,11 +934,17 @@ SingleType:
NonAnyType
|
TOK_ANY TypeSuffixStartingWithArray
+ {
+ $$ = NULL; /* todo implement */
+ }
;
/* [59] */
UnionType:
'(' UnionMemberType TOK_OR UnionMemberType UnionMemberTypes ')'
+ {
+ $$ = NULL;
+ }
;
/* [60] */
@@ -835,14 +968,31 @@ NonAnyType:
PrimitiveType TypeSuffix
|
TOK_STRING TypeSuffix
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_STRING);
+ }
|
TOK_IDENTIFIER TypeSuffix
+ {
+ struct webidl_node *type;
+ type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_USER);
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, $1);
+ }
|
TOK_SEQUENCE '<' Type '>' Null
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $3, (void *)WEBIDL_TYPE_SEQUENCE);
+ }
|
TOK_OBJECT TypeSuffix
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OBJECT);
+ }
|
TOK_DATE TypeSuffix
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DATE);
+ }
;
/* [63] */
@@ -859,15 +1009,29 @@ PrimitiveType:
UnrestrictedFloatType
|
TOK_BOOLEAN
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BOOL);
+ }
|
TOK_BYTE
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BYTE);
+ }
|
TOK_OCTET
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OCTET);
+ }
;
/* [65] */
UnrestrictedFloatType:
TOK_UNRESTRICTED FloatType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
+ (void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED);
+ }
|
FloatType
;
@@ -875,13 +1039,24 @@ UnrestrictedFloatType:
/* [66] */
FloatType:
TOK_FLOAT
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_FLOAT);
+ }
|
TOK_DOUBLE
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DOUBLE);
+ }
;
/* [67] */
UnsignedIntegerType:
TOK_UNSIGNED IntegerType
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_MODIFIER,
+ $2,
+ (void *)WEBIDL_TYPE_MODIFIER_UNSIGNED);
+ }
|
IntegerType
;
@@ -889,15 +1064,31 @@ UnsignedIntegerType:
/* [68] */
IntegerType:
TOK_SHORT
+ {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_SHORT);
+ }
|
TOK_LONG OptionalLong
+ {
+ if ($2) {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONGLONG);
+ } else {
+ $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONG);
+ }
+ }
;
/* [69] */
OptionalLong:
/* empty */
+ {
+ $$ = false;
+ }
|
TOK_LONG
+ {
+ $$ = true;
+ }
;
/* [70] */
--
NetSurf Generator for JavaScript bindings
10 years, 8 months
netsurf: branch master updated. 00697c7fad138d241c26a670992cee2cbc6045b7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/00697c7fad138d241c26a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/00697c7fad138d241c26a67...
...tree http://git.netsurf-browser.org/netsurf.git/tree/00697c7fad138d241c26a6709...
The branch, master has been updated
via 00697c7fad138d241c26a670992cee2cbc6045b7 (commit)
from afa408c7506842cea88d2a93701ce86f6c87c178 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/00697c7fad138d241c2...
commit 00697c7fad138d241c26a670992cee2cbc6045b7
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix imagemap handling to handle no coords attr when shape attr is not default.
diff --git a/render/imagemap.c b/render/imagemap.c
index 9663a89..bf90443 100644
--- a/render/imagemap.c
+++ b/render/imagemap.c
@@ -450,7 +450,7 @@ imagemap_addtolist(dom_node *n, nsurl *base_url,
/* If not 'default' and there's no 'coords' give up */
exc = dom_element_get_attribute(n, corestring_dom_coords,
&coords);
- if (exc != DOM_NO_ERR) {
+ if (exc != DOM_NO_ERR || coords == NULL) {
goto ok_out;
}
}
-----------------------------------------------------------------------
Summary of changes:
render/imagemap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/render/imagemap.c b/render/imagemap.c
index 9663a89..bf90443 100644
--- a/render/imagemap.c
+++ b/render/imagemap.c
@@ -450,7 +450,7 @@ imagemap_addtolist(dom_node *n, nsurl *base_url,
/* If not 'default' and there's no 'coords' give up */
exc = dom_element_get_attribute(n, corestring_dom_coords,
&coords);
- if (exc != DOM_NO_ERR) {
+ if (exc != DOM_NO_ERR || coords == NULL) {
goto ok_out;
}
}
--
NetSurf Browser
10 years, 8 months
nsgenjsbind: branch master updated. 20f9ab6b2c89a9a9edf00f052c912f139e7c4a38
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/20f9ab6b2c89a9a9e...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/20f9ab6b2c89a9a9edf...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/20f9ab6b2c89a9a9edf00...
The branch, master has been updated
via 20f9ab6b2c89a9a9edf00f052c912f139e7c4a38 (commit)
from d58d0289a7b7817e2d96f4666ebb370add8d1a81 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/20f9ab6b2c89a9a...
commit 20f9ab6b2c89a9a9edf00f052c912f139e7c4a38
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add basic function body creation
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index aba6bdf..13af77b 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -200,7 +200,7 @@ output_property_spec(FILE *outfile,
res = generate_property_spec(outfile, binding->interface, webidl_ast);
- fprintf(outfile, " JSAPI_PS_END\n};\n");
+ fprintf(outfile, " JSAPI_PS_END\n};\n\n");
return res;
}
@@ -297,11 +297,107 @@ output_function_spec(FILE *outfile,
res = generate_function_spec(outfile, binding->interface, webidl_ast);
- fprintf(outfile, " JSAPI_FS_END\n};\n");
+ fprintf(outfile, " JSAPI_FS_END\n};\n\n");
return res;
}
+static int webidl_function_body_cb(struct webidl_node *node, void *ctx)
+{
+ FILE *outfile = ctx;
+ struct webidl_node *ident_node;
+
+ ident_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_IDENT);
+
+ if (ident_node == NULL) {
+ /* operation without identifier - must have special keyword
+ * http://www.w3.org/TR/WebIDL/#idl-operations
+ */
+ } else {
+ fprintf(outfile,
+ "static JSBool JSAPI_NATIVE(%s, JSContext *cx, uintN argc, jsval *vp)\n",
+ webidl_node_gettext(ident_node));
+ fprintf(outfile, "{\n");
+ fprintf(outfile, "}\n\n");
+
+ }
+ return 0;
+}
+
+static int
+generate_function_body(FILE *outfile,
+ const char *interface,
+ struct webidl_node *webidl_ast)
+{
+ struct webidl_node *interface_node;
+ struct webidl_node *members_node;
+ struct webidl_node *inherit_node;
+
+
+ /* find interface in webidl with correct ident attached */
+ interface_node = webidl_node_find_type_ident(webidl_ast,
+ WEBIDL_NODE_TYPE_INTERFACE,
+ interface);
+
+ if (interface_node == NULL) {
+ fprintf(stderr,
+ "Unable to find interface %s in loaded WebIDL\n",
+ interface);
+ return -1;
+ }
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ while (members_node != NULL) {
+
+ fprintf(outfile,"/**** %s ****/\n", interface);
+
+ /* for each function emit a JSAPI_FS()*/
+ webidl_node_for_each_type(webidl_node_getnode(members_node),
+ WEBIDL_NODE_TYPE_OPERATION,
+ webidl_function_body_cb,
+ outfile);
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ members_node,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ }
+
+ /* check for inherited nodes and insert them too */
+ inherit_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE);
+
+ if (inherit_node != NULL) {
+ return generate_function_body(outfile,
+ webidl_node_gettext(inherit_node),
+ webidl_ast);
+ }
+
+ return 0;
+}
+
+static int
+output_function_body(FILE *outfile,
+ struct binding *binding,
+ struct webidl_node *webidl_ast)
+{
+ int res;
+
+ res = generate_function_body(outfile, binding->interface, webidl_ast);
+
+ return res;
+}
+
+
+
static struct binding *binding_new(struct genbind_node *genbind_ast)
{
struct binding *nb;
@@ -379,6 +475,12 @@ int jsapi_libdom_output(char *outfilename, struct genbind_node *genbind_ast)
output_preamble(outfile, genbind_ast);
+ res = output_function_body(outfile, binding, webidl_ast);
+ if (res) {
+ return 5;
+ }
+
+
res = output_function_spec(outfile, binding, webidl_ast);
if (res) {
return 5;
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index aa8e279..d698fff 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -41,6 +41,12 @@ webidl_node_link(struct webidl_node *tgt, struct webidl_node *src)
return src;
}
+struct webidl_node *
+webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new)
+{
+ return webidl_node_link(new, list);
+}
+
struct webidl_node *webidl_node_new(enum webidl_node_type type, struct webidl_node *l, void *r)
{
struct webidl_node *nn;
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index b421615..c86d59b 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -32,6 +32,8 @@ void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void
struct webidl_node *webidl_node_link(struct webidl_node *tgt, struct webidl_node *src);
+struct webidl_node *webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new);
+
/* node contents acessors */
char *webidl_node_gettext(struct webidl_node *node);
struct webidl_node *webidl_node_getnode(struct webidl_node *node);
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index d9be0b9..9b3eb12 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -307,7 +307,7 @@ InterfaceMembers:
|
InterfaceMembers ExtendedAttributeList InterfaceMember
{
- $$ = webidl_node_link($3, $1);
+ $$ = webidl_add_interface_member($1, $3);
}
;
-----------------------------------------------------------------------
Summary of changes:
src/jsapi-libdom.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++-
src/webidl-ast.c | 6 +++
src/webidl-ast.h | 2 +
src/webidl-parser.y | 2 +-
4 files changed, 113 insertions(+), 3 deletions(-)
diff --git a/src/jsapi-libdom.c b/src/jsapi-libdom.c
index aba6bdf..13af77b 100644
--- a/src/jsapi-libdom.c
+++ b/src/jsapi-libdom.c
@@ -200,7 +200,7 @@ output_property_spec(FILE *outfile,
res = generate_property_spec(outfile, binding->interface, webidl_ast);
- fprintf(outfile, " JSAPI_PS_END\n};\n");
+ fprintf(outfile, " JSAPI_PS_END\n};\n\n");
return res;
}
@@ -297,11 +297,107 @@ output_function_spec(FILE *outfile,
res = generate_function_spec(outfile, binding->interface, webidl_ast);
- fprintf(outfile, " JSAPI_FS_END\n};\n");
+ fprintf(outfile, " JSAPI_FS_END\n};\n\n");
return res;
}
+static int webidl_function_body_cb(struct webidl_node *node, void *ctx)
+{
+ FILE *outfile = ctx;
+ struct webidl_node *ident_node;
+
+ ident_node = webidl_node_find(webidl_node_getnode(node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_IDENT);
+
+ if (ident_node == NULL) {
+ /* operation without identifier - must have special keyword
+ * http://www.w3.org/TR/WebIDL/#idl-operations
+ */
+ } else {
+ fprintf(outfile,
+ "static JSBool JSAPI_NATIVE(%s, JSContext *cx, uintN argc, jsval *vp)\n",
+ webidl_node_gettext(ident_node));
+ fprintf(outfile, "{\n");
+ fprintf(outfile, "}\n\n");
+
+ }
+ return 0;
+}
+
+static int
+generate_function_body(FILE *outfile,
+ const char *interface,
+ struct webidl_node *webidl_ast)
+{
+ struct webidl_node *interface_node;
+ struct webidl_node *members_node;
+ struct webidl_node *inherit_node;
+
+
+ /* find interface in webidl with correct ident attached */
+ interface_node = webidl_node_find_type_ident(webidl_ast,
+ WEBIDL_NODE_TYPE_INTERFACE,
+ interface);
+
+ if (interface_node == NULL) {
+ fprintf(stderr,
+ "Unable to find interface %s in loaded WebIDL\n",
+ interface);
+ return -1;
+ }
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ while (members_node != NULL) {
+
+ fprintf(outfile,"/**** %s ****/\n", interface);
+
+ /* for each function emit a JSAPI_FS()*/
+ webidl_node_for_each_type(webidl_node_getnode(members_node),
+ WEBIDL_NODE_TYPE_OPERATION,
+ webidl_function_body_cb,
+ outfile);
+
+ members_node = webidl_node_find(webidl_node_getnode(interface_node),
+ members_node,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_MEMBERS);
+ }
+
+ /* check for inherited nodes and insert them too */
+ inherit_node = webidl_node_find(webidl_node_getnode(interface_node),
+ NULL,
+ webidl_cmp_node_type,
+ (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE);
+
+ if (inherit_node != NULL) {
+ return generate_function_body(outfile,
+ webidl_node_gettext(inherit_node),
+ webidl_ast);
+ }
+
+ return 0;
+}
+
+static int
+output_function_body(FILE *outfile,
+ struct binding *binding,
+ struct webidl_node *webidl_ast)
+{
+ int res;
+
+ res = generate_function_body(outfile, binding->interface, webidl_ast);
+
+ return res;
+}
+
+
+
static struct binding *binding_new(struct genbind_node *genbind_ast)
{
struct binding *nb;
@@ -379,6 +475,12 @@ int jsapi_libdom_output(char *outfilename, struct genbind_node *genbind_ast)
output_preamble(outfile, genbind_ast);
+ res = output_function_body(outfile, binding, webidl_ast);
+ if (res) {
+ return 5;
+ }
+
+
res = output_function_spec(outfile, binding, webidl_ast);
if (res) {
return 5;
diff --git a/src/webidl-ast.c b/src/webidl-ast.c
index aa8e279..d698fff 100644
--- a/src/webidl-ast.c
+++ b/src/webidl-ast.c
@@ -41,6 +41,12 @@ webidl_node_link(struct webidl_node *tgt, struct webidl_node *src)
return src;
}
+struct webidl_node *
+webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new)
+{
+ return webidl_node_link(new, list);
+}
+
struct webidl_node *webidl_node_new(enum webidl_node_type type, struct webidl_node *l, void *r)
{
struct webidl_node *nn;
diff --git a/src/webidl-ast.h b/src/webidl-ast.h
index b421615..c86d59b 100644
--- a/src/webidl-ast.h
+++ b/src/webidl-ast.h
@@ -32,6 +32,8 @@ void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void
struct webidl_node *webidl_node_link(struct webidl_node *tgt, struct webidl_node *src);
+struct webidl_node *webidl_add_interface_member(struct webidl_node *list, struct webidl_node *new);
+
/* node contents acessors */
char *webidl_node_gettext(struct webidl_node *node);
struct webidl_node *webidl_node_getnode(struct webidl_node *node);
diff --git a/src/webidl-parser.y b/src/webidl-parser.y
index d9be0b9..9b3eb12 100644
--- a/src/webidl-parser.y
+++ b/src/webidl-parser.y
@@ -307,7 +307,7 @@ InterfaceMembers:
|
InterfaceMembers ExtendedAttributeList InterfaceMember
{
- $$ = webidl_node_link($3, $1);
+ $$ = webidl_add_interface_member($1, $3);
}
;
--
NetSurf Generator for JavaScript bindings
10 years, 8 months