[Python.NET] Updates to callconvutil.cs for .NET 2.0

Brian Lloyd brian at zope.com
Fri Sep 16 15:29:21 CEST 2005


Thanks for the patch! I've been slammed lately and haven't 
had time to wrap up 1.0 and make the 2.x branch ;(

Any details you can post on the access violations would be 
helpful too (to me, anyway).


Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716              
Zope Corporation   http://www.zope.com 


> -----Original Message-----
> From: pythondotnet-bounces+brian=zope.com at python.org
> [mailto:pythondotnet-bounces+brian=zope.com at python.org]On Behalf Of
> Michael Eddington
> Sent: Thursday, September 15, 2005 7:22 PM
> To: pythondotnet at python.org
> Subject: [Python.NET] Updates to callconvutil.cs for .NET 2.0
> 
> 
> Anyone else out there started to mess with Python.NET on the 2.0
> platform?  One of the first hurtles was the output from ildasm does
> not always place the method name on the next line, causing
> callconvutil to place the modopt in the wrong place.  I've added a
> regex in to check for and split the method line if the function name
> is found.
> 
> Currently getting lots of access violation exceptions.
> 
> mike
> 
> Replace ReadMethod with the following:
> 
>     public void ReadMethod(string line)
>     {
>         Regex findMethod = new
> Regex(@"^(\s*.method\s.*\s)([^\s()]+\([^()]*(?:,|\)\s.*))$");
> 
>         ArrayList lines = new ArrayList();
>         string mline = line;
> 
>         string data;
>         string buff;
> 
>         while ((data = reader.ReadLine()) != null)
>         {
>             buff = data.Trim();
>             if (buff.StartsWith(ccAttr))
>             {
>                 // BUG: mline may have method name in it already 
> which breaks
>                 //      things.  This is mostly seen in .NET 2.0.
>                 // Example:  .method public hidebysig static int32 
> tp_descr_set(native int ds,
>                 if (findMethod.IsMatch(mline))
>                 {
>                     // method name is on same line as .method.  
> Need to insert
>                     // modOpt prior to method name.
>                     Match match = findMethod.Match(mline);
> 
>                     writer.WriteLine(match.Groups[1].Value + " ");
>                     writer.WriteLine(modOpt + " ");
>                     writer.WriteLine(match.Groups[2].Value);
>                 }
>                 else
>                 {
>                     writer.WriteLine(mline);
>                     writer.WriteLine(modOpt);
>                 }
> 
>                 WriteBuffer(lines);
>                 writer.WriteLine(data);
>                 return;
>             }
>             else if (buff.StartsWith("} // end of method"))
>             {
>                 writer.WriteLine(mline);
>                 WriteBuffer(lines);
>                 writer.WriteLine(data);
>                 return;
>             }
>             lines.Add(data);
>         }
>     }
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
> 


More information about the PythonDotNet mailing list