From fb20d3bb1d4aa932c2454edd5ea1be71dd0a69e7 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 27 Nov 2009 21:49:24 +0000 Subject: [PATCH 01/16] Relaxed requirement for Gtk-doc 1.11, as Debian stable only has 1.10. git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@186 ddfedd41-794f-dd11-ae45-00112f111e67 --- configure.ac | 4 ++-- docs/reference/Makefile.am | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 5d0c1ec..5b2501d 100644 --- a/configure.ac +++ b/configure.ac @@ -27,10 +27,10 @@ AC_SUBST(LT_VERSION_INFO) ### REQUIREMENTS ############################################################## GTK_REQUIRED_VERSION=2.12 GLIB_REQUIRED_VERSION=2.16 -GTK_DOC_REQUIRED_VERSION=1.11 +GTK_DOC_REQUIRED_VERSION=1.9 AC_SUBST(GTK_REQUIRED_VERSION) AC_SUBST(GLIB_REQUIRED_VERSION) -AC_SUBST(GTK_DOC_REQUIRED_VERSION) # Gtk-Doc 1.11 required +AC_SUBST(GTK_DOC_REQUIRED_VERSION) ### DECLARE COMPILERS ######################################################### diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index c039fb8..890de7d 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -34,7 +34,11 @@ MKTMPL_OPTIONS = # Extra options to supply to gtkdoc-mkhtml # The --path is because Gtk-doc is broken on non-distcheck vpath builds! Sigh. -MKHTML_OPTIONS = --path="$(abs_builddir)" +# But it only works on Gtk-doc 1.11 and higher. So if you want to do a vpath +# build then uncomment this and require 1.11 in configure.ac. If you want to do +# vpath build on Debian, then you're S.O.L. Complain to Gtk-doc and Debian. +# MKHTML_OPTIONS = --path="$(abs_builddir)" +MKHTML_OPTIONS = # Extra options to supply to gtkdoc-fixref. Not normally needed. FIXXREF_OPTIONS = -- 2.30.2 From 4baeafb95f6fe4523d5854778bce639dae5a3a9f Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 27 Nov 2009 22:57:35 +0000 Subject: [PATCH 02/16] Inserted extra definition of LT_OBJDIR for pre-2.2 libtool git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@187 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/chimara-if.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libchimara/chimara-if.c b/libchimara/chimara-if.c index 26e5b3a..939d734 100644 --- a/libchimara/chimara-if.c +++ b/libchimara/chimara-if.c @@ -535,12 +535,15 @@ chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) gchar *pluginpath; #ifdef DEBUG +#ifndef LT_OBJDIR +#define LT_OBJDIR ".libs" /* Pre-2.2 libtool, so take a wild guess */ +#endif /* LT_OBJDIR */ /* If there is a plugin in the source tree, use that */ pluginpath = g_build_filename(PLUGINSOURCEDIR, plugin_names[interpreter], LT_OBJDIR, pluginfile, NULL); if( !g_file_test(pluginpath, G_FILE_TEST_EXISTS) ) { g_free(pluginpath); -#endif +#endif /* DEBUG */ pluginpath = g_build_filename(PLUGINDIR, pluginfile, NULL); if( !g_file_test(pluginpath, G_FILE_TEST_EXISTS) ) { -- 2.30.2 From 727fd10832b0e8fb82f1c263531c1401f37b8a1a Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 27 Nov 2009 23:05:07 +0000 Subject: [PATCH 03/16] Workaround for GtkBuilder bug in GTK 2.12 git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@188 ddfedd41-794f-dd11-ae45-00112f111e67 --- tests/glulxercise.c | 1 + tests/glulxercise.ui | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/glulxercise.c b/tests/glulxercise.c index 3db6bba..6d4b21f 100644 --- a/tests/glulxercise.c +++ b/tests/glulxercise.c @@ -88,6 +88,7 @@ main(int argc, char *argv[]) w->window = LOAD_WIDGET("window"); GtkWidget *vbox = LOAD_WIDGET("vbox"); w->test_picker = LOAD_WIDGET("test_picker"); + gtk_combo_box_set_active(GTK_COMBO_BOX(w->test_picker), 0); w->go = LOAD_WIDGET("go"); w->stop = LOAD_WIDGET("stop"); w->interp = chimara_if_new(); diff --git a/tests/glulxercise.ui b/tests/glulxercise.ui index 22e7d0f..348f44d 100644 --- a/tests/glulxercise.ui +++ b/tests/glulxercise.ui @@ -20,7 +20,6 @@ True tests - 0 -- 2.30.2 From 8ef6e816ba9c55188181a00ae23b181bb09c5526 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 27 Nov 2009 23:56:14 +0000 Subject: [PATCH 04/16] Hack to get intltool 0.40.0 to work git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@189 ddfedd41-794f-dd11-ae45-00112f111e67 --- autogen.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autogen.sh b/autogen.sh index ee8c4dd..9c061ca 100755 --- a/autogen.sh +++ b/autogen.sh @@ -19,3 +19,8 @@ autoreconf --force --install || exit 1 # Run after autopoint echo "Setting up Intltool" intltoolize --copy --force --automake || exit 1 +# Hack to get intltool 0.40.0 to work (Debian stable) +touch intltool-extract.in +touch intltool-merge.in +touch intltool-update.in + -- 2.30.2 From 5f736bab8c5a29ed6a1f2f3f61db693525756067 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sat, 28 Nov 2009 13:38:59 +0000 Subject: [PATCH 05/16] Debian package building To build a Debian package: * make dist * copy the tarball somewhere * untar it * rename it to chimara_0.1.orig.tar.gz * cd chimara-0.1 * dpkg-buildpackage -rfakeroot Lintian reports several errors, these are due to us not having a public website, and to me being too lazy to figure out all the license crap before we know exactly what will be in the distribution. git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@190 ddfedd41-794f-dd11-ae45-00112f111e67 --- debian/.svnignore | 9 +++++++ debian/README.Debian | 6 +++++ debian/changelog | 7 +++++ debian/compat | 1 + debian/control | 49 ++++++++++++++++++++++++++++++++++ debian/copyright | 25 +++++++++++++++++ debian/docs | 16 +++++++++++ debian/info | 1 + debian/libchimara-dev.install | 4 +++ debian/libchimara-doc.doc-base | 12 +++++++++ debian/libchimara-doc.install | 1 + debian/libchimara0.install | 5 ++++ debian/rules | 9 +++++++ debian/watch | 23 ++++++++++++++++ 14 files changed, 168 insertions(+) create mode 100644 debian/.svnignore create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/info create mode 100644 debian/libchimara-dev.install create mode 100644 debian/libchimara-doc.doc-base create mode 100644 debian/libchimara-doc.install create mode 100644 debian/libchimara0.install create mode 100755 debian/rules create mode 100644 debian/watch diff --git a/debian/.svnignore b/debian/.svnignore new file mode 100644 index 0000000..69a0d7d --- /dev/null +++ b/debian/.svnignore @@ -0,0 +1,9 @@ +*.debhelper.log +*.debhelper +*.substvars +stamp-* +files +libchimara0 +libchimara-dev +libchimara-doc +tmp diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..639e8f4 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +chimara for Debian +------------------ + + + + -- Philip Chimento Sat, 28 Nov 2009 00:57:21 +0100 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f4c67af --- /dev/null +++ b/debian/changelog @@ -0,0 +1,7 @@ +chimara (0.1-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + * TODO FIXME when actually doing release + + -- Philip Chimento Sat, 28 Nov 2009 00:57:21 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..2cdf307 --- /dev/null +++ b/debian/control @@ -0,0 +1,49 @@ +Source: chimara +Section: libs +Priority: extra +Maintainer: Philip Chimento +Build-Depends: cdbs, + debhelper (>= 7), + autotools-dev, + pkg-config, + gtk-doc-tools (>= 1.9), + libglib2.0-dev, + libgtk2.0-dev +Standards-Version: 3.7.3 +Homepage: + +Package: libchimara0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: A GTK+ widget implementation of the Glk library + Chimara is a GTK+ widget that loads and runs Glk programs as plugins. Glk is an + input/output specification specifically designed for interactive fiction. + +Package: libchimara-dev +Section: libdevel +Architecture: any +Depends: ${misc:Depends}, + libchimara0 (= ${binary:Version}), + libglib2.0-dev, + libgtk2.0-dev +Suggests: libchimara-doc +Description: Development files for the Chimara Glk library + Chimara is a GTK+ widget that loads and runs Glk programs as plugins. Glk is an + input/output specification specifically designed for interactive fiction. + . + This package contains the header files required if you wish to develop software + that uses the Chimara widget. + +Package: libchimara-doc +Section: doc +Architecture: all +Depends: ${misc:Depends} +Description: Documentation for the Chimara Glk library + Chimara is a GTK+ widget that loads and runs Glk programs as plugins. Glk is an + input/output specification specifically designed for interactive fiction. + . + This package contains the Chimara reference manual. + + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..0087586 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,25 @@ +This package was debianized by Philip Chimento on +Sat, 28 Nov 2009 00:57:21 +0100. + +It was downloaded from + +Upstream Author(s): + + Marijn van Vliet + Philip Chimento + +Copyright: + + Copyright (C) 2009 <> + +License: + + Yada yada TODO FIXME when actually doing release + +The Debian packaging is (C) 2009, Philip Chimento and +is licensed under the same license as the main program. + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# TODO +# We'll have to sort through all this license crap before we release the package. diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..4a282e4 --- /dev/null +++ b/debian/docs @@ -0,0 +1,16 @@ +ABOUT-NLS +AUTHORS +ChangeLog +COPYING +NEWS +README +interpreters/frotz/AUTHORS +interpreters/frotz/COPYING +interpreters/frotz/README +interpreters/frotz/TODO +interpreters/git/README.txt +interpreters/glulxe/README +interpreters/nitfol/COPYING +interpreters/nitfol/ChangeLog +interpreters/nitfol/INSTALL +interpreters/nitfol/README diff --git a/debian/info b/debian/info new file mode 100644 index 0000000..cbf9cd5 --- /dev/null +++ b/debian/info @@ -0,0 +1 @@ +interpreters/nitfol/nitfol.info diff --git a/debian/libchimara-dev.install b/debian/libchimara-dev.install new file mode 100644 index 0000000..08cc8b3 --- /dev/null +++ b/debian/libchimara-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/include +debian/tmp/usr/lib/lib*.a +debian/tmp/usr/lib/lib*.so +debian/tmp/usr/lib/pkgconfig/* diff --git a/debian/libchimara-doc.doc-base b/debian/libchimara-doc.doc-base new file mode 100644 index 0000000..7bb7dc8 --- /dev/null +++ b/debian/libchimara-doc.doc-base @@ -0,0 +1,12 @@ +Document: chimara +Title: Chimara Reference Manual +Author: Andrew Plotkin, Philip Chimento, Marijn van Vliet +Abstract: The Chimara Reference Manual includes Andrew Plotkin's Glk + specification, version 0.7.0, annotated for use with the Chimara library. It + also contains the API documentation for using the Chimara widgets. +Section: Programming + +Format: HTML +Index: /usr/share/gtk-doc/html/chimara/index.html +Files: /usr/share/gtk-doc/html/chimara/*.html + diff --git a/debian/libchimara-doc.install b/debian/libchimara-doc.install new file mode 100644 index 0000000..133e6a2 --- /dev/null +++ b/debian/libchimara-doc.install @@ -0,0 +1 @@ +debian/tmp/usr/share/gtk-doc diff --git a/debian/libchimara0.install b/debian/libchimara0.install new file mode 100644 index 0000000..5feeda8 --- /dev/null +++ b/debian/libchimara0.install @@ -0,0 +1,5 @@ +debian/tmp/usr/lib/lib*.so.* +debian/tmp/usr/lib/chimara/frotz.so +debian/tmp/usr/lib/chimara/git.so +debian/tmp/usr/lib/chimara/glulxe.so +debian/tmp/usr/lib/chimara/nitfol.so diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..f27efba --- /dev/null +++ b/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/gnome.mk + + +# Add here any variable or target overrides you need. +DEB_CONFIGURE_EXTRA_FLAGS = --enable-gtk-doc +DEB_BUILD_OPTIONS = nocheck diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..22a3f47 --- /dev/null +++ b/debian/watch @@ -0,0 +1,23 @@ +# You can run the "uscan" command to check for upstream updates and more. +# See uscan(1) for format + +# TODO FIXME do this when we release and there is a public URL for the source + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php chimara-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/chimara-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/chimara-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for devscripts >= 2.9 +# http://sf.net/chimara/chimara-(.*)\.tar\.gz + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html chimara-(.*)\.tar\.gz -- 2.30.2 From 90c824d0e150efca7bc2860661a7823c23c46b6a Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sun, 29 Nov 2009 20:09:56 +0000 Subject: [PATCH 06/16] Added buffer flush and wait for window rearrange in shutdown_glk() git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@191 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/abort.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libchimara/abort.c b/libchimara/abort.c index 5a812cf..517dec5 100644 --- a/libchimara/abort.c +++ b/libchimara/abort.c @@ -72,7 +72,7 @@ shutdown_glk(void) /* Stop any timers */ glk_request_timer_events(0); - /* Cancel any pending input requests */ + /* Cancel any pending input requests and flush all window buffers */ winid_t win; for(win = glk_window_iterate(NULL, NULL); win; win = glk_window_iterate(win, NULL)) { @@ -90,6 +90,8 @@ shutdown_glk(void) default: ; /* Handle mouse and hyperlink requests */ } + + flush_window_buffer(win); } /* Close any open resource files */ @@ -102,6 +104,11 @@ shutdown_glk(void) g_async_queue_unref(glk_data->char_input_queue); g_async_queue_unref(glk_data->line_input_queue); - printf("cleaning up...\n"); + /* Wait for any pending window rearrange */ + g_mutex_lock(glk_data->arrange_lock); + if(glk_data->needs_rearrange) + g_cond_wait(glk_data->rearranged, glk_data->arrange_lock); + g_mutex_unlock(glk_data->arrange_lock); + chimara_glk_reset(glk_data->self); } -- 2.30.2 From 2329a72bc5acc611cbbea2e9467a021839de0294 Mon Sep 17 00:00:00 2001 From: Marijn van Vliet Date: Mon, 30 Nov 2009 11:21:54 +0000 Subject: [PATCH 07/16] Seperation of client code from the tests git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@192 ddfedd41-794f-dd11-ae45-00112f111e67 --- client/.svnignore | 6 ++ client/Makefile.am | 27 +++++++ client/callbacks.c | 52 +++++++++++++ client/chimara.menus | 19 +++++ client/chimara.ui | 49 +++++++++++++ client/error.c | 52 +++++++++++++ client/error.h | 27 +++++++ client/iliad.c | 157 +++++++++++++++++++++++++++++++++++++++ client/main.c | 170 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 559 insertions(+) create mode 100644 client/.svnignore create mode 100644 client/Makefile.am create mode 100644 client/callbacks.c create mode 100644 client/chimara.menus create mode 100644 client/chimara.ui create mode 100644 client/error.c create mode 100644 client/error.h create mode 100644 client/iliad.c create mode 100644 client/main.c diff --git a/client/.svnignore b/client/.svnignore new file mode 100644 index 0000000..c413f5d --- /dev/null +++ b/client/.svnignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile +Makefile.in +chimara +iliad diff --git a/client/Makefile.am b/client/Makefile.am new file mode 100644 index 0000000..af25af5 --- /dev/null +++ b/client/Makefile.am @@ -0,0 +1,27 @@ +AM_CFLAGS = -Wall +AM_CPPFLAGS = -I$(top_srcdir) + +PLUGIN_LIBTOOL_FLAGS=-module -avoid-version -export-symbols-regex "^glk_main$$" + +if TARGET_ILIAD + +chimara_iliad_SOURCES = iliad.c +chimara_iliad_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) +chimara_iliad_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la + +bin_PROGRAMS = chimara_iliad + +else + +dist_data_DATA = chimara.ui chimara.menus +bin_PROGRAMS = chimara + +chimara_SOURCES = main.c callbacks.c error.c error.h +chimara_CPPFLAGS = $(AM_CPPFLAGS) \ + -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ + -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ + -DPACKAGE_DATA_DIR=\""$(datadir)"\" +chimara_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) +chimara_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la + +endif diff --git a/client/callbacks.c b/client/callbacks.c new file mode 100644 index 0000000..479a5ce --- /dev/null +++ b/client/callbacks.c @@ -0,0 +1,52 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * callbacks.c + * Copyright (C) Philip en Marijn 2008 <> + * + * callbacks.c is free software copyrighted by Philip en Marijn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name ``Philip en Marijn'' nor the name of any other + * contributor may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * callbacks.c IS PROVIDED BY Philip en Marijn ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Philip en Marijn OR ANY OTHER CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "error.h" + +void on_save(GtkAction *action, ChimaraGlk *glk) { + chimara_glk_feed_line_input(glk, "save"); +} + +void on_restore(GtkAction *action, ChimaraGlk *glk) { + chimara_glk_feed_line_input(glk, "restore"); +} + +gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, ChimaraGlk *glk) { + gtk_main_quit(); + return TRUE; +} + +void on_quit(GtkAction *action, ChimaraGlk *glk) { + gtk_main_quit(); +} diff --git a/client/chimara.menus b/client/chimara.menus new file mode 100644 index 0000000..e7ead1e --- /dev/null +++ b/client/chimara.menus @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/client/chimara.ui b/client/chimara.ui new file mode 100644 index 0000000..2519722 --- /dev/null +++ b/client/chimara.ui @@ -0,0 +1,49 @@ + + + + + + Chimara + 800 + 800 + + + + True + vertical + + + + + + + + + _Game + + + _Open... + _Open + Quit the current game and load a new one + gtk-media-play + + + _Restore... + _Restore + Restore a previously saved game + gtk-open + + + + _Save + Save the game + gtk-save + + + + _Quit + Exit Chimara + gtk-quit + + + diff --git a/client/error.c b/client/error.c new file mode 100644 index 0000000..c9b6f08 --- /dev/null +++ b/client/error.c @@ -0,0 +1,52 @@ +/* Copyright 2006 P.F. Chimento + * This file is part of GNOME Inform 7. + * + * GNOME Inform 7 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. + * + * GNOME Inform 7 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 GNOME Inform 7; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include + +#include "error.h" + +/* Create and display an error dialog box, with parent window parent, and +message format string msg. If err is not NULL, tack the error message on to the +end of the format string. */ +void +error_dialog(GtkWindow *parent, GError *err, const gchar *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + gchar buffer[1024]; + g_vsnprintf(buffer, 1024, msg, ap); + va_end(ap); + + gchar *message; + if(err) { + message = g_strconcat(buffer, err->message, NULL); + g_error_free(err); + } else + message = g_strdup(buffer); + + GtkWidget *dialog = gtk_message_dialog_new(parent, + parent? GTK_DIALOG_DESTROY_WITH_PARENT : 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + message); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_free(message); +} diff --git a/client/error.h b/client/error.h new file mode 100644 index 0000000..bb05fbe --- /dev/null +++ b/client/error.h @@ -0,0 +1,27 @@ +/* Copyright 2006 P.F. Chimento + * This file is part of GNOME Inform 7. + * + * GNOME Inform 7 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. + * + * GNOME Inform 7 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 GNOME Inform 7; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef ERROR_H +#define ERROR_H + +#include +#include + +void error_dialog(GtkWindow *parent, GError *err, const gchar *msg, ...); + +#endif diff --git a/client/iliad.c b/client/iliad.c new file mode 100644 index 0000000..ee9d7f5 --- /dev/null +++ b/client/iliad.c @@ -0,0 +1,157 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * iliad.c + * Copyright (C) Philip en Marijn 2008 <> + * + * iliad.c is free software copyrighted by Philip en Marijn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name ``Philip en Marijn'' nor the name of any other + * contributor may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * main.c IS PROVIDED BY Philip en Marijn ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Philip en Marijn OR ANY OTHER CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "error.h" +#include +#include + +/* Global pointers to widgets */ +GtkWidget *window = NULL; +GtkWidget *glk = NULL; + +static void +on_started(ChimaraGlk *glk) +{ + g_printerr("Started!\n"); +} + +static void +on_stopped(ChimaraGlk *glk) +{ + g_printerr("Stopped!\n"); +} + +static void +on_restore() +{ + chimara_glk_feed_line_input( CHIMARA_GLK(glk), "restore" ); +} + +static void +on_save() +{ + chimara_glk_feed_line_input( CHIMARA_GLK(glk), "save" ); +} + +static void +create_window(void) +{ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + glk = chimara_if_new(); + //chimara_if_set_preferred_interpreter( CHIMARA_IF(glk), CHIMARA_IF_FORMAT_Z8, CHIMARA_IF_INTERPRETER_NITFOL); + + gtk_widget_set_size_request(window, 800, 800); + g_object_set(glk, + "border-width", 6, + "spacing", 6, + "ignore-errors", TRUE, + NULL); + chimara_glk_set_default_font_string(CHIMARA_GLK(glk), "Serif 12"); + chimara_glk_set_monospace_font_string(CHIMARA_GLK(glk), "Monospace 12"); + g_signal_connect(glk, "started", G_CALLBACK(on_started), NULL); + g_signal_connect(glk, "stopped", G_CALLBACK(on_stopped), NULL); + + GtkWidget *vbox = gtk_vbox_new(FALSE, 0); + GtkWidget *toolbar = gtk_toolbar_new(); + + GtkToolItem *restore_button = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN); + g_signal_connect(restore_button, "clicked", G_CALLBACK(on_restore), NULL); + gtk_toolbar_insert( GTK_TOOLBAR(toolbar), restore_button, 0 ); + + GtkToolItem *save_button = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); + g_signal_connect(save_button, "clicked", G_CALLBACK(on_save), NULL); + gtk_toolbar_insert( GTK_TOOLBAR(toolbar), save_button, 0 ); + + GtkToolItem *quit_button = gtk_tool_button_new_from_stock(GTK_STOCK_QUIT); + g_signal_connect(quit_button, "clicked", G_CALLBACK(gtk_main_quit), NULL); + gtk_toolbar_insert( GTK_TOOLBAR(toolbar), quit_button, 0 ); + + GtkWidget *spacer = gtk_vbox_new(FALSE, 0); + gtk_widget_set_size_request(spacer, -1, 250); + + gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 ); + gtk_box_pack_start( GTK_BOX(vbox), glk, TRUE, TRUE, 0 ); + gtk_box_pack_end( GTK_BOX(vbox), spacer, FALSE, FALSE, 0 ); + + gtk_container_add( GTK_CONTAINER(window), vbox ); +} + +int +main(int argc, char *argv[]) +{ + GError *error = NULL; + +#ifdef ENABLE_NLS + bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); +#endif + + if( !g_thread_supported() ) + g_thread_init(NULL); + gdk_threads_init(); + gtk_init(&argc, &argv); + + create_window(); + gtk_widget_show_all(window); + + if(argc < 2) { + g_printerr("Must provide a game file\n"); + return 1; + } + + if( !chimara_if_run_game(CHIMARA_IF(glk), argv[1], &error) ) { + g_printerr("Error starting Glk library: %s\n", error->message); + return 1; + } + //chimara_glk_run( CHIMARA_GLK(glk), ".libs/multiwin.so", argc, argv, NULL); + + + gdk_threads_enter(); + gtk_main(); + gdk_threads_leave(); + + chimara_glk_stop(CHIMARA_GLK(glk)); + chimara_glk_wait(CHIMARA_GLK(glk)); + + return 0; +} diff --git a/client/main.c b/client/main.c new file mode 100644 index 0000000..b86badd --- /dev/null +++ b/client/main.c @@ -0,0 +1,170 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * main.c + * Copyright (C) Philip en Marijn 2008 <> + * + * main.c is free software copyrighted by Philip en Marijn. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name ``Philip en Marijn'' nor the name of any other + * contributor may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * main.c IS PROVIDED BY Philip en Marijn ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Philip en Marijn OR ANY OTHER CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "error.h" +#include +#include + +/* Global pointers to widgets */ +GtkBuilder *builder = NULL; +GtkUIManager *uimanager = NULL; +GtkWidget *window = NULL; +GtkWidget *glk = NULL; + +static GObject * +load_object(const gchar *name) +{ + GObject *retval; + if( (retval = gtk_builder_get_object(builder, name)) == NULL) { + error_dialog(NULL, NULL, "Error while getting object '%s'", name); + g_error("Error while getting object '%s'", name); + } + return retval; +} + +static void +create_window(void) +{ + GError *error = NULL; + + builder = gtk_builder_new(); + if( !gtk_builder_add_from_file(builder, PACKAGE_SRC_DIR "/chimara.ui", &error) ) { + error_dialog(NULL, error, "Error while building interface: "); + return; + } + + window = GTK_WIDGET(load_object("chimara")); + GtkActionGroup *actiongroup = GTK_ACTION_GROUP(load_object("actiongroup")); + + /* Add all the actions to the action group. This for-loop is a temporary fix + and can be removed once Glade supports adding actions and accelerators to an + action group. */ + const gchar *actions[] = { + "game", "", + "open", "F7", + "save", NULL, /* NULL means use stock accelerator */ + "quit", NULL, + "hint", "", + "char_input", "", + "char_input2", "", + NULL + }; + const gchar **ptr; + for(ptr = actions; *ptr; ptr += 2) + gtk_action_group_add_action_with_accel(actiongroup, GTK_ACTION(load_object(ptr[0])), ptr[1]); + + uimanager = gtk_ui_manager_new(); + if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_SRC_DIR "/chimara.menus", &error) ) { + error_dialog(NULL, error, "Error while building interface: "); + return; + } + + glk = chimara_if_new(); + //chimara_if_set_preferred_interpreter( CHIMARA_IF(glk), CHIMARA_IF_FORMAT_Z8, CHIMARA_IF_INTERPRETER_NITFOL); + + g_object_set(glk, + "border-width", 6, + "spacing", 6, + "ignore-errors", TRUE, + NULL); + chimara_glk_set_default_font_string(CHIMARA_GLK(glk), "Serif 12"); + chimara_glk_set_monospace_font_string(CHIMARA_GLK(glk), "Monospace 12"); + + GtkBox *vbox = GTK_BOX( gtk_builder_get_object(builder, "vbox") ); + if(vbox == NULL) + { + error_dialog(NULL, NULL, "Could not find vbox"); + return; + } + + gtk_ui_manager_insert_action_group(uimanager, actiongroup, 0); + GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/menubar"); + GtkWidget *toolbar = gtk_ui_manager_get_widget(uimanager, "/toolbar"); + + gtk_box_pack_end(vbox, glk, TRUE, TRUE, 0); + gtk_box_pack_start(vbox, menubar, FALSE, FALSE, 0); + gtk_box_pack_start(vbox, toolbar, FALSE, FALSE, 0); + + gtk_builder_connect_signals(builder, glk); +} + +int +main(int argc, char *argv[]) +{ + GError *error = NULL; + +#ifdef ENABLE_NLS + bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); +#endif + + if( !g_thread_supported() ) + g_thread_init(NULL); + gdk_threads_init(); + gtk_init(&argc, &argv); + + create_window(); + gtk_widget_show_all(window); + + g_object_unref( G_OBJECT(builder) ); + g_object_unref( G_OBJECT(uimanager) ); + + if(argc < 2) { + error_dialog(GTK_WINDOW(window), NULL, "Must provide a game file"); + return 1; + } + + if( !chimara_if_run_game(CHIMARA_IF(glk), argv[1], &error) ) { + error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: "); + return 1; + } + + gdk_threads_enter(); + gtk_main(); + gdk_threads_leave(); + + chimara_glk_stop(CHIMARA_GLK(glk)); + chimara_glk_wait(CHIMARA_GLK(glk)); + + return 0; +} -- 2.30.2 From 8f36c2a6f4503a6e1a9b7368feea758f05fd7b86 Mon Sep 17 00:00:00 2001 From: Marijn van Vliet Date: Mon, 30 Nov 2009 13:25:39 +0000 Subject: [PATCH 08/16] * On a second thought: rename client to player * Added the player to the RPM and DEB packages * Added out patch to Froz to the repository git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@193 ddfedd41-794f-dd11-ae45-00112f111e67 --- Makefile.am | 4 ++-- chimara.spec.in | 14 ++++++++++++++ configure.ac | 1 + debian/control | 12 ++++++++++++ debian/copyright | 2 +- debian/libchimara-player.install | 1 + interpreters/frotz.patch | 33 ++++++++++++++++++++++++++++++++ {client => player}/.svnignore | 0 {client => player}/Makefile.am | 0 {client => player}/callbacks.c | 0 {client => player}/chimara.menus | 0 {client => player}/chimara.ui | 0 {client => player}/error.c | 0 {client => player}/error.h | 0 {client => player}/iliad.c | 0 {client => player}/main.c | 0 16 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 debian/libchimara-player.install create mode 100644 interpreters/frotz.patch rename {client => player}/.svnignore (100%) rename {client => player}/Makefile.am (100%) rename {client => player}/callbacks.c (100%) rename {client => player}/chimara.menus (100%) rename {client => player}/chimara.ui (100%) rename {client => player}/error.c (100%) rename {client => player}/error.h (100%) rename {client => player}/iliad.c (100%) rename {client => player}/main.c (100%) diff --git a/Makefile.am b/Makefile.am index 2ce4185..ac912e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in ## Created by Anjuta -SUBDIRS = libchimara interpreters tests docs po +SUBDIRS = libchimara interpreters tests docs po player chimaradocdir = ${prefix}/doc/chimara dist_chimaradoc_DATA = \ @@ -35,4 +35,4 @@ rpm: @$(ECHO) \ "To build an RPM package, you must run configure with --enable-rpm."; \ exit 1 -endif \ No newline at end of file +endif diff --git a/chimara.spec.in b/chimara.spec.in index cd41347..fbde406 100644 --- a/chimara.spec.in +++ b/chimara.spec.in @@ -40,6 +40,15 @@ Requires: %{name} = %{version}-%{release} The %{name}-devel package contains libraries and header files for developing applications that use %{name}. +%package player +Summary: The default IF player using %{name} +Group: Games +Requires: %{name} = %{version}-%{release} + +%description player +The %{name}-player package contains the default interactive fiction player using %{name}. +developing applications that use %{name}. + %prep %setup -q @@ -77,6 +86,11 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/chimara/libchimara/*.h %{_libdir}/pkgconfig/*.pc +%files player +%{_bindir}/chimara + %changelog +* Mon Nov 30 2009 W. M. van Vliet +- Added Chimara player to the package. * Wed Nov 25 2009 P. F. Chimento - Created specfile. diff --git a/configure.ac b/configure.ac index 5b2501d..787fef9 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,7 @@ interpreters/nitfol/Makefile interpreters/glulxe/Makefile interpreters/git/Makefile tests/Makefile +player/Makefile docs/Makefile docs/reference/Makefile docs/reference/version.xml diff --git a/debian/control b/debian/control index 2cdf307..8070f24 100644 --- a/debian/control +++ b/debian/control @@ -46,4 +46,16 @@ Description: Documentation for the Chimara Glk library . This package contains the Chimara reference manual. +Package: libchimara-player +Section: games +Architecture: any +Depends: ${misc:Depends} + libchimara0 (= ${binary:Version}), + libglib2.0-dev, + libgtk2.0-dev +Description: Interactive fiction player using the Chimara Glk library + Chimara is a GTK+ widget that loads and runs Glk programs as plugins. Glk is an + input/output specification specifically designed for interactive fiction. + . + This package contains a default interactive fiction player that uses Chimara. diff --git a/debian/copyright b/debian/copyright index 0087586..31b5d85 100644 --- a/debian/copyright +++ b/debian/copyright @@ -5,7 +5,7 @@ It was downloaded from Upstream Author(s): - Marijn van Vliet + Marijn van Vliet Philip Chimento Copyright: diff --git a/debian/libchimara-player.install b/debian/libchimara-player.install new file mode 100644 index 0000000..0e4f65a --- /dev/null +++ b/debian/libchimara-player.install @@ -0,0 +1 @@ +debian/tmp/usr/bin/chimara diff --git a/interpreters/frotz.patch b/interpreters/frotz.patch new file mode 100644 index 0000000..a40dcec --- /dev/null +++ b/interpreters/frotz.patch @@ -0,0 +1,33 @@ +--- frotz/glkscreen.c 2009-11-14 17:44:15.617976131 +0100 ++++ frotz/glkscreen.c.new 2009-11-14 17:44:10.367194781 +0100 +@@ -305,13 +305,6 @@ + return; + } + +- if (gos_upper && gos_curwin == gos_upper) { +- if (cury > mach_status_ht) { +- mach_status_ht = cury; +- reset_status_ht(); +- } +- } +- + /* check fixed flag in header, game can change it at whim */ + if (gos_curwin == gos_lower) + { +@@ -583,8 +576,15 @@ + { + cury = zargs[0]; + curx = zargs[1]; +- if (gos_upper) ++ ++ if (gos_upper) { ++ if (cury > mach_status_ht) { ++ mach_status_ht = cury; ++ reset_status_ht(); ++ } ++ + glk_window_move_cursor(gos_upper, curx - 1, cury - 1); ++ } + } + + /* diff --git a/client/.svnignore b/player/.svnignore similarity index 100% rename from client/.svnignore rename to player/.svnignore diff --git a/client/Makefile.am b/player/Makefile.am similarity index 100% rename from client/Makefile.am rename to player/Makefile.am diff --git a/client/callbacks.c b/player/callbacks.c similarity index 100% rename from client/callbacks.c rename to player/callbacks.c diff --git a/client/chimara.menus b/player/chimara.menus similarity index 100% rename from client/chimara.menus rename to player/chimara.menus diff --git a/client/chimara.ui b/player/chimara.ui similarity index 100% rename from client/chimara.ui rename to player/chimara.ui diff --git a/client/error.c b/player/error.c similarity index 100% rename from client/error.c rename to player/error.c diff --git a/client/error.h b/player/error.h similarity index 100% rename from client/error.h rename to player/error.h diff --git a/client/iliad.c b/player/iliad.c similarity index 100% rename from client/iliad.c rename to player/iliad.c diff --git a/client/main.c b/player/main.c similarity index 100% rename from client/main.c rename to player/main.c -- 2.30.2 From 828b9d5e00cd6903adc4c3db8f84e53ec17f497e Mon Sep 17 00:00:00 2001 From: Marijn van Vliet Date: Mon, 30 Nov 2009 15:48:32 +0000 Subject: [PATCH 09/16] Created a FreeBSD port for Chimara git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@194 ddfedd41-794f-dd11-ae45-00112f111e67 --- freebsd-port/libchimara/Makefile | 25 ++++++++++++++++ freebsd-port/libchimara/distinfo | 3 ++ freebsd-port/libchimara/pkg-descr | 3 ++ freebsd-port/libchimara/pkg-plist | 48 +++++++++++++++++++++++++++++++ player/main.c | 4 +-- 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 freebsd-port/libchimara/Makefile create mode 100644 freebsd-port/libchimara/distinfo create mode 100644 freebsd-port/libchimara/pkg-descr create mode 100644 freebsd-port/libchimara/pkg-plist diff --git a/freebsd-port/libchimara/Makefile b/freebsd-port/libchimara/Makefile new file mode 100644 index 0000000..8e8ea0c --- /dev/null +++ b/freebsd-port/libchimara/Makefile @@ -0,0 +1,25 @@ +# New ports collection makefile for: libchimara +# Date created: 30 November 2009 +# Whom: W. M. van Vliet +# +# $FreeBSD$ +# + +PORTNAME= libchimara +PORTVERSION= 0.1 +CATEGORIES= devel +MASTER_SITES= http://lassie.student.utwente.nl/chimara/ +DISTNAME= chimara-0.1 + +MAINTAINER= w.m.vanvliet@student.utwente.nl +COMMENT= A GTK widget that implements the GLK interface for interactive fiction. + +LIB_DEPENDS= libchimara.0:${PORTSDIR}/devel/libchimara \ + gtk-x11-2.0:${PORTSDIR}/x11-toolkits/gtk20 \ + glib-2.0:${PORTSDIR}/devel/glib20 + +GNU_CONFIGURE= yes +USE_GMAKE= yes + + +.include diff --git a/freebsd-port/libchimara/distinfo b/freebsd-port/libchimara/distinfo new file mode 100644 index 0000000..6179b41 --- /dev/null +++ b/freebsd-port/libchimara/distinfo @@ -0,0 +1,3 @@ +MD5 (chimara-0.1.tar.gz) = 511fa505e6af8f3a07621ac1001d7fe7 +SHA256 (chimara-0.1.tar.gz) = 90923a7af0fe66c179fa4dcfa8968563b1bbba1f8638038dfb98548cf25ca9ca +SIZE (chimara-0.1.tar.gz) = 1252441 diff --git a/freebsd-port/libchimara/pkg-descr b/freebsd-port/libchimara/pkg-descr new file mode 100644 index 0000000..3865fa7 --- /dev/null +++ b/freebsd-port/libchimara/pkg-descr @@ -0,0 +1,3 @@ +This is a GTK widget that implements the GLK interface to play interactive fiction. It means that the widget can load any interpreter plugin that uses GLK to provide a central render for interactive fiction. Many interpreters for popular formats such as Z8 and inform7 are included. + +WWW: http://lassie.student.utwente.nl/chimara diff --git a/freebsd-port/libchimara/pkg-plist b/freebsd-port/libchimara/pkg-plist new file mode 100644 index 0000000..362676c --- /dev/null +++ b/freebsd-port/libchimara/pkg-plist @@ -0,0 +1,48 @@ +bin/chimara +doc/chimara/AUTHORS +doc/chimara/COPYING +doc/chimara/ChangeLog +doc/chimara/INSTALL +doc/chimara/NEWS +doc/chimara/README +include/chimara/libchimara/chimara-glk.h +include/chimara/libchimara/chimara-if.h +include/chimara/libchimara/garglk.h +include/chimara/libchimara/gi_blorb.h +include/chimara/libchimara/glk.h +include/chimara/libchimara/glkstart.h +lib/chimara/first.a +lib/chimara/first.la +lib/chimara/first.so +lib/chimara/frotz.la +lib/chimara/frotz.so +lib/chimara/git.la +lib/chimara/git.so +lib/chimara/glulxe.la +lib/chimara/glulxe.so +lib/chimara/gridtest.a +lib/chimara/gridtest.la +lib/chimara/gridtest.so +lib/chimara/model.a +lib/chimara/model.la +lib/chimara/model.so +lib/chimara/multiwin.a +lib/chimara/multiwin.la +lib/chimara/multiwin.so +lib/chimara/nitfol.la +lib/chimara/nitfol.so +lib/chimara/splittest.a +lib/chimara/splittest.la +lib/chimara/splittest.so +lib/chimara/styletest.a +lib/chimara/styletest.la +lib/chimara/styletest.so +lib/libchimara.a +lib/libchimara.la +lib/libchimara.so.0 +lib/pkgconfig/chimara.pc +lib/pkgconfig/chimara-plugin.pc +@dirrm doc/chimara +@dirrm include/chimara/libchimara +@dirrm include/chimara +@dirrm lib/chimara diff --git a/player/main.c b/player/main.c index b86badd..089fc24 100644 --- a/player/main.c +++ b/player/main.c @@ -81,11 +81,9 @@ create_window(void) const gchar *actions[] = { "game", "", "open", "F7", + "restore", "O", "save", NULL, /* NULL means use stock accelerator */ "quit", NULL, - "hint", "", - "char_input", "", - "char_input2", "", NULL }; const gchar **ptr; -- 2.30.2 From 4240a3dfe7bae2864cdd67e8bdb9819949f01183 Mon Sep 17 00:00:00 2001 From: Marijn van Vliet Date: Mon, 30 Nov 2009 16:09:31 +0000 Subject: [PATCH 10/16] Dependency fixes. git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@195 ddfedd41-794f-dd11-ae45-00112f111e67 --- freebsd-port/libchimara/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/freebsd-port/libchimara/Makefile b/freebsd-port/libchimara/Makefile index 8e8ea0c..f8212f2 100644 --- a/freebsd-port/libchimara/Makefile +++ b/freebsd-port/libchimara/Makefile @@ -14,12 +14,11 @@ DISTNAME= chimara-0.1 MAINTAINER= w.m.vanvliet@student.utwente.nl COMMENT= A GTK widget that implements the GLK interface for interactive fiction. -LIB_DEPENDS= libchimara.0:${PORTSDIR}/devel/libchimara \ - gtk-x11-2.0:${PORTSDIR}/x11-toolkits/gtk20 \ - glib-2.0:${PORTSDIR}/devel/glib20 +USE_GNOME= gtk20 GNU_CONFIGURE= yes USE_GMAKE= yes +USE_LDCONFIG= ${PREFIX}/lib ${PREFIX}/lib/chimara .include -- 2.30.2 From cbd4cb7f8c62b2ba51329a4cb082a96115a7529d Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 3 Dec 2009 20:53:22 +0000 Subject: [PATCH 11/16] Fixed freeing data at stop & start. Previously the root window was set to NULL when the plugin stopped, which broke window rearrangement and also caused a memory leak because the tree of windows wasn't freed. Now the windows are only freed when another plugin starts. git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@196 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/abort.c | 12 +++-- libchimara/chimara-glk-private.h | 6 ++- libchimara/chimara-glk.c | 91 ++++++++++++++++++++------------ libchimara/chimara-glk.h | 1 - libchimara/garglk.c | 1 + libchimara/hyperlink.c | 1 + libchimara/stream.c | 37 ++++++++----- libchimara/stream.h | 2 + libchimara/style.c | 8 ++- libchimara/style.h | 7 --- libchimara/window.c | 33 ++++++++---- libchimara/window.h | 3 ++ 12 files changed, 130 insertions(+), 72 deletions(-) diff --git a/libchimara/abort.c b/libchimara/abort.c index 517dec5..8399f05 100644 --- a/libchimara/abort.c +++ b/libchimara/abort.c @@ -4,6 +4,7 @@ #include #include "chimara-glk-private.h" +#include "window.h" extern GPrivate *glk_data_key; @@ -66,9 +67,6 @@ shutdown_glk(void) { ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); - if(!glk_data->in_startup) - g_signal_emit_by_name(glk_data->self, "stopped"); - /* Stop any timers */ glk_request_timer_events(0); @@ -110,5 +108,11 @@ shutdown_glk(void) g_cond_wait(glk_data->rearranged, glk_data->arrange_lock); g_mutex_unlock(glk_data->arrange_lock); - chimara_glk_reset(glk_data->self); + /* Default handler for 'stopped' unloads the plugin, so be absolutely sure + we're not calling any dispatch callbacks after this point */ + if(!glk_data->in_startup) + g_signal_emit_by_name(glk_data->self, "stopped"); + + _chimara_glk_free_nonwindow_private_data(glk_data); + glk_data->needs_reset = TRUE; } diff --git a/libchimara/chimara-glk-private.h b/libchimara/chimara-glk-private.h index 33e8ebf..b3c9085 100644 --- a/libchimara/chimara-glk-private.h +++ b/libchimara/chimara-glk-private.h @@ -83,6 +83,8 @@ struct _ChimaraGlkPrivate { void (*unregister_arr)(void *, glui32, char *, gidispatch_rock_t); /* Have styles been initialized */ gboolean style_initialized; + /* Is widget still displaying windows from last run */ + gboolean needs_reset; /* *** Platform-dependent Glk library data *** */ /* Flag for functions to find out if they are being called from startup code */ @@ -93,7 +95,9 @@ struct _ChimaraGlkPrivate { #define CHIMARA_GLK_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHIMARA_TYPE_GLK, ChimaraGlkPrivate)) #define CHIMARA_GLK_USE_PRIVATE(o, n) ChimaraGlkPrivate *n = CHIMARA_GLK_PRIVATE(o) - + +G_GNUC_INTERNAL void _chimara_glk_free_nonwindow_private_data(ChimaraGlkPrivate *self); + G_END_DECLS #endif /* __CHIMARA_GLK_PRIVATE_H__ */ diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index f62c1be..0fabb39 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -11,10 +11,12 @@ #include "chimara-marshallers.h" #include "glk.h" #include "abort.h" +#include "stream.h" #include "window.h" #include "glkstart.h" #include "glkunix.h" #include "init.h" +#include "magic.h" #define CHIMARA_GLK_MIN_WIDTH 0 #define CHIMARA_GLK_MIN_HEIGHT 0 @@ -109,6 +111,7 @@ chimara_glk_init(ChimaraGlk *self) priv->stream_list = NULL; priv->timer_id = 0; priv->style_initialized = FALSE; + priv->needs_reset = FALSE; priv->in_startup = FALSE; priv->current_dir = NULL; } @@ -167,11 +170,9 @@ chimara_glk_get_property(GObject *object, guint prop_id, GValue *value, GParamSp } } -static void -chimara_glk_free_private_data(ChimaraGlk *self) +void +_chimara_glk_free_nonwindow_private_data(ChimaraGlkPrivate *priv) { - ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(self); - /* Free the event queue */ g_mutex_lock(priv->event_lock); g_queue_foreach(priv->event_queue, (GFunc)g_free, NULL); @@ -189,13 +190,6 @@ chimara_glk_free_private_data(ChimaraGlk *self) g_mutex_free(priv->abort_lock); priv->abort_lock = NULL; - /* Free the window arrangement signaling */ - g_mutex_lock(priv->arrange_lock); - g_cond_free(priv->rearranged); - g_mutex_unlock(priv->arrange_lock); - g_mutex_free(priv->arrange_lock); - priv->arrange_lock = NULL; - /* Unref input queues */ g_async_queue_unref(priv->char_input_queue); g_async_queue_unref(priv->line_input_queue); @@ -210,29 +204,58 @@ chimara_glk_free_private_data(ChimaraGlk *self) g_hash_table_destroy(priv->current_styles->text_buffer); g_hash_table_destroy(priv->current_styles->text_grid); } - + +/* Internal function: main thread version of destroy_windows_below, only more + DESTRUCTO-MATIC! */ static void -chimara_glk_finalize(GObject *object) +trash_windows_recursive(ChimaraGlkPrivate *priv, winid_t win) { - ChimaraGlk *self = CHIMARA_GLK(object); - chimara_glk_free_private_data(self); + switch(win->type) + { + case wintype_Blank: + case wintype_TextGrid: + case wintype_TextBuffer: + gtk_widget_unparent(win->frame); + break; - G_OBJECT_CLASS(chimara_glk_parent_class)->finalize(object); + case wintype_Pair: + trash_windows_recursive(priv, win->window_node->children->data); + trash_windows_recursive(priv, win->window_node->children->next->data); + break; + + default: + ILLEGAL_PARAM("Unknown window type: %u", win->type); + return; + } + trash_stream_thread_independent(priv, win->window_stream); + trash_window_thread_independent(priv, win); } -/** - * chimara_glk_reset: - * @self: The ChimaraGLK widget to reset - * - * Resets the widget back to it's origional state. IE: it resets all the private data. - */ void -chimara_glk_reset(ChimaraGlk *self) +_chimara_glk_free_window_private_data(ChimaraGlkPrivate *priv) { - chimara_glk_free_private_data(self); - chimara_glk_init(self); + /* Destroy the window tree */ + trash_windows_recursive(priv, priv->root_window->data); + g_node_destroy(priv->root_window); + + /* Free the window arrangement signaling */ + g_mutex_lock(priv->arrange_lock); + g_cond_free(priv->rearranged); + g_mutex_unlock(priv->arrange_lock); + g_mutex_free(priv->arrange_lock); + priv->arrange_lock = NULL; } +static void +chimara_glk_finalize(GObject *object) +{ + ChimaraGlk *self = CHIMARA_GLK(object); + CHIMARA_GLK_USE_PRIVATE(self, priv); + _chimara_glk_free_nonwindow_private_data(priv); + _chimara_glk_free_window_private_data(priv); + + G_OBJECT_CLASS(chimara_glk_parent_class)->finalize(object); +} /* Internal function: Recursively get the Glk window tree's size request */ static void @@ -648,7 +671,7 @@ chimara_glk_class_init(ChimaraGlkClass *klass) * it ended normally, or was interrupted. */ chimara_glk_signals[STOPPED] = g_signal_new("stopped", - G_OBJECT_CLASS_TYPE(klass), 0, + G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST, /* FIXME: Should be G_SIGNAL_RUN_CLEANUP but that segfaults??! */ G_STRUCT_OFFSET(ChimaraGlkClass, stopped), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -659,7 +682,7 @@ chimara_glk_class_init(ChimaraGlkClass *klass) * Emitted when a Glk program starts executing in the widget. */ chimara_glk_signals[STARTED] = g_signal_new ("started", - G_OBJECT_CLASS_TYPE(klass), 0, + G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(ChimaraGlkClass, started), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); /** @@ -1095,12 +1118,7 @@ glk_enter(struct StartupData *startup) /* Run main function */ g_signal_emit_by_name(startup->glk_data->self, "started"); - /* FIXME: hack. should be done by the signal above but for some reason - * this doesn't work */ - chimara_glk_started(startup->glk_data->self); - (startup->glk_main)(); - g_signal_emit_by_name(startup->glk_data->self, "stopped"); /* FIXME: hack. should be done by the signal above but for some reason * this doesn't work */ @@ -1138,7 +1156,14 @@ chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GE ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk); struct StartupData *startup = g_slice_new0(struct StartupData); - + + /* If anything was left over from the previous run, destroy it */ + if(priv->needs_reset) { + _chimara_glk_free_window_private_data(priv); + priv->needs_reset = FALSE; + chimara_glk_init(glk); + } + /* Open the module to run */ g_assert( g_module_supported() ); priv->program = g_module_open(plugin, G_MODULE_BIND_LAZY); diff --git a/libchimara/chimara-glk.h b/libchimara/chimara-glk.h index 8713efe..dfa669e 100644 --- a/libchimara/chimara-glk.h +++ b/libchimara/chimara-glk.h @@ -96,7 +96,6 @@ void chimara_glk_wait(ChimaraGlk *glk); gboolean chimara_glk_get_running(ChimaraGlk *glk); void chimara_glk_feed_char_input(ChimaraGlk *glk, guint32 keycode); void chimara_glk_feed_line_input(ChimaraGlk *glk, const gchar *text); -void chimara_glk_reset(ChimaraGlk *self); G_END_DECLS diff --git a/libchimara/garglk.c b/libchimara/garglk.c index 1a76bd7..5e80168 100644 --- a/libchimara/garglk.c +++ b/libchimara/garglk.c @@ -1,5 +1,6 @@ #include #include "chimara-glk-private.h" +#include "stream.h" extern GPrivate *glk_data_key; diff --git a/libchimara/hyperlink.c b/libchimara/hyperlink.c index 7d4be65..e58f981 100644 --- a/libchimara/hyperlink.c +++ b/libchimara/hyperlink.c @@ -1,5 +1,6 @@ #include "hyperlink.h" #include "chimara-glk-private.h" +#include "magic.h" extern GPrivate *glk_data_key; diff --git a/libchimara/stream.c b/libchimara/stream.c index a7f991d..f6abec6 100644 --- a/libchimara/stream.c +++ b/libchimara/stream.c @@ -28,25 +28,28 @@ stream_new_common(glui32 rock) return str; } -/* Internal function: Stuff to do upon closing any type of stream. */ +/* Internal function: stream closing stuff that is safe to call from either the + main thread or the Glk thread. */ void -stream_close_common(strid_t str, stream_result_t *result) +trash_stream_thread_independent(ChimaraGlkPrivate *glk_data, strid_t str) { - ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); - /* Remove the stream from the global stream list */ glk_data->stream_list = g_list_delete_link(glk_data->stream_list, str->stream_list); /* If it was the current output stream, set that to NULL */ if(glk_data->current_stream == str) glk_data->current_stream = NULL; - - /* If it was one or more windows' echo streams, set those to NULL */ - winid_t win; - for(win = glk_window_iterate(NULL, NULL); win; - win = glk_window_iterate(win, NULL)) - if(win->echo_stream == str) - win->echo_stream = NULL; + + str->magic = MAGIC_FREE; + g_free(str); +} + +/* Internal function: Stuff to do upon closing any type of stream. Call only + from Glk thread. */ +void +stream_close_common(strid_t str, stream_result_t *result) +{ + ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); if(glk_data->unregister_obj) { @@ -54,15 +57,21 @@ stream_close_common(strid_t str, stream_result_t *result) str->disprock.ptr = NULL; } + /* If the stream was one or more windows' echo streams, set those to NULL */ + winid_t win; + for(win = glk_window_iterate(NULL, NULL); win; + win = glk_window_iterate(win, NULL)) + if(win->echo_stream == str) + win->echo_stream = NULL; + /* Return the character counts */ if(result) { result->readcount = str->read_count; result->writecount = str->write_count; } - - str->magic = MAGIC_FREE; - g_free(str); + + trash_stream_thread_independent(glk_data, str); } /** diff --git a/libchimara/stream.h b/libchimara/stream.h index 193da47..87b8b7a 100644 --- a/libchimara/stream.h +++ b/libchimara/stream.h @@ -2,6 +2,7 @@ #define STREAM_H #include +#include "chimara-glk-private.h" #include "glk.h" #include "gi_dispa.h" #include "window.h" @@ -55,5 +56,6 @@ struct glk_stream_struct G_GNUC_INTERNAL strid_t file_stream_new(frefid_t fileref, glui32 fmode, glui32 rock, gboolean unicode); G_GNUC_INTERNAL strid_t stream_new_common(glui32 rock); G_GNUC_INTERNAL void stream_close_common(strid_t str, stream_result_t *result); +G_GNUC_INTERNAL void trash_stream_thread_independent(ChimaraGlkPrivate *glk_data, strid_t str); #endif diff --git a/libchimara/style.c b/libchimara/style.c index 4a6b511..af371d1 100644 --- a/libchimara/style.c +++ b/libchimara/style.c @@ -1,6 +1,12 @@ -#include "style.h" #include #include +#include +#include "chimara-glk-private.h" +#include "glk.h" +#include "style.h" +#include "magic.h" +#include "stream.h" +#include "strio.h" extern GPrivate *glk_data_key; diff --git a/libchimara/style.h b/libchimara/style.h index 8d7c69e..2b8afe3 100644 --- a/libchimara/style.h +++ b/libchimara/style.h @@ -3,13 +3,6 @@ #include #include -#include -#include -#include "glk.h" -#include "magic.h" -#include "chimara-glk-private.h" -#include "stream.h" -#include "strio.h" G_GNUC_INTERNAL void style_init_textbuffer(GtkTextBuffer *buffer); G_GNUC_INTERNAL void style_init_textgrid(GtkTextBuffer *buffer); diff --git a/libchimara/window.c b/libchimara/window.c index 5cef17e..31b157f 100644 --- a/libchimara/window.c +++ b/libchimara/window.c @@ -41,28 +41,39 @@ window_new_common(glui32 rock) return win; } +/* Internal function: window closing stuff that is safe to call from either the + main thread or the Glk thread. */ +void +trash_window_thread_independent(ChimaraGlkPrivate *glk_data, winid_t win) +{ + win->magic = MAGIC_FREE; + + g_list_foreach(win->history, (GFunc)g_free, NULL); + g_list_free(win->history); + + g_string_free(win->buffer, TRUE); + g_hash_table_destroy(win->hyperlinks); + g_free(win->current_hyperlink); + g_free(win); +} + +/* Internal function: do all the stuff necessary to close a window. Call only + from Glk thread. */ static void window_close_common(winid_t win, gboolean destroy_node) { ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); - + if(glk_data->unregister_obj) { (*glk_data->unregister_obj)(win, gidisp_Class_Window, win->disprock); win->disprock.ptr = NULL; } - + if(destroy_node) g_node_destroy(win->window_node); - win->magic = MAGIC_FREE; - - g_list_foreach(win->history, (GFunc)g_free, NULL); - g_list_free(win->history); - - g_string_free(win->buffer, TRUE); - g_hash_table_destroy(win->hyperlinks); - g_free(win->current_hyperlink); - g_free(win); + + trash_window_thread_independent(glk_data, win); } /** diff --git a/libchimara/window.h b/libchimara/window.h index e0222b0..845550e 100644 --- a/libchimara/window.h +++ b/libchimara/window.h @@ -2,6 +2,7 @@ #define WINDOW_H #include +#include "chimara-glk-private.h" #include "glk.h" #include "gi_dispa.h" #include "stream.h" @@ -78,4 +79,6 @@ struct glk_window_struct struct hyperlink *current_hyperlink; }; +G_GNUC_INTERNAL void trash_window_thread_independent(ChimaraGlkPrivate *glk_data, winid_t win); + #endif -- 2.30.2 From 224e54373b084f5246e19abebb7e9a6337798918 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 3 Dec 2009 21:00:31 +0000 Subject: [PATCH 12/16] Improved Glulxercise test program git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@197 ddfedd41-794f-dd11-ae45-00112f111e67 --- tests/glulxercise.c | 18 +++++++++++------- tests/glulxercise.ui | 4 +--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/glulxercise.c b/tests/glulxercise.c index 6d4b21f..a389d89 100644 --- a/tests/glulxercise.c +++ b/tests/glulxercise.c @@ -9,13 +9,6 @@ typedef struct { GtkWidget *window, *test_picker, *go, *stop, *interp; } Widgets; -gboolean -on_window_delete_event() -{ - gtk_main_quit(); - return TRUE; -} - void on_go_clicked(GtkButton *go, Widgets *w) { @@ -36,7 +29,11 @@ on_go_clicked(GtkButton *go, Widgets *w) gtk_main_quit(); } g_free(fullpath); +} +void +on_interp_started(ChimaraGlk *glk, Widgets *w) +{ gtk_widget_set_sensitive(w->go, FALSE); gtk_widget_set_sensitive(w->stop, TRUE); gtk_widget_set_sensitive(w->test_picker, FALSE); @@ -47,7 +44,11 @@ on_stop_clicked(GtkButton *stop, Widgets *w) { chimara_glk_stop( CHIMARA_GLK(w->interp) ); chimara_glk_wait( CHIMARA_GLK(w->interp) ); +} +void +on_interp_stopped(ChimaraGlk *glk, Widgets *w) +{ gtk_widget_set_sensitive(w->stop, FALSE); gtk_widget_set_sensitive(w->go, TRUE); gtk_widget_set_sensitive(w->test_picker, TRUE); @@ -92,8 +93,11 @@ main(int argc, char *argv[]) w->go = LOAD_WIDGET("go"); w->stop = LOAD_WIDGET("stop"); w->interp = chimara_if_new(); + gtk_widget_set_size_request(w->interp, 500, 600); gtk_box_pack_end_defaults(GTK_BOX(vbox), w->interp); gtk_builder_connect_signals(builder, w); + g_signal_connect(w->interp, "started", G_CALLBACK(on_interp_started), w); + g_signal_connect(w->interp, "stopped", G_CALLBACK(on_interp_stopped), w); gtk_widget_show_all(w->window); gdk_threads_enter(); diff --git a/tests/glulxercise.ui b/tests/glulxercise.ui index 348f44d..934e677 100644 --- a/tests/glulxercise.ui +++ b/tests/glulxercise.ui @@ -3,10 +3,8 @@ - 500 - 600 6 - + True -- 2.30.2 From 5d29fc8d5b231c0390f8a4cbebec97c7a51b8f69 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 3 Dec 2009 22:04:26 +0000 Subject: [PATCH 13/16] Bug fixes git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@198 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/chimara-glk.c | 12 ++++++++++-- tests/glulxercise.c | 7 +++++++ tests/glulxercise.ui | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index 0fabb39..93f95c7 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -235,8 +235,10 @@ void _chimara_glk_free_window_private_data(ChimaraGlkPrivate *priv) { /* Destroy the window tree */ - trash_windows_recursive(priv, priv->root_window->data); - g_node_destroy(priv->root_window); + if(priv->root_window) { + trash_windows_recursive(priv, priv->root_window->data); + g_node_destroy(priv->root_window); + } /* Free the window arrangement signaling */ g_mutex_lock(priv->arrange_lock); @@ -244,6 +246,12 @@ _chimara_glk_free_window_private_data(ChimaraGlkPrivate *priv) g_mutex_unlock(priv->arrange_lock); g_mutex_free(priv->arrange_lock); priv->arrange_lock = NULL; + + /* Remove the dispatch callbacks */ + priv->register_obj = NULL; + priv->unregister_obj = NULL; + priv->register_arr = NULL; + priv->unregister_arr = NULL; } static void diff --git a/tests/glulxercise.c b/tests/glulxercise.c index a389d89..b5d3513 100644 --- a/tests/glulxercise.c +++ b/tests/glulxercise.c @@ -9,6 +9,13 @@ typedef struct { GtkWidget *window, *test_picker, *go, *stop, *interp; } Widgets; +gboolean +on_window_delete_event() +{ + gtk_main_quit(); + return TRUE; +} + void on_go_clicked(GtkButton *go, Widgets *w) { diff --git a/tests/glulxercise.ui b/tests/glulxercise.ui index 934e677..5ca17ae 100644 --- a/tests/glulxercise.ui +++ b/tests/glulxercise.ui @@ -4,7 +4,7 @@ 6 - + True -- 2.30.2 From d35cfd7f0ed4319b838c1efc79d7924fea3d663c Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 4 Dec 2009 23:19:12 +0000 Subject: [PATCH 14/16] Mended rpmlint warnings git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@199 ddfedd41-794f-dd11-ae45-00112f111e67 --- Makefile.am | 3 +-- chimara.spec.in | 44 +++++++++++++++++++++++++++++++------------- configure.ac | 3 --- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index ac912e7..846e053 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,13 +3,12 @@ SUBDIRS = libchimara interpreters tests docs po player -chimaradocdir = ${prefix}/doc/chimara +chimaradocdir = $(datadir)/doc/chimara dist_chimaradoc_DATA = \ README\ COPYING\ AUTHORS\ ChangeLog\ - INSTALL\ NEWS pkgconfigdir = $(libdir)/pkgconfig diff --git a/chimara.spec.in b/chimara.spec.in index fbde406..9f0712a 100644 --- a/chimara.spec.in +++ b/chimara.spec.in @@ -5,10 +5,8 @@ Name: @PACKAGE_TARNAME@ Version: @PACKAGE_VERSION@ -Release: @RPM_RELEASE@%{?dist} +Release: 1%{?dist} Summary: A GTK+ widget implementation of the Glk library - -Packager: P. F. Chimento URL: http://lassie.student.utwente.nl/chimara/ License: MIT @@ -19,6 +17,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: glib2 >= @GLIB_REQUIRED_VERSION@ Requires: gtk2 >= @GTK_REQUIRED_VERSION@ Requires: pango +Requires(post): info +Requires(preun): info BuildRequires: bison # byacc is allowed instead of bison, but stoopid RPM doesn't let you specify alternative pkgs BuildRequires: perl gettext libtool pkgconfig intltool @@ -42,12 +42,12 @@ developing applications that use %{name}. %package player Summary: The default IF player using %{name} -Group: Games +Group: Amusements/Games Requires: %{name} = %{version}-%{release} %description player -The %{name}-player package contains the default interactive fiction player using %{name}. -developing applications that use %{name}. +The %{name}-player package contains the default interactive fiction player +using %{name}. %prep %setup -q @@ -60,22 +60,30 @@ make %{?_smp_mflags} rm -rf $RPM_BUILD_ROOT %makeinstall find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' +rm -f $RPM_BUILD_ROOT/usr/share/info/dir %clean rm -rf $RPM_BUILD_ROOT -%post -p /sbin/ldconfig +%post +/sbin/ldconfig +/sbin/install-info %{_infodir}/nitfol.info %{_infodir}/dir || : + +%preun +if [ $1 = 0 ] ; then + /sbin/install-info --delete %{_infodir}/nitfol.info %{_infodir}/dir || : +fi %postun -p /sbin/ldconfig %files -%define docdir %{_prefix}/doc -%define pkgdocdir %{_datadir}/doc/chimara %defattr(-,root,root,-) -%doc %{docdir}/chimara/* -%doc %{_infodir}/* -%doc %{pkgdocdir}/* -%{_libdir}/libchimara.* +%doc %{_datadir}/doc/chimara/frotz/* +%doc %{_datadir}/doc/chimara/git/* +%doc %{_datadir}/doc/chimara/glulxe/* +%doc %{_datadir}/doc/chimara/nitfol/* +%doc %{_infodir}/*.info* +%{_libdir}/libchimara.so.* %{_libdir}/chimara/*.so %{_datadir}/*.ui %{_datadir}/*.menus @@ -84,12 +92,22 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root,-) %doc %{_datadir}/gtk-doc/html/* %{_includedir}/chimara/libchimara/*.h +%{_libdir}/libchimara.so %{_libdir}/pkgconfig/*.pc %files player +%defattr(-,root,root,-) +%doc %{_datadir}/doc/chimara/README +%doc %{_datadir}/doc/chimara/COPYING +%doc %{_datadir}/doc/chimara/AUTHORS +%doc %{_datadir}/doc/chimara/ChangeLog +%doc %{_datadir}/doc/chimara/NEWS %{_bindir}/chimara %changelog +* Fri Dec 4 2009 P. F. Chimento +- 0.1-1 +- Mended rpmlint warnings and errors. * Mon Nov 30 2009 W. M. van Vliet - Added Chimara player to the package. * Wed Nov 25 2009 P. F. Chimento diff --git a/configure.ac b/configure.ac index 787fef9..ef5267a 100644 --- a/configure.ac +++ b/configure.ac @@ -102,9 +102,6 @@ AC_ARG_ENABLE([rpm], [rpm=false] ) AM_CONDITIONAL([BUILDING_RPM], [$TEST "x$rpm" = xtrue]) -# The user can specify the RPM release number in the environment (e.g. '1') -AC_ARG_VAR([RPM_RELEASE], [Release number to build RPMs with [1]]) -AS_IF([$TEST "x$RPM_RELEASE" = x], [RPM_RELEASE=1]) ### CHECK FOR LIBRARIES ####################################################### -- 2.30.2 From 17139812a5057981d2b7a0d171b679449717fdf4 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 4 Dec 2009 23:50:04 +0000 Subject: [PATCH 15/16] Don't install test plugins Install player data files in player package Don't build player in both player and tests directories git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@200 ddfedd41-794f-dd11-ae45-00112f111e67 --- chimara.spec.in | 5 ++-- debian/libchimara-player.install | 2 ++ player/Makefile.am | 4 +-- tests/Makefile.am | 46 +++++++++++--------------------- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/chimara.spec.in b/chimara.spec.in index 9f0712a..951f7d3 100644 --- a/chimara.spec.in +++ b/chimara.spec.in @@ -85,8 +85,6 @@ fi %doc %{_infodir}/*.info* %{_libdir}/libchimara.so.* %{_libdir}/chimara/*.so -%{_datadir}/*.ui -%{_datadir}/*.menus %files devel %defattr(-,root,root,-) @@ -103,11 +101,14 @@ fi %doc %{_datadir}/doc/chimara/ChangeLog %doc %{_datadir}/doc/chimara/NEWS %{_bindir}/chimara +%{_pkgdatadir}/chimara.ui +%{_pkgdatadir}/chimara.menus %changelog * Fri Dec 4 2009 P. F. Chimento - 0.1-1 - Mended rpmlint warnings and errors. +- Moved player data files to player package. * Mon Nov 30 2009 W. M. van Vliet - Added Chimara player to the package. * Wed Nov 25 2009 P. F. Chimento diff --git a/debian/libchimara-player.install b/debian/libchimara-player.install index 0e4f65a..1a09ec8 100644 --- a/debian/libchimara-player.install +++ b/debian/libchimara-player.install @@ -1 +1,3 @@ debian/tmp/usr/bin/chimara +debian/tmp/usr/share/chimara/chimara.ui +debian/tmp/usr/share/chimara/chimara.menus \ No newline at end of file diff --git a/player/Makefile.am b/player/Makefile.am index af25af5..fab8341 100644 --- a/player/Makefile.am +++ b/player/Makefile.am @@ -13,14 +13,14 @@ bin_PROGRAMS = chimara_iliad else -dist_data_DATA = chimara.ui chimara.menus +dist_pkgdata_DATA = chimara.ui chimara.menus bin_PROGRAMS = chimara chimara_SOURCES = main.c callbacks.c error.c error.h chimara_CPPFLAGS = $(AM_CPPFLAGS) \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ - -DPACKAGE_DATA_DIR=\""$(datadir)"\" + -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" chimara_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) chimara_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la diff --git a/tests/Makefile.am b/tests/Makefile.am index 1849437..b915c48 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,28 +1,16 @@ AM_CFLAGS = -Wall AM_CPPFLAGS = -I$(top_srcdir) -PLUGIN_LIBTOOL_FLAGS=-module -avoid-version -export-symbols-regex "^glk_main$$" +# The rpath is necessary because stoopid libtool won't build a shared library +# if it's noinst_, because what POSSIBLE reason could you have to do that? +TEST_PLUGIN_LIBTOOL_FLAGS = \ + -module \ + -shared \ + -avoid-version \ + -export-symbols-regex "^glk_main$$" \ + -rpath $(abs_builddir) -if TARGET_ILIAD - -iliad_SOURCES = iliad.c -iliad_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) -iliad_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la - -noinst_PROGRAMS = iliad - -else - -dist_data_DATA = chimara.ui chimara.menus glulxercise.ui -noinst_PROGRAMS = test-chimara test-multisession glulxercise plugin-loader - -test_chimara_SOURCES = main.c callbacks.c error.c error.h -test_chimara_CPPFLAGS = $(AM_CPPFLAGS) \ - -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ - -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ - -DPACKAGE_DATA_DIR=\""$(datadir)"\" -test_chimara_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) -test_chimara_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la +noinst_PROGRAMS = test-multisession glulxercise plugin-loader test_multisession_SOURCES = test-multisession.c test_multisession_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) @@ -37,24 +25,22 @@ plugin_loader_SOURCES = plugin-loader.c plugin_loader_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) plugin_loader_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la -pkglib_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la styletest.la +noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la styletest.la first_la_SOURCES = first.c -first_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) +first_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) model_la_SOURCES = model.c -model_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) +model_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) gridtest_la_SOURCES = gridtest.c -gridtest_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) +gridtest_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) splittest_la_SOURCES = splittest.c -splittest_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) +splittest_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) multiwin_la_SOURCES = multiwin.c -multiwin_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) +multiwin_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) styletest_la_SOURCES = styletest.c -styletest_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) - -endif +styletest_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) -- 2.30.2 From 3d231460ccf8a570d0ad99152a0181af50f5786f Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Sat, 5 Dec 2009 00:11:45 +0000 Subject: [PATCH 16/16] Require intltool 0.40.0 and update intltool files git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@201 ddfedd41-794f-dd11-ae45-00112f111e67 --- Makefile.am | 8 +++----- autogen.sh | 4 ---- configure.ac | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 846e053..445af84 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to produce Makefile.in ## Created by Anjuta -SUBDIRS = libchimara interpreters tests docs po player +SUBDIRS = libchimara interpreters player tests docs po chimaradocdir = $(datadir)/doc/chimara dist_chimaradoc_DATA = \ @@ -14,11 +14,9 @@ dist_chimaradoc_DATA = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = chimara.pc chimara-plugin.pc -EXTRA_DIST = intltool-extract.in intltool-merge.in intltool-update.in \ - chimara.pc.in chimara-plugin.pc.in chimara.spec.in +EXTRA_DIST = chimara.pc.in chimara-plugin.pc.in chimara.spec.in -DISTCLEANFILES = chimara.pc chimara-plugin.pc chimara.spec \ - intltool-extract intltool-merge intltool-update +DISTCLEANFILES = chimara.pc chimara-plugin.pc chimara.spec ACLOCAL_AMFLAGS = -I m4 diff --git a/autogen.sh b/autogen.sh index 9c061ca..6556cd8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -19,8 +19,4 @@ autoreconf --force --install || exit 1 # Run after autopoint echo "Setting up Intltool" intltoolize --copy --force --automake || exit 1 -# Hack to get intltool 0.40.0 to work (Debian stable) -touch intltool-extract.in -touch intltool-merge.in -touch intltool-update.in diff --git a/configure.ac b/configure.ac index ef5267a..9b0ebb0 100644 --- a/configure.ac +++ b/configure.ac @@ -50,7 +50,7 @@ LT_INIT # Libtool 2.2.6 and up #LT_PREREQ([2.2.6]) # ...goddamn Debian still has 1.5 AC_PROG_LIBTOOL # Old way of declaring Libtool AM_GNU_GETTEXT([external]) # Gettext, link to system libintl -IT_PROG_INTLTOOL # Intltool +IT_PROG_INTLTOOL([0.40.0]) # Intltool PKG_PROG_PKG_CONFIG # pkg_config GTK_DOC_CHECK($GTK_DOC_REQUIRED_VERSION) # Other utilities used in this package's various make scripts -- 2.30.2