Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion r213 committed - Fix with test for file opening...

X-BeenThere: rubydotnet@googlegroups.com
Received: by 10.141.214.36 with SMTP id r36ls962991rvq.2.p; Mon, 15 Feb 2010 
	00:20:17 -0800 (PST)
Received: by 10.141.2.7 with SMTP id e7mr733505rvi.9.1266222016817;
        Mon, 15 Feb 2010 00:20:16 -0800 (PST)
Received: by 10.141.2.7 with SMTP id e7mr733504rvi.9.1266222016748;
        Mon, 15 Feb 2010 00:20:16 -0800 (PST)
Return-Path: <3vwN5SxAKAIcnzop3t4p-yz2p0w9rzzrwp....@codesite.bounces.google.com>
Received: from mail-pz0-f205.google.com (mail-pz0-f205.google.com [209.85.222.205])
        by gmr-mx.google.com with ESMTP id 24si1767999pzk.6.2010.02.15.00.20.15;
        Mon, 15 Feb 2010 00:20:15 -0800 (PST)
Received-SPF: pass (google.com: domain of 3vwN5SxAKAIcnzop3t4p-yz2p0w9rzzrwp....@codesite.bounces.google.com designates 209.85.222.205 as permitted sender) client-ip=209.85.222.205;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of 3vwN5SxAKAIcnzop3t4p-yz2p0w9rzzrwp....@codesite.bounces.google.com designates 209.85.222.205 as permitted sender) smtp.mail=3vwN5SxAKAIcnzop3t4p-yz2p0w9rzzrwp....@codesite.bounces.google.com; dkim=pass (test mode) header...@google.com
Received: by pzk18 with SMTP id 18so220416pzk.1
        for <RubyDOTNET@googlegroups.com>; Mon, 15 Feb 2010 00:20:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=beta;
        h=domainkey-signature:mime-version:x-generated-by:received:message-id
         :date:subject:from:to:content-type;
        bh=+WLa1mlBqn9p53n7+LgTM0GRm3/UAgOaHvhzlWL6tzI=;
        b=i2x+yDvwsZ7dU9nWOcVIHabagEqIuaIVVyMIIV7h6M7rZ1WbVW/u3ej3Pm9zDtDSxC
         CIdvAfl12TXfKLzE4KNg==
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=google.com; s=beta;
        h=mime-version:x-generated-by:message-id:date:subject:from:to
         :content-type;
        b=i0PQzKw/JmmRNlf2dog1KQQE59IXCWOLEzRFtO/hjuM7R5689yXrTYcXCcHYqrRxx8
         3PavZLMFrpQjxwMnCIeg==
MIME-Version: 1.0
X-Generated-By: Google Code
Received: by 10.143.21.42 with SMTP id y42mr693149wfi.18.1266222015594; Mon, 
	15 Feb 2010 00:20:15 -0800 (PST)
Message-ID: <00504502cb1b72b3a2047f9f4...@google.com>
Date: Mon, 15 Feb 2010 08:20:15 +0000
Subject: [rubydotnetcompiler] r213 committed - Fix with test for file 
	opening...
From: codesite-nore...@google.com
To: RubyDOTNET@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes

Revision: 213
Author: djl.rifraf
Date: Mon Feb 15 00:18:57 2010
Log: Fix with test for file opening
Better support for require.  e.g. require 'drb' which then  
requires 'drb/drb' was just looping
Minor compilation warning issues removed
http://code.google.com/p/rubydotnetcompiler/source/detail?r=213

Modified:
  /trunk/src/RubyRuntime/Built-in Classes/File.cs
  /trunk/src/RubyRuntime/Compiler/AST/Methods.cs
  /trunk/src/RubyRuntime/Compiler/AST/SourceFile.cs
  /trunk/src/RubyRuntime/Compiler/CodeGenFacade.cs
  /trunk/src/RubyRuntime/Compiler/Compiler.cs
  /trunk/src/RubyRuntime/Methods/Eval.cs
  /trunk/src/RubyRuntime/Runtime/Eval.cs

=======================================
--- /trunk/src/RubyRuntime/Built-in Classes/File.cs	Thu Oct  4 02:17:51 2007
+++ /trunk/src/RubyRuntime/Built-in Classes/File.cs	Mon Feb 15 00:18:57 2010
@@ -659,10 +659,15 @@
              }
              return j > str.Length ? 0 : Dir.FNM_NOMATCH;
          }
+
+        // rifraf
+        internal static string WindowsPath(string path) {
+            return path.Replace('/', Path.DirectorySeparatorChar);
+        }

          internal static string Extension(string filename)
          {
-            return new System.IO.FileInfo(filename).Extension;
+            return new System.IO.FileInfo(WindowsPath(filename)).Extension;
          }

          internal static string dln_find(string fname, string path)
@@ -695,7 +700,7 @@

              if (try_add_ext)
              {
-                System.IO.FileInfo file = new System.IO.FileInfo(fname);
+                System.IO.FileInfo file = new  
System.IO.FileInfo(WindowsPath(fname));
                  string temp;

                  if (file.Extension == "")
@@ -749,15 +754,16 @@

          internal static string stripExtension(string name)
          {
-            // BBTAG: try using absolute paths instead
-            //return fileNameToClassName(name);
-            System.IO.FileInfo file = new System.IO.FileInfo(name);
-            return file.Name.Substring(0, file.Name.Length -  
file.Extension.Length);
+            return basename(name);
+            //rifraf // BBTAG: try using absolute paths instead
+            //rifraf //return fileNameToClassName(name);
+            //rifraf System.IO.FileInfo file = new  
System.IO.FileInfo(WindowsPath(name));
+            //rifraf return file.Name.Substring(0, file.Name.Length -  
file.Extension.Length);
          }

          internal static string fileNameToClassName(string name)
          {
-            System.IO.FileInfo file = new System.IO.FileInfo(name);
+            System.IO.FileInfo file = new  
System.IO.FileInfo(WindowsPath(name));
              // FIXME: change to RegExp
              string className =  
file.FullName.Replace('.', '_').Replace('/', '_').Replace(':', '_').Replace('\\', '_').Replace(' ', '_');
              return className.Substring(0, className.Length -  
file.Extension.Length);
=======================================
--- /trunk/src/RubyRuntime/Compiler/AST/Methods.cs	Wed Nov 14 17:27:44 2007
+++ /trunk/src/RubyRuntime/Compiler/AST/Methods.cs	Mon Feb 15 00:18:57 2010
@@ -266,7 +266,7 @@

                  method.Close();
              }
-            catch (PERWAPI.DescriptorException e)
+            catch (PERWAPI.DescriptorException)
              {
              }
          }
=======================================
--- /trunk/src/RubyRuntime/Compiler/AST/SourceFile.cs	Wed Nov 14 19:06:01  
2007
+++ /trunk/src/RubyRuntime/Compiler/AST/SourceFile.cs	Mon Feb 15 00:18:57  
2010
@@ -15,30 +15,24 @@
  using Microsoft.Build.Utilities;


-namespace Ruby.Compiler.AST
-{
-
-    public class SOURCEFILE : Scope
-    {
+namespace Ruby.Compiler.AST {
+
+    public class SOURCEFILE : Scope {
          internal ClassDef fileClass;
          static internal CodeGenContext LoadMethod;

-        internal SOURCEFILE(YYLTYPE location): base(null, location)
-        {
+        internal SOURCEFILE(YYLTYPE location)
+            : base(null, location) {
          }

-        internal static bool RemoveAllocatorDefinition(ClassSkeleton  
classSkel)
-        {
+        internal static bool RemoveAllocatorDefinition(ClassSkeleton  
classSkel) {
              //PERWAPI.Method ctor =  
classSkel.perwapiClass.GetMethodDesc(".ctor", new Type[] { Runtime.ClassRef  
});
              PERWAPI.CILInstruction[] initInstructions =  
classSkel.initMethod.GetCodeBuffer().GetInstructions();

-            for (int i = 0; i < initInstructions.Length; i++)
-            {
-                if (initInstructions[i] is PERWAPI.MethInstr)
-                {
+            for (int i = 0; i < initInstructions.Length; i++) {
+                if (initInstructions[i] is PERWAPI.MethInstr) {
                      PERWAPI.MethInstr call =  
(PERWAPI.MethInstr)(initInstructions[i]);
-                    if (call.GetMethod() ==  
Runtime.Class.define_alloc_func)
-                    {
+                    if (call.GetMethod() ==  
Runtime.Class.define_alloc_func) {
                           
classSkel.initMethod.GetCodeBuffer().RemoveInstructions(i - 2, i);
                          return true;
                      }
@@ -48,36 +42,28 @@
              return false;
          }

-        internal static bool RedefineConstructor(PERWAPI.MethodDef ctor,  
PERWAPI.Class perwapiClass)
-        {
+        internal static bool RedefineConstructor(PERWAPI.MethodDef ctor,  
PERWAPI.Class perwapiClass) {
              PERWAPI.CILInstruction[] ctorInstructions =  
ctor.GetCodeBuffer().GetInstructions();

              // try and find a constructor in the base class
              PERWAPI.Method superClassConstructor = null;

-            for (int i = 0; i < ctorInstructions.Length; i++)
-            {
-                if (ctorInstructions[i] is PERWAPI.MethInstr)
-                {
+            for (int i = 0; i < ctorInstructions.Length; i++) {
+                if (ctorInstructions[i] is PERWAPI.MethInstr) {
                      PERWAPI.MethInstr inst =  
(PERWAPI.MethInstr)(ctorInstructions[i]);
                      PERWAPI.Method calledCtor = inst.GetMethod();
-                    if (calledCtor.Name() == ".ctor")
-                    {
+                    if (calledCtor.Name() == ".ctor") {
                          PERWAPI.Type[] calledCtorParams =  
calledCtor.GetParTypes();
                          PERWAPI.Method[] superClassConstructors =  
perwapiClass.GetMethodDescs(".ctor");
                          superClassConstructor =  
perwapiClass.GetMethodDesc(".ctor", calledCtorParams);
                          int pos = i;

-                        if (superClassConstructor == null)
-                        {
-                            if (calledCtorParams.Length == 1)
-                            {
+                        if (superClassConstructor == null) {
+                            if (calledCtorParams.Length == 1) {
                                  string paramTypeName =  
calledCtorParams[0].TypeName();
-                                foreach (PERWAPI.Method superCtor in  
superClassConstructors)
-                                {
+                                foreach (PERWAPI.Method superCtor in  
superClassConstructors) {
                                      PERWAPI.Type[] superCtorParams =  
superCtor.GetParTypes();
-                                    if (superCtorParams.Length == 1)
-                                    {
+                                    if (superCtorParams.Length == 1) {
                                          string superParamTypeName =  
superCtorParams[0].TypeName();
                                          if (paramTypeName == "Ruby.Class"  
&& superParamTypeName == paramTypeName)
                                              superClassConstructor =  
superCtor;
@@ -85,18 +71,15 @@
                                  }
                              }

-                            if (superClassConstructor == null)
-                            {
+                            if (superClassConstructor == null) {
                                  // fall back on zero-arg constructor
                                  superClassConstructor =  
perwapiClass.GetMethodDesc(".ctor", new Type[0]);

                                  if (superClassConstructor == null)
                                      return false;

-                                if (calledCtorParams.Length > 0)
-                                {
-                                    for (int j = 0; j <  
calledCtorParams.Length; j++)
-                                    {
+                                if (calledCtorParams.Length > 0) {
+                                    for (int j = 0; j <  
calledCtorParams.Length; j++) {
                                           
ctor.GetCodeBuffer().RemoveInstruction(pos - 1);
                                          pos--;
                                      }
@@ -116,13 +99,10 @@
          }


-        internal static void SuperclassPostPass(CodeGenContext context,  
List<PERWAPI.ReferenceScope> peFiles)
-        {
-            foreach (ClassSkeletonPostPass postPass in  
context.postPassList)
-            {
+        internal static void SuperclassPostPass(CodeGenContext context,  
List<PERWAPI.ReferenceScope> peFiles) {
+            foreach (ClassSkeletonPostPass postPass in  
context.postPassList) {
                  PERWAPI.Class perwapiClass =  
ClassSkeleton.FindPERWAPIClass(postPass.subClass, postPass.superClassNode,  
peFiles);
-                if (perwapiClass != null)
-                {
+                if (perwapiClass != null) {
                      PERWAPI.Class perwapiClassRef;
                      if (perwapiClass is PERWAPI.ClassDef)
                          perwapiClassRef =  
((PERWAPI.ClassDef)perwapiClass).MakeRefOf();
@@ -132,27 +112,22 @@
                      postPass.subClassDef.SuperType = perwapiClassRef;
                      // redefine the constructor
                      PERWAPI.MethodDef[] ctors =  
postPass.subClassDef.GetMethods(".ctor");
-
-                    foreach (PERWAPI.MethodDef ctor in ctors)
-                    {
-                        if (!RedefineConstructor(ctor, perwapiClass))
-                        {
+
+                    foreach (PERWAPI.MethodDef ctor in ctors) {
+                        if (!RedefineConstructor(ctor, perwapiClass)) {
                              Compiler.InteropWarning("No zero-arg  
constructor found for " + perwapiClass.Name() + ", no interop class  
generated for " + postPass.subClassDef.Name());
                               
context.Assembly.RemoveClass(postPass.subClassDef);
                              RemoveAllocatorDefinition(postPass.subClass);
                               
context.Assembly.RemoveClass(postPass.subClass.allocator);
                          }
                      }
-                }
-                else
-                {
+                } else {
                      Compiler.InteropWarning("Superclass not found for " +  
postPass.subClass.name);
                  }
              }
          }

-        internal static PERWAPI.PEFile GenerateCode(List<SOURCEFILE>  
files, List<PERWAPI.ReferenceScope> peFiles, string outfile,  
List<KeyValuePair<string, object>> options, bool GUI)
-        {
+        internal static PERWAPI.PEFile GenerateCode(List<SOURCEFILE>  
files, List<PERWAPI.ReferenceScope> peFiles, string outfile,  
List<KeyValuePair<string, object>> options, bool GUI) {
              CodeGenContext context = new CodeGenContext();
              context.peFiles = peFiles;

@@ -161,15 +136,15 @@

              context.CreateAssembly(file.DirectoryName, file.Name,  
basename, GUI);

-            for (int i=1; i<files.Count; i++)
+            for (int i = 1; i < files.Count; i++)
                  files[i].GenerateClassForFile(context,  
File.stripExtension(files[i].location.file), file.Extension == ".dll",  
files);

              ClassDef mainClass = files[0].GenerateClassForFile(context,  
File.stripExtension(files[0].location.file), file.Extension == ".dll",  
files);
+//?            ClassDef mainClass = files[0].GenerateClassForFile(context,  
File.stripExtension(files[0].location.file), file.Extension == ".dll",  
files);

              SuperclassPostPass(context, peFiles);

-            if (file.Extension == ".exe")
-            {
+            if (file.Extension == ".exe") {
                  MethodDef Options = GenerateOptionsMethod(context,  
options);
                  GenerateMainMethod(context, mainClass, Options, files);
              }
@@ -178,8 +153,7 @@
          }


-        internal static void GenerateMainMethod(CodeGenContext context,  
ClassDef fileClass, MethodDef SetOptions, List<SOURCEFILE> files)
-        {
+        internal static void GenerateMainMethod(CodeGenContext context,  
ClassDef fileClass, MethodDef SetOptions, List<SOURCEFILE> files) {
              // public static void Main(string[] args) {
              CodeGenContext Main = context.CreateModuleMethod("Main",  
PrimitiveType.Void, new Param[] { new Param(ParamAttr.Default, "args", new  
PERWAPI.ZeroBasedArray(PrimitiveType.String)) });

@@ -190,16 +164,14 @@
              // try {
              Main.StartBlock(Clause.Try);

-            if (SetOptions != null)
-            {
+            if (SetOptions != null) {
                  //    SetOptions(args);
                  Main.ldarg("args");
                  Main.call(SetOptions);
              }

              // register other ruby source files in assembly so that they  
can be loaded if requested
-            foreach (SOURCEFILE f in files)
-            {
+            foreach (SOURCEFILE f in files) {
                  // Ruby.Runtime.Program.AddProgram(filename, fileClass);
                  Main.ldstr(File.stripExtension(f.location.file));
                  Main.ldtoken(f.fileClass);
@@ -237,9 +209,8 @@
              // }
          }

-        internal PERWAPI.PEFile GenerateCode(string fullFileName, string  
dll_or_exe, List<KeyValuePair<string,object>> runtime_options, bool GUI)
-        {
-            System.IO.FileInfo file = new System.IO.FileInfo(fullFileName);
+        internal PERWAPI.PEFile GenerateCode(string fullFileName, string  
dll_or_exe, List<KeyValuePair<string, object>> runtime_options, bool GUI) {
+            System.IO.FileInfo file = new  
System.IO.FileInfo(File.WindowsPath(fullFileName));

              string fileName;
              // BBTAG: try using absolute path
@@ -249,17 +220,17 @@
                  fileName = file.Name.Substring(0, file.Name.Length - 3);
              else
                  fileName = file.Name;
-
+
              CodeGenContext context = new CodeGenContext();

-            context.CreateAssembly(file.DirectoryName, fileName +  
dll_or_exe, fileName, GUI);
-
-            ClassDef mainClass = GenerateClassForFile(context, fileName,  
false, new List<SOURCEFILE>());
+            //rifraf            context.CreateAssembly(file.DirectoryName,  
fileName + dll_or_exe, fileName, GUI);
+            context.CreateAssembly(file.DirectoryName,  
File.stripExtension(fullFileName) + dll_or_exe,  
File.stripExtension(fullFileName), GUI);
+            //rifraf            ClassDef mainClass =  
GenerateClassForFile(context, fileName, false, new List<SOURCEFILE>());
+            ClassDef mainClass = GenerateClassForFile(context,  
File.stripExtension(fullFileName), false, new List<SOURCEFILE>());

              SuperclassPostPass(context, new  
List<PERWAPI.ReferenceScope>());

-            if (dll_or_exe == ".exe")
-            {
+            if (dll_or_exe == ".exe") {
                  MethodDef Options = GenerateOptionsMethod(context,  
runtime_options);
                  GenerateMainMethod(context, mainClass, Options, new  
List<SOURCEFILE>());
              }
@@ -267,14 +238,13 @@
              return context.Assembly;
          }

-        private void CreateClassForFile(CodeGenContext context, string  
file_name)
-        {
+        private void CreateClassForFile(CodeGenContext context, string  
file_name) {
              // public class file_name: System.Object {
-            fileClass =  
context.CreateGlobalClass("_Internal", "SourceFile_" + file_name,  
Runtime.SystemObjectRef);
+            // rifraf
+            fileClass =  
context.CreateGlobalClass("_Internal", "SourceFile_" +  
file_name.Replace(@"\", "_").Replace(".", "_"), Runtime.SystemObjectRef);
          }

-        private PERWAPI.ClassDef GenerateClassForFile(CodeGenContext  
context, string file_name, bool autoLoad, List<SOURCEFILE> files)
-        {
+        private PERWAPI.ClassDef GenerateClassForFile(CodeGenContext  
context, string file_name, bool autoLoad, List<SOURCEFILE> files) {
              if (fileClass == null)
                  CreateClassForFile(context, file_name);

@@ -289,8 +259,7 @@
              // }
              LoadMethod.Close();

-            if (autoLoad)
-            {
+            if (autoLoad) {
                  // accessing this field should trigger the .cctor to load  
the main source file
                  CodeGenContext.AddField(fileClass,  
FieldAttr.PublicStatic, "loaded", PrimitiveType.Boolean);

@@ -298,8 +267,7 @@
                  CodeGenContext cctor =  
context.CreateStaticConstructor(fileClass);

                  // register other ruby source files in assembly so that  
they can be loaded if requested
-                foreach (SOURCEFILE f in files)
-                {
+                foreach (SOURCEFILE f in files) {
                      if (f.fileClass == null)
                          f.CreateClassForFile(context,  
File.stripExtension(f.location.file));

@@ -325,8 +293,7 @@
          }


-        private static MethodDef GenerateOptionsMethod(CodeGenContext  
context, List<KeyValuePair<string, object>> runtime_options)
-        {
+        private static MethodDef GenerateOptionsMethod(CodeGenContext  
context, List<KeyValuePair<string, object>> runtime_options) {
              // internal void SetOptions(string[] args) {
              CodeGenContext SetOptions =  
context.CreateModuleMethod("SetOptions", PrimitiveType.Void, new  
Param(ParamAttr.Default, "args", new  
PERWAPI.ZeroBasedArray(PrimitiveType.String)));

@@ -334,27 +301,22 @@
              SetOptions.call(Runtime.Options.SetArgs);

              if (runtime_options != null)
-                foreach (KeyValuePair<string, object> option in  
runtime_options)
-                {
+                foreach (KeyValuePair<string, object> option in  
runtime_options) {
                      SetOptions.ldstr(option.Key);
                      if (option.Value == null)
                          SetOptions.ldnull();
                      else if (option.Value is string)
                          SetOptions.ldstr((string)option.Value);
-                    else if (option.Value is int)
-                    {
+                    else if (option.Value is int) {
                          SetOptions.ldc_i4((int)option.Value);
                          SetOptions.box(PrimitiveType.Int32);
-                    }
-                    else if (option.Value is bool)
-                    {
+                    } else if (option.Value is bool) {
                          if ((bool)option.Value)
                              SetOptions.PushTrue();
                          else
                              SetOptions.PushFalse();
                          SetOptions.box(PrimitiveType.Boolean);
-                    }
-                    else
+                    } else
                          throw new System.NotImplementedException("unknown  
option");
                      SetOptions.call(Runtime.Options.SetRuntimeOption);
                  }
@@ -365,111 +327,89 @@
          }


-        private static void Execute(System.Reflection.Assembly Assembly,  
Frame caller, string filename)
-        {
+        private static void Execute(System.Reflection.Assembly Assembly,  
Frame caller, string filename) {
              if (Assembly.GetCustomAttributes(typeof(RubyAttribute),  
true).Length > 0)
                  Load(Assembly, caller, filename);
              else
                  Interop.CLRClass.LoadCLRAssembly(Assembly, caller);
          }

-        internal static void LoadExisting(string filename, Frame caller)
-        {
+        internal static void LoadExisting(string filename, Frame caller) {
              string basename = File.stripExtension(filename);
-
-            System.Type type = Program.programs[basename];
+            System.Type type =  
Program.programs[basename.Replace(@"\", "_").Replace(".", "_")];
              FieldInfo loadedField = type.GetField("loaded");
              if (loadedField != null)
                  loadedField.SetValue(null, true);
-            else
-            {
+            else {
                  MethodInfo load = type.GetMethod("Load");
-                try
-                {
+                try {
                      load.Invoke(null, new object[] {  
Ruby.Object.ruby_top_self, caller });
-                }
-                catch (System.Reflection.TargetInvocationException e)
-                {
+                } catch (System.Reflection.TargetInvocationException e) {
                      throw e.InnerException;
                  }
              }
          }

-        internal static void Load(System.Reflection.Assembly Assembly,  
Frame caller, string filename)
-        {
-            foreach (System.Type type in Assembly.GetTypes())
-            {
+        internal static void Load(System.Reflection.Assembly assembly,  
Frame caller, string filename) {
+            try {
+                System.Type[] types = assembly.GetTypes();
+            } catch {
+            }
+            foreach (System.Type type in assembly.GetTypes()) {
                  if (type.Namespace == "_Internal" &&  
type.Name.StartsWith("SourceFile_"))
-                    Program.AddProgram(type.Name.Substring(11), type);
+                     
Program.AddProgram(type.Name.Substring(11).Replace(@"\\", @"\"), type);
              }

-            object e_info = Eval.ruby_errinfo.value ;
-            try
-            {
+            object e_info = Eval.ruby_errinfo.value;
+            try {
                  LoadExisting(filename, caller);
-            }
-            catch (System.Reflection.TargetInvocationException exception)
-            {
+            } catch (System.Reflection.TargetInvocationException  
exception) {
                  throw exception.InnerException;
-            }
-            finally
-            {
+            } finally {
                  Eval.ruby_errinfo.value = e_info;
              }
          }

-        internal static void Load(PERWAPI.PEFile Assembly, Frame caller,  
string filename)
-        {
+        internal static void Load(PERWAPI.PEFile Assembly, Frame caller,  
string filename) {
              Load(CodeGenContext.Load(Assembly), caller, filename);
          }

-        internal static void Execute(string path, Frame caller)
-        {
+        internal static void Execute(string path, Frame caller) {
              string fileName = new System.IO.FileInfo(path).FullName;
-            //System.Console.WriteLine("load assembly file {0}", fileName);
              System.Reflection.Assembly assembly =  
System.Reflection.Assembly.LoadFile(fileName);
              Execute(assembly, caller, path);
          }

-        internal static void ExecuteMain(PERWAPI.PEFile Assembly, string[]  
args)
-        {
+        internal static void ExecuteMain(PERWAPI.PEFile Assembly, string[]  
args) {
              ExecuteMain(CodeGenContext.Load(Assembly), args);
          }


-        internal static void ExecuteMain(string path, string[] args)
-        {
+        internal static void ExecuteMain(string path, string[] args) {
              string fileName = new System.IO.FileInfo(path).FullName;
-            //System.Console.WriteLine("load assembly file {0}", fileName);
              System.Reflection.Assembly assembly =  
System.Reflection.Assembly.LoadFile(fileName);

              ExecuteMain(assembly, args);
          }

-        private static void ExecuteMain(System.Reflection.Assembly  
Assembly, string[] args)
-        {
+        private static void ExecuteMain(System.Reflection.Assembly  
Assembly, string[] args) {
              MethodInfo mainMethod =  
Assembly.GetModules(false)[0].GetMethod("Main");
-            try
-            {
+            try {
                  mainMethod.Invoke(null, new object[] { args });
-            }
-            catch (System.Reflection.TargetInvocationException exception)
-            {
+            } catch (System.Reflection.TargetInvocationException  
exception) {
                  throw exception.InnerException;
              }
          }

-        public CodeCompileUnit ToCodeCompileUnit()
-        {
+        public CodeCompileUnit ToCodeCompileUnit() {
              CodeCompileUnit unit = new CodeCompileUnit();
-
+
              CodeNamespace defaultNS = new CodeNamespace();

              unit.Namespaces.Add(defaultNS);

              for (Node n = body; n != null; n = n.nd_next)
-                if (n is CLASS)
-                {
+                if (n is CLASS) {
                       
defaultNS.Types.Add(((CLASS)n).ToCodeTypeDeclaration());
                      break; // only care about the first class
                  }
=======================================
--- /trunk/src/RubyRuntime/Compiler/CodeGenFacade.cs	Sun Nov 25 07:03:44  
2007
+++ /trunk/src/RubyRuntime/Compiler/CodeGenFacade.cs	Mon Feb 15 00:18:57  
2010
@@ -16,12 +16,10 @@
  using Ruby.Runtime;
  using System.Globalization;

-namespace Ruby.Compiler
-{
+namespace Ruby.Compiler {
      // Facade to PERWAPI

-    internal class CodeGenContext
-    {
+    internal class CodeGenContext {
          internal PEFile Assembly;

          internal MethodDef Method;
@@ -41,13 +39,11 @@

          internal List<PERWAPI.ReferenceScope> peFiles = new  
List<PERWAPI.ReferenceScope>();

-        internal CodeGenContext()
-        {
+        internal CodeGenContext() {
              currentSkeleton = objectSkeleton;
          }

-        internal CodeGenContext(CodeGenContext context)
-        {
+        internal CodeGenContext(CodeGenContext context) {
              this.Assembly = context.Assembly;
              this.Method = context.Method;
              this.CLRLocals = context.CLRLocals;
@@ -62,235 +58,191 @@
          }


-        private CILInstructions buffer
-        {
+        private CILInstructions buffer {
              get { return this.Method.GetCodeBuffer(); }
          }

-        internal void startMethod(YYLTYPE location)
-        {
+        internal void startMethod(YYLTYPE location) {
              buffer.DefaultSourceFile =  
SourceFile.GetSourceFile(location.file, System.Guid.Empty,  
System.Guid.Empty, System.Guid.Empty);
              newStartPoint(location);
          }

-        internal void newLine(YYLTYPE location)
-        {
+        internal void newLine(YYLTYPE location) {
              if (buffer.DefaultSourceFile != null && location != null)
                  buffer.Line((uint)location.first_line,  
(uint)location.first_column, (uint)location.last_line,  
(uint)location.last_column);
          }


-        internal void newStartPoint(YYLTYPE location)
-        {
+        internal void newStartPoint(YYLTYPE location) {
              if (buffer.DefaultSourceFile != null && location != null)
                  buffer.Line((uint)location.first_line,  
(uint)location.first_column, (uint)location.first_column);
          }

-        internal void newEndPoint(YYLTYPE location)
-        {
+        internal void newEndPoint(YYLTYPE location) {
              if (buffer.DefaultSourceFile != null && location != null)
                  buffer.Line((uint)location.last_line,  
(uint)location.last_column, (uint)location.last_column);
          }

-        internal void newobj(PERWAPI.Method method)
-        {
+        internal void newobj(PERWAPI.Method method) {
              buffer.MethInst(MethodOp.newobj, method);
          }

-        internal void newarr(PERWAPI.Type type)
-        {
+        internal void newarr(PERWAPI.Type type) {
              buffer.TypeInst(TypeOp.newarr, type);
          }

-        internal void callvirt(PERWAPI.Method method)
-        {
+        internal void callvirt(PERWAPI.Method method) {
              buffer.MethInst(MethodOp.callvirt, method);
          }

-        internal void call(PERWAPI.Method method)
-        {
+        internal void call(PERWAPI.Method method) {
              buffer.MethInst(MethodOp.call, method);
          }

-        internal void dup()
-        {
+        internal void dup() {
              buffer.Inst(Op.dup);
          }

-        internal void pop()
-        {
+        internal void pop() {
              buffer.Inst(Op.pop);
          }

-        internal void stelem_ref()
-        {
+        internal void stelem_ref() {
              buffer.Inst(Op.stelem_ref);
          }

-        internal void ldloc(int loc)
-        {
+        internal void ldloc(int loc) {
              buffer.LoadLocal(loc);
          }

-        internal void stloc(int loc)
-        {
+        internal void stloc(int loc) {
              buffer.StoreLocal(loc);
          }

-        internal void ret()
-        {
+        internal void ret() {
              buffer.Inst(Op.ret);
          }

-        internal void ldnull()
-        {
+        internal void ldnull() {
              buffer.Inst(Op.ldnull);
          }

-        internal void ldtoken(Type aType)
-        {
+        internal void ldtoken(Type aType) {
              buffer.TypeInst(TypeOp.ldtoken, aType);
          }

-        internal void ldc_i4(int i)
-        {
+        internal void ldc_i4(int i) {
              buffer.PushInt(i);
          }

-        internal void ldc_r8(double d)
-        {
+        internal void ldc_r8(double d) {
              buffer.ldc_r8(d);
          }

-        internal void ldstr(string str)
-        {
+        internal void ldstr(string str) {
              Debug.Assert(str != null);
              buffer.ldstr(str);
          }

-        internal void ldarg(string argName)
-        {
+        internal void ldarg(string argName) {
              ldarg(FindArg(argName));
          }

-        internal void ldarg(int argNum)
-        {
+        internal void ldarg(int argNum) {
              Debug.Assert(argNum >= 0);
              buffer.LoadArg(argNum);
          }

-        internal void starg(string argName)
-        {
+        internal void starg(string argName) {
              buffer.StoreArg(FindArg(argName));
          }

-        internal void cast(PERWAPI.Type t)
-        {
+        internal void cast(PERWAPI.Type t) {
              buffer.TypeInst(TypeOp.castclass, t);
          }

-        internal void isinst(PERWAPI.Type t)
-        {
+        internal void isinst(PERWAPI.Type t) {
              buffer.TypeInst(TypeOp.isinst, t);
          }

-        internal void ldfld(Field field)
-        {
+        internal void ldfld(Field field) {
              buffer.FieldInst(FieldOp.ldfld, field);
          }

-        internal void ldsfld(Field field)
-        {
+        internal void ldsfld(Field field) {
              buffer.FieldInst(FieldOp.ldsfld, field);
          }

-        internal void stfld(Field field)
-        {
+        internal void stfld(Field field) {
              buffer.FieldInst(FieldOp.stfld, field);
          }

-        internal void stsfld(Field field)
-        {
+        internal void stsfld(Field field) {
              buffer.FieldInst(FieldOp.stsfld, field);
          }

-        internal void box(PERWAPI.Type t)
-        {
+        internal void box(PERWAPI.Type t) {
              buffer.TypeInst(TypeOp.box, t);
          }

-        internal void br(CILLabel label)
-        {
+        internal void br(CILLabel label) {
              buffer.Branch(BranchOp.br, label);
          }

-        internal void leave(CILLabel label)
-        {
+        internal void leave(CILLabel label) {
              buffer.Branch(BranchOp.leave, label);
          }

-        internal void brfalse(CILLabel label)
-        {
+        internal void brfalse(CILLabel label) {
              buffer.Branch(BranchOp.brfalse, label);
          }

-        internal void brtrue(CILLabel label)
-        {
+        internal void brtrue(CILLabel label) {
              buffer.Branch(BranchOp.brtrue, label);
          }

-        internal void bne(CILLabel label)
-        {
+        internal void bne(CILLabel label) {
              buffer.Branch(BranchOp.bne_un, label);
          }

-        internal void bge(CILLabel label)
-        {
+        internal void bge(CILLabel label) {
              buffer.Branch(BranchOp.bge, label);
          }

-        internal void endfinally()
-        {
+        internal void endfinally() {
              buffer.Inst(Op.endfinally);
          }

-        internal void rethrow()
-        {
+        internal void rethrow() {
              buffer.Inst(Op.rethrow);
          }

-        internal void throwOp()
-        {
+        internal void throwOp() {
              buffer.Inst(Op.throwOp);
          }


-        internal void PushTrue()
-        {
+        internal void PushTrue() {
              buffer.PushTrue();
          }

-        internal void PushFalse()
-        {
+        internal void PushFalse() {
              buffer.PushFalse();
          }

          //  
-----------------------------------------------------------------

-        internal void CodeLabel(CILLabel label)
-        {
+        internal void CodeLabel(CILLabel label) {
              buffer.CodeLabel(label);
          }

-        internal CILLabel NewLabel()
-        {
+        internal CILLabel NewLabel() {
              return buffer.NewLabel();
          }

          internal Stack<Clause> blocks = new Stack<Clause>();

-        internal void Goto(CILLabel label)
-        {
+        internal void Goto(CILLabel label) {
              Clause top = Clause.None;
              if (blocks.Count > 0)
                  top = blocks.Peek();
@@ -303,28 +255,24 @@
                  br(label);
          }

-        internal void StartBlock(Clause blockType)
-        {
+        internal void StartBlock(Clause blockType) {
              blocks.Push(blockType);
              buffer.StartBlock();
          }

-        internal TryBlock EndTryBlock()
-        {
+        internal TryBlock EndTryBlock() {
              System.Diagnostics.Debug.Assert(blocks.Peek() == Clause.Try);
              blocks.Pop();
              return buffer.EndTryBlock();
          }

-        internal void EndCatchBlock(PERWAPI.Class type, TryBlock tryBlock)
-        {
+        internal void EndCatchBlock(PERWAPI.Class type, TryBlock tryBlock)  
{
              System.Diagnostics.Debug.Assert(blocks.Peek() == Clause.Catch);
              blocks.Pop();
              buffer.EndCatchBlock(type, tryBlock);
          }

-        internal void EndFinallyBlock(TryBlock tryBlock)
-        {
+        internal void EndFinallyBlock(TryBlock tryBlock) {
              System.Diagnostics.Debug.Assert(blocks.Peek() ==  
Clause.Finally);
              blocks.Pop();
              buffer.EndFinallyBlock(tryBlock);
@@ -334,8 +282,7 @@
          //  
-----------------------------------------------------------------


-        internal void CreateAssembly(string directory, string fileName,  
string assemblyName, bool GUI)
-        {
+        internal void CreateAssembly(string directory, string fileName,  
string assemblyName, bool GUI) {
              Assembly = new PEFile(fileName, assemblyName);
              Assembly.SetSubSystem(GUI ? SubSystem.Windows_GUI :  
SubSystem.Windows_CUI);
              Assembly.SetNetVersion(NetVersion.Version2);
@@ -343,24 +290,19 @@
              Assembly.SetOutputDirectory(directory);
          }

-        internal ClassDef CreateNestedClass(ClassDef parent, string name,  
PERWAPI.Class superType)
-        {
-            if (parent == null)
-            {
+        internal ClassDef CreateNestedClass(ClassDef parent, string name,  
PERWAPI.Class superType) {
+            if (parent == null) {
                  if (Assembly.GetClass(name) != null)
                      return Assembly.GetClass(name);
                  return Assembly.AddClass(TypeAttr.Public |  
TypeAttr.BeforeFieldInit, null, name, superType);
-            }
-            else
-            {
+            } else {
                  if (parent.GetNestedClass(name) != null)
                      return parent.GetNestedClass(name);
                  return parent.AddNestedClass(TypeAttr.NestedPublic |  
TypeAttr.BeforeFieldInit, name, superType);
              }
          }

-        internal ClassDef CreateGlobalClass(string nsName, string name,  
PERWAPI.Class superType)
-        {
+        internal ClassDef CreateGlobalClass(string nsName, string name,  
PERWAPI.Class superType) {
              string fullname = name;
              int seq = 1;
              // find a name that hasn't been used
@@ -372,14 +314,12 @@

          static int indent = 0;

-        internal void Indent()
-        {
+        internal void Indent() {
              for (int i = 0; i < indent; i++)
                  System.Console.Write("\t");
          }

-        internal CodeGenContext CreateMethod(ClassDef ParentClass,  
MethAttr attr, string name, PERWAPI.Type return_type, params Param[]  
parameters)
-        {
+        internal CodeGenContext CreateMethod(ClassDef ParentClass,  
MethAttr attr, string name, PERWAPI.Type return_type, params Param[]  
parameters) {
              CodeGenContext newContext = new CodeGenContext(this);

              newContext.Method = ParentClass.AddMethod(attr, ImplAttr.IL,  
name, return_type, parameters);
@@ -396,8 +336,7 @@
              return newContext;
          }

-        internal CodeGenContext CreateModuleMethod(string name,  
PERWAPI.Type return_type, params Param[] parameters)
-        {
+        internal CodeGenContext CreateModuleMethod(string name,  
PERWAPI.Type return_type, params Param[] parameters) {
              CodeGenContext newContext = new CodeGenContext(this);

              newContext.Method = Assembly.AddMethod(MethAttr.PublicStatic,  
ImplAttr.IL, name, return_type, parameters);
@@ -412,37 +351,31 @@
          }


-        internal CodeGenContext CreateConstructor(ClassDef ParentClass,  
params Param[] parameters)
-        {
+        internal CodeGenContext CreateConstructor(ClassDef ParentClass,  
params Param[] parameters) {
              return CreateMethod(ParentClass, MethAttr.HideBySig |  
MethAttr.SpecialRTSpecialName | MethAttr.Public, ".ctor",  
PrimitiveType.Void, parameters);
          }

-        internal CodeGenContext CreateStaticConstructor(ClassDef  
ParentClass)
-        {
+        internal CodeGenContext CreateStaticConstructor(ClassDef  
ParentClass) {
              return CreateMethod(ParentClass, MethAttr.HideBySig |  
MethAttr.SpecialRTSpecialName | MethAttr.Private |  
MethAttr.Static, ".cctor", PrimitiveType.Void);
          }

-        internal static FieldDef AddField(ClassDef ParentClass, FieldAttr  
attr, string fieldName, PERWAPI.Type fieldType)
-        {
+        internal static FieldDef AddField(ClassDef ParentClass, FieldAttr  
attr, string fieldName, PERWAPI.Type fieldType) {
              return ParentClass.AddField(attr, fieldName, fieldType);
          }

          //  
-----------------------------------------------------------------

-        internal ClassDef CurrentClass()
-        {
+        internal ClassDef CurrentClass() {
              return (ClassDef)Method.GetParent();
          }

-        internal string CurrentMethodName()
-        {
+        internal string CurrentMethodName() {
              CustomAttribute methodAttribute =  
CurrentClass().GetCustomAttributes()[0];
              return  
System.Text.UnicodeEncoding.UTF8.GetString(methodAttribute.byteVal);
          }

          // BBTAG: corresponds to ruby_frame->orig_func
-        internal string OrigFuncName()
-        {
+        internal string OrigFuncName() {
              CustomAttribute methodAttribute =  
((ClassDef)orig_func.GetParent()).GetCustomAttributes()[0];
              return  
System.Text.UnicodeEncoding.UTF8.GetString(methodAttribute.byteVal);
          }
@@ -453,8 +386,7 @@
          internal List<int> locals_inuse = new List<int>();


-        internal void Close()
-        {
+        internal void Close() {
              //indent--;
              //Indent();
              //System.Console.WriteLine("Close {0}",  
this.Method.QualifiedName());
@@ -463,50 +395,41 @@

              Method.AddLocals(CLRLocals.ToArray(), true);

-            foreach (Local local in CLRLocals)
-            {
+            foreach (Local local in CLRLocals) {
                  //System.Console.WriteLine("\t{0} {1} {2}", local.Name,  
local.type.TypeName(), local.GetIndex());
                  buffer.BindLocal(local);
              }

              buffer.CloseScope();

-            if (locals_inuse.Count > 0)
-            {
+            if (locals_inuse.Count > 0) {
                  //foreach (int local in locals_inuse)
                  //    System.Console.WriteLine("({0}, {1})",  
CLRLocals[local].name, CLRLocals[local].type);
                  throw new System.Exception("unreleased locals");
              }
          }

-        internal int CreateLocal(string name, PERWAPI.Type type)
-        {
+        internal int CreateLocal(string name, PERWAPI.Type type) {
              int local;
-            if (unused_locals.ContainsKey(type) &&  
unused_locals[type].Count > 0)
-            {
+            if (unused_locals.ContainsKey(type) &&  
unused_locals[type].Count > 0) {
                  local = unused_locals[type].Pop();
-            }
-            else
-            {
+            } else {
                  Local loc = new Local(name, type);
                  CLRLocals.Add(loc);
                  local = CLRLocals.Count - 1;
              }
-
+
              locals_inuse.Add(local);
              return local;
          }

-        internal void ReleaseLocal(AST.ISimple temp, bool created)
-        {
+        internal void ReleaseLocal(AST.ISimple temp, bool created) {
              if (temp is AST.LOCAL)
                  ReleaseLocal(((AST.LOCAL)temp).local, created);
          }

-        internal void ReleaseLocal(int local, bool created)
-        {
-            if (created)
-            {
+        internal void ReleaseLocal(int local, bool created) {
+            if (created) {
                  Debug.Assert(locals_inuse.Contains(local));
                  locals_inuse.Remove(local);

@@ -517,50 +440,39 @@

                  Debug.Assert(!unused_locals[type].Contains(local));
                  unused_locals[type].Push(local);
-                }
+            }
          }

-        internal int StoreInTemp(string name, PERWAPI.Type type, YYLTYPE  
location)
-        {
+        internal int StoreInTemp(string name, PERWAPI.Type type, YYLTYPE  
location) {
              return StoreInLocal(name, type, location).local;
          }

-        internal AST.LOCAL StoreInLocal(string name, PERWAPI.Type type,  
YYLTYPE location)
-        {
+        internal AST.LOCAL StoreInLocal(string name, PERWAPI.Type type,  
YYLTYPE location) {
              int local = CreateLocal(name, type);
              stloc(local);
              return new AST.LOCAL(local, location);
          }

-        internal AST.ISimple PreCompute(AST.Node node, string name, out  
bool created)
-        {
+        internal AST.ISimple PreCompute(AST.Node node, string name, out  
bool created) {
              return PreCompute(node, name, PrimitiveType.Object, out  
created);
          }

-        internal AST.ISimple PreCompute(AST.Node node, string name,  
PERWAPI.Type type, out bool created)
-        {
-            if (node is AST.ISimple)
-            {
+        internal AST.ISimple PreCompute(AST.Node node, string name,  
PERWAPI.Type type, out bool created) {
+            if (node is AST.ISimple) {
                  created = false;
                  return (AST.ISimple)node;
-            }
-            else
-            {
+            } else {
                  created = true;
                  node.GenCode(this);
                  return StoreInLocal(name, type, node.location);
              }
          }

-        internal AST.ISimple PreCompute0(AST.Node node, string name, out  
bool created)
-        {
-            if (node is AST.ISimple)
-            {
+        internal AST.ISimple PreCompute0(AST.Node node, string name, out  
bool created) {
+            if (node is AST.ISimple) {
                  created = false;
                  return (AST.ISimple)node;
-            }
-            else
-            {
+            } else {
                  created = true;
                  node.GenCode0(this);
                  return StoreInLocal(name, PrimitiveType.Object,  
node.location);
@@ -568,24 +480,20 @@
          }


-        internal bool HasArg(ClassRef argType)
-        {
+        internal bool HasArg(ClassRef argType) {
              foreach (Type t in Method.GetParTypes())
                  if (argType == t)
                      return true;
              return false;
          }

-        internal void ruby_cbase(AST.Scope current)
-        {
+        internal void ruby_cbase(AST.Scope current) {
              LoadCurrentClass();
          }

-        internal void ruby_class(AST.Scope current)
-        {
+        internal void ruby_class(AST.Scope current) {
              ClassDef parent = CurrentClass();
-            if (parent.NameSpace() == "_Internal" &&  
parent.Name().StartsWith("Block"))
-            {
+            if (parent.NameSpace() == "_Internal" &&  
parent.Name().StartsWith("Block")) {
                  // if (ruby_class == null)
                  ldarg("ruby_class");
                  CILLabel elseLabel = NewLabel();
@@ -599,88 +507,71 @@
                  //    ruby_class
                  ldarg("ruby_class");
                  CodeLabel(endLabel);
-            }
-            else
+            } else
                  LoadCurrentClass();
          }

-        internal void LoadCurrentClass()
-        {
+        internal void LoadCurrentClass() {
              if (CurrentRubyClass != null)
                  ldsfld(CurrentRubyClass);
              else
                  ldsfld(Runtime.Init.rb_cObject);
          }

-        internal void LastClass(AST.Scope parent_scope, bool frame)
-        {
+        internal void LastClass(AST.Scope parent_scope, bool frame) {
              AST.Scope scope_cnt = parent_scope;
              AST.DEFS singletonMethod = null;

-            while (!(scope_cnt is AST.CLASS_OR_MODULE) && (scope_cnt !=  
null))
-            {
+            while (!(scope_cnt is AST.CLASS_OR_MODULE) && (scope_cnt !=  
null)) {
                  if (scope_cnt is AST.DEFS)
                      singletonMethod = (AST.DEFS)scope_cnt;
                  scope_cnt = scope_cnt.parent_scope;
              }

-            if (scope_cnt == null)
-            {
+            if (scope_cnt == null) {
                  ldsfld(Runtime.Init.rb_cObject);
                  return;
              }

              AST.CLASS_OR_MODULE parentClass =  
(AST.CLASS_OR_MODULE)scope_cnt;

-            if (singletonMethod != null)
-            {
-                if (singletonMethod.receiver is AST.SELF)
-                {
+            if (singletonMethod != null) {
+                if (singletonMethod.receiver is AST.SELF) {
                      ldsfld(parentClass.singletonField);
                      call(Runtime.Class.CLASS_OF);
-                }
-                else
-                {
-                    if (frame)
-                    {
-                        if (singletonMethod.receiver is AST.IVAR)
-                        {
+                } else {
+                    if (frame) {
+                        if (singletonMethod.receiver is AST.IVAR) {
                              ldsfld(parentClass.singletonField);
                               
ldstr(((AST.IVAR)singletonMethod.receiver).vid);
                              call(Runtime.Eval.ivar_get);
-                        }
-                        else
-                        {
+                        } else {
                              singletonMethod.receiver.GenCode(this);
                              call(Runtime.Class.CLASS_OF);
                          }
-                    }
-                    else
-                    {
+                    } else {
                          singletonMethod.receiver.GenCode(this);
                          call(Runtime.Class.CLASS_OF);
                      }
                  }
-            }
-            else
+            } else
                  ldsfld(parentClass.singletonField);
          }


-        internal static PERWAPI.FieldRef FindParentClassField(System.Type  
type)
-        {
+        internal static PERWAPI.FieldRef FindParentClassField(System.Type  
type) {
              FrameAttribute frame =  
(FrameAttribute)type.GetCustomAttributes(typeof(FrameAttribute), false)[0];
              if (frame.classname == "")
                  return null;
              System.Reflection.Module module =  
type.Assembly.GetModules(false)[0];
              System.Type sourcefile =  
module.GetType("_Internal.SourceFile_" + frame.sourcefile);
+
              FieldInfo field = sourcefile.GetField(frame.classname);
              return FindField(field);
          }


-        internal bool Reachable()
-        {
+        internal bool Reachable() {
              buffer.EndInstCounter();
              CILInstruction prev = buffer.GetPrevInstruction();
              return !((prev is Instr &&
@@ -698,8 +589,7 @@
          //  
-------------------------------------------------------------------------


-        private int FindArg(string name)
-        {
+        private int FindArg(string name) {
              int seq;
              if ((Method.GetMethAttributes() & MethAttr.Static) != 0)
                  seq = 0;
@@ -715,42 +605,34 @@
              return -1;
          }

-        internal static System.Reflection.Assembly ResolveAssembly(object  
sender, System.ResolveEventArgs args)
-        {
-            foreach (System.Reflection.Assembly assembly in loaded)
-            {
+        internal static System.Reflection.Assembly ResolveAssembly(object  
sender, System.ResolveEventArgs args) {
+            foreach (System.Reflection.Assembly assembly in loaded) {
                  if (assembly.FullName == args.Name)
                      return assembly;
              }
              return null;
          }

-        private static AssemblyRef FindAssembly(System.Type type)
-        {
+        private static AssemblyRef FindAssembly(System.Type type) {
              if (cached.ContainsKey(type.Assembly))
                  return cached[type.Assembly];
-            else
-            {
+            else {
                  AssemblyName name = type.Assembly.GetName();
                  return cached[type.Assembly] =  
AssemblyRef.MakeAssemblyRef(name.Name, (ushort)name.Version.Major,  
(ushort)name.Version.Minor, (ushort)name.Version.Build,  
(ushort)name.Version.Revision, name.GetPublicKeyToken());
              }
          }


-        internal static ClassRef FindClass(System.Type type)
-        {
+        internal static ClassRef FindClass(System.Type type) {
              AssemblyRef assembly = FindAssembly(type);

              ClassRef result;
-            if (type.IsNested)
-            {
+            if (type.IsNested) {
                  ClassRef parent = FindClass(type.DeclaringType);
                  result = parent.GetNestedClass(type.Name);
                  if (result == null)
                      result = parent.AddNestedClass(type.Name);
-            }
-            else
-            {
+            } else {
                  result = assembly.GetClass(type.Namespace, type.Name);
                  if (result == null)
                      result = assembly.AddClass(type.Namespace, type.Name);
@@ -759,23 +641,20 @@
              return result;
          }

-        internal static FieldRef FindField(FieldInfo field)
-        {
+        internal static FieldRef FindField(FieldInfo field) {
              ClassRef parent = FindClass(field.DeclaringType);
              FieldRef fieldRef = parent.GetField(field.Name);
              if (fieldRef == null)
                  fieldRef = parent.AddField(field.Name,  
FindClass(field.FieldType));
-
+
              return fieldRef;
          }


-        internal static Field FindField(PERWAPI.Class klass, string  
fieldName)
-        {
+        internal static Field FindField(PERWAPI.Class klass, string  
fieldName) {
              if (klass is ClassDef)
                  return ((ClassDef)klass).GetField(fieldName);
-            else
-            {
+            else {
                  FieldRef f = ((ClassRef)klass).GetField(fieldName);
                  if (f == null)
                      f = ((ClassRef)klass).AddField(fieldName,  
PERWAPI.PrimitiveType.Object);
@@ -784,22 +663,20 @@
          }

          private static Dictionary<System.Reflection.Assembly,  
PERWAPI.AssemblyRef> cached = new Dictionary<System.Reflection.Assembly,  
PERWAPI.AssemblyRef>();
-
+
          //  
--------------------------------------------------------------------------

          private static List<System.Reflection.Assembly> loaded = new  
List<System.Reflection.Assembly>();


-        internal static System.Reflection.Assembly Load(PEFile assembly)
-        {
+        internal static System.Reflection.Assembly Load(PEFile assembly) {
              MemoryStream binaryStream = new MemoryStream();
              assembly.SetOutputStream(binaryStream);
              assembly.MakeDebuggable(false, false);
              assembly.WritePEFile(false);
              byte[] assemblyBytes = binaryStream.ToArray();
-            //System.Console.WriteLine("Loading {0} ...", Assembly.Name());
+
              System.Reflection.Assembly loadedAssembly =  
System.Reflection.Assembly.Load(assemblyBytes);
-            //System.Console.WriteLine("Loaded {0}",  
loadedAssembly.FullName);
              loaded.Add(loadedAssembly);
              return loadedAssembly;
          }
@@ -807,9 +684,8 @@


      internal enum Clause { None, Try, Catch, Finally };
-
-    internal class Labels
-    {
+
+    internal class Labels {
          internal CILLabel Redo;
          internal CILLabel Retry;
          internal CILLabel Break;
=======================================
--- /trunk/src/RubyRuntime/Compiler/Compiler.cs	Mon Nov 26 20:08:00 2007
+++ /trunk/src/RubyRuntime/Compiler/Compiler.cs	Mon Feb 15 00:18:57 2010
@@ -191,7 +191,7 @@
                      }
                  }
              }
-            catch (System.Exception e)
+            catch (System.Exception)
              { // if Syntax Error then skip code generation
                  return;
              }
=======================================
--- /trunk/src/RubyRuntime/Methods/Eval.cs	Mon Nov 26 20:12:08 2007
+++ /trunk/src/RubyRuntime/Methods/Eval.cs	Mon Feb 15 00:18:57 2010
@@ -448,8 +448,6 @@
          internal static object load(object fname, Frame caller, bool  
try_add_ext)
          {
              //Indent(indent++);
-            //System.Console.WriteLine("loading {0}", fname);
-
              if  
(Program.programs.ContainsKey(File.stripExtension(fname.ToString())))
              {
                   
Ruby.Compiler.AST.SOURCEFILE.LoadExisting(fname.ToString(), caller);
@@ -457,11 +455,12 @@
                  return true;
              }

-            String path = File.rb_find_file((String)fname, try_add_ext);
+            String path = File.rb_find_file((String)fname, try_add_ext);

              if (path == null)
                  throw new LoadError("No such file to load -- " +  
((String)fname).value).raise(caller);

+            path.value = System.IO.Path.GetFullPath(path.value);
              ((Array)Eval.rb_features.value).Add(fname);

              if (path.value.EndsWith(".dll"))
@@ -475,7 +474,6 @@
              }

              //Indent(--indent);
-            //System.Console.WriteLine("finished loading {0}", fname);
              return true;
          }
      }
=======================================
--- /trunk/src/RubyRuntime/Runtime/Eval.cs	Sun Dec  2 19:16:00 2007
+++ /trunk/src/RubyRuntime/Runtime/Eval.cs	Mon Feb 15 00:18:57 2010
@@ -14,24 +14,21 @@
  using Ruby.Runtime;
  using System.Globalization;

-namespace Ruby.Runtime
-{
-    internal enum Receiver
-    {
+namespace Ruby.Runtime {
+    internal enum Receiver {
          Explicit = 0,   // explicit receiver specified
-        Self     = 1,   // implicit receiver (function call)
-        Virtual  = 2,   // local variable or method call
-        Super    = 3    // super class method call
+        Self = 1,   // implicit receiver (function call)
+        Virtual = 2,   // local variable or method call
+        Super = 3    // super class method call
      }

      internal enum CallStatus { Private, Protected, VCall, Super, None };

      // Ruby.Eval contains the implementation of Ruby method calling
-
-
+
+
      [UsedByRubyCompiler]
-    public class Eval
-    {
+    public class Eval {
          //  
------------------------------------------------------------------------------
          [UsedByRubyCompiler]
          public static errinfo_global ruby_errinfo = new  
errinfo_global();   // $!
@@ -42,9 +39,9 @@
          internal static safe_global safe = new  
safe_global();                 // $SAFE
          internal static lastline_global rb_lastline = new  
lastline_global();  // $_
          internal static ThreadGroup  
thgroup_default;                          // ThreadGroup.Default
-        internal static Thread curr_thread, main_thread;
-
-
+        internal static Thread curr_thread, main_thread;
+
+

          private static bool rubyRunning = false;

@@ -53,18 +50,15 @@

          //  
-----------------------------------------------------------------------------

-        internal static bool RubyRunning
-        {
+        internal static bool RubyRunning {
              get { return Eval.rubyRunning; }
              set { Eval.rubyRunning = value; }
          }

          [UsedByRubyCompiler]
-        public static object Return(object value, Frame caller)
-        {
+        public static object Return(object value, Frame caller) {
              Array array;
-            if (Array.TryToArray(value, out array, caller))
-            {
+            if (Array.TryToArray(value, out array, caller)) {
                  int length = array.Count;

                  if (length == 0)
@@ -72,7 +66,7 @@
                  if (length == 1)
                      return array[0];
              }
-
+
              return value;
          }

@@ -81,59 +75,48 @@

          private static Frame dummyFrame = new DummyFrame();

-        public static object Call0(object recv, string methodId)
-        {
+        public static object Call0(object recv, string methodId) {
              return CallPublic0(recv, dummyFrame, methodId, null);
          }

-        public static object Call1(object recv, string methodId, object  
arg1)
-        {
+        public static object Call1(object recv, string methodId, object  
arg1) {
              return CallPublic1(recv, dummyFrame, methodId, null, arg1);
          }

-        public static object Call2(object recv, string methodId, object  
arg1, object arg2)
-        {
+        public static object Call2(object recv, string methodId, object  
arg1, object arg2) {
              return CallPublic2(recv, dummyFrame, methodId, null, arg1,  
arg2);
          }

-        public static object Call3(object recv, string methodId, object  
arg1, object arg2, object arg3)
-        {
+        public static object Call3(object recv, string methodId, object  
arg1, object arg2, object arg3) {
              return CallPublic3(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3);
          }

-        public static object Call4(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4)
-        {
+        public static object Call4(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4) {
              return CallPublic4(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3, arg4);
          }

-        public static object Call5(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5)
-        {
+        public static object Call5(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5) {
              return CallPublic5(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3, arg4, arg5);
          }

-        public static object Call6(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
-        {
+        public static object Call6(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6) {
              return CallPublic6(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3, arg4, arg5, arg6);
          }

-        public static object Call7(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6,  
object arg7)
-        {
+        public static object Call7(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6,  
object arg7) {
              return CallPublic7(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3, arg4, arg5, arg6, arg7);
          }

-        public static object Call8(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6,  
object arg7, object arg8)
-        {
+        public static object Call8(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6,  
object arg7, object arg8) {
              return CallPublic8(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
          }

-        public static object Call9(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6,  
object arg7, object arg8, object arg9)
-        {
+        public static object Call9(object recv, string methodId, object  
arg1, object arg2, object arg3, object arg4, object arg5, object arg6,  
object arg7, object arg8, object arg9) {
              return CallPublic9(recv, dummyFrame, methodId, null, arg1,  
arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
          }


-        public static object Call(object recv, string methodId, params  
object[] args)
-        {
+        public static object Call(object recv, string methodId, params  
object[] args) {
              return CallPublic(recv, dummyFrame, methodId, null, args);
          }
          #endregion
@@ -141,8 +124,7 @@

          #region FixedArgCases
          [UsedByRubyCompiler]
-        public static object CallPublic0(object recv, Frame caller, string  
methodId, Proc block)
-        {
+        public static object CallPublic0(object recv, Frame caller, string  
methodId, Proc block) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -152,8 +134,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic1(object recv, Frame caller, string  
methodId, Proc block, object arg1)
-        {
+        public static object CallPublic1(object recv, Frame caller, string  
methodId, Proc block, object arg1) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -163,8 +144,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic2(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2)
-        {
+        public static object CallPublic2(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -174,8 +154,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic3(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3)
-        {
+        public static object CallPublic3(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -185,8 +164,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic4(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4)
-        {
+        public static object CallPublic4(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -196,8 +174,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic5(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5)
-        {
+        public static object CallPublic5(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -207,8 +184,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic6(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6)
-        {
+        public static object CallPublic6(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -218,8 +194,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic7(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6, object arg7)
-        {
+        public static object CallPublic7(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6, object arg7) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -229,8 +204,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic8(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6, object arg7, object arg8)
-        {
+        public static object CallPublic8(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6, object arg7, object arg8) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -240,8 +214,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPublic9(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6, object arg7, object arg8, object arg9)
-        {
+        public static object CallPublic9(object recv, Frame caller, string  
methodId, Proc block, object arg1, object arg2, object arg3, object arg4,  
object arg5, object arg6, object arg7, object arg8, object arg9) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -252,15 +225,13 @@
          #endregion

          [UsedByRubyCompiler]
-        public static object CallPublic(object recv, Frame caller, string  
methodId, Proc block, params object[] args)
-        {
-            return CallPublicA(recv, caller, methodId, new ArgList(block,  
args));
+        public static object CallPublic(object recv, Frame caller, string  
methodId, Proc block, params object[] args) {
+            return CallPublicA(recv, caller, methodId, new ArgList(block,  
args));
          }


          [UsedByRubyCompiler]
-        public static object CallPublicA(object recv, Frame caller, string  
methodId, ArgList args)
-        {
+        public static object CallPublicA(object recv, Frame caller, string  
methodId, ArgList args) {
              Class origin;
              RubyMethod method = FindPublicMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -271,10 +242,9 @@


          #region FixedArgCases
-
+
          [UsedByRubyCompiler]
-        public static object CallPrivate0(object recv, Frame caller,  
string methodId, Proc block)
-        {
+        public static object CallPrivate0(object recv, Frame caller,  
string methodId, Proc block) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -284,8 +254,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate1(object recv, Frame caller,  
string methodId, Proc block, object arg1)
-        {
+        public static object CallPrivate1(object recv, Frame caller,  
string methodId, Proc block, object arg1) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -295,8 +264,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate2(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2)
-        {
+        public static object CallPrivate2(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -306,8 +274,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate3(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3)
-        {
+        public static object CallPrivate3(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -317,8 +284,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate4(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4)
-        {
+        public static object CallPrivate4(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -328,8 +294,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate5(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5)
-        {
+        public static object CallPrivate5(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -339,8 +304,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate6(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6)
-        {
+        public static object CallPrivate6(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -350,8 +314,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate7(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6, object arg7)
-        {
+        public static object CallPrivate7(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6, object arg7) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -361,8 +324,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate8(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6, object arg7, object arg8)
-        {
+        public static object CallPrivate8(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6, object arg7, object arg8) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -372,8 +334,7 @@
          }

          [UsedByRubyCompiler]
-        public static object CallPrivate9(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6, object arg7, object arg8, object arg9)
-        {
+        public static object CallPrivate9(object recv, Frame caller,  
string methodId, Proc block, object arg1, object arg2, object arg3, object  
arg4, object arg5, object arg6, object arg7, object arg8, object arg9) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -384,14 +345,12 @@
          #endregion

          [UsedByRubyCompiler]
-        public static object CallPrivate(object recv, Frame caller, string  
methodId, Proc block, params object[] args)
-        {
+        public static object CallPrivate(object recv, Frame caller, string  
methodId, Proc block, params object[] args) {
              return CallPrivateA(recv, caller, methodId, new ArgList(block,  
args));
          }

          [UsedByRubyCompiler]
-        public static object CallPrivateA(object recv, Frame caller,  
string methodId, ArgList args)
-        {
+        public static object CallPrivateA(object recv, Frame caller,  
string methodId, ArgList args) {
              Class origin;
              RubyMethod method = FindPrivateMethod(recv, caller, methodId,  
out origin);
              if (method != null)
@@ -402,23 +361,20 @@


          [UsedByRubyCompiler]
-        public static object CallSuperA(Class klass, Frame caller, object  
recv, string methodId, ArgList args)
-        {
+        public static object CallSuperA(Class klass, Frame caller, object  
recv, string methodId, ArgList args) {
              Class origin;
              RubyMethod method = FindSuperMethod(klass, caller, methodId,  
out origin);

              if (method != null)
                  return method.body.Calln(origin, recv, caller, args);
-            else
-            {
+            else {
                  caller.call_status = CallStatus.Super;
                  return method_missing(recv, caller, methodId, args);
              }
          }


-        internal static RubyMethod FindSuperMethod(Class klass, Frame  
caller, string methodId, out Class origin)
-        {
+        internal static RubyMethod FindSuperMethod(Class klass, Frame  
caller, string methodId, out Class origin) {
              Class superClass = klass.super;
              if (superClass == null && klass._type == Class.Type.Module)
                  superClass = Init.rb_cObject;
@@ -426,22 +382,19 @@
              return FindMethodForClass(superClass, Receiver.Super, caller,  
methodId, out origin);
          }

-        internal static RubyMethod FindPrivateMethod(object recv, Frame  
caller, string methodId, out Class origin)
-        {
+        internal static RubyMethod FindPrivateMethod(object recv, Frame  
caller, string methodId, out Class origin) {
              return FindMethodForClass(Class.CLASS_OF(recv), Receiver.Self,  
caller, methodId, out origin);
          }


-        internal static RubyMethod FindPublicMethod(object recv, Frame  
caller, string methodId, out Class origin)
-        {
+        internal static RubyMethod FindPublicMethod(object recv, Frame  
caller, string methodId, out Class origin) {
              return FindMethodForClass(Class.CLASS_OF(recv),  
Receiver.Explicit, caller, methodId, out origin);
          }



          [UsedByRubyCompiler]
-        public static RubyMethod FindSuperMethod(Class klass, Frame  
caller, string methodId)
-        {
+        public static RubyMethod FindSuperMethod(Class klass, Frame  
caller, string methodId) {
              Class origin;
              Class superClass = klass.super;
              if (superClass == null && klass._type == Class.Type.Module)
@@ -451,15 +404,13 @@
          }

          [UsedByRubyCompiler]
-        public static RubyMethod FindPrivateMethod(object recv, Frame  
caller, string methodId)
-        {
+        public static RubyMethod FindPrivateMethod(object recv, Frame  
caller, string methodId) {
              Class origin;
              return FindMethodForClass(Class.CLASS_OF(recv), Receiver.Self,  
caller, methodId, out origin);
          }

          [UsedByRubyCompiler]
-        public static RubyMethod FindPublicMethod(object recv, Frame  
caller, string methodId)
-        {
+        public static RubyMethod FindPublicMethod(object recv, Frame  
caller, string methodId) {
              Class origin;
              return FindMethodForClass(Class.CLASS_OF(recv),  
Receiver.Explicit, caller, methodId, out origin);
          }
@@ -467,42 +418,35 @@



-        internal static RubyMethod FindMethodForClass(Class klass,  
Receiver receiverStyle, Frame caller, string methodId, out Class origin)
-        {
+        internal static RubyMethod FindMethodForClass(Class klass,  
Receiver receiverStyle, Frame caller, string methodId, out Class origin) {
              RubyMethod method;

-            if (klass == null)
-            {
+            if (klass == null) {
                  origin = null;
                  return null;
              }

-            if (klass.get_method(methodId, out method, out origin) &&  
method != null)
-            {
+            if (klass.get_method(methodId, out method, out origin) &&  
method != null) {
                  if (method is MethodAlias)
                      origin = method.definingClass;

-                if (method.access == Access.Private && receiverStyle ==  
Receiver.Explicit)
-                {
+                if (method.access == Access.Private && receiverStyle ==  
Receiver.Explicit) {
                      if (caller != null)
                          caller.call_status = CallStatus.Private;
                      return null;
                  }

-                if (method.access == Access.Protected && receiverStyle ==  
Receiver.Explicit)
-                {
+                if (method.access == Access.Protected && receiverStyle ==  
Receiver.Explicit) {
                      Class outerScope = Ruby.Runtime.Init.rb_cObject;

-                    if (caller != null)
-                    {
+                    if (caller != null) {
                          //Class[] nesting = caller.nesting();
                          //if (nesting != null && nesting.Length > 0)
                          //    outerScope = nesting[0];
                          outerScope = caller.lastClass();
                      }

-                    if (!outerScope.is_kind_of(method.definingClass))
-                    {
+                    if (!outerScope.is_kind_of(method.definingClass)) {
                          if (caller != null)
                              caller.call_status = CallStatus.Protected;
                          return null;
@@ -510,15 +454,12 @@
                  }

                  return method;
-            }
-            else
-            {
+            } else {
                  return null;
              }
          }

-        internal static object method_missing(object recv, Frame caller,  
string methodId, ArgList args)
-        {
+        internal static object method_missing(object recv, Frame caller,  
string methodId, ArgList args) {
              ArgList newargs = new ArgList(args.block);
              newargs.Add(new Symbol(methodId));
              newargs.AddRange(args);
@@ -532,8 +473,7 @@
          }

          [UsedByRubyCompiler]
-        public static object ivar_get(object obj, string id)
-        {
+        public static object ivar_get(object obj, string id) {
              if (obj is Object)
                  return ((Object)obj).instance_variable_get(id);
              else
@@ -544,10 +484,8 @@
          }

          [UsedByRubyCompiler]
-        public static object ivar_set(Frame caller, object obj, string id,  
object value)
-        {
-            if (obj is Object)
-            {
+        public static object ivar_set(Frame caller, object obj, string id,  
object value) {
+            if (obj is Object) {
                  Object o = (Object)obj;
                  if (!o.Tainted && Eval.rb_safe_level() >= 4)
                      throw new SecurityError("Insecure: can't modify  
instance variable").raise(caller);
@@ -555,9 +493,7 @@
                      throw  
TypeError.rb_error_frozen(caller, "object").raise(caller);

                  o.instance_variable_set(id, value);
-            }
-            else
-            {
+            } else {
                  // Lookaside
                  Object.generic_ivar_set(obj, id, value);
              }
@@ -565,20 +501,17 @@
          }

          [UsedByRubyCompiler]
-        public static object ivar_defined(object obj, string id)
-        {
+        public static object ivar_defined(object obj, string id) {
              if (obj is Object)
                  return ((Object)obj).instance_vars.ContainsKey(id);
-            else
-            {
+            else {
                  // Lookaside
                  return Object.generic_ivar_defined(obj, id);
              }
          }


-        internal static bool const_defined(Class current, string id, Frame  
caller)
-        {
+        internal static bool const_defined(Class current, string id, Frame  
caller) {
              if (current.const_defined(id, false))
                  return true;

@@ -590,8 +523,7 @@
          }


-        internal static object const_get(Class current, string id, Frame  
caller)
-        {
+        internal static object const_get(Class current, string id, Frame  
caller) {
              if (current.const_defined(id, false))
                  return current.const_get(id, caller);

@@ -604,8 +536,7 @@


          [UsedByRubyCompiler]
-        public static object const_defined(object current, string id,  
Frame caller)
-        {
+        public static object const_defined(object current, string id,  
Frame caller) {
              if (current is Class && const_defined((Class)current, id,  
caller))
                  return new Ruby.String("constant");
              else if (Class.rb_method_boundp(Class.CLASS_OF(current), id,  
false))
@@ -615,8 +546,7 @@
          }

          [UsedByRubyCompiler]
-        public static object get_const(object current, string id, Frame  
caller)
-        {
+        public static object get_const(object current, string id, Frame  
caller) {
              if (current is Class)
                  return const_get((Class)current, id, caller);
              else
@@ -624,13 +554,11 @@
          }

          [UsedByRubyCompiler]
-        public static object set_const(Frame caller, object scope, string  
id, object value)
-        {
+        public static object set_const(Frame caller, object scope, string  
id, object value) {
              Class klass = (Class)scope;
              if (!klass.Tainted && rb_safe_level() >= 4)
                  throw new SecurityError("Insecure: can't set  
constant").raise(caller);
-            if (klass.Frozen)
-            {
+            if (klass.Frozen) {
                  if (klass._type == Class.Type.Module)
                      throw  
TypeError.rb_error_frozen(caller, "module").raise(caller);
                  else
@@ -640,8 +568,7 @@
          }

          [UsedByRubyCompiler]
-        public static Proc block_pass(object arg, Frame caller)
-        {
+        public static Proc block_pass(object arg, Frame caller) {
              if (arg is Proc)
                  return (Proc)arg;

@@ -649,7 +576,7 @@
                  return null;

              object result = Eval.CallPrivate(arg, caller, "to_proc", null);
-
+
              if (result is Proc)
                  return (Proc)result;
              else
@@ -657,14 +584,13 @@
          }


-        internal static int object_id(object obj)
-        {
+        internal static int object_id(object obj) {
              if (obj == null)
                  return 4;
-
+
              if (obj is int)
                  return ((int)obj) * 2 + 1;
-
+
              if (obj is bool)
                  if ((bool)obj)
                      return 2;
@@ -679,15 +605,13 @@


          [UsedByRubyCompiler]
-        public static object alias(Class klass, string name, string def,  
Frame caller)
-        {
+        public static object alias(Class klass, string name, string def,  
Frame caller) {
              klass.define_alias(name, def, caller);
              return null;
          }

          // ruby_cbase: gets the class attached to the current 'node' (i.e.  
the current lexical context)
-        internal static Class ruby_cbase(Frame caller)
-        {
+        internal static Class ruby_cbase(Frame caller) {
              Class[] nesting = caller.nesting();

              if (nesting == null || nesting.Length == 0)
@@ -697,24 +621,21 @@
          }

          [UsedByRubyCompiler]
-        public static bool Test(object test)
-        {
+        public static bool Test(object test) {
              return !(test == null || (test is bool && ((bool)test) ==  
false));
          }

          /// <summary>
          /// rb_respond_to
          /// </summary>
-        internal static bool RespondTo(object obj, string method)
-        {
+        internal static bool RespondTo(object obj, string method) {
              Class origin;
              // FIXME:
              // - Is the null caller correct?
              // - May need to use rb_method_boundp.
              if (Eval.FindPrivateMethod(obj, null, method, out origin) !=  
null)
                  return true;
-            else
-            {
+            else {
                  // FIXME: Is the null caller correct?
                  object result = Eval.CallPrivate1(obj,  
null, "respond_to?", null, new Symbol(method));
                  // Return true for any object other than false (even nil).
@@ -725,8 +646,7 @@
          //  
------------------------------------------------------------------------------


-        internal static object eval(object self, String src, IContext  
scope, string file, int line, Frame caller)
-        {
+        internal static object eval(object self, String src, IContext  
scope, string file, int line, Frame caller) {
              //System.Console.WriteLine("eval({0})", src.value);
              Frame frame = scope.Frame();
              //frame.caller = caller;      // BBTAG
@@ -740,8 +660,7 @@
              //throw new System.Exception("testing");
          }

-        internal static object eval_under(Class klass, object self, String  
src, IContext scope, string file, int line, Frame caller)
-        {
+        internal static object eval_under(Class klass, object self, String  
src, IContext scope, string file, int line, Frame caller) {
              //System.Console.WriteLine("eval({0})", src.value);
              Frame frame = scope.Frame();
              //frame.caller = caller;      // BBTAG
@@ -756,14 +675,11 @@

          internal static object specific_eval(Class last_class, object  
self, Class ruby_class, Frame caller, Proc block, Array args) //author:  
Brian, status: partial
          {
-            if (block != null)
-            {
+            if (block != null) {
                  ArgList argList = new ArgList();
                  argList.AddArray(args, caller);
                  return block.yield_under(caller, argList, ruby_class,  
self);
-            }
-            else
-            {
+            } else {
                  string file = "eval";
                  int line = 1;

@@ -772,15 +688,12 @@
                  object vline = null;
                  String src = null;

-                if (args.Count > 0)
-                {
+                if (args.Count > 0) {
                      src = (String)(args[0]);
-                    if (args.Count > 1)
-                    {
+                    if (args.Count > 1) {
                          vfile = args[1];
                          file = ((String)vfile).value;
-                        if (args.Count > 2)
-                        {
+                        if (args.Count > 2) {
                              vline = args[2];
                              line = (int)vline;
                          }
@@ -803,7 +716,7 @@

          internal static MethodBody rb_method_node(Class klass, string id)  
// status: unimplemented
          {
-
+
              throw new System.NotImplementedException();
          }

@@ -814,14 +727,10 @@

          internal static void rb_secure(int level, Frame caller) // status:  
done
          {
-            if (level <= rb_safe_level())
-            {
-                if ((caller != null) && (caller.methodName().Length > 0))
-                {
+            if (level <= rb_safe_level()) {
+                if ((caller != null) && (caller.methodName().Length > 0)) {
                      throw new SecurityError("Insecure operation `" +  
caller.methodName() + " at level " + ruby_safe_level).raise(caller);
-                }
-                else
-                {
+                } else {
                      throw new SecurityError("Insecure operation at level "  
+ ruby_safe_level).raise(caller);
                  }
              }
@@ -851,7 +760,7 @@
          {
              //FIXME: prot_tag
              //if (prot_tag)
-            terminate_process(caller, status, "exit");
+            // rifraf commented out: terminate_process(caller,  
status, "exit");

              //ruby_finalize();

@@ -877,30 +786,24 @@



-        private class DummyFrame : Frame
-        {
+        private class DummyFrame : Frame {
              public DummyFrame()
-                : base(null)
-            {
+                : base(null) {
              }

-            protected override string file()
-            {
+            protected override string file() {
                  return "";
              }

-            public override string methodName()
-            {
+            public override string methodName() {
                  return "";
              }

-            public override Class[] nesting()
-            {
+            public override Class[] nesting() {
                  return new Class[0];
              }

-            public override Class lastClass()
-            {
+            public override Class lastClass() {
                  return null;
              }
          }
@@ -909,8 +812,7 @@



-    internal class errat_global : global_variable
-    {
+    internal class errat_global : global_variable {
          internal override object getter(string id, Frame caller) //  
status: done
          {
              System.Console.WriteLine("get global {0}, currently {1}", id,  
Eval.ruby_errinfo.value);
@@ -930,8 +832,7 @@
      }

      [UsedByRubyCompiler]
-    public class errinfo_global : global_variable
-    {
+    public class errinfo_global : global_variable {
          internal override void setter(string id, object value, Frame  
caller) // status: done
          {
              if (value != null && !(value is Exception))
@@ -942,8 +843,7 @@
      }


-    internal class safe_global : global_variable
-    {
+    internal class safe_global : global_variable {
          internal override object getter(string id, Frame caller) //  
author: Brian, status: done
          {
              // safe_getter
@@ -955,8 +855,7 @@
              // safe_setter
              int level = Object.Convert<int>(value, "to_int", caller);

-            if (level < Eval.ruby_safe_level)
-            {
+            if (level < Eval.ruby_safe_level) {
                  throw new SecurityError("tried to downgrade safe level  
from " + Eval.ruby_safe_level + " to " + level).raise(caller);
              }

@@ -970,12 +869,10 @@

      internal class lastline_global : global_variable // author:cjs,  
status: done
      {
-        internal override object getter(string id, Frame caller)
-        {
+        internal override object getter(string id, Frame caller) {
              return Eval.rb_lastline_get(caller);
          }
-        internal override void setter(string id, object value, Frame  
caller)
-        {
+        internal override void setter(string id, object value, Frame  
caller) {
              Eval.rb_lastline_set(caller, String.RStringValue(value,  
caller));
          }
      }
@@ -983,10 +880,8 @@



-namespace Ruby
-{
-    internal class LocalJumpError : StandardError
-    {
+namespace Ruby {
+    internal class LocalJumpError : StandardError {
          public LocalJumpError(string message) : this(message,  
Ruby.Runtime.Init.rb_eLocalJumpError) { }

          public LocalJumpError(string message, Class klass) : base(message,  
klass) { }
@@ -995,9 +890,8 @@
      }


-
-    internal class SystemStackError : StandardError
-    {
+
+    internal class SystemStackError : StandardError {
          public SystemStackError(string message) : this(message,  
Ruby.Runtime.Init.rb_eSysStackError) { }

          public SystemStackError(string message, Class klass) :  
base(message, klass) { }