From 3f6125ead6dc379f08f38419b5da97555330816f Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 18 Jan 2012 17:38:24 +0100 Subject: [PATCH] Automatic generation of VAPI file The bugs in vapigen seem to have been worked out. --- configure.ac | 5 ++ libchimara/Makefile.am | 8 ++- libchimara/chimara-glk.h | 4 +- libchimara/chimara-if.h | 10 +-- libchimara/chimara.vapi | 138 --------------------------------------- 5 files changed, 18 insertions(+), 147 deletions(-) delete mode 100644 libchimara/chimara.vapi diff --git a/configure.ac b/configure.ac index fa284e1..4b63d12 100644 --- a/configure.ac +++ b/configure.ac @@ -120,6 +120,11 @@ AS_IF([$TEST "x$with_gstreamer" != xno], [AC_DEFINE([GSTREAMER_SOUND], [1], [Define to enable sound support with GStreamer]) SOUND_MODULE="gstreamer-0.10 >= 0.10.12"]) +### WHETHER TO GENERATE A .VAPI FILE ########################################## +# Requires vapigen +AC_PATH_PROG([VAPIGEN], [vapigen], [notfound]) +AM_CONDITIONAL(BUILDING_VAPI, $TEST "x$VAPIGEN" != xnotfound) + ### CHECK FOR LIBRARIES ####################################################### # Libraries needed to build Chimara library diff --git a/libchimara/Makefile.am b/libchimara/Makefile.am index 2496948..e823694 100644 --- a/libchimara/Makefile.am +++ b/libchimara/Makefile.am @@ -105,9 +105,13 @@ CLEANFILES += $(gir_DATA) $(typelib_DATA) endif GITIGNOREFILES = Chimara-1.0.gir Chimara-1.0.typelib -# Currently, install the Vala VAPI file statically - generation is broken? - vapidir = $(datadir)/vala/vapi dist_vapi_DATA = chimara.vapi +if BUILDING_VAPI +chimara.vapi: Chimara-1.0.gir + $(AM_V_GEN)$(VAPIGEN) --library=chimara --pkg gtk+-2.0 Chimara-1.0.gir +endif + +MAINTAINERCLEANFILES = chimara.vapi -include $(top_srcdir)/git.mk diff --git a/libchimara/chimara-glk.h b/libchimara/chimara-glk.h index b3ea8b8..8001ada 100644 --- a/libchimara/chimara-glk.h +++ b/libchimara/chimara-glk.h @@ -21,13 +21,13 @@ G_BEGIN_DECLS * * This structure contains no public members. */ -typedef struct _ChimaraGlk { +typedef struct { GtkContainer parent_instance; /*< public >*/ } ChimaraGlk; -typedef struct _ChimaraGlkClass { +typedef struct { GtkContainerClass parent_class; /* Signals */ void(* stopped) (ChimaraGlk *self); diff --git a/libchimara/chimara-if.h b/libchimara/chimara-if.h index 3bbe06a..72d6461 100644 --- a/libchimara/chimara-if.h +++ b/libchimara/chimara-if.h @@ -24,7 +24,7 @@ G_BEGIN_DECLS * * Constants representing all game formats supported by the Chimara system. */ -typedef enum _ChimaraIFFormat { +typedef enum { /*< private >*/ CHIMARA_IF_FORMAT_NONE = -1, /*< public >*/ @@ -47,7 +47,7 @@ typedef enum _ChimaraIFFormat { * * Constants representing the available interpreter plugins. */ -typedef enum _ChimaraIFInterpreter { +typedef enum { /*< private >*/ CHIMARA_IF_INTERPRETER_NONE = -1, /*< public >*/ @@ -78,7 +78,7 @@ typedef enum _ChimaraIFInterpreter { * Allowed values for the #ChimaraIF:interpreter-number property. All trademarks * are the property of their respective owners. */ -typedef enum _ChimaraIFZmachineVersion { +typedef enum { CHIMARA_IF_ZMACHINE_DEFAULT = 0, CHIMARA_IF_ZMACHINE_DECSYSTEM_20, CHIMARA_IF_ZMACHINE_APPLE_IIE, @@ -100,13 +100,13 @@ typedef enum _ChimaraIFZmachineVersion { * * This structure contains no public members. */ -typedef struct _ChimaraIF { +typedef struct { ChimaraGlk parent_instance; /*< public >*/ } ChimaraIF; -typedef struct _ChimaraIFClass { +typedef struct { ChimaraGlkClass parent_class; /* Signals */ void(* command) (ChimaraIF *self, gchar *input, gchar *response); diff --git a/libchimara/chimara.vapi b/libchimara/chimara.vapi deleted file mode 100644 index 7b014d8..0000000 --- a/libchimara/chimara.vapi +++ /dev/null @@ -1,138 +0,0 @@ -/* chimara.vapi generated by vapigen, do not modify. */ - -[CCode (cprefix = "Chimara", lower_case_cprefix = "chimara_", gir_namespace = "Chimara", gir_version = "1.0")] -namespace Chimara { - [CCode (cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public class Glk : Gtk.Container, Atk.Implementor, Gtk.Buildable { - [CCode (type = "GtkWidget*", has_construct_function = false)] - public Glk (); - public void feed_char_input (uint32 keyval); - public void feed_line_input (string text); - public bool get_interactive (); - public bool get_protect (); - public bool get_running (); - public uint get_spacing (); - public unowned Gtk.TextTag get_tag (Chimara.GlkWindowType window, string name); - public unowned string[] get_tag_names (out uint num_tags); - public bool is_char_input_pending (); - public bool is_line_input_pending (); - public bool run (string plugin, int argc, string argv) throws GLib.Error; - public bool set_css_from_file (string filename) throws GLib.Error; - public void set_css_from_string (string css); - public void set_css_to_default (); - public void set_interactive (bool interactive); - public void set_protect (bool protect); - public void set_resource_load_callback (owned Chimara.ResourceLoadFunc func); - public void set_spacing (uint spacing); - public void stop (); - public void update_style (); - public void wait (); - public bool interactive { get; set construct; } - [NoAccessorMethod] - public string program_info { get; } - [NoAccessorMethod] - public string program_name { get; } - public bool protect { get; set construct; } - public uint spacing { get; set construct; } - [NoAccessorMethod] - public string story_name { get; } - public signal void char_input (uint object, uint p0); - public signal void iliad_screen_update (bool object); - public signal void line_input (uint object, string p0); - public signal void started (); - public signal void stopped (); - public signal void text_buffer_output (uint object, string p0); - public signal void waiting (); - } - [CCode (cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public class IF : Chimara.Glk, Atk.Implementor, Gtk.Buildable { - [CCode (type = "GtkWidget*", has_construct_function = false)] - public IF (); - public Chimara.IFFormat get_format (); - public Chimara.IFInterpreter get_interpreter (); - public Chimara.IFInterpreter get_preferred_interpreter (Chimara.IFFormat format); - public bool run_game (string gamefile) throws GLib.Error; - public void set_preferred_interpreter (Chimara.IFFormat format, Chimara.IFInterpreter interpreter); - [NoAccessorMethod] - public bool expand_abbreviations { get; set construct; } - [NoAccessorMethod] - public string graphics_file { get; set construct; } - [NoAccessorMethod] - public bool ignore_errors { get; set construct; } - [NoAccessorMethod] - public uint interpreter_number { get; set construct; } - [NoAccessorMethod] - public bool piracy_mode { get; set construct; } - [NoAccessorMethod] - public int random_seed { get; set; } - [NoAccessorMethod] - public bool random_seed_set { get; set construct; } - [NoAccessorMethod] - public bool tandy_bit { get; set construct; } - [NoAccessorMethod] - public bool typo_correction { get; set construct; } - public signal void command (string object, string p0); - } - [CCode (cprefix = "CHIMARA_GLK_TEXT_", cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public enum GlkWindowType { - BUFFER, - GRID - } - [CCode (cprefix = "CHIMARA_IF_FORMAT_", cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public enum IFFormat { - [CCode (cname = "CHIMARA_IF_FORMAT_Z5")] - FORMAT_Z5, - [CCode (cname = "CHIMARA_IF_FORMAT_Z6")] - FORMAT_Z6, - [CCode (cname = "CHIMARA_IF_FORMAT_Z8")] - FORMAT_Z8, - [CCode (cname = "CHIMARA_IF_FORMAT_Z_BLORB")] - FORMAT_Z_BLORB, - [CCode (cname = "CHIMARA_IF_FORMAT_GLULX")] - FORMAT_GLULX, - [CCode (cname = "CHIMARA_IF_FORMAT_GLULX_BLORB")] - FORMAT_GLULX_BLORB - } - [CCode (cprefix = "CHIMARA_IF_INTERPRETER_", cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public enum IFInterpreter { - [CCode (cname = "CHIMARA_IF_INTERPRETER_FROTZ")] - INTERPRETER_FROTZ, - [CCode (cname = "CHIMARA_IF_INTERPRETER_NITFOL")] - INTERPRETER_NITFOL, - [CCode (cname = "CHIMARA_IF_INTERPRETER_GLULXE")] - INTERPRETER_GLULXE, - [CCode (cname = "CHIMARA_IF_INTERPRETER_GIT")] - INTERPRETER_GIT - } - [CCode (cprefix = "CHIMARA_IF_ZMACHINE_", cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public enum IFZmachineVersion { - DEFAULT, - DECSYSTEM_20, - APPLE_IIE, - MACINTOSH, - AMIGA, - ATARI_ST, - IBM_PC, - COMMODORE_128, - COMMODORE_64, - APPLE_IIC, - APPLE_IIGS, - TANDY_COLOR - } - [CCode (cprefix = "CHIMARA_RESOURCE_", cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public enum ResourceType { - SOUND, - IMAGE - } - [CCode (cprefix = "ERROR_", cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public errordomain Error { - LOAD_MODULE_ERROR, - NO_GLK_MAIN, - PLUGIN_NOT_FOUND, - PLUGIN_ALREADY_RUNNING, - } - [CCode (cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h", instance_pos = 2.9)] - public delegate string ResourceLoadFunc (Chimara.ResourceType usage, uint32 resnum); - [CCode (cheader_filename = "libchimara/chimara-glk.h,libchimara/chimara-if.h")] - public static GLib.Quark error_quark (); -} -- 2.30.2