dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Activator.cs,1.8,1.9 A


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Activator.cs,1.8,1.9 Attribute.cs,1.7,1.8 Delegate.cs,1.8,1.9 Enum.cs,1.10,1.11 MulticastDelegate.cs,1.4,1.5 Type.cs,1.18,1.19 TypedReference.cs,1.3,1.4 ValueType.cs,1.2,1.3
Date: Tue, 15 Apr 2003 07:22:34 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv12653/runtime/System

Modified Files:
        Activator.cs Attribute.cs Delegate.cs Enum.cs 
        MulticastDelegate.cs Type.cs TypedReference.cs ValueType.cs 
Log Message:


Mark up members of the "Reflection" ECMA subset with CONFIG_REFLECTION.


Index: Activator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Activator.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Activator.cs        26 Dec 2002 08:13:17 -0000      1.8
--- Activator.cs        15 Apr 2003 11:22:32 -0000      1.9
***************
*** 22,25 ****
--- 22,27 ----
  {
  
+ #if CONFIG_REFLECTION
+ 
  using System.Reflection;
  using System.Runtime.Remoting;
***************
*** 196,199 ****
--- 198,203 ----
  
  }; // class Activator
+ 
+ #endif // CONFIG_REFLECTION
  
  }; // namespace System

Index: Attribute.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Attribute.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Attribute.cs        14 Oct 2002 13:33:12 -0000      1.7
--- Attribute.cs        15 Apr 2003 11:22:32 -0000      1.8
***************
*** 34,37 ****
--- 34,39 ----
                        }
  
+ #if CONFIG_REFLECTION
+ 
        // Determine if two attributes are equal.
        [ClrReflection]
***************
*** 409,412 ****
--- 411,416 ----
  
  #endif // !ECMA_COMPAT
+ 
+ #endif // CONFIG_REFLECTION
  
  #if !ECMA_COMPAT

Index: Delegate.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Delegate.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Delegate.cs 7 Apr 2003 04:22:51 -0000       1.8
--- Delegate.cs 15 Apr 2003 11:22:32 -0000      1.9
***************
*** 38,41 ****
--- 38,42 ----
        internal IntPtr                                 closure;
  
+ #if CONFIG_REFLECTION
        // Constructors.
        protected Delegate(Object target, String method)
***************
*** 85,88 ****
--- 86,92 ----
                                this.method = methodInfo.MethodHandle;
                        }
+ #else // !CONFIG_REFLECTION
+       protected Delegate() {}
+ #endif // !CONFIG_REFLECTION
  
        // Implement the ICloneable interface.
***************
*** 130,133 ****
--- 134,139 ----
                        }
  
+ #if CONFIG_REFLECTION
+ 
        // Create a blank instance of a delegate type, and validate its 
signature.
        [MethodImpl(MethodImplOptions.InternalCall)]
***************
*** 289,292 ****
--- 295,300 ----
                        }
  
+ #endif // CONFIG_REFLECTION
+ 
        // Determine if two delegates are equal.
        public override bool Equals(Object obj)
***************
*** 378,381 ****
--- 386,391 ----
                        }
  
+ #if CONFIG_REFLECTION
+ 
        // Get the method within this delegate.
        public MethodInfo Method
***************
*** 398,401 ****
--- 408,413 ----
                        }
  
+ #endif // CONFIG_REFLECTION
+ 
        // Get the target of this delegate.
        public Object Target
***************
*** 414,417 ****
--- 426,430 ----
                        }
  
+ #if CONFIG_REFLECTION
        // Implementation of dynamic invocation.  This handles
        // the unicast case.  MulticastDelegate handles multicast.
***************
*** 420,423 ****
--- 433,437 ----
                                return Method.Invoke(target, args);
                        }
+ #endif
  
        // Implementation of delegate removal.  The real work
***************
*** 444,447 ****
--- 458,462 ----
                        }
  
+ #if CONFIG_REFLECTION
        // Get the method implementation for this delegate.
        protected virtual MethodInfo GetMethodImpl()
***************
*** 449,452 ****
--- 464,468 ----
                                return Method;
                        }
+ #endif
  
  #if !ECMA_COMPAT

Index: Enum.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Enum.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Enum.cs     21 Feb 2003 03:22:45 -0000      1.10
--- Enum.cs     15 Apr 2003 11:22:32 -0000      1.11
***************
*** 108,111 ****
--- 108,112 ----
                                if(format == "G" || format == "g")
                                {
+                               #if CONFIG_REFLECTION
                                        if(Attribute.IsDefined(enumType, 
typeof(FlagsAttribute)))
                                        {
***************
*** 113,116 ****
--- 114,118 ----
                                        }
                                        else
+                               #endif
                                        {
                                                result = GetEnumName(enumType, 
value);
***************
*** 173,176 ****
--- 175,180 ----
                        }
  
+ #if CONFIG_REFLECTION
+ 
        // Get the names of all enumerated constants in a type.
        public static String[] GetNames(Type enumType)
***************
*** 220,223 ****
--- 224,229 ----
                        }
  
+ #endif // CONFIG_REFLECTION
+ 
        // Get the underlying type for an enumerated type.
        public static Type GetUnderlyingType(Type enumType)
***************
*** 233,236 ****
--- 239,243 ----
                                }
  
+ #if CONFIG_REFLECTION
                                // Search for a public instance field that has 
the
                                // "RTSpecialName" attribute associated with it.
***************
*** 250,255 ****
--- 257,268 ----
                                // the enumerated type is malformed in some way.
                                throw new 
ArgumentException(_("Arg_MustBeEnum"));
+ #else
+                               // TODO: use an internalcall to get this 
information
+                               throw new 
ArgumentException(_("Arg_MustBeEnum"));
+ #endif
                        }
  
+ #if CONFIG_REFLECTION
+ 
        // Get the values of all enumerated constants for an enumerated type.
        public static Array GetValues(Type enumType)
***************
*** 300,303 ****
--- 313,318 ----
                                return values;
                        }
+ 
+ #endif // CONFIG_REFLECTION
  
        // Determine if a specified constant is defined in an enumerated type.

Index: MulticastDelegate.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/MulticastDelegate.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** MulticastDelegate.cs        29 Jun 2002 00:45:26 -0000      1.4
--- MulticastDelegate.cs        15 Apr 2003 11:22:32 -0000      1.5
***************
*** 33,36 ****
--- 33,37 ----
        private MulticastDelegate prev;
  
+ #if CONFIG_REFLECTION
        // Constructors.
        protected MulticastDelegate(Object target, String method)
***************
*** 44,47 ****
--- 45,51 ----
                                prev = null;
                        }
+ #else // !CONFIG_REFLECTION
+       protected MulticastDelegate() {}
+ #endif // !CONFIG_REFLECTION
  
        // Determine if two multicast delegates are equal.
***************
*** 128,131 ****
--- 132,136 ----
                        }
  
+ #if CONFIG_REFLECTION
        // Implementation of dynamic invocation.
        protected override Object DynamicInvokeImpl(Object[] args)
***************
*** 137,140 ****
--- 142,146 ----
                                return base.DynamicInvokeImpl(args);
                        }
+ #endif
  
        // Determine if we have an invocation list match, where the

Index: Type.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Type.cs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** Type.cs     15 Apr 2003 05:13:43 -0000      1.18
--- Type.cs     15 Apr 2003 11:22:32 -0000      1.19
***************
*** 28,32 ****
  using System.Runtime.CompilerServices;
  
! public abstract class Type : MemberInfo
  {
  
--- 28,35 ----
  using System.Runtime.CompilerServices;
  
! public abstract class Type
! #if CONFIG_REFLECTION
!       : MemberInfo
! #endif
  {
  
***************
*** 58,61 ****
--- 61,256 ----
        protected Type() : base() {}
  
+       // Get the rank of this type, if it is an array.
+       public virtual int GetArrayRank()
+                       {
+                               throw new 
NotSupportedException(_("NotSupp_NotArrayType"));
+                       }
+ 
+       // Get the attribute flags for this type.
+ #if CONFIG_REFLECTION
+       protected abstract TypeAttributes GetAttributeFlagsImpl();
+ #else
+       internal abstract TypeAttributes GetAttributeFlagsImpl();
+ #endif
+ 
+       // Get the element type for this type.
+ #if CONFIG_REFLECTION
+       public abstract Type GetElementType();
+ #else
+       internal abstract Type GetElementType();
+ #endif
+ 
+       // Get all interfaces that this type implements.
+ #if CONFIG_REFLECTION
+       public abstract Type[] GetInterfaces();
+ #else
+       internal abstract Type[] GetInterfaces();
+ #endif
+ 
+       // Implementation of the "IsArray" property.
+       protected abstract bool IsArrayImpl();
+ 
+       // Determine if "this" implements the interface "c".
+       private bool IsImplementationOf(Type c)
+                       {
+                               Type[] interfaces = GetInterfaces();
+                               int posn;
+                               for(posn = 0; posn < interfaces.Length; ++posn)
+                               {
+                                       if(c == interfaces[posn])
+                                       {
+                                               return true;
+                                       }
+                               }
+                               return false;
+                       }
+ 
+       // Determine if this type is assignable from another type.
+       public virtual bool IsAssignableFrom(Type c)
+                       {
+                               if(c == null)
+                               {
+                                       return false;
+                               }
+                               else if(c == this)
+                               {
+                                       return true;
+                               }
+                               else if(c.IsSubclassOf(this))
+                               {
+                                       return true;
+                               }
+                               else if(IsInterface)
+                               {
+                                       return c.IsImplementationOf(this);
+                               }
+                               else
+                               {
+                                       return false;
+                               }
+                       }
+ 
+       // Determine if an object is an instance of this type.
+       public virtual bool IsInstanceOfType(Object obj)
+                       {
+                               if(obj == null)
+                               {
+                                       return false;
+                               }
+                               else
+                               {
+                                       return IsAssignableFrom(obj.GetType());
+                               }
+                       }
+ 
+       // Implementation of the "IsPointer" property.
+       protected abstract bool IsPointerImpl();
+ 
+       // Implementation of the "IsPrimitive" property.
+ #if CONFIG_REFLECTION
+       protected abstract bool IsPrimitiveImpl();
+ #else
+       internal abstract bool IsPrimitiveImpl();
+ #endif
+ 
+       // Determine if the current type is a subclass of another type.
+       public virtual bool IsSubclassOf(Type c)
+                       {
+                               Type current = this;
+                               if(c == current)
+                               {
+                                       return false;
+                               }
+                               while(current != null)
+                               {
+                                       if(current == c)
+                                       {
+                                               return true;
+                                       }
+                                       current = current.BaseType;
+                               }
+                               return false;
+                       }
+ 
+       // Implementation of the "IsValueType" property.
+       protected virtual bool IsValueTypeImpl()
+                       {
+                               if(this == valueType || this == enumType)
+                               {
+                                       return false;
+                               }
+                               else
+                               {
+                                       return IsSubclassOf(valueType);
+                               }
+                       }
+ 
+       // Convert this type into a string.
+       public override String ToString()
+                       {
+                       #if CONFIG_REFLECTION
+                               return "Type: " + Name;
+                       #else
+                               return "Type: " + FullName;
+                       #endif
+                       }
+ 
+       // Properties that are always accessible, even if no reflection support.
+       public abstract String AssemblyQualifiedName { get; }
+       public abstract Type BaseType { get; }
+       public abstract String FullName { get; }
+       public bool IsArray { get { return IsArrayImpl(); } }
+       public bool IsClass
+                       {
+                               get
+                               {
+                                       return ((GetAttributeFlagsImpl() &
+                                                        
TypeAttributes.ClassSemanticsMask) ==
+                                                               
TypeAttributes.Class) &&
+                                                  !IsSubclassOf(valueType);
+                               }
+                       }
+       public bool IsEnum
+                       {
+                               get
+                               {
+                                       return IsSubclassOf(enumType);
+                               }
+                       }
+       public bool IsInterface
+                       {
+                               get
+                               {
+                                       return ((GetAttributeFlagsImpl() &
+                                                        
TypeAttributes.ClassSemanticsMask) ==
+                                                               
TypeAttributes.Interface);
+                               }
+                       }
+       public bool IsPointer { get { return IsPointerImpl(); } }
+       public bool IsValueType { get { return IsValueTypeImpl(); } }
+ #if CONFIG_REFLECTION
+       public bool IsPrimitive { get { return IsPrimitiveImpl(); } }
+ #else
+       internal bool IsPrimitive { get { return IsPrimitiveImpl(); } }
+ #endif
+ 
+ #if CONFIG_RUNTIME_INFRA
+ 
+       // Get the runtime type handle associated with an object.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static RuntimeTypeHandle GetTypeHandle(Object obj);
+ 
+       // Get a type from a runtime type handle.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static Type GetTypeFromHandle(RuntimeTypeHandle handle);
+ 
+       // Infrastructure properties.
+       public abstract System.Reflection.Assembly Assembly { get; }
+       public abstract RuntimeTypeHandle TypeHandle { get; }
+ 
+ #endif // CONFIG_RUNTIME_INFRA
+ 
+ #if CONFIG_REFLECTION
+ 
        // Type equality testing.
        public override bool Equals(Object obj)
***************
*** 77,89 ****
                        }
  
-       // Get the rank of this type, if it is an array.
-       public virtual int GetArrayRank()
-                       {
-                               throw new 
NotSupportedException(_("NotSupp_NotArrayType"));
-                       }
- 
-       // Get the attribute flags for this type.
-       protected abstract TypeAttributes GetAttributeFlagsImpl();
- 
        // Validate the "types" argument to a "GetConstructor" or "GetMethod" 
call.
        private static void ValidateTypes(Type[] types)
--- 272,275 ----
***************
*** 413,419 ****
  #endif // !ECMA_COMPAT
  
-       // Get the element type for this type.
-       public abstract Type GetElementType();
- 
        // Get an event from this type.
        public abstract EventInfo GetEvent(String name, BindingFlags 
bindingAttr);
--- 599,602 ----
***************
*** 473,479 ****
                        }
  
-       // Get all interfaces that this type implements.
-       public abstract Type[] GetInterfaces();
- 
  #if !ECMA_COMPAT
  
--- 656,659 ----
***************
*** 835,848 ****
                        }
  
- #if CONFIG_RUNTIME_INFRA
-       // Get the runtime type handle associated with an object.
-       [MethodImpl(MethodImplOptions.InternalCall)]
-       extern public static RuntimeTypeHandle GetTypeHandle(Object obj);
- 
-       // Get a type from a runtime type handle.
-       [MethodImpl(MethodImplOptions.InternalCall)]
-       extern public static Type GetTypeFromHandle(RuntimeTypeHandle handle);
- #endif
- 
        // Implementation of the "HasElementType" property.
        protected abstract bool HasElementTypeImpl();
--- 1015,1018 ----
***************
*** 868,914 ****
                        }
  
-       // Implementation of the "IsArray" property.
-       protected abstract bool IsArrayImpl();
- 
-       // Determine if "this" implements the interface "c".
-       private bool IsImplementationOf(Type c)
-                       {
-                               Type[] interfaces = GetInterfaces();
-                               int posn;
-                               for(posn = 0; posn < interfaces.Length; ++posn)
-                               {
-                                       if(c == interfaces[posn])
-                                       {
-                                               return true;
-                                       }
-                               }
-                               return false;
-                       }
- 
-       // Determine if this type is assignable from another type.
-       public virtual bool IsAssignableFrom(Type c)
-                       {
-                               if(c == null)
-                               {
-                                       return false;
-                               }
-                               else if(c == this)
-                               {
-                                       return true;
-                               }
-                               else if(c.IsSubclassOf(this))
-                               {
-                                       return true;
-                               }
-                               else if(IsInterface)
-                               {
-                                       return c.IsImplementationOf(this);
-                               }
-                               else
-                               {
-                                       return false;
-                               }
-                       }
- 
        // Implementation of the "IsByRef" property.
        protected abstract bool IsByRefImpl();
--- 1038,1041 ----
***************
*** 923,939 ****
                        }
  
-       // Determine if an object is an instance of this type.
-       public virtual bool IsInstanceOfType(Object obj)
-                       {
-                               if(obj == null)
-                               {
-                                       return false;
-                               }
-                               else
-                               {
-                                       return IsAssignableFrom(obj.GetType());
-                               }
-                       }
- 
        // Implementation of the "IsMarshalByRef" property.
        protected virtual bool IsMarshalByRefImpl()
--- 1050,1053 ----
***************
*** 942,996 ****
                        }
  
-       // Implementation of the "IsPointer" property.
-       protected abstract bool IsPointerImpl();
- 
-       // Implementation of the "IsPrimitive" property.
-       protected abstract bool IsPrimitiveImpl();
- 
-       // Determine if the current type is a subclass of another type.
-       public virtual bool IsSubclassOf(Type c)
-                       {
-                               Type current = this;
-                               if(c == current)
-                               {
-                                       return false;
-                               }
-                               while(current != null)
-                               {
-                                       if(current == c)
-                                       {
-                                               return true;
-                                       }
-                                       current = current.BaseType;
-                               }
-                               return false;
-                       }
- 
-       // Implementation of the "IsValueType" property.
-       protected virtual bool IsValueTypeImpl()
-                       {
-                               if(this == valueType || this == enumType)
-                               {
-                                       return false;
-                               }
-                               else
-                               {
-                                       return IsSubclassOf(valueType);
-                               }
-                       }
- 
-       // Convert this type into a string.
-       public override String ToString()
-                       {
-                               return "Type: " + Name;
-                       }
- 
        // Abstract properties.
- #if CONFIG_RUNTIME_INFRA
-       public abstract System.Reflection.Assembly Assembly { get; }
- #endif
-       public abstract String AssemblyQualifiedName { get; }
-       public abstract Type BaseType { get; }
-       public abstract String FullName { get; }
  #if !ECMA_COMPAT
        public abstract Guid GUID { get; }
--- 1056,1060 ----
***************
*** 999,1017 ****
        public abstract String Namespace { get; }
        public abstract Type UnderlyingSystemType { get; }
- #if CONFIG_RUNTIME_INFRA
-       public abstract RuntimeTypeHandle TypeHandle { get; }
- #endif
  
        // Implemented properties.
        public override Type DeclaringType { get { return this; } }
        public bool HasElementType { get { return HasElementTypeImpl(); } }
-       public bool IsArray { get { return IsArrayImpl(); } }
        public bool IsByRef { get { return IsByRefImpl(); } }
        public bool IsCOMObject { get { return IsCOMObjectImpl(); } }
        public bool IsContextful { get { return IsContextfulImpl(); } }
        public bool IsMarshalByRef { get { return IsMarshalByRefImpl(); } }
-       public bool IsPointer { get { return IsPointerImpl(); } }
-       public bool IsPrimitive { get { return IsPrimitiveImpl(); } }
-       public bool IsValueType { get { return IsValueTypeImpl(); } }
        public override Type ReflectedType { get { return this; } }
        public TypeAttributes Attributes
--- 1063,1074 ----
***************
*** 1054,1074 ****
                                }
                        }
-       public bool IsClass
-                       {
-                               get
-                               {
-                                       return ((GetAttributeFlagsImpl() &
-                                                        
TypeAttributes.ClassSemanticsMask) ==
-                                                               
TypeAttributes.Class) &&
-                                                  !IsSubclassOf(valueType);
-                               }
-                       }
-       public bool IsEnum
-                       {
-                               get
-                               {
-                                       return IsSubclassOf(enumType);
-                               }
-                       }
        public bool IsExplicitLayout
                        {
--- 1111,1114 ----
***************
*** 1088,1100 ****
                                }
                        }
-       public bool IsInterface
-                       {
-                               get
-                               {
-                                       return ((GetAttributeFlagsImpl() &
-                                                        
TypeAttributes.ClassSemanticsMask) ==
-                                                               
TypeAttributes.Interface);
-                               }
-                       }
        public bool IsLayoutSequential
                        {
--- 1128,1131 ----
***************
*** 1319,1322 ****
--- 1350,1355 ----
                                }
                        }
+ 
+ #endif // CONFIG_REFLECTION
  
  }; // class Type

Index: TypedReference.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/TypedReference.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** TypedReference.cs   19 Jun 2002 07:31:11 -0000      1.3
--- TypedReference.cs   15 Apr 2003 11:22:32 -0000      1.4
***************
*** 22,25 ****
--- 22,27 ----
  {
  
+ #if CONFIG_REFLECTION
+ 
  using System.Reflection;
  using System.Runtime.CompilerServices;
***************
*** 133,136 ****
--- 135,140 ----
  
  }; // struct TypedReference
+ 
+ #endif // CONFIG_REFLECTION
  
  }; // namespace System

Index: ValueType.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/ValueType.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ValueType.cs        2 Dec 2001 22:00:06 -0000       1.2
--- ValueType.cs        15 Apr 2003 11:22:32 -0000      1.3
***************
*** 29,32 ****
--- 29,34 ----
        protected ValueType() : base() {}
  
+ #if CONFIG_REFLECTION
+ 
        // Determine if this value type instance is identical to another.
        [ClrReflection]
***************
*** 108,111 ****
--- 110,115 ----
                                return GetType().GetHashCode();
                        }
+ 
+ #endif // CONFIG_REFLECTION
  
        // Get a string that corresponds to this instance.





reply via email to

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