diff --git a/configure.in b/configure.in index ca65fe1f..2a395235 100644 --- a/configure.in +++ b/configure.in @@ -705,6 +705,7 @@ src/lib-popt/Makefile src/perl/Makefile src/perl/common/Makefile.PL src/perl/irc/Makefile.PL +src/perl/fe/Makefile.PL servertest/Makefile scripts/Makefile docs/Makefile diff --git a/src/perl/Makefile.am b/src/perl/Makefile.am index 0b5c7853..baa8d889 100644 --- a/src/perl/Makefile.am +++ b/src/perl/Makefile.am @@ -2,14 +2,13 @@ LIBTOOL = $(PERL_LIBTOOL) moduledir = $(libdir)/irssi/modules -module_LTLIBRARIES = $(perl_module_lib) $(perl_module_fe_lib) -noinst_LTLIBRARIES = $(perl_static_lib) $(perl_static_fe_lib) +module_LTLIBRARIES = $(perl_module_lib) +noinst_LTLIBRARIES = $(perl_static_lib) EXTRA_LTLIBRARIES = \ - libperl_core.la libfe_perl.la \ - libperl_static.la libfe_perl_static.la + libperl_core.la \ + libperl_static.la libperl_core_la_LDFLAGS = -avoid-version -rpath $(moduledir) -libfe_perl_la_LDFLAGS = -avoid-version -rpath $(moduledir) perl.c: perl-signals-list.h @@ -26,8 +25,6 @@ perl_sources = \ perl-signals.c \ xsinit.c -perl_fe_sources = perl-fe.c - libperl_core_la_DEPENDENCIES = .libs/libperl_orig.a .libs/DynaLoader.a .libs/libperl_orig.a: @@ -45,16 +42,12 @@ libperl_core_la_SOURCES = \ libperl_static_la_SOURCES = \ $(perl_sources) -libfe_perl_la_SOURCES = \ - $(perl_fe_sources) - -libfe_perl_static_la_SOURCES = \ - $(perl_fe_sources) - perl-signals-list.h: $(top_srcdir)/docs/signals.txt $(srcdir)/get-signals.pl cat $(top_srcdir)/docs/signals.txt | $(perlpath) $(srcdir)/get-signals.pl > perl-signals-list.h CORE_SOURCES = \ + common/Irssi.xs \ + common/Irssi.pm \ common/Channel.xs \ common/Core.xs \ common/Ignore.xs \ @@ -64,15 +57,13 @@ CORE_SOURCES = \ common/Rawlog.xs \ common/Server.xs \ common/Settings.xs \ - common/Themes.xs \ - common/Window.xs \ - common/Irssi.xs \ - common/Irssi.pm \ common/Makefile.PL.in \ common/typemap \ common/module.h IRC_SOURCES = \ + irc/Irc.xs \ + irc/Irc.pm \ irc/Dcc.xs \ irc/IrcChannel.xs \ irc/IrcQuery.xs \ @@ -80,8 +71,15 @@ IRC_SOURCES = \ irc/Modes.xs \ irc/Netsplit.xs \ irc/Notifylist.xs \ - irc/Irc.xs \ - irc/Irc.pm \ + irc/Makefile.PL.in \ + irc/typemap \ + irc/module.h + +FE_SOURCES = \ + irc/UI.xs \ + irc/UI.pm \ + common/Themes.xs \ + common/Window.xs \ irc/Makefile.PL.in \ irc/typemap \ irc/module.h @@ -91,7 +89,8 @@ EXTRA_DIST = \ libperl_orig.la \ get-signals.pl \ $(CORE_SOURCES) \ - $(IRC_SOURCES) + $(IRC_SOURCES) \ + $(FE_SOURCES) noinst_HEADERS = \ module.h \ @@ -99,16 +98,19 @@ noinst_HEADERS = \ perl-signals.h all-local: - for dir in common irc; do cd $$dir && if [ ! -f Makefile ]; then if [ "x$(PERL_LIB_DIR)" = "x" ]; then $(perlpath) Makefile.PL; else $(perlpath) Makefile.PL LIB=$(PERL_LIB_DIR) PREFIX=$(PERL_LIB_DIR); fi; fi && ($(MAKE) || $(MAKE)) && cd ..; done + for dir in common irc ui; do cd $$dir && if [ ! -f Makefile ]; then if [ "x$(PERL_LIB_DIR)" = "x" ]; then $(perlpath) Makefile.PL; else $(perlpath) Makefile.PL LIB=$(PERL_LIB_DIR) PREFIX=$(PERL_LIB_DIR); fi; fi && ($(MAKE) || $(MAKE)) && cd ..; done +# FIXME: remove after .99: the libfe_perl must not be used anymore install-exec-local: - for dir in common irc; do cd $$dir && $(MAKE) install && cd ..; done + -(rm -f $(moduledir)/libfe_perl.*) + for dir in common irc ui; do cd $$dir && $(MAKE) install && cd ..; done clean-generic: - rm -f common/Irssi.c irc/Irc.c + rm -f common/Irssi.c irc/Irc.c ui/UI.c distclean: distclean-am -(cd common && $(MAKE) realclean && rm -f Makefile.PL) -(cd irc && $(MAKE) realclean && rm -f Makefile.PL) + -(cd ui && $(MAKE) realclean && rm -f Makefile.PL) libperl_core_la_LIBADD = $(PERL_LDFLAGS) diff --git a/src/perl/common/Irssi.xs b/src/perl/common/Irssi.xs index b2cb24fc..272b27fd 100644 --- a/src/perl/common/Irssi.xs +++ b/src/perl/common/Irssi.xs @@ -1,5 +1,4 @@ #include "module.h" -#include "levels.h" MODULE = Irssi PACKAGE = Irssi @@ -14,5 +13,3 @@ INCLUDE: Query.xs INCLUDE: Rawlog.xs INCLUDE: Server.xs INCLUDE: Settings.xs -INCLUDE: Themes.xs -INCLUDE: Window.xs diff --git a/src/perl/common/module.h b/src/perl/common/module.h index 23cbad63..80d46b77 100644 --- a/src/perl/common/module.h +++ b/src/perl/common/module.h @@ -8,6 +8,7 @@ #include "../module.h" #include "network.h" +#include "levels.h" #include "commands.h" #include "log.h" #include "rawlog.h" @@ -15,6 +16,7 @@ #include "settings.h" #include "masks.h" #include "special-vars.h" +#include "window-item-def.h" #include "chatnets.h" #include "servers.h" @@ -25,13 +27,6 @@ #include "queries.h" #include "nicklist.h" -#include "fe-common/core/fe-windows.h" -#include "fe-common/core/formats.h" -#include "fe-common/core/printtext.h" -#include "fe-common/core/window-items.h" -#include "fe-common/core/themes.h" -#include "fe-common/core/keyboard.h" - #include "perl/perl-common.h" #include "perl/perl-signals.h" @@ -41,6 +36,7 @@ typedef LOG_ITEM_REC *Irssi__Logitem; typedef RAWLOG_REC *Irssi__Rawlog; typedef IGNORE_REC *Irssi__Ignore; typedef MODULE_REC *Irssi__Module; +typedef WI_ITEM_REC *Irssi__Windowitem; typedef CHATNET_REC *Irssi__Chatnet; typedef SERVER_REC *Irssi__Server; @@ -49,9 +45,3 @@ typedef RECONNECT_REC *Irssi__Reconnect; typedef CHANNEL_REC *Irssi__Channel; typedef QUERY_REC *Irssi__Query; typedef NICK_REC *Irssi__Nick; - -typedef THEME_REC *Irssi__Theme; -typedef KEYINFO_REC *Irssi__Keyinfo; -typedef WINDOW_REC *Irssi__Window; -typedef WI_ITEM_REC *Irssi__Windowitem; -typedef TEXT_DEST_REC *Irssi__TextDest; diff --git a/src/perl/common/typemap b/src/perl/common/typemap index f2432f17..9de29109 100644 --- a/src/perl/common/typemap +++ b/src/perl/common/typemap @@ -12,11 +12,7 @@ Irssi::Log T_PlainObj Irssi::Logitem T_PlainObj Irssi::Rawlog T_PlainObj Irssi::Module T_PlainObj -Irssi::Theme T_PlainObj -Irssi::Keyinfo T_PlainObj -Irssi::Window T_PlainObj Irssi::Windowitem T_IrssiObj -Irssi::TextDest T_PlainObj INPUT diff --git a/src/perl/irc/Makefile.PL.in b/src/perl/irc/Makefile.PL.in index 4ee86957..de7bbbff 100644 --- a/src/perl/irc/Makefile.PL.in +++ b/src/perl/irc/Makefile.PL.in @@ -2,5 +2,6 @@ use ExtUtils::MakeMaker; WriteMakefile('NAME' => 'Irssi::Irc', 'LIBS' => '', + 'TYPEMAPS' => ['../common/typemap'], 'INC' => '-I../../.. -I@top_srcdir@/src -I@top_srcdir@/src/core -I@top_srcdir@/src/irc/core -I@top_srcdir@/src/irc @GLIB_CFLAGS@', 'VERSION_FROM' => '@srcdir@/Irc.pm'); diff --git a/src/perl/irc/typemap b/src/perl/irc/typemap index c4721b1f..5fb9bdcd 100644 --- a/src/perl/irc/typemap +++ b/src/perl/irc/typemap @@ -15,8 +15,6 @@ Irssi::Irc::Netsplitserver T_PlainObj Irssi::Irc::Netsplitchannel T_PlainObj Irssi::Irc::Notifylist T_PlainObj -Irssi::Windowitem T_IrssiObj - INPUT T_IrssiObj diff --git a/src/perl/ui/.cvsignore b/src/perl/ui/.cvsignore new file mode 100644 index 00000000..239deafc --- /dev/null +++ b/src/perl/ui/.cvsignore @@ -0,0 +1,7 @@ +Makefile +Makefile.PL +UI.c +UI.bs +*.o +pm_to_blib +blib diff --git a/src/perl/ui/Makefile.PL.in b/src/perl/ui/Makefile.PL.in new file mode 100644 index 00000000..601c3b9d --- /dev/null +++ b/src/perl/ui/Makefile.PL.in @@ -0,0 +1,7 @@ +use ExtUtils::MakeMaker; + +WriteMakefile('NAME' => 'Irssi::UI', + 'LIBS' => '', + 'TYPEMAPS' => ['../common/typemap'], + 'INC' => '-I../../.. -I@top_srcdir@/src -I@top_srcdir@/src/core -I@top_srcdir@/src/fe-common/core @GLIB_CFLAGS@', + 'VERSION_FROM' => '@srcdir@/UI.pm'); diff --git a/src/perl/common/Themes.xs b/src/perl/ui/Themes.xs similarity index 93% rename from src/perl/common/Themes.xs rename to src/perl/ui/Themes.xs index e8d5c595..427952ff 100644 --- a/src/perl/common/Themes.xs +++ b/src/perl/ui/Themes.xs @@ -1,5 +1,5 @@ -MODULE = Irssi PACKAGE = Irssi +MODULE = Irssi::UI PACKAGE = Irssi void theme_register(formats) @@ -53,7 +53,7 @@ CODE: printformat_perl(&dest, format, arglist); #******************************* -MODULE = Irssi PACKAGE = Irssi::Server +MODULE = Irssi::UI PACKAGE = Irssi::Server #******************************* void @@ -77,12 +77,12 @@ CODE: printformat_perl(&dest, format, arglist); #******************************* -MODULE = Irssi PACKAGE = Irssi::Window +MODULE = Irssi::UI PACKAGE = Irssi::UI::Window #******************************* void printformat(window, level, format, ...) - Irssi::Window window + Irssi::UI::Window window int level char *format PREINIT: @@ -100,7 +100,7 @@ CODE: printformat_perl(&dest, format, arglist); #******************************* -MODULE = Irssi PACKAGE = Irssi::Windowitem +MODULE = Irssi::UI PACKAGE = Irssi::Windowitem #******************************* void diff --git a/src/perl/ui/UI.pm b/src/perl/ui/UI.pm new file mode 100644 index 00000000..acf60e8b --- /dev/null +++ b/src/perl/ui/UI.pm @@ -0,0 +1,24 @@ +# +# Perl interface to irssi functions. +# + +package Irssi::UI; + +use strict; +use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); + +$VERSION = "0.20"; + +require Exporter; +require DynaLoader; + +@ISA = qw(Exporter DynaLoader); +@EXPORT = qw(active_win active_server print command printformat); +@EXPORT_OK = qw(); + +bootstrap Irssi::UI $VERSION; + +Irssi::UI::init(); + +1; + diff --git a/src/perl/perl-fe.c b/src/perl/ui/UI.xs similarity index 67% rename from src/perl/perl-fe.c rename to src/perl/ui/UI.xs index a41b71c7..165e73de 100644 --- a/src/perl/perl-fe.c +++ b/src/perl/ui/UI.xs @@ -1,32 +1,4 @@ -/* - perl-fe.c : irssi - - Copyright (C) 2001 Timo Sirainen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - #include "module.h" -#include "signals.h" - -#include "fe-common/core/fe-exec.h" -#include "fe-common/core/formats.h" -#include "fe-common/core/printtext.h" -#include "fe-common/core/themes.h" - -#include "perl-common.h" static void perl_process_fill_hash(HV *hv, PROCESS_REC *process) { @@ -38,7 +10,7 @@ static void perl_process_fill_hash(HV *hv, PROCESS_REC *process) hv_store(hv, "target", 6, new_pv(process->target), 0); if (process->target_win != NULL) { hv_store(hv, "target_win", 10, - plain_bless(process->target_win, "Irssi::Window"), 0); + plain_bless(process->target_win, "Irssi::UI::Window"), 0); } hv_store(hv, "shell", 5, newSViv(process->shell), 0); hv_store(hv, "notice", 6, newSViv(process->notice), 0); @@ -64,7 +36,7 @@ static void perl_window_fill_hash(HV *hv, WINDOW_REC *window) static void perl_text_dest_fill_hash(HV *hv, TEXT_DEST_REC *dest) { - hv_store(hv, "window", 6, plain_bless(dest->window, "Irssi::Window"), 0); + hv_store(hv, "window", 6, plain_bless(dest->window, "Irssi::UI::Window"), 0); hv_store(hv, "server", 6, irssi_bless(dest->server), 0); hv_store(hv, "target", 6, new_pv(dest->target), 0); hv_store(hv, "level", 5, newSViv(dest->level), 0); @@ -130,23 +102,31 @@ static void sig_perl_stop(void) } } -void fe_perl_init(void) -{ - static PLAIN_OBJECT_INIT_REC fe_plains[] = { - { "Irssi::Process", (PERL_OBJECT_FUNC) perl_process_fill_hash }, - { "Irssi::Window", (PERL_OBJECT_FUNC) perl_window_fill_hash }, - { "Irssi::TextDest", (PERL_OBJECT_FUNC) perl_text_dest_fill_hash }, +static PLAIN_OBJECT_INIT_REC fe_plains[] = { + { "Irssi::UI::Process", (PERL_OBJECT_FUNC) perl_process_fill_hash }, + { "Irssi::UI::Window", (PERL_OBJECT_FUNC) perl_window_fill_hash }, + { "Irssi::UI::TextDest", (PERL_OBJECT_FUNC) perl_text_dest_fill_hash }, + + { NULL, NULL } +}; + +MODULE = Irssi::UI PACKAGE = Irssi::UI + +PROTOTYPES: ENABLE + +void +init() +PREINIT: + static int initialized = FALSE; +CODE: + if (initialized) return; + initialized = TRUE; - { NULL, NULL } - }; irssi_add_plains(fe_plains); signal_add("script destroy", (SIGNAL_FUNC) sig_script_destroy); signal_add("perl stop", (SIGNAL_FUNC) sig_perl_stop); -} -void fe_perl_deinit(void) -{ - signal_remove("script destroy", (SIGNAL_FUNC) sig_script_destroy); - signal_remove("perl stop", (SIGNAL_FUNC) sig_perl_stop); -} + +INCLUDE: Themes.xs +INCLUDE: Window.xs diff --git a/src/perl/common/Window.xs b/src/perl/ui/Window.xs similarity index 81% rename from src/perl/common/Window.xs rename to src/perl/ui/Window.xs index 027289cc..cbee5a82 100644 --- a/src/perl/common/Window.xs +++ b/src/perl/ui/Window.xs @@ -1,4 +1,4 @@ -MODULE = Irssi PACKAGE = Irssi +MODULE = Irssi::UI PACKAGE = Irssi void windows() @@ -6,11 +6,11 @@ PREINIT: GSList *tmp; PPCODE: for (tmp = windows; tmp != NULL; tmp = tmp->next) { - XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Window"))); + XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::UI::Window"))); } -Irssi::Window +Irssi::UI::Window active_win() CODE: RETVAL = active_win; @@ -37,11 +37,11 @@ command(cmd) CODE: perl_command(cmd, active_win->active_server, active_win->active); -Irssi::Window +Irssi::UI::Window window_find_name(name) char *name -Irssi::Window +Irssi::UI::Window window_find_refnum(refnum) int refnum @@ -58,7 +58,7 @@ window_refnum_next(refnum, wrap) int windows_refnum_last() -Irssi::Window +Irssi::UI::Window window_find_level(level) int level CODE: @@ -66,7 +66,7 @@ CODE: OUTPUT: RETVAL -Irssi::Window +Irssi::UI::Window window_find_item(name) char *name CODE: @@ -74,7 +74,7 @@ CODE: OUTPUT: RETVAL -Irssi::Window +Irssi::UI::Window window_find_closest(name, level) char *name int level @@ -93,7 +93,7 @@ OUTPUT: #******************************* -MODULE = Irssi PACKAGE = Irssi::Server +MODULE = Irssi::UI PACKAGE = Irssi::Server #******************************* void @@ -117,17 +117,17 @@ window_item_find(server, name) Irssi::Server server char *name -Irssi::Window +Irssi::UI::Window window_find_item(server, name) Irssi::Server server char *name -Irssi::Window +Irssi::UI::Window window_find_level(server, level) Irssi::Server server int level -Irssi::Window +Irssi::UI::Window window_find_closest(server, name, level) Irssi::Server server char *name @@ -135,12 +135,12 @@ window_find_closest(server, name, level) #******************************* -MODULE = Irssi PACKAGE = Irssi::Window PREFIX=window_ +MODULE = Irssi::UI PACKAGE = Irssi::UI::Window PREFIX=window_ #******************************* void items(window) - Irssi::Window window + Irssi::UI::Window window PREINIT: GSList *tmp; PPCODE: @@ -152,7 +152,7 @@ PPCODE: void print(window, str, level=MSGLEVEL_CLIENTNOTICE) - Irssi::Window window + Irssi::UI::Window window char *str int level; CODE: @@ -160,14 +160,14 @@ CODE: void command(window, cmd) - Irssi::Window window + Irssi::UI::Window window char *cmd CODE: perl_command(cmd, window->active_server, window->active); void window_item_add(window, item, automatic) - Irssi::Window window + Irssi::UI::Window window Irssi::Windowitem item int automatic @@ -181,47 +181,47 @@ window_item_destroy(item) void window_item_prev(window) - Irssi::Window window + Irssi::UI::Window window void window_item_next(window) - Irssi::Window window + Irssi::UI::Window window void window_destroy(window) - Irssi::Window window + Irssi::UI::Window window void window_set_active(window) - Irssi::Window window + Irssi::UI::Window window void window_change_server(window, server) - Irssi::Window window + Irssi::UI::Window window Irssi::Server server void window_set_refnum(window, refnum) - Irssi::Window window + Irssi::UI::Window window int refnum void window_set_name(window, name) - Irssi::Window window + Irssi::UI::Window window char *name void window_set_level(window, level) - Irssi::Window window + Irssi::UI::Window window int level char * window_get_active_name(window) - Irssi::Window window + Irssi::UI::Window window Irssi::Windowitem window_item_find(window, server, name) - Irssi::Window window + Irssi::UI::Window window Irssi::Server server char *name CODE: @@ -230,7 +230,7 @@ OUTPUT: RETVAL #******************************* -MODULE = Irssi PACKAGE = Irssi::Windowitem PREFIX = window_item_ +MODULE = Irssi::UI PACKAGE = Irssi::Windowitem PREFIX = window_item_ #******************************* void @@ -248,12 +248,12 @@ command(item, cmd) CODE: perl_command(cmd, item->server, item); -Irssi::Window +Irssi::UI::Window window_create(item, automatic) Irssi::Windowitem item int automatic -Irssi::Window +Irssi::UI::Window window(item) Irssi::Windowitem item CODE: diff --git a/src/perl/ui/module.h b/src/perl/ui/module.h new file mode 100644 index 00000000..31775039 --- /dev/null +++ b/src/perl/ui/module.h @@ -0,0 +1,14 @@ +#include "../common/module.h" + +#include "fe-windows.h" +#include "fe-exec.h" +#include "formats.h" +#include "printtext.h" +#include "window-items.h" +#include "themes.h" +#include "keyboard.h" + +typedef WINDOW_REC *Irssi__UI__Window; +typedef TEXT_DEST_REC *Irssi__UI__TextDest; +typedef THEME_REC *Irssi__UI__Theme; +typedef KEYINFO_REC *Irssi__UI__Keyinfo; diff --git a/src/perl/ui/typemap b/src/perl/ui/typemap new file mode 100644 index 00000000..ee156e5c --- /dev/null +++ b/src/perl/ui/typemap @@ -0,0 +1,16 @@ +TYPEMAP +Irssi::UI::Theme T_PlainObj +Irssi::UI::Window T_PlainObj +Irssi::UI::Keyinfo T_PlainObj +Irssi::UI::TextDest T_PlainObj + +INPUT + +T_PlainObj + $var = irssi_ref_object($arg) + +OUTPUT + +T_PlainObj + $arg = irssi_bless_plain(\"$type\", $var); +