From fe08134ba0b808a3d6e930a3b9d170ff638d0efd Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Sun, 17 Feb 2002 20:54:54 +0000 Subject: [PATCH] 2002-02-17 Mike Kestner * generator/StructBase.cs (MangleName): add object and event. * parser/gapi2xml.pl : Handle embedded callback declarations in method parameter lists. svn path=/trunk/gtk-sharp/; revision=2462 --- ChangeLog | 6 ++++++ generator/StructBase.cs | 7 ++++++- generator/gtkapi.xml | 2 +- parser/gapi2xml.pl | 36 ++++++++++++++++++++++++++++++++---- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf58de978..f3aa196dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-02-17 Mike Kestner + + * generator/StructBase.cs (MangleName): add object and event. + * parser/gapi2xml.pl : Handle embedded callback declarations in method + parameter lists. + 2002-02-15 Mike Kestner * generator/SignalHandler.cs : Create the SignalArgs.Args array and fix diff --git a/generator/StructBase.cs b/generator/StructBase.cs index 825bd7f0c..e97ac177f 100644 --- a/generator/StructBase.cs +++ b/generator/StructBase.cs @@ -190,7 +190,8 @@ namespace GtkSharp.Generation { foreach (XmlNode parm in parms.ChildNodes) { if (parm.Name != "parameter") { - continue; + Console.Write(parm.Name + " node "); + return false; } XmlElement elem = (XmlElement) parm; @@ -294,6 +295,10 @@ namespace GtkSharp.Generation { { if (name == "string") { return "str1ng"; + } else if (name == "event") { + return "evnt"; + } else if (name == "object") { + return "objekt"; } else { return name; } diff --git a/generator/gtkapi.xml b/generator/gtkapi.xml index ab0c1bdc0..8f8a2fa43 100644 --- a/generator/gtkapi.xml +++ b/generator/gtkapi.xml @@ -1,2 +1,2 @@ - + diff --git a/parser/gapi2xml.pl b/parser/gapi2xml.pl index edcd3a64e..ee764db0d 100755 --- a/parser/gapi2xml.pl +++ b/parser/gapi2xml.pl @@ -383,8 +383,27 @@ sub addFuncElems $mdef = delete $fdefs{$mname}; if (($mdef =~ /\((.*)\)/) && ($1 ne "void")) { - @parms = split(/,/, $1); - ($dump, @parms) = @params if $drop_1st; + @parms = (); + $parm = ""; + $pcnt = 0; + foreach $char (split(//, $1)) { + if ($char eq "(") { + $pcnt++; + } elsif ($char eq ")") { + $pcnt--; + } elsif (($pcnt == 0) && ($char eq ",")) { + @parms = (@parms, $parm); + $parm = ""; + next; + } + $parm .= $char; + } + + if ($parm) { + @parms = (@parms, $parm); + } + # @parms = split(/,/, $1); + ($dump, @parms) = @parms if $drop_1st; if (@parms > 0) { addParamsElem($el, @parms); } @@ -416,10 +435,19 @@ sub addParamsElem my $parms_elem = $doc->createElement('parameters'); $parent->appendChild($parms_elem); foreach $parm (@params) { - $parm_elem = $doc->createElement('parameter'); - $parms_elem->appendChild($parm_elem); $parm =~ s/\s+(\*+)/\1 /g; $parm =~ s/const\s+/const-/g; + if ($parm =~ /(.*)\(\s*\**\s*(\w+)\)\s+\((.*)\)/) { + my $ret = $1; my $cbn = $2; my $params = $3; + $cb_elem = addNameElem($parms_elem, 'callback', $cbn); + addReturnElem($cb_elem, $ret); + if ($params && ($params ne "void")) { + addParamsElem($cb_elem, split(/,/, $params)); + } + next; + } + $parm_elem = $doc->createElement('parameter'); + $parms_elem->appendChild($parm_elem); $parm =~ /(\S+)\s+(\S+)/; $parm_elem->setAttribute('type', $1); my $name = $2;