mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Add the "elinks" object.
This commit is contained in:
parent
acb2bb80be
commit
6e0d4374c1
@ -3,6 +3,6 @@ include $(top_builddir)/Makefile.config
|
||||
|
||||
INCLUDES += $(SPIDERMONKEY_CFLAGS)
|
||||
|
||||
OBJS = smjs.o core.o
|
||||
OBJS = smjs.o core.o elinks_object.o
|
||||
|
||||
include $(top_srcdir)/Makefile.lib
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "main/module.h"
|
||||
#include "scripting/scripting.h"
|
||||
#include "scripting/smjs/core.h"
|
||||
#include "scripting/smjs/elinks_object.h"
|
||||
#include "scripting/smjs/smjs.h"
|
||||
#include "util/string.h"
|
||||
|
||||
@ -17,6 +18,7 @@
|
||||
#define SMJS_HOOKS_FILENAME "hooks.js"
|
||||
|
||||
JSContext *smjs_ctx;
|
||||
JSObject *smjs_elinks_object;
|
||||
struct session *smjs_ses;
|
||||
|
||||
|
||||
@ -88,6 +90,8 @@ init_smjs(struct module *module)
|
||||
if (!global_object) return;
|
||||
|
||||
JS_InitStandardClasses(smjs_ctx, global_object);
|
||||
|
||||
smjs_elinks_object = smjs_get_elinks_object(global_object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -8,6 +8,7 @@ struct session;
|
||||
struct string;
|
||||
|
||||
extern JSContext *smjs_ctx;
|
||||
JSObject *smjs_elinks_object;
|
||||
struct session *smjs_ses;
|
||||
|
||||
void alert_smjs_error(unsigned char *msg);
|
||||
|
29
src/scripting/smjs/elinks_object.c
Normal file
29
src/scripting/smjs/elinks_object.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* The "elinks" object */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include "scripting/scripting.h"
|
||||
#include "scripting/smjs/core.h"
|
||||
#include "scripting/smjs/elinks_object.h"
|
||||
|
||||
|
||||
static const JSClass elinks_class = {
|
||||
"elinks",
|
||||
0,
|
||||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
JSObject *
|
||||
smjs_get_elinks_object(JSObject *global_object)
|
||||
{
|
||||
return JS_InitClass(smjs_ctx, global_object, NULL,
|
||||
(JSClass *) &elinks_class, NULL, 0, NULL,
|
||||
NULL, NULL, NULL);
|
||||
}
|
8
src/scripting/smjs/elinks_object.h
Normal file
8
src/scripting/smjs/elinks_object.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef EL__SCRIPTING_SMJS_ELINKS_OBJECT_H
|
||||
#define EL__SCRIPTING_SMJS_ELINKS_OBJECT_H
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
|
||||
JSObject *smjs_get_elinks_object(JSObject *global_object);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user