[valadoc] driver/0.13.x: Migrate to valac-master



commit 13a6cb65cd27c9e2332fe9f22e88bcf834a40102
Author: Florian Brosch <flo brosch gmail com>
Date:   Sat Aug 6 20:27:50 2011 +0200

    driver/0.13.x: Migrate to valac-master

 configure.in                       |   14 +++-
 src/driver/0.13.x/Makefile.am      |   11 ++-
 src/driver/0.13.x/treebuilder.vala |  155 +++++++++++++++++++++++++++++++----
 src/driver/Makefile.am             |    6 +-
 4 files changed, 160 insertions(+), 26 deletions(-)
---
diff --git a/configure.in b/configure.in
index c237fde..0fa3cd4 100755
--- a/configure.in
+++ b/configure.in
@@ -62,10 +62,16 @@ AC_SUBST(LIBGDKPIXBUF_LIBS)
 ## Drivers:
 ##
 
-PKG_CHECK_MODULES(LIBVALA_0_13, libvala-0.14 >= 0.13, have_libvala_0_13="yes", have_libvala_0_13="no")
-AM_CONDITIONAL(HAVE_LIBVALA_0_13, test "$have_libvala_0_13" = "yes")
-AC_SUBST(LIBVALA_0_13_CFLAGS)
-AC_SUBST(LIBVALA_0_13_LIBS)
+PKG_CHECK_MODULES(LIBVALA_0_13_X, libvala-0.14 >= 0.13.1, have_libvala_0_13_x="yes", have_libvala_0_13_x="no")
+AM_CONDITIONAL(HAVE_LIBVALA_0_13_X, test "$have_libvala_0_13_x" = "yes")
+AC_SUBST(LIBVALA_0_13_X_CFLAGS)
+AC_SUBST(LIBVALA_0_13_X_LIBS)
+
+
+PKG_CHECK_MODULES(LIBVALA_0_13_X, libvala-0.14 >= 0.13.0 libvala-0.14 <= 0.13.1, have_libvala_0_13_0_1="yes", have_libvala_0_13_0_1="no")
+AM_CONDITIONAL(HAVE_LIBVALA_0_13_0_1, test "$have_libvala_0_13_0_1" = "yes")
+AC_SUBST(LIBVALA_0_13_X_CFLAGS)
+AC_SUBST(LIBVALA_0_13_X_LIBS)
 
 
 PKG_CHECK_MODULES(LIBVALA_0_12, libvala-0.12 >= 0.12, have_libvala_0_12="yes", have_libvala_0_12="no")
diff --git a/src/driver/0.13.x/Makefile.am b/src/driver/0.13.x/Makefile.am
index 2aa8acc..c9d267f 100755
--- a/src/driver/0.13.x/Makefile.am
+++ b/src/driver/0.13.x/Makefile.am
@@ -1,12 +1,17 @@
 NULL =
 
 
+if HAVE_LIBVALA_0_13_X
+VALA_FLAGS = -D VALA_0_13_X
+endif
+
+
 AM_CFLAGS =  -g \
 	-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
 	-I ../../libvaladoc/ \
 	$(GLIB_CFLAGS) \
 	$(LIBGEE_CFLAGS) \
-	$(LIBVALA_0_13_CFLAGS) \
+	$(LIBVALA_0_13_X_CFLAGS) \
 	$(NULL)
 
 
@@ -41,14 +46,14 @@ libdriver_la_SOURCES =      \
 
 
 libdriver.vala.stamp: $(libdriver_la_VALASOURCES)
-	$(VALAC) -C --vapidir $(top_srcdir)/src/vapi --vapidir $(top_srcdir)/src/libvaladoc --pkg libvala-0.14 --pkg gee-1.0 --pkg valadoc-1.0 --basedir . $^
+	$(VALAC) $(VALA_FLAGS) -C --vapidir $(top_srcdir)/src/vapi --vapidir $(top_srcdir)/src/libvaladoc --pkg libvala-0.14 --pkg gee-1.0 --pkg valadoc-1.0 --basedir . $^
 	touch $@
 
 
 libdriver_la_LIBADD = \
 	../../libvaladoc/libvaladoc.la \
 	$(GLIB_LIBS) \
-	$(LIBVALA_0_13_LIBS) \
+	$(LIBVALA_0_13_X_LIBS) \
 	$(LIBGEE_LIBS) \
 	$(NULL)
 
diff --git a/src/driver/0.13.x/treebuilder.vala b/src/driver/0.13.x/treebuilder.vala
index fa49292..e93a864 100644
--- a/src/driver/0.13.x/treebuilder.vala
+++ b/src/driver/0.13.x/treebuilder.vala
@@ -182,6 +182,125 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 	// Translation helpers:
 	//
 
+	private string get_ccode_type_id (Vala.Class node) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_type_id (node);
+#else
+		return node.get_type_id ();
+#endif
+	}
+
+	private bool is_reference_counting (Vala.TypeSymbol sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.is_reference_counting (sym);
+#else
+		return sym.is_reference_counting ();
+#endif
+	}
+
+	private string get_ref_function (Vala.Class sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_ref_function (sym);
+#else
+		return sym.get_ref_function ();
+#endif
+	}
+
+	private string get_unref_function (Vala.Class sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
+#else
+		return sym.get_unref_function ();
+#endif
+	}
+
+	private string get_finish_name (Vala.Method m) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_finish_name (m);
+#else
+		return m.get_finish_cname ();
+#endif
+	}
+
+	private string get_take_value_function (Vala.Class sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_take_value_function (sym);
+#else
+		return sym.get_take_value_function ();
+#endif
+	}
+
+	private string get_get_value_function (Vala.Class sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_get_value_function (sym);
+#else
+		return sym.get_get_value_function ();
+#endif
+	}
+
+	private string get_set_value_function (Vala.Class sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_set_value_function (sym);
+#else
+		return sym.get_set_value_function ();
+#endif
+	}
+
+
+	private string get_param_spec_function (Vala.CodeNode sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_param_spec_function (sym);
+#else
+		return sym.get_param_spec_function ();
+#endif
+	}
+
+	private string? get_dup_function (Vala.TypeSymbol sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_dup_function (sym);
+#else
+		return sym.get_dup_function ();
+#endif
+	}
+
+	private string get_free_function (Vala.TypeSymbol sym) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_free_function (sym);
+#else
+		return sym.get_free_function ();
+#endif
+	}
+
+	private string get_nick (Vala.Property prop) {
+#if VALA_0_13_X
+		return prop.get_attribute_string ("Description", "nick") ?? prop.name.replace ("_", "-");
+#else
+		return prop.nick;
+#endif
+	}
+
+	private string? get_cname (Vala.Symbol symbol) {
+#if VALA_0_13_X
+		return Vala.CCodeBaseModule.get_ccode_name (symbol);
+#else
+		if (symbol is Vala.TypeSymbol) {
+			return ((Vala.TypeSymbol) symbol).get_cname ();
+		} else if (symbol is Vala.PropertyAccessor) {
+			return ((Vala.PropertyAccessor) symbol).get_cname ();
+		} else if (symbol is Vala.Method) {
+			return ((Vala.Signal) symbol).get_cname ();
+		} else if (symbol is Vala.Signal) {
+			return ((Vala.Method) symbol).get_cname ();
+		} else if (symbol is Vala.Constant) {
+			return ((Vala.Field) symbol).get_cname ();
+		} else if (symbol is Vala.Field) {
+			return ((Vala.Field) symbol).get_cname ();
+		} else {
+			assert_not_reached ();
+		}
+#endif
+	}
+
 	private SourceComment? create_comment (Vala.Comment? comment) {
 		if (comment != null) {
 			Vala.SourceReference pos = comment.source_reference;
@@ -339,7 +458,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 			}
 
 			// non ref counted types are weak, not unowned
-			if (element.data_type is Vala.TypeSymbol && ((Vala.TypeSymbol) element.data_type).is_reference_counting () == true) {
+			if (element.data_type is Vala.TypeSymbol && is_reference_counting ((Vala.TypeSymbol) element.data_type) == true) {
 				return false;
 			}
 
@@ -371,7 +490,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		}
 
 		// non ref counted types are unowned, not weak
-		if (element.data_type is Vala.TypeSymbol && ((Vala.TypeSymbol) element.data_type).is_reference_counting () == false) {
+		if (element.data_type is Vala.TypeSymbol && is_reference_counting ((Vala.TypeSymbol) element.data_type) == false) {
 			return false;
 		}
 
@@ -683,7 +802,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 
 		bool is_basic_type = element.base_class == null && element.name == "string";
 
-		Class node = new Class (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name (element), element.get_param_spec_function (), element.get_type_id (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+		Class node = new Class (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), get_param_spec_function (element), get_ccode_type_id (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -714,7 +833,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name (element), element);
+		Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -741,7 +860,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 
 		bool is_basic_type = element.base_type == null && (element.is_boolean_type () || element.is_floating_type () || element.is_integer_type ());
 
-		Struct node = new Struct (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), element.get_dup_function (), element.get_free_function (), is_basic_type, element);
+		Struct node = new Struct (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), get_dup_function (element), get_free_function (element), is_basic_type, element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -762,7 +881,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Field node = new Field (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), element.binding == Vala.MemberBinding.STATIC, element.is_volatile, element);
+		Field node = new Field (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element.binding == Vala.MemberBinding.STATIC, element.is_volatile, element);
 		node.field_type = create_type_reference (element.variable_type, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -778,7 +897,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Property node = new Property (parent, file, element.name, get_access_modifier(element), comment, element.nick, Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.is_dbus_visible (element), get_property_binding_type (element), element);
+		Property node = new Property (parent, file, element.name, get_access_modifier(element), comment, get_nick (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.is_dbus_visible (element), get_property_binding_type (element), element);
 		node.property_type = create_type_reference (element.property_type, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -786,12 +905,12 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		// Process property type
 		if (element.get_accessor != null) {
 			var accessor = element.get_accessor;
-			node.getter = new PropertyAccessor (node, file, element.name, get_access_modifier(element), accessor.get_cname(), get_property_accessor_type (accessor), get_property_ownership (accessor), accessor);
+			node.getter = new PropertyAccessor (node, file, element.name, get_access_modifier(element), get_cname (element), get_property_accessor_type (accessor), get_property_ownership (accessor), accessor);
 		}
 
 		if (element.set_accessor != null) {
 			var accessor = element.set_accessor;
-			node.setter = new PropertyAccessor (node, file, element.name, get_access_modifier(element), accessor.get_cname(), get_property_accessor_type (accessor), get_property_ownership (accessor), accessor);
+			node.setter = new PropertyAccessor (node, file, element.name, get_access_modifier(element), get_cname (element), get_property_accessor_type (accessor), get_property_ownership (accessor), accessor);
 		}
 
 		process_children (node, element);
@@ -805,7 +924,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Method node = new Method (parent, file, get_method_name (element), get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? element.get_finish_cname () : null, get_method_binding_type (element), element.coroutine, Vala.GDBusServerModule.is_dbus_visible (element), element is Vala.CreationMethod, element);
+		Method node = new Method (parent, file, get_method_name (element), get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? get_finish_name (element) : null, get_method_binding_type (element), element.coroutine, Vala.GDBusServerModule.is_dbus_visible (element), element is Vala.CreationMethod, element);
 		node.return_type = create_type_reference (element.return_type, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -821,7 +940,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Method node = new Method (parent, file, get_method_name (element), get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? element.get_finish_cname () : null, get_method_binding_type (element), element.coroutine, Vala.GDBusServerModule.is_dbus_visible (element), element is Vala.CreationMethod, element);
+		Method node = new Method (parent, file, get_method_name (element), get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.dbus_result_name (element), (element.coroutine)? get_finish_name (element) : null, get_method_binding_type (element), element.coroutine, Vala.GDBusServerModule.is_dbus_visible (element), element is Vala.CreationMethod, element);
 		node.return_type = create_type_reference (element.return_type, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -837,7 +956,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Api.Signal node = new Api.Signal (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.is_dbus_visible (element), element.is_virtual, element);
+		Api.Signal node = new Api.Signal (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), Vala.GDBusServerModule.is_dbus_visible (element), element.is_virtual, element);
 		node.return_type = create_type_reference (element.return_type, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -853,7 +972,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Delegate node = new Delegate (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), element.has_target, element);
+		Delegate node = new Delegate (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element.has_target, element);
 		node.return_type = create_type_reference (element.return_type, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -869,7 +988,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), element);
+		Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -884,7 +1003,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Symbol node = new Api.EnumValue (parent, file, element.name, comment, element.get_cname (), element);
+		Symbol node = new Api.EnumValue (parent, file, element.name, comment, get_cname (element), element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -899,7 +1018,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Constant node = new Constant (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), element);
+		Constant node = new Constant (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element);
 		node.constant_type = create_type_reference (element.type_reference, node);
 		symbol_map.set (element, node);
 		parent.add_child (node);
@@ -915,7 +1034,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), Vala.GDBusModule.get_dbus_name (element), element);
+		Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), Vala.GDBusModule.get_dbus_name (element), element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
@@ -930,7 +1049,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 		SourceFile? file = get_source_file (element);
 		SourceComment? comment = create_comment (element.comment);
 
-		Symbol node = new Api.ErrorCode (parent, file, element.name, comment, element.get_cname (), Vala.GDBusModule.get_dbus_name_for_member (element), element);
+		Symbol node = new Api.ErrorCode (parent, file, element.name, comment, get_cname (element), Vala.GDBusModule.get_dbus_name_for_member (element), element);
 		symbol_map.set (element, node);
 		parent.add_child (node);
 
diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am
index 50a9981..aced67d 100755
--- a/src/driver/Makefile.am
+++ b/src/driver/Makefile.am
@@ -18,7 +18,11 @@ if HAVE_LIBVALA_0_12
 DRIVER_0_12_X_DIR = 0.12.x
 endif
 
-if HAVE_LIBVALA_0_13
+if HAVE_LIBVALA_0_13_0_1
+DRIVER_0_13_X_DIR = 0.13.x
+endif
+
+if HAVE_LIBVALA_0_13_X
 DRIVER_0_13_X_DIR = 0.13.x
 endif
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]