Skip to content

Commit

Permalink
Partial ARM provisions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kudzu committed Jun 6, 2019
1 parent 8542b7f commit b83f52a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .vscode/launch.json
Expand Up @@ -13,7 +13,7 @@
"args": [ "args": [
"..\\..\\..\\playground\\", "..\\..\\..\\playground\\",
//"-Plugin:Cosmos.XSC", //"-Plugin:Cosmos.XSC",
"-Gen2", "-WaitOnError" "-Gen2", "-WaitOnError", "-CPU:x86"
], ],
"cwd": "${workspaceFolder}\\source\\XSharp\\XSC", "cwd": "${workspaceFolder}\\source\\XSharp\\XSC",
"stopAtEntry": false, "stopAtEntry": false,
Expand All @@ -29,8 +29,7 @@
"args": [ "args": [
"..\\..\\..\\playground\\", "..\\..\\..\\playground\\",
//"-Plugin:Cosmos.XSC", //"-Plugin:Cosmos.XSC",
"-Gen2", "-Gen2", "-WaitOnError", "-CPU:x86"
"-WaitOnError"
], ],
"cwd": "${workspaceFolder}\\source\\XSharp\\XSC", "cwd": "${workspaceFolder}\\source\\XSharp\\XSC",
"stopAtEntry": false, "stopAtEntry": false,
Expand Down
2 changes: 2 additions & 0 deletions ToDo 2019.txt
Expand Up @@ -13,6 +13,8 @@
-Eliminate G1 -Eliminate G1


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


Expand Down
3 changes: 2 additions & 1 deletion source/Tools/CliProcessor.cs
Expand Up @@ -14,10 +14,11 @@ public class Switch {
public string Name { get; set; } public string Name { get; set; }
public string Value { 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)) { if (aAllowedValues.Contains(Value, aCaseSensitive ? null : StringComparer.OrdinalIgnoreCase)) {
return Value; return Value;
} }
if (aRequired) throw new Exception($"{Name} requires a value.");
return aDefault; return aDefault;
} }
} }
Expand Down
11 changes: 9 additions & 2 deletions source/XSharp/XSC/Program.cs
Expand Up @@ -10,6 +10,7 @@ internal class Program {


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


private static AsmGenerator _Gen = new AsmGenerator(); private static AsmGenerator _Gen = new AsmGenerator();
// List of source files // List of source files
Expand All @@ -31,16 +32,20 @@ internal class Program {
private static void Run() { private static void Run() {
try { try {
var xUserComments = _Args["UserComments", "UC"]; 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"]; 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"]; var xOutput = _Args["Out", "O"];
if (xOutput != null) _OutputPath = xOutput.Value; if (xOutput != null) _OutputPath = xOutput.Value;
// //
_Append = _Args["Append", "A"] != null; _Append = _Args["Append", "A"] != null;
if (_Append && xOutput == null) throw new Exception("Use of -Append requires use of -Out."); 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 // Plugins
var xPlugins = _Args.GetSwitches("PlugIn"); var xPlugins = _Args.GetSwitches("PlugIn");
Expand Down Expand Up @@ -91,6 +96,7 @@ internal class Program {


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


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

0 comments on commit b83f52a

Please sign in to comment.