1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-29 03:17:53 -04:00

[viewer] action.cpp -> action.c

This commit is contained in:
Witold Filipczyk 2023-11-25 14:13:10 +01:00
parent 20aeb1cc0e
commit 009d09ba52
8 changed files with 33 additions and 22 deletions

View File

@ -10,11 +10,11 @@ SUBDIRS-$(CONFIG_QUICKJS) += quickjs
SUBDIRS-$(CONFIG_ECMASCRIPT_SMJS) += spidermonkey SUBDIRS-$(CONFIG_ECMASCRIPT_SMJS) += spidermonkey
OBJS-$(CONFIG_ECMASCRIPT_SMJS) += ecmascript.obj localstorage-db.obj spidermonkey.obj timer.obj OBJS-$(CONFIG_ECMASCRIPT_SMJS) += ecmascript.obj ecmascript-c.obj localstorage-db.obj spidermonkey.obj timer.obj
OBJS-$(CONFIG_MUJS) += ecmascript.obj localstorage-db.obj mujs.obj timer.obj OBJS-$(CONFIG_MUJS) += ecmascript.obj ecmascript-c.obj localstorage-db.obj mujs.obj timer.obj
OBJS-$(CONFIG_QUICKJS) += ecmascript.obj localstorage-db.obj quickjs.obj timer.obj OBJS-$(CONFIG_QUICKJS) += ecmascript.obj ecmascript-c.obj localstorage-db.obj quickjs.obj timer.obj
ifeq ($(CONFIG_ECMASCRIPT_SMJS), yes) ifeq ($(CONFIG_ECMASCRIPT_SMJS), yes)
CONFIG_ANY_SPIDERMONKEY = yes CONFIG_ANY_SPIDERMONKEY = yes

View File

@ -4,12 +4,33 @@
#include "config.h" #include "config.h"
#endif #endif
#include "elinks.h"
#include "dialogs/status.h"
#include "ecmascript/ecmascript-c.h" #include "ecmascript/ecmascript-c.h"
#include "intl/libintl.h"
#include "session/session.h"
#include "util/memory.h"
#include "util/string.h"
extern int interpreter_count; extern int interpreter_count;
extern int ecmascript_enabled;
int int
ecmascript_get_interpreter_count(void) ecmascript_get_interpreter_count(void)
{ {
return interpreter_count; return interpreter_count;
} }
void
toggle_ecmascript(struct session *ses)
{
ecmascript_enabled = !ecmascript_enabled;
if (ecmascript_enabled) {
mem_free_set(&ses->status.window_status, stracpy(_("Ecmascript enabled", ses->tab->term)));
} else {
mem_free_set(&ses->status.window_status, stracpy(_("Ecmascript disabled", ses->tab->term)));
}
print_screen_status(ses);
}

View File

@ -5,7 +5,10 @@
extern "C" { extern "C" {
#endif #endif
struct session;
int ecmascript_get_interpreter_count(void); int ecmascript_get_interpreter_count(void);
void toggle_ecmascript(struct session *ses);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -160,20 +160,7 @@ read_url_list(void)
} }
} }
static int ecmascript_enabled; int ecmascript_enabled;
void
toggle_ecmascript(struct session *ses)
{
ecmascript_enabled = !ecmascript_enabled;
if (ecmascript_enabled) {
mem_free_set(&ses->status.window_status, stracpy(_("Ecmascript enabled", ses->tab->term)));
} else {
mem_free_set(&ses->status.window_status, stracpy(_("Ecmascript disabled", ses->tab->term)));
}
print_screen_status(ses);
}
int int
get_ecmascript_enable(struct ecmascript_interpreter *interpreter) get_ecmascript_enable(struct ecmascript_interpreter *interpreter)

View File

@ -17,12 +17,12 @@ if CONFIG_ANY_SPIDERMONKEY
endif endif
if conf_data.get('CONFIG_MUJS') if conf_data.get('CONFIG_MUJS')
srcs += files('ecmascript.cpp', 'localstorage-db.cpp', 'mujs.cpp', 'timer.cpp') srcs += files('ecmascript.cpp', 'ecmascript-c.cpp', 'localstorage-db.cpp', 'mujs.cpp', 'timer.cpp')
subdir('mujs') subdir('mujs')
endif endif
if conf_data.get('CONFIG_QUICKJS') if conf_data.get('CONFIG_QUICKJS')
srcs += files('ecmascript.cpp', 'localstorage-db.cpp', 'quickjs.cpp', 'timer.cpp') srcs += files('ecmascript.cpp', 'ecmascript-c.cpp', 'localstorage-db.cpp', 'quickjs.cpp', 'timer.cpp')
subdir('quickjs') subdir('quickjs')
endif endif

View File

@ -2,6 +2,6 @@ top_builddir=../..
include $(top_builddir)/Makefile.config include $(top_builddir)/Makefile.config
SUBDIRS = dump text SUBDIRS = dump text
OBJS = action.obj timer.o viewer.o OBJS = action.o timer.o viewer.o
include $(top_srcdir)/Makefile.lib include $(top_srcdir)/Makefile.lib

View File

@ -26,7 +26,7 @@
#include "document/document.h" #include "document/document.h"
#include "document/view.h" #include "document/view.h"
#ifdef CONFIG_ECMASCRIPT #ifdef CONFIG_ECMASCRIPT
#include "ecmascript/ecmascript.h" #include "ecmascript/ecmascript-c.h"
#endif #endif
#include "formhist/dialogs.h" #include "formhist/dialogs.h"
#include "globhist/dialogs.h" #include "globhist/dialogs.h"

View File

@ -1,3 +1,3 @@
subdir('dump') subdir('dump')
subdir('text') subdir('text')
srcs += files('action.cpp', 'timer.c', 'viewer.c') srcs += files('action.c', 'timer.c', 'viewer.c')