+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
+
2009-01-18 Jürg Billeter <j@bitron.ch>
* vapi/Makefile.am:
}
} 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;
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 */