Bug 997: Fix unlikely stack corruption in get_pasv_socket.
[elinks/elinks-j605.git] / src / scripting / scripting.c
blobe550bc247006c9c65b5d8061009af54fd6959903
1 /* General scripting system functionality */
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif
7 #include "elinks.h"
9 #include "intl/gettext/libintl.h"
10 #include "main/module.h"
11 #include "scripting/scripting.h"
12 #include "session/session.h"
13 #include "terminal/terminal.h"
14 #include "terminal/window.h"
17 /* Backends dynamic area: */
19 #include "scripting/guile/guile.h"
20 #include "scripting/lua/lua.h"
21 #include "scripting/perl/perl.h"
22 #include "scripting/python/python.h"
23 #include "scripting/ruby/ruby.h"
24 #include "scripting/smjs/smjs.h"
27 /* Error reporting. */
29 #if defined(CONFIG_RUBY) || defined(CONFIG_SEE) || defined(CONFIG_SM_SCRIPTING)
30 void
31 report_scripting_error(struct module *module, struct session *ses,
32 unsigned char *msg)
34 struct terminal *term;
35 struct string string;
37 if (!ses) {
38 if (list_empty(terminals)) {
39 usrerror("[%s error] %s", module->name, msg);
40 return;
43 term = terminals.next;
45 } else {
46 term = ses->tab->term;
49 if (!init_string(&string))
50 return;
52 add_format_to_string(&string,
53 _("An error occurred while running a %s script", term),
54 module->name);
56 add_format_to_string(&string, ":\n\n%s", msg);
58 info_box(term, MSGBOX_NO_TEXT_INTL | MSGBOX_FREE_TEXT,
59 N_("Browser scripting error"), ALIGN_LEFT, string.source);
61 #endif
64 static struct module *scripting_modules[] = {
65 #ifdef CONFIG_LUA
66 &lua_scripting_module,
67 #endif
68 #ifdef CONFIG_GUILE
69 &guile_scripting_module,
70 #endif
71 #ifdef CONFIG_PERL
72 &perl_scripting_module,
73 #endif
74 #ifdef CONFIG_PYTHON
75 &python_scripting_module,
76 #endif
77 #ifdef CONFIG_RUBY
78 &ruby_scripting_module,
79 #endif
80 #ifdef CONFIG_SM_SCRIPTING
81 &smjs_scripting_module,
82 #endif
83 NULL,
86 struct module scripting_module = struct_module(
87 /* name: */ N_("Scripting"),
88 /* options: */ NULL,
89 /* events: */ NULL,
90 /* submodules: */ scripting_modules,
91 /* data: */ NULL,
92 /* init: */ NULL,
93 /* done: */ NULL