Преглед на файлове

All changes for NET-candidate 1.4.05

k-john-gough преди 7 години
родител
ревизия
6531bb3a86
променени са 3 файла, в които са добавени 88 реда и са изтрити 69 реда
  1. 1 1
      gpcp/GPCPcopyright.cp
  2. 6 0
      gpcp/JavaMaker.cp
  3. 81 68
      gpcp/csharp/MsilAsm.cs

+ 1 - 1
gpcp/GPCPcopyright.cp

@@ -54,7 +54,7 @@ MODULE GPCPcopyright;
      (* VERSION    = "1.4.01 of 21 October 2016"; *)
      (* VERSION    = "1.4.02 of 14 November 2016"; *)
      (* VERSION    = "1.4.04 of 07 August 2017"; *)
-        VERSION    = "1.4.05 of 30 August 2017"; 
+        VERSION    = "1.4.05 of 11 October 2017"; 
 	verStr*    = " version " + VERSION;
 
   CONST	prefix     = "#gpcp: ";

+ 6 - 0
gpcp/JavaMaker.cp

@@ -262,6 +262,12 @@ MODULE JavaMaker;
     CSt.ntvExc := exc.type;
     Bi.MkDummyClass("Class", blk, Ty.noAtt, cls);
     CSt.ntvTyp := cls.type;
+   (*
+    * This next solves a perverse problem when java_lang
+    * (jl) is imported *after* RTS. The merging of the two
+    * definitions of java_lang.Exception loses the base
+    * class name jl.Throwable. There are alternative fixes ...
+    *)
     Bi.MkDummyClass("Throwable", blk, Ty.extns, thr);
     Bi.AddDummyBaseTp(exc, thr);
    (*

+ 81 - 68
gpcp/csharp/MsilAsm.cs

@@ -15,13 +15,14 @@
 //  BEGIN END Assemble;
 //
 //END MsilAsm.
-// 
-// 
-//  NOTE: this needs (since 2005) to be compiled using
 //
-//  $ csc /t:library /r:RTS.dll MsilAsm.cs
+// Compile with :
+//
+//  $ csc /t:library /debug MsilAsm.cs
 // 
 
+using System;
+using System.Text;
 using System.Diagnostics;
 
 namespace MsilAsm {
@@ -35,77 +36,89 @@ public class MsilAsm {
     {
         // Get the path to mscorlib.dll
         string s = typeof(object).Module.FullyQualifiedName;
-
         // Remove the file part to get the directory
-        return System.IO.Directory.GetParent(s).ToString() + "\\";
+        return System.IO.Directory.GetParent(s).ToString();
     }
 
-    public static void Init() {
-	if (asm == null) {
-	    asm = new Process();
-	    asm.StartInfo.FileName = GetDotNetRuntimeInstallDirectory() + "ilasm";
-	    asm.StartInfo.CreateNoWindow = true;
-	    asm.StartInfo.UseShellExecute = false;
-	}
-    }
+        public static void Init() {
+            if (asm == null) {
+                asm = new Process();
+                System.String frameworkDir = GetDotNetRuntimeInstallDirectory();
+                //System.String frameworkDir = Environment.GetEnvironmentVariable("NET40", EnvironmentVariableTarget.User);
+                asm.StartInfo.FileName = frameworkDir + "\\" + "ilasm";
+                asm.StartInfo.CreateNoWindow = true;
+                asm.StartInfo.UseShellExecute = false;
+            }
+        }
 
-    public static void Assemble(char[] fil, char[] opt, bool hasMain) {
-	int retCode;
-	System.String optNm;
-	System.String suffx;
-	System.String fName = CP_rts.mkStr(fil);
-	if (hasMain) {
-	    optNm = "/exe ";
-	    suffx = ".exe";
-	} else {
-	    optNm = "/dll ";
-	    suffx = ".dll";
-	}
-	optNm = optNm + CP_rts.mkStr(opt) + ' ';
-	asm.StartInfo.Arguments = optNm + "/nologo /quiet " + fName + ".il";
-	asm.Start();
-	asm.WaitForExit();
-	retCode = asm.ExitCode;
-	if (retCode != 0)
-	    System.Console.WriteLine("#gpcp: ilasm FAILED " + retCode);
-	else
-	    System.Console.WriteLine("#gpcp: created " + fName + suffx);
-    }
-    
-    public static void DoAsm(char[] fil, char[] opt, 
-				bool hasMain, 
-				bool verbose, 
-				ref int rslt) {
-	System.String optNm;
-	System.String suffx;
-	System.String fName = CP_rts.mkStr(fil);
-	if (hasMain) {
-	    optNm ="/exe ";
-	    suffx = ".exe";
-	} else {
-	    optNm = "/dll ";
-	    suffx = ".dll";
-	}
-	optNm = optNm + CP_rts.mkStr(opt) + ' ';
-	if (verbose) {
-	    System.Console.WriteLine("#gpcp: Calling " + asm.StartInfo.FileName);
-	    asm.StartInfo.CreateNoWindow = false;
-	    asm.StartInfo.Arguments = optNm + "/nologo " + fName + ".il";
-	} else {
-	    asm.StartInfo.CreateNoWindow = true;
-	    asm.StartInfo.Arguments = optNm + "/nologo /quiet " + fName + ".il";
-	}
-	asm.Start();
-	asm.WaitForExit();
-	rslt = asm.ExitCode;
-	if (rslt == 0)
-	    System.Console.WriteLine("#gpcp: Created " + fName + suffx);
-    }
+        private static int CPlen(char[] arr) {
+            int len = arr.Length;
+            for (int ix = 0; ix < len; ix++)
+                if (arr[ix] == '\0')
+                    return ix;
+            return len;
+        }
+
+        public static void Assemble(char[] fil, char[] opt, bool hasMain) {
+            int retCode;
+            System.String optNm;
+            System.String suffx;
+            System.String fName = new String(fil, 0, CPlen(fil));
+            if (hasMain) {
+                optNm = "/exe ";
+                suffx = ".exe";
+            }
+            else {
+                optNm = "/dll ";
+                suffx = ".dll";
+            }
+            optNm = optNm + new String(opt, 0, CPlen(opt)) + ' ';
+            asm.StartInfo.Arguments = optNm + "/nologo /quiet " + fName + ".il";
+            asm.Start();
+            asm.WaitForExit();
+            retCode = asm.ExitCode;
+            if (retCode != 0)
+                System.Console.WriteLine("#gpcp: ilasm FAILED " + retCode);
+            else
+                System.Console.WriteLine("#gpcp: created " + fName + suffx);
+        }
+
+        public static void DoAsm(char[] fil, char[] opt,
+                    bool hasMain,
+                    bool verbose,
+                    ref int rslt) {
+            System.String optNm;
+            System.String suffx;
+            System.String fName = new String(fil, 0, CPlen(fil));
 
-    
-    public static void Assemble(char[] fil, bool hasMain) {
+            if (hasMain) {
+                optNm = "/exe ";
+                suffx = ".exe";
+            }
+            else {
+                optNm = "/dll ";
+                suffx = ".dll";
+            }
+            optNm = optNm + new String(opt, 0, CPlen(opt)) + ' ';
+            if (verbose) {
+                asm.StartInfo.Arguments = optNm + "/nologo " + fName + ".il";
+                System.Console.WriteLine("#gpcp: Calling " + asm.StartInfo.FileName + ' ' + asm.StartInfo.Arguments);
+            }
+            else {
+                asm.StartInfo.Arguments = optNm + "/nologo /quiet " + fName + ".il";
+            }
+            asm.Start();
+            asm.WaitForExit();
+            rslt = asm.ExitCode;
+            if (rslt == 0)
+                System.Console.WriteLine("#gpcp: Created " + fName + suffx);
+        }
+
+
+        public static void Assemble(char[] fil, bool hasMain) {
         char[] opt = {'/', 'd', 'e', 'b', 'u', 'g', '\0' };
         Assemble(fil, opt, hasMain);
     }
+
   }
 }