summaryrefslogtreecommitdiff
path: root/test/data/bindings/htmldocument.bnd
diff options
context:
space:
mode:
authorVincent Sanders <vincent.sanders@collabora.co.uk>2012-10-04 19:48:32 +0100
committerVincent Sanders <vincent.sanders@collabora.co.uk>2012-10-04 19:48:32 +0100
commitfbd184fe421591851e1224518a3c9430dd37dce8 (patch)
tree583578eb6d9f6aec338605ca4afd5a691051e4fc /test/data/bindings/htmldocument.bnd
parent56c66282650a7a5ac83e549d11839d26deaa1528 (diff)
downloadnsgenbind-fbd184fe421591851e1224518a3c9430dd37dce8.tar.gz
nsgenbind-fbd184fe421591851e1224518a3c9430dd37dce8.tar.bz2
allow teh binding to specify contents for operations
Diffstat (limited to 'test/data/bindings/htmldocument.bnd')
-rw-r--r--test/data/bindings/htmldocument.bnd59
1 files changed, 24 insertions, 35 deletions
diff --git a/test/data/bindings/htmldocument.bnd b/test/data/bindings/htmldocument.bnd
index 6c470e4..8d35df9 100644
--- a/test/data/bindings/htmldocument.bnd
+++ b/test/data/bindings/htmldocument.bnd
@@ -12,55 +12,44 @@ hdrcomment "multi"
hdrcomment "IDL http://www.whatwg.org/specs/web-apps/current-work/#the-document-object";
-preamble [[[
+preamble %{
#include <dom/dom.h>
-
+
#include "utils/config.h"
#include "utils/log.h"
#include "javascript/jsapi.h"
-static JSBool JSAPI_NATIVE(write, JSContext *cx, uintN argc, jsval *vp)
-{
- JSString* u16_txt;
- char *txt;
- unsigned long length;
- struct jsclass_document_priv *document;
-
- document = JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx,vp), &JSCLASS_OBJECT, NULL);
- if (document == NULL) {
- return JS_FALSE;
- }
- if (!JS_ConvertArguments(cx, argc, JSAPI_ARGV(cx, vp), "S", &u16_txt)) {
- return JS_FALSE;
- }
+ %}
- JSString_to_char(u16_txt, txt, length);
+operation write %{
- LOG(("content %p parser %p writing %s",
- document->htmlc, document->htmlc->parser, txt));
- if (document->htmlc->parser != NULL) {
- dom_hubbub_parser_insert_chunk(document->htmlc->parser, (uint8_t *)txt, length);
- }
- JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
+ if (!JS_ConvertArguments(cx, argc, JSAPI_ARGV(cx, vp), "S", &u16_txt)) {
+ return JS_FALSE;
+ }
- foo[23] = bar[n +[x]];
+ JSString_to_char(u16_txt, txt, length);
- return JS_TRUE;
-}
+ LOG(("content %p parser %p writing %s",
+ document->htmlc, document->htmlc->parser, txt));
+ if (document->htmlc->parser != NULL) {
+ dom_hubbub_parser_insert_chunk(document->htmlc->parser, (uint8_t *)txt, length);
+ }
+ JSAPI_SET_RVAL(cx, vp, JSVAL_VOID);
-]]];
+ return JS_TRUE;
+ %}
binding document {
- type js_libdom; /* the binding type */
+ type js_libdom; /* the binding type */
- /* parameters to constructor value stored in private
- * context structure.
- */
- private "dom_document *node";
- private "struct html_content *htmlc";
+ /* 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 */
-};
+ interface Document; /* Web IDL interface to generate */
+}