Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/5496a604310b65db0513c...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/5496a604310b65db0513c06...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/5496a604310b65db0513c063e...
The branch, vince/nsgenbind has been updated
via 5496a604310b65db0513c063ed171f0168baee28 (commit)
from ede48d60748101e9795050955d934ea6e329d4c5 (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/5496a604310b65db051...
commit 5496a604310b65db0513c063ed171f0168baee28
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
console interface from IDL
diff --git a/Makefile.sources.javascript b/Makefile.sources.javascript
index 6268548..f5c49f8 100644
--- a/Makefile.sources.javascript
+++ b/Makefile.sources.javascript
@@ -13,6 +13,7 @@ S_JSAPI_BINDING:=
JSAPI_BINDING_htmldocument := javascript/jsapi/bindings/htmldocument.bnd
JSAPI_BINDING_window := javascript/jsapi/bindings/window.bnd
JSAPI_BINDING_navigator := javascript/jsapi/bindings/navigator.bnd
+JSAPI_BINDING_console := javascript/jsapi/bindings/console.bnd
# 1: input file
# 2: output file
@@ -30,8 +31,8 @@ endef
# Javascript sources
ifeq ($(NETSURF_USE_JS),YES)
-S_JSAPI = console.c htmlelement.c
-#htmldocument.c window.c navigator.c
+S_JSAPI = htmlelement.c
+#htmldocument.c window.c navigator.c console.c
S_JAVASCRIPT += content.c jsapi.c $(addprefix jsapi/,$(S_JSAPI))
diff --git a/javascript/WebIDL/console.idl b/javascript/WebIDL/console.idl
new file mode 100644
index 0000000..309b976
--- /dev/null
+++ b/javascript/WebIDL/console.idl
@@ -0,0 +1,20 @@
+// de facto set of features for console object
+//
https://developer.mozilla.org/en-US/docs/DOM/console
+//
http://msdn.microsoft.com/en-us/library/dd565625%28v=vs.85%29.aspx#consol...
+// 31st October
+// Yay for non-standard standards
+
+interface Console {
+ void debug(DOMString msg, Substitition... subst);
+ void dir(JSObject object);
+ void error(DOMString msg, Substitition... subst);
+ void group();
+ void groupCollapsed();
+ void groupEnd();
+ void info(DOMString msg, Substitition... subst);
+ void log(DOMString msg, Substitition... subst);
+ void time(DOMString timerName);
+ void timeEnd(DOMString timerName);
+ void trace();
+ void warn(DOMString msg, Substitition... subst);
+};
\ No newline at end of file
diff --git a/javascript/jsapi/binding.h b/javascript/jsapi/binding.h
index 2d88c00..80340a5 100644
--- a/javascript/jsapi/binding.h
+++ b/javascript/jsapi/binding.h
@@ -57,13 +57,14 @@ JSObject *jsapi_new_Document(JSContext *cx,
dom_document *node,
struct html_content *htmlc);
+JSObject *jsapi_InitClass_Console(JSContext *cx, JSObject *parent);
/** Create a new javascript console object
*
* @param cx The javascript context.
* @param parent The parent object, usually a global window object
* @return new javascript object or NULL on error
*/
-JSObject *jsapi_new_Console(JSContext *cx, JSObject *parent);
+JSObject *jsapi_new_Console(JSContext *cx, JSObject *prototype, JSObject *parent);
JSObject *jsapi_InitClass_Navigator(JSContext *cx, JSObject *parent);
diff --git a/javascript/jsapi/bindings/console.bnd
b/javascript/jsapi/bindings/console.bnd
new file mode 100644
index 0000000..6aef9dc
--- /dev/null
+++ b/javascript/jsapi/bindings/console.bnd
@@ -0,0 +1,59 @@
+/* Binding to generate Console interface
+ *
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ *
http://www.opensource.org/licenses/mit-license
+ */
+
+webidlfile "console.idl";
+
+hdrcomment "Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>";
+hdrcomment "This file is part of NetSurf,
http://www.netsurf-browser.org/";
+hdrcomment "Released under the terms of the MIT License,";
+hdrcomment "
http://www.opensource.org/licenses/mit-license";
+
+preamble %{
+
+#include "utils/config.h"
+#include "utils/log.h"
+
+#include "javascript/jsapi.h"
+#include "javascript/jsapi/binding.h"
+
+%}
+
+binding navigator {
+ type js_libdom; /* the binding type */
+
+ interface Console; /* Web IDL interface to generate */
+
+ /* private members:
+ * - stored in private context structure.
+ * - passed as parameters to constructor and stored automatically.
+ * - are *not* considered for property getters/setters.
+ *
+ * internal members:
+ * - value stored in private context structure
+ * - not passed to constructor
+ * - must be instantiated by constructor
+ * - are considered for property getters/setters.
+ */
+ internal "void *" gui_console;
+}
+
+operation log %{
+ unsigned int argloop;
+ JSString *jsstr;
+ unsigned long jsstrlen;
+ char *txt;
+
+ for (argloop = 0; argloop < argc; argloop++) {
+ jsstr = JS_ValueToString(cx, argv[argloop]);
+
+ JSString_to_char(jsstr, txt, jsstrlen);
+ LOG(("%s", txt));
+ }
+%}
diff --git a/javascript/jsapi/bindings/window.bnd b/javascript/jsapi/bindings/window.bnd
index 9d4a844..ba2db52 100644
--- a/javascript/jsapi/bindings/window.bnd
+++ b/javascript/jsapi/bindings/window.bnd
@@ -84,6 +84,12 @@ api init %{
if (user_proto == NULL) {
return NULL;
}
+
+ user_proto = jsapi_InitClass_Console(cx, prototype);
+ if (user_proto == NULL) {
+ return NULL;
+ }
+
%}
api new %{
@@ -112,7 +118,7 @@ api new %{
/** @todo forms, history, location */
- private->console = jsapi_new_Console(cx, newobject);
+ private->console = jsapi_new_Console(cx, NULL, newobject);
if (private->console == NULL) {
free(private);
return NULL;
-----------------------------------------------------------------------
Summary of changes:
Makefile.sources.javascript | 5 ++-
javascript/WebIDL/console.idl | 20 +++++++++++
javascript/jsapi/binding.h | 3 +-
javascript/jsapi/bindings/console.bnd | 59 +++++++++++++++++++++++++++++++++
javascript/jsapi/bindings/window.bnd | 8 ++++-
5 files changed, 91 insertions(+), 4 deletions(-)
create mode 100644 javascript/WebIDL/console.idl
create mode 100644 javascript/jsapi/bindings/console.bnd
diff --git a/Makefile.sources.javascript b/Makefile.sources.javascript
index 6268548..f5c49f8 100644
--- a/Makefile.sources.javascript
+++ b/Makefile.sources.javascript
@@ -13,6 +13,7 @@ S_JSAPI_BINDING:=
JSAPI_BINDING_htmldocument := javascript/jsapi/bindings/htmldocument.bnd
JSAPI_BINDING_window := javascript/jsapi/bindings/window.bnd
JSAPI_BINDING_navigator := javascript/jsapi/bindings/navigator.bnd
+JSAPI_BINDING_console := javascript/jsapi/bindings/console.bnd
# 1: input file
# 2: output file
@@ -30,8 +31,8 @@ endef
# Javascript sources
ifeq ($(NETSURF_USE_JS),YES)
-S_JSAPI = console.c htmlelement.c
-#htmldocument.c window.c navigator.c
+S_JSAPI = htmlelement.c
+#htmldocument.c window.c navigator.c console.c
S_JAVASCRIPT += content.c jsapi.c $(addprefix jsapi/,$(S_JSAPI))
diff --git a/javascript/WebIDL/console.idl b/javascript/WebIDL/console.idl
new file mode 100644
index 0000000..309b976
--- /dev/null
+++ b/javascript/WebIDL/console.idl
@@ -0,0 +1,20 @@
+// de facto set of features for console object
+//
https://developer.mozilla.org/en-US/docs/DOM/console
+//
http://msdn.microsoft.com/en-us/library/dd565625%28v=vs.85%29.aspx#consol...
+// 31st October
+// Yay for non-standard standards
+
+interface Console {
+ void debug(DOMString msg, Substitition... subst);
+ void dir(JSObject object);
+ void error(DOMString msg, Substitition... subst);
+ void group();
+ void groupCollapsed();
+ void groupEnd();
+ void info(DOMString msg, Substitition... subst);
+ void log(DOMString msg, Substitition... subst);
+ void time(DOMString timerName);
+ void timeEnd(DOMString timerName);
+ void trace();
+ void warn(DOMString msg, Substitition... subst);
+};
\ No newline at end of file
diff --git a/javascript/jsapi/binding.h b/javascript/jsapi/binding.h
index 2d88c00..80340a5 100644
--- a/javascript/jsapi/binding.h
+++ b/javascript/jsapi/binding.h
@@ -57,13 +57,14 @@ JSObject *jsapi_new_Document(JSContext *cx,
dom_document *node,
struct html_content *htmlc);
+JSObject *jsapi_InitClass_Console(JSContext *cx, JSObject *parent);
/** Create a new javascript console object
*
* @param cx The javascript context.
* @param parent The parent object, usually a global window object
* @return new javascript object or NULL on error
*/
-JSObject *jsapi_new_Console(JSContext *cx, JSObject *parent);
+JSObject *jsapi_new_Console(JSContext *cx, JSObject *prototype, JSObject *parent);
JSObject *jsapi_InitClass_Navigator(JSContext *cx, JSObject *parent);
diff --git a/javascript/jsapi/bindings/console.bnd
b/javascript/jsapi/bindings/console.bnd
new file mode 100644
index 0000000..6aef9dc
--- /dev/null
+++ b/javascript/jsapi/bindings/console.bnd
@@ -0,0 +1,59 @@
+/* Binding to generate Console interface
+ *
+ * Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf,
http://www.netsurf-browser.org/
+ *
+ * Released under the terms of the MIT License,
+ *
http://www.opensource.org/licenses/mit-license
+ */
+
+webidlfile "console.idl";
+
+hdrcomment "Copyright 2012 Vincent Sanders <vince(a)netsurf-browser.org>";
+hdrcomment "This file is part of NetSurf,
http://www.netsurf-browser.org/";
+hdrcomment "Released under the terms of the MIT License,";
+hdrcomment "
http://www.opensource.org/licenses/mit-license";
+
+preamble %{
+
+#include "utils/config.h"
+#include "utils/log.h"
+
+#include "javascript/jsapi.h"
+#include "javascript/jsapi/binding.h"
+
+%}
+
+binding navigator {
+ type js_libdom; /* the binding type */
+
+ interface Console; /* Web IDL interface to generate */
+
+ /* private members:
+ * - stored in private context structure.
+ * - passed as parameters to constructor and stored automatically.
+ * - are *not* considered for property getters/setters.
+ *
+ * internal members:
+ * - value stored in private context structure
+ * - not passed to constructor
+ * - must be instantiated by constructor
+ * - are considered for property getters/setters.
+ */
+ internal "void *" gui_console;
+}
+
+operation log %{
+ unsigned int argloop;
+ JSString *jsstr;
+ unsigned long jsstrlen;
+ char *txt;
+
+ for (argloop = 0; argloop < argc; argloop++) {
+ jsstr = JS_ValueToString(cx, argv[argloop]);
+
+ JSString_to_char(jsstr, txt, jsstrlen);
+ LOG(("%s", txt));
+ }
+%}
diff --git a/javascript/jsapi/bindings/window.bnd b/javascript/jsapi/bindings/window.bnd
index 9d4a844..ba2db52 100644
--- a/javascript/jsapi/bindings/window.bnd
+++ b/javascript/jsapi/bindings/window.bnd
@@ -84,6 +84,12 @@ api init %{
if (user_proto == NULL) {
return NULL;
}
+
+ user_proto = jsapi_InitClass_Console(cx, prototype);
+ if (user_proto == NULL) {
+ return NULL;
+ }
+
%}
api new %{
@@ -112,7 +118,7 @@ api new %{
/** @todo forms, history, location */
- private->console = jsapi_new_Console(cx, newobject);
+ private->console = jsapi_new_Console(cx, NULL, newobject);
if (private->console == NULL) {
free(private);
return NULL;
--
NetSurf Browser