Skip to content

Commit

Permalink
g3
Browse files Browse the repository at this point in the history
  • Loading branch information
czhower committed Jul 21, 2017
1 parent a4a6b93 commit 66ea10b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 33 deletions.
2 changes: 0 additions & 2 deletions source/Cosmos.IL2CPU/CompilerEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
namespace Cosmos.IL2CPU {
// http://blogs.msdn.com/b/visualstudio/archive/2010/07/06/debugging-msbuild-script-with-visual-studio.aspx
public class CompilerEngine {
const string FULLASSEMBLYNAME_KERNEL = "Cosmos.System.Kernel";

public Action<string> OnLogMessage;
public Action<string> OnLogError;
public Action<string> OnLogWarning;
Expand Down
49 changes: 18 additions & 31 deletions source/Cosmos.IL2CPU/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;

namespace Cosmos.IL2CPU
{
public class Program
{
namespace Cosmos.IL2CPU {
public class Program {
public const string CosmosRoot = "";
private const string KernelFile = CosmosRoot + "";
private const string OutputFile = CosmosRoot + "";
Expand All @@ -13,51 +11,43 @@ public class Program
private static List<string> AdditionalReferences = new List<string>();
private static List<string> AdditionalSearchDirs = new List<string>();

public static int Run(string[] args, Action<string> logMessage, Action<string> logError)
{
if (args == null)
{
public static int Run(string[] args, Action<string> logMessage, Action<string> logError) {
if (args == null) {
throw new ArgumentNullException("args");
}
if (logMessage == null)
{
if (logMessage == null) {
throw new ArgumentNullException("logMessage");
}
if (logError == null)
{
if (logError == null) {
throw new ArgumentNullException("logError");
}

try
{
try {
var tmp = "";
foreach (var s in args)
{
foreach (var s in args) {
tmp += s;
string[] s1 = s.Split(':');
string argID = s1[0].ToLower();
if (argID == "References".ToLower())
{
if (argID == "References".ToLower()) {
References.Add(s.Replace(s1[0] + ":", ""));
}
else if (argID == "AdditionalReferences".ToLower())
{
else if (argID == "AdditionalReferences".ToLower()) {
AdditionalReferences.Add(s.Replace(s1[0] + ":", ""));
}
else if (argID == "AdditionalSearchDirs".ToLower())
{
else if (argID == "AdditionalSearchDirs".ToLower()) {
AdditionalSearchDirs.Add(s.Replace(s1[0] + ":", ""));
}
else
{
else {
CmdOptions.Add(argID, s.Replace(s1[0] + ":", ""));
}
}

var xTask = new CompilerEngine();
xTask.UseGen3Kernel = Convert.ToBoolean(CmdOptions["UseGen3Kernel".ToLower()]);
xTask.DebugEnabled = Convert.ToBoolean(CmdOptions["DebugEnabled".ToLower()]);
logMessage("Loaded : DebugEnabled");
xTask.StackCorruptionDetectionEnabled = Convert.ToBoolean(CmdOptions["StackCorruptionDetectionEnabled".ToLower()]);
xTask.StackCorruptionDetectionEnabled =
Convert.ToBoolean(CmdOptions["StackCorruptionDetectionEnabled".ToLower()]);
logMessage("Loaded : StackCorruptionDetectionEnabled");
xTask.DebugMode = CmdOptions["DebugMode".ToLower()];
logMessage("Loaded : DebugMode");
Expand Down Expand Up @@ -89,21 +79,18 @@ public static int Run(string[] args, Action<string> logMessage, Action<string> l
xTask.OnLogMessage = logMessage;
xTask.OnLogException = (m) => logError(String.Format("Exception: {0}", m.ToString()));
xTask.AssemblerLog = "Cosmos.Assembler.log";
if (xTask.Execute())
{
if (xTask.Execute()) {
logMessage("Executed OK");
// File.WriteAllText(@"e:\compiler.log", "OK");
return 0;
}
else
{
else {
logMessage("Errorred");
// File.WriteAllText(@"e:\compiler.log", "Errored");
return 2;
}
}
catch (Exception E)
{
catch (Exception E) {
logError(String.Format("Error occurred: " + E.ToString()));
return 1;
}
Expand Down

0 comments on commit 66ea10b

Please sign in to comment.