vala r1140 - in trunk: . vala vapi vapi/packages/gstreamer-interfaces-0.10 vapigen



Author: juergbi
Date: Thu Mar 20 23:45:20 2008
New Revision: 1140
URL: http://svn.gnome.org/viewvc/vala?rev=1140&view=rev

Log:
2008-03-20  Juerg Billeter  <j bitron ch>

	* vala/valainterface.vala, vala/valainterfacewriter.vala,
	  vapigen/valagidlparser.vala: support lower_case_csuffix attribute
	  for interfaces

	* vapi/packages/gstreamer-interfaces-0.10/: fix GstXOverlay binding

	* vapi/gstreamer-interfaces-0.10.vapi: regenerated

	Patch by Andrea Del Signore, fixes bug 512744


Modified:
   trunk/ChangeLog
   trunk/vala/valainterface.vala
   trunk/vala/valainterfacewriter.vala
   trunk/vapi/gstreamer-interfaces-0.10.vapi
   trunk/vapi/packages/gstreamer-interfaces-0.10/gstreamer-interfaces-0.10.metadata
   trunk/vapigen/valagidlparser.vala

Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala	(original)
+++ trunk/vala/valainterface.vala	Thu Mar 20 23:45:20 2008
@@ -263,20 +263,32 @@
 	 */
 	public string! get_lower_case_csuffix () {
 		if (lower_case_csuffix == null) {
-			lower_case_csuffix = camel_case_to_lower_case (name);
-
-			// remove underscores in some cases to avoid conflicts of type macros
-			if (lower_case_csuffix.has_prefix ("type_")) {
-				lower_case_csuffix = "type" + lower_case_csuffix.offset ("type_".len ());
-			} else if (lower_case_csuffix.has_prefix ("is_")) {
-				lower_case_csuffix = "is" + lower_case_csuffix.offset ("is_".len ());
-			}
-			if (lower_case_csuffix.has_suffix ("_class")) {
-				lower_case_csuffix = lower_case_csuffix.substring (0, lower_case_csuffix.len () - "_class".len ()) + "class";
-			}
+			lower_case_csuffix = get_default_lower_case_csuffix ();
 		}
 		return lower_case_csuffix;
 	}
+
+	/**
+	 * Returns default string to be prepended to the name of members of this
+	 * interface when used in C code.
+	 *
+	 * @return the suffix to be used in C code
+	 */
+	public string! get_default_lower_case_csuffix () {
+		string result = camel_case_to_lower_case (name);
+
+		// remove underscores in some cases to avoid conflicts of type macros
+		if (result.has_prefix ("type_")) {
+			result = "type" + result.offset ("type_".len ());
+		} else if (result.has_prefix ("is_")) {
+			result = "is" + result.offset ("is_".len ());
+		}
+		if (result.has_suffix ("_class")) {
+			result = result.substring (0, result.len () - "_class".len ()) + "class";
+		}
+
+		return result;
+	}
 	
 	/**
 	 * Sets the string to be prepended to the name of members of this
@@ -389,6 +401,9 @@
 				add_cheader_filename (filename);
 			}
 		}
+		if (a.has_argument ("lower_case_csuffix")) {
+			lower_case_csuffix = a.get_string ("lower_case_csuffix");
+		}
 	}
 
 	private void process_dbus_interface_attribute (Attribute! a) {

Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala	(original)
+++ trunk/vala/valainterfacewriter.vala	Thu Mar 20 23:45:20 2008
@@ -240,7 +240,11 @@
 				cheaders = "%s,%s".printf (cheaders, cheader);
 			}
 		}
-		write_string ("[CCode (cheader_filename = \"%s\")]".printf (cheaders));
+		write_string ("[CCode (cheader_filename = \"%s\"".printf (cheaders));
+		if (iface.get_lower_case_csuffix () != iface.get_default_lower_case_csuffix ())
+			write_string (", lower_case_csuffix = \"%s\"".printf (iface.get_lower_case_csuffix ()));
+
+		write_string (")]");
 		write_newline ();
 
 		write_indent ();

Modified: trunk/vapi/gstreamer-interfaces-0.10.vapi
==============================================================================
--- trunk/vapi/gstreamer-interfaces-0.10.vapi	(original)
+++ trunk/vapi/gstreamer-interfaces-0.10.vapi	Thu Mar 20 23:45:20 2008
@@ -173,17 +173,12 @@
 		public abstract bool set_vcenter (int center);
 		public abstract bool set_vflip (bool flip);
 	}
-	[CCode (cheader_filename = "gst/interfaces/xoverlay.h")]
+	[CCode (cheader_filename = "gst/interfaces/xoverlay.h", lower_case_csuffix = "x_overlay")]
 	public interface XOverlay : Gst.ImplementsInterface, Gst.Element {
-		[CCode (cname = "gst_x_overlay_got_xwindow_id")]
 		public void got_xwindow_id (ulong xwindow_id);
-		[CCode (cname = "gst_x_overlay_prepare_xwindow_id")]
 		public void prepare_xwindow_id ();
-		[CCode (cname = "gst_x_overlay_expose")]
 		public abstract void expose ();
-		[CCode (cname = "gst_x_overlay_handle_events")]
 		public abstract void handle_events (bool handle_events);
-		[CCode (cname = "gst_x_overlay_set_xwindow_id")]
 		public abstract void set_xwindow_id (ulong xwindow_id);
 	}
 }

Modified: trunk/vapi/packages/gstreamer-interfaces-0.10/gstreamer-interfaces-0.10.metadata
==============================================================================
--- trunk/vapi/packages/gstreamer-interfaces-0.10/gstreamer-interfaces-0.10.metadata	(original)
+++ trunk/vapi/packages/gstreamer-interfaces-0.10/gstreamer-interfaces-0.10.metadata	Thu Mar 20 23:45:20 2008
@@ -23,4 +23,4 @@
 GstPropertyProbe cheader_filename="gst/interfaces/propertyprobe.h"
 GstTuner cheader_filename="gst/interfaces/tunerchannel.h"
 GstVideoOrientation cheader_filename="gst/interfaces/videoorientation.h"
-GstXOverlay cheader_filename="gst/interfaces/xoverlay.h"
+GstXOverlay cheader_filename="gst/interfaces/xoverlay.h" lower_case_csuffix="x_overlay"

Modified: trunk/vapigen/valagidlparser.vala
==============================================================================
--- trunk/vapigen/valagidlparser.vala	(original)
+++ trunk/vapigen/valagidlparser.vala	Thu Mar 20 23:45:20 2008
@@ -917,6 +917,8 @@
 					var nv = attr.split ("=", 2);
 					if (nv[0] == "cheader_filename") {
 						iface.add_cheader_filename (eval (nv[1]));
+					} else if (nv[0] == "lower_case_csuffix") {
+						iface.set_lower_case_csuffix (eval (nv[1]));
 					}
 				}
 			}



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