Automatic generation of VAPI file
authorPhilip Chimento <philip.chimento@gmail.com>
Wed, 18 Jan 2012 16:38:24 +0000 (17:38 +0100)
committerPhilip Chimento <philip.chimento@gmail.com>
Wed, 18 Jan 2012 16:38:24 +0000 (17:38 +0100)
The bugs in vapigen seem to have been worked out.

configure.ac
libchimara/Makefile.am
libchimara/chimara-glk.h
libchimara/chimara-if.h
libchimara/chimara.vapi [deleted file]

index fa284e1051ccfc0ed7e6a23b9497f095833dbe43..4b63d120c8e51a996573abca339be201246142f9 100644 (file)
@@ -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
index 2496948200c121a06fc1f64141d04d1625c29450..e823694e3fccf135addf1825511de42a9e99bd09 100644 (file)
@@ -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
index b3ea8b86002db3d8bfcaac774929217eaf3898db..8001adafbfdb3f40ccc0ce4101bb8fc971e8ba12 100644 (file)
@@ -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);
index 3bbe06ac7e0b2fd16d10976a6adccd9b3b47151a..72d64610346542555c9b68407b1d04f39cb833ea 100644 (file)
@@ -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 (file)
index 7b014d8..0000000
+++ /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 ();
-}