mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-22 05:41:09 +00:00
2002-06-21 Mike Kestner <mkestner@speakeasy.net>
* makefile : remove gdk.imaging from the build * gdk.imaging/* : kill * generated/BoxedGen.cs : XmlNode namespace handling. Use GenBase. * generated/CallbackGen.cs : XmlNode namespace handling. * generated/Ctor.cs : construct with libname not ns. * generated/EnumGen.cs : XmlNode namespace handling. * generated/GenBase.cs : XmlNode namespace handling. Make AppendCustom an instance method so it can use the private fields instead of params. * generated/InterfaceGen.cs : XmlNode namespace handling. * generated/Method.cs : construct with libname not ns. * generated/ObjectGen.cs : XmlNode namespace handling. * generated/Parser.cs : Use new XmlNode namespace ctors. * generated/Signal.cs : Lose the namespace field. * generated/StructBase.cs : derive from ClassBase * generated/StructGen.cs : XmlNode namespace handling. Use GenBase. * generated/SymbolTable.cs : nuke GetDllName method. * generator/gtkapi.xml : Add library name to namespace node. * parser/build.pl : refactor for library name param * parser/gapi2xml.pl : add libname param handling * sample/Makefile.in : build linux on make install, but don't install. svn path=/trunk/gtk-sharp/; revision=5400
This commit is contained in:
parent
6857128f07
commit
5d67982de9
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2002-06-21 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* makefile : remove gdk.imaging from the build
|
||||||
|
* gdk.imaging/* : kill
|
||||||
|
* generated/BoxedGen.cs : XmlNode namespace handling. Use GenBase.
|
||||||
|
* generated/CallbackGen.cs : XmlNode namespace handling.
|
||||||
|
* generated/Ctor.cs : construct with libname not ns.
|
||||||
|
* generated/EnumGen.cs : XmlNode namespace handling.
|
||||||
|
* generated/GenBase.cs : XmlNode namespace handling. Make AppendCustom
|
||||||
|
an instance method so it can use the private fields instead of params.
|
||||||
|
* generated/InterfaceGen.cs : XmlNode namespace handling.
|
||||||
|
* generated/Method.cs : construct with libname not ns.
|
||||||
|
* generated/ObjectGen.cs : XmlNode namespace handling.
|
||||||
|
* generated/Parser.cs : Use new XmlNode namespace ctors.
|
||||||
|
* generated/Signal.cs : Lose the namespace field.
|
||||||
|
* generated/StructBase.cs : derive from ClassBase
|
||||||
|
* generated/StructGen.cs : XmlNode namespace handling. Use GenBase.
|
||||||
|
* generated/SymbolTable.cs : nuke GetDllName method.
|
||||||
|
* generator/gtkapi.xml : Add library name to namespace node.
|
||||||
|
* parser/build.pl : refactor for library name param
|
||||||
|
* parser/gapi2xml.pl : add libname param handling
|
||||||
|
* sample/Makefile.in : build linux on make install, but don't install.
|
||||||
|
|
||||||
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
|
||||||
|
|
||||||
* generator/ClassBase.cs: New base class for classes and interfaces.
|
* generator/ClassBase.cs: New base class for classes and interfaces.
|
||||||
|
|
|
@ -13,14 +13,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class BoxedGen : StructBase, IGeneratable {
|
public class BoxedGen : StructBase, IGeneratable {
|
||||||
|
|
||||||
public BoxedGen (String ns, XmlElement elem) : base (ns, elem) {}
|
public BoxedGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
||||||
|
|
||||||
public String MarshalType {
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return "IntPtr";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String CallByName (String var_name)
|
public String CallByName (String var_name)
|
||||||
{
|
{
|
||||||
|
@ -34,22 +27,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public void Generate ()
|
public void Generate ()
|
||||||
{
|
{
|
||||||
char sep = Path.DirectorySeparatorChar;
|
StreamWriter sw = CreateWriter ();
|
||||||
string dir = ".." + sep + ns.ToLower() + sep + "generated";
|
|
||||||
if (!Directory.Exists(dir)) {
|
|
||||||
Directory.CreateDirectory(dir);
|
|
||||||
}
|
|
||||||
String filename = dir + sep + Name + ".cs";
|
|
||||||
|
|
||||||
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
|
||||||
StreamWriter sw = new StreamWriter (stream);
|
|
||||||
|
|
||||||
sw.WriteLine ("// Generated File. Do not modify.");
|
|
||||||
sw.WriteLine ("// <c> 2001-2002 Mike Kestner");
|
|
||||||
sw.WriteLine ();
|
|
||||||
|
|
||||||
sw.WriteLine ("namespace " + ns + " {");
|
|
||||||
sw.WriteLine ();
|
|
||||||
|
|
||||||
sw.WriteLine ("\tusing System;");
|
sw.WriteLine ("\tusing System;");
|
||||||
sw.WriteLine ("\tusing System.Collections;");
|
sw.WriteLine ("\tusing System.Collections;");
|
||||||
|
@ -65,7 +43,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
Hashtable clash_map = new Hashtable();
|
Hashtable clash_map = new Hashtable();
|
||||||
|
|
||||||
foreach (XmlNode node in elem.ChildNodes) {
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
|
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
|
@ -97,13 +75,9 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GenBase.AppendCustom(ns, Name, sw);
|
AppendCustom(sw);
|
||||||
sw.WriteLine ("\t}");
|
sw.WriteLine ("\t}");
|
||||||
sw.WriteLine ();
|
CloseWriter (sw);
|
||||||
sw.WriteLine ("}");
|
|
||||||
|
|
||||||
sw.Flush();
|
|
||||||
sw.Close();
|
|
||||||
Statistics.BoxedCount++;
|
Statistics.BoxedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
private Parameters parms;
|
private Parameters parms;
|
||||||
|
|
||||||
public CallbackGen (String ns, XmlElement elem) : base (ns, elem)
|
public CallbackGen (XmlElement ns, XmlElement elem) : base (ns, elem)
|
||||||
{
|
{
|
||||||
if (elem ["parameters"] != null)
|
if (elem ["parameters"] != null)
|
||||||
parms = new Parameters (elem ["parameters"]);
|
parms = new Parameters (elem ["parameters"]);
|
||||||
|
|
|
@ -18,13 +18,13 @@ namespace GtkSharp.Generation {
|
||||||
protected Hashtable methods = new Hashtable();
|
protected Hashtable methods = new Hashtable();
|
||||||
protected ArrayList interfaces = null;
|
protected ArrayList interfaces = null;
|
||||||
|
|
||||||
protected ClassBase (string ns, XmlElement elem) : base (ns, elem) {
|
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
|
||||||
foreach (XmlNode node in elem.ChildNodes) {
|
foreach (XmlNode node in elem.ChildNodes) {
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
switch (node.Name) {
|
switch (node.Name) {
|
||||||
case "method":
|
case "method":
|
||||||
methods.Add (member.GetAttribute ("name"), new Method (ns, member, this));
|
methods.Add (member.GetAttribute ("name"), new Method (LibraryName, member, this));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "property":
|
case "property":
|
||||||
|
@ -32,7 +32,7 @@ namespace GtkSharp.Generation {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "signal":
|
case "signal":
|
||||||
sigs.Add (member.GetAttribute ("name"), new Signal (ns, member));
|
sigs.Add (member.GetAttribute ("name"), new Signal (member));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "implements":
|
case "implements":
|
||||||
|
|
|
@ -13,12 +13,12 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class Ctor {
|
public class Ctor {
|
||||||
|
|
||||||
private string ns;
|
private string libname;
|
||||||
private XmlElement elem;
|
private XmlElement elem;
|
||||||
private Parameters parms;
|
private Parameters parms;
|
||||||
|
|
||||||
public Ctor (string ns, XmlElement elem) {
|
public Ctor (string libname, XmlElement elem) {
|
||||||
this.ns = ns;
|
this.libname = libname;
|
||||||
this.elem = elem;
|
this.elem = elem;
|
||||||
XmlElement parms_elem = elem ["parameters"];
|
XmlElement parms_elem = elem ["parameters"];
|
||||||
if (parms_elem != null)
|
if (parms_elem != null)
|
||||||
|
@ -67,7 +67,7 @@ namespace GtkSharp.Generation {
|
||||||
else
|
else
|
||||||
safety = "";
|
safety = "";
|
||||||
|
|
||||||
sw.WriteLine("\t\t[DllImport(\"" + SymbolTable.GetDllName(ns) + "\")]");
|
sw.WriteLine("\t\t[DllImport(\"" + libname + "\")]");
|
||||||
sw.WriteLine("\t\tstatic extern " + safety + "IntPtr " + cname + isig);
|
sw.WriteLine("\t\tstatic extern " + safety + "IntPtr " + cname + isig);
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class EnumGen : GenBase, IGeneratable {
|
public class EnumGen : GenBase, IGeneratable {
|
||||||
|
|
||||||
public EnumGen (String ns, XmlElement elem) : base (ns, elem) {}
|
public EnumGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
||||||
|
|
||||||
public String MarshalType {
|
public String MarshalType {
|
||||||
get
|
get
|
||||||
|
|
|
@ -12,10 +12,10 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public abstract class GenBase {
|
public abstract class GenBase {
|
||||||
|
|
||||||
private string ns;
|
private XmlElement ns;
|
||||||
private XmlElement elem;
|
private XmlElement elem;
|
||||||
|
|
||||||
protected GenBase (string ns, XmlElement elem)
|
protected GenBase (XmlElement ns, XmlElement elem)
|
||||||
{
|
{
|
||||||
this.ns = ns;
|
this.ns = ns;
|
||||||
this.elem = elem;
|
this.elem = elem;
|
||||||
|
@ -33,34 +33,40 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string LibraryName {
|
||||||
|
get {
|
||||||
|
return ns.GetAttribute ("library");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string Name {
|
public string Name {
|
||||||
get {
|
get {
|
||||||
return elem.GetAttribute ("name");
|
return elem.GetAttribute ("name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Namespace {
|
public string NS {
|
||||||
get {
|
get {
|
||||||
return ns;
|
return ns.GetAttribute ("name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string QualifiedName {
|
public string QualifiedName {
|
||||||
get {
|
get {
|
||||||
return ns + "." + Name;
|
return NS + "." + Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected StreamWriter CreateWriter ()
|
protected StreamWriter CreateWriter ()
|
||||||
{
|
{
|
||||||
char sep = Path.DirectorySeparatorChar;
|
char sep = Path.DirectorySeparatorChar;
|
||||||
string dir = ".." + sep + ns.ToLower() + sep + "generated";
|
string dir = ".." + sep + NS.ToLower() + sep + "generated";
|
||||||
if (!Directory.Exists(dir)) {
|
if (!Directory.Exists(dir)) {
|
||||||
Console.WriteLine ("creating " + dir);
|
Console.WriteLine ("creating " + dir);
|
||||||
Directory.CreateDirectory(dir);
|
Directory.CreateDirectory(dir);
|
||||||
}
|
}
|
||||||
String filename = dir + sep + Name + ".cs";
|
String filename = dir + sep + Name + ".cs";
|
||||||
Console.WriteLine ("creating " + filename);
|
// Console.WriteLine ("creating " + filename);
|
||||||
|
|
||||||
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
||||||
StreamWriter sw = new StreamWriter (stream);
|
StreamWriter sw = new StreamWriter (stream);
|
||||||
|
@ -68,7 +74,7 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ("// Generated File. Do not modify.");
|
sw.WriteLine ("// Generated File. Do not modify.");
|
||||||
sw.WriteLine ("// <c> 2001-2002 Mike Kestner");
|
sw.WriteLine ("// <c> 2001-2002 Mike Kestner");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("namespace " + ns + " {");
|
sw.WriteLine ("namespace " + NS + " {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
||||||
return sw;
|
return sw;
|
||||||
|
@ -82,10 +88,10 @@ namespace GtkSharp.Generation {
|
||||||
sw.Close();
|
sw.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AppendCustom (string ns, string name, StreamWriter sw)
|
public void AppendCustom (StreamWriter sw)
|
||||||
{
|
{
|
||||||
char sep = Path.DirectorySeparatorChar;
|
char sep = Path.DirectorySeparatorChar;
|
||||||
string custom = ".." + sep + ns.ToLower() + sep + name + ".custom";
|
string custom = ".." + sep + NS.ToLower() + sep + Name + ".custom";
|
||||||
if (File.Exists(custom)) {
|
if (File.Exists(custom)) {
|
||||||
FileStream custstream = new FileStream(custom, FileMode.Open, FileAccess.Read);
|
FileStream custstream = new FileStream(custom, FileMode.Open, FileAccess.Read);
|
||||||
StreamReader sr = new StreamReader(custstream);
|
StreamReader sr = new StreamReader(custstream);
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class InterfaceGen : ClassBase, IGeneratable {
|
public class InterfaceGen : ClassBase, IGeneratable {
|
||||||
|
|
||||||
public InterfaceGen (string ns, XmlElement elem) : base (ns, elem) {}
|
public InterfaceGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
||||||
|
|
||||||
public void Generate ()
|
public void Generate ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class Method {
|
public class Method {
|
||||||
|
|
||||||
private string ns;
|
private string libname;
|
||||||
private XmlElement elem;
|
private XmlElement elem;
|
||||||
private Parameters parms;
|
private Parameters parms;
|
||||||
private ClassBase container_type;
|
private ClassBase container_type;
|
||||||
|
@ -24,9 +24,9 @@ namespace GtkSharp.Generation {
|
||||||
private string name, cname, safety;
|
private string name, cname, safety;
|
||||||
private bool is_get, is_set;
|
private bool is_get, is_set;
|
||||||
|
|
||||||
public Method (string ns, XmlElement elem, ClassBase container_type)
|
public Method (string libname, XmlElement elem, ClassBase container_type)
|
||||||
{
|
{
|
||||||
this.ns = ns;
|
this.libname = libname;
|
||||||
this.elem = elem;
|
this.elem = elem;
|
||||||
if (elem["parameters"] != null)
|
if (elem["parameters"] != null)
|
||||||
parms = new Parameters (elem["parameters"]);
|
parms = new Parameters (elem["parameters"]);
|
||||||
|
@ -211,7 +211,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
protected void GenerateImport (StreamWriter sw)
|
protected void GenerateImport (StreamWriter sw)
|
||||||
{
|
{
|
||||||
sw.WriteLine("\t\t[DllImport(\"" + SymbolTable.GetDllName(ns) +
|
sw.WriteLine("\t\t[DllImport(\"" + libname +
|
||||||
"\", CallingConvention=CallingConvention.Cdecl)]");
|
"\", CallingConvention=CallingConvention.Cdecl)]");
|
||||||
sw.Write("\t\tstatic extern " + safety + m_ret + " " + cname + isig);
|
sw.Write("\t\tstatic extern " + safety + m_ret + " " + cname + isig);
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
private ArrayList ctors = new ArrayList();
|
private ArrayList ctors = new ArrayList();
|
||||||
|
|
||||||
public ObjectGen (string ns, XmlElement elem) : base (ns, elem)
|
public ObjectGen (XmlElement ns, XmlElement elem) : base (ns, elem)
|
||||||
{
|
{
|
||||||
foreach (XmlNode node in elem.ChildNodes) {
|
foreach (XmlNode node in elem.ChildNodes) {
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace GtkSharp.Generation {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "constructor":
|
case "constructor":
|
||||||
ctors.Add (new Ctor (ns, member));
|
ctors.Add (new Ctor (LibraryName, member));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -79,7 +79,7 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendCustom(Namespace, Name, sw);
|
AppendCustom(sw);
|
||||||
|
|
||||||
sw.WriteLine ("\t}");
|
sw.WriteLine ("\t}");
|
||||||
|
|
||||||
|
|
|
@ -72,27 +72,27 @@ namespace GtkSharp.Generation {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "boxed":
|
case "boxed":
|
||||||
SymbolTable.AddType (new BoxedGen (ns_name, elem));
|
SymbolTable.AddType (new BoxedGen (ns, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "callback":
|
case "callback":
|
||||||
SymbolTable.AddType (new CallbackGen (ns_name, elem));
|
SymbolTable.AddType (new CallbackGen (ns, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "enum":
|
case "enum":
|
||||||
SymbolTable.AddType (new EnumGen (ns_name, elem));
|
SymbolTable.AddType (new EnumGen (ns, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "interface":
|
case "interface":
|
||||||
SymbolTable.AddType (new InterfaceGen (ns_name, elem));
|
SymbolTable.AddType (new InterfaceGen (ns, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "object":
|
case "object":
|
||||||
SymbolTable.AddType (new ObjectGen (ns_name, elem));
|
SymbolTable.AddType (new ObjectGen (ns, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "struct":
|
case "struct":
|
||||||
SymbolTable.AddType (new StructGen (ns_name, elem));
|
SymbolTable.AddType (new StructGen (ns, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -13,14 +13,12 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class Signal {
|
public class Signal {
|
||||||
|
|
||||||
private string ns;
|
|
||||||
private string marsh;
|
private string marsh;
|
||||||
private string name;
|
private string name;
|
||||||
private XmlElement elem;
|
private XmlElement elem;
|
||||||
|
|
||||||
public Signal (string ns, XmlElement elem)
|
public Signal (XmlElement elem)
|
||||||
{
|
{
|
||||||
this.ns = ns;
|
|
||||||
this.elem = elem;
|
this.elem = elem;
|
||||||
this.name = elem.GetAttribute ("name");
|
this.name = elem.GetAttribute ("name");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,38 +12,9 @@ namespace GtkSharp.Generation {
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
public class StructBase {
|
public class StructBase : ClassBase {
|
||||||
|
|
||||||
protected String ns;
|
|
||||||
protected XmlElement elem;
|
|
||||||
|
|
||||||
public StructBase (String ns, XmlElement elem) {
|
|
||||||
|
|
||||||
this.ns = ns;
|
|
||||||
this.elem = elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String Name {
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return elem.GetAttribute("name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String QualifiedName {
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ns + "." + elem.GetAttribute("name");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String CName {
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return elem.GetAttribute("cname");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public StructBase (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
||||||
|
|
||||||
protected bool GenCtor(XmlElement ctor, StreamWriter sw, Hashtable clash_map)
|
protected bool GenCtor(XmlElement ctor, StreamWriter sw, Hashtable clash_map)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +46,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
String cname = ctor.GetAttribute("cname");
|
String cname = ctor.GetAttribute("cname");
|
||||||
|
|
||||||
sw.WriteLine("\t\t[DllImport(\"" + SymbolTable.GetDllName(ns) +
|
sw.WriteLine("\t\t[DllImport(\"" + LibraryName +
|
||||||
"\", CallingConvention=CallingConvention.Cdecl)]");
|
"\", CallingConvention=CallingConvention.Cdecl)]");
|
||||||
sw.WriteLine("\t\tstatic extern IntPtr " + cname + isig);
|
sw.WriteLine("\t\tstatic extern IntPtr " + cname + isig);
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
|
@ -178,7 +149,7 @@ namespace GtkSharp.Generation {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.WriteLine("\t\t[DllImport(\"" + SymbolTable.GetDllName(ns) +
|
sw.WriteLine("\t\t[DllImport(\"" + LibraryName +
|
||||||
"\", CallingConvention=CallingConvention.Cdecl)]");
|
"\", CallingConvention=CallingConvention.Cdecl)]");
|
||||||
sw.Write("\t\tstatic extern " + m_ret + " " + cname + isig);
|
sw.Write("\t\tstatic extern " + m_ret + " " + cname + isig);
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public class StructGen : StructBase, IGeneratable {
|
public class StructGen : StructBase, IGeneratable {
|
||||||
|
|
||||||
public StructGen (String ns, XmlElement elem) : base (ns, elem) {}
|
public StructGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
||||||
|
|
||||||
public String MarshalType {
|
public new string MarshalType {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return QualifiedName;
|
return QualifiedName;
|
||||||
|
@ -33,23 +33,8 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public void Generate ()
|
public void Generate ()
|
||||||
{
|
{
|
||||||
char sep = Path.DirectorySeparatorChar;
|
StreamWriter sw = CreateWriter ();
|
||||||
string dir = ".." + sep + ns.ToLower() + sep + "generated";
|
|
||||||
if (!Directory.Exists(dir)) {
|
|
||||||
Directory.CreateDirectory(dir);
|
|
||||||
}
|
|
||||||
String filename = dir + sep + Name + ".cs";
|
|
||||||
|
|
||||||
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
|
||||||
StreamWriter sw = new StreamWriter (stream);
|
|
||||||
|
|
||||||
sw.WriteLine ("// Generated File. Do not modify.");
|
|
||||||
sw.WriteLine ("// <c> 2001 Mike Kestner");
|
|
||||||
sw.WriteLine ();
|
|
||||||
|
|
||||||
sw.WriteLine ("namespace " + ns + " {");
|
|
||||||
sw.WriteLine ();
|
|
||||||
|
|
||||||
sw.WriteLine ("\tusing System;");
|
sw.WriteLine ("\tusing System;");
|
||||||
sw.WriteLine ("\tusing System.Collections;");
|
sw.WriteLine ("\tusing System.Collections;");
|
||||||
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
|
sw.WriteLine ("\tusing System.Runtime.InteropServices;");
|
||||||
|
@ -59,7 +44,7 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ("\tpublic class " + Name + " {");
|
sw.WriteLine ("\tpublic class " + Name + " {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
||||||
foreach (XmlNode node in elem.ChildNodes) {
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
|
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
|
@ -87,14 +72,10 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GenBase.AppendCustom(ns, Name, sw);
|
AppendCustom(sw);
|
||||||
|
|
||||||
sw.WriteLine ("\t}");
|
sw.WriteLine ("\t}");
|
||||||
sw.WriteLine ();
|
CloseWriter (sw);
|
||||||
sw.WriteLine ("}");
|
|
||||||
|
|
||||||
sw.Flush();
|
|
||||||
sw.Close();
|
|
||||||
Statistics.StructCount++;
|
Statistics.StructCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,11 +162,6 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetDllName(string ns)
|
|
||||||
{
|
|
||||||
return (string) dlls[ns];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetMarshalType(string c_type)
|
public static string GetMarshalType(string c_type)
|
||||||
{
|
{
|
||||||
c_type = Trim(c_type);
|
c_type = Trim(c_type);
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
makefile
2
makefile
|
@ -1,4 +1,4 @@
|
||||||
DIRS=generator glib pango atk gdk gdk.imaging gtk sample
|
DIRS=generator glib pango atk gdk gtk sample
|
||||||
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
|
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
|
||||||
CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe
|
CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe
|
||||||
MCS=mcs
|
MCS=mcs
|
||||||
|
|
|
@ -4,19 +4,14 @@ $file = "../generator/gtkapi.xml";
|
||||||
|
|
||||||
unlink ($file);
|
unlink ($file);
|
||||||
|
|
||||||
%ns = ( "Atk" => "atk-1.0.2/atk",
|
%srcs = ( "atk-1.0.0/atk" => "Atk:atk-1.0",
|
||||||
"Pango" => "pango-1.0.2/pango",
|
"pango-1.0.0/pango" => "Pango:pango-1.0",
|
||||||
"Gdk" => "gtk+-2.0.3/gdk",
|
"gtk+-2.0.0/gdk" => "Gdk:gdk-x11-2.0",
|
||||||
"Gdk.Imaging" => "gtk+-2.0.3/gdk-pixbuf",
|
"gtk+-2.0.0/gdk-pixbuf" => "Gdk:gdk_pixbuf-2.0",
|
||||||
"Gtk" => "gtk+-2.0.3/gtk");
|
"gtk+-2.0.0/gtk" => "Gtk:gtk-x11-2.0");
|
||||||
|
|
||||||
%c_ns = ( "Gdk.Imaging" => "Gdk");
|
foreach $dir (keys %srcs) {
|
||||||
|
($ns, $lib) = split (/:/, $srcs{$dir});
|
||||||
foreach $key (keys %ns) {
|
system ("./gapi_pp.pl $dir | ./gapi2xml.pl $ns $file $lib");
|
||||||
$dir = $ns{$key};
|
|
||||||
if (not ($c_key = $c_ns{$key})) {
|
|
||||||
$c_key = $key;
|
|
||||||
}
|
|
||||||
system ("./gapi_pp.pl $dir | ./gapi2xml.pl $c_key $file --out-ns $key");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,25 +12,20 @@ $debug=1;
|
||||||
use XML::LibXML;
|
use XML::LibXML;
|
||||||
use Metadata;
|
use Metadata;
|
||||||
|
|
||||||
if (!$ARGV[0]) {
|
if (!$ARGV[2]) {
|
||||||
die "Usage: gapi_pp.pl <srcdir> | gapi2xml.pl <namespace> <outfile> [--out-ns outns]\n";
|
die "Usage: gapi_pp.pl <srcdir> | gapi2xml.pl <namespace> <outfile> <libname>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$ns = $ARGV[0];
|
$ns = $ARGV[0];
|
||||||
|
$libname = $ARGV[2];
|
||||||
if ($ARGV[2] && $ARGV[2] eq "--out-ns") {
|
|
||||||
$out_ns = $ARGV[3];
|
|
||||||
} else {
|
|
||||||
$out_ns = $ns;
|
|
||||||
}
|
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
# If a filename was provided see if it exists. We parse existing files into
|
# Check if the filename provided exists. We parse existing files into
|
||||||
# a tree and append the namespace to the root node. If the file doesn't
|
# a tree and append the namespace to the root node. If the file doesn't
|
||||||
# exist, we create a doc tree and root node to work with.
|
# exist, we create a doc tree and root node to work with.
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
if ($ARGV[1] && -e $ARGV[1]) {
|
if (-e $ARGV[1]) {
|
||||||
#parse existing file and get root node.
|
#parse existing file and get root node.
|
||||||
$doc = XML::LibXML->new->parse_file($ARGV[1]);
|
$doc = XML::LibXML->new->parse_file($ARGV[1]);
|
||||||
$root = $doc->getDocumentElement();
|
$root = $doc->getDocumentElement();
|
||||||
|
@ -41,7 +36,8 @@ if ($ARGV[1] && -e $ARGV[1]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$ns_elem = $doc->createElement('namespace');
|
$ns_elem = $doc->createElement('namespace');
|
||||||
$ns_elem->setAttribute('name', $out_ns);
|
$ns_elem->setAttribute('name', $ns);
|
||||||
|
$ns_elem->setAttribute('library', $libname);
|
||||||
$root->appendChild($ns_elem);
|
$root->appendChild($ns_elem);
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
|
@ -23,5 +23,7 @@ clean:
|
||||||
unix:
|
unix:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
||||||
install:
|
install: linux
|
||||||
|
@echo "Nothing to install."
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue