Merge pull request #25 from Forage/master

GAPI: Additonal types support + class const fields support
This commit is contained in:
Mike Kestner 2011-09-26 07:20:38 -07:00
commit 61a213c7b8
2 changed files with 10 additions and 2 deletions

View File

@ -84,12 +84,16 @@ namespace GtkSharp.Generation {
AddType (new SimpleGen ("ulong", "uint", "0"));
AddType (new SimpleGen ("gulong", "uint", "0"));
AddType (new SimpleGen ("unsigned long", "uint", "0"));
AddType (new SimpleGen ("gintptr", "int", "0"));
AddType (new SimpleGen ("guintptr", "uint", "0"));
#else
AddType (new LPGen ("long"));
AddType (new LPGen ("glong"));
AddType (new LPGen ("gintptr"));
AddType (new LPUGen ("ulong"));
AddType (new LPUGen ("gulong"));
AddType (new LPUGen ("unsigned long"));
AddType (new LPUGen ("guintptr"));
#endif
AddType (new LPGen ("ssize_t"));
@ -121,6 +125,7 @@ namespace GtkSharp.Generation {
AddType (new ManualGen ("GSList", "GLib.SList"));
AddType (new ManualGen ("GVariant", "GLib.Variant"));
AddType (new ManualGen ("GVariantType", "GLib.VariantType"));
AddType (new ManualGen ("GValueArray", "GLib.ValueArray"));
AddType (new MarshalGen ("gunichar", "char", "uint", "GLib.Marshaller.CharToGUnichar ({0})", "GLib.Marshaller.GUnicharToChar ({0})"));
AddType (new MarshalGen ("time_t", "System.DateTime", "IntPtr", "GLib.Marshaller.DateTimeTotime_t ({0})", "GLib.Marshaller.time_tToDateTime ({0})"));
AddType (new MarshalGen ("GString", "string", "IntPtr", "new GLib.GString ({0}).Handle", "GLib.GString.PtrToString ({0})"));

View File

@ -574,8 +574,11 @@ sub addClassElem
$vm_elem->setAttribute('padding', 'true');
}
}
} elsif ($field =~ /(unsigned\s+)?(\S+)\s+(.+)/) {
my $type = $1 . $2; $symb = $3;
} elsif ($field =~ /(unsigned\s+)?(const\s+)?(\S+)\s+(.+)/) {
my $unsigned = $1; $const = $2; $name = $3; $symb = $4;
$const =~ s/const\s+/const\-/g;
my $type = $unsigned . $const . $name;
foreach $tok (split (/,\s*/, $symb)) { # multiple field defs may occur in one line; like int xrange, yrange;
$tok =~ /(\*)?(\w+)\s*(.*)/;
my $field_type = $type . $1; my $cname = $2; my $modifiers = $3;