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/Reflection/Emit Assemb


From: Richard Baumann <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Reflection/Emit AssemblyBuilder.cs, 1.9, 1.10 SignatureHelper.cs, 1.4, 1.5
Date: Tue, 22 Jul 2003 09:46:40 -0400

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

Modified Files:
        AssemblyBuilder.cs SignatureHelper.cs 
Log Message:
Implement basic saving for dynamic assemblies and fix 
SignatureHelper.GetSignature behavior.


Index: AssemblyBuilder.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Reflection/Emit/AssemblyBuilder.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** AssemblyBuilder.cs  20 Jul 2003 05:00:02 -0000      1.9
--- AssemblyBuilder.cs  22 Jul 2003 13:46:38 -0000      1.10
***************
*** 336,340 ****
                                }
                                /* TODO: the rest of the exception throwing 
checks */
!                               throw new NotImplementedException("Save");
                        }
  
--- 336,351 ----
                                }
                                /* TODO: the rest of the exception throwing 
checks */
!                               String path = directory+assemblyFileName;
!                               /* TODO: checks on the dir and filename */
!                               IntPtr entry = IntPtr.Zero;
!                               if (entryPoint != null)
!                               {
!                                       entry = 
((IClrProgramItem)entryPoint).ClrHandle;
!                               }
!                               if (!(ClrSave(base.privateData, writer, path, 
entry, fileKind)))
!                               {
!                                       throw new IOException(/* TODO */);
!                               }
!                               saved = true;
                        }
  

Index: SignatureHelper.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Reflection/Emit/SignatureHelper.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** SignatureHelper.cs  26 May 2003 05:03:41 -0000      1.4
--- SignatureHelper.cs  22 Jul 2003 13:46:38 -0000      1.5
***************
*** 40,45 ****
--- 40,58 ----
        internal int numArgs;
        private CallingConvention callConv;
+       private bool field;
+       private long bytesOffset;
  
        // Constructor.
+       private SignatureHelper(Module mod, IntPtr context)
+                       {
+                               this.mod = mod;
+                               this.context = context;
+                               this.sig = IntPtr.Zero;
+                               this.numArgs = 0;
+                               this.callConv = (CallingConvention)0;
+                               this.field = true;
+                               this.bytesOffset = -1;
+                               ((ModuleBuilder)mod).assembly.AddDetach(this);
+                       }
        private SignatureHelper(Module mod, IntPtr context, IntPtr sig)
                        {
***************
*** 49,54 ****
                                this.numArgs = 0;
                                this.callConv = (CallingConvention)0;
                                ((ModuleBuilder)mod).assembly.AddDetach(this);
- 
                        }
        private SignatureHelper(Module mod, IntPtr context, IntPtr sig,
--- 62,68 ----
                                this.numArgs = 0;
                                this.callConv = (CallingConvention)0;
+                               this.field = false;
+                               this.bytesOffset = -1;
                                ((ModuleBuilder)mod).assembly.AddDetach(this);
                        }
        private SignatureHelper(Module mod, IntPtr context, IntPtr sig,
***************
*** 60,63 ****
--- 74,79 ----
                                this.numArgs = 0;
                                this.callConv = callConv;
+                               this.field = false;
+                               this.bytesOffset = -1;
                                ((ModuleBuilder)mod).assembly.AddDetach(this);
                        }
***************
*** 139,144 ****
                                {
                                        IntPtr context = ModuleToContext(mod);
!                                       return new SignatureHelper
!                                               (mod, context, 
ClrSigCreateField(context));
                                }
                        }
--- 155,159 ----
                                {
                                        IntPtr context = ModuleToContext(mod);
!                                       return new SignatureHelper(mod, 
context);
                                }
                        }
***************
*** 265,268 ****
--- 280,287 ----
                                lock(typeof(AssemblyBuilder))
                                {
+                                       if (bytesOffset != -1)
+                                       {
+                                               throw new ArgumentException(/* 
TODO */);
+                                       }
                                        if(clsArgument == null)
                                        {
***************
*** 270,274 ****
                                        }
                                        IntPtr type = CSToILType(mod, context, 
clsArgument);
!                                       if(!ClrSigAddArgument(context, sig, 
type))
                                        {
                                                throw new 
InvalidOperationException
--- 289,302 ----
                                        }
                                        IntPtr type = CSToILType(mod, context, 
clsArgument);
!                                       if (field && sig == IntPtr.Zero)
!                                       {
!                                               sig = type;
!                                       }
!                                       else if (field)
!                                       {
!                                               throw new 
InvalidOperationException
!                                                       
(_("Emit_InvalidSigArgument"));
!                                       }
!                                       else if(!ClrSigAddArgument(context, 
sig, type))
                                        {
                                                throw new 
InvalidOperationException
***************
*** 284,287 ****
--- 312,324 ----
                                lock(typeof(AssemblyBuilder))
                                {
+                                       if (bytesOffset != -1)
+                                       {
+                                               throw new ArgumentException(/* 
TODO */);
+                                       }
+                                       if (field)
+                                       {
+                                               throw new 
InvalidOperationException
+                                                       
(_("Emit_InvalidSigArgument"));
+                                       }
                                        if(!ClrSigAddSentinel(context, sig))
                                        {
***************
*** 298,302 ****
                                {
                                        SignatureHelper helper = (obj as 
SignatureHelper);
!                                       if(helper != null && helper.mod == mod)
                                        {
                                                return ClrSigIdentical(sig, 
helper.sig);
--- 335,341 ----
                                {
                                        SignatureHelper helper = (obj as 
SignatureHelper);
!                                       if(helper != null &&
!                                          helper.mod == mod &&
!                                          helper.field == field)
                                        {
                                                return ClrSigIdentical(sig, 
helper.sig);
***************
*** 323,327 ****
                                lock(typeof(AssemblyBuilder))
                                {
!                                       return ClrSigGetBytes(mod.privateData, 
sig);
                                }
                        }
--- 362,372 ----
                                lock(typeof(AssemblyBuilder))
                                {
!                                       if (bytesOffset == -1)
!                                       {
!                                               bytesOffset = ClrSigFinalize
!                                                       (mod.privateData, sig, 
field);
!                                       }
!                                       return ClrSigGetBytes
!                                               (mod.privateData, bytesOffset);
                                }
                        }
***************
*** 393,400 ****
                        (IntPtr module, int typeToken);
  
-       // Create a field signature type value.
-       [MethodImpl(MethodImplOptions.InternalCall)]
-       extern private static IntPtr ClrSigCreateField(IntPtr context);
- 
        // Create a local variable signature type value.
        [MethodImpl(MethodImplOptions.InternalCall)]
--- 438,441 ----
***************
*** 433,439 ****
        extern private static int ClrSigGetHashCode(IntPtr sig);
  
!       // Get the bytes of a signature.
        [MethodImpl(MethodImplOptions.InternalCall)]
!       extern private static byte[] ClrSigGetBytes(IntPtr module, IntPtr sig);
  
  }; // class SignatureHelper
--- 474,485 ----
        extern private static int ClrSigGetHashCode(IntPtr sig);
  
!       // Write the signature to the blob and get its offset.
!       [MethodImpl(MethodImplOptions.InternalCall)]
!       extern private static long ClrSigFinalize
!                       (IntPtr module, IntPtr sig, bool field);
! 
!       // Get the bytes of a signature from the blob.
        [MethodImpl(MethodImplOptions.InternalCall)]
!       extern private static byte[] ClrSigGetBytes(IntPtr module, long offset);
  
  }; // class SignatureHelper





reply via email to

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