1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

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

This commit is contained in:
Witold Filipczyk 2006-05-20 17:28:57 +02:00 committed by Witold Filipczyk
commit d87c0d9958
18 changed files with 141 additions and 34 deletions

View File

@ -16,6 +16,7 @@
#include "config/options.h" #include "config/options.h"
#include "intl/gettext/libintl.h" #include "intl/gettext/libintl.h"
#include "main/event.h" #include "main/event.h"
#include "main/module.h"
#include "terminal/kbd.h" #include "terminal/kbd.h"
#include "util/memory.h" #include "util/memory.h"
#include "util/string.h" #include "util/string.h"
@ -515,8 +516,8 @@ static struct action_list action_table[KEYMAP_MAX] = {
#undef ACTION_ #undef ACTION_
void static void
init_keymaps(void) init_keymaps(struct module *xxx)
{ {
enum keymap_id keymap_id; enum keymap_id keymap_id;
@ -527,8 +528,8 @@ init_keymaps(void)
add_default_keybindings(); add_default_keybindings();
} }
void static void
free_keymaps(void) free_keymaps(struct module *xxx)
{ {
enum keymap_id keymap_id; enum keymap_id keymap_id;
@ -948,3 +949,13 @@ bind_config_string(struct string *file)
} }
} }
} }
struct module kbdbind_module = struct_module(
/* name: */ "Keyboard Bindings",
/* options: */ NULL,
/* hooks: */ NULL,
/* submodules: */ NULL,
/* data: */ NULL,
/* init: */ init_keymaps,
/* done: */ free_keymaps
);

View File

@ -8,6 +8,7 @@
#include "util/string.h" #include "util/string.h"
struct listbox_item; struct listbox_item;
struct module;
/* Used for holding enum <keymap>_action values. */ /* Used for holding enum <keymap>_action values. */
typedef long action_id_T; typedef long action_id_T;
@ -114,9 +115,6 @@ struct keybinding {
}; };
void init_keymaps(void);
void free_keymaps(void);
struct keybinding *add_keybinding(enum keymap_id keymap_id, action_id_T action_id, struct term_event_keyboard *kbd, int event); struct keybinding *add_keybinding(enum keymap_id keymap_id, action_id_T action_id, struct term_event_keyboard *kbd, int event);
int keybinding_exists(enum keymap_id keymap_id, struct term_event_keyboard *kbd, action_id_T *action_id); int keybinding_exists(enum keymap_id keymap_id, struct term_event_keyboard *kbd, action_id_T *action_id);
void free_keybinding(struct keybinding *); void free_keybinding(struct keybinding *);
@ -207,4 +205,6 @@ unsigned char *get_keystroke(action_id_T action_id, enum keymap_id keymap_id);
void add_actions_to_string(struct string *string, action_id_T actions[], void add_actions_to_string(struct string *string, action_id_T actions[],
enum keymap_id keymap_id, struct terminal *term); enum keymap_id keymap_id, struct terminal *term);
extern struct module kbdbind_module;
#endif #endif

View File

@ -23,7 +23,6 @@
#include "config/cmdline.h" #include "config/cmdline.h"
#include "config/conf.h" #include "config/conf.h"
#include "config/home.h" #include "config/home.h"
#include "config/kbdbind.h"
#include "config/options.h" #include "config/options.h"
#include "dialogs/menu.h" #include "dialogs/menu.h"
#include "document/document.h" #include "document/document.h"
@ -130,7 +129,6 @@ init(void)
register_modules_options(builtin_modules); register_modules_options(builtin_modules);
set_sigcld(); set_sigcld();
get_system_name(); get_system_name();
init_keymaps();
/* XXX: OS/2 has some stupid bug and the pipe must be created before /* XXX: OS/2 has some stupid bug and the pipe must be created before
* socket :-/. -- Mikulas */ * socket :-/. -- Mikulas */
@ -283,14 +281,9 @@ terminate_all_subsystems(void)
if (init_b) { if (init_b) {
#ifdef CONFIG_SCRIPTING #ifdef CONFIG_SCRIPTING
trigger_event_name("quit"); trigger_event_name("quit");
#endif
#ifdef CONFIG_MARKS
free_marks();
#endif #endif
free_history_lists(); free_history_lists();
free_auth();
done_modules(builtin_modules); done_modules(builtin_modules);
done_screen_drivers();
done_saved_session_info(); done_saved_session_info();
} }
@ -298,7 +291,6 @@ terminate_all_subsystems(void)
free_charsets_lookup(); free_charsets_lookup();
free_colors_lookup(); free_colors_lookup();
done_modules(main_modules); done_modules(main_modules);
free_keymaps();
free_conv_table(); free_conv_table();
check_bottom_halves(); check_bottom_halves();
done_home(); done_home();

View File

@ -14,6 +14,7 @@
#include "bfu/dialog.h" #include "bfu/dialog.h"
#include "bookmarks/bookmarks.h" #include "bookmarks/bookmarks.h"
#include "config/kbdbind.h"
#include "config/timer.h" #include "config/timer.h"
#include "config/urlhist.h" #include "config/urlhist.h"
#include "cookies/cookies.h" #include "cookies/cookies.h"
@ -27,19 +28,21 @@
#include "network/ssl/ssl.h" #include "network/ssl/ssl.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
#include "scripting/scripting.h" #include "scripting/scripting.h"
#include "viewer/text/search.h" #include "terminal/terminal.h"
#include "viewer/timer.h" #include "viewer/viewer.h"
struct module *main_modules[] = { struct module *main_modules[] = {
&document_module, &document_module,
&kbdbind_module,
&terminal_module,
NULL /* XXX: Keep this */ NULL /* XXX: Keep this */
}; };
/* This is also used for version string composing so keep NULL terminated */ /* This is also used for version string composing so keep NULL terminated */
struct module *builtin_modules[] = { struct module *builtin_modules[] = {
&periodic_saving_module, &periodic_saving_module,
&timer_module, &viewer_module,
#ifdef CONFIG_CSS #ifdef CONFIG_CSS
&css_module, &css_module,
#endif #endif
@ -73,7 +76,6 @@ struct module *builtin_modules[] = {
&exmode_module, &exmode_module,
#endif #endif
&goto_url_history_module, &goto_url_history_module,
&search_history_module,
NULL NULL
}; };

View File

@ -74,7 +74,11 @@ void done_module(struct module *module);
/* Interface for handling builtin modules */ /* Interface for handling builtin modules */
/* Builtin modules are initialised only when not connecting to a master
* terminal. */
extern struct module *builtin_modules[]; extern struct module *builtin_modules[];
/* Main modules are initialised earlier and are not listed in Help -> About. */
extern struct module *main_modules[]; extern struct module *main_modules[];
void register_modules_options(struct module *modules[]); void register_modules_options(struct module *modules[]);

View File

@ -10,6 +10,7 @@
#include "bfu/hierbox.h" #include "bfu/hierbox.h"
#include "intl/gettext/libintl.h" #include "intl/gettext/libintl.h"
#include "main/module.h"
#include "protocol/auth/auth.h" #include "protocol/auth/auth.h"
#include "protocol/auth/dialogs.h" #include "protocol/auth/dialogs.h"
#include "protocol/protocol.h" #include "protocol/protocol.h"
@ -305,6 +306,12 @@ free_auth(void)
free_list(questions_queue); free_list(questions_queue);
} }
static void
done_auth(struct module *xxx)
{
free_auth();
}
struct auth_entry * struct auth_entry *
get_invalid_auth_entry(void) get_invalid_auth_entry(void)
{ {
@ -320,3 +327,13 @@ get_invalid_auth_entry(void)
return NULL; return NULL;
} }
struct module auth_module = struct_module(
/* name: */ "HTTP Authentication",
/* options: */ NULL,
/* hooks: */ NULL,
/* submodules: */ NULL,
/* data: */ NULL,
/* init: */ NULL,
/* done: */ done_auth
);

View File

@ -7,6 +7,7 @@
#include "util/lists.h" #include "util/lists.h"
struct listbox_item; struct listbox_item;
struct module;
struct auth_entry { struct auth_entry {
OBJECT_HEAD(struct auth_entry); OBJECT_HEAD(struct auth_entry);
@ -41,4 +42,6 @@ void del_auth_entry(struct auth_entry *);
void free_auth(void); void free_auth(void);
struct auth_entry *get_invalid_auth_entry(void); struct auth_entry *get_invalid_auth_entry(void);
extern struct module auth_module;
#endif #endif

View File

@ -114,20 +114,14 @@ update_bittorrent_connection_state(struct connection *conn)
continue; continue;
if (min_uploads < max_uploads) { if (min_uploads < max_uploads) {
if (peer->remote.choked) unchoke_bittorrent_peer(peer);
unchoke_bittorrent_peer(peer);
peer->remote.choked = 0;
/* Uninterested peers are not counted as uploads. */ /* Uninterested peers are not counted as uploads. */
if (peer->remote.interested) if (peer->remote.interested)
max_uploads--; max_uploads--;
} else { } else {
if (!peer->remote.choked) choke_bittorrent_peer(peer);
choke_bittorrent_peer(peer);
peer->remote.choked = 1;
} }
/* Can remove the peer so we use foreachsafe(). */ /* Can remove the peer so we use foreachsafe(). */

View File

@ -26,6 +26,7 @@
/* Backends dynamic area: */ /* Backends dynamic area: */
#include "protocol/about.h" #include "protocol/about.h"
#include "protocol/auth/auth.h"
#include "protocol/bittorrent/bittorrent.h" #include "protocol/bittorrent/bittorrent.h"
#include "protocol/bittorrent/connection.h" #include "protocol/bittorrent/connection.h"
#include "protocol/data.h" #include "protocol/data.h"
@ -273,6 +274,7 @@ static struct option_info protocol_options[] = {
NULL_OPTION_INFO, NULL_OPTION_INFO,
}; };
static struct module *protocol_submodules[] = { static struct module *protocol_submodules[] = {
&auth_module,
#ifdef CONFIG_BITTORRENT #ifdef CONFIG_BITTORRENT
&bittorrent_protocol_module, &bittorrent_protocol_module,
#endif #endif

View File

@ -11,6 +11,7 @@
#include "config/options.h" #include "config/options.h"
#include "intl/charsets.h" #include "intl/charsets.h"
#include "main/module.h"
#include "osdep/ascii.h" #include "osdep/ascii.h"
#include "osdep/osdep.h" #include "osdep/osdep.h"
#include "terminal/color.h" #include "terminal/color.h"
@ -305,8 +306,9 @@ get_screen_driver(struct terminal *term)
return add_screen_driver(type, term, len); return add_screen_driver(type, term, len);
} }
/* Release private screen drawing utilities. */
void void
done_screen_drivers(void) done_screen_drivers(struct module *xxx)
{ {
free_list(active_screen_drivers); free_list(active_screen_drivers);
} }
@ -776,3 +778,13 @@ done_screen(struct terminal_screen *screen)
mem_free_if(screen->image); mem_free_if(screen->image);
mem_free(screen); mem_free(screen);
} }
struct module terminal_screen_module = struct_module(
/* name: */ "Terminal Screen",
/* options: */ NULL,
/* hooks: */ NULL,
/* submodules: */ NULL,
/* data: */ NULL,
/* init: */ NULL,
/* done: */ done_screen_drivers
);

View File

@ -2,6 +2,7 @@
#define EL__TERMINAL_SCREEN_H #define EL__TERMINAL_SCREEN_H
struct module;
struct screen_char; struct screen_char;
struct terminal; struct terminal;
@ -49,7 +50,6 @@ void erase_screen(struct terminal *term);
/* Meeep! */ /* Meeep! */
void beep_terminal(struct terminal *term); void beep_terminal(struct terminal *term);
/* Release private screen drawing utilities. */ extern struct module terminal_screen_module;
void done_screen_drivers(void);
#endif #endif

View File

@ -17,6 +17,7 @@
#include "config/options.h" #include "config/options.h"
#include "intl/gettext/libintl.h" #include "intl/gettext/libintl.h"
#include "main/main.h" #include "main/main.h"
#include "main/module.h"
#include "main/object.h" #include "main/object.h"
#include "main/select.h" #include "main/select.h"
#include "osdep/osdep.h" #include "osdep/osdep.h"
@ -370,3 +371,18 @@ attach_terminal(int in, int out, int ctl, void *info, int len)
return term; return term;
} }
static struct module *terminal_submodules[] = {
&terminal_screen_module,
NULL
};
struct module terminal_module = struct_module(
/* name: */ "Terminal",
/* options: */ NULL,
/* hooks: */ NULL,
/* submodules: */ terminal_submodules,
/* data: */ NULL,
/* init: */ NULL,
/* done: */ NULL
);

View File

@ -5,6 +5,7 @@
#include "terminal/event.h" #include "terminal/event.h"
#include "util/lists.h" #include "util/lists.h"
struct module;
struct option; struct option;
struct terminal_screen; struct terminal_screen;
struct terminal_interlink; struct terminal_interlink;
@ -178,4 +179,6 @@ int check_terminal_pipes(void);
void close_terminal_pipes(void); void close_terminal_pipes(void);
struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len); struct terminal *attach_terminal(int in, int out, int ctl, void *info, int len);
extern struct module terminal_module;
#endif /* EL__TERMINAL_TERMINAL_H */ #endif /* EL__TERMINAL_TERMINAL_H */

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.o timer.o OBJS = action.o timer.o viewer.o
include $(top_srcdir)/Makefile.lib include $(top_srcdir)/Makefile.lib

View File

@ -10,6 +10,7 @@
#include "elinks.h" #include "elinks.h"
#include "document/view.h" #include "document/view.h"
#include "main/module.h"
#include "protocol/uri.h" #include "protocol/uri.h"
#include "util/memory.h" #include "util/memory.h"
#include "util/string.h" #include "util/string.h"
@ -136,8 +137,8 @@ set_mark(unsigned char mark, struct view_state *mark_vs)
marks[i] = vs; marks[i] = vs;
} }
void static void
free_marks(void) done_marks(struct module *xxx)
{ {
int i; int i;
@ -145,3 +146,13 @@ free_marks(void)
free_mark_by_index(i); free_mark_by_index(i);
} }
} }
struct module viewer_marks_module = struct_module(
/* name: */ "Marks",
/* options: */ NULL,
/* hooks: */ NULL,
/* submodules: */ NULL,
/* data: */ NULL,
/* init: */ NULL,
/* done: */ done_marks
);

View File

@ -2,11 +2,12 @@
#ifndef EL__VIEWER_TEXT_MARKS_H #ifndef EL__VIEWER_TEXT_MARKS_H
#define EL__VIEWER_TEXT_MARKS_H #define EL__VIEWER_TEXT_MARKS_H
struct module;
struct view_state; struct view_state;
void goto_mark(unsigned char mark, struct view_state *vs); void goto_mark(unsigned char mark, struct view_state *vs);
void set_mark(unsigned char mark, struct view_state *vs); void set_mark(unsigned char mark, struct view_state *vs);
void free_marks(void); extern struct module viewer_marks_module;
#endif #endif

31
src/viewer/viewer.c Normal file
View File

@ -0,0 +1,31 @@
/* Viewer module */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "elinks.h"
#include "intl/gettext/libintl.h"
#include "main/module.h"
#include "viewer/text/marks.h"
#include "viewer/text/search.h"
#include "viewer/timer.h"
static struct module *viewer_submodules[] = {
&search_history_module,
&timer_module,
#ifdef CONFIG_MARKS
&viewer_marks_module,
#endif
};
struct module viewer_module = struct_module(
/* name: */ N_("Viewer"),
/* options: */ NULL,
/* hooks: */ NULL,
/* submodules: */ viewer_submodules,
/* data: */ NULL,
/* init: */ NULL,
/* done: */ NULL
);

8
src/viewer/viewer.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef EL__VIEWER_VIEWER_H
#define EL__VIEWER_VIEWER_H
struct module;
extern struct module viewer_module;
#endif