From b8126ea9de737e2d8f7a544b3b54be202fd23126 Mon Sep 17 00:00:00 2001 From: Date: Mon, 16 Jan 2006 14:14:14 +0100 Subject: [PATCH] Introduced ecmascript submodules --- src/ecmascript/ecmascript.c | 18 +++++++++++++++++- src/ecmascript/see.c | 10 ++++++++++ src/ecmascript/see.h | 1 + src/ecmascript/spidermonkey.c | 10 ++++++++++ src/ecmascript/spidermonkey.h | 1 + 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index 718786ff6..8948eab08 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -24,6 +24,12 @@ #include "viewer/text/form.h" /* <-ecmascript_reset_state() */ #include "viewer/text/vs.h" +#ifdef CONFIG_ECMASCRIPT_SEE +#include "ecmascript/see.h" +#elif defined(CONFIG_SPIDERMONKEY) +#include "ecmascript/spidermonkey.h" +#endif + /* TODO: We should have some kind of ACL for the scripts - i.e. ability to * disallow the scripts to open new windows (or so that the windows are always @@ -133,11 +139,21 @@ ecmascript_timeout_dialog(struct terminal *term, int max_exec_time) } +static struct module *ecmascript_modules[] = { +#ifdef CONFIG_ECMASCRIPT_SEE + &see_module, +#elif defined(CONFIG_SPIDERMONKEY) + &spidermonkey_module, +#endif + NULL, +}; + + struct module ecmascript_module = struct_module( /* name: */ N_("ECMAScript"), /* options: */ ecmascript_options, /* events: */ NULL, - /* submodules: */ NULL, + /* submodules: */ ecmascript_modules, /* data: */ NULL, /* init: */ ecmascript_init, /* done: */ ecmascript_done diff --git a/src/ecmascript/see.c b/src/ecmascript/see.c index 6f203b403..4f353a79d 100644 --- a/src/ecmascript/see.c +++ b/src/ecmascript/see.c @@ -240,3 +240,13 @@ see_eval_boolback(struct ecmascript_interpreter *interpreter, } return res; } + +struct module see_module = struct_module( + /* name: */ "SEE", + /* options: */ NULL, + /* events: */ NULL, + /* submodules: */ NULL, + /* data: */ NULL, + /* init: */ NULL, + /* done: */ NULL +); diff --git a/src/ecmascript/see.h b/src/ecmascript/see.h index 206be2cb8..8d75c6e28 100644 --- a/src/ecmascript/see.h +++ b/src/ecmascript/see.h @@ -14,4 +14,5 @@ void see_eval(struct ecmascript_interpreter *interpreter, struct string *code); unsigned char *see_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code); int see_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code); +extern struct module see_module; #endif diff --git a/src/ecmascript/spidermonkey.c b/src/ecmascript/spidermonkey.c index 0f21054fe..00ca51e92 100644 --- a/src/ecmascript/spidermonkey.c +++ b/src/ecmascript/spidermonkey.c @@ -376,3 +376,13 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, return jsval_to_boolean(ctx, &rval); } + +struct module spidermonkey_module = struct_module( + /* name: */ "SpiderMonkey", + /* options: */ NULL, + /* events: */ NULL, + /* submodules: */ NULL, + /* data: */ NULL, + /* init: */ NULL, + /* done: */ NULL +); diff --git a/src/ecmascript/spidermonkey.h b/src/ecmascript/spidermonkey.h index a0241cd8b..b9f2b6352 100644 --- a/src/ecmascript/spidermonkey.h +++ b/src/ecmascript/spidermonkey.h @@ -14,4 +14,5 @@ void spidermonkey_eval(struct ecmascript_interpreter *interpreter, struct string unsigned char *spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code); int spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code); +extern struct module spidermonkey_module; #endif