aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2010-11-07 00:56:27 +0000
committerTom Feist <shabble@metavore.org>2010-11-07 00:56:27 +0000
commite8103212057eb6cf587ca77c36a11a87aa05bab9 (patch)
treeb45c299fea5bbf9cc0b9eb5ae138a8d7f789033c
parentrl_search_history: bump version number (diff)
downloadirssi-scripts-e8103212057eb6cf587ca77c36a11a87aa05bab9.tar.gz
irssi-scripts-e8103212057eb6cf587ca77c36a11a87aa05bab9.zip
test_harness: added a stubbed C irssi module for eventual signal capture/injection
-rw-r--r--modules/test_harness/Makefile32
-rw-r--r--modules/test_harness/test_harness.c54
-rw-r--r--modules/test_harness/test_harness.h29
-rw-r--r--modules/test_harness/test_harness_irssi.h52
4 files changed, 167 insertions, 0 deletions
diff --git a/modules/test_harness/Makefile b/modules/test_harness/Makefile
new file mode 100644
index 0000000..ed1ee93
--- /dev/null
+++ b/modules/test_harness/Makefile
@@ -0,0 +1,32 @@
+CFLAGS = -Wall -O2 -Werror -g
+LDFLAGS = -avoid-version -module -bundle -flat_namespace -undefined suppress
+INSTALL_DIR = $(HOME)/projects/tmp/test/irssi
+OBJECTS = test_harness.o
+
+IRSSI_DIST = /opt/stow/repo/irssi/include/irssi
+
+IRSSI_INCLUDE = -I$(IRSSI_DIST) -I$(IRSSI_DIST)/src -I$(IRSSI_DIST)/src/fe-common/core \
+ -I$(IRSSI_DIST)/src/core -I$(IRSSI_DIST)/src/fe-text -I$(IRSSI_DIST)/src/irc \
+ -I$(IRSSI_DIST)/src/irc/core -I$(IRSSI_DIST)/src/irc/dcc -I$(IRSSI_DIST)/src/irc/notifylist
+
+LUA_CFLAGS = $(shell pkg-config lua --cflags)
+GLIB_CFLAGS = $(shell pkg-config glib-2.0 --cflags)
+LUA_LIBS = $(shell pkg-config lua --libs)
+
+all: libtest_harness.so
+
+%.o: %.c
+ $(CC) $(CFLAGS) $(LUA_CFLAGS) $(GLIB_CFLAGS) $(IRSSI_INCLUDE) -I. -fPIC -c $<
+
+libtest_harness.so: $(OBJECTS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LUA_LIBS) $(OBJECTS) -o $@
+
+install: libtest_harness.so
+ install $< $(INSTALL_DIR)/modules/
+
+clean:
+ rm -rf *~ *.o *.so core || true
+
+.default: all
+
+.phony: clean install
diff --git a/modules/test_harness/test_harness.c b/modules/test_harness/test_harness.c
new file mode 100644
index 0000000..f57fab0
--- /dev/null
+++ b/modules/test_harness/test_harness.c
@@ -0,0 +1,54 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ *
+ * Copyright (c) 2009 Alexander Færøy <ahf@irssi.org>
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <test_harness.h>
+#include <test_harness_irssi.h>
+
+void test_harness_init(void) {
+ module_register(MODULE_NAME, "core");
+ printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "Hello, World.");
+ /* int i = 0; */
+ /* for (i = 0; i < 26; i++) { */
+ /* signal_emit("gui key pressed", 1, 'a' + i); */
+ /* } */
+
+ signal_emit("beep", 0);
+}
+
+void test_harness_deinit() {
+/* lua_loader_deinit(); */
+/* lua_commands_deinit(); */
+/* lua_api_deinit(); */
+}
+
+/*
+ * Plan:
+ * Register as a plugin
+ * Open a FIFO (named pipe) for control
+ * allow emission of arbitrary signals (via fifo control channel)
+ * allow signal listeners for arbitrary signals (serialised to some format
+ * and printed to fifo.
+
+ * Issues:
+ * How to handle serialisation / args marshalling?
+ *
+
+ */
diff --git a/modules/test_harness/test_harness.h b/modules/test_harness/test_harness.h
new file mode 100644
index 0000000..60eddbf
--- /dev/null
+++ b/modules/test_harness/test_harness.h
@@ -0,0 +1,29 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Alexander Færøy <ahf@irssi.org>
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef TEST_HARNESS_CORE_H
+#define TEST_HARNESS_CORE_H 1
+
+#define MODULE_NAME "test_harness"
+
+void test_harness_init();
+void test_harness_deinit();
+
+#endif
diff --git a/modules/test_harness/test_harness_irssi.h b/modules/test_harness/test_harness_irssi.h
new file mode 100644
index 0000000..33b7c1a
--- /dev/null
+++ b/modules/test_harness/test_harness_irssi.h
@@ -0,0 +1,52 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 Alexander Færøy <ahf@irssi.org>
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GUARD_TEST_HARNESS_IRSSI_H
+#define GUARD_TEST_HARNESS_IRSSI_H 1
+
+/* FIXME: bug */
+#define UOFF_T_LONG_LONG 1
+
+/* #include "config.h" */
+#include "core.h"
+#include "common.h"
+#include "modules.h"
+#include "commands.h"
+#include "settings.h"
+#include "printtext.h"
+#include "window-items.h"
+#include "window-activity.h"
+#include "levels.h"
+#include "servers.h"
+#include "chat-protocols.h"
+#include "channels.h"
+#include "queries.h"
+#include "nicklist.h"
+#include "chatnets.h"
+#include "servers-reconnect.h"
+#include "masks.h"
+#include "misc.h"
+#include "rawlog.h"
+#include "log.h"
+#include "ignore.h"
+#include "fe-exec.h"
+#include "pidwait.h"
+
+#endif