vala r2386 - in trunk: . gobject vapi



Author: juergbi
Date: Sun Jan 18 15:18:09 2009
New Revision: 2386
URL: http://svn.gnome.org/viewvc/vala?rev=2386&view=rev

Log:
2009-01-18  JÃrg Billeter  <j bitron ch>

	* gobject/valaccodememberaccessmodule.vala:
	* vapi/glib-2.0.vapi:

	Add Log.FILE, Log.LINE, and Log.METHOD constants as replacements
	for __FILE__ and __LINE__ as they are used in C


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodememberaccessmodule.vala
   trunk/vapi/glib-2.0.vapi

Modified: trunk/gobject/valaccodememberaccessmodule.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessmodule.vala	(original)
+++ trunk/gobject/valaccodememberaccessmodule.vala	Sun Jan 18 15:18:09 2009
@@ -148,7 +148,23 @@
 			}
 		} else if (expr.symbol_reference is Constant) {
 			var c = (Constant) expr.symbol_reference;
-			expr.ccodenode = new CCodeIdentifier (c.get_cname ());
+
+			string fn = c.get_full_name ();
+			if (fn == "GLib.Log.FILE") {
+				string s = Path.get_basename (expr.source_reference.file.filename);
+				expr.ccodenode = new CCodeConstant ("\"%s\"".printf (s));
+			} else if (fn == "GLib.Log.LINE") {
+				int i = expr.source_reference.first_line;
+				expr.ccodenode = new CCodeConstant ("%d".printf (i));
+			} else if (fn == "GLib.Log.METHOD") {
+				string s = "";
+				if (current_method != null) {
+					s = current_method.get_full_name ();
+				}
+				expr.ccodenode = new CCodeConstant ("\"%s\"".printf (s));
+			} else {
+				expr.ccodenode = new CCodeIdentifier (c.get_cname ());
+			}
 		} else if (expr.symbol_reference is Property) {
 			var prop = (Property) expr.symbol_reference;
 

Modified: trunk/vapi/glib-2.0.vapi
==============================================================================
--- trunk/vapi/glib-2.0.vapi	(original)
+++ trunk/vapi/glib-2.0.vapi	Sun Jan 18 15:18:09 2009
@@ -1499,6 +1499,10 @@
 	namespace Log {
 		public static uint set_handler (string? log_domain, LogLevelFlags log_levels, LogFunc log_func);
 		public static void set_default_handler (LogFunc log_func);
+
+		public const string FILE;
+		public const int LINE;
+		public const string METHOD;
 	}
 
 	/* String Utility Functions */



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