* generator/Parameters.cs:

* generator/StructBase.cs:
        * generator/SymbolTable.cs: Fixed the keyword base was not
        mangled, also did a little refactoring.

svn path=/trunk/gtk-sharp/; revision=17702
This commit is contained in:
Martin Willemoes Hansen 2003-08-28 16:49:29 +00:00
parent 1272d759e0
commit f7ba4e2866
4 changed files with 41 additions and 59 deletions

View File

@ -4,6 +4,10 @@
proper copyright header.
* sources/Gtk.metadata: Fixed new_flag rules, they did not
get applied to the gtk-api.xml.
* generator/Parameters.cs:
* generator/StructBase.cs:
* generator/SymbolTable.cs: Fixed the keyword base was not
mangled, also did a little refactoring.
2003-08-28 Alp Toker <alp@atoker.com>

View File

@ -75,7 +75,7 @@ namespace GtkSharp.Generation {
public string Name {
get {
return MangleName (elem.GetAttribute("name"));
return SymbolTable.Table.MangleName (elem.GetAttribute("name"));
}
}
@ -91,37 +91,6 @@ namespace GtkSharp.Generation {
}
}
private string MangleName(string name)
{
switch (name) {
case "string":
return "str1ng";
case "event":
return "evnt";
case "null":
return "is_null";
case "object":
return "objekt";
case "params":
return "parms";
case "ref":
return "reference";
case "in":
return "in_param";
case "out":
return "out_param";
case "fixed":
return "mfixed";
case "byte":
return "_byte";
case "new":
return "_new";
default:
break;
}
return name;
}
public string StudlyName {
get {
string name = elem.GetAttribute("name");

View File

@ -141,7 +141,7 @@ namespace GtkSharp.Generation {
if (IsBit (field))
name = String.Format ("_bitfield{0}", bitfields++);
else
name += MangleName (field.GetAttribute ("cname"));
name += SymbolTable.Table.MangleName (field.GetAttribute ("cname"));
return true;
}
@ -151,14 +151,14 @@ namespace GtkSharp.Generation {
string c_type, type, name;
if (!GetFieldInfo (field, out c_type, out type, out name))
return false;
sw.WriteLine ("\t\tpublic {0} {1};", type, name);
sw.WriteLine ("\t\tpublic {0} {1};", type, SymbolTable.Table.MangleName (name));
if (field.HasAttribute("array_len"))
Console.WriteLine ("warning: array field {0}.{1} probably incorrectly generated", QualifiedName, name);
SymbolTable table = SymbolTable.Table;
string wrapped = table.GetCSType (c_type);
string wrapped_name = MangleName (field.GetAttribute ("cname"));
string wrapped_name = SymbolTable.Table.MangleName (field.GetAttribute ("cname"));
if (table.IsObject (c_type)) {
sw.WriteLine ();
sw.WriteLine ("\t\tpublic " + wrapped + " " + wrapped_name + " {");
@ -190,29 +190,6 @@ namespace GtkSharp.Generation {
return true;
}
private String MangleName(String name)
{
if (name == "string") {
return "str1ng";
} else if (name == "event") {
return "evnt";
} else if (name == "null") {
return "is_null";
} else if (name == "object") {
return "objekt";
} else if (name == "ref") {
return "reference";
} else if (name == "params") {
return "parms";
} else if (name == "fixed") {
return "mfixed";
} else if (name == "in") {
return "inn";
} else {
return name;
}
}
public virtual void Generate ()
{
StreamWriter sw = CreateWriter ();

View File

@ -292,6 +292,38 @@ namespace GtkSharp.Generation {
return false;
}
public string MangleName(string name)
{
switch (name) {
case "string":
return "str1ng";
case "event":
return "evnt";
case "null":
return "is_null";
case "object":
return "objekt";
case "params":
return "parms";
case "ref":
return "reference";
case "in":
return "in_param";
case "out":
return "out_param";
case "fixed":
return "mfixed";
case "byte":
return "_byte";
case "new":
return "_new";
case "base":
return "_base";
default:
break;
}
return name;
}
}
}