1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

Merge with git+ssh://pasky.or.cz/srv/git/elinks.git

This commit is contained in:
Miciah Dashiel Butler Masters 2005-11-01 19:32:31 +00:00 committed by Miciah Dashiel Butler Masters
commit 37d43ef7c6
10 changed files with 1744 additions and 1705 deletions

View File

@ -1,7 +1,8 @@
top_builddir=.
-include $(top_builddir)/Makefile.config
SUBDIRS = doc po src
SUBDIRS = doc src
SUBDIRS-$(CONFIG_NLS) += po
CLEAN = features.log
all-recursive: config.h

View File

@ -42,6 +42,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
host = @host@
ASCIIDOC = @ASCIIDOC@
AWK = @AWK@
CATALOGS = @CATALOGS@

View File

@ -94,9 +94,7 @@ check-po:
#
# Use *-local targets to place and remove .gmo files.
install-local: install-local-$(CONFIG_NLS)
install-local-no:
install-local-yes: all-local
install-local: all-local
$(MKINSTALLDIRS) $(DESTDIR)$(localedir)
@$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \
$(MKINSTALLDIRS) $(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES; \

3009
po/fr.po

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ static void free_options_tree(struct list_head *, int recursive);
/* Detect ending '.' (and some others) in options captions.
* It will emit a message in debug mode only. --Zas */
#define bad_punct(c) (c != ')' && !isquote(c) && ispunct(c))
#define bad_punct(c) (c != ')' && c!= '>' && !isquote(c) && ispunct(c))
static void
check_caption(unsigned char *caption)

View File

@ -27,7 +27,7 @@ OBJS = \
# $(builddir)/charset.alias: $(srcdir)/config.charset
$(builddir)/charset.alias: $(srcdir)/config.charset
$(SHELL) $(srcdir)/config.charset '@host@' > $@.new
$(SHELL) $(srcdir)/config.charset '$(host)' > $@.new
mv $@.new $@
# FIXME: Building plural.c from plural.y on the fly doesn't work
@ -41,7 +41,7 @@ plural.c: plural.y
rm -f $*.h
install-local: $(builddir)/charset.alias all
@if test '@USE_INCLUDED_LIBINTL@' = yes; then \
@if test '$(CONFIG_NLS)' = yes; then \
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
dest=$(DESTDIR)$(libdir)/charset.alias; \
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
@ -50,7 +50,7 @@ install-local: $(builddir)/charset.alias all
$(INSTALL_DATA) $$temp $$dest; \
rm -f $$temp; \
else \
if test @GLIBC21@ = no; then \
if test $(GLIBC21) = no; then \
$(MKINSTALLDIRS) $(DESTDIR)$(libdir); \
orig=charset.alias; \
sed -f ref-add.sed $$orig > $$temp; \
@ -72,7 +72,7 @@ install-local: $(builddir)/charset.alias all
fi
uninstall-local:
@if test '@USE_INCLUDED_LIBINTL@' = yes; then \
@if test '$(CONFIG_NLS)' = yes; then \
if test -f $(DESTDIR)$(libdir)/charset.alias; then \
temp=$(DESTDIR)$(libdir)/t-charset.alias; \
dest=$(DESTDIR)$(libdir)/charset.alias; \

View File

@ -3,6 +3,6 @@ include $(top_builddir)/Makefile.config
INCLUDES += $(SEE_CFLAGS)
OBJS = see.o hooks.o core.o
OBJS = see.o core.o hooks.o interface.o
include $(top_srcdir)/Makefile.lib

View File

@ -1,4 +1,4 @@
/* Ruby interface (scripting engine) */
/* SEE interface (scripting engine) */
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -9,18 +9,14 @@
#include "elinks.h"
#include "bfu/dialog.h"
#include "config/conf.h"
#include "config/home.h"
#include "config/options.h"
#include "config/opttypes.h"
#include "intl/gettext/libintl.h"
#include "main/module.h"
#include "scripting/scripting.h"
#include "scripting/see/core.h"
#include "scripting/see/interface.h"
#include "scripting/see/see.h"
#include "session/session.h"
#include "util/error.h"
#include "util/file.h"
#include "util/string.h"
@ -55,195 +51,6 @@ alert_see_error(struct session *ses, unsigned char *msg)
}
/* The ELinks module: */
static void
navigator_preference(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
struct SEE_value v;
struct string opt_name;
struct option *opt;
SEE_SET_UNDEFINED(res);
if (argc != 1 && argc != 2) return;
SEE_ToString(see, argv[0], &v);
if (!convert_see_string(&opt_name, v.u.string))
return;
opt = get_opt_rec(config_options, opt_name.source);
done_string(&opt_name);
/* FIXME: Alert? */
if (!opt) return;
/* Set option */
switch (opt->type) {
case OPT_BOOL:
{
long value = opt->value.number;
if (argc == 1) {
SEE_SET_BOOLEAN(res, value);
return;
}
SEE_ToBoolean(see, argv[1], &v);
value = !!v.u.boolean;
opt->value.number = value;
break;
}
case OPT_INT:
case OPT_LONG:
{
long value;
if (argc == 1) {
SEE_SET_NUMBER(res, opt->value.number);
return;
}
SEE_ToInteger(see, argv[1], &v);
value = SEE_ToInt32(see, &v);
if (opt->min <= value && value <= opt->max)
option_types[opt->type].set(opt, (unsigned char *) (&value));
break;
}
case OPT_STRING:
case OPT_CODEPAGE:
case OPT_LANGUAGE:
case OPT_COLOR:
{
struct string opt_value;
if (argc == 1) {
SEE_SET_STRING(res, SEE_string_sprintf(see, opt->value.string));
return;
}
SEE_ToString(see, argv[1], &v);
if (!convert_see_string(&opt_value, v.u.string))
return;
option_types[opt->type].set(opt, opt_value.source);
done_string(&opt_value);
break;
}
default:
return;
}
if (argc == 2) {
opt->flags |= OPT_TOUCHED;
call_change_hooks(see_ses, opt, opt);
}
}
static void
navigator_save_preferences(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
if (see_ses)
write_config(see_ses->tab->term);
}
static void
navigator_alert(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
struct SEE_value v;
struct string string;
struct terminal *term;
SEE_SET_UNDEFINED(res);
if (!argc) return;
SEE_ToString(see, argv[0], &v);
if (!convert_see_string(&string, v.u.string))
return;
if (!see_ses && list_empty(terminals)) {
usrerror("[SEE] %s", string.source);
done_string(&string);
return;
}
term = see_ses ? see_ses->tab->term : terminals.next;
info_box(term, MSGBOX_NO_TEXT_INTL | MSGBOX_FREE_TEXT,
N_("SEE Message"), ALIGN_LEFT, string.source);
}
#if DATADRIVEN
_IDEA
struct object_info browser_object[] = {
"ELinks", SEE_ATTR_READONLY,
{ /* Properties: */
{ "version", SEE_STRING, VERSION, SEE_ATTR_READONLY },
{ "home", SEE_STRING, NULL, SEE_ATTR_READONLY },
},
{ /* Methods: (as name, handler, args) */
{ "write", elinks_see_write, SEE_ATTR_READONLY },
{ NULL }
},
};
struct object_info *see_
#endif
static void
init_see_environment(struct SEE_interpreter *see)
{
unsigned char *home;
struct SEE_object *obj, *navigator;
struct SEE_value value;
struct SEE_string *name;
/* TODO: Initialize strings.
SEE_intern_global(s_print = &S_print);
* */
/* Create the navigator browser object. Add it to the global space */
navigator = SEE_Object_new(see);
SEE_SET_OBJECT(&value, navigator);
name = SEE_string_sprintf(see, "navigator");
SEE_OBJECT_PUT(see, see->Global, name, &value, SEE_ATTR_READONLY);
/* Create a string and attach as 'ELinks.version' */
SEE_SET_STRING(&value, SEE_string_sprintf(see, VERSION));
name = SEE_string_sprintf(see, "appVersion");
SEE_OBJECT_PUT(see, navigator, name, &value, SEE_ATTR_READONLY);
/* Create a string and attach as 'ELinks.home' */
home = elinks_home ? elinks_home : (unsigned char *) CONFDIR;
SEE_SET_STRING(&value, SEE_string_sprintf(see, home));
name = SEE_string_sprintf(see, "appHome");
SEE_OBJECT_PUT(see, navigator, name, &value, SEE_ATTR_READONLY);
/* Create an 'alert' method and attach to the browser object. */
/* FIXME: The browser object and the Global object should be identical. */
name = SEE_string_sprintf(see, "alert");
obj = SEE_cfunction_make(see, navigator_alert, name, 1);
SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, navigator, name, &value, 0);
SEE_OBJECT_PUT(see, see->Global, name, &value, 0);
name = SEE_string_sprintf(see, "preference");
obj = SEE_cfunction_make(see, navigator_preference, name, 1);
SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, navigator, name, &value, 0);
name = SEE_string_sprintf(see, "savePreferences");
obj = SEE_cfunction_make(see, navigator_save_preferences, name, 1);
SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, navigator, name, &value, 0);
}
static void
see_abort_handler(struct SEE_interpreter *see, const char *msg)
{
@ -270,8 +77,8 @@ init_see(struct module *module)
/* Initialise an interpreter */
SEE_interpreter_init(see);
/* Set up the ELinks module interface. */
init_see_environment(see);
/* Set up the ELinks interface. */
init_see_interface(see);
if (elinks_home) {
path = straconcat(elinks_home, SEE_HOOKS_FILENAME, NULL);

View File

@ -0,0 +1,209 @@
/* The ELinks SEE interface: */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <see/see.h>
#include "elinks.h"
#include "bfu/dialog.h"
#include "config/conf.h"
#include "config/home.h"
#include "config/options.h"
#include "config/opttypes.h"
#include "intl/gettext/libintl.h"
#include "main/module.h"
#include "scripting/scripting.h"
#include "scripting/see/core.h"
#include "scripting/see/see.h"
#include "session/session.h"
#include "util/error.h"
#include "util/file.h"
#include "util/string.h"
static void
navigator_preference(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
struct SEE_value v;
struct string opt_name;
struct option *opt;
SEE_SET_UNDEFINED(res);
if (argc != 1 && argc != 2) return;
SEE_ToString(see, argv[0], &v);
if (!convert_see_string(&opt_name, v.u.string))
return;
opt = get_opt_rec(config_options, opt_name.source);
done_string(&opt_name);
/* FIXME: Alert? */
if (!opt) return;
/* Set option */
switch (opt->type) {
case OPT_BOOL:
{
long value = opt->value.number;
if (argc == 1) {
SEE_SET_BOOLEAN(res, value);
return;
}
SEE_ToBoolean(see, argv[1], &v);
value = !!v.u.boolean;
opt->value.number = value;
break;
}
case OPT_INT:
case OPT_LONG:
{
long value;
if (argc == 1) {
SEE_SET_NUMBER(res, opt->value.number);
return;
}
SEE_ToInteger(see, argv[1], &v);
value = SEE_ToInt32(see, &v);
if (opt->min <= value && value <= opt->max)
option_types[opt->type].set(opt, (unsigned char *) (&value));
break;
}
case OPT_STRING:
case OPT_CODEPAGE:
case OPT_LANGUAGE:
case OPT_COLOR:
{
struct string opt_value;
if (argc == 1) {
SEE_SET_STRING(res, SEE_string_sprintf(see, opt->value.string));
return;
}
SEE_ToString(see, argv[1], &v);
if (!convert_see_string(&opt_value, v.u.string))
return;
option_types[opt->type].set(opt, opt_value.source);
done_string(&opt_value);
break;
}
default:
return;
}
if (argc == 2) {
opt->flags |= OPT_TOUCHED;
call_change_hooks(see_ses, opt, opt);
}
}
static void
navigator_save_preferences(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
if (see_ses)
write_config(see_ses->tab->term);
}
static void
navigator_alert(struct SEE_interpreter *see, struct SEE_object *self,
struct SEE_object *thisobj, int argc, struct SEE_value **argv,
struct SEE_value *res)
{
struct SEE_value v;
struct string string;
struct terminal *term;
SEE_SET_UNDEFINED(res);
if (!argc) return;
SEE_ToString(see, argv[0], &v);
if (!convert_see_string(&string, v.u.string))
return;
if (!see_ses && list_empty(terminals)) {
usrerror("[SEE] %s", string.source);
done_string(&string);
return;
}
term = see_ses ? see_ses->tab->term : terminals.next;
info_box(term, MSGBOX_NO_TEXT_INTL | MSGBOX_FREE_TEXT,
N_("SEE Message"), ALIGN_LEFT, string.source);
}
#if DATADRIVEN
_IDEA
struct object_info browser_object[] = {
"ELinks", SEE_ATTR_READONLY,
{ /* Properties: */
{ "version", SEE_STRING, VERSION, SEE_ATTR_READONLY },
{ "home", SEE_STRING, NULL, SEE_ATTR_READONLY },
},
{ /* Methods: (as name, handler, args) */
{ "write", elinks_see_write, SEE_ATTR_READONLY },
{ NULL }
},
};
struct object_info *see_
#endif
void
init_see_interface(struct SEE_interpreter *see)
{
unsigned char *home;
struct SEE_object *obj, *navigator;
struct SEE_value value;
struct SEE_string *name;
/* Create the navigator browser object. Add it to the global space */
navigator = SEE_Object_new(see);
SEE_SET_OBJECT(&value, navigator);
name = SEE_string_sprintf(see, "navigator");
SEE_OBJECT_PUT(see, see->Global, name, &value, SEE_ATTR_READONLY);
/* Create a string and attach as 'ELinks.version' */
SEE_SET_STRING(&value, SEE_string_sprintf(see, VERSION));
name = SEE_string_sprintf(see, "appVersion");
SEE_OBJECT_PUT(see, navigator, name, &value, SEE_ATTR_READONLY);
/* Create a string and attach as 'ELinks.home' */
home = elinks_home ? elinks_home : (unsigned char *) CONFDIR;
SEE_SET_STRING(&value, SEE_string_sprintf(see, home));
name = SEE_string_sprintf(see, "appHome");
SEE_OBJECT_PUT(see, navigator, name, &value, SEE_ATTR_READONLY);
/* Create an 'alert' method and attach to the browser object. */
/* FIXME: The browser object and the Global object should be identical. */
name = SEE_string_sprintf(see, "alert");
obj = SEE_cfunction_make(see, navigator_alert, name, 1);
SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, navigator, name, &value, 0);
SEE_OBJECT_PUT(see, see->Global, name, &value, 0);
name = SEE_string_sprintf(see, "preference");
obj = SEE_cfunction_make(see, navigator_preference, name, 1);
SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, navigator, name, &value, 0);
name = SEE_string_sprintf(see, "savePreferences");
obj = SEE_cfunction_make(see, navigator_save_preferences, name, 1);
SEE_SET_OBJECT(&value, obj);
SEE_OBJECT_PUT(see, navigator, name, &value, 0);
}

View File

@ -0,0 +1,9 @@
#ifndef EL__SCRIPTING_SEE_INTERFACE_H
#define EL__SCRIPTING_SEE_INTERFACE_H
struct SEE_interpreter;
void init_see_interface(struct SEE_interpreter *see);
#endif