dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]DotGNU-Libs Mailing List for Commits proposal


From: Peter Minten
Subject: Re: [DotGNU]DotGNU-Libs Mailing List for Commits proposal
Date: Mon, 31 Mar 2003 09:44:11 +0200

Stephen Compall wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Sunday 30 March 2003 01:19 pm, minddog wrote:
> > Following in pnet's footsteps we'd like a commits list for
> > dotgnu-libs because it is growing rapidly with the addition of a few
> > new namespaces being planned, ie: DotGNU.Collections , DotGNU.Rdf.
> > Does anyone agree?
> 
> No, but not for the reason you'd think:
> 
> If we're to insist that the MS extensions are deprecated (as at least
> *I* do), then it won't do to have them more accessible than the
> (superior) replacements in dotgnu-libs.  This is why I wanted to make
> ECMA-only libs the default.  But Rhys had another suggestion last
> meeting:
> 
> [21:58] <S11001001> I just think it's a problem, that for example the
> presence of MS collections discourages development of non-MS
> collection alternatives
> [21:59] <rhysw> I wasn't aware that it was discouraging development -
> MS collections are pretty basic and stupid anyway
> [21:59] <chillywilly> it promotes borg-like bahavior ;)
> [22:00] nb (address@hidden) joined #dotgnu.
> [22:00] <rhysw> on the subject of non-MS libraries, perhaps we should
> roll dotgnu-libs back into pnetlib - it might get more exposure that
> way
> 
> So how about this?

My humble suggestion: put it in the baselib. Due to the sealed classes it's
impossible to implement some stuff elsewhere. Plus you can put convenience
methods high into the classes.

I've attached a patch to pnet that I made a whole time ago but never send in.
Now that the baselib is opened it might be useful (after some hacking, the whole
dgext stuff needs to be removed). The only really useful part are probably the
Stream class convenience methods.

Greetings,

Peter
diff -C 2 -P -N -r pnetlib/profiles/dotgnu ~pnetlib/profiles/dotgnu
*** pnetlib/profiles/dotgnu     Mon Jan 27 10:51:00 2003
--- ~pnetlib/profiles/dotgnu    Thu Jan  1 01:00:00 1970
***************
*** 1,30 ****
- <?xml version="1.0"?>
- <profile>
- <!-- DotGNU profile, all features + dotgnu extensions -->
- <!-- Hacked by Peter Minten -->
- 
- <!-- Only use ECMA-compatible features -->
- <define name="ECMA_COMPAT" value="false"/>
- 
-  <!-- Enable DotGNU features -->
- <define name="DOTGNU_EXT" value="true"/>
- 
- <!-- Use reflection facilities -->
- <define name="CONFIG_REFLECTION" value="true"/>
- 
- <!-- Use runtime infrastructure facilities -->
- <define name="CONFIG_RUNTIME_INFRA" value="true"/>
- 
- <!-- Use extended numerics -->
- <define name="CONFIG_EXTENDED_NUMERICS" value="true"/>
- 
- <!-- Use extended culture support -->
- <define name="CONFIG_CULTURE" value="true"/>
- 
- <!-- Use remoting facilities -->
- <define name="CONFIG_REMOTING" value="true"/>
- 
- <!-- Use file and directory facilities -->
- <define name="CONFIG_FILESYSTEM" value="true"/>
- 
- </profile>
--- 0 ----
diff -C 2 -P -N -r pnetlib/runtime/System/Array.cs 
~pnetlib/runtime/System/Array.cs
*** pnetlib/runtime/System/Array.cs     Mon Jan 27 12:14:03 2003
--- ~pnetlib/runtime/System/Array.cs    Mon Jan 27 10:21:35 2003
***************
*** 1406,1677 ****
        }
  
- #if DOTGNU_EXT
-       //Accessor for ranges, returns new array
-       public Object[] GetValues(int start, int end)
-       {
-               Object[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = this[x];
-                       i++;
-               }
-               
-               return retval;
-       }
- 
-       //Accessor for ranges, returns bool array
-       public bool[] GetBoolValues(int start, int end)
-       {
-               bool[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (bool)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns byte array
-       public byte[] GetByteValues(int start, int end)
-       {
-               byte[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (byte)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns char array
-       public char[] GetCharValues(int start, int end)
-       {
-               char[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (char)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns double array
-       public double[] GetDoubleValues(int start, int end)
-       {
-               double[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (double)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns float array
-       public float[] GetFloatValues(int start, int end)
-       {
-               float[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (float)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns int array
-       public int[] GetIntValues(int start, int end)
-       {
-               int[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (int)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns IntPtr array
-       public IntPtr[] GetIntPtrValues(int start, int end)
-       {
-               IntPtr[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (IntPtr)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns long array
-       public long[] GetLongValues(int start, int end)
-       {
-               long[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (long)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
-       
-       //Accessor for ranges, returns sbyte array
-       public sbyte[] GetSByteValues(int start, int end)
-       {
-               sbyte[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (sbyte)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
-       
-       //Accessor for ranges, returns short array
-       public short[] GetShortValues(int start, int end)
-       {
-               short[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (short)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }       
- 
-       //Accessor for ranges, returns Single array
-       public Single[] GetSingleValues(int start, int end)
-       {
-               Single[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (Single)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns string array
-       public string[] GetStringValues(int start, int end)
-       {
-               string[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (string)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
-       
-       //Accessor for ranges, returns uint array
-       public uint[] GetUIntValues(int start, int end)
-       {
-               uint[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (uint)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns UIntPtr array
-       public UIntPtr[] GetUIntPtrValues(int start, int end)
-       {
-               UIntPtr[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (UIntPtr)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns ulong array
-       public ulong[] GetULongValues(int start, int end)
-       {
-               ulong[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (ulong)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       //Accessor for ranges, returns ushort array
-       public ushort[] GetUShortValues(int start, int end)
-       {
-               ushort[] retval;
-               int i = 0;                      
-                       
-               for (int x = start; x < end; x++)
-               {
-                       retval[i] = (ushort)this[x];
-                       i++;
-               }
-               
-               return retval;          
-       }
- 
-       public void SetValues(Object[] values, int start, int end)
-       {
-               int j = start;
-               for (int x = 0; x < (end - start); x++)
-               {
-                       this[j] = values[x];
-                       j++;
-               }
-       }
- 
- #endif //DOTGNU_EXT
- 
  }; // class Array
  
--- 1406,1409 ----
diff -C 2 -P -N -r pnetlib/runtime/System/IO/Stream.cs 
~pnetlib/runtime/System/IO/Stream.cs
*** pnetlib/runtime/System/IO/Stream.cs Mon Jan 27 11:58:49 2003
--- ~pnetlib/runtime/System/IO/Stream.cs        Mon Jan 27 10:21:38 2003
***************
*** 25,33 ****
  using System.Threading;
  
- #if DOTGNU_EXT
- using System.Collections;
- using System.Text;
- #endif //DOTGNU_EXT
- 
  public abstract class Stream : MarshalByRefObject, IDisposable
  {
--- 25,28 ----
***************
*** 246,380 ****
        }; // class NullStream
  
- #if DOTGNU_EXT
- 
-       //Read data, if no data can be read the array length == 0
-       public byte[] Read()
-       {
-               byte[] rbuffer; //Return buffer
-               byte[] tbuffer = new byte[512]; //Temporary buffer
-               
-               while (Read(tbuffer, 0, 512) > 0)
-               {
-               //      rbuffer.Add(tbuffer);
-               }
-               
-               return rbuffer;
-       }
- 
-       //Write data
-       public void Write(byte[] buffer)
-       {
-               byte[] tbuffer = new byte[512]; //Temporary buffer
-               
-               for (int x = 0; x < buffer.Length; x += 512)
-               {
-                       //Is this block incomplete?
-                       if (x + 512 < buffer.Length)
-                       {                       
-                               //Complete block, all 512 bytes filled
-                               //Copy some data into the temporary buffer
-                               Array.Copy(buffer, x, tbuffer, 0, 512);
-                               
-                               //Write
-                               Write(tbuffer, 0, 512);
-                       }
-                       else
-                       {
-                               //How much bytes can we write?
-                               int numwrite = buffer.Length - x;
-                               
-                               //Incomplete block, not all 512 bytes filled
-                               //Copy some data into the temporary buffer
-                               tbuffer = buffer.GetByteValues(x, x + numwrite);
-                               //Array.Copy(buffer, x, tbuffer, 0, numwrite);
-                               
-                               //Write
-                               Write(tbuffer, 0, numwrite);                    
        
-                       }
-               }
-       }
- 
-       //Stream operators
- 
-       //Read into a String (in unicode encoding)
-       public static Stream operator>> (Stream source, String output)
-       {
-               UnicodeEncoding e;
-               
-               byte[] buffer = source.Read();
-               char[] cbuffer;
-               e.GetChars(buffer, 0, buffer.Length, cbuffer, 0);
-               output = new String(cbuffer);
-               return source;
-       }       
- 
-       //Read into a TextWriter (in unicode encoding)
-       public static Stream operator>> (Stream source, TextWriter output)
-       {
-               UnicodeEncoding e;
-               
-               byte[] buffer = source.Read();
-               char[] cbuffer;
-               String sbuffer;
-               e.GetChars(buffer, 0, buffer.Length, cbuffer, 0);
-               output.Write(cbuffer);
-               return source;
-       }       
- 
-       //Read into a StringBuilder (in unicode encoding)
-       public static Stream operator>> (Stream source, StringBuilder output)
-       {
-               UnicodeEncoding e;
-               
-               byte[] buffer = source.Read();
-               char[] cbuffer;
-               String sbuffer;
-               e.GetChars(buffer, 0, buffer.Length, cbuffer, 0);
-               output.Append(cbuffer);
-               return source;
-       }       
- 
- 
-       //Write a String (in unicode encoding)
-       public static Stream operator<< (Stream target, String input)
-       {
-               UnicodeEncoding e;
-               
-               target.Write(e.GetBytes(input));
-               return target;
-       }
- 
-       //Write an object (converted to unicode encoded string, if possible)
-       //Note: this is the method to use with StringBuilder
-       public static Stream operator<< (Stream target, object input)
-       {
-               UnicodeEncoding e;
-               
-               target.Write(e.GetBytes(input.ToString()));
-               return target;
-       }
- 
-       //Write the contents of a TextReader to a stream (in unicode encoding)
-       //Note: this is the method to use with StringBuilder
-       public static Stream operator<< (Stream target, TextReader input)
-       {
-               UnicodeEncoding e;
- 
-               int bytesread;
- 
-               char[] tbuffer = new char[512]; //Temporary buffer
- 
-               while (input.ReadBlock(tbuffer, 0, 512) > 0)
-               {
-                       target.Write(e.GetBytes(new String(tbuffer)));
-               }
-               return target;
-       }
- 
- 
- #endif //DOTGNU_EXT
- 
  }; // class Stream
  
  }; // namespace System.IO
- 
--- 241,245 ----

reply via email to

[Prev in Thread] Current Thread [Next in Thread]