public abstract void unimplemented_method () throws GLib.DBusError, GLib.IOError;
public abstract void property_cancellation () throws GLib.DBusError, GLib.IOError;
/*<para>Property docs, yah...</para><para>Second paragraph.</para>*/
- [DBus (name = "y")]
public abstract char y { get; set; }
- [DBus (name = "b")]
public abstract bool b { get; set; }
- [DBus (name = "n")]
public abstract int16 n { get; set; }
- [DBus (name = "q")]
public abstract uint16 q { get; set; }
- [DBus (name = "i")]
public abstract int32 i { get; set; }
- [DBus (name = "u")]
public abstract uint32 u { get; set; }
- [DBus (name = "x")]
public abstract int64 x { get; set; }
- [DBus (name = "t")]
public abstract uint64 t { get; set; }
- [DBus (name = "d")]
public abstract double d { get; set; }
- [DBus (name = "s")]
public abstract string s { owned get; set; }
- [DBus (name = "o")]
public abstract GLib.ObjectPath o { owned get; set; }
- [DBus (name = "g")]
public abstract string g { owned get; set; }
- [DBus (name = "ay")]
public abstract string ay { owned get; set; }
- [DBus (name = "as")]
public abstract string[] @as { owned get; set; }
- [DBus (name = "aay")]
public abstract string[] aay { owned get; set; }
- [DBus (name = "ao")]
public abstract GLib.ObjectPath[] ao { owned get; set; }
- [DBus (name = "ag")]
public abstract string[] ag { owned get; set; }
public abstract string finally_normal_name { owned get; set; }
public abstract string readonly_property { owned get; }
public abstract string writeonly_property { set; }
[CCode (notify = false)]
- [DBus (name = "quiet")]
public abstract string quiet { owned get; set; }
[CCode (notify = false)]
- [DBus (name = "quiet_too")]
public abstract string quiet_too { owned get; set; }
- [DBus (name = "unset_i")]
public abstract int32 unset_i { get; set; }
- [DBus (name = "unset_d")]
public abstract double unset_d { get; set; }
- [DBus (name = "unset_s")]
public abstract string unset_s { owned get; set; }
- [DBus (name = "unset_o")]
public abstract GLib.ObjectPath unset_o { owned get; set; }
- [DBus (name = "unset_g")]
public abstract string unset_g { owned get; set; }
- [DBus (name = "unset_ay")]
public abstract string unset_ay { owned get; set; }
- [DBus (name = "unset_as")]
public abstract string[] unset_as { owned get; set; }
- [DBus (name = "unset_ao")]
public abstract GLib.ObjectPath[] unset_ao { owned get; set; }
- [DBus (name = "unset_ag")]
public abstract string[] unset_ag { owned get; set; }
- [DBus (name = "unset_struct")]
public abstract DBusProxyStruct_1idsogayasaoag1_ unset_struct { owned get; set; }
[DBus (name = "HelloWorld")]
public signal void hello_world0 (string greeting);
[CCode (cname = "speed-xyz")]
public abstract double speed { get; }
public abstract DBusProxyStruct_1ddd1_ direction { owned get; }
- public abstract string type { owned get; }
+ [DBus (name = "Type")]
+ public abstract string type_ { owned get; }
[CCode (cname = "exploded-xyz")]
public signal void exploded ();
}
[DBus (name = "org.project.Bat", timeout = 120000)]
public interface OrgProjectBat : GLib.Object {
public abstract void force_method ([DBus (signature = "i")] GLib.Variant force_in_i, [DBus (signature = "s")] GLib.Variant force_in_s, [DBus (signature = "ay")] GLib.Variant force_in_ay, [DBus (signature = "(i)")] GLib.Variant force_in_struct, [DBus (signature = "i")] out GLib.Variant force_out_i, [DBus (signature = "s")] out GLib.Variant force_out_s, [DBus (signature = "ay")] out GLib.Variant force_out_ay, [DBus (signature = "(i)")] out GLib.Variant force_out_struct) throws GLib.DBusError, GLib.IOError;
- [DBus (name = "force_i", signature = "i")]
+ [DBus (signature = "i")]
public abstract GLib.Variant force_i { owned get; set; }
- [DBus (name = "force_s", signature = "s")]
+ [DBus (signature = "s")]
public abstract GLib.Variant force_s { owned get; set; }
- [DBus (name = "force_ay", signature = "ay")]
+ [DBus (signature = "ay")]
public abstract GLib.Variant force_ay { owned get; set; }
- [DBus (name = "force_struct", signature = "(i)")]
+ [DBus (signature = "(i)")]
public abstract GLib.Variant force_struct { owned get; set; }
public signal void force_signal ([DBus (signature = "i")] GLib.Variant force_i, [DBus (signature = "s")] GLib.Variant force_s, [DBus (signature = "ay")] GLib.Variant force_ay, [DBus (signature = "(i)")] GLib.Variant force_struct);
}
public abstract string property3 { owned get; }
public abstract string property4 { owned get; }
public abstract string property5 { owned get; }
+ [DBus (name = "type")]
+ public abstract string type_ { owned get; set; }
public abstract string fancy_property { owned get; }
- [DBus (name = "foo-bar-property")]
- public abstract string foo_bar_property { owned get; }
+ [DBus (name = "foo-bar-property")]
+ public abstract string foo_bar_property { owned get; }
public signal void bar_signal (string blah, string boo);
}
[DBus (name = "ChangingInterfaceV1", timeout = 120000)]
}
[DBus (name = "Naming", timeout = 120000)]
public interface Naming : GLib.Object {
- public abstract int32 type { get; set; }
+ [DBus (name = "Type")]
+ public abstract int32 type_ { get; set; }
}
[DBus (name = "org.freedesktop.DBus.Introspectable", timeout = 120000)]
public interface OrgFreedesktopDBusIntrospectable : GLib.Object {
*/
using GLib;
-
+// TODO: org.freedesktop.login1.Manager.xml.vala
+// org.freedesktop.NetworkManager.Device.Wireless.xml.vala
+// org.freedesktop.NetworkManager.xml.vala
+// Internal duplicated symbols
/**
* Code visitor parsing all DBus Interface files.
*
private Set<string> argnames = new HashSet<string> (str_hash, str_equal);
// Used for guarding against duplicate member names (signals, properties and methods)
private Set<string> member_names = new HashSet<string> (str_hash, str_equal);
+ // Used to avoid generating method names like "register", or properties like "type" that yield
+ // "foo_bar_get_type" that generate invalid C code
+ private Set<string> banned_names = new HashSet<string> (str_hash, str_equal);
private int duplicate_counter;
public int dbus_timeout { get; set; }
public void parse (CodeContext context) {
this.context = context;
current_ns = context.root;
+ // TODO: Add all C keywords?
+ banned_names.add ("type");
+ banned_names.add ("register");
+ banned_names.add ("default");
+ banned_names.add ("continue");
+ banned_names.add ("restrict");
+ banned_names.add ("unsigned");
dbus_module = new DBusVariantModule (context);
dbus_module.current_ns = context.root;
name = "%s%u".printf (name, duplicate_counter++);
}
+ var banned = name in banned_names;
+ if (banned) {
+ name = name + "_";
+ }
+
current_node = current_method = new Method (name, dbus_module.void_type.copy (), get_current_src ());
((Method)current_method).is_abstract = true;
((Method)current_method).access = SymbolAccessibility.PUBLIC;
if (needs_name) {
current_node.set_attribute_string ("DBus", "name", name);
}
- if (duplicate) {
+ if (duplicate || banned) {
current_node.set_attribute_string ("DBus", "name", reader.get_attribute ("name"));
}
var needs_name = false;
var vala_name = Vala.Symbol.camel_case_to_lower_case (name);
- if (name == Vala.Symbol.lower_case_to_camel_case (vala_name)) {
+
+ if (name == Vala.Symbol.lower_case_to_camel_case (vala_name) || (name == vala_name && !name.contains ("-"))) {
name = vala_name;
} else {
needs_name = true;
duplicate = true;
name = "%s%u".printf (name, duplicate_counter++);
}
+ var banned = name in banned_names;
+ if (banned) {
+ name = name + "_";
+ }
current_node = current_property = new Property (name.replace ("-", "_"), data_type, null, null, get_current_src ());
current_property.is_abstract = true;
if (needs_name) {
current_node.set_attribute_string ("DBus", "name", name);
}
- if (duplicate) {
+ if (duplicate || banned) {
current_node.set_attribute_string ("DBus", "name", reader.get_attribute ("name"));
}
name = "%s%u".printf (name, duplicate_counter++);
}
+ var banned = name in banned_names;
+ if (banned) {
+ name = name + "_";
+ }
+
current_node = current_method = new Signal (name, dbus_module.void_type.copy ());
((Signal)current_node).access = SymbolAccessibility.PUBLIC;
if (needs_name) {
current_node.set_attribute_string ("DBus", "name", name);
}
- if (duplicate) {
+ if (duplicate || banned) {
current_node.set_attribute_string ("DBus", "name", reader.get_attribute ("name"));
}
var n = type.n_items ();
var able_to_add_all = true;
unowned var sub = type.first ();
+ var file = context.get_source_file ("<artificial>");
+ if (file == null) {
+ file = new SourceFile (context, SourceFileType.SOURCE, "<artificial>", null, true);
+ context.add_source_file (file);
+ }
var sref = new SourceReference (
- new SourceFile (context, SourceFileType.NONE, "<artificial>", null, true),
- new SourceLocation (null, 0, 0),
- new SourceLocation (null, 0, 1));
+ file,
+ SourceLocation (null, 0, 0),
+ SourceLocation (null, 0, 1));
var new_struct = new Struct (generated_name, sref);
new_struct.access = SymbolAccessibility.PUBLIC;
for (var i = 0; i < n; i++) {
able_to_add_all = false;
break;
}
- var field = new Field ("arg%d".printf (i), dt, null);
+ var field = new Field ("arg%d".printf (i), dt, null, sref);
field.access = SymbolAccessibility.PUBLIC;
new_struct.add_field (field);
sub = sub.next();