diff --git a/ChangeLog b/ChangeLog index 0a4529379..d1200c4c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-09-30 Stephane Delcroix + + * generator/CallbackGen.cs: + * generator/ClassGen.cs: + * generator/EnumGen.cs: + * generator/GenBase.cs: + * generator/InterfaceGen.cs: + * generator/Method.cs: + * generator/OpaqueGen.cs: + * generator/StructBase.cs: + * generator/ObjectGen: check for the internal attribute + * generator/Method.cs: check for the accessibility attribute; + 2008-09-24 Mike Gorse * atk/Atk.metadata: Mark rect in GetRangeExtents as out. diff --git a/generator/CallbackGen.cs b/generator/CallbackGen.cs index 121f2bd7c..a30cfa53d 100644 --- a/generator/CallbackGen.cs +++ b/generator/CallbackGen.cs @@ -291,7 +291,7 @@ namespace GtkSharp.Generation { sw.WriteLine (); sw.WriteLine ("\tusing System;"); sw.WriteLine (); - sw.WriteLine ("\tpublic delegate " + retval.CSType + " " + Name + "(" + sig.ToString() + ");"); + sw.WriteLine ("\t{0} delegate " + retval.CSType + " " + Name + "(" + sig.ToString() + ");", IsInternal ? "internal" : "public"); sw.WriteLine (); sw.WriteLine ("}"); diff --git a/generator/ClassGen.cs b/generator/ClassGen.cs index b3a4e395c..700a27a1e 100644 --- a/generator/ClassGen.cs +++ b/generator/ClassGen.cs @@ -73,7 +73,7 @@ namespace GtkSharp.Generation { sw.WriteLine ("#region Autogenerated code"); if (IsDeprecated) sw.WriteLine ("\t[Obsolete]"); - sw.Write ("\tpublic class " + Name); + sw.Write ("\t{0} class " + Name, IsInternal ? "internal" : "public"); sw.WriteLine (" {"); sw.WriteLine (); diff --git a/generator/EnumGen.cs b/generator/EnumGen.cs index 2e2a74eb4..e05ead5bc 100644 --- a/generator/EnumGen.cs +++ b/generator/EnumGen.cs @@ -94,7 +94,7 @@ namespace GtkSharp.Generation { if (Elem.HasAttribute("gtype")) sw.WriteLine ("\t[GLib.GType (typeof (" + NS + "." + Name + "GType))]"); - sw.WriteLine ("\tpublic enum " + Name + enum_type + " {"); + sw.WriteLine ("\t{0} enum " + Name + enum_type + " {", IsInternal ? "internal" : "public"); sw.WriteLine (); foreach (string member in members) diff --git a/generator/GenBase.cs b/generator/GenBase.cs index 2bb8644e8..db0a0040d 100644 --- a/generator/GenBase.cs +++ b/generator/GenBase.cs @@ -49,6 +49,16 @@ namespace GtkSharp.Generation { } } + public bool IsInternal { + get { + if (elem.HasAttribute ("internal")) { + string attr = elem.GetAttribute ("internal"); + return attr == "1" || attr == "true"; + } + return false; + } + } + public string LibraryName { get { return ns.GetAttribute ("library"); diff --git a/generator/InterfaceGen.cs b/generator/InterfaceGen.cs index 44ca20be1..4dd141c53 100644 --- a/generator/InterfaceGen.cs +++ b/generator/InterfaceGen.cs @@ -302,7 +302,7 @@ namespace GtkSharp.Generation { sw.WriteLine (); sw.WriteLine ("\t[GLib.GInterface (typeof (" + Name + "Adapter))]"); - sw.WriteLine ("\tpublic interface " + Name + "Implementor : GLib.IWrapper {"); + sw.WriteLine ("\t{0} interface " + Name + "Implementor : GLib.IWrapper {", IsInternal ? "internal" : "public"); sw.WriteLine (); Hashtable vm_table = new Hashtable (); foreach (VirtualMethod vm in vms) diff --git a/generator/Method.cs b/generator/Method.cs index 486146a3f..0527837b2 100644 --- a/generator/Method.cs +++ b/generator/Method.cs @@ -44,6 +44,18 @@ namespace GtkSharp.Generation { string attr = elem.GetAttribute ("deprecated"); deprecated = attr == "1" || attr == "true"; } + if (elem.HasAttribute ("accessibility")) { + string attr = elem.GetAttribute ("accessibility"); + switch (attr) { + case "public": + case "protected": + case "internal": + case "private": + case "protected internal": + protection = attr; + break; + } + } if (Name == "GetType") Name = "GetGType"; diff --git a/generator/ObjectGen.cs b/generator/ObjectGen.cs index 1a9f66cac..58d2c17df 100644 --- a/generator/ObjectGen.cs +++ b/generator/ObjectGen.cs @@ -157,7 +157,7 @@ namespace GtkSharp.Generation { sw.WriteLine ("\t[Obsolete]"); foreach (string attr in custom_attrs) sw.WriteLine ("\t" + attr); - sw.Write ("\tpublic {0}class " + Name, IsAbstract ? "abstract " : ""); + sw.Write ("\t{0} {1}class " + Name, IsInternal ? "internal" : "public", IsAbstract ? "abstract " : ""); string cs_parent = table.GetCSType(Elem.GetAttribute("parent")); if (cs_parent != "") { di.objects.Add (CName, QualifiedName); diff --git a/generator/OpaqueGen.cs b/generator/OpaqueGen.cs index 36582f246..6c2af67d1 100644 --- a/generator/OpaqueGen.cs +++ b/generator/OpaqueGen.cs @@ -63,7 +63,7 @@ namespace GtkSharp.Generation { if (IsDeprecated) sw.WriteLine ("\t[Obsolete]"); - sw.Write ("\tpublic class " + Name); + sw.Write ("\t{0} class " + Name, IsInternal ? "internal" : "public"); string cs_parent = table.GetCSType(Elem.GetAttribute("parent")); if (cs_parent != "") sw.Write (" : " + cs_parent); diff --git a/generator/StructBase.cs b/generator/StructBase.cs index 1b1b02235..43b84e535 100644 --- a/generator/StructBase.cs +++ b/generator/StructBase.cs @@ -159,7 +159,7 @@ namespace GtkSharp.Generation { if (IsDeprecated) sw.WriteLine ("\t[Obsolete]"); sw.WriteLine ("\t[StructLayout(LayoutKind.Sequential)]"); - sw.WriteLine ("\tpublic struct " + Name + " {"); + sw.WriteLine ("\t{0} struct " + Name + " {", IsInternal ? "internal" : "public"); sw.WriteLine (); need_read_native = false;