Skip to content
Permalink
Browse files

Partial ARM provisions.

  • Loading branch information...
czhower committed Jun 6, 2019
1 parent 8542b7f commit b83f52a767c67ca481c2c4eb4b6c6770fb67c2ff
Showing with 15 additions and 6 deletions.
  1. +2 −3 .vscode/launch.json
  2. +2 −0 ToDo 2019.txt
  3. +2 −1 source/Tools/CliProcessor.cs
  4. +9 −2 source/XSharp/XSC/Program.cs
@@ -13,7 +13,7 @@
"args": [
"..\\..\\..\\playground\\",
//"-Plugin:Cosmos.XSC",
"-Gen2", "-WaitOnError"
"-Gen2", "-WaitOnError", "-CPU:x86"
],
"cwd": "${workspaceFolder}\\source\\XSharp\\XSC",
"stopAtEntry": false,
@@ -29,8 +29,7 @@
"args": [
"..\\..\\..\\playground\\",
//"-Plugin:Cosmos.XSC",
"-Gen2",
"-WaitOnError"
"-Gen2", "-WaitOnError", "-CPU:x86"
],
"cwd": "${workspaceFolder}\\source\\XSharp\\XSC",
"stopAtEntry": false,
@@ -13,6 +13,8 @@
-Eliminate G1

* .xsproj
-Use .json if allowed
-replication of xsc args - then args can override if specified wtih .xsproj to xsc
-Build files
-F5 build and run

@@ -14,10 +14,11 @@ public class Switch {
public string Name { get; set; }
public string Value { get; set; }

public string Check(string aDefault, string[] aAllowedValues, bool aCaseSensitive = false) {
public string Check(string aDefault, string[] aAllowedValues, bool aRequired = false, bool aCaseSensitive = false) {
if (aAllowedValues.Contains(Value, aCaseSensitive ? null : StringComparer.OrdinalIgnoreCase)) {
return Value;
}
if (aRequired) throw new Exception($"{Name} requires a value.");
return aDefault;
}
}
@@ -10,6 +10,7 @@ internal class Program {

private static bool _Append = false;
private static string _OutputPath = null;
private static string _CPU = null;

private static AsmGenerator _Gen = new AsmGenerator();
// List of source files
@@ -31,16 +32,20 @@ internal class Program {
private static void Run() {
try {
var xUserComments = _Args["UserComments", "UC"];
if (xUserComments != null) _Gen.EmitUserComments = xUserComments.Check("ON", new string[] { "ON", "OFF" }) == "ON";
if (xUserComments != null) _Gen.EmitUserComments = xUserComments.Check("ON", new string[] { "ON", "OFF" }).ToUpper() == "ON";
//
var xSourceCode = _Args["SourceCode", "SC"];
if (xSourceCode != null) _Gen.EmitSourceCode = xSourceCode.Check("ON", new string[] { "ON", "OFF" }) == "ON";
if (xSourceCode != null) _Gen.EmitSourceCode = xSourceCode.Check("ON", new string[] { "ON", "OFF" }).ToUpper() == "ON";
//
var xOutput = _Args["Out", "O"];
if (xOutput != null) _OutputPath = xOutput.Value;
//
_Append = _Args["Append", "A"] != null;
if (_Append && xOutput == null) throw new Exception("Use of -Append requires use of -Out.");
//
var xCPU = _Args["CPU"];
if (xCPU == null) throw new Exception("-CPU is a required parameter.");
_CPU = xCPU.Check("", new string[] { "X86", "ARM" }, true).ToUpper();

// Plugins
var xPlugins = _Args.GetSwitches("PlugIn");
@@ -91,6 +96,7 @@ internal class Program {

#region Gen1
private static void RunGen1() {
if (_CPU != "X86") throw new Exception("Gen1 only supports X86");
try {
// Generate output
foreach (var xFile in _XsFiles) {
@@ -126,6 +132,7 @@ internal class Program {
#endregion

private static void RunGen2() {
if (_CPU != "X86") throw new Exception("ARM is in progress and not supported yet.");
foreach (var xFile in _XsFiles) {
using(var xIn = File.OpenText(xFile)) {
if (!_Append) _OutputPath = Path.ChangeExtension(xFile, ".asm");

0 comments on commit b83f52a

Please sign in to comment.
You can’t perform that action at this time.