Author: andreia
Date: 2008-01-28 22:34:22 -0500 (Mon, 28 Jan 2008)
New Revision: 94227

Modified:
   trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/ChangeLog
   trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/xpidl2cs.pl
Log:
* xpidl2cs.pl: Add support for arrays in parameters

2008-01-29  Andreia Gaita <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/ChangeLog       2008-01-29 
03:31:51 UTC (rev 94226)
+++ trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/ChangeLog       2008-01-29 
03:34:22 UTC (rev 94227)
@@ -1,3 +1,7 @@
+2008-01-29  Andreia Gaita  <[EMAIL PROTECTED]>
+
+       * xpidl2cs.pl: Add support for arrays in parameters
+
 2008-01-24  Andreia Gaita  <[EMAIL PROTECTED]>
 
        * xpidl2cs.pl: Add support for different marshalling depending

Modified: trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/xpidl2cs.pl
===================================================================
--- trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/xpidl2cs.pl     2008-01-29 
03:31:51 UTC (rev 94226)
+++ trunk/mcs/class/Mono.Mozilla/tools/xpidl2cs/xpidl2cs.pl     2008-01-29 
03:34:22 UTC (rev 94227)
@@ -161,8 +161,9 @@
     my $x = shift;
     my $ret = '';
     my %list;
+#    print $methods{$x}->{"params"}."\n";
     my @params = split /,/, $methods{$x}->{"params"};
-
+       
 #    print "params:@params:\n";
     for my $param (@params) {
        my $marshal;
@@ -174,7 +175,7 @@
 
 #      print "param:$param:\n";
        my @p = split (" ", $param);
-
+#      print "@p\n";
 # need to backtrack to a previous parameter defined by iid_is(name) and 
 # replace the type of this one with that. who the $%#@ came up with this idea? 
le sigh.
 
@@ -191,13 +192,20 @@
            }
        }
 
-       shift @p unless @p[0] =~ /(in|out)/;
+       if (@p[0] =~ m/array/) {
+           until (scalar(@p) == 3) {
+               shift @p;
+           }
+           $isout = 1 if (@p[0] =~ m/out/);
+           shift @p;
 
-       if (@p[0] =~ m/out/) {
-           $isout = 1;
+           $type = @p[0] . "[]";
        }
-       shift @p;
 
+       shift @p unless @p[0] =~ /(in|out)/;
+       $isout = 1 if (@p[0] =~ m/out/);
+       shift @p unless scalar(@p) <= 2;
+
        # if an out parameter is of type nsQIResult, that means
        # it will return a pointer to an interface (that can be anything). 
        # That means we want to return an IntPtr, and later cast it to
@@ -223,8 +231,9 @@
        $out = &get_out($type) if $isout;
 
        $type = &get_type (@p[0]) unless $type;
+       shift @p unless scalar(@p) == 1;
        $marshal = &get_marshal ($type) unless $marshal;
-       $name = @p[1] unless $name;
+       $name = @p[0] unless $name;
 
 #      print "marshal:$marshal\ttype:$type\tname:$name\n";
 
@@ -319,7 +328,7 @@
                    my  $m = substr($line, 0, index($line, "("));
                    my @atts = split / /, $m;
 
-#                  print $m;
+#                  print "$m\n";
                    $mname = pop @atts;
 #                  print "name=$mname\n";
                    my @nospaces = grep /[^ ]/, @atts;
@@ -333,6 +342,7 @@
                    @atts = split / /, $mparams;
                    @nospaces = grep /[^ ]/, @atts;
                    $mparams = join " ", @nospaces;
+#                  print "params=>$mparams\n";
 
                }
                elsif (index ($line, "raises") == -1) {
@@ -342,9 +352,11 @@
                    my @atts = split / /, $mparams;
                    my @nospaces = grep /[^ ]/, @atts;
                    $mparams = join " ", @nospaces;
+#                  print "params=>$mparams\n";
                }
                if (index ($line, ";") != -1) {
                    $method = 0;
+                   $mparams =~ s/\[([^\]]+),([^\]]+),([^\]]+)\]/\1 \2 \3/;
                    $mparams =~ s/\[([^\]]+),([^\]]+)\]/\1 \2/;
                    $mparams =~ s/\(/ /;
                    $mparams =~ s/\)//;
@@ -412,7 +424,6 @@
     print X " : $parent" if $parent !~ /nsISupports/;
     print X " {\n";
 
-
     if ($parent !~ /nsISupports/) {
        print X &parse_parent ($parent);
     }
@@ -421,7 +432,6 @@
 
     my @items = split ",", $interface->{"items"};
     for my $item (@items) {
-
        print X "\t\t[PreserveSigAttribute]\n";
        print X "\t\t[MethodImpl (MethodImplOptions.InternalCall, 
MethodCodeType = MethodCodeType.Runtime)]\n";
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to