[Gtk-sharp-list] Possible improvements to gtk#

Duncan Mak duncan@ximian.com
03 Jan 2003 22:33:35 -0500


--=-GgaZK9ewbwIvO+BXF0hJ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2003-01-03 at 20:48, Miguel de Icaza wrote:
> I think point #2 could be fixed by doing a:
> 
> 	#region Auto-generated code.
> 	...
> 	#endregion
> 
> 	#region Customized extensions
> 	#endregion
> 

I just implemented this. This is the patch.


-- 
Duncan Mak <duncan@ximian.com>

--=-GgaZK9ewbwIvO+BXF0hJ
Content-Disposition: attachment; filename=regions.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; name=regions.patch; charset=ISO-8859-1

Index: StructBase.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/StructBase.cs,v
retrieving revision 1.31
diff -u -r1.31 StructBase.cs
--- StructBase.cs	10 Nov 2002 10:03:50 -0000	1.31
+++ StructBase.cs	4 Jan 2003 03:00:23 -0000
@@ -219,6 +219,7 @@
 			sw.WriteLine("\t\t/// <remarks>");
 			sw.WriteLine("\t\t/// </remarks>");
=20
+			sw.WriteLine ("#region Autogenerated code");
 			sw.WriteLine ("\t[StructLayout(LayoutKind.Sequential)]");
 			sw.WriteLine ("\tpublic struct " + Name + " {");
 			sw.WriteLine ();
@@ -227,6 +228,8 @@
 			sw.WriteLine ();
 			GenCtors (sw);
 			GenMethods (sw, null, null, true);
+
+			sw.WriteLine ("#endregion");
 			AppendCustom(sw);
 		=09
 			sw.WriteLine ("\t}");
Index: OpaqueGen.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/OpaqueGen.cs,v
retrieving revision 1.2
diff -u -r1.2 OpaqueGen.cs
--- OpaqueGen.cs	20 Aug 2002 19:56:14 -0000	1.2
+++ OpaqueGen.cs	4 Jan 2003 03:00:23 -0000
@@ -42,12 +42,15 @@
 			sw.WriteLine("\t\t/// <summary> " + Name + " Opaque Struct</summary>");
 			sw.WriteLine("\t\t/// <remarks>");
 			sw.WriteLine("\t\t/// </remarks>");
+
+			sw.WriteLine ("#region Autogenerated code");
 			sw.Write ("\tpublic class {0} : GLib.Opaque", Name);
 			sw.WriteLine (" {");
 			sw.WriteLine ();
=20
 			GenMethods (sw, null, null, true);
 			GenCtors (sw);
+			sw.WriteLine ("#endregion");
 		=09
 			AppendCustom(sw);
=20
Index: ObjectGen.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/ObjectGen.cs,v
retrieving revision 1.39
diff -u -r1.39 ObjectGen.cs
--- ObjectGen.cs	25 Dec 2002 00:35:59 -0000	1.39
+++ ObjectGen.cs	4 Jan 2003 03:00:23 -0000
@@ -66,6 +66,8 @@
 			sw.WriteLine("\t\t/// <summary> " + Name + " Class</summary>");
 			sw.WriteLine("\t\t/// <remarks>");
 			sw.WriteLine("\t\t/// </remarks>");
+
+			sw.WriteLine ("#region Autogenerated code");
 			sw.Write ("\tpublic class " + Name);
 			string cs_parent =3D SymbolTable.GetCSType(Elem.GetAttribute("parent"))=
;
 			if (cs_parent !=3D "")
@@ -128,7 +130,8 @@
 				sw.Write ("\t\tpublic static string " + str.GetAttribute ("name"));
 				sw.WriteLine (" {\n\t\t\t get { return \"" + str.GetAttribute ("value"=
) + "\"; }\n\t\t}");
 			}
-		=09
+
+			sw.WriteLine ("#endregion");
 			AppendCustom(sw);
=20
 			sw.WriteLine ("\t}");
@@ -267,7 +270,6 @@
 				sw.WriteLine ("\t}");
 				sw.WriteLine ("}");
 				sw.WriteLine ("}");
-
 				sw.Flush ();
 				sw.Close ();
 			}
Index: InterfaceGen.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/InterfaceGen.cs,v
retrieving revision 1.11
diff -u -r1.11 InterfaceGen.cs
--- InterfaceGen.cs	8 Oct 2002 19:14:13 -0000	1.11
+++ InterfaceGen.cs	4 Jan 2003 03:00:23 -0000
@@ -28,6 +28,7 @@
 			sw.WriteLine("\t\t/// <remarks>");
 			sw.WriteLine("\t\t/// </remarks>");
=20
+			sw.WriteLine ("#region Autogenerated code");
 			sw.WriteLine ("\tpublic interface " + Name + " : GLib.IWrapper {");
 			sw.WriteLine ();
 		=09
@@ -47,6 +48,7 @@
 			AppendCustom (sw);
=20
 			sw.WriteLine ("\t}");
+			sw.WriteLine ("#endregion");
 			CloseWriter (sw);
 			Statistics.IFaceCount++;
 		}
Index: GenBase.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/GenBase.cs,v
retrieving revision 1.5
diff -u -r1.5 GenBase.cs
--- GenBase.cs	20 Aug 2002 19:56:14 -0000	1.5
+++ GenBase.cs	4 Jan 2003 03:00:23 -0000
@@ -99,9 +99,11 @@
 			char sep =3D Path.DirectorySeparatorChar;
 			string custom =3D ".." + sep + NS.ToLower() + sep + Name + ".custom";
 			if (File.Exists(custom)) {
+				sw.WriteLine ("#region Customized extensions");
 				FileStream custstream =3D new FileStream(custom, FileMode.Open, FileAc=
cess.Read);
 				StreamReader sr =3D new StreamReader(custstream);
 				sw.WriteLine (sr.ReadToEnd ());
+				sw.WriteLine ("#endregion");
 				sr.Close ();
 			}
 		}
Index: EnumGen.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/EnumGen.cs,v
retrieving revision 1.14
diff -u -r1.14 EnumGen.cs
--- EnumGen.cs	20 Aug 2002 19:56:14 -0000	1.14
+++ EnumGen.cs	4 Jan 2003 03:00:23 -0000
@@ -60,6 +60,8 @@
=20
 			if (Elem.GetAttribute("type") =3D=3D "flags")=20
 				sw.WriteLine ("\t[Flags]");
+
+			sw.WriteLine ("#region Autogenerated code");
 			=09
 			sw.WriteLine ("\tpublic enum " + Name + " {");
 			sw.WriteLine ();
@@ -82,8 +84,9 @@
 					sw.WriteLine (",");
 				}
 			}
-			=09
+
 			sw.WriteLine ("\t}");
+			sw.WriteLine ("#endregion");
 			CloseWriter (sw);
 			Statistics.EnumCount++;
 		}
Index: CallbackGen.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/CallbackGen.cs,v
retrieving revision 1.16
diff -u -r1.16 CallbackGen.cs
--- CallbackGen.cs	10 Nov 2002 10:03:50 -0000	1.16
+++ CallbackGen.cs	4 Jan 2003 03:00:23 -0000
@@ -71,7 +71,8 @@
 			sw.WriteLine ();
 			sw.WriteLine ("\tusing System;");
 			sw.WriteLine ();
-		=09
+
+			sw.WriteLine ("#region Autogenerated code");
 			string import_sig;
 			if (parms !=3D null)
 			{
@@ -152,7 +153,8 @@
 			sw.WriteLine ("\t\t}");
=20
 			sw.WriteLine ("\t}");
-		=09
+
+			sw.WriteLine ("#endregion");
 			CloseWriter (sw);
 		}
 	=09

--=-GgaZK9ewbwIvO+BXF0hJ--