+2008-07-23 Jared Moore <jaredm@svn.gnome.org>
+
+ * vala/valainterfacewriter.vala:
+ * vala/valaclass.vala:
+ * gobject/valaccodeinterfacebinding.vala:
+ * gobject/valaccodeclassbinding.vala:
+ * gobject/valaccodegenerator.vala:
+
+ Add [CCode (type_check_function = "BLAH_IS_FOO")] for classes.
+
+ * vapigen/valagidlparser.vala:
+
+ Add type_check_function metadata.
+
+ * vapi/packages/gnome-vfs-2.0/gnome-vfs-2.0.metadata:
+
+ Set type_check_function for GnomeVFSDrive, GnomeVFSVolume,
+ GnomeVFSVolumeMonitor, fixes bug 543693.
+
+ * vapi/gnome-vfs-2.0.vapi: regenerated
+
2008-07-22 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vapi:
decl_frag.append (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (cl.get_upper_case_cname (null)), macro));
macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (cl.get_type_id ());
- decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (cl.get_upper_case_cname ("IS_")), macro));
+ decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (codegen.get_type_check_function (cl)), macro));
macro = "(G_TYPE_CHECK_CLASS_TYPE ((klass), %s))".printf (cl.get_type_id ());
- decl_frag.append (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (cl.get_upper_case_cname ("IS_")), macro));
+ decl_frag.append (new CCodeMacroReplacement ("%s_CLASS(klass)".printf (codegen.get_type_check_function (cl)), macro));
macro = "(G_TYPE_INSTANCE_GET_CLASS ((obj), %s, %sClass))".printf (cl.get_type_id (), cl.get_cname ());
decl_frag.append (new CCodeMacroReplacement ("%s_GET_CLASS(obj)".printf (cl.get_upper_case_cname (null)), macro));
expr.ccodenode = new CCodeBinaryExpression (op, cleft, cright);
}
- static CCodeFunctionCall create_type_check (CCodeNode ccodenode, TypeSymbol type) {
- var ccheck = new CCodeFunctionCall (new CCodeIdentifier (type.get_upper_case_cname ("IS_")));
+ public string get_type_check_function (TypeSymbol type) {
+ var cl = type as Class;
+ if (cl != null && cl.type_check_function != null) {
+ return cl.type_check_function;
+ } else {
+ return type.get_upper_case_cname ("IS_");
+ }
+ }
+
+ CCodeFunctionCall create_type_check (CCodeNode ccodenode, TypeSymbol type) {
+ var ccheck = new CCodeFunctionCall (new CCodeIdentifier (get_type_check_function (type)));
ccheck.add_argument ((CCodeExpression) ccodenode);
return ccheck;
}
var ccheck = new CCodeFunctionCall ();
if ((t is Class && ((Class) t).is_subtype_of (gobject_type)) || t is Interface) {
- var ctype_check = new CCodeFunctionCall (new CCodeIdentifier (t.get_upper_case_cname ("IS_")));
+ var ctype_check = new CCodeFunctionCall (new CCodeIdentifier (get_type_check_function (t)));
ctype_check.add_argument (new CCodeIdentifier (var_name));
CCodeExpression cexpr = ctype_check;
decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (iface.get_type_id ());
- decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname ("IS_")), macro));
+ decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (codegen.get_type_check_function (iface)), macro));
macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %s))".printf (iface.get_type_id (), iface.get_type_cname ());
decl_frag.append (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
}
/**
+ * The name of the function to use to check whether a value is an instance of
+ * this class. If this is null then the default type check function should be
+ * used instead.
+ */
+ public string? type_check_function { get; set; }
+
+ /**
* Specifies whether this class has private fields.
*/
public bool has_private_fields { get; private set; }
if (a.has_argument ("type_signature")) {
type_signature = a.get_string ("type_signature");
}
+ if (a.has_argument ("type_check_function")) {
+ type_check_function = a.get_string ("type_check_function");
+ }
}
/**
write_string ("cname = \"%s\", ".printf (cl.get_cname ()));
}
+ if (cl.type_check_function != null) {
+ write_string ("type_check_function = \"%s\", ".printf (cl.type_check_function ));
+ }
+
bool first = true;
string cheaders;
foreach (string cheader in cl.get_cheader_filenames ()) {
}
[Compact]
[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
- public class Address : GLib.Boxed {
+ public class Address {
public weak GnomeVFS.Address dup ();
public bool equal (GnomeVFS.Address b);
public int get_family_type ();
}
[Compact]
[CCode (ref_function = "gnome_vfs_file_info_ref", unref_function = "gnome_vfs_file_info_unref", cheader_filename = "libgnomevfs/gnome-vfs.h")]
- public class FileInfo : GLib.Boxed {
+ public class FileInfo {
public weak string name;
public GnomeVFS.FileInfoFields valid_fields;
public GnomeVFS.FileType type;
}
[Compact]
[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
- public class GnomeVfsFindDirectoryResult : GLib.Boxed {
+ public class GnomeVfsFindDirectoryResult {
}
[Compact]
[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
- public class GnomeVfsGetFileInfoResult : GLib.Boxed {
+ public class GnomeVfsGetFileInfoResult {
}
[CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
public class ACE : GLib.Object {
public void set (GnomeVFS.ACE ace);
public void unset (GnomeVFS.ACE ace);
}
- [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+ [CCode (type_check_function = "GNOME_IS_VFS_DRIVE", cheader_filename = "libgnomevfs/gnome-vfs.h")]
public class Drive : GLib.Object {
public int compare (GnomeVFS.Drive b);
public void eject (GnomeVFS.VolumeOpCallback callback);
public static weak GnomeVFS.MIMEMonitor get ();
public virtual signal void data_changed ();
}
- [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+ [CCode (type_check_function = "GNOME_IS_VFS_VOLUME", cheader_filename = "libgnomevfs/gnome-vfs.h")]
public class Volume : GLib.Object {
public int compare (GnomeVFS.Volume b);
public void eject (GnomeVFS.VolumeOpCallback callback);
public void unmount (GnomeVFS.VolumeOpCallback callback);
public void unref ();
}
- [CCode (cheader_filename = "libgnomevfs/gnome-vfs.h")]
+ [CCode (type_check_function = "GNOME_IS_VFS_VOLUME_MONITOR", cheader_filename = "libgnomevfs/gnome-vfs.h")]
public class VolumeMonitor : GLib.Object {
public weak GLib.List get_connected_drives ();
public weak GnomeVFS.Drive get_drive_by_id (ulong id);
GnomeVFS cheader_filename="libgnomevfs/gnome-vfs.h"
gnome_vfs_address_new_from_sockaddr hidden="1"
+GnomeVFSDrive type_check_function="GNOME_IS_VFS_DRIVE"
GnomeVFSFileInfo.device hidden="1"
GnomeVFSMimeApplication.priv hidden="1"
GnomeVFSMimeApplication.requires_terminal hidden="1"
+GnomeVFSVolume type_check_function="GNOME_IS_VFS_VOLUME"
+GnomeVFSVolumeMonitor type_check_function="GNOME_IS_VFS_VOLUME_MONITOR"
if (eval (nv[1]) == "1") {
return;
}
+ } else if (nv[0] == "type_check_function") {
+ cl.type_check_function = eval (nv[1]);
} else if (nv[0] == "abstract") {
if (eval (nv[1]) == "1") {
cl.is_abstract = true;