2002-07-23 Mike Kestner <mkestner@speakeasy.net>

* generator/Method.cs : implement static method generation.
	* parser/Gnome.metadata : map AppBar::ClearPrompt signal collision.
	* parser/Gtk.metadata : map IMContext::DeleteSurrounding collision.
	* parser/gapi2xml.pl : mark shared methods in the XML.

svn path=/trunk/gtk-sharp/; revision=6096
This commit is contained in:
Mike Kestner 2002-07-23 22:23:40 +00:00
parent 2f44d60039
commit 7ba51928a5
9 changed files with 8307 additions and 7220 deletions

View file

@ -1,3 +1,10 @@
2002-07-23 Mike Kestner <mkestner@speakeasy.net>
* generator/Method.cs : implement static method generation.
* parser/Gnome.metadata : map AppBar::ClearPrompt signal collision.
* parser/Gtk.metadata : map IMContext::DeleteSurrounding collision.
* parser/gapi2xml.pl : mark shared methods in the XML.
2002-07-20 Mike Kestner <mkestner@speakeasy.net>
* generator/SignalHandler.cs : pring unexpected key in exception.

View file

@ -122,6 +122,7 @@ namespace GtkSharp.Generation {
m_ret = SymbolTable.GetMarshalType(rettype);
s_ret = SymbolTable.GetCSType(rettype);
cname = elem.GetAttribute("cname");
bool is_shared = elem.HasAttribute("shared");
if (ret_elem.HasAttribute("array")) {
s_ret += "[]";
@ -139,12 +140,12 @@ namespace GtkSharp.Generation {
if (parms != null) {
parms.CreateSignature (is_set);
sig = "(" + parms.Signature + ")";
isig = "(IntPtr raw, " + parms.ImportSig + ");";
call = "(Handle, " + parms.CallString + ")";
isig = "(" + (is_shared ? "" : "IntPtr raw, ") + parms.ImportSig + ");";
call = "(" + (is_shared ? "" : "Handle, ") + parms.CallString + ")";
} else {
sig = "()";
isig = "(IntPtr raw);";
call = "(Handle)";
isig = "(" + (is_shared ? "" : "IntPtr raw") + ");";
call = "(" + (is_shared ? "" : "Handle") + ")";
}
initialized = true;
@ -177,6 +178,8 @@ namespace GtkSharp.Generation {
private void GenerateDeclCommon (StreamWriter sw, ClassBase implementor)
{
if (elem.HasAttribute("shared"))
sw.Write("static ");
sw.Write(safety);
Method dup = null;
if (Name == "ToString")

File diff suppressed because it is too large Load diff

View file

@ -11,9 +11,6 @@
[DllImport("gobject-2.0")]
static extern void g_type_init ();
[DllImport("libgnome-2.so.0")]
static extern System.IntPtr gnome_program_get_type ();
[StructLayout(LayoutKind.Sequential)]
struct PropertyArg {
public string name;

View file

@ -2,6 +2,17 @@
<metadata>
<!-- renames -->
<rule>
<class name="GnomeAppBar">
<signal>ClearPrompt</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>PromptCleared</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeClient">
<signal>Connect</signal>

View file

@ -174,6 +174,17 @@
</attribute>
</data>
</rule>
<rule>
<class name="GtkIMContext">
<signal>DeleteSurrounding</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>SurroundingDeleted</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<signal>Show</signal>

View file

@ -266,6 +266,8 @@ foreach $type (sort(keys(%objects))) {
$classcnt++;
$obj_el = addNameElem($ns_elem, 'object', $inst, $ns);
$elem_table{lc($inst)} = $obj_el;
# Extract parent and fields from the struct
if ($instdef =~ /^struct/) {
$instdef =~ /\{(.*)\}/;
@ -293,7 +295,6 @@ foreach $type (sort(keys(%objects))) {
warn "Don't have a GetType func for $inst.\n" if $debug;
}
addFuncElems($obj_el, $inst);
}
##############################################################
@ -328,6 +329,9 @@ foreach $key (sort (keys (%types))) {
} else {
$struct_el = addNameElem($ns_elem, 'struct', $key, $ns);
}
$elem_table{lc($key)} = $struct_el;
$def =~ s/\s+/ /g;
if ($def =~ /privatestruct/) {
$struct_el->setAttribute('opaque', 'true');
@ -335,9 +339,10 @@ foreach $key (sort (keys (%types))) {
$def =~ /\{(.+)\}/;
addFieldElems($struct_el, split(/;/, $1));
}
addFuncElems($struct_el, $key);
}
addFuncElems();
# This should probably be done in a more generic way
foreach $define (sort (keys (%defines))) {
next if $define !~ /[A-Z]_STOCK_/;
@ -418,33 +423,44 @@ sub addFieldElems
sub addFuncElems
{
my ($obj_el, $inst) = @_;
my $prefix = $inst;
$prefix =~ s/([A-Z]+)/_\1/g;
$prefix = lc($prefix);
$prefix =~ s/^_//;
$prefix .= "_";
my ($obj_el, $inst, $prefix);
$fcnt = keys(%fdefs);
foreach $mname (keys(%fdefs)) {
next if ($mname !~ /^$prefix/);
foreach $mname (sort (keys (%fdefs))) {
next if ($mname =~ /^_/);
$obj_el = "";
$prefix = $mname;
while ($prefix =~ /(\w+)_/) {
$prefix = $key = $1;
$key =~ s/_//g;
if (exists ($elem_table{$key})) {
$prefix .= "_";
$obj_el = $elem_table{$key};
$inst = $key;
last;
}
}
next if (!$obj_el);
$mdef = delete $fdefs{$mname};
if ($mname =~ /$prefix(new)/) {
$el = addNameElem($obj_el, 'constructor', $mname);
$drop_1st = 0;
} elsif ($fdefs{$mname} =~ /\(\s*(const)?\s*$inst\b/) {
$el = addNameElem($obj_el, 'method', $mname, $prefix);
$fdefs{$mname} =~ /(.*?)\w+\s*\(/;
addReturnElem($el, $1);
$drop_1st = 1;
} else {
next;
$el = addNameElem($obj_el, 'method', $mname, $prefix);
$mdef =~ /(.*?)\w+\s*\(/;
addReturnElem($el, $1);
$mdef =~ /\(\s*(const)?\s*(\w+)/;
if (lc($2) ne $inst) {
$el->setAttribute("shared", "true");
$drop_1st = 0;
} else {
$drop_1st = 1;
}
}
$mdef = delete $fdefs{$mname};
if (($mdef =~ /\((.*)\)/) && ($1 ne "void")) {
@parms = ();
$parm = "";

View file

@ -2,6 +2,17 @@
<metadata>
<!-- renames -->
<rule>
<class name="GnomeAppBar">
<signal>ClearPrompt</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>PromptCleared</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeClient">
<signal>Connect</signal>

View file

@ -174,6 +174,17 @@
</attribute>
</data>
</rule>
<rule>
<class name="GtkIMContext">
<signal>DeleteSurrounding</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>SurroundingDeleted</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<signal>Show</signal>