[Mono-devel-list] Patch for System.Drawing.Graphics.DrawString

2005-05-23 Thread Kornél Pál

Hi,

This patch is related to bug #74762:
http://bugzilla.ximian.com/show_bug.cgi?id=74762

The current fix works, but I think the attached fix would be better.

It throws the same exceptions as MS implementaion and using only one
DrawString implementation that is called by the other overloaded DrawStrings
is a better choice.

Comments are welcomed.

Kornl


System.Drawing.Graphics.diff
Description: Binary data
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] Stack frames with null methods

2005-05-23 Thread Kornél Pál

Hi,

Stack frames can be obtained usually using two ways:
1. Stack trace from an Exception
2. The current stack trace

.NET Framework returns only stack frames with non-null methods.

Mono returns track frames for wrapper functions created by the runtime.
These wrapper functions have no methods associated.

The problem is that StackFrame.GetMethod() may return null on Mono but never
returns null on .NET Framework.

As I know there is no way to get the wrapper function name using managed
code from the runtim on Mono.

I think returning stack frames with null methods is useless.

There is a bug in corlib:
Current StackTrace returns no null methods but StackTrace for an Exception
returns null methods. The behaviour regarding null methods should be
consistent.

The only case when wrapper method can be identified is Exception.StackTrace
property as it calls the internal GetInternalMethodName method of
StackFrame.

Note that the StackFrames of wrapper methods are ignored in the current
StackTrace.

Sometimes it can be good if you know that the exception ocurred in a wrapper
method but StackFrames with null method infos are useless and are making
Mono inclompatible with .NET Framework.

I think the solution sould be not to return StackFrames with null methods in
any cases (current or exception StackTrace) but include them in the string
representation of both stack traces.

Comments are welcomed about stack frames with null methods.

Kornl

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] [PATCH]Mono.Data.SqliteClient - Parameter Support

2005-05-23 Thread Thomas Zoechling

http://bugzilla.ximian.com/show_bug.cgi?id=62613

I merged the patches provided by Chris Turchin and Jeroen Zwartepoorte.

   - Parameter support for sqlite2 (regular expression to extract the 
Paramter)

   - Parameter support for sqlite3 (native via sqlite3_bind)
   - Nunit Tests
   - Enables DataAdapter for Sqlite
Index: Mono.Data.SqliteClient/SqliteParameterCollection.cs
===
--- Mono.Data.SqliteClient/SqliteParameterCollection.cs (revision 44904)
+++ Mono.Data.SqliteClient/SqliteParameterCollection.cs (working copy)
@@ -4,8 +4,11 @@
 // Represents a collection of parameters relevant to a SqliteCommand as well 
as 
 // their respective mappings to columns in a DataSet.
 //
-// Author(s): Vladimir Vukicevic  [EMAIL PROTECTED]
-//Everaldo Canuto  [EMAIL PROTECTED]
+//Author(s):   Vladimir Vukicevic  [EMAIL PROTECTED]
+// Everaldo Canuto  [EMAIL PROTECTED]
+// Chris Turchin [EMAIL PROTECTED]
+// Jeroen Zwartepoorte [EMAIL PROTECTED]
+// Thomas Zoechling [EMAIL PROTECTED]
 //
 // Copyright (C) 2002  Vladimir Vukicevic
 //
@@ -46,85 +49,148 @@
#endregion
 
#region Private Methods
-   
+
private void CheckSqliteParam (object value)
{
if (!(value is SqliteParameter))
-   throw new InvalidCastException(Can only use 
SqliteParameter objects);
-   }
+   throw new InvalidCastException (Can only use 
SqliteParameter objects);
+   SqliteParameter sqlp = value as SqliteParameter;
+   if (sqlp.ParameterName == null || 
sqlp.ParameterName.Length == 0)
+   sqlp.ParameterName = 
this.GenerateParameterName();
+ }
 
private void RecreateNamedHash ()
{
-   for (int i = 0; i  numeric_param_list.Count; i++) {
+   for (int i = 0; i  numeric_param_list.Count; i++) 
+   {
named_param_hash[((SqliteParameter) 
numeric_param_list[i]).ParameterName] = i;
}
}
-   
+
+   //FIXME: if the user is calling Insert at various locations 
with unnamed parameters, this is not going to work
+   private string GenerateParameterName()
+   {
+   int index   = this.Count + 1;
+   string  name= String.Empty;
+
+   while (index  0)
+   {
+   name = : + index.ToString();
+   if (this.IndexOf(name) == -1)
+   index = -1;
+   else
+   index++;
+   }
+   return name;
+   }
+
#endregion
 
#region Properties

object IList.this[int index] {
-   get {
+   get 
+   {
return this[index];
}
-   set {
+   set 
+   {
CheckSqliteParam (value);
this[index] = (SqliteParameter) value;
}
}

object IDataParameterCollection.this[string parameterName] {
-   get {
+   get 
+   {
return this[parameterName];
}
-   set {
+   set 
+   {
CheckSqliteParam (value);
this[parameterName] = (SqliteParameter) value;
}
}

-   public SqliteParameter this[string parameterName] {
-   get {
-   return this[(int) 
named_param_hash[parameterName]];
+   public SqliteParameter this[string parameterName] 
+   {
+   get 
+   {
+   if (this.Contains(parameterName))
+   return this[(int) 
named_param_hash[parameterName]];
+   else
+   throw new IndexOutOfRangeException(The 
specified name does not exist:  + parameterName);
}
-   set {
-   if (this.Contains (parameterName))
+   set

[Mono-devel-list] planning module standalone_tests

2005-05-23 Thread Atsushi Eno
Hello,
(B
(BWith related to XSLT standalone tests, I talked with Andrew and Ben,
(Band we think about having separate "standalone_tests" module, since
(Bthose tests are likely to increate mono's tarball size extraneously
(Bwhen we just put them inside mcs module.
(B
(BThings we should note are:
(B
(B- In this module we are likely to check all the
(B  dependencies into svn (e.g. OASIS XSLT test archive
(B  itself, the test result output archives, and so on)
(B
(B- We are not moving everything right now.
(B
(B- For every standalone tests it should not break existing
(B  standalone tests, including our daily-basis tests and
(B  buildbot tests (if any, I don't think we have such
(B  ones though). For example decent standalone tests might
(B  not premise that tested assemblies are in GAC.
(B
(B- If required, when running daily tests or auto build,
(B  I think we can add some lines to those scripts to
(B  checkout those standalone module(s) in a certain
(B  directory (e.g. sys.xml/Test/sys.xml.xsl/standalone_tests)
(B  and run tests as well as we do now.
(B
(BIf this plan does not sound bad, I'll first svn move xml related
(Bstandalone tests to there e.g. "standalone_tests/System.Xml.Xsl".
(B
(BI appreciate your comments.
(B
(BAtsushi Eno
(B___
(BMono-devel-list mailing list
(BMono-devel-list@lists.ximian.com
(Bhttp://lists.ximian.com/mailman/listinfo/mono-devel-list

Re: [Mono-devel-list] Patch for System.Data.Common and System.Data.ProviderBase

2005-05-23 Thread Sureshkumar T
 Index: DbParameterBase.cs
 ===
 --- DbParameterBase.cs(revision 44908)
 +++ DbParameterBase.cs(working copy)
 @@ -4,6 +4,7 @@
  // Author:
  //   Sureshkumar T ([EMAIL PROTECTED])
  //   Tim Coleman ([EMAIL PROTECTED])
 +//   Boris Kirzner [EMAIL PROTECTED]
  //
  // Copyright (C) Tim Coleman, 2003
  //
 @@ -30,27 +31,30 @@
  // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  //
  
 -#if NET_2_0
 +#if NET_2_0 || TARGET_JVM
  
  using System.Data.Common;
  
  namespace System.Data.ProviderBase {
   public abstract class DbParameterBase : DbParameter
   {
 + #region Fields
  
 -#region Fields

I guess this is a whitespace changes. 

 -string _name;
 -ParameterDirection _direction = ParameterDirection.Input;
 -bool _isNullable = false;
 + string _parameterName;

not accepted. mere naming change. 

   int _size;
 +#if NET_2_0
   byte _precision;
   byte _scale;
 -object _paramValue;
 -int _offset;
   DataRowVersion _sourceVersion;
 +#endif
 + object _value;

not accepted. mere naming change. 

 + ParameterDirection _direction;
 + bool _isNullable;
 + int _offset;
   string _sourceColumn;
 + DbParameterCollection _parent = null;
  
 -#endregion // Fields
 + #endregion // Fields
  
   #region Constructors
   
 @@ -59,11 +63,19 @@
   {
   }
  
 - [MonoTODO]
   protected DbParameterBase (DbParameterBase source)
   {
 + if (source == null) {
 + throw ExceptionHelper.ArgumentNull(source);

this example, where mono's coding guidelines is not followed. refer
bottom of this message.

 + }
 +
 + source.CopyTo(this);
 + ICloneable cloneable = source._value as ICloneable;
 + if (cloneable != null)  {
 + _value = cloneable.Clone();
 + }
   }
 -
 +
   #endregion // Constructors
  
   #region Properties
 @@ -73,9 +85,29 @@
   get { throw new NotImplementedException (); }
   }
  
 -public override ParameterDirection Direction {
 - get { return _direction; }
 - set { _direction = value; }
 + public override ParameterDirection Direction {
 + get {
 + if (_direction == ((ParameterDirection) 0)) {
 + return ParameterDirection.Input;
 + }

what is this check for? revert to previous default assignment of
ParameterDirection.Input.

 + return _direction;
 + }
 + set {
 + if (_direction != value) {
 + switch (value) {
 + case 
 ParameterDirection.Input:
 + case 
 ParameterDirection.Output:
 + case 
 ParameterDirection.InputOutput:
 + case 
 ParameterDirection.ReturnValue:
 + {
 + 
 PropertyChanging();
 + _direction = 
 value;
 + return;
 + }
 + }
 + throw 
 ExceptionHelper.InvalidParameterDirection(value);
 + }
 + 

By the property declaration, this property cannot be set of any value
other than of type ParameterDirection. These exception handling are
irrelevant. Or am I missing something?

 } }
  
 + internal DbParameterCollection Parent
 + {
 + get { return _parent; }
 + set { _parent = value; }
 + }
 +

what is the need for this parent reference? is the internal type
justified?  Avoid using internal as far as possible as it complicates
the design. Instead, write a internal method wherever you want to access
internal data. i.e. add a public behavior to manipulate a state rather
the state itself.

 + * DbParameterBase.cs
 + - Private members names changed to suite naming conventions.

where did you get this naming convetion? I