From 9d70118c68222f118082eac76e5f4295c1d560fc Mon Sep 17 00:00:00 2001 From: PHB Date: Tue, 21 Nov 2017 18:39:09 -0500 Subject: [PATCH] Modify MakeyMakey to support .core projects with workaround for the Visual Studio Custom Tool bug --- BuildTools.sln | 3 + Domainer/domainer/domainer.csproj | 8 - Domainer/xGoedel.Tool.Domainer/Domainer.cs | 2552 ----------------- Domainer/xGoedel.Tool.Domainer/Domainer.gdl | 129 - .../xGoedel.Tool.Domainer/DomainerPlus.cs | 137 - Domainer/xGoedel.Tool.Domainer/Extension.cs | 61 - .../xGoedel.Tool.Domainer/Generate.Script | 343 --- Domainer/xGoedel.Tool.Domainer/Generate.cs | 439 --- Domainer/xGoedel.Tool.Domainer/PHBLogo256.ico | Bin 4149 -> 0 bytes .../xGoedel.Tool.Domainer.csproj | 37 - Exceptional/Exceptional/Exceptional.csproj | 1 + .../Goedel.Tool.Makey/GenerateMakefile.cs | 56 +- .../Goedel.Tool.Makey/GenerateMakefile.script | 59 +- .../Goedel.Tool.Makey.projitems | 2 +- MakeyMakey/Goedel.Tool.Makey/Makefile | 242 -- MakeyMakey/Goedel.Tool.Makey/ParseProject.cs | 92 +- MakeyMakey/Goedel.Tool.Makey/ParseSolution.cs | 26 +- MakeyMakey/Goedel.Tool.Makey/Project.cs | 33 + MakeyMakey/Goedel.Tool.Makey/VS.Make | 35 + MakeyMakey/TestSolution/App.config | 6 + MakeyMakey/TestSolution/BuildProject.csproj | 63 + .../TestSolution/Container2/Container2.csproj | 9 + MakeyMakey/TestSolution/Container2/VS.Make | 38 + .../ContainerStandard.csproj | 9 + .../TestSolution/ContainerStandard/VS.Make | 38 + .../TestSolution/CoreConsole/Command.cs | 437 +++ .../TestSolution/CoreConsole/CommandLex.cs | 174 ++ .../TestSolution/CoreConsole/CommandLex.fsm | 46 + .../CoreConsole/CommandLexPlus.cs | 121 + .../TestSolution/CoreConsole/CommandSplit.cs | 173 ++ .../TestSolution/CoreConsole/CommandSplit.fsm | 68 + .../CoreConsole/CommandSplitLexPlus.cs | 166 ++ .../CoreConsole/CoreConsole.csproj | 50 + .../TestSolution/CoreConsole/Dispatch.cs | 19 + .../TestSolution/CoreConsole/Exceptions.cs | 373 +++ .../CoreConsole/Exceptions.exceptional | 41 + .../TestSolution/CoreConsole/FileTools.cs | 114 + .../TestSolution/CoreConsole}/Main.command | 0 MakeyMakey/TestSolution/CoreConsole/Main.cs | 266 ++ .../TestSolution/CoreConsole/NamespaceDoc.cs | 11 + MakeyMakey/TestSolution/CoreConsole/Parse.md | 15 + MakeyMakey/TestSolution/CoreConsole/Type.cs | 293 ++ MakeyMakey/TestSolution/CoreConsole/VS.Make | 52 + .../TestSolution/FrameworkLibrary/App.config | 6 + .../TestSolution/FrameworkLibrary/Command.cs | 437 +++ .../FrameworkLibrary/CommandLex.cs | 174 ++ .../FrameworkLibrary/CommandLex.fsm | 46 + .../FrameworkLibrary/CommandLexPlus.cs | 121 + .../FrameworkLibrary/CommandSplit.cs | 173 ++ .../FrameworkLibrary/CommandSplit.fsm | 68 + .../FrameworkLibrary/CommandSplitLexPlus.cs | 166 ++ .../TestSolution/FrameworkLibrary/Dispatch.cs | 19 + .../FrameworkLibrary/Exceptions.Exceptional | 41 + .../FrameworkLibrary/Exceptions.cs | 373 +++ .../FrameworkLibrary/FileTools.cs | 114 + .../FrameworkLibrary/FrameworkLibrary.csproj | 95 + .../FrameworkLibrary/Main.command | 20 + .../TestSolution/FrameworkLibrary/Main.cs | 266 ++ .../FrameworkLibrary/NamespaceDoc.cs | 11 + .../TestSolution/FrameworkLibrary/Parse.md | 15 + .../Properties/AssemblyInfo.cs | 36 + .../TestSolution/FrameworkLibrary/Type.cs | 293 ++ .../TestSolution/FrameworkLibrary/VS.Make | 52 + .../TestSolution/Properties/AssemblyInfo.cs | 36 + .../TestSolution/SharedProject/Command.cs | 437 +++ .../TestSolution/SharedProject/CommandLex.cs | 174 ++ .../TestSolution/SharedProject/CommandLex.fsm | 46 + .../SharedProject/CommandLexPlus.cs | 121 + .../SharedProject/CommandSplit.cs | 173 ++ .../SharedProject/CommandSplit.fsm | 68 + .../SharedProject/CommandSplitLexPlus.cs | 166 ++ .../TestSolution/SharedProject/Dispatch.cs | 19 + .../TestSolution/SharedProject/Exceptions.cs | 373 +++ .../SharedProject/Exceptions.exceptional | 41 + .../TestSolution/SharedProject/FileTools.cs | 114 + .../TestSolution/SharedProject/Main.command | 20 + MakeyMakey/TestSolution/SharedProject/Main.cs | 266 ++ .../SharedProject/NamespaceDoc.cs | 11 + .../TestSolution/SharedProject/Parse.md | 15 + .../SharedProject/SharedProject.projitems | 60 + .../SharedProject/SharedProject.shproj | 13 + MakeyMakey/TestSolution/SharedProject/Type.cs | 293 ++ MakeyMakey/TestSolution/SharedProject/VS.Make | 52 + .../TestSolution/StandardLibrary/Command.cs | 437 +++ .../StandardLibrary/CommandLex.cs | 174 ++ .../StandardLibrary/CommandLex.fsm | 46 + .../StandardLibrary/CommandLexPlus.cs | 121 + .../StandardLibrary/CommandSplit.cs | 173 ++ .../StandardLibrary/CommandSplit.fsm | 68 + .../StandardLibrary/CommandSplitLexPlus.cs | 166 ++ .../TestSolution/StandardLibrary/Dispatch.cs | 19 + .../StandardLibrary/Exceptions.cs | 373 +++ .../StandardLibrary/Exceptions.exceptional | 41 + .../TestSolution/StandardLibrary/FileTools.cs | 114 + .../TestSolution/StandardLibrary/Main.command | 20 + .../TestSolution/StandardLibrary/Main.cs | 266 ++ .../StandardLibrary/NamespaceDoc.cs | 11 + .../TestSolution/StandardLibrary/Parse.md | 15 + .../StandardLibrary/StandardLibrary.csproj | 57 + .../TestSolution/StandardLibrary/Type.cs | 293 ++ .../TestSolution/StandardLibrary/VS.Make | 52 + MakeyMakey/TestSolution/TestSolution.sln | 59 + MakeyMakey/TestSolution/VS.Make | 36 + MakeyMakey/makey/Commands.cs | 12 +- MakeyMakey/makey/Dispatch.cs | 27 +- .../makey/Properties/launchSettings.json | 4 +- MakeyMakey/makey/VS.Make | 43 + MakeyMakey/makey/makey.csproj | 8 + MakeyMakey/xGoedel.Tool.Makey/Exceptions.cs | 277 -- .../xGoedel.Tool.Makey/Exceptions.exceptional | 30 - .../xGoedel.Tool.Makey/GenerateMakefile.cs | 477 --- .../GenerateMakefile.script | 441 --- MakeyMakey/xGoedel.Tool.Makey/Makefile | 242 -- .../Microsoft.Build.Core.xsd | 722 ----- .../Microsoft_Build_Core.cs | 1848 ------------ MakeyMakey/xGoedel.Tool.Makey/PHBLogo256.ico | Bin 4149 -> 0 bytes MakeyMakey/xGoedel.Tool.Makey/ParseProject.cs | 511 ---- .../xGoedel.Tool.Makey/ParseSolution.cs | 288 -- MakeyMakey/xGoedel.Tool.Makey/Project.cs | 189 -- MakeyMakey/xGoedel.Tool.Makey/Tokenizer.cs | 219 -- MakeyMakey/xGoedel.Tool.Makey/Tokenizer.fsr | 82 - .../xGoedel.Tool.Makey/TokenizerPlus.cs | 205 -- .../xGoedel.Tool.Makey.csproj | 46 - 123 files changed, 10503 insertions(+), 9570 deletions(-) delete mode 100644 Domainer/xGoedel.Tool.Domainer/Domainer.cs delete mode 100644 Domainer/xGoedel.Tool.Domainer/Domainer.gdl delete mode 100644 Domainer/xGoedel.Tool.Domainer/DomainerPlus.cs delete mode 100644 Domainer/xGoedel.Tool.Domainer/Extension.cs delete mode 100644 Domainer/xGoedel.Tool.Domainer/Generate.Script delete mode 100644 Domainer/xGoedel.Tool.Domainer/Generate.cs delete mode 100644 Domainer/xGoedel.Tool.Domainer/PHBLogo256.ico delete mode 100644 Domainer/xGoedel.Tool.Domainer/xGoedel.Tool.Domainer.csproj delete mode 100644 MakeyMakey/Goedel.Tool.Makey/Makefile create mode 100644 MakeyMakey/Goedel.Tool.Makey/VS.Make create mode 100644 MakeyMakey/TestSolution/App.config create mode 100644 MakeyMakey/TestSolution/BuildProject.csproj create mode 100644 MakeyMakey/TestSolution/Container2/Container2.csproj create mode 100644 MakeyMakey/TestSolution/Container2/VS.Make create mode 100644 MakeyMakey/TestSolution/ContainerStandard/ContainerStandard.csproj create mode 100644 MakeyMakey/TestSolution/ContainerStandard/VS.Make create mode 100644 MakeyMakey/TestSolution/CoreConsole/Command.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/CommandLex.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/CommandLex.fsm create mode 100644 MakeyMakey/TestSolution/CoreConsole/CommandLexPlus.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/CommandSplit.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/CommandSplit.fsm create mode 100644 MakeyMakey/TestSolution/CoreConsole/CommandSplitLexPlus.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/CoreConsole.csproj create mode 100644 MakeyMakey/TestSolution/CoreConsole/Dispatch.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/Exceptions.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/Exceptions.exceptional create mode 100644 MakeyMakey/TestSolution/CoreConsole/FileTools.cs rename {Domainer/domainer => MakeyMakey/TestSolution/CoreConsole}/Main.command (100%) create mode 100644 MakeyMakey/TestSolution/CoreConsole/Main.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/NamespaceDoc.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/Parse.md create mode 100644 MakeyMakey/TestSolution/CoreConsole/Type.cs create mode 100644 MakeyMakey/TestSolution/CoreConsole/VS.Make create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/App.config create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Command.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.fsm create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/CommandLexPlus.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.fsm create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/CommandSplitLexPlus.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Dispatch.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.Exceptional create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/FileTools.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/FrameworkLibrary.csproj create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Main.command create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Main.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/NamespaceDoc.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Parse.md create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Properties/AssemblyInfo.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/Type.cs create mode 100644 MakeyMakey/TestSolution/FrameworkLibrary/VS.Make create mode 100644 MakeyMakey/TestSolution/Properties/AssemblyInfo.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/Command.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/CommandLex.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/CommandLex.fsm create mode 100644 MakeyMakey/TestSolution/SharedProject/CommandLexPlus.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/CommandSplit.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/CommandSplit.fsm create mode 100644 MakeyMakey/TestSolution/SharedProject/CommandSplitLexPlus.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/Dispatch.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/Exceptions.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/Exceptions.exceptional create mode 100644 MakeyMakey/TestSolution/SharedProject/FileTools.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/Main.command create mode 100644 MakeyMakey/TestSolution/SharedProject/Main.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/NamespaceDoc.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/Parse.md create mode 100644 MakeyMakey/TestSolution/SharedProject/SharedProject.projitems create mode 100644 MakeyMakey/TestSolution/SharedProject/SharedProject.shproj create mode 100644 MakeyMakey/TestSolution/SharedProject/Type.cs create mode 100644 MakeyMakey/TestSolution/SharedProject/VS.Make create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Command.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/CommandLex.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/CommandLex.fsm create mode 100644 MakeyMakey/TestSolution/StandardLibrary/CommandLexPlus.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/CommandSplit.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/CommandSplit.fsm create mode 100644 MakeyMakey/TestSolution/StandardLibrary/CommandSplitLexPlus.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Dispatch.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Exceptions.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Exceptions.exceptional create mode 100644 MakeyMakey/TestSolution/StandardLibrary/FileTools.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Main.command create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Main.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/NamespaceDoc.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Parse.md create mode 100644 MakeyMakey/TestSolution/StandardLibrary/StandardLibrary.csproj create mode 100644 MakeyMakey/TestSolution/StandardLibrary/Type.cs create mode 100644 MakeyMakey/TestSolution/StandardLibrary/VS.Make create mode 100644 MakeyMakey/TestSolution/TestSolution.sln create mode 100644 MakeyMakey/TestSolution/VS.Make create mode 100644 MakeyMakey/makey/VS.Make delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Exceptions.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Exceptions.exceptional delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.script delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Makefile delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Microsoft.Build.Core.xsd delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Microsoft_Build_Core.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/PHBLogo256.ico delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/ParseProject.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/ParseSolution.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Project.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Tokenizer.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/Tokenizer.fsr delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/TokenizerPlus.cs delete mode 100644 MakeyMakey/xGoedel.Tool.Makey/xGoedel.Tool.Makey.csproj diff --git a/BuildTools.sln b/BuildTools.sln index a73fa817d..ec0400003 100644 --- a/BuildTools.sln +++ b/BuildTools.sln @@ -117,6 +117,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Goedel.Tool.Script-Framework", "GScript\Goedel.Tool.Script-Framework\Goedel.Tool.Script-Framework.csproj", "{8D243206-A118-4BA4-8BD6-45593818D35D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Goedel.Tool.Makey-Framework", "MakeyMakey\Goedel.Tool.Makey-Framework\Goedel.Tool.Makey-Framework.csproj", "{CA76E3F9-6732-4064-9CF5-FFE87C6015BC}" + ProjectSection(ProjectDependencies) = postProject + {C22AA4A5-F0A0-4CFF-AB4D-7A02F5DFB59E} = {C22AA4A5-F0A0-4CFF-AB4D-7A02F5DFB59E} + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Goedel.Tool.Protogen-Framework", "Protogen\Goedel.Tool.Protogen-Framework\Goedel.Tool.Protogen-Framework.csproj", "{529F25C0-4803-4259-8CFC-F666F0978A1A}" EndProject diff --git a/Domainer/domainer/domainer.csproj b/Domainer/domainer/domainer.csproj index 2ef793065..5262655e2 100644 --- a/Domainer/domainer/domainer.csproj +++ b/Domainer/domainer/domainer.csproj @@ -9,14 +9,6 @@ - - - Main.command - True - True - - - Main.cs diff --git a/Domainer/xGoedel.Tool.Domainer/Domainer.cs b/Domainer/xGoedel.Tool.Domainer/Domainer.cs deleted file mode 100644 index 252f0699d..000000000 --- a/Domainer/xGoedel.Tool.Domainer/Domainer.cs +++ /dev/null @@ -1,2552 +0,0 @@ - -// Copyright (c) Comodo Group Inc. by 2013 -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// -// This file is automatically generated from the following source files: -// Command line options: -// /dlexer=False -// /dparser=False -// /dstack=False - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using Goedel.Registry; -using Goedel.Utilities; - - -// -// Namespace Goedel.Tool.Domainer -// Class Domainer -// - - -// Types -// TopTypeType -// Group -// RR -// Q -// IG -// NA -// TypeType -// Obsolete -// Pseudo -// Experimental -// IPv4 -// IPv6 -// Domain -// Mail -// NodeID -// Byte -// Int16 -// Int32 -// Time32 -// Time48 -// String -// Strings -// OptionalString -// StringX -// Binary -// Binary8 -// Binary16 -// LBinary -// Hex -// Hex8 -// Hex16 -// List -// Alt -// LByte -// LInt16 -// OptionList -// Gateway -// Null -// AltEntry -// IdType -// GroupT -// RRT -// NamespaceType -// Goedel.Tool.Domainer -// ClassType -// Domainer -// NameType -// Id -// Members -// Code -// Description -// Reference -// Entries -// Length -// Target -// Choices -// Reason -// First -// Last -// TokenType -// VarT -// ReasonT - -namespace Goedel.Tool.Domainer { - - - public enum DomainerType { - _Top, - - Group, - RR, - Obsolete, - Pseudo, - Experimental, - IPv4, - IPv6, - Domain, - Mail, - NodeID, - Byte, - Int16, - Int32, - Time32, - Time48, - String, - OptionalString, - Strings, - StringX, - Binary, - Binary8, - Binary16, - LBinary, - LByte, - LInt16, - Hex, - Hex8, - Hex16, - Null, - OptionList, - Gateway, - List, - Alt, - AltEntry, - Q, - IG, - NA, - - _Label, - _Bottom - } - - - public abstract partial class _Choice { - abstract public DomainerType _Tag (); - - public abstract void Serialize (StructureWriter Output, bool tag); - - public virtual void Init (_Choice Parent) { - } - - bool _Initialized = false; - public virtual void _InitChildren (_Choice Parent) { - Init (Parent); - if (_Initialized) { - return; - } - _Initialized = true; - } - } - - - - public partial class Group : _Choice { - public ID<_Choice> Id; - public List > Members = new List> (); - - public override DomainerType _Tag () { - return DomainerType.Group; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Group"); - } - - Output.WriteId ("Id", Id.ToString()); - Output.StartList (""); - foreach (REF<_Choice> _e in Members) { - Output.WriteId ("Members", _e.ToString()); - } - Output.EndList (""); - if (tag) { - Output.EndElement ("Group"); - } - } - } - - public partial class RR : _Choice { - public ID<_Choice> Id; - public int Code; - public string Description; - public string Reference; - public List <_Choice> Entries = new List<_Choice> (); - - public override DomainerType _Tag () { - return DomainerType.RR; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - foreach (var Sub in Entries) { - Sub._InitChildren (this); - } - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("RR"); - } - - Output.WriteId ("Id", Id.ToString()); - Output.WriteAttribute ("Code", Code); - Output.WriteAttribute ("Description", Description); - Output.WriteAttribute ("Reference", Reference); - Output.StartList (""); - foreach (_Choice _e in Entries) { - _e.Serialize (Output, true); - } - Output.EndList (""); - if (tag) { - Output.EndElement ("RR"); - } - } - } - - public partial class Obsolete : _Choice { - - public override DomainerType _Tag () { - return DomainerType.Obsolete; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Obsolete"); - } - - if (tag) { - Output.EndElement ("Obsolete"); - } - } - } - - public partial class Pseudo : _Choice { - - public override DomainerType _Tag () { - return DomainerType.Pseudo; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Pseudo"); - } - - if (tag) { - Output.EndElement ("Pseudo"); - } - } - } - - public partial class Experimental : _Choice { - - public override DomainerType _Tag () { - return DomainerType.Experimental; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Experimental"); - } - - if (tag) { - Output.EndElement ("Experimental"); - } - } - } - - public partial class IPv4 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.IPv4; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("IPv4"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("IPv4"); - } - } - } - - public partial class IPv6 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.IPv6; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("IPv6"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("IPv6"); - } - } - } - - public partial class Domain : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Domain; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Domain"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Domain"); - } - } - } - - public partial class Mail : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Mail; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Mail"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Mail"); - } - } - } - - public partial class NodeID : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.NodeID; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("NodeID"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("NodeID"); - } - } - } - - public partial class Byte : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Byte; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Byte"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Byte"); - } - } - } - - public partial class Int16 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Int16; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Int16"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Int16"); - } - } - } - - public partial class Int32 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Int32; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Int32"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Int32"); - } - } - } - - public partial class Time32 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Time32; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Time32"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Time32"); - } - } - } - - public partial class Time48 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Time48; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Time48"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Time48"); - } - } - } - - public partial class String : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.String; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("String"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("String"); - } - } - } - - public partial class OptionalString : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.OptionalString; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("OptionalString"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("OptionalString"); - } - } - } - - public partial class Strings : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Strings; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Strings"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Strings"); - } - } - } - - public partial class StringX : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.StringX; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("StringX"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("StringX"); - } - } - } - - public partial class Binary : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Binary; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Binary"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Binary"); - } - } - } - - public partial class Binary8 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Binary8; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Binary8"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Binary8"); - } - } - } - - public partial class Binary16 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Binary16; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Binary16"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Binary16"); - } - } - } - - public partial class LBinary : _Choice { - public TOKEN<_Choice> Length; - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.LBinary; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("LBinary"); - } - - Output.WriteId ("Length", Length.ToString()); - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("LBinary"); - } - } - } - - public partial class LByte : _Choice { - public TOKEN<_Choice> Target; - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.LByte; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("LByte"); - } - - Output.WriteId ("Target", Target.ToString()); - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("LByte"); - } - } - } - - public partial class LInt16 : _Choice { - public TOKEN<_Choice> Target; - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.LInt16; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("LInt16"); - } - - Output.WriteId ("Target", Target.ToString()); - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("LInt16"); - } - } - } - - public partial class Hex : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Hex; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Hex"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Hex"); - } - } - } - - public partial class Hex8 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Hex8; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Hex8"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Hex8"); - } - } - } - - public partial class Hex16 : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Hex16; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Hex16"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Hex16"); - } - } - } - - public partial class Null : _Choice { - - public override DomainerType _Tag () { - return DomainerType.Null; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Null"); - } - - if (tag) { - Output.EndElement ("Null"); - } - } - } - - public partial class OptionList : _Choice { - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.OptionList; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("OptionList"); - } - - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("OptionList"); - } - } - } - - public partial class Gateway : _Choice { - public TOKEN<_Choice> Code; - public TOKEN<_Choice> Id; - - public override DomainerType _Tag () { - return DomainerType.Gateway; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Gateway"); - } - - Output.WriteId ("Code", Code.ToString()); - Output.WriteId ("Id", Id.ToString()); - if (tag) { - Output.EndElement ("Gateway"); - } - } - } - - public partial class List : _Choice { - public TOKEN<_Choice> Id; - public List <_Choice> Entries = new List<_Choice> (); - - public override DomainerType _Tag () { - return DomainerType.List; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - foreach (var Sub in Entries) { - Sub._InitChildren (this); - } - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("List"); - } - - Output.WriteId ("Id", Id.ToString()); - Output.StartList (""); - foreach (_Choice _e in Entries) { - _e.Serialize (Output, true); - } - Output.EndList (""); - if (tag) { - Output.EndElement ("List"); - } - } - } - - public partial class Alt : _Choice { - public TOKEN<_Choice> Id; - public List Entries = new List (); - - public override DomainerType _Tag () { - return DomainerType.Alt; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - foreach (var Sub in Entries) { - Sub._InitChildren (this); - } - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Alt"); - } - - Output.WriteId ("Id", Id.ToString()); - Output.StartList (""); - foreach (AltEntry _e in Entries) { - _e.Serialize (Output, true); - } - Output.EndList (""); - if (tag) { - Output.EndElement ("Alt"); - } - } - } - - public partial class AltEntry : _Choice { - public int Code; - public _Choice Choices; - - public override DomainerType _Tag () { - return DomainerType.AltEntry; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - Choices._InitChildren (this); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("AltEntry"); - } - - Output.WriteAttribute ("Code", Code); - Choices.Serialize (Output, true); - if (tag) { - Output.EndElement ("AltEntry"); - } - } - } - - public partial class Q : _Choice { - public ID<_Choice> Id; - public int Code; - public string Description; - public string Reference; - - public override DomainerType _Tag () { - return DomainerType.Q; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("Q"); - } - - Output.WriteId ("Id", Id.ToString()); - Output.WriteAttribute ("Code", Code); - Output.WriteAttribute ("Description", Description); - Output.WriteAttribute ("Reference", Reference); - if (tag) { - Output.EndElement ("Q"); - } - } - } - - public partial class IG : _Choice { - public ID<_Choice> Id; - public int Code; - public string Description; - public string Reference; - - public override DomainerType _Tag () { - return DomainerType.IG; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("IG"); - } - - Output.WriteId ("Id", Id.ToString()); - Output.WriteAttribute ("Code", Code); - Output.WriteAttribute ("Description", Description); - Output.WriteAttribute ("Reference", Reference); - if (tag) { - Output.EndElement ("IG"); - } - } - } - - public partial class NA : _Choice { - public TOKEN<_Choice> Reason; - public int First; - public int Last; - - public override DomainerType _Tag () { - return DomainerType.NA; - } - - public override void _InitChildren (_Choice Parent) { - Init (Parent); - } - - public override void Serialize (StructureWriter Output, bool tag) { - - if (tag) { - Output.StartElement ("NA"); - } - - Output.WriteId ("Reason", Reason.ToString()); - Output.WriteAttribute ("First", First); - Output.WriteAttribute ("Last", Last); - if (tag) { - Output.EndElement ("NA"); - } - } - } - - class _Label : _Choice { - public REF<_Choice> Label; - - // This method is never called. It exists only to prevent a warning when a - // Schema does not contain a ChoiceREF element. - public void Reach() { - Label = null; - } - - public override DomainerType _Tag () { - return DomainerType._Label; - } - - public override void Serialize (StructureWriter Output, bool tag) { - Output.WriteId ("ID", Label.ToString()); - } - } - - - public enum StateCode { - _Start, - _Choice, - _End, - - Group_Start, - Group__Id, - Group__Members, - RR_Start, - RR__Id, - RR__Code, - RR__Description, - RR__Reference, - RR__Entries, - Obsolete_Start, - Pseudo_Start, - Experimental_Start, - IPv4_Start, - IPv4__Id, - IPv6_Start, - IPv6__Id, - Domain_Start, - Domain__Id, - Mail_Start, - Mail__Id, - NodeID_Start, - NodeID__Id, - Byte_Start, - Byte__Id, - Int16_Start, - Int16__Id, - Int32_Start, - Int32__Id, - Time32_Start, - Time32__Id, - Time48_Start, - Time48__Id, - String_Start, - String__Id, - OptionalString_Start, - OptionalString__Id, - Strings_Start, - Strings__Id, - StringX_Start, - StringX__Id, - Binary_Start, - Binary__Id, - Binary8_Start, - Binary8__Id, - Binary16_Start, - Binary16__Id, - LBinary_Start, - LBinary__Length, - LBinary__Id, - LByte_Start, - LByte__Target, - LByte__Id, - LInt16_Start, - LInt16__Target, - LInt16__Id, - Hex_Start, - Hex__Id, - Hex8_Start, - Hex8__Id, - Hex16_Start, - Hex16__Id, - Null_Start, - OptionList_Start, - OptionList__Id, - Gateway_Start, - Gateway__Code, - Gateway__Id, - List_Start, - List__Id, - List__Entries, - Alt_Start, - Alt__Id, - Alt__Entries, - AltEntry_Start, - AltEntry__Code, - AltEntry__Choices, - Q_Start, - Q__Id, - Q__Code, - Q__Description, - Q__Reference, - IG_Start, - IG__Id, - IG__Code, - IG__Description, - IG__Reference, - NA_Start, - NA__Reason, - NA__First, - NA__Last, - } - - - struct _StackItem { - public StateCode State; - public Goedel.Tool.Domainer._Choice Token; - } - - public partial class Domainer : Goedel.Registry.Parser{ - public List Top; - public Registry Registry; - - - - bool _StartOfEntry; - public bool StartOfEntry { - get {return _StartOfEntry;} - private set { _StartOfEntry = value; } - } - - StateCode State; - Goedel.Tool.Domainer._Choice Current; - List <_StackItem> Stack; - - - public static Domainer Parse(string File, Goedel.Registry.Dispatch Options) { - var Result = new Domainer(); - Result.Options = Options; - - using (Stream infile = - new FileStream(File, FileMode.Open, FileAccess.Read)) { - Lexer Schema = new Lexer(File); - Schema.Process(infile, Result); - } - Result._InitChildren (); - - return Result; - } - - bool _Initialized = false; - public virtual void _InitChildren () { - if (_Initialized) { - return; - } - _Initialized = true; - foreach (var Entry in Top) { - Entry._InitChildren (null); - } - } - - public Domainer() { - Top = new List () ; - Registry = new Registry (); - State = StateCode._Start; - Stack = new List <_StackItem> (); - _StartOfEntry = true; - - TYPE__GroupT = Registry.TYPE ("GroupT"); - TYPE__RRT = Registry.TYPE ("RRT"); - TYPE__VarT = Registry.TYPE ("VarT"); - TYPE__ReasonT = Registry.TYPE ("ReasonT"); - - - - } - - - - public TYPE TYPE__GroupT ; - public TYPE TYPE__RRT ; - public TYPE TYPE__VarT ; - public TYPE TYPE__ReasonT ; - - private Goedel.Tool.Domainer._Choice New_Choice(string Label) { - switch (Label) { - - case "Group": return NewGroup(); - case "RR": return NewRR(); - case "Obsolete": return NewObsolete(); - case "Pseudo": return NewPseudo(); - case "Experimental": return NewExperimental(); - case "IPv4": return NewIPv4(); - case "IPv6": return NewIPv6(); - case "Domain": return NewDomain(); - case "Mail": return NewMail(); - case "NodeID": return NewNodeID(); - case "Byte": return NewByte(); - case "Int16": return NewInt16(); - case "Int32": return NewInt32(); - case "Time32": return NewTime32(); - case "Time48": return NewTime48(); - case "String": return NewString(); - case "OptionalString": return NewOptionalString(); - case "Strings": return NewStrings(); - case "StringX": return NewStringX(); - case "Binary": return NewBinary(); - case "Binary8": return NewBinary8(); - case "Binary16": return NewBinary16(); - case "LBinary": return NewLBinary(); - case "LByte": return NewLByte(); - case "LInt16": return NewLInt16(); - case "Hex": return NewHex(); - case "Hex8": return NewHex8(); - case "Hex16": return NewHex16(); - case "Null": return NewNull(); - case "OptionList": return NewOptionList(); - case "Gateway": return NewGateway(); - case "List": return NewList(); - case "Alt": return NewAlt(); - case "AltEntry": return NewAltEntry(); - case "Q": return NewQ(); - case "IG": return NewIG(); - case "NA": return NewNA(); - - } - - throw new NotFoundReserved ("Reserved word not recognized \"" + Label + "\""); - } - - - - private Goedel.Tool.Domainer.Group NewGroup() { - Goedel.Tool.Domainer.Group result = new Goedel.Tool.Domainer.Group(); - Push (result); - State = StateCode.Group_Start; - return result; - } - - - private Goedel.Tool.Domainer.RR NewRR() { - Goedel.Tool.Domainer.RR result = new Goedel.Tool.Domainer.RR(); - Push (result); - State = StateCode.RR_Start; - return result; - } - - - private Goedel.Tool.Domainer.Obsolete NewObsolete() { - Goedel.Tool.Domainer.Obsolete result = new Goedel.Tool.Domainer.Obsolete(); - Push (result); - State = StateCode.Obsolete_Start; - return result; - } - - - private Goedel.Tool.Domainer.Pseudo NewPseudo() { - Goedel.Tool.Domainer.Pseudo result = new Goedel.Tool.Domainer.Pseudo(); - Push (result); - State = StateCode.Pseudo_Start; - return result; - } - - - private Goedel.Tool.Domainer.Experimental NewExperimental() { - Goedel.Tool.Domainer.Experimental result = new Goedel.Tool.Domainer.Experimental(); - Push (result); - State = StateCode.Experimental_Start; - return result; - } - - - private Goedel.Tool.Domainer.IPv4 NewIPv4() { - Goedel.Tool.Domainer.IPv4 result = new Goedel.Tool.Domainer.IPv4(); - Push (result); - State = StateCode.IPv4_Start; - return result; - } - - - private Goedel.Tool.Domainer.IPv6 NewIPv6() { - Goedel.Tool.Domainer.IPv6 result = new Goedel.Tool.Domainer.IPv6(); - Push (result); - State = StateCode.IPv6_Start; - return result; - } - - - private Goedel.Tool.Domainer.Domain NewDomain() { - Goedel.Tool.Domainer.Domain result = new Goedel.Tool.Domainer.Domain(); - Push (result); - State = StateCode.Domain_Start; - return result; - } - - - private Goedel.Tool.Domainer.Mail NewMail() { - Goedel.Tool.Domainer.Mail result = new Goedel.Tool.Domainer.Mail(); - Push (result); - State = StateCode.Mail_Start; - return result; - } - - - private Goedel.Tool.Domainer.NodeID NewNodeID() { - Goedel.Tool.Domainer.NodeID result = new Goedel.Tool.Domainer.NodeID(); - Push (result); - State = StateCode.NodeID_Start; - return result; - } - - - private Goedel.Tool.Domainer.Byte NewByte() { - Goedel.Tool.Domainer.Byte result = new Goedel.Tool.Domainer.Byte(); - Push (result); - State = StateCode.Byte_Start; - return result; - } - - - private Goedel.Tool.Domainer.Int16 NewInt16() { - Goedel.Tool.Domainer.Int16 result = new Goedel.Tool.Domainer.Int16(); - Push (result); - State = StateCode.Int16_Start; - return result; - } - - - private Goedel.Tool.Domainer.Int32 NewInt32() { - Goedel.Tool.Domainer.Int32 result = new Goedel.Tool.Domainer.Int32(); - Push (result); - State = StateCode.Int32_Start; - return result; - } - - - private Goedel.Tool.Domainer.Time32 NewTime32() { - Goedel.Tool.Domainer.Time32 result = new Goedel.Tool.Domainer.Time32(); - Push (result); - State = StateCode.Time32_Start; - return result; - } - - - private Goedel.Tool.Domainer.Time48 NewTime48() { - Goedel.Tool.Domainer.Time48 result = new Goedel.Tool.Domainer.Time48(); - Push (result); - State = StateCode.Time48_Start; - return result; - } - - - private Goedel.Tool.Domainer.String NewString() { - Goedel.Tool.Domainer.String result = new Goedel.Tool.Domainer.String(); - Push (result); - State = StateCode.String_Start; - return result; - } - - - private Goedel.Tool.Domainer.OptionalString NewOptionalString() { - Goedel.Tool.Domainer.OptionalString result = new Goedel.Tool.Domainer.OptionalString(); - Push (result); - State = StateCode.OptionalString_Start; - return result; - } - - - private Goedel.Tool.Domainer.Strings NewStrings() { - Goedel.Tool.Domainer.Strings result = new Goedel.Tool.Domainer.Strings(); - Push (result); - State = StateCode.Strings_Start; - return result; - } - - - private Goedel.Tool.Domainer.StringX NewStringX() { - Goedel.Tool.Domainer.StringX result = new Goedel.Tool.Domainer.StringX(); - Push (result); - State = StateCode.StringX_Start; - return result; - } - - - private Goedel.Tool.Domainer.Binary NewBinary() { - Goedel.Tool.Domainer.Binary result = new Goedel.Tool.Domainer.Binary(); - Push (result); - State = StateCode.Binary_Start; - return result; - } - - - private Goedel.Tool.Domainer.Binary8 NewBinary8() { - Goedel.Tool.Domainer.Binary8 result = new Goedel.Tool.Domainer.Binary8(); - Push (result); - State = StateCode.Binary8_Start; - return result; - } - - - private Goedel.Tool.Domainer.Binary16 NewBinary16() { - Goedel.Tool.Domainer.Binary16 result = new Goedel.Tool.Domainer.Binary16(); - Push (result); - State = StateCode.Binary16_Start; - return result; - } - - - private Goedel.Tool.Domainer.LBinary NewLBinary() { - Goedel.Tool.Domainer.LBinary result = new Goedel.Tool.Domainer.LBinary(); - Push (result); - State = StateCode.LBinary_Start; - return result; - } - - - private Goedel.Tool.Domainer.LByte NewLByte() { - Goedel.Tool.Domainer.LByte result = new Goedel.Tool.Domainer.LByte(); - Push (result); - State = StateCode.LByte_Start; - return result; - } - - - private Goedel.Tool.Domainer.LInt16 NewLInt16() { - Goedel.Tool.Domainer.LInt16 result = new Goedel.Tool.Domainer.LInt16(); - Push (result); - State = StateCode.LInt16_Start; - return result; - } - - - private Goedel.Tool.Domainer.Hex NewHex() { - Goedel.Tool.Domainer.Hex result = new Goedel.Tool.Domainer.Hex(); - Push (result); - State = StateCode.Hex_Start; - return result; - } - - - private Goedel.Tool.Domainer.Hex8 NewHex8() { - Goedel.Tool.Domainer.Hex8 result = new Goedel.Tool.Domainer.Hex8(); - Push (result); - State = StateCode.Hex8_Start; - return result; - } - - - private Goedel.Tool.Domainer.Hex16 NewHex16() { - Goedel.Tool.Domainer.Hex16 result = new Goedel.Tool.Domainer.Hex16(); - Push (result); - State = StateCode.Hex16_Start; - return result; - } - - - private Goedel.Tool.Domainer.Null NewNull() { - Goedel.Tool.Domainer.Null result = new Goedel.Tool.Domainer.Null(); - Push (result); - State = StateCode.Null_Start; - return result; - } - - - private Goedel.Tool.Domainer.OptionList NewOptionList() { - Goedel.Tool.Domainer.OptionList result = new Goedel.Tool.Domainer.OptionList(); - Push (result); - State = StateCode.OptionList_Start; - return result; - } - - - private Goedel.Tool.Domainer.Gateway NewGateway() { - Goedel.Tool.Domainer.Gateway result = new Goedel.Tool.Domainer.Gateway(); - Push (result); - State = StateCode.Gateway_Start; - return result; - } - - - private Goedel.Tool.Domainer.List NewList() { - Goedel.Tool.Domainer.List result = new Goedel.Tool.Domainer.List(); - Push (result); - State = StateCode.List_Start; - return result; - } - - - private Goedel.Tool.Domainer.Alt NewAlt() { - Goedel.Tool.Domainer.Alt result = new Goedel.Tool.Domainer.Alt(); - Push (result); - State = StateCode.Alt_Start; - return result; - } - - - private Goedel.Tool.Domainer.AltEntry NewAltEntry() { - Goedel.Tool.Domainer.AltEntry result = new Goedel.Tool.Domainer.AltEntry(); - Push (result); - State = StateCode.AltEntry_Start; - return result; - } - - - private Goedel.Tool.Domainer.Q NewQ() { - Goedel.Tool.Domainer.Q result = new Goedel.Tool.Domainer.Q(); - Push (result); - State = StateCode.Q_Start; - return result; - } - - - private Goedel.Tool.Domainer.IG NewIG() { - Goedel.Tool.Domainer.IG result = new Goedel.Tool.Domainer.IG(); - Push (result); - State = StateCode.IG_Start; - return result; - } - - - private Goedel.Tool.Domainer.NA NewNA() { - Goedel.Tool.Domainer.NA result = new Goedel.Tool.Domainer.NA(); - Push (result); - State = StateCode.NA_Start; - return result; - } - - - static Goedel.Tool.Domainer.DomainerType _Reserved(string Label) { - switch (Label) { - - case "Group": return Goedel.Tool.Domainer.DomainerType.Group; - case "RR": return Goedel.Tool.Domainer.DomainerType.RR; - case "Obsolete": return Goedel.Tool.Domainer.DomainerType.Obsolete; - case "Pseudo": return Goedel.Tool.Domainer.DomainerType.Pseudo; - case "Experimental": return Goedel.Tool.Domainer.DomainerType.Experimental; - case "IPv4": return Goedel.Tool.Domainer.DomainerType.IPv4; - case "IPv6": return Goedel.Tool.Domainer.DomainerType.IPv6; - case "Domain": return Goedel.Tool.Domainer.DomainerType.Domain; - case "Mail": return Goedel.Tool.Domainer.DomainerType.Mail; - case "NodeID": return Goedel.Tool.Domainer.DomainerType.NodeID; - case "Byte": return Goedel.Tool.Domainer.DomainerType.Byte; - case "Int16": return Goedel.Tool.Domainer.DomainerType.Int16; - case "Int32": return Goedel.Tool.Domainer.DomainerType.Int32; - case "Time32": return Goedel.Tool.Domainer.DomainerType.Time32; - case "Time48": return Goedel.Tool.Domainer.DomainerType.Time48; - case "String": return Goedel.Tool.Domainer.DomainerType.String; - case "OptionalString": return Goedel.Tool.Domainer.DomainerType.OptionalString; - case "Strings": return Goedel.Tool.Domainer.DomainerType.Strings; - case "StringX": return Goedel.Tool.Domainer.DomainerType.StringX; - case "Binary": return Goedel.Tool.Domainer.DomainerType.Binary; - case "Binary8": return Goedel.Tool.Domainer.DomainerType.Binary8; - case "Binary16": return Goedel.Tool.Domainer.DomainerType.Binary16; - case "LBinary": return Goedel.Tool.Domainer.DomainerType.LBinary; - case "LByte": return Goedel.Tool.Domainer.DomainerType.LByte; - case "LInt16": return Goedel.Tool.Domainer.DomainerType.LInt16; - case "Hex": return Goedel.Tool.Domainer.DomainerType.Hex; - case "Hex8": return Goedel.Tool.Domainer.DomainerType.Hex8; - case "Hex16": return Goedel.Tool.Domainer.DomainerType.Hex16; - case "Null": return Goedel.Tool.Domainer.DomainerType.Null; - case "OptionList": return Goedel.Tool.Domainer.DomainerType.OptionList; - case "Gateway": return Goedel.Tool.Domainer.DomainerType.Gateway; - case "List": return Goedel.Tool.Domainer.DomainerType.List; - case "Alt": return Goedel.Tool.Domainer.DomainerType.Alt; - case "AltEntry": return Goedel.Tool.Domainer.DomainerType.AltEntry; - case "Q": return Goedel.Tool.Domainer.DomainerType.Q; - case "IG": return Goedel.Tool.Domainer.DomainerType.IG; - case "NA": return Goedel.Tool.Domainer.DomainerType.NA; - - } - return Goedel.Tool.Domainer.DomainerType._Bottom; - } - - - public void Serialize (TextWriter Output) { - Serialize (Output, OutputFormat.Goedel); - } - - public void Serialize (TextWriter Output, OutputFormat OutputFormat) { - - StructureWriter StructureWriter = StructureWriter.GetStructureWriter (Output, OutputFormat); - StructureWriter.StartDocument (); - foreach (Goedel.Tool.Domainer._Choice Entry in Top) { - Entry.Serialize (StructureWriter, true); - } - StructureWriter.EndDocument (); - } - - - void Push (Goedel.Tool.Domainer._Choice Token) { - _StackItem Item = new _StackItem (); - Item.State = State; - Item.Token = Current; - - Stack.Add (Item); - - //Console.WriteLine ("$$$$PUSH {0}", Current); - - Current = Token; - } - - void Pop () { - Assert.False (Stack.Count == 0, InternalError.Throw); - - _StackItem Item = Stack[Stack.Count -1]; - State = Item.State; - Current = Item.Token; - - Stack.RemoveAt (Stack.Count -1 ) ; - - //Console.WriteLine ("$$$$POP {0}", Current); - } - - - - public override void Process(TokenType Token, Position Position, string Text) { - - if ((Token == TokenType.SEPARATOR) | - (Token == TokenType.NULL) | - (Token == TokenType.COMMENT)) { - return; - } - Assert.False (Token == TokenType.INVALID, InvalidToken.Throw); - - bool Represent = true; - - while (Represent) { - //Console.WriteLine (" {3}: {0} {1} '{2}'", Token, Position, Text, State); - - - Represent = false; - switch (State) { - case StateCode._Start: // BEGIN - if (Token == TokenType.BEGIN) { - State = StateCode._Choice; - break; - } - else { - throw new ExpectedStart (); - } - - case StateCode._Choice: // LABEL Class | END - if (Token == TokenType.LABEL) { - Goedel.Tool.Domainer.DomainerType LabelType = _Reserved (Text); - if (false | - (LabelType == Goedel.Tool.Domainer.DomainerType.Group) | - (LabelType == Goedel.Tool.Domainer.DomainerType.RR) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Q) | - (LabelType == Goedel.Tool.Domainer.DomainerType.IG) | - (LabelType == Goedel.Tool.Domainer.DomainerType.NA)) { - Top.Add(New_Choice(Text)); - } - else { - throw new Expected("Parser Error Expected [Class]"); - } - break; - } - if (Token == TokenType.END) { - State = StateCode._End; - break; - } - else { - throw new ExpectedClass(); - } - - case StateCode._End: { // - - throw new TooManyClose(); - } - - case StateCode.Group_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Group Current_Cast = (Goedel.Tool.Domainer.Group)Current; - Current_Cast.Id = Registry.ID(Position, Text, TYPE__GroupT, Current_Cast); - State = StateCode.Group__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Group__Id: - - if (Token == TokenType.BEGIN) { - State = StateCode.Group__Members; - } - else { - Pop (); - Represent = true; - } - break; - case StateCode.Group__Members: - if (Token == TokenType.END) { - Pop(); - break; - } - - // Parser transition for LIST $$$$$ - - else if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Group Current_Cast = (Goedel.Tool.Domainer.Group)Current; - Current_Cast.Members.Add ( Registry.REF(Position, Text, TYPE__RRT, Current_Cast ) ); - break; - } - - break; - - - case StateCode.RR_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.RR Current_Cast = (Goedel.Tool.Domainer.RR)Current; - Current_Cast.Id = Registry.ID(Position, Text, TYPE__RRT, Current_Cast); - State = StateCode.RR__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.RR__Id: - if (Token == TokenType.INTEGER) { - Goedel.Tool.Domainer.RR Current_Cast = (Goedel.Tool.Domainer.RR)Current; - Current_Cast.Code = Convert.ToInt32(Text); - State = StateCode.RR__Code; - break; - } - throw new Expected("Expected Integer"); - - case StateCode.RR__Code: - if (Token == TokenType.STRING) { - Goedel.Tool.Domainer.RR Current_Cast = (Goedel.Tool.Domainer.RR)Current; - Current_Cast.Description = Text; - State = StateCode.RR__Description; - break; - } - throw new Expected("Expected String"); - - case StateCode.RR__Description: - if (Token == TokenType.STRING) { - Goedel.Tool.Domainer.RR Current_Cast = (Goedel.Tool.Domainer.RR)Current; - Current_Cast.Reference = Text; - State = StateCode.RR__Reference; - break; - } - throw new Expected("Expected String"); - - case StateCode.RR__Reference: - - if (Token == TokenType.BEGIN) { - State = StateCode.RR__Entries; - } - else { - Pop (); - Represent = true; - } - break; - case StateCode.RR__Entries: - if (Token == TokenType.END) { - Pop(); - break; - } - - // Parser transition for LIST $$$$$ - - else if (Token == TokenType.LABEL) { - Goedel.Tool.Domainer.RR Current_Cast = (Goedel.Tool.Domainer.RR)Current; - Goedel.Tool.Domainer.DomainerType LabelType = _Reserved (Text); - if ( false | - (LabelType == Goedel.Tool.Domainer.DomainerType.Obsolete) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Pseudo) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Experimental) | - (LabelType == Goedel.Tool.Domainer.DomainerType.IPv4) | - (LabelType == Goedel.Tool.Domainer.DomainerType.IPv6) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Domain) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Mail) | - (LabelType == Goedel.Tool.Domainer.DomainerType.NodeID) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Byte) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Int16) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Int32) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Time32) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Time48) | - (LabelType == Goedel.Tool.Domainer.DomainerType.String) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Strings) | - (LabelType == Goedel.Tool.Domainer.DomainerType.OptionalString) | - (LabelType == Goedel.Tool.Domainer.DomainerType.StringX) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Binary) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Binary8) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Binary16) | - (LabelType == Goedel.Tool.Domainer.DomainerType.LBinary) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Hex) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Hex8) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Hex16) | - (LabelType == Goedel.Tool.Domainer.DomainerType.List) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Alt) | - (LabelType == Goedel.Tool.Domainer.DomainerType.LByte) | - (LabelType == Goedel.Tool.Domainer.DomainerType.LInt16) | - (LabelType == Goedel.Tool.Domainer.DomainerType.OptionList) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Gateway) ) { - Current_Cast.Entries.Add (New_Choice(Text)); - } - else { - throw new Expected ("Parser Error Expected [Obsolete Pseudo Experimental IPv4 IPv6 Domain Mail NodeID Byte Int16 Int32 Time32 Time48 String Strings OptionalString StringX Binary Binary8 Binary16 LBinary Hex Hex8 Hex16 List Alt LByte LInt16 OptionList Gateway ]"); - } - } - break; - - - case StateCode.Obsolete_Start: - Pop (); - Represent = true; - break; - case StateCode.Pseudo_Start: - Pop (); - Represent = true; - break; - case StateCode.Experimental_Start: - Pop (); - Represent = true; - break; - case StateCode.IPv4_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.IPv4 Current_Cast = (Goedel.Tool.Domainer.IPv4)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.IPv4__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.IPv4__Id: - Pop (); - Represent = true; - break; - case StateCode.IPv6_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.IPv6 Current_Cast = (Goedel.Tool.Domainer.IPv6)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.IPv6__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.IPv6__Id: - Pop (); - Represent = true; - break; - case StateCode.Domain_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Domain Current_Cast = (Goedel.Tool.Domainer.Domain)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Domain__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Domain__Id: - Pop (); - Represent = true; - break; - case StateCode.Mail_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Mail Current_Cast = (Goedel.Tool.Domainer.Mail)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Mail__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Mail__Id: - Pop (); - Represent = true; - break; - case StateCode.NodeID_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.NodeID Current_Cast = (Goedel.Tool.Domainer.NodeID)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.NodeID__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.NodeID__Id: - Pop (); - Represent = true; - break; - case StateCode.Byte_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Byte Current_Cast = (Goedel.Tool.Domainer.Byte)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Byte__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Byte__Id: - Pop (); - Represent = true; - break; - case StateCode.Int16_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Int16 Current_Cast = (Goedel.Tool.Domainer.Int16)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Int16__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Int16__Id: - Pop (); - Represent = true; - break; - case StateCode.Int32_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Int32 Current_Cast = (Goedel.Tool.Domainer.Int32)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Int32__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Int32__Id: - Pop (); - Represent = true; - break; - case StateCode.Time32_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Time32 Current_Cast = (Goedel.Tool.Domainer.Time32)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Time32__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Time32__Id: - Pop (); - Represent = true; - break; - case StateCode.Time48_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Time48 Current_Cast = (Goedel.Tool.Domainer.Time48)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Time48__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Time48__Id: - Pop (); - Represent = true; - break; - case StateCode.String_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.String Current_Cast = (Goedel.Tool.Domainer.String)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.String__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.String__Id: - Pop (); - Represent = true; - break; - case StateCode.OptionalString_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.OptionalString Current_Cast = (Goedel.Tool.Domainer.OptionalString)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.OptionalString__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.OptionalString__Id: - Pop (); - Represent = true; - break; - case StateCode.Strings_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Strings Current_Cast = (Goedel.Tool.Domainer.Strings)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Strings__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Strings__Id: - Pop (); - Represent = true; - break; - case StateCode.StringX_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.StringX Current_Cast = (Goedel.Tool.Domainer.StringX)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.StringX__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.StringX__Id: - Pop (); - Represent = true; - break; - case StateCode.Binary_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Binary Current_Cast = (Goedel.Tool.Domainer.Binary)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Binary__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Binary__Id: - Pop (); - Represent = true; - break; - case StateCode.Binary8_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Binary8 Current_Cast = (Goedel.Tool.Domainer.Binary8)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Binary8__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Binary8__Id: - Pop (); - Represent = true; - break; - case StateCode.Binary16_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Binary16 Current_Cast = (Goedel.Tool.Domainer.Binary16)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Binary16__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Binary16__Id: - Pop (); - Represent = true; - break; - case StateCode.LBinary_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.LBinary Current_Cast = (Goedel.Tool.Domainer.LBinary)Current; - Current_Cast.Length = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.LBinary__Length; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.LBinary__Length: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.LBinary Current_Cast = (Goedel.Tool.Domainer.LBinary)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.LBinary__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.LBinary__Id: - Pop (); - Represent = true; - break; - case StateCode.LByte_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.LByte Current_Cast = (Goedel.Tool.Domainer.LByte)Current; - Current_Cast.Target = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.LByte__Target; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.LByte__Target: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.LByte Current_Cast = (Goedel.Tool.Domainer.LByte)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.LByte__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.LByte__Id: - Pop (); - Represent = true; - break; - case StateCode.LInt16_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.LInt16 Current_Cast = (Goedel.Tool.Domainer.LInt16)Current; - Current_Cast.Target = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.LInt16__Target; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.LInt16__Target: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.LInt16 Current_Cast = (Goedel.Tool.Domainer.LInt16)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.LInt16__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.LInt16__Id: - Pop (); - Represent = true; - break; - case StateCode.Hex_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Hex Current_Cast = (Goedel.Tool.Domainer.Hex)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Hex__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Hex__Id: - Pop (); - Represent = true; - break; - case StateCode.Hex8_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Hex8 Current_Cast = (Goedel.Tool.Domainer.Hex8)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Hex8__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Hex8__Id: - Pop (); - Represent = true; - break; - case StateCode.Hex16_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Hex16 Current_Cast = (Goedel.Tool.Domainer.Hex16)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Hex16__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Hex16__Id: - Pop (); - Represent = true; - break; - case StateCode.Null_Start: - Pop (); - Represent = true; - break; - case StateCode.OptionList_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.OptionList Current_Cast = (Goedel.Tool.Domainer.OptionList)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.OptionList__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.OptionList__Id: - Pop (); - Represent = true; - break; - case StateCode.Gateway_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Gateway Current_Cast = (Goedel.Tool.Domainer.Gateway)Current; - Current_Cast.Code = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Gateway__Code; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Gateway__Code: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Gateway Current_Cast = (Goedel.Tool.Domainer.Gateway)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Gateway__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Gateway__Id: - Pop (); - Represent = true; - break; - case StateCode.List_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.List Current_Cast = (Goedel.Tool.Domainer.List)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.List__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.List__Id: - - if (Token == TokenType.BEGIN) { - State = StateCode.List__Entries; - } - else { - Pop (); - Represent = true; - } - break; - case StateCode.List__Entries: - if (Token == TokenType.END) { - Pop(); - break; - } - - // Parser transition for LIST $$$$$ - - else if (Token == TokenType.LABEL) { - Goedel.Tool.Domainer.List Current_Cast = (Goedel.Tool.Domainer.List)Current; - Goedel.Tool.Domainer.DomainerType LabelType = _Reserved (Text); - if ( false | - (LabelType == Goedel.Tool.Domainer.DomainerType.IPv4) | - (LabelType == Goedel.Tool.Domainer.DomainerType.IPv6) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Domain) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Mail) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Byte) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Int16) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Int32) | - (LabelType == Goedel.Tool.Domainer.DomainerType.String) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Strings) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Binary) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Binary8) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Binary16) | - (LabelType == Goedel.Tool.Domainer.DomainerType.LBinary) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Hex) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Hex8) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Hex16) ) { - Current_Cast.Entries.Add (New_Choice(Text)); - } - else { - throw new Expected ("Parser Error Expected [IPv4 IPv6 Domain Mail Byte Int16 Int32 String Strings Binary Binary8 Binary16 LBinary Hex Hex8 Hex16 ]"); - } - } - break; - - - case StateCode.Alt_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Alt Current_Cast = (Goedel.Tool.Domainer.Alt)Current; - Current_Cast.Id = Registry.TOKEN(Position, Text, TYPE__VarT, Current_Cast); - State = StateCode.Alt__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Alt__Id: - - if (Token == TokenType.BEGIN) { - State = StateCode.Alt__Entries; - } - else { - Pop (); - Represent = true; - } - break; - case StateCode.Alt__Entries: - if (Token == TokenType.END) { - Pop(); - break; - } - - // Parser transition for LIST $$$$$ - - - /// Label - else { - Goedel.Tool.Domainer.Alt Current_Cast = (Goedel.Tool.Domainer.Alt)Current; - Current_Cast.Entries.Add (NewAltEntry ()); - Represent = true; - } - - break; - - - case StateCode.AltEntry_Start: - if (Token == TokenType.INTEGER) { - Goedel.Tool.Domainer.AltEntry Current_Cast = (Goedel.Tool.Domainer.AltEntry)Current; - Current_Cast.Code = Convert.ToInt32(Text); - State = StateCode.AltEntry__Code; - break; - } - throw new Expected("Expected Integer"); - - case StateCode.AltEntry__Code: - if (Token == TokenType.LABEL) { - Goedel.Tool.Domainer.AltEntry Current_Cast = (Goedel.Tool.Domainer.AltEntry)Current; - Goedel.Tool.Domainer.DomainerType LabelType = _Reserved (Text); - if ( false | - (LabelType == Goedel.Tool.Domainer.DomainerType.Null) | - (LabelType == Goedel.Tool.Domainer.DomainerType.IPv4) | - (LabelType == Goedel.Tool.Domainer.DomainerType.IPv6) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Domain) | - (LabelType == Goedel.Tool.Domainer.DomainerType.Mail) ) { - State = StateCode.AltEntry__Choices; - Current_Cast.Choices = New_Choice(Text); - } - else { - throw new Expected ("Parser Error Expected [Null IPv4 IPv6 Domain Mail ]"); - } - break; - } - else throw new Expected("Parser Error Expected [Null IPv4 IPv6 Domain Mail ]"); - - case StateCode.AltEntry__Choices: - Pop (); - Represent = true; - break; - case StateCode.Q_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.Q Current_Cast = (Goedel.Tool.Domainer.Q)Current; - Current_Cast.Id = Registry.ID(Position, Text, TYPE__RRT, Current_Cast); - State = StateCode.Q__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.Q__Id: - if (Token == TokenType.INTEGER) { - Goedel.Tool.Domainer.Q Current_Cast = (Goedel.Tool.Domainer.Q)Current; - Current_Cast.Code = Convert.ToInt32(Text); - State = StateCode.Q__Code; - break; - } - throw new Expected("Expected Integer"); - - case StateCode.Q__Code: - if (Token == TokenType.STRING) { - Goedel.Tool.Domainer.Q Current_Cast = (Goedel.Tool.Domainer.Q)Current; - Current_Cast.Description = Text; - State = StateCode.Q__Description; - break; - } - throw new Expected("Expected String"); - - case StateCode.Q__Description: - if (Token == TokenType.STRING) { - Goedel.Tool.Domainer.Q Current_Cast = (Goedel.Tool.Domainer.Q)Current; - Current_Cast.Reference = Text; - State = StateCode.Q__Reference; - break; - } - throw new Expected("Expected String"); - - case StateCode.Q__Reference: - Pop (); - Represent = true; - break; - case StateCode.IG_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.IG Current_Cast = (Goedel.Tool.Domainer.IG)Current; - Current_Cast.Id = Registry.ID(Position, Text, TYPE__RRT, Current_Cast); - State = StateCode.IG__Id; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.IG__Id: - if (Token == TokenType.INTEGER) { - Goedel.Tool.Domainer.IG Current_Cast = (Goedel.Tool.Domainer.IG)Current; - Current_Cast.Code = Convert.ToInt32(Text); - State = StateCode.IG__Code; - break; - } - throw new Expected("Expected Integer"); - - case StateCode.IG__Code: - if (Token == TokenType.STRING) { - Goedel.Tool.Domainer.IG Current_Cast = (Goedel.Tool.Domainer.IG)Current; - Current_Cast.Description = Text; - State = StateCode.IG__Description; - break; - } - throw new Expected("Expected String"); - - case StateCode.IG__Description: - if (Token == TokenType.STRING) { - Goedel.Tool.Domainer.IG Current_Cast = (Goedel.Tool.Domainer.IG)Current; - Current_Cast.Reference = Text; - State = StateCode.IG__Reference; - break; - } - throw new Expected("Expected String"); - - case StateCode.IG__Reference: - Pop (); - Represent = true; - break; - case StateCode.NA_Start: - if ((Token == TokenType.LABEL) | (Token == TokenType.LITERAL)) { - Goedel.Tool.Domainer.NA Current_Cast = (Goedel.Tool.Domainer.NA)Current; - Current_Cast.Reason = Registry.TOKEN(Position, Text, TYPE__ReasonT, Current_Cast); - State = StateCode.NA__Reason; - break; - } - throw new Expected("Expected LABEL or LITERAL"); - - case StateCode.NA__Reason: - if (Token == TokenType.INTEGER) { - Goedel.Tool.Domainer.NA Current_Cast = (Goedel.Tool.Domainer.NA)Current; - Current_Cast.First = Convert.ToInt32(Text); - State = StateCode.NA__First; - break; - } - throw new Expected("Expected Integer"); - - case StateCode.NA__First: - if (Token == TokenType.INTEGER) { - Goedel.Tool.Domainer.NA Current_Cast = (Goedel.Tool.Domainer.NA)Current; - Current_Cast.Last = Convert.ToInt32(Text); - State = StateCode.NA__Last; - break; - } - throw new Expected("Expected Integer"); - - case StateCode.NA__Last: - Pop (); - Represent = true; - break; - - default: { - throw new UnreachableCode(); - } - } - } - } - } - } - - diff --git a/Domainer/xGoedel.Tool.Domainer/Domainer.gdl b/Domainer/xGoedel.Tool.Domainer/Domainer.gdl deleted file mode 100644 index b3f94fe56..000000000 --- a/Domainer/xGoedel.Tool.Domainer/Domainer.gdl +++ /dev/null @@ -1,129 +0,0 @@ -Copyright "Comodo Group Inc." "2013" MITLicense - -Class Goedel.Tool.Domainer Domainer - TopType Group - Id ID GroupT - Members List REF RRT - - TopType RR - Id ID RRT - Code Integer - Description String - Reference String - Entries List Choice - Obsolete Pseudo Experimental - IPv4 IPv6 Domain Mail NodeID - Byte Int16 Int32 Time32 Time48 - String Strings OptionalString StringX - Binary Binary8 Binary16 LBinary - Hex Hex8 Hex16 - List Alt - LByte LInt16 - OptionList Gateway - - Type Obsolete - Type Pseudo - Type Experimental - - - Type IPv4 - Id Token VarT - Type IPv6 - Id Token VarT - Type Domain - Id Token VarT - Type Mail - Id Token VarT - Type NodeID - Id Token VarT - - - - Type Byte - Id Token VarT - Type Int16 - Id Token VarT - - Type Int32 - Id Token VarT - Type Time32 - Id Token VarT - Type Time48 - Id Token VarT - - Type String - Id Token VarT - Type OptionalString - Id Token VarT - Type Strings - Id Token VarT - Type StringX - Id Token VarT - - Type Binary - Id Token VarT - Type Binary8 - Id Token VarT - Type Binary16 - Id Token VarT - Type LBinary - Length Token VarT - Id Token VarT - Type LByte - Target Token VarT - Id Token VarT - Type LInt16 - Target Token VarT - Id Token VarT - - Type Hex - Id Token VarT - Type Hex8 - Id Token VarT - Type Hex16 - Id Token VarT - - Type Null - - - Type OptionList - Id Token VarT - Type Gateway - Code Token VarT - Id Token VarT - - Type List - Id Token VarT - Entries List Choice - IPv4 IPv6 Domain Mail - Byte Int16 Int32 - String Strings - Binary Binary8 Binary16 LBinary - Hex Hex8 Hex16 - - Type Alt - Id Token VarT - Entries List AltEntry - - Type AltEntry - Code Integer - Choices Choice - Null - IPv4 IPv6 Domain Mail - - TopType Q - Id ID RRT - Code Integer - Description String - Reference String - - TopType IG - Id ID RRT - Code Integer - Description String - Reference String - - TopType NA - Reason Token ReasonT - First Integer - Last Integer diff --git a/Domainer/xGoedel.Tool.Domainer/DomainerPlus.cs b/Domainer/xGoedel.Tool.Domainer/DomainerPlus.cs deleted file mode 100644 index ba20c6815..000000000 --- a/Domainer/xGoedel.Tool.Domainer/DomainerPlus.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Goedel.Tool.Domainer { - - public abstract partial class _Choice { - public virtual string TypeCS { get { return null; } } - public virtual string IdLabel {get {return null; } } - public virtual string Tag { get { return null; } } - public virtual string Buffer { get { return null; } } - } - public partial class IPv4 : _Choice { - public override string TypeCS { get { return "IPAddress"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "IPv4"; }} - } - public partial class IPv6 : _Choice { - public override string TypeCS { get { return "IPAddress"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "IPv6"; }} - } - public partial class Domain : _Choice { - public override string TypeCS { get { return "Domain"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Domain"; }} - } - public partial class Mail : _Choice { - public override string TypeCS { get { return "string"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Mail"; }} - } - public partial class NodeID : _Choice { - public override string TypeCS { get { return "ulong"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "NodeID"; }} - } - public partial class Byte : _Choice { - public override string TypeCS { get { return "byte"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Byte"; }} - } - public partial class Int16 : _Choice { - public override string TypeCS { get { return "ushort"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Int16"; }} - } - public partial class LByte : _Choice { - public override string TypeCS { get { return "byte"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Byte"; }} - } - public partial class LInt16 : _Choice { - public override string TypeCS { get { return "ushort"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Int16"; }} - } - public partial class Int32 : _Choice { - public override string TypeCS { get { return "uint"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Int32"; }} - } - public partial class Time32 : _Choice { - public override string TypeCS { get { return "uint"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Time32"; }} - } - public partial class Time48 : _Choice { - public override string TypeCS { get { return "ulong"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Time48"; }} - } - public partial class String : _Choice { - public override string TypeCS { get { return "string"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "String"; }} - } - public partial class OptionalString : _Choice { - public override string TypeCS { get { return "string"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "OptionalString"; }} - } - public partial class Strings : _Choice { - public override string TypeCS { get { return "List"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Strings"; }} - } - public partial class StringX : _Choice { - public override string TypeCS { get { return "string"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "StringX"; }} - } - public partial class Binary : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Binary"; }} - } - public partial class Binary8 : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Binary8"; }} - } - public partial class Binary16 : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Binary16"; }} - } - public partial class LBinary : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "LBinary"; }} - } - public partial class Hex : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Hex"; }} - } - public partial class Hex8 : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Hex8"; }} - } - public partial class Hex16 : _Choice { - public override string TypeCS { get { return "byte[]"; } } - public override string IdLabel {get {return Id.Label; } } - public override string Tag {get {return "Hex16"; }} - } - public partial class OptionList : _Choice { - public override string TypeCS { get { return "List"; } } - public override string IdLabel {get {return Id.Label; } } - } - public partial class Gateway : _Choice { - public override string TypeCS { get { return "DNSGateway"; } } - public override string IdLabel {get {return Id.Label; } } - } - } diff --git a/Domainer/xGoedel.Tool.Domainer/Extension.cs b/Domainer/xGoedel.Tool.Domainer/Extension.cs deleted file mode 100644 index 6273a171b..000000000 --- a/Domainer/xGoedel.Tool.Domainer/Extension.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Text; -using Goedel.Registry; - -namespace Goedel.Tool.Domainer { - /// - public class Conversion { - public DomainerType Type; - public string Declaration; - - public Conversion(DomainerType Type, string Declaration) { - this.Type = Type; - this.Declaration = Declaration; - } - - // There are faster ways to do this, but this is the most readable - static Conversion Lookup(DomainerType Key, IList Items) { - foreach (Conversion Entry in Items) { - if (Entry.Type == Key) return Entry; - } - return null; - } - } - - public partial class Domainer : Goedel.Registry.Parser { - - public static readonly IList ConversionCS = new ReadOnlyCollection(new[] { - new Conversion (DomainerType.IPv4, "IPAddress"), - new Conversion (DomainerType.IPv6, "IPAddress"), - new Conversion (DomainerType.Domain, "string"), - new Conversion (DomainerType.Mail, "string"), - new Conversion (DomainerType.NodeID, "string"), - new Conversion (DomainerType.Byte, "byte"), - new Conversion (DomainerType.Int16, "ushort"), - new Conversion (DomainerType.Int32, "uint"), - new Conversion (DomainerType.Time32, "uint"), - new Conversion (DomainerType.Time48, "ulong"), - new Conversion (DomainerType.String, "string"), - new Conversion (DomainerType.OptionalString, "string"), - new Conversion (DomainerType.Strings, "string"), - new Conversion (DomainerType.StringX, "string"), - new Conversion (DomainerType.Binary, "byte []"), - new Conversion (DomainerType.Binary8, "byte []"), - new Conversion (DomainerType.Binary16, "byte []"), - new Conversion (DomainerType.LBinary, "byte []"), - new Conversion (DomainerType.Hex, "byte []"), - new Conversion (DomainerType.Hex8, "byte []"), - new Conversion (DomainerType.Hex16, "byte []"), - }); - } - - public abstract partial class _Choice { - public Boolean IsType; - public ID<_Choice> TypeId; - - public Conversion ConversionCS; - } - } diff --git a/Domainer/xGoedel.Tool.Domainer/Generate.Script b/Domainer/xGoedel.Tool.Domainer/Generate.Script deleted file mode 100644 index 57b3ce4e6..000000000 --- a/Domainer/xGoedel.Tool.Domainer/Generate.Script +++ /dev/null @@ -1,343 +0,0 @@ -#script 1.0 -#license MITLicense -#pclass Goedel.Tool.Domainer Generate - -#method GenerateCS Domainer Domainer -using System.Net; -using System.Collections.Generic; -namespace Goedel.Discovery { - - /// DNS management interface class. - public partial class DNS { - // Dictionary of Type names to codes - // - // if (DictionaryType.ContainsKey("RR") { - // int value = dictionary["RR"]; - // } - static Dictionary DictionaryType = new Dictionary () { -#foreach (_Choice Toplevel in Domainer.Top) -#switchcast DomainerType Toplevel -#casecast RR RR - {"#{RR.Id}", #{RR.Code}}, -#casecast Q Q - {"#{Q.Id}", #{Q.Code}}, -#end switchcast -#end foreach - {"*", 255} // End of list * = ALL - } ; - - static Dictionary DictionaryCode = new Dictionary () { -#foreach (_Choice Toplevel in Domainer.Top) -#switchcast DomainerType Toplevel -#casecast RR RR - {#{RR.Code}, "#{RR.Id}"}, -#casecast Q Q - {#{Q.Code}, "#{Q.Id}"}, -#end switchcast -#end foreach - {0, ""} // End of list * = ALL - } ; - - /// Convert RR text code to type code. - /// DNS text code - /// Type code - public static DNSTypeCode TypeCode(string Tag) { - if (Tag != null) { - return (DNSTypeCode) DictionaryType[Tag]; - } - return 0; - } - - /// Convert RR type code to text code. - /// Type code - /// DNS text code - public static string TypeCode(int Code ) { - return DictionaryCode[(ushort)Code]; - } - } - - /// DNT Type codes - public enum DNSTypeCode : ushort { -#foreach (_Choice Toplevel in Domainer.Top) -#switchcast DomainerType Toplevel -#casecast RR RR - /// Resource record #{RR.Id} = #{RR.Code}, #{RR.Description} - #{RR.Id} = #{RR.Code}, -#casecast Q Q - /// Query type #{Q.Id} = #{Q.Code} - #{Q.Id} = #{Q.Code}, // Used in Queries only -#casecast IG IG - /// Deprecated type #{IG.Id} = #{IG.Code} - #{IG.Id} = #{IG.Code}, // Deprecated, NOT IMPLEMENTED -#end switchcast -#end foreach - /// Unknown record type. - Unknown = 0 - } - - // All resource record classes are descended from DNSRR - - public abstract partial class DNSRecord { - - /// The type code - public virtual DNSTypeCode Code => (0); - - /// The type text - public virtual string Label => ("Unknown"); - - /// Description - public virtual string Description=> ("Record is not defined"); - - /// Decode record or query from buffer - /// Input data - /// Parsed record. - public static DNSRecord Decode(DNSBufferIndex Index) { - DNSRecord DNSRecord; - - Domain Domain; - DNSTypeCode RType; - DNSClass RClass; - uint TTL; - int RDLength; - - Domain = Index.ReadDomain (); - RType = (DNSTypeCode)Index.ReadInt16 (); - RClass = (DNSClass)Index.ReadInt16 (); - TTL = Index.ReadInt32 (); - RDLength = Index.ReadInt16 (); - int NextRecord = Index.Pointer + RDLength; - - //Index.ReadL16Data (out RData); - - switch ((int) RType) { -#foreach (_Choice Toplevel in Domainer.Top) -#switchcast DomainerType Toplevel -#casecast RR RR - case (#{RR.Code}) : { - DNSRecord = DNSRecord_#{RR.Id}.Decode (Index, RDLength); - break; - } -#end switchcast -#end foreach - default : { - DNSRecord = DNSRecord_Unknown.Decode (Index, RDLength) ; - break; - } - } - DNSRecord.Domain = Domain; - DNSRecord.RType = RType; - DNSRecord.RClass = RClass; - DNSRecord.TTL = TTL; - Index.Pointer = NextRecord; - - return DNSRecord; - } - - /// Dispatch parser to parse text representation of specific DNS record - /// Record tag - /// Parser - /// Parsed record - public static DNSRecord Parse(string Tag, Parse Parse) { - switch (Tag) { - -#foreach (_Choice Toplevel in Domainer.Top) -#switchcast DomainerType Toplevel -#casecast RR RR - case ("#{RR.Id}") : { - return DNSRecord_#{RR.Id}.Parse (Parse); - } -#end switchcast -#end foreach - - default : { - return null; - } - } - } - - } - - - - -#foreach (_Choice Toplevel in Domainer.Top) -#switchcast DomainerType Toplevel -#casecast RR RR - - /// #{RR.Id} #{RR.Code} #{RR.Description} see #{RR.Reference} - public class DNSRecord_#{RR.Id} : DNSRecord { - -#foreach (_Choice Entry in RR.Entries) -#if (Entry.TypeCS != null) - /// #{Entry.IdLabel} - public #{Entry.TypeCS} #{Entry.IdLabel} ; -#end if -#end foreach - - /// The type code - public override DNSTypeCode Code => (DNSTypeCode.#{RR.Id}); - - /// The type text - public override string Label => ("#{RR.Id}"); - - /// Description - public override string Description => ("#{RR.Description}"); - - - /// Convert to canonical form - /// Canonical form of record data contents - public override string Canonical () { - Canonicalize Canonicalize = new Canonicalize ("#{RR.Id}", Domain); -#foreach (_Choice Entry in RR.Entries) -#if (Entry.Tag != null) - Canonicalize.#{Entry.Tag} (#{Entry.IdLabel}); -#end if -#end foreach - return Canonicalize.Text; - } - - /// Parse record or query from string - /// Input data - /// Parsed record. - public static DNSRecord_#{RR.Id} Parse(Parse Parse) { - DNSRecord_#{RR.Id} NewRecord = new DNSRecord_#{RR.Id} () { -#foreach (_Choice Entry in RR.Entries) -#if (Entry.Tag != null) - #{Entry.IdLabel} = Parse.#{Entry.Tag} (), -#end if -#end foreach - }; - return NewRecord; - } - - /// Convert to wire form - /// Output buffer - /// Canonical form of record data contents - public override void Encode(DNSBufferIndex Index) { - -#foreach (_Choice Entry in RR.Entries) -#switchcast DomainerType Entry -#casecast IPv4 null - Index.WriteIPv4 (#{Entry.IdLabel}); -#casecast IPv6 null - Index.WriteIPv6 (#{Entry.IdLabel}); -#casecast Domain null - Index.WriteDomain (#{Entry.IdLabel}); -#casecast Mail null - Index.WriteMail (#{Entry.IdLabel}); -#casecast NodeID null - Index.WriteInt64 (#{Entry.IdLabel}); -#casecast Byte null - Index.WriteByte (#{Entry.IdLabel}); -#casecast Int16 null - Index.WriteInt16 (#{Entry.IdLabel}); -#casecast Int32 null - Index.WriteInt32 (#{Entry.IdLabel}); -#casecast Time32 null - Index.WriteInt32 (#{Entry.IdLabel}); -#casecast Time48 null - Index.WriteInt48 (#{Entry.IdLabel}); -#casecast String null - Index.WriteString8 (#{Entry.IdLabel}); -#casecast OptionalString null - if (#{Entry.IdLabel} != null) { - Index.WriteString8 (#{Entry.IdLabel}); - } -#casecast Strings null - foreach (string s in #{Entry.IdLabel}) { - Index.WriteString8 (s); - } -#casecast StringX null - Index.WriteString (#{Entry.IdLabel}); -#casecast Binary null - Index.WriteData (#{Entry.IdLabel}); -#casecast Binary8 null - Index.WriteByte ((byte)#{Entry.IdLabel}.Length); - Index.WriteData (#{Entry.IdLabel}); -#casecast Binary16 null - Index.WriteInt16 (#{Entry.IdLabel}.Length); - Index.WriteData (#{Entry.IdLabel}); -#casecast LBinary Cast - Index.Write (#{Cast.Length}); - Index.WriteData (#{Entry.IdLabel}); -#casecast Hex null - Index.WriteData (#{Entry.IdLabel}); -#casecast Hex8 null - Index.WriteByte ((byte)#{Entry.IdLabel}.Length); - Index.WriteData (#{Entry.IdLabel}); -#casecast Hex16 null - Index.WriteInt16 (#{Entry.IdLabel}.Length); - Index.WriteData (#{Entry.IdLabel}); -#casecast OptionList null - foreach (DNSOption opt in #{Entry.IdLabel}) { - Index.WriteInt16 (opt.Code); - Index.WriteInt16 (opt.Data.Length); - Index.WriteData (opt.Data); - } -#casecast Gateway null -#end switchcast - -#end foreach - } - - /// Decode record or query from byte form buffer - /// Input data - /// Maximum amount of data to read - /// Parsed record. - public static DNSRecord_#{RR.Id} Decode (DNSBufferIndex Index, int Length) { - DNSRecord_#{RR.Id} NewRecord = new DNSRecord_#{RR.Id} () { - Start = Index.Start#! -#foreach (_Choice Entry in RR.Entries) -#switchcast DomainerType Entry -#casecast Binary null -, - #{Entry.IdLabel} = Index.ReadData (Index.Remainder(Length))#! -#casecast Binary8 null -, - #{Entry.IdLabel} = Index.ReadData (Index.ReadByte ())#! -#casecast Binary16 null -, - #{Entry.IdLabel} = Index.ReadData (Index.ReadInt16 ())#! -#casecast LBinary LBinary - - // Binary - length specified by #{LBinary.Length}#! -#casecast Hex null -, - #{Entry.IdLabel} = Index.ReadData (Index.Remainder(Length))#! -#casecast Hex8 null -, - #{Entry.IdLabel} = Index.ReadData (Index.ReadByte ())#! -#casecast Hex16 null -, - #{Entry.IdLabel} = Index.ReadData (Index.ReadInt16 ())#! -#casecast Strings null -, - #{Entry.IdLabel} = Index.ReadStrings (Index.Remainder(Length)) #! -#casecast OptionalString null -, - #{Entry.IdLabel} = (Index.Remainder(Length) > 0) ? Index.ReadString () : null#! -#casecast StringX null -, - #{Entry.IdLabel} = Index.ReadString (Index.Remainder(Length))#! -#% break; } default: { -#if (Entry.Tag != null) -, - #{Entry.IdLabel} = Index.Read#{Entry.Tag} ()#! -#end if -#end switchcast -#end foreach - - }; - - return NewRecord; - } - - } -#end switchcast -#end foreach - - } - - -#end method -#end pclass diff --git a/Domainer/xGoedel.Tool.Domainer/Generate.cs b/Domainer/xGoedel.Tool.Domainer/Generate.cs deleted file mode 100644 index cb8b5d81d..000000000 --- a/Domainer/xGoedel.Tool.Domainer/Generate.cs +++ /dev/null @@ -1,439 +0,0 @@ -// Script Syntax Version: 1.0 - -// Unknown by Unknown -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// -using System; -using System.IO; -using System.Collections.Generic; -using Goedel.Registry; -namespace Goedel.Tool.Domainer { - /// A Goedel script. - public partial class Generate : global::Goedel.Registry.Script { - /// Default constructor. - public Generate () : base () { - } - /// Constructor with output stream. - /// The output stream - public Generate (TextWriter Output) : base (Output) { - } - - - - // - // GenerateCS - // - public void GenerateCS (Domainer Domainer) { - _Output.Write ("using System.Net;\n{0}", _Indent); - _Output.Write ("using System.Collections.Generic;\n{0}", _Indent); - _Output.Write ("namespace Goedel.Discovery {{\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// DNS management interface class. \n{0}", _Indent); - _Output.Write (" public partial class DNS {{\n{0}", _Indent); - _Output.Write (" // Dictionary of Type names to codes\n{0}", _Indent); - _Output.Write (" //\n{0}", _Indent); - _Output.Write (" // if (DictionaryType.ContainsKey(\"RR\") {{\n{0}", _Indent); - _Output.Write (" // int value = dictionary[\"RR\"];\n{0}", _Indent); - _Output.Write (" // }}\n{0}", _Indent); - _Output.Write (" static Dictionary DictionaryType = new Dictionary () {{\n{0}", _Indent); - foreach (_Choice Toplevel in Domainer.Top) { - switch (Toplevel._Tag ()) { - case DomainerType.RR: { - RR RR = (RR) Toplevel; - _Output.Write (" {{\"{1}\", {2}}},\n{0}", _Indent, RR.Id, RR.Code); - break; } - case DomainerType.Q: { - Q Q = (Q) Toplevel; - _Output.Write (" {{\"{1}\", {2}}},\n{0}", _Indent, Q.Id, Q.Code); - break; } - } - } - _Output.Write (" {{\"*\", 255}} // End of list * = ALL\n{0}", _Indent); - _Output.Write (" }} ;\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" static Dictionary DictionaryCode = new Dictionary () {{\n{0}", _Indent); - foreach (_Choice Toplevel in Domainer.Top) { - switch (Toplevel._Tag ()) { - case DomainerType.RR: { - RR RR = (RR) Toplevel; - _Output.Write (" {{{1}, \"{2}\"}},\n{0}", _Indent, RR.Code, RR.Id); - break; } - case DomainerType.Q: { - Q Q = (Q) Toplevel; - _Output.Write (" {{{1}, \"{2}\"}},\n{0}", _Indent, Q.Code, Q.Id); - break; } - } - } - _Output.Write (" {{0, \"\"}} // End of list * = ALL\n{0}", _Indent); - _Output.Write (" }} ;\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Convert RR text code to type code.\n{0}", _Indent); - _Output.Write (" /// DNS text code\n{0}", _Indent); - _Output.Write (" /// Type code\n{0}", _Indent); - _Output.Write (" public static DNSTypeCode TypeCode(string Tag) {{\n{0}", _Indent); - _Output.Write (" if (Tag != null) {{\n{0}", _Indent); - _Output.Write (" return (DNSTypeCode) DictionaryType[Tag];\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write (" return 0;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Convert RR type code to text code.\n{0}", _Indent); - _Output.Write (" /// Type code\n{0}", _Indent); - _Output.Write (" /// DNS text code\n{0}", _Indent); - _Output.Write (" public static string TypeCode(int Code ) {{\n{0}", _Indent); - _Output.Write (" return DictionaryCode[(ushort)Code];\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// DNT Type codes\n{0}", _Indent); - _Output.Write (" public enum DNSTypeCode : ushort {{\n{0}", _Indent); - foreach (_Choice Toplevel in Domainer.Top) { - switch (Toplevel._Tag ()) { - case DomainerType.RR: { - RR RR = (RR) Toplevel; - _Output.Write (" /// Resource record {1} = {2}, {3}\n{0}", _Indent, RR.Id, RR.Code, RR.Description); - _Output.Write (" {1} = {2},\n{0}", _Indent, RR.Id, RR.Code); - break; } - case DomainerType.Q: { - Q Q = (Q) Toplevel; - _Output.Write (" /// Query type {1} = {2}\n{0}", _Indent, Q.Id, Q.Code); - _Output.Write (" {1} = {2}, // Used in Queries only\n{0}", _Indent, Q.Id, Q.Code); - break; } - case DomainerType.IG: { - IG IG = (IG) Toplevel; - _Output.Write (" /// Deprecated type {1} = {2}\n{0}", _Indent, IG.Id, IG.Code); - _Output.Write (" {1} = {2}, // Deprecated, NOT IMPLEMENTED\n{0}", _Indent, IG.Id, IG.Code); - break; } - } - } - _Output.Write (" /// Unknown record type.\n{0}", _Indent); - _Output.Write (" Unknown = 0\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" // All resource record classes are descended from DNSRR\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" public abstract partial class DNSRecord {{\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// The type code\n{0}", _Indent); - _Output.Write (" public virtual DNSTypeCode Code => (0);\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// The type text \n{0}", _Indent); - _Output.Write (" public virtual string Label => (\"Unknown\");\n{0}", _Indent); - _Output.Write (" \n{0}", _Indent); - _Output.Write (" /// Description\n{0}", _Indent); - _Output.Write (" public virtual string Description=> (\"Record is not defined\");\n{0}", _Indent); - _Output.Write (" \n{0}", _Indent); - _Output.Write (" /// Decode record or query from buffer \n{0}", _Indent); - _Output.Write (" /// Input data\n{0}", _Indent); - _Output.Write (" /// Parsed record.\n{0}", _Indent); - _Output.Write (" public static DNSRecord Decode(DNSBufferIndex Index) {{\n{0}", _Indent); - _Output.Write (" DNSRecord DNSRecord;\n{0}", _Indent); - _Output.Write (" \n{0}", _Indent); - _Output.Write (" Domain Domain;\n{0}", _Indent); - _Output.Write (" DNSTypeCode RType;\n{0}", _Indent); - _Output.Write (" DNSClass RClass;\n{0}", _Indent); - _Output.Write (" uint TTL;\n{0}", _Indent); - _Output.Write (" int RDLength;\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" Domain = Index.ReadDomain ();\n{0}", _Indent); - _Output.Write (" RType = (DNSTypeCode)Index.ReadInt16 ();\n{0}", _Indent); - _Output.Write (" RClass = (DNSClass)Index.ReadInt16 ();\n{0}", _Indent); - _Output.Write (" TTL = Index.ReadInt32 ();\n{0}", _Indent); - _Output.Write (" RDLength = Index.ReadInt16 ();\n{0}", _Indent); - _Output.Write (" int NextRecord = Index.Pointer + RDLength;\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" //Index.ReadL16Data (out RData);\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" switch ((int) RType) {{\n{0}", _Indent); - foreach (_Choice Toplevel in Domainer.Top) { - switch (Toplevel._Tag ()) { - case DomainerType.RR: { - RR RR = (RR) Toplevel; - _Output.Write (" case ({1}) : {{\n{0}", _Indent, RR.Code); - _Output.Write (" DNSRecord = DNSRecord_{1}.Decode (Index, RDLength);\n{0}", _Indent, RR.Id); - _Output.Write (" break;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - break; } - } - } - _Output.Write (" default : {{\n{0}", _Indent); - _Output.Write (" DNSRecord = DNSRecord_Unknown.Decode (Index, RDLength) ;\n{0}", _Indent); - _Output.Write (" break;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write (" DNSRecord.Domain = Domain;\n{0}", _Indent); - _Output.Write (" DNSRecord.RType = RType;\n{0}", _Indent); - _Output.Write (" DNSRecord.RClass = RClass;\n{0}", _Indent); - _Output.Write (" DNSRecord.TTL = TTL;\n{0}", _Indent); - _Output.Write (" Index.Pointer = NextRecord;\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" return DNSRecord;\n{0}", _Indent); - _Output.Write (" }} \n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Dispatch parser to parse text representation of specific DNS record\n{0}", _Indent); - _Output.Write (" /// Record tag\n{0}", _Indent); - _Output.Write (" /// Parser\n{0}", _Indent); - _Output.Write (" /// Parsed record\n{0}", _Indent); - _Output.Write (" public static DNSRecord Parse(string Tag, Parse Parse) {{\n{0}", _Indent); - _Output.Write (" switch (Tag) {{\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - foreach (_Choice Toplevel in Domainer.Top) { - switch (Toplevel._Tag ()) { - case DomainerType.RR: { - RR RR = (RR) Toplevel; - _Output.Write (" case (\"{1}\") : {{\n{0}", _Indent, RR.Id); - _Output.Write (" return DNSRecord_{1}.Parse (Parse);\n{0}", _Indent, RR.Id); - _Output.Write (" }}\n{0}", _Indent); - break; } - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write (" default : {{\n{0}", _Indent); - _Output.Write (" return null;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - foreach (_Choice Toplevel in Domainer.Top) { - switch (Toplevel._Tag ()) { - case DomainerType.RR: { - RR RR = (RR) Toplevel; - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// {1} {2} {3} see {4}\n{0}", _Indent, RR.Id, RR.Code, RR.Description, RR.Reference); - _Output.Write (" public class DNSRecord_{1} : DNSRecord {{\n{0}", _Indent, RR.Id); - _Output.Write ("\n{0}", _Indent); - foreach (_Choice Entry in RR.Entries) { - if ( (Entry.TypeCS != null) ) { - _Output.Write (" /// {1}\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" public {1} {2} ;\n{0}", _Indent, Entry.TypeCS, Entry.IdLabel); - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// The type code\n{0}", _Indent); - _Output.Write (" public override DNSTypeCode Code => (DNSTypeCode.{1}); \n{0}", _Indent, RR.Id); - _Output.Write (" \n{0}", _Indent); - _Output.Write (" /// The type text\n{0}", _Indent); - _Output.Write (" public override string Label => (\"{1}\");\n{0}", _Indent, RR.Id); - _Output.Write (" \n{0}", _Indent); - _Output.Write (" /// Description \n{0}", _Indent); - _Output.Write (" public override string Description => (\"{1}\");\n{0}", _Indent, RR.Description); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Convert to canonical form\n{0}", _Indent); - _Output.Write (" /// Canonical form of record data contents\n{0}", _Indent); - _Output.Write (" public override string Canonical () {{\n{0}", _Indent); - _Output.Write (" Canonicalize Canonicalize = new Canonicalize (\"{1}\", Domain);\n{0}", _Indent, RR.Id); - foreach (_Choice Entry in RR.Entries) { - if ( (Entry.Tag != null) ) { - _Output.Write (" Canonicalize.{1} ({2});\n{0}", _Indent, Entry.Tag, Entry.IdLabel); - } - } - _Output.Write (" return Canonicalize.Text;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Parse record or query from string \n{0}", _Indent); - _Output.Write (" /// Input data\n{0}", _Indent); - _Output.Write (" /// Parsed record.\n{0}", _Indent); - _Output.Write (" public static DNSRecord_{1} Parse(Parse Parse) {{\n{0}", _Indent, RR.Id); - _Output.Write (" DNSRecord_{1} NewRecord = new DNSRecord_{2} () {{\n{0}", _Indent, RR.Id, RR.Id); - foreach (_Choice Entry in RR.Entries) { - if ( (Entry.Tag != null) ) { - _Output.Write (" {1} = Parse.{2} (),\n{0}", _Indent, Entry.IdLabel, Entry.Tag); - } - } - _Output.Write (" }};\n{0}", _Indent); - _Output.Write (" return NewRecord;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Convert to wire form\n{0}", _Indent); - _Output.Write (" /// Output buffer\n{0}", _Indent); - _Output.Write (" /// Canonical form of record data contents\n{0}", _Indent); - _Output.Write (" public override void Encode(DNSBufferIndex Index) {{\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - foreach (_Choice Entry in RR.Entries) { - switch (Entry._Tag ()) { - case DomainerType.IPv4: { - _Output.Write (" Index.WriteIPv4 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.IPv6: { - _Output.Write (" Index.WriteIPv6 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Domain: { - _Output.Write (" Index.WriteDomain ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Mail: { - _Output.Write (" Index.WriteMail ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.NodeID: { - _Output.Write (" Index.WriteInt64 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Byte: { - _Output.Write (" Index.WriteByte ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Int16: { - _Output.Write (" Index.WriteInt16 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Int32: { - _Output.Write (" Index.WriteInt32 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Time32: { - _Output.Write (" Index.WriteInt32 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Time48: { - _Output.Write (" Index.WriteInt48 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.String: { - _Output.Write (" Index.WriteString8 ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.OptionalString: { - _Output.Write (" if ({1} != null) {{\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteString8 ({1});\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" }}\n{0}", _Indent); - break; } - case DomainerType.Strings: { - _Output.Write (" foreach (string s in {1}) {{\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteString8 (s);\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - break; } - case DomainerType.StringX: { - _Output.Write (" Index.WriteString ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Binary: { - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Binary8: { - _Output.Write (" Index.WriteByte ((byte){1}.Length);\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Binary16: { - _Output.Write (" Index.WriteInt16 ({1}.Length);\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.LBinary: { - LBinary Cast = (LBinary) Entry; - _Output.Write (" Index.Write ({1});\n{0}", _Indent, Cast.Length); - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Hex: { - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Hex8: { - _Output.Write (" Index.WriteByte ((byte){1}.Length);\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.Hex16: { - _Output.Write (" Index.WriteInt16 ({1}.Length);\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteData ({1});\n{0}", _Indent, Entry.IdLabel); - break; } - case DomainerType.OptionList: { - _Output.Write (" foreach (DNSOption opt in {1}) {{\n{0}", _Indent, Entry.IdLabel); - _Output.Write (" Index.WriteInt16 (opt.Code);\n{0}", _Indent); - _Output.Write (" Index.WriteInt16 (opt.Data.Length);\n{0}", _Indent); - _Output.Write (" Index.WriteData (opt.Data);\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - break; } - case DomainerType.Gateway: { - break; } - } - _Output.Write ("\n{0}", _Indent); - } - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" /// Decode record or query from byte form buffer \n{0}", _Indent); - _Output.Write (" /// Input data\n{0}", _Indent); - _Output.Write (" /// Maximum amount of data to read\n{0}", _Indent); - _Output.Write (" /// Parsed record.\n{0}", _Indent); - _Output.Write (" public static DNSRecord_{1} Decode (DNSBufferIndex Index, int Length) {{\n{0}", _Indent, RR.Id); - _Output.Write (" DNSRecord_{1} NewRecord = new DNSRecord_{2} () {{\n{0}", _Indent, RR.Id, RR.Id); - _Output.Write (" Start = Index.Start", _Indent); - foreach (_Choice Entry in RR.Entries) { - switch (Entry._Tag ()) { - case DomainerType.Binary: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadData (Index.Remainder(Length))", _Indent, Entry.IdLabel); - break; } - case DomainerType.Binary8: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadData (Index.ReadByte ())", _Indent, Entry.IdLabel); - break; } - case DomainerType.Binary16: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadData (Index.ReadInt16 ())", _Indent, Entry.IdLabel); - break; } - case DomainerType.LBinary: { - LBinary LBinary = (LBinary) Entry; - _Output.Write ("\n{0}", _Indent); - _Output.Write (" // Binary - length specified by {1}", _Indent, LBinary.Length); - break; } - case DomainerType.Hex: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadData (Index.Remainder(Length))", _Indent, Entry.IdLabel); - break; } - case DomainerType.Hex8: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadData (Index.ReadByte ())", _Indent, Entry.IdLabel); - break; } - case DomainerType.Hex16: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadData (Index.ReadInt16 ())", _Indent, Entry.IdLabel); - break; } - case DomainerType.Strings: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadStrings (Index.Remainder(Length)) ", _Indent, Entry.IdLabel); - break; } - case DomainerType.OptionalString: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = (Index.Remainder(Length) > 0) ? Index.ReadString () : null", _Indent, Entry.IdLabel); - break; } - case DomainerType.StringX: { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.ReadString (Index.Remainder(Length))", _Indent, Entry.IdLabel); - - break; } default: { - if ( (Entry.Tag != null) ) { - _Output.Write (",\n{0}", _Indent); - _Output.Write (" {1} = Index.Read{2} ()", _Indent, Entry.IdLabel, Entry.Tag); - } - break; } - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write (" }};\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" return NewRecord;\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - break; } - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write (" }}\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - } - } - } diff --git a/Domainer/xGoedel.Tool.Domainer/PHBLogo256.ico b/Domainer/xGoedel.Tool.Domainer/PHBLogo256.ico deleted file mode 100644 index 67d73bf31cba7e4b7192b8c46bdb33d10dbe6705..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4149 zcmcgvi9eL>*FQ633CV*b*#=K4vP4lCOeInwSqfwMrHHaLQnHRbdGaVNwqz`+$Qm9? z3mTP7h$35>s76D|zArPs>sEij`+48b=e_5?KXYH_oa-#tb-TpMGeR92p-BVwCcQoE|dzZFtiF6#O&f(BQUd<$jP8|CbJ5!}=RQ+}3HO>d2G26+%g6D&H0p*qP zpH_=^8|_Gvte(=`{wkKPZKXaEk<#3tOg(E>RUdr7>dv#p!s`A~>Sc;`T%{+^a5g{4 zpmx6!)vlhjhm^=q;})z`mR|FHa0A>c*11e^CCy3WGXKKgd0Px|+*mGNq__DS-Qz=*Ts7M0FZ>yp)$c0Xy|X{IG- zN01PBuwOi}OKAoCI5haSHP0$kF)<}Ack=cg&Z=DfZ`HMyyTGmg`_4mroWS8jLx zEXl5s-M5o|uh}DGTY7b~*Q&{#OgZze#Xi6;tgy06?}a_h-|tXxRB z>#m;S1L&JL?)uu^#wI84gLOHM+~POu$u-m^%G!RKH{AYh7fR=6svPgQbzF}BPz0%X zzE;clUER+(k%3nUQCar38km4*eXe}o*z7CFobur%SlDbXQR>Wjs1>vU50KgK9(f|d zxl{){BED()zA91_K}4^jZ?1NVi;FmzbxgkGy!o+G@6w<%(q$2!oRQ;_wxkBDkEB@# zzMrE{Bz?T>shMVde$`V+0CF3JS?$)Kb)bTuTr(Lj>0UtE;&cp6+&@{DY2CY_TYFEV`Cq#ZDd2=luF2y&V?VqtRIQU_3E2~JE4`y)0g$qjq^Wg6za&B{RyJI<4tI2j|vV=BEWe((O6XPvM&Jjc}w)9XvN3N)n7vh04Eh5 z=e?Z*<|^;b8>uk~BI<%zaBR*n%|*+NA0)(7KLo2Z6f%(~WtJTNG?oZMGCsX{Nq`b^ z5-lC=+l^QjMT9{w43H}kPd#`NTQD!Sfc~z}yM_sw^Vh#u%(0$5l8M(rxI&&Ni}m6d zL2%s^wMigB_U{BC4deon|E5$#AkOV8y{mUDRmKO|+IsaPyTcBcJ{3RCeX%;D>-F_d zM74-dOuauRe@_E<-AT>B$8s?stM8sFVrWc^cKyvFke^5Lnfbn~-#}W0sr{6~i!*=+ zI*<0(R=-c%KHiM^&^YPZ-761OQVU7$`d=P~MDPP>PZ|8#gZm>*;%C>@puvXqfsK`w zNb9U&{`5ntAe^fnZ|U^XE0IC*_Nr702atfeRAtl5eflo6itUa$_Dp$)0xf5QaUtF4 ztNsybwHa@Wh#S&*TT8=zB4%lnUi*ya0;m!L<)uQYRd1bL;oSN9V;$ zTiu?X*VSu5#zsRFWEL(5;I5mgq;82gv3UQYN)&Hm{=DeZ1NY@Dww#bzeEd!YjtWAz z@e{3|;m#RaJc{Unb=i7~y{BixRj$c6iU8rtX zvVsI#srx(>v?H*81xqCy+o}f&m1J!w)sCr36gYkxP2qMOi`PBbBZ4F=5qO z09|4*r)fSiHnUEm2j@2F#fS=5WKWbf^&0j1gIdH98ITjEC4{Ya>g;r(S9Em)Q+M(T zT}(P+V50P3FNx(3zKX#Huzf8&4tH&d*&j#MgWUSV$jDF6ikS-z;a#&)pW&my7Z>o? z1_TB|U5eUH_~L~o-^L#l4^o1yWtaeX;)%&2jg`~Ear8|?Ct=!iSpV!-!ySX>8OiIz zt*So5Z17=0%-0L0iRl>3sO_~yhD=8&T#EULt)@EXS5^~{r{vDP&Vgah-GXww(~L=x z!D!zqvwFktZB(XDvI*s`nF0+D&3t6v&xM=>_Skp@jy&RLQH~$wX3ZqZNUl~mE(C1V z&D2O+YpI$*8CWewqljhBFk|+{2`))NlSojXfx19_4b)t+n*`v8R;2!`V z>dI`SsagZvx!%cBfX6W&(*tmVnT^jiv*nIb>u%WNN5!I87ZAw#Art~z+y67Ko}tTiy5r_g_N4~Ey56vFJ59#)8vn;PZy%h-gqu)*m2#XsNO+1e*6UA5610k zR8&ANQE^qn(+Ie=Rp+!(VOf|}JRNMo^Fcs%eX9bRr!OCoE{_8}0wbgH9P}B%bQ&wC zA;L)k=)zI+W7QE^^dm?eP1-PzjP2hGTQmRIMbW{Hx_Za>+0Cw6l7b+MzwS@09ht(z@Vpe+cb}79!DiSlPKy*Gpp)RAwA@^q z!Z8~n3>awSl%a#NxJ3&OnZ0t2JF^D|i=fXE*xc3Bh+W{n0^B>VwU;4ZtCId|{>GKBV={3^r1oItw-CygHOK+`nu_LC%F1rg3X{kp%(1%<{< zL(K-bNdwy?PF3VBk{ieP4$LUaQ*i}C2-4D2rzPEb8K1f0s~zU9Ka>dxljG5Zv%F3dr+wRo(^>6ldU68149|^rCHjP-}RQQ zaJeEt_O(@R$x>H?VpY(YxmqO#cu^WX#V%}L;GWLdcX0L=tCn*D2Sec2z`6*T12+hF zzJ83$F2GD@W%C-i;HC$HI${ru#=@EwGaZv5@&ET$v3psr3xngs|fFv#^@mRbHj* zQb>oVoZeZL$9hS3$)Zx~$8FTS(9!$RCqUF8X=-o?hvs#yhhi9=7Hg3bF?mB>5!fmm5-7ZXze&{Z(dEvEDPhh3Bsy$ zg9i)a?`7=J83^zLXp8iM8Pep^p5J`-j)-8Zwit_L3uqS&m9N}dW8;W%k*<@!dLHms zhql8xGNq(9s(L8l0MrSiP47M5w=d>LZ@xwez(}x$j~sqi@wztI`3d!PaeuC&vm!>u z^OI-pv)cU@!k-r1dtuI>d^L3oHChQ{JsJ%Moyzd@SRKJ5aoP{{Zi*;6mHX@=j&6*_ z1HSyksiSJkd@0(AkR;4cniFpAasvbKQJ6e3`w3&CIWFl_I=>}@-M=qO%Ho(!&9?V< z@BckITH?oVC5Z3|MI?So8Ixud!maV+ZrE$F0whmp%JN9q0LvjEL5Zdw9yVY&q6|NU zX<^)ltytrRE?+*ZNqW4n9OqF%TKXBoWr?f6l&7H+`}g2Vk9PCok{C7vkNS=yjD*+- zY`_SHm#1Tdnz+k*6Uk5Hcw4%0=dlGQ_u;gEK3~>byauR4elHZcm^SDj5RHvp%QL!- zihr5q6QD7Tl?l&y7@IZ+1%_qziOX#x@{i!w^V%m5b$uOOzoH;vr`VBgrtgcJe_8zo z#FqK|9i`dj)5e&7Z3UWFZkz3;QQ?l?fp3Ra%bZ+}C&`cXD~3savgVL;=_&JCzeUt8 zIfd|+Q^E(BZ6P|PI<~E!?_G?&AfUR^wlJsC9yOlR-MpsI67L)B!oERnwkLKsc1h6G zqVm^1aao+JcJMXxVV5R|syk%`t`|(c(RgH2R%_tH4H-QmJipU{G$*0|^QR#YmH)SQ z77eby{)b3C;mJ>1ZO?Z@{lIk4ZbR1+<;#?#4{|cz>% diff --git a/Domainer/xGoedel.Tool.Domainer/xGoedel.Tool.Domainer.csproj b/Domainer/xGoedel.Tool.Domainer/xGoedel.Tool.Domainer.csproj deleted file mode 100644 index 56abb7637..000000000 --- a/Domainer/xGoedel.Tool.Domainer/xGoedel.Tool.Domainer.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - netstandard2.0 - PHBLogo256.ico - - - - - - - - - - Domainer.gdl - True - True - - - Generate.Script - True - True - - - - - - Domainer.cs - Goedel3 - - - Generate.cs - gscript - - - - diff --git a/Exceptional/Exceptional/Exceptional.csproj b/Exceptional/Exceptional/Exceptional.csproj index b7d834259..55813fb5f 100644 --- a/Exceptional/Exceptional/Exceptional.csproj +++ b/Exceptional/Exceptional/Exceptional.csproj @@ -4,6 +4,7 @@ Exe netcoreapp2.0 PHBLogo256.ico + exceptional diff --git a/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.cs b/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.cs index 0bf4c01c4..034ba3924 100644 --- a/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.cs +++ b/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.cs @@ -1,6 +1,6 @@ // Script Syntax Version: 1.0 -// Unknown by Unknown +// Copyright © 2016 by // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -31,6 +31,7 @@ public partial class Generate : global::Goedel.Registry.Script { public Generate (TextWriter Output) : base (Output) {} string Prefix = "! "; //"\t"; + // // Preamble @@ -149,6 +150,11 @@ public void GenerateVSMakefile (VSProject Project) { _Output.Write ("# * Postprocess VSIX projects\n{0}", _Indent); _Output.Write ("# * Copy executables\n{0}", _Indent); _Output.Write ("\n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); + _Output.Write (".PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse\n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); + _Output.Write ("MSBuildThisFileDirectory = \n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); _Output.Write ("LinkFiles = ", _Indent); foreach (var File in Project.FixedLinkDependency) { _Output.Write ("\\\n{0}", _Indent); @@ -160,16 +166,50 @@ public void GenerateVSMakefile (VSProject Project) { } _Output.Write ("\n{0}", _Indent); _Output.Write ("\n{0}", _Indent); - _Output.Write ("prebuild : \n{0}", _Indent); - _Output.Write (" echo \"Do Prebuild\"\n{0}", _Indent); + _Output.Write ("ToolTargets = ", _Indent); + foreach (var File in Project.None) { + if ( (File.BuildTool) ) { + _Output.Write ("\\\n{0}", _Indent); + _Output.Write (" {1}", _Indent, File.BuildTarget); + } + } _Output.Write ("\n{0}", _Indent); - _Output.Write ("postbuild : \n{0}", _Indent); - if ( (Project.IsExe) ) { - _Output.Write (" powershell publishtarget {1} $(LinkFiles) \n{0}", _Indent, Project.Target); - } else if ( (Project.IsLibrary)) { - _Output.Write (" powershell publishtarget {1}\n{0}", _Indent, Project.Target); + _Output.Write ("\n{0}", _Indent); + foreach (var File in Project.None) { + if ( (File.BuildTool) ) { + _Output.Write ("{1} : {2}\n{0}", _Indent, File.BuildSource, File.BuildTarget); + _Output.Write (" {1} {2} {3}\n{0}", _Indent, File.BuildCommand, File.BuildSource, File.BuildTarget); + _Output.Write ("\n{0}", _Indent); + } } _Output.Write ("\n{0}", _Indent); + _Output.Write ("prebuildRecurse : ", _Indent); + if ( (Project.ProjectType != ProjectType.shared) ) { + foreach (var SharedProject in Project.SharedProject) { + _Output.Write ("\\\n{0}", _Indent); + _Output.Write (" cd {1} && nmake /c /f VS.make prebuild ", _Indent, SharedProject.Directory); + } + } + _Output.Write ("\n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); + _Output.Write ("postbuildRecurse : ", _Indent); + if ( (Project.ProjectType != ProjectType.shared) ) { + foreach (var SharedProject in Project.SharedProject) { + _Output.Write ("\\\n{0}", _Indent); + _Output.Write (" cd {1} && nmake /c /f VS.make postbuild ", _Indent, SharedProject.Directory); + } + } + _Output.Write ("\n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); + _Output.Write ("prebuild : prebuildRecurse $(ToolTargets)\n{0}", _Indent); + _Output.Write (" echo Completed prebuild $(MAKEDIR)\n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); + _Output.Write ("postbuild : postbuildRecurse\n{0}", _Indent); + _Output.Write (" echo Completed postbuild $(MAKEDIR)\n{0}", _Indent); + _Output.Write ("\n{0}", _Indent); + // + // powershell publishtarget #{Project.Target} $(LinkFiles) + // powershell publishtarget #{Project.Target} _Output.Write ("\n{0}", _Indent); } diff --git a/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.script b/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.script index 099392030..22842a311 100644 --- a/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.script +++ b/MakeyMakey/Goedel.Tool.Makey/GenerateMakefile.script @@ -3,7 +3,7 @@ #xclass Goedel.Tool.Makey Generate #% public Generate (TextWriter Output) : base (Output) {} #% string Prefix = "! "; //"\t"; - +#% #method Preamble VSFile VSFile ## This file is generated automatically from the Visual Studio Project @@ -115,6 +115,11 @@ export BUNDLE ?= mkbundle -L /usr/lib/mono/4.7-api --deps --static -o ## * Postprocess VSIX projects ## * Copy executables + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + LinkFiles = #! #foreach (var File in Project.FixedLinkDependency) \ @@ -126,16 +131,54 @@ LinkFiles = #! #end foreach -prebuild : - echo "Do Prebuild" +ToolTargets = #! +#foreach (var File in Project.None) +#if (File.BuildTool) +\ + #{File.BuildTarget}#! +#end if +#end foreach + + +#foreach (var File in Project.None) +#if (File.BuildTool) +#{File.BuildSource} : #{File.BuildTarget} + #{File.BuildCommand} #{File.BuildSource} #{File.BuildTarget} -postbuild : -#if (Project.IsExe) - powershell publishtarget #{Project.Target} $(LinkFiles) -#elseif (Project.IsLibrary) - powershell publishtarget #{Project.Target} #end if +#end foreach + +prebuildRecurse : #! +#if (Project.ProjectType != ProjectType.shared) +#foreach (var SharedProject in Project.SharedProject) +\ + cd #{SharedProject.Directory} && nmake /c /f VS.make prebuild #! +#end foreach +#end if + + +postbuildRecurse : #! +#if (Project.ProjectType != ProjectType.shared) +#foreach (var SharedProject in Project.SharedProject) +\ + cd #{SharedProject.Directory} && nmake /c /f VS.make postbuild #! +#end foreach +#end if + + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) +#! +#!postbuild : +#!#if (Project.IsExe) +#! powershell publishtarget #{Project.Target} $(LinkFiles) +#!#elseif (Project.IsLibrary) +#! powershell publishtarget #{Project.Target} +#!#end if #end method diff --git a/MakeyMakey/Goedel.Tool.Makey/Goedel.Tool.Makey.projitems b/MakeyMakey/Goedel.Tool.Makey/Goedel.Tool.Makey.projitems index 3679e66f3..bcab157b8 100644 --- a/MakeyMakey/Goedel.Tool.Makey/Goedel.Tool.Makey.projitems +++ b/MakeyMakey/Goedel.Tool.Makey/Goedel.Tool.Makey.projitems @@ -39,12 +39,12 @@ GenerateMakefile.cs GScript - Tokenizer.cs fsrcs + \ No newline at end of file diff --git a/MakeyMakey/Goedel.Tool.Makey/Makefile b/MakeyMakey/Goedel.Tool.Makey/Makefile deleted file mode 100644 index fadb43921..000000000 --- a/MakeyMakey/Goedel.Tool.Makey/Makefile +++ /dev/null @@ -1,242 +0,0 @@ -# -# Makefile for Visual Studio Project Goedel.Tool.Makey -# -# This file is generated automatically from the Visual Studio Project -# File. If you make changes to this file and do not update the project -# file, changes will be lost when the file is regenerated. - -# NB: This process will fail if any of the paths have spaces in them -# While it is possible to work around the lack of support for spaces in -# file paths in gmake, it is not possible to do this reliably in the tools -# that it invokes to build the system. Rather than do half a job, it seems -# safest to simply reject the corner case - - -# The following targets are defined (well planned) -# -# make Compile for the current platform -# make cross Compile for all platforms -# make install Compile and install -# make clean Delete all target and intermediate files - -# The following build flags are supported -# -# make mode= release | debug Build release or debug version -# make arch= this | all | Bundle for the current platform, all platforms -# or the specified platform - -# Define the default target directories (referenced projects must all follow same scheme) -# -# By default, we arrange the mono targets as follows: -# -# The source code directory -# /mono/ Equivalent to VS bin directory -# /mono/Debug Equivalent to VS bin/Debug directory -# /mono/Release Equivalent to VS bin/Debug directory -# -# If the target is an executable, the following directories are also created: -# -# /This The bundled executable for the platform the code was compiled on -# / The bundled executable for the platform -# -# If the install target is selected, the bundles will be installed in -# -# ~/Tools/This The bundled executable for platform the code is built on -# ~/Tools/ The bundled executable for this platform - -export TARGETROOT ?= mono -export MODE ?= Release -export ARCH ?= This -export Packages ?= $(HOME)/Packages -export PackagesPath ?= /lib/net40 -export Libraries ?= $(HOME)/Libraries -export LibrariesPath ?= /Mono - - -export TARGETBIN = $(TARGETROOT)/$(MODE) -export TARGETEXE = $(TARGETROOT)/$(ARCH) -export LIBRARYBIN = $(Libraries)$(LibrariesPath) - -export DESTDIR ?= $(HOME)/.local -export bindir ?= /bin -export libdir ?= /lib -export INSTALL_PROGRAM ?= $(DESTDIR)$(bindir) -export INSTALL_DATA ?= $(DESTDIR)$(libdir) - -# Define the default compilers, linkers, packagers, etc. -export CSHARPDLL ?= mcs /target:library -export CSHARPEXE ?= mcs /target:exe -export BUNDLE ?= mkbundle --deps --static -o - - - -# The following tools are used in the goedel build system itself: -export Custom_RFC2TXT ?= rfctool /in -export Custom_RFC2TXT_FLAG ?= /txt -export Custom_RFC2XML ?= rfctool /in -export Custom_RFC2XML_FLAG ?= /xml -export Custom_RFC2MD ?= rfctool /in -export Custom_RFC2MD_FLAG ?= /md -export Custom_RFC2HTML ?= rfctool /in -export Custom_RFC2HTML_FLAG ?= /html -export Custom_CommandCS ?= commandparse /in -export Custom_CommandCS_FLAG ?= /cs -export Custom_FSRCS ?= fsrgen /in -export Custom_FSRCS_FLAG ?= /cs -export Custom_Exceptional ?= exceptional /in -export Custom_Exceptional_FLAG ?= /cs -export Custom_GScript ?= gscript /in -export Custom_GScript_FLAG ?= /cs -export Custom_Goedel3 ?= goedel3 /in -export Custom_Goedel3_FLAG ?= /cs -export Custom_ASN2CS ?= asn2 /in -export Custom_ASN2CS_FLAG ?= /cs -export Custom_DomainerCS ?= domainer /in -export Custom_DomainerCS_FLAG ?= /cs -export Custom_RegistryCS ?= registryconfig /in -export Custom_RegistryCS_FLAG ?= /cs -export Custom_VSIXBuild ?= vsixbuild /in -export Custom_VSIXBuild_FLAG ?= /cs -export Custom_ProtoGen ?= protogen /in -export Custom_ProtoGen_FLAG ?= /cs -export Custom_TrojanGTK ?= trojan /gtk -export Custom_TrojanGTK_FLAG ?= /cs - -# Use the specified character as the prefix character. Note this may not -# be supported on versions of make other than gmake. -.RECIPEPREFIX = ! - -# The main target - -SourceFiles = \ - Exceptions.cs\ - Microsoft_Build_Core.cs\ - ParseProject.cs\ - GenerateMakefile.cs\ - ParseSolution.cs\ - Project.cs\ - Properties/AssemblyInfo.cs\ - Tokenizer.cs\ - TokenizerPlus.cs - -LinkFiles = \ - $(TARGETBIN)/Goedel.FSR.dll\ - $(TARGETBIN)/Goedel.Registry.dll\ - $(TARGETBIN)/Goedel.Utilities.dll - -LinkFilesComma = $(TARGETBIN)/Goedel.FSR.dll,$(TARGETBIN)/Goedel.Registry.dll,$(TARGETBIN)/Goedel.Utilities.dll - - -NugetFiles = -NugetFilesComa = - -# A) Main target packaged - -$(TARGETBIN)/Goedel.Tool.Makey.dll :| $(LIBRARYBIN) -$(TARGETBIN)/Goedel.Tool.Makey.dll :| $(TARGETBIN) - -$(TARGETBIN)/Goedel.Tool.Makey.dll : $(SourceFiles) $(LinkFiles) $(NugetFiles) -! $(CSHARPDLL) /out:$@ $(SourceFiles) -reference:$(LinkFilesComma) -! cp $(TARGETBIN)/Goedel.Tool.Makey.dll $(LIBRARYBIN)/Goedel.Tool.Makey.dll - - -# Directories etc. - -$(INSTALL_PROGRAM) : -! mkdir -p $(INSTALL_PROGRAM) - -$(INSTALL_DATA) : -! mkdir -p $(INSTALL_DATA) - -$(TARGETBIN) : -! mkdir -p $(TARGETBIN) - -$(TARGETEXE) : -! mkdir -p $(TARGETEXE) - -$(LIBRARYBIN) : -! mkdir -p $(LIBRARYBIN) - -# Generated code - -ifdef PHB_BUILD - -Exceptions.cs : Exceptions.exceptional -! $(Custom_exceptional) Exceptions.exceptional $(Custom_exceptional_FLAG) Exceptions.cs -GenerateMakefile.cs : GenerateMakefile.script -! $(Custom_GScript) GenerateMakefile.script $(Custom_GScript_FLAG) GenerateMakefile.cs -Tokenizer.cs : Tokenizer.fsr -! $(Custom_fsrcs) Tokenizer.fsr $(Custom_fsrcs_FLAG) Tokenizer.cs - -endif - -.PHONY : clean install publish debian rpm - - -# Referenced projects -# - -# Recursive make targets, do not execute if the variable NORECURSE is defined -ifndef NORECURSE - -../../Libraries/Goedel.FSR/$(TARGETBIN)/Goedel.FSR.dll : recursive -! $(MAKE) -C ../../Libraries/Goedel.FSR - -../../Libraries/Goedel.Registry/$(TARGETBIN)/Goedel.Registry.dll : recursive -! $(MAKE) -C ../../Libraries/Goedel.Registry - -../../Libraries/Goedel.Utilities/$(TARGETBIN)/Goedel.Utilities.dll : recursive -! $(MAKE) -C ../../Libraries/Goedel.Utilities - -endif - -$(TARGETBIN)/Goedel.FSR.dll :| $(TARGETBIN) -$(TARGETBIN)/Goedel.FSR.dll : ../../Libraries/Goedel.FSR/$(TARGETBIN)/Goedel.FSR.dll -! cp ../../Libraries/Goedel.FSR/$(TARGETBIN)/Goedel.FSR.dll $(TARGETBIN)/Goedel.FSR.dll - -$(TARGETBIN)/Goedel.Registry.dll :| $(TARGETBIN) -$(TARGETBIN)/Goedel.Registry.dll : ../../Libraries/Goedel.Registry/$(TARGETBIN)/Goedel.Registry.dll -! cp ../../Libraries/Goedel.Registry/$(TARGETBIN)/Goedel.Registry.dll $(TARGETBIN)/Goedel.Registry.dll - -$(TARGETBIN)/Goedel.Utilities.dll :| $(TARGETBIN) -$(TARGETBIN)/Goedel.Utilities.dll : ../../Libraries/Goedel.Utilities/$(TARGETBIN)/Goedel.Utilities.dll -! cp ../../Libraries/Goedel.Utilities/$(TARGETBIN)/Goedel.Utilities.dll $(TARGETBIN)/Goedel.Utilities.dll - - -# Referenced Libraries -# - - -# Clean up -# -# At the moment we only delete the currently indicated target. This allows a -# developer to do a make clean / make when a problem with a corrupted intermediate -# file is suspected. - -clean : -! rm -f $(TARGETBIN)/* -! rm -f $(TARGETEXE)/* - -# Install -# -# Install files to a tools directory. Default is ~/.local/bin - - -install : $(INSTALL_DATA)/Goedel.Tool.Makey.dll - -$(INSTALL_DATA)/Goedel.Tool.Makey.dll :| $(INSTALL_DATA) -$(INSTALL_DATA)/Goedel.Tool.Makey.dll : $(TARGETBIN)/Goedel.Tool.Makey.dll -! cp $^ $@ - - - - -# To Do List -# -# 1) Redo install target -# Create a wrapper script and library -# 2) Create a Debian target -# 3) Create a RPM target -# 4) Create a nuget target - - diff --git a/MakeyMakey/Goedel.Tool.Makey/ParseProject.cs b/MakeyMakey/Goedel.Tool.Makey/ParseProject.cs index 79b3cf911..0092e086e 100644 --- a/MakeyMakey/Goedel.Tool.Makey/ParseProject.cs +++ b/MakeyMakey/Goedel.Tool.Makey/ParseProject.cs @@ -123,6 +123,7 @@ public class VSProject : VSFile { public List Compile { get; set; } = new List(); public List None { get; set; } = new List(); public List ProjectReference { get; set; } = new List(); + public List ImportList { get; set; } = new List(); public string CompileAll = ""; public string LinkAll = ""; @@ -131,8 +132,11 @@ public class VSProject : VSFile { public List FixedLinkDependency = new List(); public List LinkDependency = new List(); public List AdditionalLinkDependency { get; set; } = new List(); - + public string Directory; + public ProjectType ProjectType; + + public List SharedProject = new List(); public VSProject(string Filename, bool Expand) { @@ -193,6 +197,7 @@ void FuckerParse2 (TextReader TextReader) { Reference = new ReferenceType(); ItemGroup.Reference.Add (Reference); Reference.Include = XmlReader.GetAttribute("Include"); + Reference.Update = XmlReader.GetAttribute("Update"); Current = Reference; break; } @@ -200,13 +205,35 @@ void FuckerParse2 (TextReader TextReader) { Compile = new CompileType(); ItemGroup.Compile.Add(Compile); Compile.Include = XmlReader.GetAttribute("Include"); + Compile.Update = XmlReader.GetAttribute("Update"); Current = Compile; + break; + } + case "Import": { + var Import = new ImportType(); + ImportList.Add(Import); + Import.Condition = XmlReader.GetAttribute("Condition"); + Import.Project = XmlReader.GetAttribute("Project"); + Import.Label = XmlReader.GetAttribute("Label"); + Current = Import; + + if (Import.Label == "Shared") { + var File = Path.Combine(Directory, Import.Project); + var Shared = new VSProject(File, true) { + ProjectType = ProjectType.shared + }; + SharedProject.Add(Shared); + + } + + break; } case "None": { None = new NoneType(); ItemGroup.None.Add(None); None.Include = XmlReader.GetAttribute("Include"); + None.Update = XmlReader.GetAttribute("Update"); Current = None; break; } @@ -503,6 +530,69 @@ public void Parse (TextReader TextReader, bool Expand) { } + public partial class NoneType { + public static Dictionary BuildTypes = new Dictionary() { + { "commandcs", new BuildDescription ("cs", "commandparse") }, + { "fsrcs", new BuildDescription ("cs", "fsrgen") }, + { "exceptional", new BuildDescription("cs", "exceptional") }, + { "gscript", new BuildDescription ("cs", "gscript") }, + { "goedel3", new BuildDescription ("cs", "goedel3") }, + { "asn2cs", new BuildDescription ("cs", "asn2") }, + { "domainercs", new BuildDescription ("cs", "domainer") }, + { "registrycs", new BuildDescription ("cs", "registryconfig") }, + { "vsixbuild", new BuildDescription ("cs", "vsixbuild") }, + { "protogen", new BuildDescription ("cs", "protogen") }, + { "rfc2txt", new BuildDescription ("txt", "rfctool") }, + { "rfc2xml", new BuildDescription("xml", "rfctool") }, + { "rfc2md", new BuildDescription ("md", "rfctool") }, + { "rfc2html", new BuildDescription ("html", "rfctool") }, + { "md2aml", new BuildDescription ("aml", "rfctool") }, + }; + + BuildDescription _BuildDescription = null; + BuildDescription BuildDescription { + get { + _BuildDescription = _BuildDescription ?? GetBuildDescription(); + return _BuildDescription; + } + } + + + BuildDescription GetBuildDescription () { + if (Generator == null) { + return null; + } + BuildTypes.TryGetValue(Generator.ToLower(), out var Result); + return Result; + } + + + public bool BuildTool => BuildDescription != null; + + public string BuildExtension => BuildDescription?.Extension; + + public string BuildCommand => BuildDescription?.Command; + + public string BuildTarget => Path.ChangeExtension(BuildSource, BuildExtension); + + public string BuildSource => Include ?? Update; + } + + + + + public partial class BuildDescription { + public string Extension; + + public string Command; + + public BuildDescription (string Extension, string Command) { + + this.Extension = Extension; + this.Command = Command; + } + + } public partial class ProjectReferenceType { [System.Xml.Serialization.XmlIgnore] diff --git a/MakeyMakey/Goedel.Tool.Makey/ParseSolution.cs b/MakeyMakey/Goedel.Tool.Makey/ParseSolution.cs index 7c7e4b9f1..eac9789d0 100644 --- a/MakeyMakey/Goedel.Tool.Makey/ParseSolution.cs +++ b/MakeyMakey/Goedel.Tool.Makey/ParseSolution.cs @@ -21,8 +21,7 @@ public enum ProjectType { portable, website, vsix, - csstandard, - cscore, + csstandard, // includes core shared } @@ -39,21 +38,18 @@ public enum ProjectType { /// public partial class VSSolution : VSFile { readonly static public Dictionary MapProject = new Dictionary { - { "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", ProjectType.folder}, - { "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", ProjectType.csproj}, - { "{930C7802-8A8C-48F9-8165-68863BCCD9DD}", ProjectType.wixproj}, - { "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}", ProjectType.cproj }, - { "{786C830F-07A1-408B-BD7F-6EE04809D6DB}", ProjectType.portable }, + { "{2150e333-8fdc-42a3-9474-1a3956d46de8}", ProjectType.folder}, + { "{fae04ec0-301f-11d3-bf4b-00c04f79efbc}", ProjectType.csproj}, + { "{930c7802-8a8c-48f9-8165-68863bccd9dd}", ProjectType.wixproj}, + { "{8bc9ceb8-8b4a-11d0-8d11-00a0c91bc942}", ProjectType.cproj }, + { "{786c830f-07a1-408b-bd7f-6ee04809d6db}", ProjectType.portable }, { "{82b43b9b-a64c-4715-b499-d71e9ca2bd60}", ProjectType.vsix}, - { "{9A19103F-16F7-4668-BE54-9A1E7A4F7556}", ProjectType.csstandard}, - { "{420F632D-B323-42B4-954C-DA875083DCC6}", ProjectType.cscore}, - { "{98F612E7-C4C4-44D3-8D0E-B7A961E2BBAB}", ProjectType.shared}, - { "{E24C65DC-7377-472B-9ABA-BC803B73C61A}", ProjectType.website} + { "{9a19103f-16f7-4668-be54-9a1e7a4f7556}", ProjectType.csstandard}, + { "{d954291e-2a0b-460d-934e-dc6b0785db48}", ProjectType.shared}, + { "{e24c65dc-7377-472b-9aba-bc803b73c61a}", ProjectType.website} }; - - public string Directory; public string FormatVersion { get; set; } @@ -252,14 +248,14 @@ public SolutionProject(Tokenizer Tokenizer) { Directory = Tokenizer.Value1; ThisGUID = Tokenizer.Value2; - VSSolution.MapProject.TryGetValue(TypeGUID, out _ProjectType); + VSSolution.MapProject.TryGetValue(TypeGUID.ToLower(), out _ProjectType); } public static bool IsRecurse (ProjectType ProjectType) { switch (ProjectType) { case ProjectType.cproj: + case ProjectType.csproj: case ProjectType.csstandard: - case ProjectType.cscore: case ProjectType.shared: { return true; } diff --git a/MakeyMakey/Goedel.Tool.Makey/Project.cs b/MakeyMakey/Goedel.Tool.Makey/Project.cs index be321a420..634b5bfba 100644 --- a/MakeyMakey/Goedel.Tool.Makey/Project.cs +++ b/MakeyMakey/Goedel.Tool.Makey/Project.cs @@ -106,6 +106,10 @@ public partial class ReferenceType { [System.Xml.Serialization.XmlAttributeAttribute("Include")] public string Include { get; set; } + /// + [System.Xml.Serialization.XmlAttributeAttribute("Updates")] + public string Update { get; set; } + /// [System.Xml.Serialization.XmlElementAttribute("HintPath")] public string HintPath { get; set; } @@ -133,6 +137,10 @@ public partial class CompileType { [System.Xml.Serialization.XmlAttributeAttribute("Include")] public string Include { get; set; } + /// + [System.Xml.Serialization.XmlAttributeAttribute("Updates")] + public string Update { get; set; } + /// [System.Xml.Serialization.XmlElementAttribute("DependentUpon")] public string DependentUpon { get; set; } @@ -153,6 +161,11 @@ public partial class NoneType { /// [System.Xml.Serialization.XmlAttributeAttribute("Include")] public string Include { get; set; } + + /// + [System.Xml.Serialization.XmlAttributeAttribute("Updates")] + public string Update { get; set; } + /// [System.Xml.Serialization.XmlElementAttribute("Generator")] public string Generator { get; set; } @@ -186,4 +199,24 @@ public partial class ProjectReferenceType { } + + [Serializable()] + [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] + public partial class ImportType { + + /// + [System.Xml.Serialization.XmlAttributeAttribute("Project")] + public string Project { get; set; } + + /// + [System.Xml.Serialization.XmlElementAttribute("Condition")] + public string Condition { get; set; } + + /// + [System.Xml.Serialization.XmlElementAttribute("Label")] + public string Label { get; set; } + + } + + } diff --git a/MakeyMakey/Goedel.Tool.Makey/VS.Make b/MakeyMakey/Goedel.Tool.Makey/VS.Make new file mode 100644 index 000000000..4599af1ff --- /dev/null +++ b/MakeyMakey/Goedel.Tool.Makey/VS.Make @@ -0,0 +1,35 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + +LinkFiles = \ + Goedel.FSR.dll\ + Goedel.Registry.dll\ + Goedel.Utilities.dll + +ToolTargets = \ + GenerateMakefile.cs + +GenerateMakefile.cs : GenerateMakefile.script + gscript GenerateMakefile.script GenerateMakefile.cs + +prebuild : $(ToolTargets) + echo "Completed prebuild" + +postbuild : + echo "Completed postbuild" + +# powershell publishtarget Goedel.Tool.Makey.dll + + diff --git a/MakeyMakey/TestSolution/App.config b/MakeyMakey/TestSolution/App.config new file mode 100644 index 000000000..016d28fcc --- /dev/null +++ b/MakeyMakey/TestSolution/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/BuildProject.csproj b/MakeyMakey/TestSolution/BuildProject.csproj new file mode 100644 index 000000000..c8888a6a3 --- /dev/null +++ b/MakeyMakey/TestSolution/BuildProject.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {1F4B83F8-B03A-4A5C-87CB-74524A7379F6} + Exe + BuildProject + BuildProject + v4.7 + 512 + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + AnyCPU + true + full + false + BuildProject\bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/Container2/Container2.csproj b/MakeyMakey/TestSolution/Container2/Container2.csproj new file mode 100644 index 000000000..ae14b21e0 --- /dev/null +++ b/MakeyMakey/TestSolution/Container2/Container2.csproj @@ -0,0 +1,9 @@ + + + + netstandard2.0 + + + + + diff --git a/MakeyMakey/TestSolution/Container2/VS.Make b/MakeyMakey/TestSolution/Container2/VS.Make new file mode 100644 index 000000000..5aeece16c --- /dev/null +++ b/MakeyMakey/TestSolution/Container2/VS.Make @@ -0,0 +1,38 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = + + +prebuildRecurse : \ + cd Container2\..\SharedProject && nmake /c /f VS.make prebuild + +postbuildRecurse : \ + cd Container2\..\SharedProject && nmake /c /f VS.make postbuild + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/TestSolution/ContainerStandard/ContainerStandard.csproj b/MakeyMakey/TestSolution/ContainerStandard/ContainerStandard.csproj new file mode 100644 index 000000000..ae14b21e0 --- /dev/null +++ b/MakeyMakey/TestSolution/ContainerStandard/ContainerStandard.csproj @@ -0,0 +1,9 @@ + + + + netstandard2.0 + + + + + diff --git a/MakeyMakey/TestSolution/ContainerStandard/VS.Make b/MakeyMakey/TestSolution/ContainerStandard/VS.Make new file mode 100644 index 000000000..39bec8956 --- /dev/null +++ b/MakeyMakey/TestSolution/ContainerStandard/VS.Make @@ -0,0 +1,38 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = + + +prebuildRecurse : \ + cd ContainerStandard\..\SharedProject && nmake /c /f VS.make prebuild + +postbuildRecurse : \ + cd ContainerStandard\..\SharedProject && nmake /c /f VS.make postbuild + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/TestSolution/CoreConsole/Command.cs b/MakeyMakey/TestSolution/CoreConsole/Command.cs new file mode 100644 index 000000000..cd0a2eb28 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Command.cs @@ -0,0 +1,437 @@ +using Goedel.Utilities; +using System; +using System.Collections.Generic; + +namespace Goedel.Command { + + /// + /// Delegate calling a dispatch routine. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public delegate void HandleDelegate (DispatchShell Dispatch, string[] args, int index); + + + /// + /// Base class for command line interpreters + /// + public abstract class CommandLineInterpreterBase { + + + ///// The command entries + //public static SortedDictionary Entries; + ///// The default command. + //public static DescribeCommandEntry DefaultCommand; + ///// Description of the comman + //public static string Description = ""; + + /// The default flag indicator for display to terminal, this is a forward slash / for Windows + /// and a double dash -- for UNIX. + public static char FlagIndicator = '/'; + + ///// + ///// Provide the summary of the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void Brief (DispatchShell Dispatch, string[] args, int index) { + // Brief(); + // } + + ///// + ///// Describe the application invoked by the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void About (DispatchShell Dispatch, string[] args, int index) { + // FileTools.About(); + // } + + + /// + /// Provide the summary of the command. + /// + public static void Brief ( + string Description, + DescribeCommandEntry DefaultCommand, + SortedDictionary Entries) { + Console.WriteLine(Description); + Console.WriteLine(""); + + if (DefaultCommand != null) { + DefaultCommand.Describe(FlagIndicator); + + } + foreach (var Entry in Entries) { + if (!Entry.Value.IsDefault) { // BUG: Is not doing the right thing here. + Entry.Value.Describe(FlagIndicator); + } + } + } + + /// + /// Process command options. + /// + /// The command line arguments. + /// The first unparsed argument. + /// The option values to set. + public static void ProcessOptions (string[] Args, int Index, Dispatch Options) { + var Describe = Options.DescribeCommand; + var CommandLex = new CommandLex(); + + var Parameter = 0; + + // Set all data slots to their default value + foreach (var Description in Describe.Entries) { + if (Description.Default != null) { + Options._Data[Description.Index].Default(Description.Default); + } + } + + for (var i = Index; i < Args.Length; i++) { + var Arg = Args[i]; + var Token = CommandLex.GetToken(Arg); + + switch (Token) { + case CommandLex.Token.Empty: { + break; + } + case CommandLex.Token.Flag: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; + Assert.NotNull(Entry, UnknownOption.Throw); + var Data = Options._Data[Entry.Index]; + if ((i + 1 < Args.Length) && !IsFlagged(Args[i + 1])) { + i++; + Arg = Args[i]; + + SetValue(Data, Args[i]); + } + Data.SetFlag(CommandLex.Not); + + if (Data as _Flag != null) { + (Data as _Flag).Value = !CommandLex.Not; + Data.ByDefault = false; + } + break; + } + case CommandLex.Token.FlagValue: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; ; + Assert.NotNull(Entry, UnknownOption.Throw); + + SetValue(Options._Data[Entry.Index], CommandLex.Value); + + break; + } + case CommandLex.Token.Value: { + var Search = true; + for (var j = Parameter; Search & j < Describe.Entries.Count; j++) { + if (Describe.Entries[j] is DescribeEntryParameter) { + DescribeEntryParameter Entry = Describe.Entries[j] as DescribeEntryParameter; + SetValue(Options._Data[Entry.Index], CommandLex.Value); + Parameter = j + 1; + Search = false; + } + + + + //switch (Describe.Entries[j]) { + // case DescribeEntryParameter Entry: { + // SetValue(Options._Data[Entry.Index], CommandLex.Value); + // Parameter = j+1; + // Search = false; + // break; + // } + // } + } + break; + } + } + } + foreach (var Entry in Options._Data) { + Entry.Complete(Options._Data); + } + } + + static void SetValue (Type Data, string Value) { + Data.Parameter(Value); // Hack: consolidate + Data.ByDefault = false; // Has been set explicitly + } + + static DescribeEntry Match (List Entries, string Flag) { + foreach (var Entry in Entries) { + if (Entry.Key.ToLower() == Flag.ToLower()) { + return Entry; + } + } + return null; + } + + /// + /// Describe the values in an command. + /// + /// The command to describe. + public static void DescribeValues (Dispatch Dispatch) { + // NYI: This may not be required. + } + + /// + /// Return true iff the text value is flagged. + /// + /// Text to test. + /// Result of the test. + public static bool IsFlagged (string Text) { + if (Text == null) { + return false; + } + if (Text.Length <= 0) { + return false; + } + return Text[0] == '-' | Text[0] == '/'; + } + + /// + /// The main dispatch point + /// + /// Dictionary describing the shell commands and dispatchers. + /// The default command entry + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public void Dispatcher (SortedDictionary Entries, + DescribeCommandEntry DefaultCommand, + DispatchShell Dispatch, string[] Args, int Index) { + // NYI: This should really be set up to take a Command set description + // as the input. + + if (Args.Length == 0) { + Assert.NotNull(DefaultCommand, UnknownCommand.Throw); + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + Assert.True(Index < Args.Length, UnknownCommand.Throw); + + var Arg = Args[Index]; + Assert.True(Arg.Length > 0, UnknownCommand.Throw); // Should never happen. + var Flagged = IsFlagged(Arg); + var Command = Flagged ? Arg.Substring(1).ToLower() : Arg.ToLower(); + + if (DefaultCommand != null & !Flagged) { + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + // NYI: no, it could be a default command and an option. + Assert.True(Entries.TryGetValue(Command, out var DescribeCommand), UnknownCommand.Throw); + if (DescribeCommand is DescribeCommandEntry) { + var DescribeCommandEntry = DescribeCommand as DescribeCommandEntry; + DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + } + else if (DescribeCommand is DescribeCommandSet) { + var DescribeCommandSet = DescribeCommand as DescribeCommandSet; + Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + } + + //switch (DescribeCommand) { + + // case DescribeCommandEntry DescribeCommandEntry: { + // DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + // break; + // } + // case DescribeCommandSet DescribeCommandSet: { + // Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + // break; + // } + // } + + } + } + + + /// + /// Describe a command or parameter entry + /// + public abstract class DescribeEntry { + /// The identifier name. + public string Identifier { get; set; } + /// Brief description + public string Brief { get; set; } + /// The default value (if specified) + public string Default { get; set; } + /// The command line key. + public string Key { get; set; } + /// The position in the options array. + public int Index { get; set; } // Index into array of Type + } + + /// + /// Describe a command set. + /// + public abstract class DescribeCommand : DescribeEntry { + + /// If true, this is the default command. + public bool IsDefault = false; + + /// + /// Describe the command set. + /// + /// The flag indicator to use when printing the description. + public abstract void Describe (char FlagIndicator); + } + + /// + /// Describe a command entry + /// + public class DescribeCommandEntry : DescribeCommand { + + /// Delegate to dispatch if command is selected. + public HandleDelegate HandleDelegate { get; set; } + + /// If true perform lezy evaluation of parameters. + public bool Lazy { get; set; } = false; + + /// The command entries. + public List Entries { get; set; } + + /// + /// Get the default for the value. + /// + /// The tag text + /// The default value if it exists, null otherwise. + public string GetDefault (string Tag) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + return Entry.Default; + } + } + return null; + } + + /// + /// Set the default value for the tag + /// + /// The tag text + /// The value to set as the default. + public void SetDefault (string Tag, string Default) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + Entry.Default = Default; + } + } + + } + + /// + /// Describe the command to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}{1}", FlagIndicator, Identifier); + foreach (var Entry in Entries) { + + if (Entry is DescribeCommandEntry) { + var SubCommand = Entry as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry is DescribeEntryParameter) { + var Parameter = Entry as DescribeEntryParameter; + Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + } + else if (Entry is DescribeEntryOption) { + var Option = Entry as DescribeEntryOption; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + } + + + //switch (Entry) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeEntryParameter Parameter: { + // Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + // break; + // } + //case DescribeEntryOption Option: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + // break; + // } + //} + } + } + + + } + + /// + /// Describe a command set. + /// + public class DescribeCommandSet : DescribeCommand { + + /// Dictionary of command entries. + public SortedDictionary Entries; + + /// + /// Describe the command set to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}", Identifier); + foreach (var Entry in Entries) { + + if (Entry.Value is DescribeCommandEntry) { + var SubCommand = Entry.Value as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry.Value is DescribeCommandSet) { + var Parameter = Entry.Value as DescribeCommandSet; + Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + } + + + //switch (Entry.Value) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeCommandSet Parameter: { + // Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + // break; + // } + + //} + } + } + } + + /// + /// Describe an entry value. + /// + public class DescribeEntryValue : DescribeEntry { + + } + + /// + /// Describe an option value. + /// + public class DescribeEntryOption : DescribeEntryValue { + } + + /// + /// Describe a parameter value. + /// + public class DescribeEntryParameter : DescribeEntryValue { + } + + /// + /// Describe a shell. + /// + public abstract class DispatchShell : Dispatch{ + + } + + + } diff --git a/MakeyMakey/TestSolution/CoreConsole/CommandLex.cs b/MakeyMakey/TestSolution/CoreConsole/CommandLex.cs new file mode 100644 index 000000000..05af94f98 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CommandLex.cs @@ -0,0 +1,174 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandLex { + public virtual void Reset (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddFlag (int c) { + } + public virtual void AddFlagN (int c) { + } + public virtual void AddFlagNo (int c) { + } + public virtual void Abort (int c) { + } + } + */ + + public partial class CommandLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// IsValue + IsValue = 1, + /// StartFlag + StartFlag = 2, + /// IsFlag + IsFlag = 3, + /// IsFlagN + IsFlagN = 4, + /// IsFlagNo + IsFlagNo = 5, + /// StartFlagValue + StartFlagValue = 6, + /// IsFlagValue + IsFlagValue = 7, + /// Fail + Fail = 8 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1, + /// Flag + Flag = 2, + /// FlagValue + FlagValue = 3 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 2 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 3 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {1 , 8 , 2 , 1 , 1 , 1 }, + {1 , 1 , 1 , 1 , 1 , 1 }, + {3 , 3 , 3 , 3 , 4 , 3 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {3 , 3 , 3 , 6 , 3 , 5 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {-2 , -2 , -2 , -2 , -2 , -2 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Flag, + Token.Flag, + Token.Flag, + Token.Flag, + Token.FlagValue, + Token.FlagValue, + Token.Empty + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + Reset, + AddValue, + Ignore, + AddFlag, + AddFlagN, + AddFlagNo, + Ignore, + AddValue, + Abort + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/CoreConsole/CommandLex.fsm b/MakeyMakey/TestSolution/CoreConsole/CommandLex.fsm new file mode 100644 index 000000000..f2bd4de77 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CommandLex.fsm @@ -0,0 +1,46 @@ +FSR Goedel.Command CommandLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "example.file" + Token Flag "/flag" + Token FlagValue "/flag:example.file" + + + + State ItemStart Reset Empty // Start of file + On " \t\n" GoTo Fail + On "/-" GoTo StartFlag + Any GoTo IsValue + + State IsValue AddValue Value + Any GoTo IsValue + + State StartFlag Ignore Flag + On "Nn" GoTo IsFlagN + Any GoTo IsFlag + + State IsFlag AddFlag Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagN AddFlagN Flag + On "Oo" GoTo IsFlagNo + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagNo AddFlagNo Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State StartFlagValue Ignore FlagValue + Any GoTo IsFlagValue + + State IsFlagValue AddValue FlagValue + Any GoTo IsFlagValue + + State Fail Abort Empty + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/CoreConsole/CommandLexPlus.cs b/MakeyMakey/TestSolution/CoreConsole/CommandLexPlus.cs new file mode 100644 index 000000000..a11698372 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CommandLexPlus.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Lexical analyzer for command line parsing. + /// + public partial class CommandLex { + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The data to parse + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public string Value => BuildValue.ToString(); + + /// + /// Return the resulting string value + /// + public string Flag => BuildFlag.ToString(); + + /// + /// If true, flag was negated. + /// + public bool Not { get; set; } + + StringBuilder BuildValue = new StringBuilder(); + StringBuilder BuildFlag = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + BuildValue.Clear(); + BuildFlag.Clear(); + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void Reset (int c) { + Reset(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + BuildValue.Append((char)c); + } + + /// + /// Add a character to the flag buffer + /// + /// The character read + public virtual void AddFlag (int c) { + BuildFlag.Append((char)c); + } + + /// + /// N of possible NO flag + /// + /// The character read + public virtual void AddFlagN (int c) { + BuildFlag.Append((char)c); + } + + /// + /// O of possible NO flag + /// + /// The character read + public virtual void AddFlagNo (int c) { + BuildFlag.Clear(); // delete 'no' prefix + Not = true; + } + /// + /// Abort parsing, the command cannot be read. + /// + /// The character read + public virtual void Abort (int c) { + } + + + + } + } diff --git a/MakeyMakey/TestSolution/CoreConsole/CommandSplit.cs b/MakeyMakey/TestSolution/CoreConsole/CommandSplit.cs new file mode 100644 index 000000000..7c5155154 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CommandSplit.cs @@ -0,0 +1,173 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandSplitLex { + public virtual void AddParam (int c) { + } + public virtual void BeginValue (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddEscape (int c) { + } + public virtual void AddEscapedValue (int c) { + } + } + */ + + public partial class CommandSplitLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// StartQuoted + StartQuoted = 1, + /// Quoted + Quoted = 2, + /// QuotedQuote + QuotedQuote = 3, + /// QuotedEscape + QuotedEscape = 4, + /// QuotedEscapeReturn + QuotedEscapeReturn = 5, + /// Unquoted + Unquoted = 6, + /// UnquotedQuote + UnquotedQuote = 7, + /// UnquotedEscape + UnquotedEscape = 8, + /// UnquotedEscapeReturn + UnquotedEscapeReturn = 9 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {6 , 0 , 1 , 8 }, + {2 , 2 , 3 , 4 }, + {2 , 2 , 3 , 4 }, + {2 , 0 , 2 , 4 }, + {5 , 5 , 5 , 4 }, + {2 , 2 , 3 , 4 }, + {6 , 0 , 7 , 8 }, + {6 , 0 , 7 , 8 }, + {9 , 0 , 9 , 8 }, + {6 , 6 , 7 , 8 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + AddParam, + BeginValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/CoreConsole/CommandSplit.fsm b/MakeyMakey/TestSolution/CoreConsole/CommandSplit.fsm new file mode 100644 index 000000000..b85742b96 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CommandSplit.fsm @@ -0,0 +1,68 @@ +FSR Goedel.Command CommandSplitLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "Parameter" + + + + State ItemStart AddParam Empty // Start of file + On " \t\n" GoTo ItemStart + On "\"" GoTo StartQuoted + On "\\" GoTo UnquotedEscape + Any GoTo Unquoted + + State StartQuoted BeginValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State Quoted AddValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedQuote Ignore Value + On " \t\n" GoTo ItemStart // An end quote + On "\"" GoTo Quoted + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedEscape AddEscape Value + On "\"" GoTo QuotedEscapeReturn + On "\\" GoTo QuotedEscape + Any GoTo QuotedEscapeReturn + + State QuotedEscapeReturn AddEscapedValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + + + + State Unquoted AddValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedQuote Ignore Value + On "\"" GoTo UnquotedQuote + On "\\" GoTo UnquotedEscape + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedEscape AddEscape Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedEscapeReturn + On " \t\n" GoTo ItemStart + Any GoTo UnquotedEscapeReturn + + State UnquotedEscapeReturn AddEscapedValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + Any GoTo Unquoted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/CoreConsole/CommandSplitLexPlus.cs b/MakeyMakey/TestSolution/CoreConsole/CommandSplitLexPlus.cs new file mode 100644 index 000000000..dd410bb7f --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CommandSplitLexPlus.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Split a command line into parts. + /// + public partial class CommandSplitLex { + + /// + /// Split a commandline into entries. + /// + /// The command line to split. + /// The command line split into entries. + public static string[] Split (string Text) { + var CommandSplitLex = new CommandSplitLex(); + CommandSplitLex.GetToken(Text); + return CommandSplitLex.Value.ToArray(); + } + + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandSplitLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The string to parse. + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public List Value { + get { + if (Pending) { + AddParam(); + Pending = false; + } + return Arguments; + } + } + + // Private variables + bool Pending = false; // if true, there is an incomplete value to be added. + int EscapeCount = 0; + List Arguments = new List(); + StringBuilder BuildValue = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + Arguments.Clear(); + BuildValue.Clear(); + Pending = false; + EscapeCount = 0; + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void AddParam (int c) { + AddParam(); + } + + void AddParam () { + // Add any pending escape characters + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + // Add the parameter to the build string + var Text = BuildValue.ToString(); + if (Pending) { + Arguments.Add(Text); + } + // Reset all buffers + EscapeCount = 0; + BuildValue.Clear(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + + /// + /// Start a quoted parameter, this can be null + /// + /// The character read + public virtual void BeginValue (int c) { + Pending = true; + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + EscapeCount = 0; + Pending = true; + BuildValue.Append((char)c); + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddEscape (int c) { + Pending = true; + EscapeCount++; + } + + /// + /// Add a sequence of escape characters to the value buffer. If the final character is not + /// a double quote, the escape characters are simply added. Otherwise, each pair of escape + /// characters results in a single escape character and a double quote is added if the number + /// of escape characters is odd. + /// + /// The character read + public virtual void AddEscapedValue (int c) { + + if (c == '\"') { + while (EscapeCount > 1) { + EscapeCount -= 2; + BuildValue.Append('\\'); + } + if (EscapeCount == 1) { + BuildValue.Append('\"'); + } + } + else { + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + BuildValue.Append((char)c); + } + EscapeCount = 0; + + } + + } + } diff --git a/MakeyMakey/TestSolution/CoreConsole/CoreConsole.csproj b/MakeyMakey/TestSolution/CoreConsole/CoreConsole.csproj new file mode 100644 index 000000000..acabc9c9b --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/CoreConsole.csproj @@ -0,0 +1,50 @@ + + + + Exe + netcoreapp2.0 + + + + + CommandLex.fsm + True + True + + + CommandSplit.fsm + True + True + + + Exceptions.exceptional + True + True + + + Main.command + True + True + + + + + + CommandLex.cs + fsrcs + + + CommandSplit.cs + fsrcs + + + Exceptions.cs + exceptional + + + Main.cs + CommandCS + + + + diff --git a/MakeyMakey/TestSolution/CoreConsole/Dispatch.cs b/MakeyMakey/TestSolution/CoreConsole/Dispatch.cs new file mode 100644 index 000000000..a506003bf --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Dispatch.cs @@ -0,0 +1,19 @@ +using System; + +namespace Goedel.Command { + /// Track start and end time of parse. + public abstract class Dispatch { + /// Record start time. + public DateTime Started = DateTime.Now; + + /// Calculate elapsed time. + public TimeSpan Elapsed => DateTime.Now - Started; + + /// Command type data + public virtual Type[] _Data { get; set; } + + /// Command description + public virtual DescribeCommandEntry DescribeCommand { get; set; } + } + + } diff --git a/MakeyMakey/TestSolution/CoreConsole/Exceptions.cs b/MakeyMakey/TestSolution/CoreConsole/Exceptions.cs new file mode 100644 index 000000000..7f51389f4 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Exceptions.cs @@ -0,0 +1,373 @@ +using System; +using Goedel.Utilities; + + + +namespace Goedel.Command { + + + /// + /// The user command could not be parsed + /// + public class ParserException : global::System.Exception { + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + public ParserException () : base ("The user command could not be parsed") { + } + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + /// Description of the error + public ParserException (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public ParserException (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + /// + /// User data associated with the exception. + /// + public object UserData; + + + + + /// + /// The public fatory delegate + /// + public static global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new ParserException(Reason as string); + } + else { + return new ParserException(); + } + } + } + + + /// + /// The file could not be read. + /// + public class FileReadError : ParserException { + + /// + /// Construct instance for exception "The file could not be read" + /// + public FileReadError () : base ("The file could not be read") { + } + + /// + /// Construct instance for exception "The file could not be read" + /// + /// Description of the error + public FileReadError (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public FileReadError (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + public FileReadError (ExceptionData Object) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + /// Inner Exception + public FileReadError (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new FileReadError(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new FileReadError(Reason as ExceptionData); + } + else { + return new FileReadError(); + } + } + } + + + /// + /// User entered an unknown command + /// + public class UnknownCommand : ParserException { + + /// + /// Construct instance for exception "Unknown command" + /// + public UnknownCommand () : base ("Unknown command") { + } + + /// + /// Construct instance for exception "Unknown command" + /// + /// Description of the error + public UnknownCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + public UnknownCommand (ExceptionData Object) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownCommand (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownCommand(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownCommand(Reason as ExceptionData); + } + else { + return new UnknownCommand(); + } + } + } + + + /// + /// User entered an unknown option + /// + public class UnknownOption : ParserException { + + /// + /// Construct instance for exception "Unknown option" + /// + public UnknownOption () : base ("Unknown option") { + } + + /// + /// Construct instance for exception "Unknown option" + /// + /// Description of the error + public UnknownOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + public UnknownOption (ExceptionData Object) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownOption (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownOption(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownOption(Reason as ExceptionData); + } + else { + return new UnknownOption(); + } + } + } + + + /// + /// No command specified + /// + public class NoCommand : ParserException { + + /// + /// Construct instance for exception "No command specified" + /// + public NoCommand () : base ("No command specified") { + } + + /// + /// Construct instance for exception "No command specified" + /// + /// Description of the error + public NoCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public NoCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new NoCommand(Reason as string); + } + else { + return new NoCommand(); + } + } + } + + + /// + /// The option value was incorrectly formatted + /// + public class InvalidOption : ParserException { + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + public InvalidOption () : base ("The option value was incorrectly formatted") { + } + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + /// Description of the error + public InvalidOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public InvalidOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new InvalidOption(Reason as string); + } + else { + return new InvalidOption(); + } + } + } + + + } diff --git a/MakeyMakey/TestSolution/CoreConsole/Exceptions.exceptional b/MakeyMakey/TestSolution/CoreConsole/Exceptions.exceptional new file mode 100644 index 000000000..0220f6994 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Exceptions.exceptional @@ -0,0 +1,41 @@ + +Namespace Goedel.Command + + Exception ParserException + Console "The user command could not be parsed" + Description + |The user command could not be parsed + + Exception FileReadError + Console "The file could not be read" + Description + |The file could not be read. + + Object ExceptionData "The file {0} could not be read" + String + + Exception UnknownCommand + Console "Unknown command" + Description + |User entered an unknown command + + Object ExceptionData "The command {0} is not known." + String + + Exception UnknownOption + Console "Unknown option" + Description + |User entered an unknown option + + Object ExceptionData "The option {0} is not known." + String + + Exception NoCommand + Console "No command specified" + Description + |No command specified + + Exception InvalidOption + Console "The option value was incorrectly formatted" + Description + |The option value was incorrectly formatted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/CoreConsole/FileTools.cs b/MakeyMakey/TestSolution/CoreConsole/FileTools.cs new file mode 100644 index 000000000..335f9c6d1 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/FileTools.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Goedel.Registry; + +namespace Goedel.Command { + + + /// + /// Utility class for managing files. + /// + public class FileTools { + + + /// + /// Get the time at which the specified file was created + /// Return DateTime.MinValue if the file does not exist + /// + /// The file to test + /// The time the file was created. + public static DateTime GetFileDateTime(string FileName) { + if (!File.Exists(FileName)) { + return DateTime.MinValue; + } + return File.GetLastWriteTimeUtc(FileName); + } + + /// + /// Write short form description of the current program to the console. + /// + public static void About() { + DateTime CompilationDate = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + + string Build = Script.LocalizeTime(CompilationDate, false); + + + Console.WriteLine(Script.AssemblyTitle); + Console.WriteLine(" {0}", Script.AssemblyDescription); + Console.WriteLine(" CopyRight : {0} {1}", Script.AssemblyCopyright, Script.AssemblyCompany); + Console.WriteLine(" Version : {0}", Script.AssemblyVersion); + Console.WriteLine(" Compiled : {0}", Build); + } + + /// + /// Cehck to see if a Destination file is more recent than a source file. + /// + /// The source file. + /// The destination file. + /// True if the source was created before the destination. + public static bool UpToDate(string Source, string Destination) { + + DateTime OutputDateTime = FileTools.GetFileDateTime(Destination); + if (OutputDateTime == DateTime.MinValue) { + return false; + } + DateTime ToolDateTime = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + if (OutputDateTime < ToolDateTime) { + return false; + } + DateTime SourceDateTime = FileTools.GetFileDateTime(Source); + return (OutputDateTime > SourceDateTime); + } + + /// + /// Determine output file name using command line entry and default data. + /// + /// The default extension. + /// The base file name. + /// The defaulted output file. + public static string DefaultFile(string Extension, string Default) { + return Path.GetFileNameWithoutExtension(Default) + "." + Extension; + } + + + // + // Search for a file. + // + // If FileName exists, use that, otherwise try FileName.Extension + // + + /// + /// Search for a file using specified extension if required. + /// + /// The base file name. + /// Default extension. + /// The defaulted file. + public static string DefaultExtension(string FileName, string Extension) { + if (File.Exists(FileName)) { + return FileName; + } + + return FileName + "." + Extension; + } + + /// + /// Calculate output file name. + /// + /// The source file path + /// The destination file path. + /// The default extension. + /// The defaulted file name. + public static string DefaultOutput(string SourcePath, string DestinationPath, + string Extension) { + if (DestinationPath != null) { + return DestinationPath; + } + return Path.GetFileNameWithoutExtension(SourcePath) + "." + Extension; + } + } + } diff --git a/Domainer/domainer/Main.command b/MakeyMakey/TestSolution/CoreConsole/Main.command similarity index 100% rename from Domainer/domainer/Main.command rename to MakeyMakey/TestSolution/CoreConsole/Main.command diff --git a/MakeyMakey/TestSolution/CoreConsole/Main.cs b/MakeyMakey/TestSolution/CoreConsole/Main.cs new file mode 100644 index 000000000..d60180c7a --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Main.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.Command; +using Goedel.Registry; +using Goedel.Utilities; + +namespace DomainerShell { + public partial class CommandLineInterpreter : CommandLineInterpreterBase { + + /// The command entries + public static SortedDictionary Entries; + /// The default command. + public static DescribeCommandEntry DefaultCommand; + /// Description of the comman + public static string Description = ""; + + static char UnixFlag = '-'; + static char WindowsFlag = '/'; + + + /// + /// + /// + /// + /// + /// + public static void Help (DispatchShell Dispatch, string[] args, int index) { + Brief(Description, DefaultCommand, Entries); + } + + public static DescribeCommandEntry DescribeHelp = new DescribeCommandEntry() { + Identifier = "help", + HandleDelegate = Help, + Entries = new List() { } + }; + + /// + /// Describe the application invoked by the command. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public static void About (DispatchShell Dispatch, string[] args, int index) { + FileTools.About(); + } + + public static DescribeCommandEntry DescribeAbout = new DescribeCommandEntry() { + Identifier = "about", + HandleDelegate = About, + Entries = new List() { } + }; + + static bool IsFlag(char c) { + return (c == UnixFlag) | (c == WindowsFlag) ; + } + + + static CommandLineInterpreter () { + System.OperatingSystem OperatingSystem = System.Environment.OSVersion; + + if (OperatingSystem.Platform == PlatformID.Unix | + OperatingSystem.Platform == PlatformID.MacOSX) { + FlagIndicator = UnixFlag; + } + else { + FlagIndicator = WindowsFlag; + } + + DefaultCommand = _GenerateDomainer._DescribeCommand; + Description = "Manage DNS Resource and Query Records"; + + Entries = new SortedDictionary () { + {"about", DescribeAbout }, + {"in", _GenerateDomainer._DescribeCommand }, + {"help", DescribeHelp } + }; // End Entries + + + + } + + static void Main(string[] args) { + var CLI = new CommandLineInterpreter (); + CLI.MainMethod (args); + } + + public void MainMethod(string[] Args) { + DomainerShell Dispatch = new DomainerShell (); + + MainMethod (Dispatch, Args); + } + + + public void MainMethod(DomainerShell Dispatch, string[] Args) { + Dispatcher (Entries, DefaultCommand, Dispatch, Args, 0); + } // Main + + + + public static void Handle_GenerateDomainer ( + DispatchShell DispatchIn, string[] Args, int Index) { + DomainerShell Dispatch = DispatchIn as DomainerShell; + GenerateDomainer Options = new GenerateDomainer (); + ProcessOptions (Args, Index, Options); + Dispatch.GenerateDomainer (Options); + } + + + } // class Main + + + // The stub class for carrying optional parameters for each command type + // As with the main class each consists of an abstract main class + // with partial virtual that can be extended as required. + + // All subclasses inherit from the abstract classes Goedel.Regisrty.Dispatch + // and Goedel.Command.Type + + + public class _GenerateDomainer : Goedel.Command.Dispatch { + + public override Goedel.Command.Type[] _Data {get; set;} = new Goedel.Command.Type [] { + new Flag (), + new ExistingFile (), + new NewFile () } ; + + /// Field accessor for parameter [lazy] + public virtual Flag Lazy { + get => _Data[0] as Flag; + set => _Data[0] = value; + } + + public virtual string _Lazy { + set => _Data[0].Parameter (value); + } + /// Field accessor for parameter [] + public virtual ExistingFile Domainer { + get => _Data[1] as ExistingFile; + set => _Data[1] = value; + } + + public virtual string _Domainer { + set => _Data[1].Parameter (value); + } + /// Field accessor for option [cs] + public virtual NewFile GenerateCS { + get => _Data[2] as NewFile; + set => _Data[2] = value; + } + + public virtual string _GenerateCS { + set => _Data[2].Parameter (value); + } + public override DescribeCommandEntry DescribeCommand {get; set;} = _DescribeCommand; + + public static DescribeCommandEntry _DescribeCommand = new DescribeCommandEntry () { + Identifier = "in", + Brief = "", + HandleDelegate = CommandLineInterpreter.Handle_GenerateDomainer, + Lazy = true, + Entries = new List () { + new DescribeEntryParameter () { + Identifier = "Domainer", + Default = null, // null if null + Brief = "", + Index = 1, + Key = "" + }, + new DescribeEntryOption () { + Identifier = "GenerateCS", + Default = "cs", // null if null + Brief = "Generate C# code", + Index = 2, + Key = "cs" + } + } + }; + + } + + public partial class GenerateDomainer : _GenerateDomainer { + } // class GenerateDomainer + + + public partial class NewFile : _NewFile { + public static NewFile Factory (string Value) { + var Result = new NewFile(); + Result.Default(Value); + return Result; + } + } // NewFile + + + public partial class ExistingFile : _ExistingFile { + public static ExistingFile Factory (string Value) { + var Result = new ExistingFile(); + Result.Default(Value); + return Result; + } + } // ExistingFile + + + public partial class Flag : _Flag { + public static Flag Factory (string Value) { + var Result = new Flag(); + Result.Default(Value); + return Result; + } + } // Flag + + + + // The stub class just contains routines that echo their arguments and + // write 'not yet implemented' + + // Eventually there will be a compiler option to suppress the debugging + // to eliminate the redundant code + public class _DomainerShell : global::Goedel.Command.DispatchShell { + + public virtual void GenerateDomainer ( GenerateDomainer Options) { + string inputfile = null; + + inputfile = Options.Domainer.Text; + + Goedel.Tool.Domainer.Domainer Parse = new Goedel.Tool.Domainer.Domainer() { + }; + + + using (Stream infile = + new FileStream(inputfile, FileMode.Open, FileAccess.Read)) { + + Lexer Schema = new Lexer(inputfile); + + Schema.Process(infile, Parse); + } + + + // Script output of type GenerateCS cs + if (Options.GenerateCS.Text != null) { + string outputfile = Options.GenerateCS.Text; // Automatically defaults + if (Options.Lazy.Value & FileTools.UpToDate (inputfile, outputfile)) { + return; + } + using (Stream outputStream = + new FileStream(outputfile, FileMode.Create, FileAccess.Write)) { + using (TextWriter OutputWriter = new StreamWriter(outputStream, Encoding.UTF8)) { + + Goedel.Tool.Domainer.Generate Script = new Goedel.Tool.Domainer.Generate (OutputWriter); + + Script.GenerateCS (Parse); + } + } + } + } + + + } // class _DomainerShell + + public partial class DomainerShell : _DomainerShell { + } // class DomainerShell + + } // namespace DomainerShell + + diff --git a/MakeyMakey/TestSolution/CoreConsole/NamespaceDoc.cs b/MakeyMakey/TestSolution/CoreConsole/NamespaceDoc.cs new file mode 100644 index 000000000..c306a76b5 --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/NamespaceDoc.cs @@ -0,0 +1,11 @@ +namespace Goedel.Command { + + /// + /// Support routines for command line parsers defined using the PHB Command tool. + /// + + [System.Runtime.CompilerServices.CompilerGenerated] + class NamespaceDoc { + } + + } diff --git a/MakeyMakey/TestSolution/CoreConsole/Parse.md b/MakeyMakey/TestSolution/CoreConsole/Parse.md new file mode 100644 index 000000000..d86aabb9b --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Parse.md @@ -0,0 +1,15 @@ + // split a command line into chunks applying windows command line escaping rules + // + // one two -> [one] [two] + // "one two" -> [one two] + // "one"two" -> [onetwo] + // "one""two" -> [one"two] + // \\ -> [\\] + // \\" -> [\"] + // \\" \\ -> [\ \\] + // \\\" \\ -> [\"] [\\] + // "Test""Here" -> [TestHere] + // Test""Here -> [Test"Here]] + + + "" Test-> [] [Test] \ No newline at end of file diff --git a/MakeyMakey/TestSolution/CoreConsole/Type.cs b/MakeyMakey/TestSolution/CoreConsole/Type.cs new file mode 100644 index 000000000..df5dfc1db --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/Type.cs @@ -0,0 +1,293 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.Registry; + +namespace Goedel.Command { + /// Base class for Command line parser types. This could do with + /// some decrufting to remove implementation artifacts. + public abstract class Type { + + /// The command line value. + public virtual string Text { get; set; } + + /// If true, the value was set by default + public bool ByDefault { get; set; } = true; + + /// + /// Convert value to string. + /// + /// The string value. + public override string ToString () { + return Text; + } + + /// + /// Set parameter text. + /// + /// Text to set. + public virtual void Parameter (string TextIn) { + Text = TextIn; + } + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public virtual void Default (string TextIn) { + Parameter(TextIn); + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The final data. + public virtual void Complete (Type[] Data) { + } + + /// + /// Set the flag value. + /// + /// If true, flag is negated. + public virtual void SetFlag (bool Negated) { + } + + } + + /// + /// Command line boolean type for flags. + /// + public abstract class _Flag : Goedel.Command.Type { + + /// The canonical command line value. + public override string Text { + get => Value ? "true" : "false"; + set => Parameter(value); + } + + /// + /// Default constructor + /// + public _Flag () { + } + + /// + /// Construct flag with specified value + /// + /// The flag value to set + public _Flag (string Value) { + Default(Value); + } + + /// + /// The flag value. + /// + public virtual bool Value { get; set; } + + /// + /// Set tag value from parameter. + /// + /// The values true and 1 set a true value, 0 and false set a false value. + /// Otherwise an exception is thrown. + public override void Parameter (string Text) { + //Text = (Text == null) ? "true" : Text; + switch (Text.ToLower()) { + case "true": + case "1": { + Value = true; + break; + } + case "false": + case "0": { + Value = false; + break; + } + case "": { + break; + } + default: + throw new System.Exception("Flag value not recognized" + Text); + } + } + + /// + /// Set the negated flag + /// + /// If true, command is negated. + public override void SetFlag (bool Negated) { + Parameter (Negated ? "false" : "true"); + ByDefault = false; + } + + /// + /// Convert value to string. + /// + /// the string value + public override string ToString () { + return Text; + } + + + + } + + + /// + /// Command line flag for file. + /// + public abstract class _File : Goedel.Command.Type { + /// + /// Default constructor + /// + public _File () { + } + + /// + /// Constructor with specified default value. + /// + /// The default value text for this entry + public _File (string Value) { + Default(Value); + } + + /// + /// The default extension. + /// + public string Extension = ""; + + /// + /// Set the default. + /// + /// The default value text for this entry + public override void Default (string TextIn) { + Extension = TextIn; + } + + /// + /// The value. + /// + public string Value => Text; + + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// File name. + public string DefaultFile (_File Source) { + return DefaultFile(Source.Text); + } + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// The extension. + /// File name. + public string DefaultFile (string Source, string Extension = null) { + Extension = Extension ?? this.Extension; + + Text = FileTools.DefaultFile(Extension, Source); + return Text; + } + + + + + } + + /// + /// Command line flag for file. + /// + public abstract class _NewFile : _File { + bool Flagged = false; + + /// + /// Set the negated flag + /// + /// if true, is negated. + public override void SetFlag (bool Negated) { + Flagged = true; + } + + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public override void Default (string TextIn) { + Extension = TextIn; + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The completed data + public override void Complete (Type[] Data) { + if (!ByDefault | !Flagged) { + return; // not flagged or explicitly set + } + + var Source = Get(Data); + if (Source != null) { + Parameter(DefaultFile(Source)); + } + + } + + + _ExistingFile Get (Type[] Data) { + foreach (var Entry in Data) { + if (Entry as _ExistingFile != null) { + return Entry as _ExistingFile; + } + } + return null; + } + } + + /// + /// Command line flag for file. + /// + public abstract class _ExistingFile : _File { + + } + + /// + /// Command line flag for file. + /// + public abstract class _Integer : Type { + + /// + /// Return the value as an integer + /// + public int Value { + get { + if (Text == "") { + return 0; + } + if (int.TryParse(Text, out var Result)) { + return Result; + } + throw new InvalidOption(); + } + } + } + + /// + /// Command line flag for file. + /// + public abstract class _String : Type { + /// + /// The value. + /// + public string Value => Text; + + } + + } diff --git a/MakeyMakey/TestSolution/CoreConsole/VS.Make b/MakeyMakey/TestSolution/CoreConsole/VS.Make new file mode 100644 index 000000000..cc1173a9e --- /dev/null +++ b/MakeyMakey/TestSolution/CoreConsole/VS.Make @@ -0,0 +1,52 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = \ + CommandLex.cs\ + CommandSplit.cs\ + Exceptions.cs\ + Main.cs + +CommandLex.fsm : CommandLex.cs + fsrgen CommandLex.fsm CommandLex.cs + +CommandSplit.fsm : CommandSplit.cs + fsrgen CommandSplit.fsm CommandSplit.cs + +Exceptions.exceptional : Exceptions.cs + exceptional Exceptions.exceptional Exceptions.cs + +Main.command : Main.cs + commandparse Main.command Main.cs + + +prebuildRecurse : + +postbuildRecurse : + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/App.config b/MakeyMakey/TestSolution/FrameworkLibrary/App.config new file mode 100644 index 000000000..016d28fcc --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Command.cs b/MakeyMakey/TestSolution/FrameworkLibrary/Command.cs new file mode 100644 index 000000000..cd0a2eb28 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Command.cs @@ -0,0 +1,437 @@ +using Goedel.Utilities; +using System; +using System.Collections.Generic; + +namespace Goedel.Command { + + /// + /// Delegate calling a dispatch routine. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public delegate void HandleDelegate (DispatchShell Dispatch, string[] args, int index); + + + /// + /// Base class for command line interpreters + /// + public abstract class CommandLineInterpreterBase { + + + ///// The command entries + //public static SortedDictionary Entries; + ///// The default command. + //public static DescribeCommandEntry DefaultCommand; + ///// Description of the comman + //public static string Description = ""; + + /// The default flag indicator for display to terminal, this is a forward slash / for Windows + /// and a double dash -- for UNIX. + public static char FlagIndicator = '/'; + + ///// + ///// Provide the summary of the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void Brief (DispatchShell Dispatch, string[] args, int index) { + // Brief(); + // } + + ///// + ///// Describe the application invoked by the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void About (DispatchShell Dispatch, string[] args, int index) { + // FileTools.About(); + // } + + + /// + /// Provide the summary of the command. + /// + public static void Brief ( + string Description, + DescribeCommandEntry DefaultCommand, + SortedDictionary Entries) { + Console.WriteLine(Description); + Console.WriteLine(""); + + if (DefaultCommand != null) { + DefaultCommand.Describe(FlagIndicator); + + } + foreach (var Entry in Entries) { + if (!Entry.Value.IsDefault) { // BUG: Is not doing the right thing here. + Entry.Value.Describe(FlagIndicator); + } + } + } + + /// + /// Process command options. + /// + /// The command line arguments. + /// The first unparsed argument. + /// The option values to set. + public static void ProcessOptions (string[] Args, int Index, Dispatch Options) { + var Describe = Options.DescribeCommand; + var CommandLex = new CommandLex(); + + var Parameter = 0; + + // Set all data slots to their default value + foreach (var Description in Describe.Entries) { + if (Description.Default != null) { + Options._Data[Description.Index].Default(Description.Default); + } + } + + for (var i = Index; i < Args.Length; i++) { + var Arg = Args[i]; + var Token = CommandLex.GetToken(Arg); + + switch (Token) { + case CommandLex.Token.Empty: { + break; + } + case CommandLex.Token.Flag: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; + Assert.NotNull(Entry, UnknownOption.Throw); + var Data = Options._Data[Entry.Index]; + if ((i + 1 < Args.Length) && !IsFlagged(Args[i + 1])) { + i++; + Arg = Args[i]; + + SetValue(Data, Args[i]); + } + Data.SetFlag(CommandLex.Not); + + if (Data as _Flag != null) { + (Data as _Flag).Value = !CommandLex.Not; + Data.ByDefault = false; + } + break; + } + case CommandLex.Token.FlagValue: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; ; + Assert.NotNull(Entry, UnknownOption.Throw); + + SetValue(Options._Data[Entry.Index], CommandLex.Value); + + break; + } + case CommandLex.Token.Value: { + var Search = true; + for (var j = Parameter; Search & j < Describe.Entries.Count; j++) { + if (Describe.Entries[j] is DescribeEntryParameter) { + DescribeEntryParameter Entry = Describe.Entries[j] as DescribeEntryParameter; + SetValue(Options._Data[Entry.Index], CommandLex.Value); + Parameter = j + 1; + Search = false; + } + + + + //switch (Describe.Entries[j]) { + // case DescribeEntryParameter Entry: { + // SetValue(Options._Data[Entry.Index], CommandLex.Value); + // Parameter = j+1; + // Search = false; + // break; + // } + // } + } + break; + } + } + } + foreach (var Entry in Options._Data) { + Entry.Complete(Options._Data); + } + } + + static void SetValue (Type Data, string Value) { + Data.Parameter(Value); // Hack: consolidate + Data.ByDefault = false; // Has been set explicitly + } + + static DescribeEntry Match (List Entries, string Flag) { + foreach (var Entry in Entries) { + if (Entry.Key.ToLower() == Flag.ToLower()) { + return Entry; + } + } + return null; + } + + /// + /// Describe the values in an command. + /// + /// The command to describe. + public static void DescribeValues (Dispatch Dispatch) { + // NYI: This may not be required. + } + + /// + /// Return true iff the text value is flagged. + /// + /// Text to test. + /// Result of the test. + public static bool IsFlagged (string Text) { + if (Text == null) { + return false; + } + if (Text.Length <= 0) { + return false; + } + return Text[0] == '-' | Text[0] == '/'; + } + + /// + /// The main dispatch point + /// + /// Dictionary describing the shell commands and dispatchers. + /// The default command entry + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public void Dispatcher (SortedDictionary Entries, + DescribeCommandEntry DefaultCommand, + DispatchShell Dispatch, string[] Args, int Index) { + // NYI: This should really be set up to take a Command set description + // as the input. + + if (Args.Length == 0) { + Assert.NotNull(DefaultCommand, UnknownCommand.Throw); + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + Assert.True(Index < Args.Length, UnknownCommand.Throw); + + var Arg = Args[Index]; + Assert.True(Arg.Length > 0, UnknownCommand.Throw); // Should never happen. + var Flagged = IsFlagged(Arg); + var Command = Flagged ? Arg.Substring(1).ToLower() : Arg.ToLower(); + + if (DefaultCommand != null & !Flagged) { + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + // NYI: no, it could be a default command and an option. + Assert.True(Entries.TryGetValue(Command, out var DescribeCommand), UnknownCommand.Throw); + if (DescribeCommand is DescribeCommandEntry) { + var DescribeCommandEntry = DescribeCommand as DescribeCommandEntry; + DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + } + else if (DescribeCommand is DescribeCommandSet) { + var DescribeCommandSet = DescribeCommand as DescribeCommandSet; + Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + } + + //switch (DescribeCommand) { + + // case DescribeCommandEntry DescribeCommandEntry: { + // DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + // break; + // } + // case DescribeCommandSet DescribeCommandSet: { + // Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + // break; + // } + // } + + } + } + + + /// + /// Describe a command or parameter entry + /// + public abstract class DescribeEntry { + /// The identifier name. + public string Identifier { get; set; } + /// Brief description + public string Brief { get; set; } + /// The default value (if specified) + public string Default { get; set; } + /// The command line key. + public string Key { get; set; } + /// The position in the options array. + public int Index { get; set; } // Index into array of Type + } + + /// + /// Describe a command set. + /// + public abstract class DescribeCommand : DescribeEntry { + + /// If true, this is the default command. + public bool IsDefault = false; + + /// + /// Describe the command set. + /// + /// The flag indicator to use when printing the description. + public abstract void Describe (char FlagIndicator); + } + + /// + /// Describe a command entry + /// + public class DescribeCommandEntry : DescribeCommand { + + /// Delegate to dispatch if command is selected. + public HandleDelegate HandleDelegate { get; set; } + + /// If true perform lezy evaluation of parameters. + public bool Lazy { get; set; } = false; + + /// The command entries. + public List Entries { get; set; } + + /// + /// Get the default for the value. + /// + /// The tag text + /// The default value if it exists, null otherwise. + public string GetDefault (string Tag) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + return Entry.Default; + } + } + return null; + } + + /// + /// Set the default value for the tag + /// + /// The tag text + /// The value to set as the default. + public void SetDefault (string Tag, string Default) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + Entry.Default = Default; + } + } + + } + + /// + /// Describe the command to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}{1}", FlagIndicator, Identifier); + foreach (var Entry in Entries) { + + if (Entry is DescribeCommandEntry) { + var SubCommand = Entry as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry is DescribeEntryParameter) { + var Parameter = Entry as DescribeEntryParameter; + Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + } + else if (Entry is DescribeEntryOption) { + var Option = Entry as DescribeEntryOption; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + } + + + //switch (Entry) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeEntryParameter Parameter: { + // Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + // break; + // } + //case DescribeEntryOption Option: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + // break; + // } + //} + } + } + + + } + + /// + /// Describe a command set. + /// + public class DescribeCommandSet : DescribeCommand { + + /// Dictionary of command entries. + public SortedDictionary Entries; + + /// + /// Describe the command set to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}", Identifier); + foreach (var Entry in Entries) { + + if (Entry.Value is DescribeCommandEntry) { + var SubCommand = Entry.Value as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry.Value is DescribeCommandSet) { + var Parameter = Entry.Value as DescribeCommandSet; + Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + } + + + //switch (Entry.Value) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeCommandSet Parameter: { + // Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + // break; + // } + + //} + } + } + } + + /// + /// Describe an entry value. + /// + public class DescribeEntryValue : DescribeEntry { + + } + + /// + /// Describe an option value. + /// + public class DescribeEntryOption : DescribeEntryValue { + } + + /// + /// Describe a parameter value. + /// + public class DescribeEntryParameter : DescribeEntryValue { + } + + /// + /// Describe a shell. + /// + public abstract class DispatchShell : Dispatch{ + + } + + + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.cs b/MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.cs new file mode 100644 index 000000000..05af94f98 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.cs @@ -0,0 +1,174 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandLex { + public virtual void Reset (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddFlag (int c) { + } + public virtual void AddFlagN (int c) { + } + public virtual void AddFlagNo (int c) { + } + public virtual void Abort (int c) { + } + } + */ + + public partial class CommandLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// IsValue + IsValue = 1, + /// StartFlag + StartFlag = 2, + /// IsFlag + IsFlag = 3, + /// IsFlagN + IsFlagN = 4, + /// IsFlagNo + IsFlagNo = 5, + /// StartFlagValue + StartFlagValue = 6, + /// IsFlagValue + IsFlagValue = 7, + /// Fail + Fail = 8 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1, + /// Flag + Flag = 2, + /// FlagValue + FlagValue = 3 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 2 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 3 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {1 , 8 , 2 , 1 , 1 , 1 }, + {1 , 1 , 1 , 1 , 1 , 1 }, + {3 , 3 , 3 , 3 , 4 , 3 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {3 , 3 , 3 , 6 , 3 , 5 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {-2 , -2 , -2 , -2 , -2 , -2 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Flag, + Token.Flag, + Token.Flag, + Token.Flag, + Token.FlagValue, + Token.FlagValue, + Token.Empty + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + Reset, + AddValue, + Ignore, + AddFlag, + AddFlagN, + AddFlagNo, + Ignore, + AddValue, + Abort + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.fsm b/MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.fsm new file mode 100644 index 000000000..f2bd4de77 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/CommandLex.fsm @@ -0,0 +1,46 @@ +FSR Goedel.Command CommandLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "example.file" + Token Flag "/flag" + Token FlagValue "/flag:example.file" + + + + State ItemStart Reset Empty // Start of file + On " \t\n" GoTo Fail + On "/-" GoTo StartFlag + Any GoTo IsValue + + State IsValue AddValue Value + Any GoTo IsValue + + State StartFlag Ignore Flag + On "Nn" GoTo IsFlagN + Any GoTo IsFlag + + State IsFlag AddFlag Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagN AddFlagN Flag + On "Oo" GoTo IsFlagNo + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagNo AddFlagNo Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State StartFlagValue Ignore FlagValue + Any GoTo IsFlagValue + + State IsFlagValue AddValue FlagValue + Any GoTo IsFlagValue + + State Fail Abort Empty + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/CommandLexPlus.cs b/MakeyMakey/TestSolution/FrameworkLibrary/CommandLexPlus.cs new file mode 100644 index 000000000..a11698372 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/CommandLexPlus.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Lexical analyzer for command line parsing. + /// + public partial class CommandLex { + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The data to parse + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public string Value => BuildValue.ToString(); + + /// + /// Return the resulting string value + /// + public string Flag => BuildFlag.ToString(); + + /// + /// If true, flag was negated. + /// + public bool Not { get; set; } + + StringBuilder BuildValue = new StringBuilder(); + StringBuilder BuildFlag = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + BuildValue.Clear(); + BuildFlag.Clear(); + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void Reset (int c) { + Reset(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + BuildValue.Append((char)c); + } + + /// + /// Add a character to the flag buffer + /// + /// The character read + public virtual void AddFlag (int c) { + BuildFlag.Append((char)c); + } + + /// + /// N of possible NO flag + /// + /// The character read + public virtual void AddFlagN (int c) { + BuildFlag.Append((char)c); + } + + /// + /// O of possible NO flag + /// + /// The character read + public virtual void AddFlagNo (int c) { + BuildFlag.Clear(); // delete 'no' prefix + Not = true; + } + /// + /// Abort parsing, the command cannot be read. + /// + /// The character read + public virtual void Abort (int c) { + } + + + + } + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.cs b/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.cs new file mode 100644 index 000000000..7c5155154 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.cs @@ -0,0 +1,173 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandSplitLex { + public virtual void AddParam (int c) { + } + public virtual void BeginValue (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddEscape (int c) { + } + public virtual void AddEscapedValue (int c) { + } + } + */ + + public partial class CommandSplitLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// StartQuoted + StartQuoted = 1, + /// Quoted + Quoted = 2, + /// QuotedQuote + QuotedQuote = 3, + /// QuotedEscape + QuotedEscape = 4, + /// QuotedEscapeReturn + QuotedEscapeReturn = 5, + /// Unquoted + Unquoted = 6, + /// UnquotedQuote + UnquotedQuote = 7, + /// UnquotedEscape + UnquotedEscape = 8, + /// UnquotedEscapeReturn + UnquotedEscapeReturn = 9 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {6 , 0 , 1 , 8 }, + {2 , 2 , 3 , 4 }, + {2 , 2 , 3 , 4 }, + {2 , 0 , 2 , 4 }, + {5 , 5 , 5 , 4 }, + {2 , 2 , 3 , 4 }, + {6 , 0 , 7 , 8 }, + {6 , 0 , 7 , 8 }, + {9 , 0 , 9 , 8 }, + {6 , 6 , 7 , 8 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + AddParam, + BeginValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.fsm b/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.fsm new file mode 100644 index 000000000..b85742b96 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplit.fsm @@ -0,0 +1,68 @@ +FSR Goedel.Command CommandSplitLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "Parameter" + + + + State ItemStart AddParam Empty // Start of file + On " \t\n" GoTo ItemStart + On "\"" GoTo StartQuoted + On "\\" GoTo UnquotedEscape + Any GoTo Unquoted + + State StartQuoted BeginValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State Quoted AddValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedQuote Ignore Value + On " \t\n" GoTo ItemStart // An end quote + On "\"" GoTo Quoted + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedEscape AddEscape Value + On "\"" GoTo QuotedEscapeReturn + On "\\" GoTo QuotedEscape + Any GoTo QuotedEscapeReturn + + State QuotedEscapeReturn AddEscapedValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + + + + State Unquoted AddValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedQuote Ignore Value + On "\"" GoTo UnquotedQuote + On "\\" GoTo UnquotedEscape + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedEscape AddEscape Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedEscapeReturn + On " \t\n" GoTo ItemStart + Any GoTo UnquotedEscapeReturn + + State UnquotedEscapeReturn AddEscapedValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + Any GoTo Unquoted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplitLexPlus.cs b/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplitLexPlus.cs new file mode 100644 index 000000000..dd410bb7f --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/CommandSplitLexPlus.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Split a command line into parts. + /// + public partial class CommandSplitLex { + + /// + /// Split a commandline into entries. + /// + /// The command line to split. + /// The command line split into entries. + public static string[] Split (string Text) { + var CommandSplitLex = new CommandSplitLex(); + CommandSplitLex.GetToken(Text); + return CommandSplitLex.Value.ToArray(); + } + + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandSplitLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The string to parse. + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public List Value { + get { + if (Pending) { + AddParam(); + Pending = false; + } + return Arguments; + } + } + + // Private variables + bool Pending = false; // if true, there is an incomplete value to be added. + int EscapeCount = 0; + List Arguments = new List(); + StringBuilder BuildValue = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + Arguments.Clear(); + BuildValue.Clear(); + Pending = false; + EscapeCount = 0; + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void AddParam (int c) { + AddParam(); + } + + void AddParam () { + // Add any pending escape characters + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + // Add the parameter to the build string + var Text = BuildValue.ToString(); + if (Pending) { + Arguments.Add(Text); + } + // Reset all buffers + EscapeCount = 0; + BuildValue.Clear(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + + /// + /// Start a quoted parameter, this can be null + /// + /// The character read + public virtual void BeginValue (int c) { + Pending = true; + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + EscapeCount = 0; + Pending = true; + BuildValue.Append((char)c); + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddEscape (int c) { + Pending = true; + EscapeCount++; + } + + /// + /// Add a sequence of escape characters to the value buffer. If the final character is not + /// a double quote, the escape characters are simply added. Otherwise, each pair of escape + /// characters results in a single escape character and a double quote is added if the number + /// of escape characters is odd. + /// + /// The character read + public virtual void AddEscapedValue (int c) { + + if (c == '\"') { + while (EscapeCount > 1) { + EscapeCount -= 2; + BuildValue.Append('\\'); + } + if (EscapeCount == 1) { + BuildValue.Append('\"'); + } + } + else { + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + BuildValue.Append((char)c); + } + EscapeCount = 0; + + } + + } + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Dispatch.cs b/MakeyMakey/TestSolution/FrameworkLibrary/Dispatch.cs new file mode 100644 index 000000000..a506003bf --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Dispatch.cs @@ -0,0 +1,19 @@ +using System; + +namespace Goedel.Command { + /// Track start and end time of parse. + public abstract class Dispatch { + /// Record start time. + public DateTime Started = DateTime.Now; + + /// Calculate elapsed time. + public TimeSpan Elapsed => DateTime.Now - Started; + + /// Command type data + public virtual Type[] _Data { get; set; } + + /// Command description + public virtual DescribeCommandEntry DescribeCommand { get; set; } + } + + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.Exceptional b/MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.Exceptional new file mode 100644 index 000000000..0220f6994 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.Exceptional @@ -0,0 +1,41 @@ + +Namespace Goedel.Command + + Exception ParserException + Console "The user command could not be parsed" + Description + |The user command could not be parsed + + Exception FileReadError + Console "The file could not be read" + Description + |The file could not be read. + + Object ExceptionData "The file {0} could not be read" + String + + Exception UnknownCommand + Console "Unknown command" + Description + |User entered an unknown command + + Object ExceptionData "The command {0} is not known." + String + + Exception UnknownOption + Console "Unknown option" + Description + |User entered an unknown option + + Object ExceptionData "The option {0} is not known." + String + + Exception NoCommand + Console "No command specified" + Description + |No command specified + + Exception InvalidOption + Console "The option value was incorrectly formatted" + Description + |The option value was incorrectly formatted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.cs b/MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.cs new file mode 100644 index 000000000..7f51389f4 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Exceptions.cs @@ -0,0 +1,373 @@ +using System; +using Goedel.Utilities; + + + +namespace Goedel.Command { + + + /// + /// The user command could not be parsed + /// + public class ParserException : global::System.Exception { + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + public ParserException () : base ("The user command could not be parsed") { + } + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + /// Description of the error + public ParserException (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public ParserException (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + /// + /// User data associated with the exception. + /// + public object UserData; + + + + + /// + /// The public fatory delegate + /// + public static global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new ParserException(Reason as string); + } + else { + return new ParserException(); + } + } + } + + + /// + /// The file could not be read. + /// + public class FileReadError : ParserException { + + /// + /// Construct instance for exception "The file could not be read" + /// + public FileReadError () : base ("The file could not be read") { + } + + /// + /// Construct instance for exception "The file could not be read" + /// + /// Description of the error + public FileReadError (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public FileReadError (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + public FileReadError (ExceptionData Object) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + /// Inner Exception + public FileReadError (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new FileReadError(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new FileReadError(Reason as ExceptionData); + } + else { + return new FileReadError(); + } + } + } + + + /// + /// User entered an unknown command + /// + public class UnknownCommand : ParserException { + + /// + /// Construct instance for exception "Unknown command" + /// + public UnknownCommand () : base ("Unknown command") { + } + + /// + /// Construct instance for exception "Unknown command" + /// + /// Description of the error + public UnknownCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + public UnknownCommand (ExceptionData Object) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownCommand (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownCommand(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownCommand(Reason as ExceptionData); + } + else { + return new UnknownCommand(); + } + } + } + + + /// + /// User entered an unknown option + /// + public class UnknownOption : ParserException { + + /// + /// Construct instance for exception "Unknown option" + /// + public UnknownOption () : base ("Unknown option") { + } + + /// + /// Construct instance for exception "Unknown option" + /// + /// Description of the error + public UnknownOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + public UnknownOption (ExceptionData Object) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownOption (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownOption(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownOption(Reason as ExceptionData); + } + else { + return new UnknownOption(); + } + } + } + + + /// + /// No command specified + /// + public class NoCommand : ParserException { + + /// + /// Construct instance for exception "No command specified" + /// + public NoCommand () : base ("No command specified") { + } + + /// + /// Construct instance for exception "No command specified" + /// + /// Description of the error + public NoCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public NoCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new NoCommand(Reason as string); + } + else { + return new NoCommand(); + } + } + } + + + /// + /// The option value was incorrectly formatted + /// + public class InvalidOption : ParserException { + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + public InvalidOption () : base ("The option value was incorrectly formatted") { + } + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + /// Description of the error + public InvalidOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public InvalidOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new InvalidOption(Reason as string); + } + else { + return new InvalidOption(); + } + } + } + + + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/FileTools.cs b/MakeyMakey/TestSolution/FrameworkLibrary/FileTools.cs new file mode 100644 index 000000000..335f9c6d1 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/FileTools.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Goedel.Registry; + +namespace Goedel.Command { + + + /// + /// Utility class for managing files. + /// + public class FileTools { + + + /// + /// Get the time at which the specified file was created + /// Return DateTime.MinValue if the file does not exist + /// + /// The file to test + /// The time the file was created. + public static DateTime GetFileDateTime(string FileName) { + if (!File.Exists(FileName)) { + return DateTime.MinValue; + } + return File.GetLastWriteTimeUtc(FileName); + } + + /// + /// Write short form description of the current program to the console. + /// + public static void About() { + DateTime CompilationDate = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + + string Build = Script.LocalizeTime(CompilationDate, false); + + + Console.WriteLine(Script.AssemblyTitle); + Console.WriteLine(" {0}", Script.AssemblyDescription); + Console.WriteLine(" CopyRight : {0} {1}", Script.AssemblyCopyright, Script.AssemblyCompany); + Console.WriteLine(" Version : {0}", Script.AssemblyVersion); + Console.WriteLine(" Compiled : {0}", Build); + } + + /// + /// Cehck to see if a Destination file is more recent than a source file. + /// + /// The source file. + /// The destination file. + /// True if the source was created before the destination. + public static bool UpToDate(string Source, string Destination) { + + DateTime OutputDateTime = FileTools.GetFileDateTime(Destination); + if (OutputDateTime == DateTime.MinValue) { + return false; + } + DateTime ToolDateTime = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + if (OutputDateTime < ToolDateTime) { + return false; + } + DateTime SourceDateTime = FileTools.GetFileDateTime(Source); + return (OutputDateTime > SourceDateTime); + } + + /// + /// Determine output file name using command line entry and default data. + /// + /// The default extension. + /// The base file name. + /// The defaulted output file. + public static string DefaultFile(string Extension, string Default) { + return Path.GetFileNameWithoutExtension(Default) + "." + Extension; + } + + + // + // Search for a file. + // + // If FileName exists, use that, otherwise try FileName.Extension + // + + /// + /// Search for a file using specified extension if required. + /// + /// The base file name. + /// Default extension. + /// The defaulted file. + public static string DefaultExtension(string FileName, string Extension) { + if (File.Exists(FileName)) { + return FileName; + } + + return FileName + "." + Extension; + } + + /// + /// Calculate output file name. + /// + /// The source file path + /// The destination file path. + /// The default extension. + /// The defaulted file name. + public static string DefaultOutput(string SourcePath, string DestinationPath, + string Extension) { + if (DestinationPath != null) { + return DestinationPath; + } + return Path.GetFileNameWithoutExtension(SourcePath) + "." + Extension; + } + } + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/FrameworkLibrary.csproj b/MakeyMakey/TestSolution/FrameworkLibrary/FrameworkLibrary.csproj new file mode 100644 index 000000000..4486ef722 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/FrameworkLibrary.csproj @@ -0,0 +1,95 @@ + + + + + Debug + AnyCPU + {B003A172-61D1-40DC-96A8-28B760D5CDC1} + Exe + FrameworkLibrary + FrameworkLibrary + v4.7 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + CommandLex.fsm + True + True + + + + CommandSplit.fsm + True + True + + + + + Exceptions.Exceptional + True + True + + + + True + True + Main.command + + + + + + + + + fsrcs + CommandLex.cs + + + fsrcs + CommandSplit.cs + + + exceptional + Exceptions.cs + + + CommandCS + Main.cs + + + + + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Main.command b/MakeyMakey/TestSolution/FrameworkLibrary/Main.command new file mode 100644 index 000000000..dce9549fc --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Main.command @@ -0,0 +1,20 @@ +Class DomainerShell DomainerShell + Brief "Manage DNS Resource and Query Records" + + Type NewFile "file" + Type ExistingFile "file" + Type Flag "flag" + + About "about" + + Command GenerateDomainer "in" + DefaultCommand + + Lazy Lazy "lazy" + Brief "Only generate code if source or generator have changed" + + Parser Goedel.Tool.Domainer Domainer "domainer" + + Script Goedel.Tool.Domainer Generate GenerateCS "cs" + Brief "Generate C# code" + Default "cs" diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Main.cs b/MakeyMakey/TestSolution/FrameworkLibrary/Main.cs new file mode 100644 index 000000000..d60180c7a --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Main.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.Command; +using Goedel.Registry; +using Goedel.Utilities; + +namespace DomainerShell { + public partial class CommandLineInterpreter : CommandLineInterpreterBase { + + /// The command entries + public static SortedDictionary Entries; + /// The default command. + public static DescribeCommandEntry DefaultCommand; + /// Description of the comman + public static string Description = ""; + + static char UnixFlag = '-'; + static char WindowsFlag = '/'; + + + /// + /// + /// + /// + /// + /// + public static void Help (DispatchShell Dispatch, string[] args, int index) { + Brief(Description, DefaultCommand, Entries); + } + + public static DescribeCommandEntry DescribeHelp = new DescribeCommandEntry() { + Identifier = "help", + HandleDelegate = Help, + Entries = new List() { } + }; + + /// + /// Describe the application invoked by the command. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public static void About (DispatchShell Dispatch, string[] args, int index) { + FileTools.About(); + } + + public static DescribeCommandEntry DescribeAbout = new DescribeCommandEntry() { + Identifier = "about", + HandleDelegate = About, + Entries = new List() { } + }; + + static bool IsFlag(char c) { + return (c == UnixFlag) | (c == WindowsFlag) ; + } + + + static CommandLineInterpreter () { + System.OperatingSystem OperatingSystem = System.Environment.OSVersion; + + if (OperatingSystem.Platform == PlatformID.Unix | + OperatingSystem.Platform == PlatformID.MacOSX) { + FlagIndicator = UnixFlag; + } + else { + FlagIndicator = WindowsFlag; + } + + DefaultCommand = _GenerateDomainer._DescribeCommand; + Description = "Manage DNS Resource and Query Records"; + + Entries = new SortedDictionary () { + {"about", DescribeAbout }, + {"in", _GenerateDomainer._DescribeCommand }, + {"help", DescribeHelp } + }; // End Entries + + + + } + + static void Main(string[] args) { + var CLI = new CommandLineInterpreter (); + CLI.MainMethod (args); + } + + public void MainMethod(string[] Args) { + DomainerShell Dispatch = new DomainerShell (); + + MainMethod (Dispatch, Args); + } + + + public void MainMethod(DomainerShell Dispatch, string[] Args) { + Dispatcher (Entries, DefaultCommand, Dispatch, Args, 0); + } // Main + + + + public static void Handle_GenerateDomainer ( + DispatchShell DispatchIn, string[] Args, int Index) { + DomainerShell Dispatch = DispatchIn as DomainerShell; + GenerateDomainer Options = new GenerateDomainer (); + ProcessOptions (Args, Index, Options); + Dispatch.GenerateDomainer (Options); + } + + + } // class Main + + + // The stub class for carrying optional parameters for each command type + // As with the main class each consists of an abstract main class + // with partial virtual that can be extended as required. + + // All subclasses inherit from the abstract classes Goedel.Regisrty.Dispatch + // and Goedel.Command.Type + + + public class _GenerateDomainer : Goedel.Command.Dispatch { + + public override Goedel.Command.Type[] _Data {get; set;} = new Goedel.Command.Type [] { + new Flag (), + new ExistingFile (), + new NewFile () } ; + + /// Field accessor for parameter [lazy] + public virtual Flag Lazy { + get => _Data[0] as Flag; + set => _Data[0] = value; + } + + public virtual string _Lazy { + set => _Data[0].Parameter (value); + } + /// Field accessor for parameter [] + public virtual ExistingFile Domainer { + get => _Data[1] as ExistingFile; + set => _Data[1] = value; + } + + public virtual string _Domainer { + set => _Data[1].Parameter (value); + } + /// Field accessor for option [cs] + public virtual NewFile GenerateCS { + get => _Data[2] as NewFile; + set => _Data[2] = value; + } + + public virtual string _GenerateCS { + set => _Data[2].Parameter (value); + } + public override DescribeCommandEntry DescribeCommand {get; set;} = _DescribeCommand; + + public static DescribeCommandEntry _DescribeCommand = new DescribeCommandEntry () { + Identifier = "in", + Brief = "", + HandleDelegate = CommandLineInterpreter.Handle_GenerateDomainer, + Lazy = true, + Entries = new List () { + new DescribeEntryParameter () { + Identifier = "Domainer", + Default = null, // null if null + Brief = "", + Index = 1, + Key = "" + }, + new DescribeEntryOption () { + Identifier = "GenerateCS", + Default = "cs", // null if null + Brief = "Generate C# code", + Index = 2, + Key = "cs" + } + } + }; + + } + + public partial class GenerateDomainer : _GenerateDomainer { + } // class GenerateDomainer + + + public partial class NewFile : _NewFile { + public static NewFile Factory (string Value) { + var Result = new NewFile(); + Result.Default(Value); + return Result; + } + } // NewFile + + + public partial class ExistingFile : _ExistingFile { + public static ExistingFile Factory (string Value) { + var Result = new ExistingFile(); + Result.Default(Value); + return Result; + } + } // ExistingFile + + + public partial class Flag : _Flag { + public static Flag Factory (string Value) { + var Result = new Flag(); + Result.Default(Value); + return Result; + } + } // Flag + + + + // The stub class just contains routines that echo their arguments and + // write 'not yet implemented' + + // Eventually there will be a compiler option to suppress the debugging + // to eliminate the redundant code + public class _DomainerShell : global::Goedel.Command.DispatchShell { + + public virtual void GenerateDomainer ( GenerateDomainer Options) { + string inputfile = null; + + inputfile = Options.Domainer.Text; + + Goedel.Tool.Domainer.Domainer Parse = new Goedel.Tool.Domainer.Domainer() { + }; + + + using (Stream infile = + new FileStream(inputfile, FileMode.Open, FileAccess.Read)) { + + Lexer Schema = new Lexer(inputfile); + + Schema.Process(infile, Parse); + } + + + // Script output of type GenerateCS cs + if (Options.GenerateCS.Text != null) { + string outputfile = Options.GenerateCS.Text; // Automatically defaults + if (Options.Lazy.Value & FileTools.UpToDate (inputfile, outputfile)) { + return; + } + using (Stream outputStream = + new FileStream(outputfile, FileMode.Create, FileAccess.Write)) { + using (TextWriter OutputWriter = new StreamWriter(outputStream, Encoding.UTF8)) { + + Goedel.Tool.Domainer.Generate Script = new Goedel.Tool.Domainer.Generate (OutputWriter); + + Script.GenerateCS (Parse); + } + } + } + } + + + } // class _DomainerShell + + public partial class DomainerShell : _DomainerShell { + } // class DomainerShell + + } // namespace DomainerShell + + diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/NamespaceDoc.cs b/MakeyMakey/TestSolution/FrameworkLibrary/NamespaceDoc.cs new file mode 100644 index 000000000..c306a76b5 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/NamespaceDoc.cs @@ -0,0 +1,11 @@ +namespace Goedel.Command { + + /// + /// Support routines for command line parsers defined using the PHB Command tool. + /// + + [System.Runtime.CompilerServices.CompilerGenerated] + class NamespaceDoc { + } + + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Parse.md b/MakeyMakey/TestSolution/FrameworkLibrary/Parse.md new file mode 100644 index 000000000..d86aabb9b --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Parse.md @@ -0,0 +1,15 @@ + // split a command line into chunks applying windows command line escaping rules + // + // one two -> [one] [two] + // "one two" -> [one two] + // "one"two" -> [onetwo] + // "one""two" -> [one"two] + // \\ -> [\\] + // \\" -> [\"] + // \\" \\ -> [\ \\] + // \\\" \\ -> [\"] [\\] + // "Test""Here" -> [TestHere] + // Test""Here -> [Test"Here]] + + + "" Test-> [] [Test] \ No newline at end of file diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Properties/AssemblyInfo.cs b/MakeyMakey/TestSolution/FrameworkLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..44aca5827 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FrameworkLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FrameworkLibrary")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b003a172-61d1-40dc-96a8-28b760d5cdc1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/Type.cs b/MakeyMakey/TestSolution/FrameworkLibrary/Type.cs new file mode 100644 index 000000000..df5dfc1db --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/Type.cs @@ -0,0 +1,293 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.Registry; + +namespace Goedel.Command { + /// Base class for Command line parser types. This could do with + /// some decrufting to remove implementation artifacts. + public abstract class Type { + + /// The command line value. + public virtual string Text { get; set; } + + /// If true, the value was set by default + public bool ByDefault { get; set; } = true; + + /// + /// Convert value to string. + /// + /// The string value. + public override string ToString () { + return Text; + } + + /// + /// Set parameter text. + /// + /// Text to set. + public virtual void Parameter (string TextIn) { + Text = TextIn; + } + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public virtual void Default (string TextIn) { + Parameter(TextIn); + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The final data. + public virtual void Complete (Type[] Data) { + } + + /// + /// Set the flag value. + /// + /// If true, flag is negated. + public virtual void SetFlag (bool Negated) { + } + + } + + /// + /// Command line boolean type for flags. + /// + public abstract class _Flag : Goedel.Command.Type { + + /// The canonical command line value. + public override string Text { + get => Value ? "true" : "false"; + set => Parameter(value); + } + + /// + /// Default constructor + /// + public _Flag () { + } + + /// + /// Construct flag with specified value + /// + /// The flag value to set + public _Flag (string Value) { + Default(Value); + } + + /// + /// The flag value. + /// + public virtual bool Value { get; set; } + + /// + /// Set tag value from parameter. + /// + /// The values true and 1 set a true value, 0 and false set a false value. + /// Otherwise an exception is thrown. + public override void Parameter (string Text) { + //Text = (Text == null) ? "true" : Text; + switch (Text.ToLower()) { + case "true": + case "1": { + Value = true; + break; + } + case "false": + case "0": { + Value = false; + break; + } + case "": { + break; + } + default: + throw new System.Exception("Flag value not recognized" + Text); + } + } + + /// + /// Set the negated flag + /// + /// If true, command is negated. + public override void SetFlag (bool Negated) { + Parameter (Negated ? "false" : "true"); + ByDefault = false; + } + + /// + /// Convert value to string. + /// + /// the string value + public override string ToString () { + return Text; + } + + + + } + + + /// + /// Command line flag for file. + /// + public abstract class _File : Goedel.Command.Type { + /// + /// Default constructor + /// + public _File () { + } + + /// + /// Constructor with specified default value. + /// + /// The default value text for this entry + public _File (string Value) { + Default(Value); + } + + /// + /// The default extension. + /// + public string Extension = ""; + + /// + /// Set the default. + /// + /// The default value text for this entry + public override void Default (string TextIn) { + Extension = TextIn; + } + + /// + /// The value. + /// + public string Value => Text; + + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// File name. + public string DefaultFile (_File Source) { + return DefaultFile(Source.Text); + } + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// The extension. + /// File name. + public string DefaultFile (string Source, string Extension = null) { + Extension = Extension ?? this.Extension; + + Text = FileTools.DefaultFile(Extension, Source); + return Text; + } + + + + + } + + /// + /// Command line flag for file. + /// + public abstract class _NewFile : _File { + bool Flagged = false; + + /// + /// Set the negated flag + /// + /// if true, is negated. + public override void SetFlag (bool Negated) { + Flagged = true; + } + + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public override void Default (string TextIn) { + Extension = TextIn; + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The completed data + public override void Complete (Type[] Data) { + if (!ByDefault | !Flagged) { + return; // not flagged or explicitly set + } + + var Source = Get(Data); + if (Source != null) { + Parameter(DefaultFile(Source)); + } + + } + + + _ExistingFile Get (Type[] Data) { + foreach (var Entry in Data) { + if (Entry as _ExistingFile != null) { + return Entry as _ExistingFile; + } + } + return null; + } + } + + /// + /// Command line flag for file. + /// + public abstract class _ExistingFile : _File { + + } + + /// + /// Command line flag for file. + /// + public abstract class _Integer : Type { + + /// + /// Return the value as an integer + /// + public int Value { + get { + if (Text == "") { + return 0; + } + if (int.TryParse(Text, out var Result)) { + return Result; + } + throw new InvalidOption(); + } + } + } + + /// + /// Command line flag for file. + /// + public abstract class _String : Type { + /// + /// The value. + /// + public string Value => Text; + + } + + } diff --git a/MakeyMakey/TestSolution/FrameworkLibrary/VS.Make b/MakeyMakey/TestSolution/FrameworkLibrary/VS.Make new file mode 100644 index 000000000..f5841ac45 --- /dev/null +++ b/MakeyMakey/TestSolution/FrameworkLibrary/VS.Make @@ -0,0 +1,52 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = \ + CommandLex.cs\ + CommandSplit.cs\ + Exceptions.cs\ + Main.cs + +CommandLex.fsm : CommandLex.cs + fsrgen CommandLex.fsm CommandLex.cs + +CommandSplit.fsm : CommandSplit.cs + fsrgen CommandSplit.fsm CommandSplit.cs + +Exceptions.Exceptional : Exceptions.cs + exceptional Exceptions.Exceptional Exceptions.cs + +Main.command : Main.cs + commandparse Main.command Main.cs + + +prebuildRecurse : + +postbuildRecurse : + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/TestSolution/Properties/AssemblyInfo.cs b/MakeyMakey/TestSolution/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..f7decd9cf --- /dev/null +++ b/MakeyMakey/TestSolution/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BuildProject")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BuildProject")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1f4b83f8-b03a-4a5c-87cb-74524a7379f6")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MakeyMakey/TestSolution/SharedProject/Command.cs b/MakeyMakey/TestSolution/SharedProject/Command.cs new file mode 100644 index 000000000..cd0a2eb28 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Command.cs @@ -0,0 +1,437 @@ +using Goedel.Utilities; +using System; +using System.Collections.Generic; + +namespace Goedel.Command { + + /// + /// Delegate calling a dispatch routine. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public delegate void HandleDelegate (DispatchShell Dispatch, string[] args, int index); + + + /// + /// Base class for command line interpreters + /// + public abstract class CommandLineInterpreterBase { + + + ///// The command entries + //public static SortedDictionary Entries; + ///// The default command. + //public static DescribeCommandEntry DefaultCommand; + ///// Description of the comman + //public static string Description = ""; + + /// The default flag indicator for display to terminal, this is a forward slash / for Windows + /// and a double dash -- for UNIX. + public static char FlagIndicator = '/'; + + ///// + ///// Provide the summary of the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void Brief (DispatchShell Dispatch, string[] args, int index) { + // Brief(); + // } + + ///// + ///// Describe the application invoked by the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void About (DispatchShell Dispatch, string[] args, int index) { + // FileTools.About(); + // } + + + /// + /// Provide the summary of the command. + /// + public static void Brief ( + string Description, + DescribeCommandEntry DefaultCommand, + SortedDictionary Entries) { + Console.WriteLine(Description); + Console.WriteLine(""); + + if (DefaultCommand != null) { + DefaultCommand.Describe(FlagIndicator); + + } + foreach (var Entry in Entries) { + if (!Entry.Value.IsDefault) { // BUG: Is not doing the right thing here. + Entry.Value.Describe(FlagIndicator); + } + } + } + + /// + /// Process command options. + /// + /// The command line arguments. + /// The first unparsed argument. + /// The option values to set. + public static void ProcessOptions (string[] Args, int Index, Dispatch Options) { + var Describe = Options.DescribeCommand; + var CommandLex = new CommandLex(); + + var Parameter = 0; + + // Set all data slots to their default value + foreach (var Description in Describe.Entries) { + if (Description.Default != null) { + Options._Data[Description.Index].Default(Description.Default); + } + } + + for (var i = Index; i < Args.Length; i++) { + var Arg = Args[i]; + var Token = CommandLex.GetToken(Arg); + + switch (Token) { + case CommandLex.Token.Empty: { + break; + } + case CommandLex.Token.Flag: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; + Assert.NotNull(Entry, UnknownOption.Throw); + var Data = Options._Data[Entry.Index]; + if ((i + 1 < Args.Length) && !IsFlagged(Args[i + 1])) { + i++; + Arg = Args[i]; + + SetValue(Data, Args[i]); + } + Data.SetFlag(CommandLex.Not); + + if (Data as _Flag != null) { + (Data as _Flag).Value = !CommandLex.Not; + Data.ByDefault = false; + } + break; + } + case CommandLex.Token.FlagValue: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; ; + Assert.NotNull(Entry, UnknownOption.Throw); + + SetValue(Options._Data[Entry.Index], CommandLex.Value); + + break; + } + case CommandLex.Token.Value: { + var Search = true; + for (var j = Parameter; Search & j < Describe.Entries.Count; j++) { + if (Describe.Entries[j] is DescribeEntryParameter) { + DescribeEntryParameter Entry = Describe.Entries[j] as DescribeEntryParameter; + SetValue(Options._Data[Entry.Index], CommandLex.Value); + Parameter = j + 1; + Search = false; + } + + + + //switch (Describe.Entries[j]) { + // case DescribeEntryParameter Entry: { + // SetValue(Options._Data[Entry.Index], CommandLex.Value); + // Parameter = j+1; + // Search = false; + // break; + // } + // } + } + break; + } + } + } + foreach (var Entry in Options._Data) { + Entry.Complete(Options._Data); + } + } + + static void SetValue (Type Data, string Value) { + Data.Parameter(Value); // Hack: consolidate + Data.ByDefault = false; // Has been set explicitly + } + + static DescribeEntry Match (List Entries, string Flag) { + foreach (var Entry in Entries) { + if (Entry.Key.ToLower() == Flag.ToLower()) { + return Entry; + } + } + return null; + } + + /// + /// Describe the values in an command. + /// + /// The command to describe. + public static void DescribeValues (Dispatch Dispatch) { + // NYI: This may not be required. + } + + /// + /// Return true iff the text value is flagged. + /// + /// Text to test. + /// Result of the test. + public static bool IsFlagged (string Text) { + if (Text == null) { + return false; + } + if (Text.Length <= 0) { + return false; + } + return Text[0] == '-' | Text[0] == '/'; + } + + /// + /// The main dispatch point + /// + /// Dictionary describing the shell commands and dispatchers. + /// The default command entry + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public void Dispatcher (SortedDictionary Entries, + DescribeCommandEntry DefaultCommand, + DispatchShell Dispatch, string[] Args, int Index) { + // NYI: This should really be set up to take a Command set description + // as the input. + + if (Args.Length == 0) { + Assert.NotNull(DefaultCommand, UnknownCommand.Throw); + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + Assert.True(Index < Args.Length, UnknownCommand.Throw); + + var Arg = Args[Index]; + Assert.True(Arg.Length > 0, UnknownCommand.Throw); // Should never happen. + var Flagged = IsFlagged(Arg); + var Command = Flagged ? Arg.Substring(1).ToLower() : Arg.ToLower(); + + if (DefaultCommand != null & !Flagged) { + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + // NYI: no, it could be a default command and an option. + Assert.True(Entries.TryGetValue(Command, out var DescribeCommand), UnknownCommand.Throw); + if (DescribeCommand is DescribeCommandEntry) { + var DescribeCommandEntry = DescribeCommand as DescribeCommandEntry; + DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + } + else if (DescribeCommand is DescribeCommandSet) { + var DescribeCommandSet = DescribeCommand as DescribeCommandSet; + Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + } + + //switch (DescribeCommand) { + + // case DescribeCommandEntry DescribeCommandEntry: { + // DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + // break; + // } + // case DescribeCommandSet DescribeCommandSet: { + // Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + // break; + // } + // } + + } + } + + + /// + /// Describe a command or parameter entry + /// + public abstract class DescribeEntry { + /// The identifier name. + public string Identifier { get; set; } + /// Brief description + public string Brief { get; set; } + /// The default value (if specified) + public string Default { get; set; } + /// The command line key. + public string Key { get; set; } + /// The position in the options array. + public int Index { get; set; } // Index into array of Type + } + + /// + /// Describe a command set. + /// + public abstract class DescribeCommand : DescribeEntry { + + /// If true, this is the default command. + public bool IsDefault = false; + + /// + /// Describe the command set. + /// + /// The flag indicator to use when printing the description. + public abstract void Describe (char FlagIndicator); + } + + /// + /// Describe a command entry + /// + public class DescribeCommandEntry : DescribeCommand { + + /// Delegate to dispatch if command is selected. + public HandleDelegate HandleDelegate { get; set; } + + /// If true perform lezy evaluation of parameters. + public bool Lazy { get; set; } = false; + + /// The command entries. + public List Entries { get; set; } + + /// + /// Get the default for the value. + /// + /// The tag text + /// The default value if it exists, null otherwise. + public string GetDefault (string Tag) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + return Entry.Default; + } + } + return null; + } + + /// + /// Set the default value for the tag + /// + /// The tag text + /// The value to set as the default. + public void SetDefault (string Tag, string Default) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + Entry.Default = Default; + } + } + + } + + /// + /// Describe the command to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}{1}", FlagIndicator, Identifier); + foreach (var Entry in Entries) { + + if (Entry is DescribeCommandEntry) { + var SubCommand = Entry as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry is DescribeEntryParameter) { + var Parameter = Entry as DescribeEntryParameter; + Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + } + else if (Entry is DescribeEntryOption) { + var Option = Entry as DescribeEntryOption; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + } + + + //switch (Entry) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeEntryParameter Parameter: { + // Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + // break; + // } + //case DescribeEntryOption Option: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + // break; + // } + //} + } + } + + + } + + /// + /// Describe a command set. + /// + public class DescribeCommandSet : DescribeCommand { + + /// Dictionary of command entries. + public SortedDictionary Entries; + + /// + /// Describe the command set to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}", Identifier); + foreach (var Entry in Entries) { + + if (Entry.Value is DescribeCommandEntry) { + var SubCommand = Entry.Value as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry.Value is DescribeCommandSet) { + var Parameter = Entry.Value as DescribeCommandSet; + Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + } + + + //switch (Entry.Value) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeCommandSet Parameter: { + // Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + // break; + // } + + //} + } + } + } + + /// + /// Describe an entry value. + /// + public class DescribeEntryValue : DescribeEntry { + + } + + /// + /// Describe an option value. + /// + public class DescribeEntryOption : DescribeEntryValue { + } + + /// + /// Describe a parameter value. + /// + public class DescribeEntryParameter : DescribeEntryValue { + } + + /// + /// Describe a shell. + /// + public abstract class DispatchShell : Dispatch{ + + } + + + } diff --git a/MakeyMakey/TestSolution/SharedProject/CommandLex.cs b/MakeyMakey/TestSolution/SharedProject/CommandLex.cs new file mode 100644 index 000000000..05af94f98 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/CommandLex.cs @@ -0,0 +1,174 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandLex { + public virtual void Reset (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddFlag (int c) { + } + public virtual void AddFlagN (int c) { + } + public virtual void AddFlagNo (int c) { + } + public virtual void Abort (int c) { + } + } + */ + + public partial class CommandLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// IsValue + IsValue = 1, + /// StartFlag + StartFlag = 2, + /// IsFlag + IsFlag = 3, + /// IsFlagN + IsFlagN = 4, + /// IsFlagNo + IsFlagNo = 5, + /// StartFlagValue + StartFlagValue = 6, + /// IsFlagValue + IsFlagValue = 7, + /// Fail + Fail = 8 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1, + /// Flag + Flag = 2, + /// FlagValue + FlagValue = 3 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 2 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 3 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {1 , 8 , 2 , 1 , 1 , 1 }, + {1 , 1 , 1 , 1 , 1 , 1 }, + {3 , 3 , 3 , 3 , 4 , 3 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {3 , 3 , 3 , 6 , 3 , 5 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {-2 , -2 , -2 , -2 , -2 , -2 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Flag, + Token.Flag, + Token.Flag, + Token.Flag, + Token.FlagValue, + Token.FlagValue, + Token.Empty + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + Reset, + AddValue, + Ignore, + AddFlag, + AddFlagN, + AddFlagNo, + Ignore, + AddValue, + Abort + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/SharedProject/CommandLex.fsm b/MakeyMakey/TestSolution/SharedProject/CommandLex.fsm new file mode 100644 index 000000000..f2bd4de77 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/CommandLex.fsm @@ -0,0 +1,46 @@ +FSR Goedel.Command CommandLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "example.file" + Token Flag "/flag" + Token FlagValue "/flag:example.file" + + + + State ItemStart Reset Empty // Start of file + On " \t\n" GoTo Fail + On "/-" GoTo StartFlag + Any GoTo IsValue + + State IsValue AddValue Value + Any GoTo IsValue + + State StartFlag Ignore Flag + On "Nn" GoTo IsFlagN + Any GoTo IsFlag + + State IsFlag AddFlag Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagN AddFlagN Flag + On "Oo" GoTo IsFlagNo + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagNo AddFlagNo Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State StartFlagValue Ignore FlagValue + Any GoTo IsFlagValue + + State IsFlagValue AddValue FlagValue + Any GoTo IsFlagValue + + State Fail Abort Empty + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/SharedProject/CommandLexPlus.cs b/MakeyMakey/TestSolution/SharedProject/CommandLexPlus.cs new file mode 100644 index 000000000..a11698372 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/CommandLexPlus.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Lexical analyzer for command line parsing. + /// + public partial class CommandLex { + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The data to parse + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public string Value => BuildValue.ToString(); + + /// + /// Return the resulting string value + /// + public string Flag => BuildFlag.ToString(); + + /// + /// If true, flag was negated. + /// + public bool Not { get; set; } + + StringBuilder BuildValue = new StringBuilder(); + StringBuilder BuildFlag = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + BuildValue.Clear(); + BuildFlag.Clear(); + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void Reset (int c) { + Reset(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + BuildValue.Append((char)c); + } + + /// + /// Add a character to the flag buffer + /// + /// The character read + public virtual void AddFlag (int c) { + BuildFlag.Append((char)c); + } + + /// + /// N of possible NO flag + /// + /// The character read + public virtual void AddFlagN (int c) { + BuildFlag.Append((char)c); + } + + /// + /// O of possible NO flag + /// + /// The character read + public virtual void AddFlagNo (int c) { + BuildFlag.Clear(); // delete 'no' prefix + Not = true; + } + /// + /// Abort parsing, the command cannot be read. + /// + /// The character read + public virtual void Abort (int c) { + } + + + + } + } diff --git a/MakeyMakey/TestSolution/SharedProject/CommandSplit.cs b/MakeyMakey/TestSolution/SharedProject/CommandSplit.cs new file mode 100644 index 000000000..7c5155154 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/CommandSplit.cs @@ -0,0 +1,173 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandSplitLex { + public virtual void AddParam (int c) { + } + public virtual void BeginValue (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddEscape (int c) { + } + public virtual void AddEscapedValue (int c) { + } + } + */ + + public partial class CommandSplitLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// StartQuoted + StartQuoted = 1, + /// Quoted + Quoted = 2, + /// QuotedQuote + QuotedQuote = 3, + /// QuotedEscape + QuotedEscape = 4, + /// QuotedEscapeReturn + QuotedEscapeReturn = 5, + /// Unquoted + Unquoted = 6, + /// UnquotedQuote + UnquotedQuote = 7, + /// UnquotedEscape + UnquotedEscape = 8, + /// UnquotedEscapeReturn + UnquotedEscapeReturn = 9 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {6 , 0 , 1 , 8 }, + {2 , 2 , 3 , 4 }, + {2 , 2 , 3 , 4 }, + {2 , 0 , 2 , 4 }, + {5 , 5 , 5 , 4 }, + {2 , 2 , 3 , 4 }, + {6 , 0 , 7 , 8 }, + {6 , 0 , 7 , 8 }, + {9 , 0 , 9 , 8 }, + {6 , 6 , 7 , 8 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + AddParam, + BeginValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/SharedProject/CommandSplit.fsm b/MakeyMakey/TestSolution/SharedProject/CommandSplit.fsm new file mode 100644 index 000000000..b85742b96 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/CommandSplit.fsm @@ -0,0 +1,68 @@ +FSR Goedel.Command CommandSplitLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "Parameter" + + + + State ItemStart AddParam Empty // Start of file + On " \t\n" GoTo ItemStart + On "\"" GoTo StartQuoted + On "\\" GoTo UnquotedEscape + Any GoTo Unquoted + + State StartQuoted BeginValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State Quoted AddValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedQuote Ignore Value + On " \t\n" GoTo ItemStart // An end quote + On "\"" GoTo Quoted + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedEscape AddEscape Value + On "\"" GoTo QuotedEscapeReturn + On "\\" GoTo QuotedEscape + Any GoTo QuotedEscapeReturn + + State QuotedEscapeReturn AddEscapedValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + + + + State Unquoted AddValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedQuote Ignore Value + On "\"" GoTo UnquotedQuote + On "\\" GoTo UnquotedEscape + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedEscape AddEscape Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedEscapeReturn + On " \t\n" GoTo ItemStart + Any GoTo UnquotedEscapeReturn + + State UnquotedEscapeReturn AddEscapedValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + Any GoTo Unquoted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/SharedProject/CommandSplitLexPlus.cs b/MakeyMakey/TestSolution/SharedProject/CommandSplitLexPlus.cs new file mode 100644 index 000000000..dd410bb7f --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/CommandSplitLexPlus.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Split a command line into parts. + /// + public partial class CommandSplitLex { + + /// + /// Split a commandline into entries. + /// + /// The command line to split. + /// The command line split into entries. + public static string[] Split (string Text) { + var CommandSplitLex = new CommandSplitLex(); + CommandSplitLex.GetToken(Text); + return CommandSplitLex.Value.ToArray(); + } + + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandSplitLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The string to parse. + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public List Value { + get { + if (Pending) { + AddParam(); + Pending = false; + } + return Arguments; + } + } + + // Private variables + bool Pending = false; // if true, there is an incomplete value to be added. + int EscapeCount = 0; + List Arguments = new List(); + StringBuilder BuildValue = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + Arguments.Clear(); + BuildValue.Clear(); + Pending = false; + EscapeCount = 0; + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void AddParam (int c) { + AddParam(); + } + + void AddParam () { + // Add any pending escape characters + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + // Add the parameter to the build string + var Text = BuildValue.ToString(); + if (Pending) { + Arguments.Add(Text); + } + // Reset all buffers + EscapeCount = 0; + BuildValue.Clear(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + + /// + /// Start a quoted parameter, this can be null + /// + /// The character read + public virtual void BeginValue (int c) { + Pending = true; + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + EscapeCount = 0; + Pending = true; + BuildValue.Append((char)c); + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddEscape (int c) { + Pending = true; + EscapeCount++; + } + + /// + /// Add a sequence of escape characters to the value buffer. If the final character is not + /// a double quote, the escape characters are simply added. Otherwise, each pair of escape + /// characters results in a single escape character and a double quote is added if the number + /// of escape characters is odd. + /// + /// The character read + public virtual void AddEscapedValue (int c) { + + if (c == '\"') { + while (EscapeCount > 1) { + EscapeCount -= 2; + BuildValue.Append('\\'); + } + if (EscapeCount == 1) { + BuildValue.Append('\"'); + } + } + else { + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + BuildValue.Append((char)c); + } + EscapeCount = 0; + + } + + } + } diff --git a/MakeyMakey/TestSolution/SharedProject/Dispatch.cs b/MakeyMakey/TestSolution/SharedProject/Dispatch.cs new file mode 100644 index 000000000..a506003bf --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Dispatch.cs @@ -0,0 +1,19 @@ +using System; + +namespace Goedel.Command { + /// Track start and end time of parse. + public abstract class Dispatch { + /// Record start time. + public DateTime Started = DateTime.Now; + + /// Calculate elapsed time. + public TimeSpan Elapsed => DateTime.Now - Started; + + /// Command type data + public virtual Type[] _Data { get; set; } + + /// Command description + public virtual DescribeCommandEntry DescribeCommand { get; set; } + } + + } diff --git a/MakeyMakey/TestSolution/SharedProject/Exceptions.cs b/MakeyMakey/TestSolution/SharedProject/Exceptions.cs new file mode 100644 index 000000000..7f51389f4 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Exceptions.cs @@ -0,0 +1,373 @@ +using System; +using Goedel.Utilities; + + + +namespace Goedel.Command { + + + /// + /// The user command could not be parsed + /// + public class ParserException : global::System.Exception { + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + public ParserException () : base ("The user command could not be parsed") { + } + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + /// Description of the error + public ParserException (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public ParserException (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + /// + /// User data associated with the exception. + /// + public object UserData; + + + + + /// + /// The public fatory delegate + /// + public static global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new ParserException(Reason as string); + } + else { + return new ParserException(); + } + } + } + + + /// + /// The file could not be read. + /// + public class FileReadError : ParserException { + + /// + /// Construct instance for exception "The file could not be read" + /// + public FileReadError () : base ("The file could not be read") { + } + + /// + /// Construct instance for exception "The file could not be read" + /// + /// Description of the error + public FileReadError (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public FileReadError (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + public FileReadError (ExceptionData Object) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + /// Inner Exception + public FileReadError (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new FileReadError(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new FileReadError(Reason as ExceptionData); + } + else { + return new FileReadError(); + } + } + } + + + /// + /// User entered an unknown command + /// + public class UnknownCommand : ParserException { + + /// + /// Construct instance for exception "Unknown command" + /// + public UnknownCommand () : base ("Unknown command") { + } + + /// + /// Construct instance for exception "Unknown command" + /// + /// Description of the error + public UnknownCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + public UnknownCommand (ExceptionData Object) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownCommand (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownCommand(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownCommand(Reason as ExceptionData); + } + else { + return new UnknownCommand(); + } + } + } + + + /// + /// User entered an unknown option + /// + public class UnknownOption : ParserException { + + /// + /// Construct instance for exception "Unknown option" + /// + public UnknownOption () : base ("Unknown option") { + } + + /// + /// Construct instance for exception "Unknown option" + /// + /// Description of the error + public UnknownOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + public UnknownOption (ExceptionData Object) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownOption (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownOption(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownOption(Reason as ExceptionData); + } + else { + return new UnknownOption(); + } + } + } + + + /// + /// No command specified + /// + public class NoCommand : ParserException { + + /// + /// Construct instance for exception "No command specified" + /// + public NoCommand () : base ("No command specified") { + } + + /// + /// Construct instance for exception "No command specified" + /// + /// Description of the error + public NoCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public NoCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new NoCommand(Reason as string); + } + else { + return new NoCommand(); + } + } + } + + + /// + /// The option value was incorrectly formatted + /// + public class InvalidOption : ParserException { + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + public InvalidOption () : base ("The option value was incorrectly formatted") { + } + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + /// Description of the error + public InvalidOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public InvalidOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new InvalidOption(Reason as string); + } + else { + return new InvalidOption(); + } + } + } + + + } diff --git a/MakeyMakey/TestSolution/SharedProject/Exceptions.exceptional b/MakeyMakey/TestSolution/SharedProject/Exceptions.exceptional new file mode 100644 index 000000000..0220f6994 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Exceptions.exceptional @@ -0,0 +1,41 @@ + +Namespace Goedel.Command + + Exception ParserException + Console "The user command could not be parsed" + Description + |The user command could not be parsed + + Exception FileReadError + Console "The file could not be read" + Description + |The file could not be read. + + Object ExceptionData "The file {0} could not be read" + String + + Exception UnknownCommand + Console "Unknown command" + Description + |User entered an unknown command + + Object ExceptionData "The command {0} is not known." + String + + Exception UnknownOption + Console "Unknown option" + Description + |User entered an unknown option + + Object ExceptionData "The option {0} is not known." + String + + Exception NoCommand + Console "No command specified" + Description + |No command specified + + Exception InvalidOption + Console "The option value was incorrectly formatted" + Description + |The option value was incorrectly formatted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/SharedProject/FileTools.cs b/MakeyMakey/TestSolution/SharedProject/FileTools.cs new file mode 100644 index 000000000..335f9c6d1 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/FileTools.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Goedel.Registry; + +namespace Goedel.Command { + + + /// + /// Utility class for managing files. + /// + public class FileTools { + + + /// + /// Get the time at which the specified file was created + /// Return DateTime.MinValue if the file does not exist + /// + /// The file to test + /// The time the file was created. + public static DateTime GetFileDateTime(string FileName) { + if (!File.Exists(FileName)) { + return DateTime.MinValue; + } + return File.GetLastWriteTimeUtc(FileName); + } + + /// + /// Write short form description of the current program to the console. + /// + public static void About() { + DateTime CompilationDate = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + + string Build = Script.LocalizeTime(CompilationDate, false); + + + Console.WriteLine(Script.AssemblyTitle); + Console.WriteLine(" {0}", Script.AssemblyDescription); + Console.WriteLine(" CopyRight : {0} {1}", Script.AssemblyCopyright, Script.AssemblyCompany); + Console.WriteLine(" Version : {0}", Script.AssemblyVersion); + Console.WriteLine(" Compiled : {0}", Build); + } + + /// + /// Cehck to see if a Destination file is more recent than a source file. + /// + /// The source file. + /// The destination file. + /// True if the source was created before the destination. + public static bool UpToDate(string Source, string Destination) { + + DateTime OutputDateTime = FileTools.GetFileDateTime(Destination); + if (OutputDateTime == DateTime.MinValue) { + return false; + } + DateTime ToolDateTime = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + if (OutputDateTime < ToolDateTime) { + return false; + } + DateTime SourceDateTime = FileTools.GetFileDateTime(Source); + return (OutputDateTime > SourceDateTime); + } + + /// + /// Determine output file name using command line entry and default data. + /// + /// The default extension. + /// The base file name. + /// The defaulted output file. + public static string DefaultFile(string Extension, string Default) { + return Path.GetFileNameWithoutExtension(Default) + "." + Extension; + } + + + // + // Search for a file. + // + // If FileName exists, use that, otherwise try FileName.Extension + // + + /// + /// Search for a file using specified extension if required. + /// + /// The base file name. + /// Default extension. + /// The defaulted file. + public static string DefaultExtension(string FileName, string Extension) { + if (File.Exists(FileName)) { + return FileName; + } + + return FileName + "." + Extension; + } + + /// + /// Calculate output file name. + /// + /// The source file path + /// The destination file path. + /// The default extension. + /// The defaulted file name. + public static string DefaultOutput(string SourcePath, string DestinationPath, + string Extension) { + if (DestinationPath != null) { + return DestinationPath; + } + return Path.GetFileNameWithoutExtension(SourcePath) + "." + Extension; + } + } + } diff --git a/MakeyMakey/TestSolution/SharedProject/Main.command b/MakeyMakey/TestSolution/SharedProject/Main.command new file mode 100644 index 000000000..dce9549fc --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Main.command @@ -0,0 +1,20 @@ +Class DomainerShell DomainerShell + Brief "Manage DNS Resource and Query Records" + + Type NewFile "file" + Type ExistingFile "file" + Type Flag "flag" + + About "about" + + Command GenerateDomainer "in" + DefaultCommand + + Lazy Lazy "lazy" + Brief "Only generate code if source or generator have changed" + + Parser Goedel.Tool.Domainer Domainer "domainer" + + Script Goedel.Tool.Domainer Generate GenerateCS "cs" + Brief "Generate C# code" + Default "cs" diff --git a/MakeyMakey/TestSolution/SharedProject/Main.cs b/MakeyMakey/TestSolution/SharedProject/Main.cs new file mode 100644 index 000000000..d60180c7a --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Main.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.Command; +using Goedel.Registry; +using Goedel.Utilities; + +namespace DomainerShell { + public partial class CommandLineInterpreter : CommandLineInterpreterBase { + + /// The command entries + public static SortedDictionary Entries; + /// The default command. + public static DescribeCommandEntry DefaultCommand; + /// Description of the comman + public static string Description = ""; + + static char UnixFlag = '-'; + static char WindowsFlag = '/'; + + + /// + /// + /// + /// + /// + /// + public static void Help (DispatchShell Dispatch, string[] args, int index) { + Brief(Description, DefaultCommand, Entries); + } + + public static DescribeCommandEntry DescribeHelp = new DescribeCommandEntry() { + Identifier = "help", + HandleDelegate = Help, + Entries = new List() { } + }; + + /// + /// Describe the application invoked by the command. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public static void About (DispatchShell Dispatch, string[] args, int index) { + FileTools.About(); + } + + public static DescribeCommandEntry DescribeAbout = new DescribeCommandEntry() { + Identifier = "about", + HandleDelegate = About, + Entries = new List() { } + }; + + static bool IsFlag(char c) { + return (c == UnixFlag) | (c == WindowsFlag) ; + } + + + static CommandLineInterpreter () { + System.OperatingSystem OperatingSystem = System.Environment.OSVersion; + + if (OperatingSystem.Platform == PlatformID.Unix | + OperatingSystem.Platform == PlatformID.MacOSX) { + FlagIndicator = UnixFlag; + } + else { + FlagIndicator = WindowsFlag; + } + + DefaultCommand = _GenerateDomainer._DescribeCommand; + Description = "Manage DNS Resource and Query Records"; + + Entries = new SortedDictionary () { + {"about", DescribeAbout }, + {"in", _GenerateDomainer._DescribeCommand }, + {"help", DescribeHelp } + }; // End Entries + + + + } + + static void Main(string[] args) { + var CLI = new CommandLineInterpreter (); + CLI.MainMethod (args); + } + + public void MainMethod(string[] Args) { + DomainerShell Dispatch = new DomainerShell (); + + MainMethod (Dispatch, Args); + } + + + public void MainMethod(DomainerShell Dispatch, string[] Args) { + Dispatcher (Entries, DefaultCommand, Dispatch, Args, 0); + } // Main + + + + public static void Handle_GenerateDomainer ( + DispatchShell DispatchIn, string[] Args, int Index) { + DomainerShell Dispatch = DispatchIn as DomainerShell; + GenerateDomainer Options = new GenerateDomainer (); + ProcessOptions (Args, Index, Options); + Dispatch.GenerateDomainer (Options); + } + + + } // class Main + + + // The stub class for carrying optional parameters for each command type + // As with the main class each consists of an abstract main class + // with partial virtual that can be extended as required. + + // All subclasses inherit from the abstract classes Goedel.Regisrty.Dispatch + // and Goedel.Command.Type + + + public class _GenerateDomainer : Goedel.Command.Dispatch { + + public override Goedel.Command.Type[] _Data {get; set;} = new Goedel.Command.Type [] { + new Flag (), + new ExistingFile (), + new NewFile () } ; + + /// Field accessor for parameter [lazy] + public virtual Flag Lazy { + get => _Data[0] as Flag; + set => _Data[0] = value; + } + + public virtual string _Lazy { + set => _Data[0].Parameter (value); + } + /// Field accessor for parameter [] + public virtual ExistingFile Domainer { + get => _Data[1] as ExistingFile; + set => _Data[1] = value; + } + + public virtual string _Domainer { + set => _Data[1].Parameter (value); + } + /// Field accessor for option [cs] + public virtual NewFile GenerateCS { + get => _Data[2] as NewFile; + set => _Data[2] = value; + } + + public virtual string _GenerateCS { + set => _Data[2].Parameter (value); + } + public override DescribeCommandEntry DescribeCommand {get; set;} = _DescribeCommand; + + public static DescribeCommandEntry _DescribeCommand = new DescribeCommandEntry () { + Identifier = "in", + Brief = "", + HandleDelegate = CommandLineInterpreter.Handle_GenerateDomainer, + Lazy = true, + Entries = new List () { + new DescribeEntryParameter () { + Identifier = "Domainer", + Default = null, // null if null + Brief = "", + Index = 1, + Key = "" + }, + new DescribeEntryOption () { + Identifier = "GenerateCS", + Default = "cs", // null if null + Brief = "Generate C# code", + Index = 2, + Key = "cs" + } + } + }; + + } + + public partial class GenerateDomainer : _GenerateDomainer { + } // class GenerateDomainer + + + public partial class NewFile : _NewFile { + public static NewFile Factory (string Value) { + var Result = new NewFile(); + Result.Default(Value); + return Result; + } + } // NewFile + + + public partial class ExistingFile : _ExistingFile { + public static ExistingFile Factory (string Value) { + var Result = new ExistingFile(); + Result.Default(Value); + return Result; + } + } // ExistingFile + + + public partial class Flag : _Flag { + public static Flag Factory (string Value) { + var Result = new Flag(); + Result.Default(Value); + return Result; + } + } // Flag + + + + // The stub class just contains routines that echo their arguments and + // write 'not yet implemented' + + // Eventually there will be a compiler option to suppress the debugging + // to eliminate the redundant code + public class _DomainerShell : global::Goedel.Command.DispatchShell { + + public virtual void GenerateDomainer ( GenerateDomainer Options) { + string inputfile = null; + + inputfile = Options.Domainer.Text; + + Goedel.Tool.Domainer.Domainer Parse = new Goedel.Tool.Domainer.Domainer() { + }; + + + using (Stream infile = + new FileStream(inputfile, FileMode.Open, FileAccess.Read)) { + + Lexer Schema = new Lexer(inputfile); + + Schema.Process(infile, Parse); + } + + + // Script output of type GenerateCS cs + if (Options.GenerateCS.Text != null) { + string outputfile = Options.GenerateCS.Text; // Automatically defaults + if (Options.Lazy.Value & FileTools.UpToDate (inputfile, outputfile)) { + return; + } + using (Stream outputStream = + new FileStream(outputfile, FileMode.Create, FileAccess.Write)) { + using (TextWriter OutputWriter = new StreamWriter(outputStream, Encoding.UTF8)) { + + Goedel.Tool.Domainer.Generate Script = new Goedel.Tool.Domainer.Generate (OutputWriter); + + Script.GenerateCS (Parse); + } + } + } + } + + + } // class _DomainerShell + + public partial class DomainerShell : _DomainerShell { + } // class DomainerShell + + } // namespace DomainerShell + + diff --git a/MakeyMakey/TestSolution/SharedProject/NamespaceDoc.cs b/MakeyMakey/TestSolution/SharedProject/NamespaceDoc.cs new file mode 100644 index 000000000..c306a76b5 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/NamespaceDoc.cs @@ -0,0 +1,11 @@ +namespace Goedel.Command { + + /// + /// Support routines for command line parsers defined using the PHB Command tool. + /// + + [System.Runtime.CompilerServices.CompilerGenerated] + class NamespaceDoc { + } + + } diff --git a/MakeyMakey/TestSolution/SharedProject/Parse.md b/MakeyMakey/TestSolution/SharedProject/Parse.md new file mode 100644 index 000000000..d86aabb9b --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Parse.md @@ -0,0 +1,15 @@ + // split a command line into chunks applying windows command line escaping rules + // + // one two -> [one] [two] + // "one two" -> [one two] + // "one"two" -> [onetwo] + // "one""two" -> [one"two] + // \\ -> [\\] + // \\" -> [\"] + // \\" \\ -> [\ \\] + // \\\" \\ -> [\"] [\\] + // "Test""Here" -> [TestHere] + // Test""Here -> [Test"Here]] + + + "" Test-> [] [Test] \ No newline at end of file diff --git a/MakeyMakey/TestSolution/SharedProject/SharedProject.projitems b/MakeyMakey/TestSolution/SharedProject/SharedProject.projitems new file mode 100644 index 000000000..a4952b0d1 --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/SharedProject.projitems @@ -0,0 +1,60 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 5cb9fa6c-a53b-46ce-9f1f-219c2d293bd7 + + + SharedProject + + + + CommandLex.cs + fsrcs + + + CommandSplit.cs + fsrcs + + + Exceptions.cs + exceptional + + + Main.cs + CommandCS + + + + + + + + CommandLex.fsm + True + True + + + + CommandSplit.fsm + True + True + + + + + Exceptions.exceptional + True + True + + + + Main.command + True + True + + + + + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/SharedProject/SharedProject.shproj b/MakeyMakey/TestSolution/SharedProject/SharedProject.shproj new file mode 100644 index 000000000..34ad4b6fe --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/SharedProject.shproj @@ -0,0 +1,13 @@ + + + + 5cb9fa6c-a53b-46ce-9f1f-219c2d293bd7 + 14.0 + + + + + + + + diff --git a/MakeyMakey/TestSolution/SharedProject/Type.cs b/MakeyMakey/TestSolution/SharedProject/Type.cs new file mode 100644 index 000000000..df5dfc1db --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/Type.cs @@ -0,0 +1,293 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.Registry; + +namespace Goedel.Command { + /// Base class for Command line parser types. This could do with + /// some decrufting to remove implementation artifacts. + public abstract class Type { + + /// The command line value. + public virtual string Text { get; set; } + + /// If true, the value was set by default + public bool ByDefault { get; set; } = true; + + /// + /// Convert value to string. + /// + /// The string value. + public override string ToString () { + return Text; + } + + /// + /// Set parameter text. + /// + /// Text to set. + public virtual void Parameter (string TextIn) { + Text = TextIn; + } + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public virtual void Default (string TextIn) { + Parameter(TextIn); + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The final data. + public virtual void Complete (Type[] Data) { + } + + /// + /// Set the flag value. + /// + /// If true, flag is negated. + public virtual void SetFlag (bool Negated) { + } + + } + + /// + /// Command line boolean type for flags. + /// + public abstract class _Flag : Goedel.Command.Type { + + /// The canonical command line value. + public override string Text { + get => Value ? "true" : "false"; + set => Parameter(value); + } + + /// + /// Default constructor + /// + public _Flag () { + } + + /// + /// Construct flag with specified value + /// + /// The flag value to set + public _Flag (string Value) { + Default(Value); + } + + /// + /// The flag value. + /// + public virtual bool Value { get; set; } + + /// + /// Set tag value from parameter. + /// + /// The values true and 1 set a true value, 0 and false set a false value. + /// Otherwise an exception is thrown. + public override void Parameter (string Text) { + //Text = (Text == null) ? "true" : Text; + switch (Text.ToLower()) { + case "true": + case "1": { + Value = true; + break; + } + case "false": + case "0": { + Value = false; + break; + } + case "": { + break; + } + default: + throw new System.Exception("Flag value not recognized" + Text); + } + } + + /// + /// Set the negated flag + /// + /// If true, command is negated. + public override void SetFlag (bool Negated) { + Parameter (Negated ? "false" : "true"); + ByDefault = false; + } + + /// + /// Convert value to string. + /// + /// the string value + public override string ToString () { + return Text; + } + + + + } + + + /// + /// Command line flag for file. + /// + public abstract class _File : Goedel.Command.Type { + /// + /// Default constructor + /// + public _File () { + } + + /// + /// Constructor with specified default value. + /// + /// The default value text for this entry + public _File (string Value) { + Default(Value); + } + + /// + /// The default extension. + /// + public string Extension = ""; + + /// + /// Set the default. + /// + /// The default value text for this entry + public override void Default (string TextIn) { + Extension = TextIn; + } + + /// + /// The value. + /// + public string Value => Text; + + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// File name. + public string DefaultFile (_File Source) { + return DefaultFile(Source.Text); + } + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// The extension. + /// File name. + public string DefaultFile (string Source, string Extension = null) { + Extension = Extension ?? this.Extension; + + Text = FileTools.DefaultFile(Extension, Source); + return Text; + } + + + + + } + + /// + /// Command line flag for file. + /// + public abstract class _NewFile : _File { + bool Flagged = false; + + /// + /// Set the negated flag + /// + /// if true, is negated. + public override void SetFlag (bool Negated) { + Flagged = true; + } + + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public override void Default (string TextIn) { + Extension = TextIn; + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The completed data + public override void Complete (Type[] Data) { + if (!ByDefault | !Flagged) { + return; // not flagged or explicitly set + } + + var Source = Get(Data); + if (Source != null) { + Parameter(DefaultFile(Source)); + } + + } + + + _ExistingFile Get (Type[] Data) { + foreach (var Entry in Data) { + if (Entry as _ExistingFile != null) { + return Entry as _ExistingFile; + } + } + return null; + } + } + + /// + /// Command line flag for file. + /// + public abstract class _ExistingFile : _File { + + } + + /// + /// Command line flag for file. + /// + public abstract class _Integer : Type { + + /// + /// Return the value as an integer + /// + public int Value { + get { + if (Text == "") { + return 0; + } + if (int.TryParse(Text, out var Result)) { + return Result; + } + throw new InvalidOption(); + } + } + } + + /// + /// Command line flag for file. + /// + public abstract class _String : Type { + /// + /// The value. + /// + public string Value => Text; + + } + + } diff --git a/MakeyMakey/TestSolution/SharedProject/VS.Make b/MakeyMakey/TestSolution/SharedProject/VS.Make new file mode 100644 index 000000000..9b7c2496d --- /dev/null +++ b/MakeyMakey/TestSolution/SharedProject/VS.Make @@ -0,0 +1,52 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = \ + $(MSBuildThisFileDirectory)CommandLex.cs\ + $(MSBuildThisFileDirectory)CommandSplit.cs\ + $(MSBuildThisFileDirectory)Exceptions.cs\ + $(MSBuildThisFileDirectory)Main.cs + +$(MSBuildThisFileDirectory)CommandLex.fsm : $(MSBuildThisFileDirectory)CommandLex.cs + fsrgen $(MSBuildThisFileDirectory)CommandLex.fsm $(MSBuildThisFileDirectory)CommandLex.cs + +$(MSBuildThisFileDirectory)CommandSplit.fsm : $(MSBuildThisFileDirectory)CommandSplit.cs + fsrgen $(MSBuildThisFileDirectory)CommandSplit.fsm $(MSBuildThisFileDirectory)CommandSplit.cs + +$(MSBuildThisFileDirectory)Exceptions.exceptional : $(MSBuildThisFileDirectory)Exceptions.cs + exceptional $(MSBuildThisFileDirectory)Exceptions.exceptional $(MSBuildThisFileDirectory)Exceptions.cs + +$(MSBuildThisFileDirectory)Main.command : $(MSBuildThisFileDirectory)Main.cs + commandparse $(MSBuildThisFileDirectory)Main.command $(MSBuildThisFileDirectory)Main.cs + + +prebuildRecurse : + +postbuildRecurse : + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/TestSolution/StandardLibrary/Command.cs b/MakeyMakey/TestSolution/StandardLibrary/Command.cs new file mode 100644 index 000000000..cd0a2eb28 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Command.cs @@ -0,0 +1,437 @@ +using Goedel.Utilities; +using System; +using System.Collections.Generic; + +namespace Goedel.Command { + + /// + /// Delegate calling a dispatch routine. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public delegate void HandleDelegate (DispatchShell Dispatch, string[] args, int index); + + + /// + /// Base class for command line interpreters + /// + public abstract class CommandLineInterpreterBase { + + + ///// The command entries + //public static SortedDictionary Entries; + ///// The default command. + //public static DescribeCommandEntry DefaultCommand; + ///// Description of the comman + //public static string Description = ""; + + /// The default flag indicator for display to terminal, this is a forward slash / for Windows + /// and a double dash -- for UNIX. + public static char FlagIndicator = '/'; + + ///// + ///// Provide the summary of the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void Brief (DispatchShell Dispatch, string[] args, int index) { + // Brief(); + // } + + ///// + ///// Describe the application invoked by the command. + ///// + ///// The command description. + ///// The set of arguments. + ///// The first unparsed argument. + //public static void About (DispatchShell Dispatch, string[] args, int index) { + // FileTools.About(); + // } + + + /// + /// Provide the summary of the command. + /// + public static void Brief ( + string Description, + DescribeCommandEntry DefaultCommand, + SortedDictionary Entries) { + Console.WriteLine(Description); + Console.WriteLine(""); + + if (DefaultCommand != null) { + DefaultCommand.Describe(FlagIndicator); + + } + foreach (var Entry in Entries) { + if (!Entry.Value.IsDefault) { // BUG: Is not doing the right thing here. + Entry.Value.Describe(FlagIndicator); + } + } + } + + /// + /// Process command options. + /// + /// The command line arguments. + /// The first unparsed argument. + /// The option values to set. + public static void ProcessOptions (string[] Args, int Index, Dispatch Options) { + var Describe = Options.DescribeCommand; + var CommandLex = new CommandLex(); + + var Parameter = 0; + + // Set all data slots to their default value + foreach (var Description in Describe.Entries) { + if (Description.Default != null) { + Options._Data[Description.Index].Default(Description.Default); + } + } + + for (var i = Index; i < Args.Length; i++) { + var Arg = Args[i]; + var Token = CommandLex.GetToken(Arg); + + switch (Token) { + case CommandLex.Token.Empty: { + break; + } + case CommandLex.Token.Flag: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; + Assert.NotNull(Entry, UnknownOption.Throw); + var Data = Options._Data[Entry.Index]; + if ((i + 1 < Args.Length) && !IsFlagged(Args[i + 1])) { + i++; + Arg = Args[i]; + + SetValue(Data, Args[i]); + } + Data.SetFlag(CommandLex.Not); + + if (Data as _Flag != null) { + (Data as _Flag).Value = !CommandLex.Not; + Data.ByDefault = false; + } + break; + } + case CommandLex.Token.FlagValue: { + var Entry = Match(Describe.Entries, CommandLex.Flag) as DescribeEntryValue; ; + Assert.NotNull(Entry, UnknownOption.Throw); + + SetValue(Options._Data[Entry.Index], CommandLex.Value); + + break; + } + case CommandLex.Token.Value: { + var Search = true; + for (var j = Parameter; Search & j < Describe.Entries.Count; j++) { + if (Describe.Entries[j] is DescribeEntryParameter) { + DescribeEntryParameter Entry = Describe.Entries[j] as DescribeEntryParameter; + SetValue(Options._Data[Entry.Index], CommandLex.Value); + Parameter = j + 1; + Search = false; + } + + + + //switch (Describe.Entries[j]) { + // case DescribeEntryParameter Entry: { + // SetValue(Options._Data[Entry.Index], CommandLex.Value); + // Parameter = j+1; + // Search = false; + // break; + // } + // } + } + break; + } + } + } + foreach (var Entry in Options._Data) { + Entry.Complete(Options._Data); + } + } + + static void SetValue (Type Data, string Value) { + Data.Parameter(Value); // Hack: consolidate + Data.ByDefault = false; // Has been set explicitly + } + + static DescribeEntry Match (List Entries, string Flag) { + foreach (var Entry in Entries) { + if (Entry.Key.ToLower() == Flag.ToLower()) { + return Entry; + } + } + return null; + } + + /// + /// Describe the values in an command. + /// + /// The command to describe. + public static void DescribeValues (Dispatch Dispatch) { + // NYI: This may not be required. + } + + /// + /// Return true iff the text value is flagged. + /// + /// Text to test. + /// Result of the test. + public static bool IsFlagged (string Text) { + if (Text == null) { + return false; + } + if (Text.Length <= 0) { + return false; + } + return Text[0] == '-' | Text[0] == '/'; + } + + /// + /// The main dispatch point + /// + /// Dictionary describing the shell commands and dispatchers. + /// The default command entry + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public void Dispatcher (SortedDictionary Entries, + DescribeCommandEntry DefaultCommand, + DispatchShell Dispatch, string[] Args, int Index) { + // NYI: This should really be set up to take a Command set description + // as the input. + + if (Args.Length == 0) { + Assert.NotNull(DefaultCommand, UnknownCommand.Throw); + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + Assert.True(Index < Args.Length, UnknownCommand.Throw); + + var Arg = Args[Index]; + Assert.True(Arg.Length > 0, UnknownCommand.Throw); // Should never happen. + var Flagged = IsFlagged(Arg); + var Command = Flagged ? Arg.Substring(1).ToLower() : Arg.ToLower(); + + if (DefaultCommand != null & !Flagged) { + DefaultCommand.HandleDelegate(Dispatch, Args, Index); + return; + } + + // NYI: no, it could be a default command and an option. + Assert.True(Entries.TryGetValue(Command, out var DescribeCommand), UnknownCommand.Throw); + if (DescribeCommand is DescribeCommandEntry) { + var DescribeCommandEntry = DescribeCommand as DescribeCommandEntry; + DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + } + else if (DescribeCommand is DescribeCommandSet) { + var DescribeCommandSet = DescribeCommand as DescribeCommandSet; + Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + } + + //switch (DescribeCommand) { + + // case DescribeCommandEntry DescribeCommandEntry: { + // DescribeCommandEntry.HandleDelegate(Dispatch, Args, Index + 1); + // break; + // } + // case DescribeCommandSet DescribeCommandSet: { + // Dispatcher(DescribeCommandSet.Entries, DefaultCommand, Dispatch, Args, Index + 1); + // break; + // } + // } + + } + } + + + /// + /// Describe a command or parameter entry + /// + public abstract class DescribeEntry { + /// The identifier name. + public string Identifier { get; set; } + /// Brief description + public string Brief { get; set; } + /// The default value (if specified) + public string Default { get; set; } + /// The command line key. + public string Key { get; set; } + /// The position in the options array. + public int Index { get; set; } // Index into array of Type + } + + /// + /// Describe a command set. + /// + public abstract class DescribeCommand : DescribeEntry { + + /// If true, this is the default command. + public bool IsDefault = false; + + /// + /// Describe the command set. + /// + /// The flag indicator to use when printing the description. + public abstract void Describe (char FlagIndicator); + } + + /// + /// Describe a command entry + /// + public class DescribeCommandEntry : DescribeCommand { + + /// Delegate to dispatch if command is selected. + public HandleDelegate HandleDelegate { get; set; } + + /// If true perform lezy evaluation of parameters. + public bool Lazy { get; set; } = false; + + /// The command entries. + public List Entries { get; set; } + + /// + /// Get the default for the value. + /// + /// The tag text + /// The default value if it exists, null otherwise. + public string GetDefault (string Tag) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + return Entry.Default; + } + } + return null; + } + + /// + /// Set the default value for the tag + /// + /// The tag text + /// The value to set as the default. + public void SetDefault (string Tag, string Default) { + foreach (var Entry in Entries) { + if (Entry.Key == Tag) { + Entry.Default = Default; + } + } + + } + + /// + /// Describe the command to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}{1}", FlagIndicator, Identifier); + foreach (var Entry in Entries) { + + if (Entry is DescribeCommandEntry) { + var SubCommand = Entry as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry is DescribeEntryParameter) { + var Parameter = Entry as DescribeEntryParameter; + Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + } + else if (Entry is DescribeEntryOption) { + var Option = Entry as DescribeEntryOption; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + } + + + //switch (Entry) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeEntryParameter Parameter: { + // Console.WriteLine(" {0} {1}", Entry.Key, Parameter.Brief); + // break; + // } + //case DescribeEntryOption Option: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, Option.Brief); + // break; + // } + //} + } + } + + + } + + /// + /// Describe a command set. + /// + public class DescribeCommandSet : DescribeCommand { + + /// Dictionary of command entries. + public SortedDictionary Entries; + + /// + /// Describe the command set to the console. + /// + /// The flag indicator to use in display. + public override void Describe (char FlagIndicator) { + Console.WriteLine("{0}", Identifier); + foreach (var Entry in Entries) { + + if (Entry.Value is DescribeCommandEntry) { + var SubCommand = Entry.Value as DescribeCommandEntry; + Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + } + else if (Entry.Value is DescribeCommandSet) { + var Parameter = Entry.Value as DescribeCommandSet; + Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + } + + + //switch (Entry.Value) { + //case DescribeCommandEntry SubCommand: { + // Console.WriteLine(" {0}{1} {2}", FlagIndicator, Entry.Key, SubCommand.Brief); + // break; + // } + //case DescribeCommandSet Parameter: { + // Console.WriteLine(" {0}{1}", Entry.Key, Parameter.Brief); + // break; + // } + + //} + } + } + } + + /// + /// Describe an entry value. + /// + public class DescribeEntryValue : DescribeEntry { + + } + + /// + /// Describe an option value. + /// + public class DescribeEntryOption : DescribeEntryValue { + } + + /// + /// Describe a parameter value. + /// + public class DescribeEntryParameter : DescribeEntryValue { + } + + /// + /// Describe a shell. + /// + public abstract class DispatchShell : Dispatch{ + + } + + + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/CommandLex.cs b/MakeyMakey/TestSolution/StandardLibrary/CommandLex.cs new file mode 100644 index 000000000..05af94f98 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/CommandLex.cs @@ -0,0 +1,174 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandLex { + public virtual void Reset (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddFlag (int c) { + } + public virtual void AddFlagN (int c) { + } + public virtual void AddFlagNo (int c) { + } + public virtual void Abort (int c) { + } + } + */ + + public partial class CommandLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// IsValue + IsValue = 1, + /// StartFlag + StartFlag = 2, + /// IsFlag + IsFlag = 3, + /// IsFlagN + IsFlagN = 4, + /// IsFlagNo + IsFlagNo = 5, + /// StartFlagValue + StartFlagValue = 6, + /// IsFlagValue + IsFlagValue = 7, + /// Fail + Fail = 8 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1, + /// Flag + Flag = 2, + /// FlagValue + FlagValue = 3 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 2 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 3 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 5 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {1 , 8 , 2 , 1 , 1 , 1 }, + {1 , 1 , 1 , 1 , 1 , 1 }, + {3 , 3 , 3 , 3 , 4 , 3 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {3 , 3 , 3 , 6 , 3 , 5 }, + {3 , 3 , 3 , 6 , 3 , 3 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {7 , 7 , 7 , 7 , 7 , 7 }, + {-2 , -2 , -2 , -2 , -2 , -2 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Flag, + Token.Flag, + Token.Flag, + Token.Flag, + Token.FlagValue, + Token.FlagValue, + Token.Empty + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + Reset, + AddValue, + Ignore, + AddFlag, + AddFlagN, + AddFlagNo, + Ignore, + AddValue, + Abort + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/StandardLibrary/CommandLex.fsm b/MakeyMakey/TestSolution/StandardLibrary/CommandLex.fsm new file mode 100644 index 000000000..f2bd4de77 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/CommandLex.fsm @@ -0,0 +1,46 @@ +FSR Goedel.Command CommandLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "example.file" + Token Flag "/flag" + Token FlagValue "/flag:example.file" + + + + State ItemStart Reset Empty // Start of file + On " \t\n" GoTo Fail + On "/-" GoTo StartFlag + Any GoTo IsValue + + State IsValue AddValue Value + Any GoTo IsValue + + State StartFlag Ignore Flag + On "Nn" GoTo IsFlagN + Any GoTo IsFlag + + State IsFlag AddFlag Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagN AddFlagN Flag + On "Oo" GoTo IsFlagNo + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State IsFlagNo AddFlagNo Flag + On ":=" GoTo StartFlagValue + Any GoTo IsFlag + + State StartFlagValue Ignore FlagValue + Any GoTo IsFlagValue + + State IsFlagValue AddValue FlagValue + Any GoTo IsFlagValue + + State Fail Abort Empty + \ No newline at end of file diff --git a/MakeyMakey/TestSolution/StandardLibrary/CommandLexPlus.cs b/MakeyMakey/TestSolution/StandardLibrary/CommandLexPlus.cs new file mode 100644 index 000000000..a11698372 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/CommandLexPlus.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Lexical analyzer for command line parsing. + /// + public partial class CommandLex { + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The data to parse + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public string Value => BuildValue.ToString(); + + /// + /// Return the resulting string value + /// + public string Flag => BuildFlag.ToString(); + + /// + /// If true, flag was negated. + /// + public bool Not { get; set; } + + StringBuilder BuildValue = new StringBuilder(); + StringBuilder BuildFlag = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + BuildValue.Clear(); + BuildFlag.Clear(); + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void Reset (int c) { + Reset(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + BuildValue.Append((char)c); + } + + /// + /// Add a character to the flag buffer + /// + /// The character read + public virtual void AddFlag (int c) { + BuildFlag.Append((char)c); + } + + /// + /// N of possible NO flag + /// + /// The character read + public virtual void AddFlagN (int c) { + BuildFlag.Append((char)c); + } + + /// + /// O of possible NO flag + /// + /// The character read + public virtual void AddFlagNo (int c) { + BuildFlag.Clear(); // delete 'no' prefix + Not = true; + } + /// + /// Abort parsing, the command cannot be read. + /// + /// The character read + public virtual void Abort (int c) { + } + + + + } + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/CommandSplit.cs b/MakeyMakey/TestSolution/StandardLibrary/CommandSplit.cs new file mode 100644 index 000000000..7c5155154 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/CommandSplit.cs @@ -0,0 +1,173 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.FSR; + + +// Goedel.Command +namespace Goedel.Command{ + + + // Prototypes for the actions. These must be implemented in + // the plus class + + /* + public partial class CommandSplitLex { + public virtual void AddParam (int c) { + } + public virtual void BeginValue (int c) { + } + public virtual void AddValue (int c) { + } + public virtual void Ignore (int c) { + } + public virtual void AddEscape (int c) { + } + public virtual void AddEscapedValue (int c) { + } + } + */ + + public partial class CommandSplitLex : global::Goedel.FSR.Lexer { + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(LexReader Reader) : base (Reader) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(Stream Stream) : base(new LexReader(Stream)) { + } + + /// + /// Create and initialize a lexical analyzer. + /// + /// The input source. + public CommandSplitLex(TextReader TextReader) : base(new LexReader(TextReader)) { + } + + /// + /// Maps characters to character sets + /// + public override byte[] CharacterMappings => Character_Mapping; + + /// + /// State transitions in response to character set + /// + public override short[,] CompressedTransitions => Compressed_Transitions; + + /// + /// Get the next token from the stream + /// + /// The initial starting state + /// The token detected or -1 if an error occurred + public Token GetToken(State StartState) { + return Tokens [GetTokenInt((int)StartState)]; + } + + /// + /// Get the next token from the stream + /// + /// The token detected or -1 if an error occurred + public Token GetToken () { + return GetToken (0); + } + + /// State types + public enum State { + /// ItemStart + ItemStart = 0, + /// StartQuoted + StartQuoted = 1, + /// Quoted + Quoted = 2, + /// QuotedQuote + QuotedQuote = 3, + /// QuotedEscape + QuotedEscape = 4, + /// QuotedEscapeReturn + QuotedEscapeReturn = 5, + /// Unquoted + Unquoted = 6, + /// UnquotedQuote + UnquotedQuote = 7, + /// UnquotedEscape + UnquotedEscape = 8, + /// UnquotedEscapeReturn + UnquotedEscapeReturn = 9 + }; + + /// Token Types + public enum Token { + /// Could not find a valid token. + INVALID = -1, + /// Empty + Empty = 0, + /// Value + Value = 1 + }; + + + /// Mapping of characters to character groups + static byte [] Character_Mapping = new byte [] { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; + + static short [,] Compressed_Transitions = new short [,] { + {6 , 0 , 1 , 8 }, + {2 , 2 , 3 , 4 }, + {2 , 2 , 3 , 4 }, + {2 , 0 , 2 , 4 }, + {5 , 5 , 5 , 4 }, + {2 , 2 , 3 , 4 }, + {6 , 0 , 7 , 8 }, + {6 , 0 , 7 , 8 }, + {9 , 0 , 9 , 8 }, + {6 , 6 , 7 , 8 } + }; + + + static Token [] Tokens = new Token [] { + Token.Empty, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value, + Token.Value + }; + + /// Generated initialization method, is called automatically + /// the FSR to reset + public override void Init () { + Actions = new ActionDelegate[] { + AddParam, + BeginValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue, + AddValue, + Ignore, + AddEscape, + AddEscapedValue + }; + } + } + } + diff --git a/MakeyMakey/TestSolution/StandardLibrary/CommandSplit.fsm b/MakeyMakey/TestSolution/StandardLibrary/CommandSplit.fsm new file mode 100644 index 000000000..b85742b96 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/CommandSplit.fsm @@ -0,0 +1,68 @@ +FSR Goedel.Command CommandSplitLex + + Charset Digit "0" "9" + Charset alpha "a" "z" + Charset ALPHA "A" "Z" + + Token Empty "" + Token Value "Parameter" + + + + State ItemStart AddParam Empty // Start of file + On " \t\n" GoTo ItemStart + On "\"" GoTo StartQuoted + On "\\" GoTo UnquotedEscape + Any GoTo Unquoted + + State StartQuoted BeginValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State Quoted AddValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedQuote Ignore Value + On " \t\n" GoTo ItemStart // An end quote + On "\"" GoTo Quoted + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + State QuotedEscape AddEscape Value + On "\"" GoTo QuotedEscapeReturn + On "\\" GoTo QuotedEscape + Any GoTo QuotedEscapeReturn + + State QuotedEscapeReturn AddEscapedValue Value + On "\"" GoTo QuotedQuote + On "\\" GoTo QuotedEscape + Any GoTo Quoted + + + + + State Unquoted AddValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedQuote Ignore Value + On "\"" GoTo UnquotedQuote + On "\\" GoTo UnquotedEscape + On " \t\n" GoTo ItemStart + Any GoTo Unquoted + + State UnquotedEscape AddEscape Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedEscapeReturn + On " \t\n" GoTo ItemStart + Any GoTo UnquotedEscapeReturn + + State UnquotedEscapeReturn AddEscapedValue Value + On "\\" GoTo UnquotedEscape + On "\"" GoTo UnquotedQuote + Any GoTo Unquoted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/StandardLibrary/CommandSplitLexPlus.cs b/MakeyMakey/TestSolution/StandardLibrary/CommandSplitLexPlus.cs new file mode 100644 index 000000000..dd410bb7f --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/CommandSplitLexPlus.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.FSR; + +namespace Goedel.Command { + + /// + /// Split a command line into parts. + /// + public partial class CommandSplitLex { + + /// + /// Split a commandline into entries. + /// + /// The command line to split. + /// The command line split into entries. + public static string[] Split (string Text) { + var CommandSplitLex = new CommandSplitLex(); + CommandSplitLex.GetToken(Text); + return CommandSplitLex.Value.ToArray(); + } + + LexStringReader LexStringReader; + + /// + /// Construct a parser to read from a string to be specified in GetToken (data) + /// + public CommandSplitLex () { + LexStringReader = new LexStringReader(null); + Reader = LexStringReader; + } + + /// + /// Parse the specified string. Note, this is only valid if no LexReader + /// was specified in the constructor. + /// + /// The string to parse. + /// The token value. + public Token GetToken (string Data) { + LexStringReader.String = Data; + Reset(); + return GetToken(); + } + + + /// + /// Return the resulting string value + /// + public List Value { + get { + if (Pending) { + AddParam(); + Pending = false; + } + return Arguments; + } + } + + // Private variables + bool Pending = false; // if true, there is an incomplete value to be added. + int EscapeCount = 0; + List Arguments = new List(); + StringBuilder BuildValue = new StringBuilder(); + + /// + /// Reset the value buffers to start a new parse. + /// + public override void Reset () { + Arguments.Clear(); + BuildValue.Clear(); + Pending = false; + EscapeCount = 0; + } + + /// + /// Reset the value buffers to start a new parse. + /// + /// The character read + public virtual void AddParam (int c) { + AddParam(); + } + + void AddParam () { + // Add any pending escape characters + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + // Add the parameter to the build string + var Text = BuildValue.ToString(); + if (Pending) { + Arguments.Add(Text); + } + // Reset all buffers + EscapeCount = 0; + BuildValue.Clear(); + } + + /// + /// Do nothing + /// + /// The character read + public virtual void Ignore (int c) { + } + + + /// + /// Start a quoted parameter, this can be null + /// + /// The character read + public virtual void BeginValue (int c) { + Pending = true; + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddValue (int c) { + EscapeCount = 0; + Pending = true; + BuildValue.Append((char)c); + } + + /// + /// Add a character to the value buffer + /// + /// The character read + public virtual void AddEscape (int c) { + Pending = true; + EscapeCount++; + } + + /// + /// Add a sequence of escape characters to the value buffer. If the final character is not + /// a double quote, the escape characters are simply added. Otherwise, each pair of escape + /// characters results in a single escape character and a double quote is added if the number + /// of escape characters is odd. + /// + /// The character read + public virtual void AddEscapedValue (int c) { + + if (c == '\"') { + while (EscapeCount > 1) { + EscapeCount -= 2; + BuildValue.Append('\\'); + } + if (EscapeCount == 1) { + BuildValue.Append('\"'); + } + } + else { + for (var i = 0; i < EscapeCount; i++) { + BuildValue.Append('\\'); + } + BuildValue.Append((char)c); + } + EscapeCount = 0; + + } + + } + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/Dispatch.cs b/MakeyMakey/TestSolution/StandardLibrary/Dispatch.cs new file mode 100644 index 000000000..a506003bf --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Dispatch.cs @@ -0,0 +1,19 @@ +using System; + +namespace Goedel.Command { + /// Track start and end time of parse. + public abstract class Dispatch { + /// Record start time. + public DateTime Started = DateTime.Now; + + /// Calculate elapsed time. + public TimeSpan Elapsed => DateTime.Now - Started; + + /// Command type data + public virtual Type[] _Data { get; set; } + + /// Command description + public virtual DescribeCommandEntry DescribeCommand { get; set; } + } + + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/Exceptions.cs b/MakeyMakey/TestSolution/StandardLibrary/Exceptions.cs new file mode 100644 index 000000000..7f51389f4 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Exceptions.cs @@ -0,0 +1,373 @@ +using System; +using Goedel.Utilities; + + + +namespace Goedel.Command { + + + /// + /// The user command could not be parsed + /// + public class ParserException : global::System.Exception { + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + public ParserException () : base ("The user command could not be parsed") { + } + + /// + /// Construct instance for exception "The user command could not be parsed" + /// + /// Description of the error + public ParserException (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public ParserException (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + /// + /// User data associated with the exception. + /// + public object UserData; + + + + + /// + /// The public fatory delegate + /// + public static global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new ParserException(Reason as string); + } + else { + return new ParserException(); + } + } + } + + + /// + /// The file could not be read. + /// + public class FileReadError : ParserException { + + /// + /// Construct instance for exception "The file could not be read" + /// + public FileReadError () : base ("The file could not be read") { + } + + /// + /// Construct instance for exception "The file could not be read" + /// + /// Description of the error + public FileReadError (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public FileReadError (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + public FileReadError (ExceptionData Object) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The file {0} could not be read" + /// + /// User data + /// Inner Exception + public FileReadError (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The file {0} could not be read", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new FileReadError(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new FileReadError(Reason as ExceptionData); + } + else { + return new FileReadError(); + } + } + } + + + /// + /// User entered an unknown command + /// + public class UnknownCommand : ParserException { + + /// + /// Construct instance for exception "Unknown command" + /// + public UnknownCommand () : base ("Unknown command") { + } + + /// + /// Construct instance for exception "Unknown command" + /// + /// Description of the error + public UnknownCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + public UnknownCommand (ExceptionData Object) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The command {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownCommand (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The command {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownCommand(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownCommand(Reason as ExceptionData); + } + else { + return new UnknownCommand(); + } + } + } + + + /// + /// User entered an unknown option + /// + public class UnknownOption : ParserException { + + /// + /// Construct instance for exception "Unknown option" + /// + public UnknownOption () : base ("Unknown option") { + } + + /// + /// Construct instance for exception "Unknown option" + /// + /// Description of the error + public UnknownOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public UnknownOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + public UnknownOption (ExceptionData Object) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String )) { + UserData = Object; + } + + /// + /// Construct instance for exception using a userdata parameter of + /// type ExceptionData and the format string "The option {0} is not known." + /// + /// User data + /// Inner Exception + public UnknownOption (ExceptionData Object, System.Exception Inner) : + base (global::System.String.Format ("The option {0} is not known.", + Object.String ), Inner) { + UserData = Object; + } + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new UnknownOption(Reason as string); + } + else if (Reason as ExceptionData != null) { + return new UnknownOption(Reason as ExceptionData); + } + else { + return new UnknownOption(); + } + } + } + + + /// + /// No command specified + /// + public class NoCommand : ParserException { + + /// + /// Construct instance for exception "No command specified" + /// + public NoCommand () : base ("No command specified") { + } + + /// + /// Construct instance for exception "No command specified" + /// + /// Description of the error + public NoCommand (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public NoCommand (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new NoCommand(Reason as string); + } + else { + return new NoCommand(); + } + } + } + + + /// + /// The option value was incorrectly formatted + /// + public class InvalidOption : ParserException { + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + public InvalidOption () : base ("The option value was incorrectly formatted") { + } + + /// + /// Construct instance for exception "The option value was incorrectly formatted" + /// + /// Description of the error + public InvalidOption (string Description) : base (Description) { + } + + /// + /// Construct instance for exception /// containing an inner exception. + /// + /// Description of the error + /// Inner Exception + public InvalidOption (string Description, System.Exception Inner) : + base (Description, Inner) { + } + + + + + + /// + /// The public fatory delegate + /// + public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; + + static System.Exception _Throw(object Reason) { + if (Reason as string != null) { + return new InvalidOption(Reason as string); + } + else { + return new InvalidOption(); + } + } + } + + + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/Exceptions.exceptional b/MakeyMakey/TestSolution/StandardLibrary/Exceptions.exceptional new file mode 100644 index 000000000..0220f6994 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Exceptions.exceptional @@ -0,0 +1,41 @@ + +Namespace Goedel.Command + + Exception ParserException + Console "The user command could not be parsed" + Description + |The user command could not be parsed + + Exception FileReadError + Console "The file could not be read" + Description + |The file could not be read. + + Object ExceptionData "The file {0} could not be read" + String + + Exception UnknownCommand + Console "Unknown command" + Description + |User entered an unknown command + + Object ExceptionData "The command {0} is not known." + String + + Exception UnknownOption + Console "Unknown option" + Description + |User entered an unknown option + + Object ExceptionData "The option {0} is not known." + String + + Exception NoCommand + Console "No command specified" + Description + |No command specified + + Exception InvalidOption + Console "The option value was incorrectly formatted" + Description + |The option value was incorrectly formatted \ No newline at end of file diff --git a/MakeyMakey/TestSolution/StandardLibrary/FileTools.cs b/MakeyMakey/TestSolution/StandardLibrary/FileTools.cs new file mode 100644 index 000000000..335f9c6d1 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/FileTools.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Goedel.Registry; + +namespace Goedel.Command { + + + /// + /// Utility class for managing files. + /// + public class FileTools { + + + /// + /// Get the time at which the specified file was created + /// Return DateTime.MinValue if the file does not exist + /// + /// The file to test + /// The time the file was created. + public static DateTime GetFileDateTime(string FileName) { + if (!File.Exists(FileName)) { + return DateTime.MinValue; + } + return File.GetLastWriteTimeUtc(FileName); + } + + /// + /// Write short form description of the current program to the console. + /// + public static void About() { + DateTime CompilationDate = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + + string Build = Script.LocalizeTime(CompilationDate, false); + + + Console.WriteLine(Script.AssemblyTitle); + Console.WriteLine(" {0}", Script.AssemblyDescription); + Console.WriteLine(" CopyRight : {0} {1}", Script.AssemblyCopyright, Script.AssemblyCompany); + Console.WriteLine(" Version : {0}", Script.AssemblyVersion); + Console.WriteLine(" Compiled : {0}", Build); + } + + /// + /// Cehck to see if a Destination file is more recent than a source file. + /// + /// The source file. + /// The destination file. + /// True if the source was created before the destination. + public static bool UpToDate(string Source, string Destination) { + + DateTime OutputDateTime = FileTools.GetFileDateTime(Destination); + if (OutputDateTime == DateTime.MinValue) { + return false; + } + DateTime ToolDateTime = Script.AssemblyBuildTime( + System.Reflection.Assembly.GetCallingAssembly()); + if (OutputDateTime < ToolDateTime) { + return false; + } + DateTime SourceDateTime = FileTools.GetFileDateTime(Source); + return (OutputDateTime > SourceDateTime); + } + + /// + /// Determine output file name using command line entry and default data. + /// + /// The default extension. + /// The base file name. + /// The defaulted output file. + public static string DefaultFile(string Extension, string Default) { + return Path.GetFileNameWithoutExtension(Default) + "." + Extension; + } + + + // + // Search for a file. + // + // If FileName exists, use that, otherwise try FileName.Extension + // + + /// + /// Search for a file using specified extension if required. + /// + /// The base file name. + /// Default extension. + /// The defaulted file. + public static string DefaultExtension(string FileName, string Extension) { + if (File.Exists(FileName)) { + return FileName; + } + + return FileName + "." + Extension; + } + + /// + /// Calculate output file name. + /// + /// The source file path + /// The destination file path. + /// The default extension. + /// The defaulted file name. + public static string DefaultOutput(string SourcePath, string DestinationPath, + string Extension) { + if (DestinationPath != null) { + return DestinationPath; + } + return Path.GetFileNameWithoutExtension(SourcePath) + "." + Extension; + } + } + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/Main.command b/MakeyMakey/TestSolution/StandardLibrary/Main.command new file mode 100644 index 000000000..dce9549fc --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Main.command @@ -0,0 +1,20 @@ +Class DomainerShell DomainerShell + Brief "Manage DNS Resource and Query Records" + + Type NewFile "file" + Type ExistingFile "file" + Type Flag "flag" + + About "about" + + Command GenerateDomainer "in" + DefaultCommand + + Lazy Lazy "lazy" + Brief "Only generate code if source or generator have changed" + + Parser Goedel.Tool.Domainer Domainer "domainer" + + Script Goedel.Tool.Domainer Generate GenerateCS "cs" + Brief "Generate C# code" + Default "cs" diff --git a/MakeyMakey/TestSolution/StandardLibrary/Main.cs b/MakeyMakey/TestSolution/StandardLibrary/Main.cs new file mode 100644 index 000000000..d60180c7a --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Main.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Goedel.Command; +using Goedel.Registry; +using Goedel.Utilities; + +namespace DomainerShell { + public partial class CommandLineInterpreter : CommandLineInterpreterBase { + + /// The command entries + public static SortedDictionary Entries; + /// The default command. + public static DescribeCommandEntry DefaultCommand; + /// Description of the comman + public static string Description = ""; + + static char UnixFlag = '-'; + static char WindowsFlag = '/'; + + + /// + /// + /// + /// + /// + /// + public static void Help (DispatchShell Dispatch, string[] args, int index) { + Brief(Description, DefaultCommand, Entries); + } + + public static DescribeCommandEntry DescribeHelp = new DescribeCommandEntry() { + Identifier = "help", + HandleDelegate = Help, + Entries = new List() { } + }; + + /// + /// Describe the application invoked by the command. + /// + /// The command description. + /// The set of arguments. + /// The first unparsed argument. + public static void About (DispatchShell Dispatch, string[] args, int index) { + FileTools.About(); + } + + public static DescribeCommandEntry DescribeAbout = new DescribeCommandEntry() { + Identifier = "about", + HandleDelegate = About, + Entries = new List() { } + }; + + static bool IsFlag(char c) { + return (c == UnixFlag) | (c == WindowsFlag) ; + } + + + static CommandLineInterpreter () { + System.OperatingSystem OperatingSystem = System.Environment.OSVersion; + + if (OperatingSystem.Platform == PlatformID.Unix | + OperatingSystem.Platform == PlatformID.MacOSX) { + FlagIndicator = UnixFlag; + } + else { + FlagIndicator = WindowsFlag; + } + + DefaultCommand = _GenerateDomainer._DescribeCommand; + Description = "Manage DNS Resource and Query Records"; + + Entries = new SortedDictionary () { + {"about", DescribeAbout }, + {"in", _GenerateDomainer._DescribeCommand }, + {"help", DescribeHelp } + }; // End Entries + + + + } + + static void Main(string[] args) { + var CLI = new CommandLineInterpreter (); + CLI.MainMethod (args); + } + + public void MainMethod(string[] Args) { + DomainerShell Dispatch = new DomainerShell (); + + MainMethod (Dispatch, Args); + } + + + public void MainMethod(DomainerShell Dispatch, string[] Args) { + Dispatcher (Entries, DefaultCommand, Dispatch, Args, 0); + } // Main + + + + public static void Handle_GenerateDomainer ( + DispatchShell DispatchIn, string[] Args, int Index) { + DomainerShell Dispatch = DispatchIn as DomainerShell; + GenerateDomainer Options = new GenerateDomainer (); + ProcessOptions (Args, Index, Options); + Dispatch.GenerateDomainer (Options); + } + + + } // class Main + + + // The stub class for carrying optional parameters for each command type + // As with the main class each consists of an abstract main class + // with partial virtual that can be extended as required. + + // All subclasses inherit from the abstract classes Goedel.Regisrty.Dispatch + // and Goedel.Command.Type + + + public class _GenerateDomainer : Goedel.Command.Dispatch { + + public override Goedel.Command.Type[] _Data {get; set;} = new Goedel.Command.Type [] { + new Flag (), + new ExistingFile (), + new NewFile () } ; + + /// Field accessor for parameter [lazy] + public virtual Flag Lazy { + get => _Data[0] as Flag; + set => _Data[0] = value; + } + + public virtual string _Lazy { + set => _Data[0].Parameter (value); + } + /// Field accessor for parameter [] + public virtual ExistingFile Domainer { + get => _Data[1] as ExistingFile; + set => _Data[1] = value; + } + + public virtual string _Domainer { + set => _Data[1].Parameter (value); + } + /// Field accessor for option [cs] + public virtual NewFile GenerateCS { + get => _Data[2] as NewFile; + set => _Data[2] = value; + } + + public virtual string _GenerateCS { + set => _Data[2].Parameter (value); + } + public override DescribeCommandEntry DescribeCommand {get; set;} = _DescribeCommand; + + public static DescribeCommandEntry _DescribeCommand = new DescribeCommandEntry () { + Identifier = "in", + Brief = "", + HandleDelegate = CommandLineInterpreter.Handle_GenerateDomainer, + Lazy = true, + Entries = new List () { + new DescribeEntryParameter () { + Identifier = "Domainer", + Default = null, // null if null + Brief = "", + Index = 1, + Key = "" + }, + new DescribeEntryOption () { + Identifier = "GenerateCS", + Default = "cs", // null if null + Brief = "Generate C# code", + Index = 2, + Key = "cs" + } + } + }; + + } + + public partial class GenerateDomainer : _GenerateDomainer { + } // class GenerateDomainer + + + public partial class NewFile : _NewFile { + public static NewFile Factory (string Value) { + var Result = new NewFile(); + Result.Default(Value); + return Result; + } + } // NewFile + + + public partial class ExistingFile : _ExistingFile { + public static ExistingFile Factory (string Value) { + var Result = new ExistingFile(); + Result.Default(Value); + return Result; + } + } // ExistingFile + + + public partial class Flag : _Flag { + public static Flag Factory (string Value) { + var Result = new Flag(); + Result.Default(Value); + return Result; + } + } // Flag + + + + // The stub class just contains routines that echo their arguments and + // write 'not yet implemented' + + // Eventually there will be a compiler option to suppress the debugging + // to eliminate the redundant code + public class _DomainerShell : global::Goedel.Command.DispatchShell { + + public virtual void GenerateDomainer ( GenerateDomainer Options) { + string inputfile = null; + + inputfile = Options.Domainer.Text; + + Goedel.Tool.Domainer.Domainer Parse = new Goedel.Tool.Domainer.Domainer() { + }; + + + using (Stream infile = + new FileStream(inputfile, FileMode.Open, FileAccess.Read)) { + + Lexer Schema = new Lexer(inputfile); + + Schema.Process(infile, Parse); + } + + + // Script output of type GenerateCS cs + if (Options.GenerateCS.Text != null) { + string outputfile = Options.GenerateCS.Text; // Automatically defaults + if (Options.Lazy.Value & FileTools.UpToDate (inputfile, outputfile)) { + return; + } + using (Stream outputStream = + new FileStream(outputfile, FileMode.Create, FileAccess.Write)) { + using (TextWriter OutputWriter = new StreamWriter(outputStream, Encoding.UTF8)) { + + Goedel.Tool.Domainer.Generate Script = new Goedel.Tool.Domainer.Generate (OutputWriter); + + Script.GenerateCS (Parse); + } + } + } + } + + + } // class _DomainerShell + + public partial class DomainerShell : _DomainerShell { + } // class DomainerShell + + } // namespace DomainerShell + + diff --git a/MakeyMakey/TestSolution/StandardLibrary/NamespaceDoc.cs b/MakeyMakey/TestSolution/StandardLibrary/NamespaceDoc.cs new file mode 100644 index 000000000..c306a76b5 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/NamespaceDoc.cs @@ -0,0 +1,11 @@ +namespace Goedel.Command { + + /// + /// Support routines for command line parsers defined using the PHB Command tool. + /// + + [System.Runtime.CompilerServices.CompilerGenerated] + class NamespaceDoc { + } + + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/Parse.md b/MakeyMakey/TestSolution/StandardLibrary/Parse.md new file mode 100644 index 000000000..d86aabb9b --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Parse.md @@ -0,0 +1,15 @@ + // split a command line into chunks applying windows command line escaping rules + // + // one two -> [one] [two] + // "one two" -> [one two] + // "one"two" -> [onetwo] + // "one""two" -> [one"two] + // \\ -> [\\] + // \\" -> [\"] + // \\" \\ -> [\ \\] + // \\\" \\ -> [\"] [\\] + // "Test""Here" -> [TestHere] + // Test""Here -> [Test"Here]] + + + "" Test-> [] [Test] \ No newline at end of file diff --git a/MakeyMakey/TestSolution/StandardLibrary/StandardLibrary.csproj b/MakeyMakey/TestSolution/StandardLibrary/StandardLibrary.csproj new file mode 100644 index 000000000..89356a0b9 --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/StandardLibrary.csproj @@ -0,0 +1,57 @@ + + + + netstandard2.0 + + + + + CommandLex.fsm + True + True + + + CommandSplit.fsm + True + True + + + Exceptions.exceptional + True + True + + + Main.command + True + True + + + + + + CommandLex.cs + fsrcs + + + CommandSplit.cs + fsrcs + + + Exceptions.cs + exceptional + + + Main.cs + CommandCS + + + + + + + + + + + + diff --git a/MakeyMakey/TestSolution/StandardLibrary/Type.cs b/MakeyMakey/TestSolution/StandardLibrary/Type.cs new file mode 100644 index 000000000..df5dfc1db --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/Type.cs @@ -0,0 +1,293 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Goedel.Utilities; +using Goedel.Registry; + +namespace Goedel.Command { + /// Base class for Command line parser types. This could do with + /// some decrufting to remove implementation artifacts. + public abstract class Type { + + /// The command line value. + public virtual string Text { get; set; } + + /// If true, the value was set by default + public bool ByDefault { get; set; } = true; + + /// + /// Convert value to string. + /// + /// The string value. + public override string ToString () { + return Text; + } + + /// + /// Set parameter text. + /// + /// Text to set. + public virtual void Parameter (string TextIn) { + Text = TextIn; + } + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public virtual void Default (string TextIn) { + Parameter(TextIn); + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The final data. + public virtual void Complete (Type[] Data) { + } + + /// + /// Set the flag value. + /// + /// If true, flag is negated. + public virtual void SetFlag (bool Negated) { + } + + } + + /// + /// Command line boolean type for flags. + /// + public abstract class _Flag : Goedel.Command.Type { + + /// The canonical command line value. + public override string Text { + get => Value ? "true" : "false"; + set => Parameter(value); + } + + /// + /// Default constructor + /// + public _Flag () { + } + + /// + /// Construct flag with specified value + /// + /// The flag value to set + public _Flag (string Value) { + Default(Value); + } + + /// + /// The flag value. + /// + public virtual bool Value { get; set; } + + /// + /// Set tag value from parameter. + /// + /// The values true and 1 set a true value, 0 and false set a false value. + /// Otherwise an exception is thrown. + public override void Parameter (string Text) { + //Text = (Text == null) ? "true" : Text; + switch (Text.ToLower()) { + case "true": + case "1": { + Value = true; + break; + } + case "false": + case "0": { + Value = false; + break; + } + case "": { + break; + } + default: + throw new System.Exception("Flag value not recognized" + Text); + } + } + + /// + /// Set the negated flag + /// + /// If true, command is negated. + public override void SetFlag (bool Negated) { + Parameter (Negated ? "false" : "true"); + ByDefault = false; + } + + /// + /// Convert value to string. + /// + /// the string value + public override string ToString () { + return Text; + } + + + + } + + + /// + /// Command line flag for file. + /// + public abstract class _File : Goedel.Command.Type { + /// + /// Default constructor + /// + public _File () { + } + + /// + /// Constructor with specified default value. + /// + /// The default value text for this entry + public _File (string Value) { + Default(Value); + } + + /// + /// The default extension. + /// + public string Extension = ""; + + /// + /// Set the default. + /// + /// The default value text for this entry + public override void Default (string TextIn) { + Extension = TextIn; + } + + /// + /// The value. + /// + public string Value => Text; + + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// File name. + public string DefaultFile (_File Source) { + return DefaultFile(Source.Text); + } + + /// + /// Construct extension defaulted file name for specified file. + /// + /// The source file. + /// The extension. + /// File name. + public string DefaultFile (string Source, string Extension = null) { + Extension = Extension ?? this.Extension; + + Text = FileTools.DefaultFile(Extension, Source); + return Text; + } + + + + + } + + /// + /// Command line flag for file. + /// + public abstract class _NewFile : _File { + bool Flagged = false; + + /// + /// Set the negated flag + /// + /// if true, is negated. + public override void SetFlag (bool Negated) { + Flagged = true; + } + + + /// + /// Set the default value for the type. + /// + /// The default value as it would be given on the command line. + public override void Default (string TextIn) { + Extension = TextIn; + } + + + /// + /// Completion routine. This is called at the end of parameter processing to finalize default values. + /// + /// The completed data + public override void Complete (Type[] Data) { + if (!ByDefault | !Flagged) { + return; // not flagged or explicitly set + } + + var Source = Get(Data); + if (Source != null) { + Parameter(DefaultFile(Source)); + } + + } + + + _ExistingFile Get (Type[] Data) { + foreach (var Entry in Data) { + if (Entry as _ExistingFile != null) { + return Entry as _ExistingFile; + } + } + return null; + } + } + + /// + /// Command line flag for file. + /// + public abstract class _ExistingFile : _File { + + } + + /// + /// Command line flag for file. + /// + public abstract class _Integer : Type { + + /// + /// Return the value as an integer + /// + public int Value { + get { + if (Text == "") { + return 0; + } + if (int.TryParse(Text, out var Result)) { + return Result; + } + throw new InvalidOption(); + } + } + } + + /// + /// Command line flag for file. + /// + public abstract class _String : Type { + /// + /// The value. + /// + public string Value => Text; + + } + + } diff --git a/MakeyMakey/TestSolution/StandardLibrary/VS.Make b/MakeyMakey/TestSolution/StandardLibrary/VS.Make new file mode 100644 index 000000000..cc1173a9e --- /dev/null +++ b/MakeyMakey/TestSolution/StandardLibrary/VS.Make @@ -0,0 +1,52 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = \ + CommandLex.cs\ + CommandSplit.cs\ + Exceptions.cs\ + Main.cs + +CommandLex.fsm : CommandLex.cs + fsrgen CommandLex.fsm CommandLex.cs + +CommandSplit.fsm : CommandSplit.cs + fsrgen CommandSplit.fsm CommandSplit.cs + +Exceptions.exceptional : Exceptions.cs + exceptional Exceptions.exceptional Exceptions.cs + +Main.command : Main.cs + commandparse Main.command Main.cs + + +prebuildRecurse : + +postbuildRecurse : + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/TestSolution/TestSolution.sln b/MakeyMakey/TestSolution/TestSolution.sln new file mode 100644 index 000000000..3c244a068 --- /dev/null +++ b/MakeyMakey/TestSolution/TestSolution.sln @@ -0,0 +1,59 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2009 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StandardLibrary", "StandardLibrary\StandardLibrary.csproj", "{00561998-DFE2-45A0-9F55-C63C727BEA94}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedProject", "SharedProject\SharedProject.shproj", "{5CB9FA6C-A53B-46CE-9F1F-219C2D293BD7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreConsole", "CoreConsole\CoreConsole.csproj", "{E723EE13-4532-4CF7-B6A4-82FF1124AF0F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrameworkLibrary", "FrameworkLibrary\FrameworkLibrary.csproj", "{B003A172-61D1-40DC-96A8-28B760D5CDC1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildProject", "BuildProject.csproj", "{1F4B83F8-B03A-4A5C-87CB-74524A7379F6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ContainerStandard", "ContainerStandard\ContainerStandard.csproj", "{D3EBC8C5-79CC-44B3-B4B9-74FD3905EAF5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Container2", "Container2\Container2.csproj", "{0A0FAF02-1C53-4EFD-A969-88B695389FC5}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + SharedProject\SharedProject.projitems*{5cb9fa6c-a53b-46ce-9f1f-219c2d293bd7}*SharedItemsImports = 13 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00561998-DFE2-45A0-9F55-C63C727BEA94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00561998-DFE2-45A0-9F55-C63C727BEA94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00561998-DFE2-45A0-9F55-C63C727BEA94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00561998-DFE2-45A0-9F55-C63C727BEA94}.Release|Any CPU.Build.0 = Release|Any CPU + {E723EE13-4532-4CF7-B6A4-82FF1124AF0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E723EE13-4532-4CF7-B6A4-82FF1124AF0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E723EE13-4532-4CF7-B6A4-82FF1124AF0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E723EE13-4532-4CF7-B6A4-82FF1124AF0F}.Release|Any CPU.Build.0 = Release|Any CPU + {B003A172-61D1-40DC-96A8-28B760D5CDC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B003A172-61D1-40DC-96A8-28B760D5CDC1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B003A172-61D1-40DC-96A8-28B760D5CDC1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B003A172-61D1-40DC-96A8-28B760D5CDC1}.Release|Any CPU.Build.0 = Release|Any CPU + {1F4B83F8-B03A-4A5C-87CB-74524A7379F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F4B83F8-B03A-4A5C-87CB-74524A7379F6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F4B83F8-B03A-4A5C-87CB-74524A7379F6}.Release|Any CPU.Build.0 = Release|Any CPU + {D3EBC8C5-79CC-44B3-B4B9-74FD3905EAF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3EBC8C5-79CC-44B3-B4B9-74FD3905EAF5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3EBC8C5-79CC-44B3-B4B9-74FD3905EAF5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3EBC8C5-79CC-44B3-B4B9-74FD3905EAF5}.Release|Any CPU.Build.0 = Release|Any CPU + {0A0FAF02-1C53-4EFD-A969-88B695389FC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A0FAF02-1C53-4EFD-A969-88B695389FC5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A0FAF02-1C53-4EFD-A969-88B695389FC5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A0FAF02-1C53-4EFD-A969-88B695389FC5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E1ED80BA-9915-4067-86B4-273C6DCC152C} + EndGlobalSection +EndGlobal diff --git a/MakeyMakey/TestSolution/VS.Make b/MakeyMakey/TestSolution/VS.Make new file mode 100644 index 000000000..43c0cbe1a --- /dev/null +++ b/MakeyMakey/TestSolution/VS.Make @@ -0,0 +1,36 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +MSBuildThisFileDirectory = + +LinkFiles = + +ToolTargets = + + +prebuildRecurse : + +postbuildRecurse : + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + + diff --git a/MakeyMakey/makey/Commands.cs b/MakeyMakey/makey/Commands.cs index 20a4bfd37..f08c79707 100644 --- a/MakeyMakey/makey/Commands.cs +++ b/MakeyMakey/makey/Commands.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Text; @@ -88,7 +88,15 @@ static void Main(string[] args) { public void MainMethod(string[] Args) { MakeyShell Dispatch = new MakeyShell (); - MainMethod (Dispatch, Args); + try { + MainMethod (Dispatch, Args); + } + catch (Goedel.Command.ParserException) { + Brief(Description, DefaultCommand, Entries); + } + catch (System.Exception Exception) { + Console.WriteLine("Application: {0}", Exception.Message); + } } diff --git a/MakeyMakey/makey/Dispatch.cs b/MakeyMakey/makey/Dispatch.cs index 5c39302ad..09a600d02 100644 --- a/MakeyMakey/makey/Dispatch.cs +++ b/MakeyMakey/makey/Dispatch.cs @@ -23,10 +23,16 @@ public override void Project (Project Options) { var OutputFile = Path.Combine(SolutionPath, "Makefile"); foreach (var Item in Solution.Projects) { + var ProjectFile = Path.Combine(SolutionPath, Item.Directory); + Console.WriteLine("Make Project {0}\n {1}", ProjectFile, Item.TypeGUID); + + + if (Item.Recurse) { - var ProjectFile = Path.Combine(SolutionPath, Item.Directory); + Item.Project = new VSProject(ProjectFile, true); + Item.Project.ProjectType = Item.ProjectType; var ProjectPath = Path.GetDirectoryName(Item.Directory); var TargetFile = Path.Combine(SolutionPath, ProjectPath, "Makefile"); @@ -41,16 +47,21 @@ public override void Project (Project Options) { // } // } - //var TargetFile2 = Path.Combine(SolutionPath, ProjectPath, "VS.Make"); - //using (var outputStream = TargetFile2.OpenFileNew()) { - // using (var outputText = outputStream.OpenTextWriter()) { - // var Generate = new Generate(outputText); + var TargetFile2 = Path.Combine(SolutionPath, ProjectPath, "VS.Make"); - // Generate.GenerateVSMakefile(Item.Project); - // } - // } + var Project = (Item.ProjectType == ProjectType.shared) ? + Item.Project.SharedProject[0] : Item.Project; + + using (var outputStream = TargetFile2.OpenFileNew()) { + using (var outputText = outputStream.OpenTextWriter()) { + var Generate = new Generate(outputText); + + Generate.GenerateVSMakefile(Project); + } + } } + } } diff --git a/MakeyMakey/makey/Properties/launchSettings.json b/MakeyMakey/makey/Properties/launchSettings.json index 79dd0a010..ac214340a 100644 --- a/MakeyMakey/makey/Properties/launchSettings.json +++ b/MakeyMakey/makey/Properties/launchSettings.json @@ -2,8 +2,8 @@ "profiles": { "makey": { "commandName": "Project", - "commandLineArgs": "mmm.sln", - "workingDirectory": "C:\\Users\\hallam\\Work\\mmm" + "commandLineArgs": "TestSolution.sln", + "workingDirectory": "C:\\Users\\hallam\\Work\\buildtools\\MakeyMakey\\TestSolution" } } } \ No newline at end of file diff --git a/MakeyMakey/makey/VS.Make b/MakeyMakey/makey/VS.Make new file mode 100644 index 000000000..8a0deeb06 --- /dev/null +++ b/MakeyMakey/makey/VS.Make @@ -0,0 +1,43 @@ + +# Supplemental Makefile for Visual Studios Projects +# +# Visual Studio is responsible for managing rules for production of +# code but does not provide support for pre and post build actions. +# +# Prebuild items supported: +# [None currently] +# +# PostBuild items supported: +# * Copy library to locations on disk +# * Build ilMerge executables +# * Postprocess VSIX projects +# * Copy executables + +.PHONY : all always clean install publish prebuild prebuildRecurse postbuild postbuildRecurse + +LinkFiles = \ + Goedel.FSR.dll\ + Goedel.Registry.dll\ + Goedel.Utilities.dll + +ToolTargets = \ + Commands.command + +Commands.cs : Commands.command + commandparse Commands.command /cs=Commands.cs + +prebuildRecurse : + cd ..\Goedel.Tool.Makey && nmake /c /f VS.make prebuild + +prebuild : prebuildRecurse $(ToolTargets) + echo Completed prebuild $(MAKEDIR) + +postbuildRecurse : + cd ..\Goedel.Tool.Makey && nmake /c /f VS.make postbuild + +postbuild : postbuildRecurse + echo Completed postbuild $(MAKEDIR) + +# powershell publishtarget Goedel.Tool.Makey.dll + + diff --git a/MakeyMakey/makey/makey.csproj b/MakeyMakey/makey/makey.csproj index a9defb929..9572ae3ec 100644 --- a/MakeyMakey/makey/makey.csproj +++ b/MakeyMakey/makey/makey.csproj @@ -29,4 +29,12 @@ + + + + + + + + diff --git a/MakeyMakey/xGoedel.Tool.Makey/Exceptions.cs b/MakeyMakey/xGoedel.Tool.Makey/Exceptions.cs deleted file mode 100644 index 7985bc16f..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Exceptions.cs +++ /dev/null @@ -1,277 +0,0 @@ -using System; -using Goedel.Utilities; - -using Goedel.FSR; - - -namespace Goedel.Tool.Makey { - - - /// - /// - public class KeyFileException : global::System.Exception { - - /// - /// Construct instance for exception "Key could not be read" - /// - public KeyFileException () : base ("Key could not be read") { - } - - /// - /// Construct instance for exception "Key could not be read" - /// - /// Description of the error - public KeyFileException (string Description) : base (Description) { - } - - /// - /// Construct instance for exception /// containing an inner exception. - /// - /// Description of the error - /// Inner Exception - public KeyFileException (string Description, System.Exception Inner) : - base (Description, Inner) { - } - - /// - /// User data associated with the exception. - /// - public object UserData; - - - - - /// - /// The public fatory delegate - /// - public static global::Goedel.Utilities.ThrowDelegate Throw = _Throw; - - static System.Exception _Throw(object Reason) { - if (Reason as string != null) { - return new KeyFileException(Reason as string); - } - else { - return new KeyFileException(); - } - } - } - - - /// - /// The specified key did not have a valid cryptographic - /// provider. This may be because the key algorithm is - /// not supported or the key parameters were found to be invalid. - /// - public class NoProviderSpecified : KeyFileException { - - /// - /// Construct instance for exception "No provider specified" - /// - public NoProviderSpecified () : base ("No provider specified") { - } - - /// - /// Construct instance for exception "No provider specified" - /// - /// Description of the error - public NoProviderSpecified (string Description) : base (Description) { - } - - /// - /// Construct instance for exception /// containing an inner exception. - /// - /// Description of the error - /// Inner Exception - public NoProviderSpecified (string Description, System.Exception Inner) : - base (Description, Inner) { - } - - - - - - /// - /// The public fatory delegate - /// - public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; - - static System.Exception _Throw(object Reason) { - if (Reason as string != null) { - return new NoProviderSpecified(Reason as string); - } - else { - return new NoProviderSpecified(); - } - } - } - - - /// - /// An attempt was made to perform a private key operation - /// and the private key parameters could not be found. - /// - public class PrivateKeyNotAvailable : KeyFileException { - - /// - /// Construct instance for exception "The specified private key could not be found" - /// - public PrivateKeyNotAvailable () : base ("The specified private key could not be found") { - } - - /// - /// Construct instance for exception "The specified private key could not be found" - /// - /// Description of the error - public PrivateKeyNotAvailable (string Description) : base (Description) { - } - - /// - /// Construct instance for exception /// containing an inner exception. - /// - /// Description of the error - /// Inner Exception - public PrivateKeyNotAvailable (string Description, System.Exception Inner) : - base (Description, Inner) { - } - - - - - - /// - /// The public fatory delegate - /// - public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; - - static System.Exception _Throw(object Reason) { - if (Reason as string != null) { - return new PrivateKeyNotAvailable(Reason as string); - } - else { - return new PrivateKeyNotAvailable(); - } - } - } - - - /// - /// An attempt to read a file failed because data was - /// missing or corrupted. - /// - public class UnexpectedEnd : KeyFileException { - - /// - /// Construct instance for exception "File read error, file was incomplete" - /// - public UnexpectedEnd () : base ("File read error, file was incomplete") { - } - - /// - /// Construct instance for exception "File read error, file was incomplete" - /// - /// Description of the error - public UnexpectedEnd (string Description) : base (Description) { - } - - /// - /// Construct instance for exception /// containing an inner exception. - /// - /// Description of the error - /// Inner Exception - public UnexpectedEnd (string Description, System.Exception Inner) : - base (Description, Inner) { - } - - - - - - /// - /// The public fatory delegate - /// - public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; - - static System.Exception _Throw(object Reason) { - if (Reason as string != null) { - return new UnexpectedEnd(Reason as string); - } - else { - return new UnexpectedEnd(); - } - } - } - - - /// - /// - public class ParseError : KeyFileException { - - /// - /// Construct instance for exception "An error occurred" - /// - public ParseError () : base ("An error occurred") { - } - - /// - /// Construct instance for exception "An error occurred" - /// - /// Description of the error - public ParseError (string Description) : base (Description) { - } - - /// - /// Construct instance for exception /// containing an inner exception. - /// - /// Description of the error - /// Inner Exception - public ParseError (string Description, System.Exception Inner) : - base (Description, Inner) { - } - - - /// - /// Construct instance for exception using a userdata parameter of - /// type LexReader and the format string "The file {0} could not be read" - /// - /// User data - public ParseError (LexReader Object) : - base (global::System.String.Format ("The file {0} could not be read", - Object.FilePath )) { - UserData = Object; - } - - /// - /// Construct instance for exception using a userdata parameter of - /// type LexReader and the format string "The file {0} could not be read" - /// - /// User data - /// Inner Exception - public ParseError (LexReader Object, System.Exception Inner) : - base (global::System.String.Format ("The file {0} could not be read", - Object.FilePath ), Inner) { - UserData = Object; - } - - - - - /// - /// The public fatory delegate - /// - public static new global::Goedel.Utilities.ThrowDelegate Throw = _Throw; - - static System.Exception _Throw(object Reason) { - if (Reason as string != null) { - return new ParseError(Reason as string); - } - else if (Reason as LexReader != null) { - return new ParseError(Reason as LexReader); - } - else { - return new ParseError(); - } - } - } - - - } diff --git a/MakeyMakey/xGoedel.Tool.Makey/Exceptions.exceptional b/MakeyMakey/xGoedel.Tool.Makey/Exceptions.exceptional deleted file mode 100644 index 394f2e956..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Exceptions.exceptional +++ /dev/null @@ -1,30 +0,0 @@ -Using Goedel.FSR - -Namespace Goedel.Tool.Makey - - Exception KeyFileException - Console "Key could not be read" - - - Exception NoProviderSpecified - Console "No provider specified" - Description - |The specified key did not have a valid cryptographic - |provider. This may be because the key algorithm is - |not supported or the key parameters were found to be invalid. - - Exception PrivateKeyNotAvailable - Console "The specified private key could not be found" - Description - |An attempt was made to perform a private key operation - |and the private key parameters could not be found. - - Exception UnexpectedEnd - Console "File read error, file was incomplete" - Description - |An attempt to read a file failed because data was - |missing or corrupted. - - Exception ParseError - Object LexReader "The file {0} could not be read" - FilePath \ No newline at end of file diff --git a/MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.cs b/MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.cs deleted file mode 100644 index 0bf4c01c4..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.cs +++ /dev/null @@ -1,477 +0,0 @@ -// Script Syntax Version: 1.0 - -// Unknown by Unknown -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -// -using System; -using System.IO; -using System.Collections.Generic; -using Goedel.Registry; -namespace Goedel.Tool.Makey { - public partial class Generate : global::Goedel.Registry.Script { - - public Generate (TextWriter Output) : base (Output) {} - string Prefix = "! "; //"\t"; - - - // - // Preamble - // - public void Preamble (VSFile VSFile) { - _Output.Write ("# This file is generated automatically from the Visual Studio Project\n{0}", _Indent); - _Output.Write ("# File. If you make changes to this file and do not update the project\n{0}", _Indent); - _Output.Write ("# file, changes will be lost when the file is regenerated.\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# NB: This process will fail if any of the paths have spaces in them\n{0}", _Indent); - _Output.Write ("# While it is possible to work around the lack of support for spaces in \n{0}", _Indent); - _Output.Write ("# file paths in gmake, it is not possible to do this reliably in the tools\n{0}", _Indent); - _Output.Write ("# that it invokes to build the system. Rather than do half a job, it seems\n{0}", _Indent); - _Output.Write ("# safest to simply reject the corner case\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# The following targets are defined (well planned)\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# make Compile for the current platform\n{0}", _Indent); - _Output.Write ("# make cross Compile for all platforms\n{0}", _Indent); - _Output.Write ("# make install Compile and install\n{0}", _Indent); - _Output.Write ("# make clean Delete all target and intermediate files\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# The following build flags are supported\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# make mode= release | debug Build release or debug version\n{0}", _Indent); - _Output.Write ("# make arch= this | all | Bundle for the current platform, all platforms\n{0}", _Indent); - _Output.Write ("# or the specified platform\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Define the default target directories (referenced projects must all follow same scheme)\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# By default, we arrange the mono targets as follows:\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# The source code directory\n{0}", _Indent); - _Output.Write ("# /mono/ Equivalent to VS bin directory\n{0}", _Indent); - _Output.Write ("# /mono/Debug Equivalent to VS bin/Debug directory\n{0}", _Indent); - _Output.Write ("# /mono/Release Equivalent to VS bin/Debug directory\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# If the target is an executable, the following directories are also created:\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# /This The bundled executable for the platform the code was compiled on\n{0}", _Indent); - _Output.Write ("# / The bundled executable for the platform \n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# If the install target is selected, the bundles will be installed in\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# ~/Tools/This The bundled executable for platform the code is built on\n{0}", _Indent); - _Output.Write ("# ~/Tools/ The bundled executable for this platform \n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("export TARGETROOT ?= mono\n{0}", _Indent); - _Output.Write ("export MODE ?= Release\n{0}", _Indent); - _Output.Write ("export ARCH ?= This\n{0}", _Indent); - _Output.Write ("export Packages ?= $(HOME)/Packages\n{0}", _Indent); - _Output.Write ("export PackagesPath ?= /lib/net40\n{0}", _Indent); - _Output.Write ("export Libraries ?= $(HOME)/Libraries\n{0}", _Indent); - _Output.Write ("export LibrariesPath ?= /Mono\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("export TARGETBIN = $(TARGETROOT)/$(MODE)\n{0}", _Indent); - _Output.Write ("export TARGETEXE = $(TARGETROOT)/$(ARCH)\n{0}", _Indent); - _Output.Write ("export LIBRARYBIN = $(Libraries)$(LibrariesPath)\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("export DESTDIR ?= $(HOME)/.local\n{0}", _Indent); - _Output.Write ("export bindir ?= /bin\n{0}", _Indent); - _Output.Write ("export libdir ?= /lib\n{0}", _Indent); - _Output.Write ("export INSTALL_PROGRAM ?= $(DESTDIR)$(bindir)\n{0}", _Indent); - _Output.Write ("export INSTALL_DATA ?= $(DESTDIR)$(libdir)\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Define the default compilers, linkers, packagers, etc.\n{0}", _Indent); - _Output.Write ("export CSHARPDLL ?= mcs /target:library\n{0}", _Indent); - _Output.Write ("export CSHARPEXE ?= mcs /target:exe\n{0}", _Indent); - _Output.Write ("export BUNDLE ?= mkbundle -L /usr/lib/mono/4.7-api --deps --static -o \n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# The following tools are used in the goedel build system itself:\n{0}", _Indent); - PHBTool ("RFC2TXT", "rfctool /in", "/txt"); - PHBTool ("RFC2XML", "rfctool /in", "/xml"); - PHBTool ("RFC2MD", "rfctool /in", "/md"); - PHBTool ("RFC2HTML", "rfctool /in", "/html"); - PHBTool ("CommandCS", "commandparse /in", "/cs"); - PHBTool ("FSRCS", "fsrgen /in", "/cs"); - PHBTool ("Exceptional", "exceptional /in", "/cs"); - PHBTool ("GScript", "gscript /in", "/cs"); - PHBTool ("Goedel3", "goedel3 /in", "/cs"); - PHBTool ("ASN2CS", "asn2 /in", "/cs"); - PHBTool ("DomainerCS", "domainer /in", "/cs"); - PHBTool ("RegistryCS", "registryconfig /in", "/cs"); - PHBTool ("VSIXBuild", "vsixbuild /in", "/cs"); - PHBTool ("ProtoGen", "protogen /in", "/cs"); - PHBTool ("TrojanGTK", "trojan /gtk", "/cs"); - _Output.Write ("\n{0}", _Indent); - if ( (Prefix != "\t") ) { - _Output.Write ("# Use the specified character as the prefix character. Note this may not \n{0}", _Indent); - _Output.Write ("# be supported on versions of make other than gmake.\n{0}", _Indent); - _Output.Write (".RECIPEPREFIX = {1}\n{0}", _Indent, Prefix); - } - } - - - // - // GenerateVSMakefile - // - public void GenerateVSMakefile (VSProject Project) { - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Supplemental Makefile for Visual Studios Projects\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# Visual Studio is responsible for managing rules for production of\n{0}", _Indent); - _Output.Write ("# code but does not provide support for pre and post build actions.\n{0}", _Indent); - _Output.Write ("# \n{0}", _Indent); - _Output.Write ("# Prebuild items supported:\n{0}", _Indent); - _Output.Write ("# [None currently]\n{0}", _Indent); - _Output.Write ("# \n{0}", _Indent); - _Output.Write ("# PostBuild items supported:\n{0}", _Indent); - _Output.Write ("# * Copy library to locations on disk\n{0}", _Indent); - _Output.Write ("# * Build ilMerge executables\n{0}", _Indent); - _Output.Write ("# * Postprocess VSIX projects\n{0}", _Indent); - _Output.Write ("# * Copy executables\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("LinkFiles = ", _Indent); - foreach (var File in Project.FixedLinkDependency) { - _Output.Write ("\\\n{0}", _Indent); - _Output.Write (" {1}", _Indent, File); - } - foreach (var File in Project.LinkDependency) { - _Output.Write ("\\\n{0}", _Indent); - _Output.Write (" {1}", _Indent, File); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("prebuild : \n{0}", _Indent); - _Output.Write (" echo \"Do Prebuild\"\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("postbuild : \n{0}", _Indent); - if ( (Project.IsExe) ) { - _Output.Write (" powershell publishtarget {1} $(LinkFiles) \n{0}", _Indent, Project.Target); - } else if ( (Project.IsLibrary)) { - _Output.Write (" powershell publishtarget {1}\n{0}", _Indent, Project.Target); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - } - - - // - // GenerateMakefile - // - public void GenerateMakefile (VSSolution Solution) { - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# Makefile for Visual Studio Solution ..\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - Preamble (Solution); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# The main target\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (".PHONY : all always clean install publish cross\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Need to identify the target directory using UnixPath()\n{0}", _Indent); - _Output.Write ("# This file in directory {1}\n{0}", _Indent, Solution.Directory); - _Output.Write ("\n{0}", _Indent); - foreach (var Item in Solution.Projects) { - if ( (Item.MakeUnix()) ) { - var Project = Item.Project; - var Target = Project.Target.UnixFile(); - var Directory = Item.Directory.UnixPath(); - _Output.Write ("# Project : {1}\n{0}", _Indent, Target); - _Output.Write ("# Item : {1}\n{0}", _Indent, Directory); - if ( (Directory.IndexOf(' ') >= 0) ) { - _Output.Write ("***** Spaces in file path not supported\n{0}", _Indent); - } else if ( (Project.IsExe)) { - _Output.Write ("# Output : {1}/$(TARGETEXE)/{2}\n{0}", _Indent, Directory, Target); - } else if ( (Project.IsLibrary)) { - _Output.Write ("# Output : {1}/$(TARGETBIN)/{2}\n{0}", _Indent, Directory, Target); - } else { - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("all : {1}/$(TARGETBIN)/{2}\n{0}", _Indent, Directory, Project.Target); - _Output.Write ("\n{0}", _Indent); - foreach (var Dep in Project.ProjectReference) { - var SubProject = Dep.SubProject; - var GUID = SubProject.ProjectGuid; - var SubProjectDir = SubProject.Directory.UnixCanonicalPath(); - if ( (Project.IsExe) ) { - _Output.Write ("{1}/$(TARGETBIN)/{2} : {3}$(TARGETBIN)/{4}\n{0}", _Indent, Directory, Project.Target, SubProjectDir, SubProject.Target); - } else if ( (Project.IsLibrary)) { - _Output.Write ("{1}/$(TARGETBIN)/{2} : {3}$(TARGETBIN)/{4}\n{0}", _Indent, Directory, Project.Target, SubProjectDir, SubProject.Target); - } else { - } - _Output.Write ("\n{0}", _Indent); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("{1}/$(TARGETBIN)/{2} : always\n{0}", _Indent, Directory, Project.Target); - _Output.Write ("{1}echo \"\" >&2\n{0}", _Indent, Prefix); - _Output.Write ("{1}echo \"*** Directory {2}\" >&2\n{0}", _Indent, Prefix, Directory); - _Output.Write ("{1}make NORECURSE=true -C {2}\n{0}", _Indent, Prefix, Directory); - _Output.Write ("\n{0}", _Indent); - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# clean all projects\n{0}", _Indent); - _Output.Write ("clean :\n{0}", _Indent); - foreach (var Item in Solution.Projects) { - if ( (Item.MakeUnix()) ) { - var Directory = Item.Directory.UnixPath(); - _Output.Write ("{1}make clean NORECURSE=true -C {2}\n{0}", _Indent, Prefix, Directory); - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# publish all projects\n{0}", _Indent); - _Output.Write ("publish : all\n{0}", _Indent); - foreach (var Item in Solution.Projects) { - if ( (Item.MakeUnix()) ) { - var Directory = Item.Directory.UnixPath(); - _Output.Write ("{1}make publish NORECURSE=true -C {2}\n{0}", _Indent, Prefix, Directory); - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# install all projects\n{0}", _Indent); - _Output.Write ("install : all\n{0}", _Indent); - foreach (var Item in Solution.Projects) { - if ( (Item.MakeUnix()) ) { - var Directory = Item.Directory.UnixPath(); - _Output.Write ("{1}make install NORECURSE=true -C {2}\n{0}", _Indent, Prefix, Directory); - } - } - _Output.Write ("\n{0}", _Indent); - } - - - // - // GenerateMakefile - // - public void GenerateMakefile (VSProject Project) { - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# Makefile for Visual Studio Project {1}\n{0}", _Indent, Project.AssemblyName); - _Output.Write ("#\n{0}", _Indent); - Preamble (Project); - bool HaveLink = (Project.LinkDependency.Count > 0) | (Project.FixedLinkDependency.Count > 0); - bool HavePackage = Project.PrivateReference.Count > 0; - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# The main target \n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("SourceFiles = ", _Indent); - foreach (var File in Project.SourceDependency) { - _Output.Write ("\\\n{0}", _Indent); - _Output.Write (" {1}", _Indent, File.UnixFile()); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("LinkFiles = ", _Indent); - foreach (var File in Project.FixedLinkDependency) { - _Output.Write ("\\\n{0}", _Indent); - _Output.Write (" $(LIBRARYBIN)/{1}", _Indent, File); - } - foreach (var File in Project.LinkDependency) { - _Output.Write ("\\\n{0}", _Indent); - _Output.Write (" $(TARGETBIN)/{1}", _Indent, File); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("LinkFilesComma = ", _Indent); - var LinkSep = new Separator ("", ","); - foreach (var File in Project.FixedLinkDependency) { - _Output.Write ("{1}$(LIBRARYBIN)/{2}", _Indent, LinkSep, File); - } - foreach (var File in Project.LinkDependency) { - _Output.Write ("{1}$(TARGETBIN)/{2}", _Indent, LinkSep, File); - } - foreach (var File in Project.AdditionalLinkDependency) { - _Output.Write ("{1}{2}", _Indent, LinkSep, File); - } - _Output.Write ("\n{0}", _Indent); - foreach (var Item in Project.PrivateReference) { - _Output.Write ("# Nuget {1} : {2}\n{0}", _Indent, Item.Include, Item.HintPath); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("NugetFiles = ", _Indent); - foreach (var Item in Project.PrivateReference) { - _Output.Write ("\\\n{0}", _Indent); - _Output.Write (" {1}", _Indent, Item.HintPath.UnixFile()); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("NugetFilesComa = ", _Indent); - var PkgSep = new Separator ("", ","); - foreach (var Item in Project.PrivateReference) { - _Output.Write ("{1}\\\n{0}", _Indent, PkgSep); - _Output.Write (" {1}", _Indent, Item.HintPath.UnixFile()); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# A) Main target packaged\n{0}", _Indent); - if ( (Project.IsExe) ) { - _Output.Write ("$(TARGETEXE)/{1} :| $(TARGETEXE)\n{0}", _Indent, Project.AssemblyName); - _Output.Write ("$(TARGETEXE)/{1} : $(TARGETBIN)/{2}.exe \n{0}", _Indent, Project.AssemblyName, Project.AssemblyName); - _Output.Write ("{1}$(BUNDLE) $@ $^ $(LinkFiles) $(NugetFiles)\n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# B) Main target executable\n{0}", _Indent); - _Output.Write ("$(TARGETBIN)/{1} :| $(TARGETBIN)\n{0}", _Indent, Project.Target); - _Output.Write ("$(TARGETBIN)/{1} : $(SourceFiles) $(LinkFiles) $(NugetFiles)\n{0}", _Indent, Project.Target); - _Output.Write ("{1}$(CSHARPEXE) /out:$@ $(SourceFiles) ", _Indent, Prefix); - if ( HaveLink ) { - _Output.Write ("-reference:$(LinkFilesComma) ", _Indent); - } - if ( HavePackage ) { - _Output.Write ("-r:$(NugetFilesComa) ", _Indent); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - } else if ( (Project.IsLibrary)) { - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(TARGETBIN)/{1} :| $(LIBRARYBIN)\n{0}", _Indent, Project.Target); - _Output.Write ("$(TARGETBIN)/{1} :| $(TARGETBIN)\n{0}", _Indent, Project.Target); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(TARGETBIN)/{1} : $(SourceFiles) $(LinkFiles) $(NugetFiles)\n{0}", _Indent, Project.Target); - _Output.Write ("{1}$(CSHARPDLL) /out:$@ $(SourceFiles) ", _Indent, Prefix); - if ( HaveLink ) { - _Output.Write ("-reference:$(LinkFilesComma) ", _Indent); - } - if ( HavePackage ) { - _Output.Write ("-r:$(NugetFilesComa) ", _Indent); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("{1}cp $(TARGETBIN)/{2} $(LIBRARYBIN)/{3}\n{0}", _Indent, Prefix, Project.Target, Project.Target); - _Output.Write ("\n{0}", _Indent); - } else { - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Directories etc.\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(INSTALL_PROGRAM) :\n{0}", _Indent); - _Output.Write ("{1}mkdir -p $(INSTALL_PROGRAM) \n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(INSTALL_DATA) :\n{0}", _Indent); - _Output.Write ("{1}mkdir -p $(INSTALL_DATA) \n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(TARGETBIN) :\n{0}", _Indent); - _Output.Write ("{1}mkdir -p $(TARGETBIN) \n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(TARGETEXE) :\n{0}", _Indent); - _Output.Write ("{1}mkdir -p $(TARGETEXE) \n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(LIBRARYBIN) :\n{0}", _Indent); - _Output.Write ("{1}mkdir -p $(LIBRARYBIN)\n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Generated code\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("ifdef PHB_BUILD\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - foreach (var Item in Project.None) { - if ( (Item.Generator != null) ) { - _Output.Write ("{1} : {2}\n{0}", _Indent, Item.LastGenOutput, Item.Include); - _Output.Write ("{1} $(Custom_{2}) {3} $(Custom_{4}_FLAG) {5} \n{0}", _Indent, Prefix, Item.Generator, Item.Include, Item.Generator, Item.LastGenOutput); - } - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("endif\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write (".PHONY : clean install publish debian rpm\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Referenced projects\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Recursive make targets, do not execute if the variable NORECURSE is defined\n{0}", _Indent); - _Output.Write ("ifndef NORECURSE\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - foreach (var Item in Project.ProjectReference) { - _Output.Write ("{1}/$(TARGETBIN)/{2}.dll : recursive\n{0}", _Indent, Item.Include.UnixPath(), Item.SubProject.AssemblyName); - _Output.Write ("{1}$(MAKE) -C {2}\n{0}", _Indent, Prefix, Item.Include.UnixPath()); - _Output.Write ("\n{0}", _Indent); - } - _Output.Write ("endif\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - foreach (var Item in Project.ProjectReference) { - _Output.Write ("$(TARGETBIN)/{1}.dll :| $(TARGETBIN)\n{0}", _Indent, Item.SubProject.AssemblyName); - _Output.Write ("$(TARGETBIN)/{1}.dll : {2}/$(TARGETBIN)/{3}.dll\n{0}", _Indent, Item.SubProject.AssemblyName, Item.Include.UnixPath(), Item.SubProject.AssemblyName); - _Output.Write ("{1} cp {2}/$(TARGETBIN)/{3}.dll $(TARGETBIN)/{4}.dll\n{0}", _Indent, Prefix, Item.Include.UnixPath(), Item.SubProject.AssemblyName, Item.SubProject.AssemblyName); - _Output.Write ("\n{0}", _Indent); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Referenced Libraries\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - foreach (var Item in Project.PrivateReference) { - _Output.Write ("$(TARGETBIN)/{1} :| $(TARGETBIN)\n{0}", _Indent, Item.Name); - _Output.Write ("$(TARGETBIN)/{1} : {2}\n{0}", _Indent, Item.Name, Item.HintPath.UnixFile()); - _Output.Write ("{1} cp {2} $(TARGETBIN)/{3}\n{0}", _Indent, Prefix, Item.HintPath.UnixFile(), Item.Name); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Clean up\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# At the moment we only delete the currently indicated target. This allows a \n{0}", _Indent); - _Output.Write ("# developer to do a make clean / make when a problem with a corrupted intermediate\n{0}", _Indent); - _Output.Write ("# file is suspected.\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("clean : \n{0}", _Indent); - _Output.Write ("{1}rm -f $(TARGETBIN)/*\n{0}", _Indent, Prefix); - _Output.Write ("{1}rm -f $(TARGETEXE)/*\n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# Install\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# Install files to a tools directory. Default is ~/.local/bin\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - if ( (Project.IsExe) ) { - _Output.Write ("install : $(INSTALL_PROGRAM)/{1} \n{0}", _Indent, Project.AssemblyName); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(INSTALL_PROGRAM)/{1} :| $(INSTALL_PROGRAM)\n{0}", _Indent, Project.AssemblyName); - _Output.Write ("$(INSTALL_PROGRAM)/{1} : $(TARGETEXE)/{2} \n{0}", _Indent, Project.AssemblyName, Project.AssemblyName); - _Output.Write ("{1}cp $^ $@ \n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - } else if ( (Project.OutputType == "Library")) { - _Output.Write ("install : $(INSTALL_DATA)/{1}.dll\n{0}", _Indent, Project.AssemblyName); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("$(INSTALL_DATA)/{1}.dll :| $(INSTALL_DATA)\n{0}", _Indent, Project.AssemblyName); - _Output.Write ("$(INSTALL_DATA)/{1}.dll : $(TARGETBIN)/{2}.dll\n{0}", _Indent, Project.AssemblyName, Project.AssemblyName); - _Output.Write ("{1}cp $^ $@ \n{0}", _Indent, Prefix); - _Output.Write ("\n{0}", _Indent); - } - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("# To Do List\n{0}", _Indent); - _Output.Write ("#\n{0}", _Indent); - _Output.Write ("# 1) Redo install target\n{0}", _Indent); - _Output.Write ("# Create a wrapper script and library \n{0}", _Indent); - _Output.Write ("# 2) Create a Debian target\n{0}", _Indent); - _Output.Write ("# 3) Create a RPM target\n{0}", _Indent); - _Output.Write ("# 4) Create a nuget target\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - _Output.Write ("\n{0}", _Indent); - } - - - // - // PHBTool - // - public void PHBTool (string Tag, string Tool, string Flag) { - _Output.Write ("export Custom_{1} ?= {2}\n{0}", _Indent, Tag, Tool); - _Output.Write ("export Custom_{1}_FLAG ?= {2}\n{0}", _Indent, Tag, Flag); - } - } - } diff --git a/MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.script b/MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.script deleted file mode 100644 index 099392030..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/GenerateMakefile.script +++ /dev/null @@ -1,441 +0,0 @@ -#script 1.0 -#license MITLicense -#xclass Goedel.Tool.Makey Generate -#% public Generate (TextWriter Output) : base (Output) {} -#% string Prefix = "! "; //"\t"; - - -#method Preamble VSFile VSFile -## This file is generated automatically from the Visual Studio Project -## File. If you make changes to this file and do not update the project -## file, changes will be lost when the file is regenerated. - -## NB: This process will fail if any of the paths have spaces in them -## While it is possible to work around the lack of support for spaces in -## file paths in gmake, it is not possible to do this reliably in the tools -## that it invokes to build the system. Rather than do half a job, it seems -## safest to simply reject the corner case - - -## The following targets are defined (well planned) -## -## make Compile for the current platform -## make cross Compile for all platforms -## make install Compile and install -## make clean Delete all target and intermediate files - -## The following build flags are supported -## -## make mode= release | debug Build release or debug version -## make arch= this | all | Bundle for the current platform, all platforms -## or the specified platform - -## Define the default target directories (referenced projects must all follow same scheme) -## -## By default, we arrange the mono targets as follows: -## -## The source code directory -## /mono/ Equivalent to VS bin directory -## /mono/Debug Equivalent to VS bin/Debug directory -## /mono/Release Equivalent to VS bin/Debug directory -## -## If the target is an executable, the following directories are also created: -## -## /This The bundled executable for the platform the code was compiled on -## / The bundled executable for the platform -## -## If the install target is selected, the bundles will be installed in -## -## ~/Tools/This The bundled executable for platform the code is built on -## ~/Tools/ The bundled executable for this platform - -export TARGETROOT ?= mono -export MODE ?= Release -export ARCH ?= This -export Packages ?= $(HOME)/Packages -export PackagesPath ?= /lib/net40 -export Libraries ?= $(HOME)/Libraries -export LibrariesPath ?= /Mono - - -export TARGETBIN = $(TARGETROOT)/$(MODE) -export TARGETEXE = $(TARGETROOT)/$(ARCH) -export LIBRARYBIN = $(Libraries)$(LibrariesPath) - -export DESTDIR ?= $(HOME)/.local -export bindir ?= /bin -export libdir ?= /lib -export INSTALL_PROGRAM ?= $(DESTDIR)$(bindir) -export INSTALL_DATA ?= $(DESTDIR)$(libdir) - -## Define the default compilers, linkers, packagers, etc. -export CSHARPDLL ?= mcs /target:library -export CSHARPEXE ?= mcs /target:exe -export BUNDLE ?= mkbundle -L /usr/lib/mono/4.7-api --deps --static -o - - - -## The following tools are used in the goedel build system itself: -#% PHBTool ("RFC2TXT", "rfctool /in", "/txt"); -#% PHBTool ("RFC2XML", "rfctool /in", "/xml"); -#% PHBTool ("RFC2MD", "rfctool /in", "/md"); -#% PHBTool ("RFC2HTML", "rfctool /in", "/html"); -#% PHBTool ("CommandCS", "commandparse /in", "/cs"); -#% PHBTool ("FSRCS", "fsrgen /in", "/cs"); -#% PHBTool ("Exceptional", "exceptional /in", "/cs"); -#% PHBTool ("GScript", "gscript /in", "/cs"); -#% PHBTool ("Goedel3", "goedel3 /in", "/cs"); -#% PHBTool ("ASN2CS", "asn2 /in", "/cs"); -#% PHBTool ("DomainerCS", "domainer /in", "/cs"); -#% PHBTool ("RegistryCS", "registryconfig /in", "/cs"); -#% PHBTool ("VSIXBuild", "vsixbuild /in", "/cs"); -#% PHBTool ("ProtoGen", "protogen /in", "/cs"); -#% PHBTool ("TrojanGTK", "trojan /gtk", "/cs"); - -#if (Prefix != "\t") -## Use the specified character as the prefix character. Note this may not -## be supported on versions of make other than gmake. -.RECIPEPREFIX = #{Prefix} -#end if -#end method - -#method GenerateVSMakefile VSProject Project - -## Supplemental Makefile for Visual Studios Projects -## -## Visual Studio is responsible for managing rules for production of -## code but does not provide support for pre and post build actions. -## -## Prebuild items supported: -## [None currently] -## -## PostBuild items supported: -## * Copy library to locations on disk -## * Build ilMerge executables -## * Postprocess VSIX projects -## * Copy executables - -LinkFiles = #! -#foreach (var File in Project.FixedLinkDependency) -\ - #{File}#! -#end foreach -#foreach (var File in Project.LinkDependency) -\ - #{File}#! -#end foreach - - -prebuild : - echo "Do Prebuild" - -postbuild : -#if (Project.IsExe) - powershell publishtarget #{Project.Target} $(LinkFiles) -#elseif (Project.IsLibrary) - powershell publishtarget #{Project.Target} -#end if - - -#end method - - -#method GenerateMakefile VSSolution Solution -## -## Makefile for Visual Studio Solution .. -## -#call Preamble Solution - -## The main target - -.PHONY : all always clean install publish cross - -## Need to identify the target directory using UnixPath() -## This file in directory #{Solution.Directory} - -#foreach (var Item in Solution.Projects) -#if (Item.MakeUnix()) -#% var Project = Item.Project; -#% var Target = Project.Target.UnixFile(); -#% var Directory = Item.Directory.UnixPath(); -## Project : #{Target} -## Item : #{Directory} -#if (Directory.IndexOf(' ') >= 0) -***** Spaces in file path not supported -#elseif (Project.IsExe) -## Output : #{Directory}/$(TARGETEXE)/#{Target} -#elseif (Project.IsLibrary) -## Output : #{Directory}/$(TARGETBIN)/#{Target} -#else -#end if - -all : #{Directory}/$(TARGETBIN)/#{Project.Target} - -#foreach (var Dep in Project.ProjectReference) -#% var SubProject = Dep.SubProject; -#% var GUID = SubProject.ProjectGuid; -#% var SubProjectDir = SubProject.Directory.UnixCanonicalPath(); -#if (Project.IsExe) -#{Directory}/$(TARGETBIN)/#{Project.Target} : #{SubProjectDir}$(TARGETBIN)/#{SubProject.Target} -#elseif (Project.IsLibrary) -#{Directory}/$(TARGETBIN)/#{Project.Target} : #{SubProjectDir}$(TARGETBIN)/#{SubProject.Target} -#else -#end if - -#end foreach - -#{Directory}/$(TARGETBIN)/#{Project.Target} : always -#{Prefix}echo "" >&2 -#{Prefix}echo "*** Directory #{Directory}" >&2 -#{Prefix}make NORECURSE=true -C #{Directory} - -#end if -#end foreach - - -## clean all projects -clean : -#foreach (var Item in Solution.Projects) -#if (Item.MakeUnix()) -#% var Directory = Item.Directory.UnixPath(); -#{Prefix}make clean NORECURSE=true -C #{Directory} -#end if -#end foreach - -## publish all projects -publish : all -#foreach (var Item in Solution.Projects) -#if (Item.MakeUnix()) -#% var Directory = Item.Directory.UnixPath(); -#{Prefix}make publish NORECURSE=true -C #{Directory} -#end if -#end foreach - -## install all projects -install : all -#foreach (var Item in Solution.Projects) -#if (Item.MakeUnix()) -#% var Directory = Item.Directory.UnixPath(); -#{Prefix}make install NORECURSE=true -C #{Directory} -#end if -#end foreach - -#end method - - -#method GenerateMakefile VSProject Project -## -## Makefile for Visual Studio Project #{Project.AssemblyName} -## -#call Preamble Project -#!% bool HaveSoure = Project.SourceDependency.Count > 0; -#% bool HaveLink = (Project.LinkDependency.Count > 0) | (Project.FixedLinkDependency.Count > 0); -#% bool HavePackage = Project.PrivateReference.Count > 0; - -## The main target - -SourceFiles = #! -#foreach (var File in Project.SourceDependency) -\ - #{File.UnixFile()}#! -#end foreach - - -LinkFiles = #! -#foreach (var File in Project.FixedLinkDependency) -\ - $(LIBRARYBIN)/#{File}#! -#end foreach -#foreach (var File in Project.LinkDependency) -\ - $(TARGETBIN)/#{File}#! -#end foreach - - -LinkFilesComma = #! -#% var LinkSep = new Separator ("", ","); -#foreach (var File in Project.FixedLinkDependency) -#{LinkSep}$(LIBRARYBIN)/#{File}#! -#end foreach -#foreach (var File in Project.LinkDependency) -#{LinkSep}$(TARGETBIN)/#{File}#! -#end foreach -#foreach (var File in Project.AdditionalLinkDependency) -#{LinkSep}#{File}#! -#end foreach - -#foreach (var Item in Project.PrivateReference) -## Nuget #{Item.Include} : #{Item.HintPath} -#end foreach - - -NugetFiles = #! -#foreach (var Item in Project.PrivateReference) -\ - #{Item.HintPath.UnixFile()}#! -#end foreach - -NugetFilesComa = #! -#% var PkgSep = new Separator ("", ","); -#foreach (var Item in Project.PrivateReference) -#{PkgSep}\ - #{Item.HintPath.UnixFile()}#! -#end foreach - - -## A) Main target packaged -#if (Project.IsExe) -$(TARGETEXE)/#{Project.AssemblyName} :| $(TARGETEXE) -$(TARGETEXE)/#{Project.AssemblyName} : $(TARGETBIN)/#{Project.AssemblyName}.exe -#{Prefix}$(BUNDLE) $@ $^ $(LinkFiles) $(NugetFiles) - -## B) Main target executable -$(TARGETBIN)/#{Project.Target} :| $(TARGETBIN) -$(TARGETBIN)/#{Project.Target} : $(SourceFiles) $(LinkFiles) $(NugetFiles) -#{Prefix}$(CSHARPEXE) /out:$@ $(SourceFiles) #! -#if HaveLink --reference:$(LinkFilesComma) #! -#end if -#if HavePackage --r:$(NugetFilesComa) #! -#end if - - -#elseif (Project.IsLibrary) - -$(TARGETBIN)/#{Project.Target} :| $(LIBRARYBIN) -$(TARGETBIN)/#{Project.Target} :| $(TARGETBIN) - -$(TARGETBIN)/#{Project.Target} : $(SourceFiles) $(LinkFiles) $(NugetFiles) -#{Prefix}$(CSHARPDLL) /out:$@ $(SourceFiles) #! -#if HaveLink --reference:$(LinkFilesComma) #! -#end if -#if HavePackage --r:$(NugetFilesComa) #! -#end if - -#{Prefix}cp $(TARGETBIN)/#{Project.Target} $(LIBRARYBIN)/#{Project.Target} - -#else -#end if - -## Directories etc. - -$(INSTALL_PROGRAM) : -#{Prefix}mkdir -p $(INSTALL_PROGRAM) - -$(INSTALL_DATA) : -#{Prefix}mkdir -p $(INSTALL_DATA) - -$(TARGETBIN) : -#{Prefix}mkdir -p $(TARGETBIN) - -$(TARGETEXE) : -#{Prefix}mkdir -p $(TARGETEXE) - -$(LIBRARYBIN) : -#{Prefix}mkdir -p $(LIBRARYBIN) - -## Generated code - -ifdef PHB_BUILD - -#foreach (var Item in Project.None) -#if (Item.Generator != null) -#{Item.LastGenOutput} : #{Item.Include} -#{Prefix} $(Custom_#{Item.Generator}) #{Item.Include} $(Custom_#{Item.Generator}_FLAG) #{Item.LastGenOutput} -#end if -#end foreach - -endif - -.PHONY : clean install publish debian rpm - - -## Referenced projects -## - -## Recursive make targets, do not execute if the variable NORECURSE is defined -ifndef NORECURSE - -#foreach (var Item in Project.ProjectReference) -#{Item.Include.UnixPath()}/$(TARGETBIN)/#{Item.SubProject.AssemblyName}.dll : recursive -#{Prefix}$(MAKE) -C #{Item.Include.UnixPath()} - -#end foreach -endif - -# copy libraries into the base library -#foreach (var Item in Project.ProjectReference) -$(TARGETBIN)/#{Item.SubProject.AssemblyName}.dll :| $(TARGETBIN) -$(TARGETBIN)/#{Item.SubProject.AssemblyName}.dll : #{Item.Include.UnixPath()}/$(TARGETBIN)/#{Item.SubProject.AssemblyName}.dll -#{Prefix} cp #{Item.Include.UnixPath()}/$(TARGETBIN)/#{Item.SubProject.AssemblyName}.dll $(TARGETBIN)/#{Item.SubProject.AssemblyName}.dll - -#end foreach - -## Referenced Libraries -## -#foreach (var Item in Project.PrivateReference) -$(TARGETBIN)/#{Item.Name} :| $(TARGETBIN) -$(TARGETBIN)/#{Item.Name} : #{Item.HintPath.UnixFile()} -#{Prefix} cp #{Item.HintPath.UnixFile()} $(TARGETBIN)/#{Item.Name} -#end foreach - - -## Clean up -## -## At the moment we only delete the currently indicated target. This allows a -## developer to do a make clean / make when a problem with a corrupted intermediate -## file is suspected. - -clean : -#{Prefix}rm -f $(TARGETBIN)/* -#{Prefix}rm -f $(TARGETEXE)/* - -## Install -## -## Install files to a tools directory. Default is ~/.local/bin - - -#if (Project.IsExe) -install : $(INSTALL_PROGRAM)/#{Project.AssemblyName} - -$(INSTALL_PROGRAM)/#{Project.AssemblyName} :| $(INSTALL_PROGRAM) -$(INSTALL_PROGRAM)/#{Project.AssemblyName} : $(TARGETEXE)/#{Project.AssemblyName} -#{Prefix}cp $^ $@ - -#elseif (Project.OutputType == "Library") -install : $(INSTALL_DATA)/#{Project.AssemblyName}.dll - -$(INSTALL_DATA)/#{Project.AssemblyName}.dll :| $(INSTALL_DATA) -$(INSTALL_DATA)/#{Project.AssemblyName}.dll : $(TARGETBIN)/#{Project.AssemblyName}.dll -#{Prefix}cp $^ $@ - -#end if - - - -## To Do List -## -## 1) Redo install target -## Create a wrapper script and library -## 2) Create a Debian target -## 3) Create a RPM target -## 4) Create a nuget target - - -#end method - - - - - - -#method3 PHBTool string Tag string Tool string Flag -export Custom_#{Tag} ?= #{Tool} -export Custom_#{Tag}_FLAG ?= #{Flag} -#end method3 - - -#end xclass \ No newline at end of file diff --git a/MakeyMakey/xGoedel.Tool.Makey/Makefile b/MakeyMakey/xGoedel.Tool.Makey/Makefile deleted file mode 100644 index fadb43921..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Makefile +++ /dev/null @@ -1,242 +0,0 @@ -# -# Makefile for Visual Studio Project Goedel.Tool.Makey -# -# This file is generated automatically from the Visual Studio Project -# File. If you make changes to this file and do not update the project -# file, changes will be lost when the file is regenerated. - -# NB: This process will fail if any of the paths have spaces in them -# While it is possible to work around the lack of support for spaces in -# file paths in gmake, it is not possible to do this reliably in the tools -# that it invokes to build the system. Rather than do half a job, it seems -# safest to simply reject the corner case - - -# The following targets are defined (well planned) -# -# make Compile for the current platform -# make cross Compile for all platforms -# make install Compile and install -# make clean Delete all target and intermediate files - -# The following build flags are supported -# -# make mode= release | debug Build release or debug version -# make arch= this | all | Bundle for the current platform, all platforms -# or the specified platform - -# Define the default target directories (referenced projects must all follow same scheme) -# -# By default, we arrange the mono targets as follows: -# -# The source code directory -# /mono/ Equivalent to VS bin directory -# /mono/Debug Equivalent to VS bin/Debug directory -# /mono/Release Equivalent to VS bin/Debug directory -# -# If the target is an executable, the following directories are also created: -# -# /This The bundled executable for the platform the code was compiled on -# / The bundled executable for the platform -# -# If the install target is selected, the bundles will be installed in -# -# ~/Tools/This The bundled executable for platform the code is built on -# ~/Tools/ The bundled executable for this platform - -export TARGETROOT ?= mono -export MODE ?= Release -export ARCH ?= This -export Packages ?= $(HOME)/Packages -export PackagesPath ?= /lib/net40 -export Libraries ?= $(HOME)/Libraries -export LibrariesPath ?= /Mono - - -export TARGETBIN = $(TARGETROOT)/$(MODE) -export TARGETEXE = $(TARGETROOT)/$(ARCH) -export LIBRARYBIN = $(Libraries)$(LibrariesPath) - -export DESTDIR ?= $(HOME)/.local -export bindir ?= /bin -export libdir ?= /lib -export INSTALL_PROGRAM ?= $(DESTDIR)$(bindir) -export INSTALL_DATA ?= $(DESTDIR)$(libdir) - -# Define the default compilers, linkers, packagers, etc. -export CSHARPDLL ?= mcs /target:library -export CSHARPEXE ?= mcs /target:exe -export BUNDLE ?= mkbundle --deps --static -o - - - -# The following tools are used in the goedel build system itself: -export Custom_RFC2TXT ?= rfctool /in -export Custom_RFC2TXT_FLAG ?= /txt -export Custom_RFC2XML ?= rfctool /in -export Custom_RFC2XML_FLAG ?= /xml -export Custom_RFC2MD ?= rfctool /in -export Custom_RFC2MD_FLAG ?= /md -export Custom_RFC2HTML ?= rfctool /in -export Custom_RFC2HTML_FLAG ?= /html -export Custom_CommandCS ?= commandparse /in -export Custom_CommandCS_FLAG ?= /cs -export Custom_FSRCS ?= fsrgen /in -export Custom_FSRCS_FLAG ?= /cs -export Custom_Exceptional ?= exceptional /in -export Custom_Exceptional_FLAG ?= /cs -export Custom_GScript ?= gscript /in -export Custom_GScript_FLAG ?= /cs -export Custom_Goedel3 ?= goedel3 /in -export Custom_Goedel3_FLAG ?= /cs -export Custom_ASN2CS ?= asn2 /in -export Custom_ASN2CS_FLAG ?= /cs -export Custom_DomainerCS ?= domainer /in -export Custom_DomainerCS_FLAG ?= /cs -export Custom_RegistryCS ?= registryconfig /in -export Custom_RegistryCS_FLAG ?= /cs -export Custom_VSIXBuild ?= vsixbuild /in -export Custom_VSIXBuild_FLAG ?= /cs -export Custom_ProtoGen ?= protogen /in -export Custom_ProtoGen_FLAG ?= /cs -export Custom_TrojanGTK ?= trojan /gtk -export Custom_TrojanGTK_FLAG ?= /cs - -# Use the specified character as the prefix character. Note this may not -# be supported on versions of make other than gmake. -.RECIPEPREFIX = ! - -# The main target - -SourceFiles = \ - Exceptions.cs\ - Microsoft_Build_Core.cs\ - ParseProject.cs\ - GenerateMakefile.cs\ - ParseSolution.cs\ - Project.cs\ - Properties/AssemblyInfo.cs\ - Tokenizer.cs\ - TokenizerPlus.cs - -LinkFiles = \ - $(TARGETBIN)/Goedel.FSR.dll\ - $(TARGETBIN)/Goedel.Registry.dll\ - $(TARGETBIN)/Goedel.Utilities.dll - -LinkFilesComma = $(TARGETBIN)/Goedel.FSR.dll,$(TARGETBIN)/Goedel.Registry.dll,$(TARGETBIN)/Goedel.Utilities.dll - - -NugetFiles = -NugetFilesComa = - -# A) Main target packaged - -$(TARGETBIN)/Goedel.Tool.Makey.dll :| $(LIBRARYBIN) -$(TARGETBIN)/Goedel.Tool.Makey.dll :| $(TARGETBIN) - -$(TARGETBIN)/Goedel.Tool.Makey.dll : $(SourceFiles) $(LinkFiles) $(NugetFiles) -! $(CSHARPDLL) /out:$@ $(SourceFiles) -reference:$(LinkFilesComma) -! cp $(TARGETBIN)/Goedel.Tool.Makey.dll $(LIBRARYBIN)/Goedel.Tool.Makey.dll - - -# Directories etc. - -$(INSTALL_PROGRAM) : -! mkdir -p $(INSTALL_PROGRAM) - -$(INSTALL_DATA) : -! mkdir -p $(INSTALL_DATA) - -$(TARGETBIN) : -! mkdir -p $(TARGETBIN) - -$(TARGETEXE) : -! mkdir -p $(TARGETEXE) - -$(LIBRARYBIN) : -! mkdir -p $(LIBRARYBIN) - -# Generated code - -ifdef PHB_BUILD - -Exceptions.cs : Exceptions.exceptional -! $(Custom_exceptional) Exceptions.exceptional $(Custom_exceptional_FLAG) Exceptions.cs -GenerateMakefile.cs : GenerateMakefile.script -! $(Custom_GScript) GenerateMakefile.script $(Custom_GScript_FLAG) GenerateMakefile.cs -Tokenizer.cs : Tokenizer.fsr -! $(Custom_fsrcs) Tokenizer.fsr $(Custom_fsrcs_FLAG) Tokenizer.cs - -endif - -.PHONY : clean install publish debian rpm - - -# Referenced projects -# - -# Recursive make targets, do not execute if the variable NORECURSE is defined -ifndef NORECURSE - -../../Libraries/Goedel.FSR/$(TARGETBIN)/Goedel.FSR.dll : recursive -! $(MAKE) -C ../../Libraries/Goedel.FSR - -../../Libraries/Goedel.Registry/$(TARGETBIN)/Goedel.Registry.dll : recursive -! $(MAKE) -C ../../Libraries/Goedel.Registry - -../../Libraries/Goedel.Utilities/$(TARGETBIN)/Goedel.Utilities.dll : recursive -! $(MAKE) -C ../../Libraries/Goedel.Utilities - -endif - -$(TARGETBIN)/Goedel.FSR.dll :| $(TARGETBIN) -$(TARGETBIN)/Goedel.FSR.dll : ../../Libraries/Goedel.FSR/$(TARGETBIN)/Goedel.FSR.dll -! cp ../../Libraries/Goedel.FSR/$(TARGETBIN)/Goedel.FSR.dll $(TARGETBIN)/Goedel.FSR.dll - -$(TARGETBIN)/Goedel.Registry.dll :| $(TARGETBIN) -$(TARGETBIN)/Goedel.Registry.dll : ../../Libraries/Goedel.Registry/$(TARGETBIN)/Goedel.Registry.dll -! cp ../../Libraries/Goedel.Registry/$(TARGETBIN)/Goedel.Registry.dll $(TARGETBIN)/Goedel.Registry.dll - -$(TARGETBIN)/Goedel.Utilities.dll :| $(TARGETBIN) -$(TARGETBIN)/Goedel.Utilities.dll : ../../Libraries/Goedel.Utilities/$(TARGETBIN)/Goedel.Utilities.dll -! cp ../../Libraries/Goedel.Utilities/$(TARGETBIN)/Goedel.Utilities.dll $(TARGETBIN)/Goedel.Utilities.dll - - -# Referenced Libraries -# - - -# Clean up -# -# At the moment we only delete the currently indicated target. This allows a -# developer to do a make clean / make when a problem with a corrupted intermediate -# file is suspected. - -clean : -! rm -f $(TARGETBIN)/* -! rm -f $(TARGETEXE)/* - -# Install -# -# Install files to a tools directory. Default is ~/.local/bin - - -install : $(INSTALL_DATA)/Goedel.Tool.Makey.dll - -$(INSTALL_DATA)/Goedel.Tool.Makey.dll :| $(INSTALL_DATA) -$(INSTALL_DATA)/Goedel.Tool.Makey.dll : $(TARGETBIN)/Goedel.Tool.Makey.dll -! cp $^ $@ - - - - -# To Do List -# -# 1) Redo install target -# Create a wrapper script and library -# 2) Create a Debian target -# 3) Create a RPM target -# 4) Create a nuget target - - diff --git a/MakeyMakey/xGoedel.Tool.Makey/Microsoft.Build.Core.xsd b/MakeyMakey/xGoedel.Tool.Makey/Microsoft.Build.Core.xsd deleted file mode 100644 index 8051b8da4..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Microsoft.Build.Core.xsd +++ /dev/null @@ -1,722 +0,0 @@ - - - - - - An MSBuild Project - - - - - - - - - - - Optional semi-colon separated list of one or more targets that will be built if no targets are otherwise specified - - - - - Optional semi-colon separated list of targets that should always be built before any other targets - - - - - Optional string describing the toolset version this project should normally be built with - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Groups tasks into a section of the build process - - - - - - - - - - - - - - - Name of the target - - - - - Optional semi-colon separated list of targets that should be run before this target - - - - - Optional semi-colon separated list of files that form inputs into this target. Their timestamps will be compared with the timestamps of files in Outputs to determine whether the Target is up to date - - - - - Optional semi-colon separated list of files that form outputs into this target. Their timestamps will be compared with the timestamps of files in Inputs to determine whether the Target is up to date - - - - - Optional expression evaluated to determine whether the Target and the targets it depends on should be run - - - - - Optional expression evaluated to determine whether duplicate items in the Target's Returns should be removed before returning them. The default is not to eliminate duplicates. - - - - - Optional expression evaluated to determine which items generated by the target should be returned by the target. If there are no Returns attributes on Targets in the file, the Outputs attributes are used instead for this purpose. - - - - - Optional semi-colon separated list of targets that this target should run before. - - - - - Optional semi-colon separated list of targets that this target should run after. - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Groups property definitions - - - - - - - Optional expression evaluated to determine whether the PropertyGroup should be used - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Groups import definitions - - - - - - - Optional expression evaluated to determine whether the ImportGroup should be used - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Groups item list definitions - - - - - - - - - - - Optional expression evaluated to determine whether the ItemGroup should be used - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Groups item metadata definitions - - - - - - - - - - - Optional expression evaluated to determine whether the ItemDefinitionGroup should be used - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Groups When and Otherwise elements - - - - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Groups PropertyGroup and/or ItemGroup elements - - - - - - - - - - - Optional expression evaluated to determine whether the child PropertyGroups and/or ItemGroups should be used - - - - - - - Groups PropertyGroup and/or ItemGroup elements that are used if no Conditions on sibling When elements evaluate to true - - - - - - - - - - - - - Specifies targets to execute in the event of a recoverable error - - - - Optional expression evaluated to determine whether the targets should be executed - - - - - Semi-colon separated list of targets to execute - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Defines the assembly containing a task's implementation, or contains the implementation itself. - - - - - - - - Optional expression evaluated to determine whether the declaration should be evaluated - - - - - Optional name of assembly containing the task. Either AssemblyName or AssemblyFile must be used - - - - - Optional path to assembly containing the task. Either AssemblyName or AssemblyFile must be used - - - - - Name of task class in the assembly - - - - - Name of the task factory class in the assembly - - - - - - Defines the architecture of the task host that this task should be run in. Currently supported values: x86, x64, CurrentArchitecture, and * (any). If Architecture is not specified, either the task will be run within the MSBuild process, or the task host will be launched using the architecture of the parent MSBuild process - - - - - - - Defines the .NET runtime version of the task host that this task should be run in. Currently supported values: CLR2, CLR4, CurrentRuntime, and * (any). If Runtime is not specified, either the task will be run within the MSBuild process, or the task host will be launched using the runtime of the parent MSBuild process - - - - - - - - Groups parameters that are part of an inline task definition. - - - - - - - - - - Contains the inline task implementation. Content is opaque to MSBuild. - - - - - - - Whether the body should have properties expanded before use. Defaults to false. - - - - - - - Declares that the contents of another project file should be inserted at this location - - - - Optional expression evaluated to determine whether the import should occur - - - - - Project file to import - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - Optional section used by MSBuild hosts, that may contain arbitrary XML content that is ignored by MSBuild itself - - - - - - - - - - - - - - Optional expression evaluated to determine whether the items should be evaluated - - - - - Semi-colon separated list of files (wildcards are allowed) or other item names to include in this item list - - - - - Semi-colon separated list of files (wildcards are allowed) or other item names to exclude from the Include list - - - - - Semi-colon separated list of files (wildcards are allowed) or other item names to remove from the existing list contents - - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - - - - - - - - - - - - - - - - - - - - Optional expression evaluated to determine whether the property should be evaluated - - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - - - - - - - - - Optional expression evaluated to determine whether the property should be evaluated - - - - - - Optional expression. Used to identify or order system and user elements - - - - - - - - - - - - Optional element specifying a specific task output to be gathered - - - - - Task parameter to gather. Matches the name of a .NET Property on the task class that has an [Output] attribute - - - - - Optional name of an item list to put the gathered outputs into. Either ItemName or PropertyName must be specified - - - - - Optional name of a property to put the gathered output into. Either PropertyName or ItemName must be specified - - - - - Optional expression evaluated to determine whether the output should be gathered - - - - - - - - Optional expression evaluated to determine whether the task should be executed - - - - - Optional boolean indicating whether a recoverable task error should be ignored. Default false - - - - - - Defines the bitness of the task if it must be run specifically in a 32bit or 64bit process. If not specified, it will run with the bitness of the build process. If there are multiple tasks defined in UsingTask with the same name but with different Architecture attribute values, the value of the Architecture attribute specified here will be used to match and select the correct task - - - - - - - Defines the .NET runtime of the task. This must be specified if the task must run on a specific version of the .NET runtime. If not specified, the task will run on the runtime being used by the build process. If there are multiple tasks defined in UsingTask with the same name but with different Runtime attribute values, the value of the Runtime attribute specified here will be used to match and select the correct task - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MakeyMakey/xGoedel.Tool.Makey/Microsoft_Build_Core.cs b/MakeyMakey/xGoedel.Tool.Makey/Microsoft_Build_Core.cs deleted file mode 100644 index 0f9136637..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Microsoft_Build_Core.cs +++ /dev/null @@ -1,1848 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// -// This source code was auto-generated by xsd, Version=4.6.1055.0. -// -namespace Goedel.Tool.Makey1 { - using System.Xml.Serialization; - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003", IsNullable=false)] - public partial class Project { - - private PropertyGroupType[] propertyGroupField; - - private ItemGroupType[] itemGroupField; - - private ItemDefinitionGroupType[] itemDefinitionGroupField; - - private ChooseType[] chooseField; - - private UsingTaskType[] usingTaskField; - - private System.Xml.XmlNode[] projectExtensionsField; - - private TargetType targetField; - - private ImportType importField; - - private ImportGroupType importGroupField; - - private PropertyGroupType[] propertyGroup1Field; - - private ItemGroupType[] itemGroup1Field; - - private ItemDefinitionGroupType[] itemDefinitionGroup1Field; - - private ChooseType[] choose1Field; - - private UsingTaskType[] usingTask1Field; - - private TargetType[] target1Field; - - private ImportType[] import1Field; - - private ImportGroupType[] importGroup1Field; - - private System.Xml.XmlNode[] projectExtensions1Field; - - private string defaultTargetsField; - - private string initialTargetsField; - - private string toolsVersionField; - - /// - [System.Xml.Serialization.XmlElementAttribute("PropertyGroup", Order=0)] - public PropertyGroupType[] PropertyGroup { - get { - return this.propertyGroupField; - } - set { - this.propertyGroupField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemGroup", Order=1)] - public ItemGroupType[] ItemGroup { - get { - return this.itemGroupField; - } - set { - this.itemGroupField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemDefinitionGroup", Order=2)] - public ItemDefinitionGroupType[] ItemDefinitionGroup { - get { - return this.itemDefinitionGroupField; - } - set { - this.itemDefinitionGroupField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("Choose", Order=3)] - public ChooseType[] Choose { - get { - return this.chooseField; - } - set { - this.chooseField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("UsingTask", Order=4)] - public UsingTaskType[] UsingTask { - get { - return this.usingTaskField; - } - set { - this.usingTaskField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ProjectExtensions", Order=5)] - public System.Xml.XmlNode[] ProjectExtensions { - get { - return this.projectExtensionsField; - } - set { - this.projectExtensionsField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute(Order=6)] - public TargetType Target { - get { - return this.targetField; - } - set { - this.targetField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute(Order=7)] - public ImportType Import { - get { - return this.importField; - } - set { - this.importField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute(Order=8)] - public ImportGroupType ImportGroup { - get { - return this.importGroupField; - } - set { - this.importGroupField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("PropertyGroup", Order=9)] - public PropertyGroupType[] PropertyGroup1 { - get { - return this.propertyGroup1Field; - } - set { - this.propertyGroup1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemGroup", Order=10)] - public ItemGroupType[] ItemGroup1 { - get { - return this.itemGroup1Field; - } - set { - this.itemGroup1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemDefinitionGroup", Order=11)] - public ItemDefinitionGroupType[] ItemDefinitionGroup1 { - get { - return this.itemDefinitionGroup1Field; - } - set { - this.itemDefinitionGroup1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("Choose", Order=12)] - public ChooseType[] Choose1 { - get { - return this.choose1Field; - } - set { - this.choose1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("UsingTask", Order=13)] - public UsingTaskType[] UsingTask1 { - get { - return this.usingTask1Field; - } - set { - this.usingTask1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("Target", Order=14)] - public TargetType[] Target1 { - get { - return this.target1Field; - } - set { - this.target1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("Import", Order=15)] - public ImportType[] Import1 { - get { - return this.import1Field; - } - set { - this.import1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ImportGroup", Order=16)] - public ImportGroupType[] ImportGroup1 { - get { - return this.importGroup1Field; - } - set { - this.importGroup1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ProjectExtensions", Order=17)] - public System.Xml.XmlNode[] ProjectExtensions1 { - get { - return this.projectExtensions1Field; - } - set { - this.projectExtensions1Field = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string DefaultTargets { - get { - return this.defaultTargetsField; - } - set { - this.defaultTargetsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string InitialTargets { - get { - return this.initialTargetsField; - } - set { - this.initialTargetsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string ToolsVersion { - get { - return this.toolsVersionField; - } - set { - this.toolsVersionField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class PropertyGroupType { - - private object[] propertyField; - - private string conditionField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Property")] - public object[] Property { - get { - return this.propertyField; - } - set { - this.propertyField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class GenericPropertyType { - - private System.Xml.XmlNode[] anyField; - - private string conditionField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlTextAttribute()] - [System.Xml.Serialization.XmlAnyElementAttribute()] - public System.Xml.XmlNode[] Any { - get { - return this.anyField; - } - set { - this.anyField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class UsingTaskBodyType { - - private System.Xml.XmlNode[] anyField; - - private string evaluateField; - - /// - [System.Xml.Serialization.XmlTextAttribute()] - [System.Xml.Serialization.XmlAnyElementAttribute()] - public System.Xml.XmlNode[] Any { - get { - return this.anyField; - } - set { - this.anyField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Evaluate { - get { - return this.evaluateField; - } - set { - this.evaluateField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class UsingTaskType { - - private System.Xml.XmlElement parameterGroupField; - - private UsingTaskBodyType taskField; - - private string conditionField; - - private string assemblyNameField; - - private string assemblyFileField; - - private string taskNameField; - - private string taskFactoryField; - - private string architectureField; - - private string runtimeField; - - /// - public System.Xml.XmlElement ParameterGroup { - get { - return this.parameterGroupField; - } - set { - this.parameterGroupField = value; - } - } - - /// - public UsingTaskBodyType Task { - get { - return this.taskField; - } - set { - this.taskField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string AssemblyName { - get { - return this.assemblyNameField; - } - set { - this.assemblyNameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string AssemblyFile { - get { - return this.assemblyFileField; - } - set { - this.assemblyFileField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string TaskName { - get { - return this.taskNameField; - } - set { - this.taskNameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string TaskFactory { - get { - return this.taskFactoryField; - } - set { - this.taskFactoryField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Architecture { - get { - return this.architectureField; - } - set { - this.architectureField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Runtime { - get { - return this.runtimeField; - } - set { - this.runtimeField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class OtherwiseType { - - private object[] itemsField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Choose", typeof(ChooseType))] - [System.Xml.Serialization.XmlElementAttribute("ItemGroup", typeof(ItemGroupType))] - [System.Xml.Serialization.XmlElementAttribute("PropertyGroup", typeof(PropertyGroupType))] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ChooseType { - - private WhenType[] whenField; - - private OtherwiseType otherwiseField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlElementAttribute("When")] - public WhenType[] When { - get { - return this.whenField; - } - set { - this.whenField = value; - } - } - - /// - public OtherwiseType Otherwise { - get { - return this.otherwiseField; - } - set { - this.otherwiseField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class WhenType { - - private object[] itemsField; - - private string conditionField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Choose", typeof(ChooseType))] - [System.Xml.Serialization.XmlElementAttribute("ItemGroup", typeof(ItemGroupType))] - [System.Xml.Serialization.XmlElementAttribute("PropertyGroup", typeof(PropertyGroupType))] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ItemGroupType { - - private SimpleItemType[] itemsField; - - private string conditionField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Item", typeof(SimpleItemType))] - [System.Xml.Serialization.XmlElementAttribute("Link", typeof(LinkItem))] - [System.Xml.Serialization.XmlElementAttribute("PostBuildEvent", typeof(PostBuildEventItem))] - [System.Xml.Serialization.XmlElementAttribute("PreBuildEvent", typeof(PreBuildEventItem))] - [System.Xml.Serialization.XmlElementAttribute("ResourceCompile", typeof(ResourceCompile))] - public SimpleItemType[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.Xml.Serialization.XmlIncludeAttribute(typeof(PostBuildEventItem))] - [System.Xml.Serialization.XmlIncludeAttribute(typeof(PreBuildEventItem))] - [System.Xml.Serialization.XmlIncludeAttribute(typeof(ResourceCompile))] - [System.Xml.Serialization.XmlIncludeAttribute(typeof(LinkItem))] - [System.Xml.Serialization.XmlIncludeAttribute(typeof(GenericItemType))] - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class SimpleItemType { - - private string conditionField; - - private string includeField; - - private string excludeField; - - private string removeField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Include { - get { - return this.includeField; - } - set { - this.includeField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Exclude { - get { - return this.excludeField; - } - set { - this.excludeField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Remove { - get { - return this.removeField; - } - set { - this.removeField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class PostBuildEventItem : SimpleItemType { - - private object[] itemsField; - - private ItemsChoiceType3[] itemsElementNameField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Command", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("Message", typeof(object))] - [System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemsElementName")] - [System.Xml.Serialization.XmlIgnoreAttribute()] - public ItemsChoiceType3[] ItemsElementName { - get { - return this.itemsElementNameField; - } - set { - this.itemsElementNameField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003", IncludeInSchema=false)] - public enum ItemsChoiceType3 { - - /// - Command, - - /// - Message, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class PreBuildEventItem : SimpleItemType { - - private object[] itemsField; - - private ItemsChoiceType2[] itemsElementNameField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Command", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("Message", typeof(object))] - [System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemsElementName")] - [System.Xml.Serialization.XmlIgnoreAttribute()] - public ItemsChoiceType2[] ItemsElementName { - get { - return this.itemsElementNameField; - } - set { - this.itemsElementNameField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003", IncludeInSchema=false)] - public enum ItemsChoiceType2 { - - /// - Command, - - /// - Message, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ResourceCompile : SimpleItemType { - - private object[] itemsField; - - private ItemsChoiceType1[] itemsElementNameField; - - /// - [System.Xml.Serialization.XmlElementAttribute("AdditionalIncludeDirectories", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("Culture", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("IgnoreStandardIncludePath", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("NullTerminateStrings", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("PreprocessorDefinitions", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ResourceOutputFileName", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ShowProgress", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SuppressStartupBanner", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("UndefinePreprocessorDefinitions", typeof(object))] - [System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemsElementName")] - [System.Xml.Serialization.XmlIgnoreAttribute()] - public ItemsChoiceType1[] ItemsElementName { - get { - return this.itemsElementNameField; - } - set { - this.itemsElementNameField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003", IncludeInSchema=false)] - public enum ItemsChoiceType1 { - - /// - AdditionalIncludeDirectories, - - /// - Culture, - - /// - IgnoreStandardIncludePath, - - /// - NullTerminateStrings, - - /// - PreprocessorDefinitions, - - /// - ResourceOutputFileName, - - /// - ShowProgress, - - /// - SuppressStartupBanner, - - /// - UndefinePreprocessorDefinitions, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class LinkItem : SimpleItemType { - - private object[] itemsField; - - private ItemsChoiceType[] itemsElementNameField; - - /// - [System.Xml.Serialization.XmlElementAttribute("AddModuleNamesToAssembly", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("AdditionalDependencies", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("AdditionalLibraryDirectories", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("AdditionalManifestDependencies", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("AllowIsolation", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("AssemblyDebug", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("AssemblyLinkResource", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("BaseAddress", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("CLRImageType", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("CLRSupportLastError", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("CLRThreadAttribute", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("CLRUnmanagedCodeCheck", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("CreateHotPatchableImage", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("DataExecutionPrevention", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("DelayLoadDLLs", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("DelaySign", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("Driver", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("EmbedManagedResourceFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("EnableCOMDATFolding", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("EnableUAC", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("EntryPointSymbol", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("FixedBaseAddress", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ForceFileOutput", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ForceSymbolReferences", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("FunctionOrder", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("GenerateDebugInformation", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("GenerateMapFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("HeapCommitSize", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("HeapReserveSize", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("IgnoreAllDefaultLibraries", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("IgnoreEmbeddedIDL", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("IgnoreSpecificDefaultLibraries", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("IgnoreStandardIncludePath", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ImageHasSafeExceptionHandlers", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ImportLibrary", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("KeyContainer", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("KeyFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("LargeAddressAware", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("LinkErrorReporting", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("LinkStatus", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("LinkTimeCodeGeneration", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MSDOSStubFileName", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MapExports", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MapFileName", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MergeSections", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MergedIDLBaseFileName", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MidlCommandFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("MinimumRequiredVersion", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ModuleDefinitionFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("OptimizeReferences", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("OutputFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("PreventDllBinding", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("Profile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ProfileGuidedDatabase", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ProgramDatabaseFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("RandomizedBaseAddress", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("RegisterOutput", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SectionAlignment", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("ShowProgress", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SpecifySectionAttributes", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("StackCommitSize", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("StackReserveSize", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("StripPrivateSymbols", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SubSystem", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SupportNobindOfDelayLoadedDLL", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SupportUnloadOfDelayLoadedDLL", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SuppressStartupBanner", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SwapRunFromCD", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("SwapRunFromNET", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("TargetMachine", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("TerminalServerAware", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("TreatLinkerWarningAsErrors", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("TypeLibraryFile", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("TypeLibraryResourceID", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("UACExecutionLevel", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("UACUIAccess", typeof(object))] - [System.Xml.Serialization.XmlElementAttribute("Version", typeof(object))] - [System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemsElementName")] - [System.Xml.Serialization.XmlIgnoreAttribute()] - public ItemsChoiceType[] ItemsElementName { - get { - return this.itemsElementNameField; - } - set { - this.itemsElementNameField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003", IncludeInSchema=false)] - public enum ItemsChoiceType { - - /// - AddModuleNamesToAssembly, - - /// - AdditionalDependencies, - - /// - AdditionalLibraryDirectories, - - /// - AdditionalManifestDependencies, - - /// - AllowIsolation, - - /// - AssemblyDebug, - - /// - AssemblyLinkResource, - - /// - BaseAddress, - - /// - CLRImageType, - - /// - CLRSupportLastError, - - /// - CLRThreadAttribute, - - /// - CLRUnmanagedCodeCheck, - - /// - CreateHotPatchableImage, - - /// - DataExecutionPrevention, - - /// - DelayLoadDLLs, - - /// - DelaySign, - - /// - Driver, - - /// - EmbedManagedResourceFile, - - /// - EnableCOMDATFolding, - - /// - EnableUAC, - - /// - EntryPointSymbol, - - /// - FixedBaseAddress, - - /// - ForceFileOutput, - - /// - ForceSymbolReferences, - - /// - FunctionOrder, - - /// - GenerateDebugInformation, - - /// - GenerateMapFile, - - /// - HeapCommitSize, - - /// - HeapReserveSize, - - /// - IgnoreAllDefaultLibraries, - - /// - IgnoreEmbeddedIDL, - - /// - IgnoreSpecificDefaultLibraries, - - /// - IgnoreStandardIncludePath, - - /// - ImageHasSafeExceptionHandlers, - - /// - ImportLibrary, - - /// - KeyContainer, - - /// - KeyFile, - - /// - LargeAddressAware, - - /// - LinkErrorReporting, - - /// - LinkStatus, - - /// - LinkTimeCodeGeneration, - - /// - MSDOSStubFileName, - - /// - MapExports, - - /// - MapFileName, - - /// - MergeSections, - - /// - MergedIDLBaseFileName, - - /// - MidlCommandFile, - - /// - MinimumRequiredVersion, - - /// - ModuleDefinitionFile, - - /// - OptimizeReferences, - - /// - OutputFile, - - /// - PreventDllBinding, - - /// - Profile, - - /// - ProfileGuidedDatabase, - - /// - ProgramDatabaseFile, - - /// - RandomizedBaseAddress, - - /// - RegisterOutput, - - /// - SectionAlignment, - - /// - ShowProgress, - - /// - SpecifySectionAttributes, - - /// - StackCommitSize, - - /// - StackReserveSize, - - /// - StripPrivateSymbols, - - /// - SubSystem, - - /// - SupportNobindOfDelayLoadedDLL, - - /// - SupportUnloadOfDelayLoadedDLL, - - /// - SuppressStartupBanner, - - /// - SwapRunFromCD, - - /// - SwapRunFromNET, - - /// - TargetMachine, - - /// - TerminalServerAware, - - /// - TreatLinkerWarningAsErrors, - - /// - TypeLibraryFile, - - /// - TypeLibraryResourceID, - - /// - UACExecutionLevel, - - /// - UACUIAccess, - - /// - Version, - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class GenericItemType : SimpleItemType { - - private System.Xml.XmlElement anyField; - - /// - [System.Xml.Serialization.XmlAnyElementAttribute()] - public System.Xml.XmlElement Any { - get { - return this.anyField; - } - set { - this.anyField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ItemDefinitionGroupType { - - private SimpleItemType[] itemsField; - - private string conditionField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Item", typeof(SimpleItemType))] - [System.Xml.Serialization.XmlElementAttribute("Link", typeof(LinkItem))] - [System.Xml.Serialization.XmlElementAttribute("PostBuildEvent", typeof(PostBuildEventItem))] - [System.Xml.Serialization.XmlElementAttribute("PreBuildEvent", typeof(PreBuildEventItem))] - [System.Xml.Serialization.XmlElementAttribute("ResourceCompile", typeof(ResourceCompile))] - public SimpleItemType[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ImportType { - - private string conditionField; - - private string projectField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Project { - get { - return this.projectField; - } - set { - this.projectField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ImportGroupType { - - private ImportType[] importField; - - private string conditionField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Import")] - public ImportType[] Import { - get { - return this.importField; - } - set { - this.importField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class OnErrorType { - - private string conditionField; - - private string executeTargetsField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string ExecuteTargets { - get { - return this.executeTargetsField; - } - set { - this.executeTargetsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class TaskType { - - private TaskTypeOutput[] outputField; - - private string conditionField; - - private string continueOnErrorField; - - private string architectureField; - - private string runtimeField; - - /// - [System.Xml.Serialization.XmlElementAttribute("Output")] - public TaskTypeOutput[] Output { - get { - return this.outputField; - } - set { - this.outputField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string ContinueOnError { - get { - return this.continueOnErrorField; - } - set { - this.continueOnErrorField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Architecture { - get { - return this.architectureField; - } - set { - this.architectureField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Runtime { - get { - return this.runtimeField; - } - set { - this.runtimeField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class TaskTypeOutput { - - private string taskParameterField; - - private string itemNameField; - - private string propertyNameField; - - private string conditionField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string TaskParameter { - get { - return this.taskParameterField; - } - set { - this.taskParameterField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string ItemName { - get { - return this.itemNameField; - } - set { - this.itemNameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string PropertyName { - get { - return this.propertyNameField; - } - set { - this.propertyNameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class TargetType { - - private object[] itemsField; - - private OnErrorType[] onErrorField; - - private string nameField; - - private string dependsOnTargetsField; - - private string inputsField; - - private string outputsField; - - private string conditionField; - - private string keepDuplicateOutputsField; - - private string returnsField; - - private string beforeTargetsField; - - private string afterTargetsField; - - private string labelField; - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemGroup", typeof(ItemGroupType))] - [System.Xml.Serialization.XmlElementAttribute("PropertyGroup", typeof(PropertyGroupType))] - [System.Xml.Serialization.XmlElementAttribute("Task", typeof(TaskType))] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("OnError")] - public OnErrorType[] OnError { - get { - return this.onErrorField; - } - set { - this.onErrorField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Name { - get { - return this.nameField; - } - set { - this.nameField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string DependsOnTargets { - get { - return this.dependsOnTargetsField; - } - set { - this.dependsOnTargetsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Inputs { - get { - return this.inputsField; - } - set { - this.inputsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Outputs { - get { - return this.outputsField; - } - set { - this.outputsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Condition { - get { - return this.conditionField; - } - set { - this.conditionField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string KeepDuplicateOutputs { - get { - return this.keepDuplicateOutputsField; - } - set { - this.keepDuplicateOutputsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Returns { - get { - return this.returnsField; - } - set { - this.returnsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string BeforeTargets { - get { - return this.beforeTargetsField; - } - set { - this.beforeTargetsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string AfterTargets { - get { - return this.afterTargetsField; - } - set { - this.afterTargetsField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string Label { - get { - return this.labelField; - } - set { - this.labelField = value; - } - } - } -} diff --git a/MakeyMakey/xGoedel.Tool.Makey/PHBLogo256.ico b/MakeyMakey/xGoedel.Tool.Makey/PHBLogo256.ico deleted file mode 100644 index 67d73bf31cba7e4b7192b8c46bdb33d10dbe6705..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4149 zcmcgvi9eL>*FQ633CV*b*#=K4vP4lCOeInwSqfwMrHHaLQnHRbdGaVNwqz`+$Qm9? z3mTP7h$35>s76D|zArPs>sEij`+48b=e_5?KXYH_oa-#tb-TpMGeR92p-BVwCcQoE|dzZFtiF6#O&f(BQUd<$jP8|CbJ5!}=RQ+}3HO>d2G26+%g6D&H0p*qP zpH_=^8|_Gvte(=`{wkKPZKXaEk<#3tOg(E>RUdr7>dv#p!s`A~>Sc;`T%{+^a5g{4 zpmx6!)vlhjhm^=q;})z`mR|FHa0A>c*11e^CCy3WGXKKgd0Px|+*mGNq__DS-Qz=*Ts7M0FZ>yp)$c0Xy|X{IG- zN01PBuwOi}OKAoCI5haSHP0$kF)<}Ack=cg&Z=DfZ`HMyyTGmg`_4mroWS8jLx zEXl5s-M5o|uh}DGTY7b~*Q&{#OgZze#Xi6;tgy06?}a_h-|tXxRB z>#m;S1L&JL?)uu^#wI84gLOHM+~POu$u-m^%G!RKH{AYh7fR=6svPgQbzF}BPz0%X zzE;clUER+(k%3nUQCar38km4*eXe}o*z7CFobur%SlDbXQR>Wjs1>vU50KgK9(f|d zxl{){BED()zA91_K}4^jZ?1NVi;FmzbxgkGy!o+G@6w<%(q$2!oRQ;_wxkBDkEB@# zzMrE{Bz?T>shMVde$`V+0CF3JS?$)Kb)bTuTr(Lj>0UtE;&cp6+&@{DY2CY_TYFEV`Cq#ZDd2=luF2y&V?VqtRIQU_3E2~JE4`y)0g$qjq^Wg6za&B{RyJI<4tI2j|vV=BEWe((O6XPvM&Jjc}w)9XvN3N)n7vh04Eh5 z=e?Z*<|^;b8>uk~BI<%zaBR*n%|*+NA0)(7KLo2Z6f%(~WtJTNG?oZMGCsX{Nq`b^ z5-lC=+l^QjMT9{w43H}kPd#`NTQD!Sfc~z}yM_sw^Vh#u%(0$5l8M(rxI&&Ni}m6d zL2%s^wMigB_U{BC4deon|E5$#AkOV8y{mUDRmKO|+IsaPyTcBcJ{3RCeX%;D>-F_d zM74-dOuauRe@_E<-AT>B$8s?stM8sFVrWc^cKyvFke^5Lnfbn~-#}W0sr{6~i!*=+ zI*<0(R=-c%KHiM^&^YPZ-761OQVU7$`d=P~MDPP>PZ|8#gZm>*;%C>@puvXqfsK`w zNb9U&{`5ntAe^fnZ|U^XE0IC*_Nr702atfeRAtl5eflo6itUa$_Dp$)0xf5QaUtF4 ztNsybwHa@Wh#S&*TT8=zB4%lnUi*ya0;m!L<)uQYRd1bL;oSN9V;$ zTiu?X*VSu5#zsRFWEL(5;I5mgq;82gv3UQYN)&Hm{=DeZ1NY@Dww#bzeEd!YjtWAz z@e{3|;m#RaJc{Unb=i7~y{BixRj$c6iU8rtX zvVsI#srx(>v?H*81xqCy+o}f&m1J!w)sCr36gYkxP2qMOi`PBbBZ4F=5qO z09|4*r)fSiHnUEm2j@2F#fS=5WKWbf^&0j1gIdH98ITjEC4{Ya>g;r(S9Em)Q+M(T zT}(P+V50P3FNx(3zKX#Huzf8&4tH&d*&j#MgWUSV$jDF6ikS-z;a#&)pW&my7Z>o? z1_TB|U5eUH_~L~o-^L#l4^o1yWtaeX;)%&2jg`~Ear8|?Ct=!iSpV!-!ySX>8OiIz zt*So5Z17=0%-0L0iRl>3sO_~yhD=8&T#EULt)@EXS5^~{r{vDP&Vgah-GXww(~L=x z!D!zqvwFktZB(XDvI*s`nF0+D&3t6v&xM=>_Skp@jy&RLQH~$wX3ZqZNUl~mE(C1V z&D2O+YpI$*8CWewqljhBFk|+{2`))NlSojXfx19_4b)t+n*`v8R;2!`V z>dI`SsagZvx!%cBfX6W&(*tmVnT^jiv*nIb>u%WNN5!I87ZAw#Art~z+y67Ko}tTiy5r_g_N4~Ey56vFJ59#)8vn;PZy%h-gqu)*m2#XsNO+1e*6UA5610k zR8&ANQE^qn(+Ie=Rp+!(VOf|}JRNMo^Fcs%eX9bRr!OCoE{_8}0wbgH9P}B%bQ&wC zA;L)k=)zI+W7QE^^dm?eP1-PzjP2hGTQmRIMbW{Hx_Za>+0Cw6l7b+MzwS@09ht(z@Vpe+cb}79!DiSlPKy*Gpp)RAwA@^q z!Z8~n3>awSl%a#NxJ3&OnZ0t2JF^D|i=fXE*xc3Bh+W{n0^B>VwU;4ZtCId|{>GKBV={3^r1oItw-CygHOK+`nu_LC%F1rg3X{kp%(1%<{< zL(K-bNdwy?PF3VBk{ieP4$LUaQ*i}C2-4D2rzPEb8K1f0s~zU9Ka>dxljG5Zv%F3dr+wRo(^>6ldU68149|^rCHjP-}RQQ zaJeEt_O(@R$x>H?VpY(YxmqO#cu^WX#V%}L;GWLdcX0L=tCn*D2Sec2z`6*T12+hF zzJ83$F2GD@W%C-i;HC$HI${ru#=@EwGaZv5@&ET$v3psr3xngs|fFv#^@mRbHj* zQb>oVoZeZL$9hS3$)Zx~$8FTS(9!$RCqUF8X=-o?hvs#yhhi9=7Hg3bF?mB>5!fmm5-7ZXze&{Z(dEvEDPhh3Bsy$ zg9i)a?`7=J83^zLXp8iM8Pep^p5J`-j)-8Zwit_L3uqS&m9N}dW8;W%k*<@!dLHms zhql8xGNq(9s(L8l0MrSiP47M5w=d>LZ@xwez(}x$j~sqi@wztI`3d!PaeuC&vm!>u z^OI-pv)cU@!k-r1dtuI>d^L3oHChQ{JsJ%Moyzd@SRKJ5aoP{{Zi*;6mHX@=j&6*_ z1HSyksiSJkd@0(AkR;4cniFpAasvbKQJ6e3`w3&CIWFl_I=>}@-M=qO%Ho(!&9?V< z@BckITH?oVC5Z3|MI?So8Ixud!maV+ZrE$F0whmp%JN9q0LvjEL5Zdw9yVY&q6|NU zX<^)ltytrRE?+*ZNqW4n9OqF%TKXBoWr?f6l&7H+`}g2Vk9PCok{C7vkNS=yjD*+- zY`_SHm#1Tdnz+k*6Uk5Hcw4%0=dlGQ_u;gEK3~>byauR4elHZcm^SDj5RHvp%QL!- zihr5q6QD7Tl?l&y7@IZ+1%_qziOX#x@{i!w^V%m5b$uOOzoH;vr`VBgrtgcJe_8zo z#FqK|9i`dj)5e&7Z3UWFZkz3;QQ?l?fp3Ra%bZ+}C&`cXD~3savgVL;=_&JCzeUt8 zIfd|+Q^E(BZ6P|PI<~E!?_G?&AfUR^wlJsC9yOlR-MpsI67L)B!oERnwkLKsc1h6G zqVm^1aao+JcJMXxVV5R|syk%`t`|(c(RgH2R%_tH4H-QmJipU{G$*0|^QR#YmH)SQ z77eby{)b3C;mJ>1ZO?Z@{lIk4ZbR1+<;#?#4{|cz>% diff --git a/MakeyMakey/xGoedel.Tool.Makey/ParseProject.cs b/MakeyMakey/xGoedel.Tool.Makey/ParseProject.cs deleted file mode 100644 index da3e1dc9d..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/ParseProject.cs +++ /dev/null @@ -1,511 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Collections.Generic; -using System.Xml; -using System.Xml.Serialization; - -namespace Goedel.Tool.Makey { - - public static class Utilities { - - - public static string UnixCanonicalPath (this string Path) { - var Directories = Path.Split('\\'); - - for (var i = 0; i < Directories.Length; i++) { - if (Directories[i] == "." | Directories[i] == "") { - Directories[i] = null; - } - else if (Directories[i] == "..") { - if (StrikeDirectory(Directories, i)) { - Directories[i] = null; - } - } - - } - - var Builder = new StringBuilder(); - foreach (var Directory in Directories) { - if (Directory != null) { - Builder.Append(Directory); - Builder.Append("/"); - } - } - - return Builder.ToString(); - } - - - static bool StrikeDirectory (string[] Directories, int Index) { - for (var i = Index - 1; i >= 0; i--) { - if (Directories[i] != null) { - Directories[i] = null; - return true; - } - } - return false; - - } - - public static string UnixPath(this string File, string Sub) { - var FilePath = Path.Combine(File, Sub); - var Directory = Path.GetDirectoryName(FilePath); - return Directory.Replace('\\', '/'); ; - } - - public static string UnixPath(this string File) { - var Directory = Path.GetDirectoryName(File); - return Directory.Replace('\\', '/'); ; - } - - public static string UnixFile(this string File) { - return File.Replace('\\', '/'); ; - } - - public static string UnixFile(this string File, string Sub) { - var FilePath = Path.Combine(File, Sub); - return FilePath.Replace('\\', '/'); ; - } - - } - - public class SaneXmlTextReader : XmlTextReader { - public SaneXmlTextReader (TextReader reader): base(reader) { } - - public override string NamespaceURI => ""; - } - - - public class VSProject : VSFile { - - public SortedSet ManualAddLibraries = new SortedSet { - "WindowsBase", - "System.Numerics", - "Microsoft.VisualStudio.QualityTools.UnitTestFramework" - }; - - - public List CrossTargets { get; set; } = new List { - - "4.4.0-linux-libc2.13-amd64", - "4.4.0-linux-libc2.13-armel", - "4.4.0-linux-libc2.13-armhf", - "4.4.0-linux-libc2.13-i386", - "4.4.0-macos-10.7-amd64", - "4.4.0-macos-10.7-i386", - "4.4.2-linux-libc2.13-amd64", - "4.4.2-linux-libc2.13-armel", - "4.4.2-linux-libc2.13-armhf", - "4.4.2-linux-libc2.13-i386", - "4.4.2-macos-10.7-amd64", - "4.4.2-macos-10.7-i386" - }; - - - public Project Project; - - public string Target = "unknown"; - - public string OutputType { get; set; } = null; - public bool IsExe = false; - public bool IsLibrary = false; - public string AssemblyName { get; set; } = null; - public string ProjectGuid { get; set; } = null; - public string ProjectTypeGuids { get; set; } = null; - - - public List Reference { get; set; } = new List(); - public List PrivateReference { get; set; } = new List(); - - - - public List Compile { get; set; } = new List(); - public List None { get; set; } = new List(); - public List ProjectReference { get; set; } = new List(); - - public string CompileAll = ""; - public string LinkAll = ""; - - public List SourceDependency = new List(); - public List FixedLinkDependency = new List(); - public List LinkDependency = new List(); - public List AdditionalLinkDependency { get; set; } = new List(); - - public string Directory; - - public VSProject(string Filename, bool Expand) { - - Directory = Path.GetDirectoryName(Filename); - - using (Stream scriptfile = - new FileStream(Filename, FileMode.Open, FileAccess.Read)) { - - using (var TextReader = new StreamReader(scriptfile)) { - - Parse (TextReader, Expand); - } - } - } - - public VSProject(TextReader TextReader) { - Parse(TextReader, true); - } - - - - void FuckerParse2 (TextReader TextReader) { - Project = new Project(); - Project.ItemGroup = new List(); - Project.PropertyGroup = new List(); - ItemGroupType ItemGroup = null; - PropertyGroupType PropertyGroup = null; - ReferenceType Reference = null; - CompileType Compile = null; - NoneType None = null; - ProjectReferenceType ProjectReference = null; - - object Current = Project; - var XmlReader = new XmlTextReader(TextReader) { }; - - - - while (XmlReader.Read()) { - if (XmlReader.NodeType== XmlNodeType.Element) { - switch (XmlReader.Name) { - case "PropertyGroup": { - PropertyGroup = new PropertyGroupType(); - Project.PropertyGroup.Add(PropertyGroup); - Current = PropertyGroup; - break; - } - case "ItemGroup": { - ItemGroup = new ItemGroupType(); - ItemGroup.Reference = new List(); - ItemGroup.Compile = new List(); - ItemGroup.None = new List(); - ItemGroup.ProjectReference = new List(); - Project.ItemGroup.Add(ItemGroup); - Current = ItemGroup; - break; - } - case "Reference": { - Reference = new ReferenceType(); - ItemGroup.Reference.Add (Reference); - Reference.Include = XmlReader.GetAttribute("Include"); - Current = Reference; - break; - } - case "Compile": { - Compile = new CompileType(); - ItemGroup.Compile.Add(Compile); - Compile.Include = XmlReader.GetAttribute("Include"); - Current = Compile; - break; - } - case "None": { - None = new NoneType(); - ItemGroup.None.Add(None); - None.Include = XmlReader.GetAttribute("Include"); - Current = None; - break; - } - case "ProjectReference": { - ProjectReference = new ProjectReferenceType(); - ItemGroup.ProjectReference.Add(ProjectReference); - ProjectReference.Include = XmlReader.GetAttribute("Include"); - Current = ProjectReference; - break; - } - - // now the strings - //case "Include": { - - // if (Current == Reference) { - // XmlReader.Read(); - // Reference.Include = XmlReader.Value; - // } - // if (Current == Compile) { - // XmlReader.Read(); - // Compile.Include = XmlReader.Value; - // } - // if (Current == None) { - // XmlReader.Read(); - // None.Include = XmlReader.Value; - // } - // if (Current == ProjectReference) { - // XmlReader.Read(); - // ProjectReference.Include = XmlReader.Value; - // } - - - // break; - // } - case "Project": { - - if (Current == ProjectReference) { - XmlReader.Read(); - ProjectReference.Project = XmlReader.Value; - } - break; - } - - // one off - - case "ProjectTypeGuids": { - - if (Current == PropertyGroup) { - XmlReader.Read(); - PropertyGroup.ProjectTypeGuids = XmlReader.Value; - } - - break; - } - case "ProjectGuid": { - - if (Current == PropertyGroup) { - XmlReader.Read(); - PropertyGroup.ProjectGuid = XmlReader.Value; - } - - break; - } - case "OutputType": { - - if (Current == PropertyGroup) { - XmlReader.Read(); - PropertyGroup.OutputType = XmlReader.Value; - } - - break; - } - case "AssemblyName": { - - if (Current == PropertyGroup) { - XmlReader.Read(); - PropertyGroup.AssemblyName = XmlReader.Value; - } - - break; - } - - case "HintPath": { - - if (Current == Reference) { - XmlReader.Read(); - Reference.HintPath = XmlReader.Value; - } - - break; - } - case "Private": { - - if (Current == Reference) { - XmlReader.Read(); - Reference.Private = XmlReader.Value; - } - - break; - } - case "DependentUpon": { - - if (Current == Compile) { - XmlReader.Read(); - Compile.DependentUpon = XmlReader.Value; - } - - break; - } - case "Generator": { - - if (Current == None) { - XmlReader.Read(); - None.Generator = XmlReader.Value; - } - - break; - } - case "LastGenOutput": { - - if (Current == None) { - XmlReader.Read(); - None.LastGenOutput = XmlReader.Value; - } - - break; - } - case "Name": { - if (Current == ProjectReference) { - XmlReader.Read(); - ProjectReference.Name = XmlReader.Value; - } - - break; - } - //default: { - // Current = null; - // break; - // } - } - - - - } - - - - - - //switch (XmlReader.NodeType) { - // case XmlNodeType.Element: - // Console.Write("<{0}>", XmlReader.Name); - // break; - - - // case XmlNodeType.Text: - // Console.Write(XmlReader.Value); - // break; - - // default: { - // break; - // } - // } - - - - } - - - } - - - - // Fucking fuckwittery. XmlSerializer has two modes, throw a stupid - // error if the utterly unnecessary namespace is missing if expected and - // throw a stupid error if it is encountered unexpectedly. - void FuckerParse (TextReader TextReader) { - var ProjectType = typeof(Project); - var XmlRootAttribute = new XmlRootAttribute() { - ElementName = "Project", - IsNullable = false, - }; - var Serializer = new XmlSerializer(ProjectType); - var XmlReader = new XmlTextReader(TextReader) { }; - Project = Serializer.Deserialize(XmlReader) as Project; - - - //try { - // var XmlRootAttribute = new XmlRootAttribute() { - // ElementName = "Project", - // Namespace = "http://schemas.microsoft.com/developer/msbuild/2003", - // IsNullable = false, - // DataType = "string" - // }; - // var Serializer = new XmlSerializer(ProjectType, XmlRootAttribute); - // Project = Serializer.Deserialize(TextReader) as Project; - // } - - //catch { - // var XmlRootAttribute = new XmlRootAttribute() { - // ElementName = "Project", - // IsNullable = false, - // DataType = "string" - // }; - // var Serializer = new XmlSerializer(ProjectType, XmlRootAttribute); - // Project = Serializer.Deserialize(TextReader) as Project; - // } - - } - - - public void Parse (TextReader TextReader, bool Expand) { - FuckerParse2(TextReader); - - foreach (var PropertyGroup in Project.PropertyGroup) { - OutputType = OutputType != null ? OutputType : PropertyGroup.OutputType; - AssemblyName = AssemblyName != null ? AssemblyName : PropertyGroup.AssemblyName; - ProjectGuid = ProjectGuid != null ? ProjectGuid : PropertyGroup.ProjectGuid; - ProjectTypeGuids = ProjectTypeGuids != null ? ProjectTypeGuids : PropertyGroup.ProjectTypeGuids; - } - - switch (OutputType) { - case "Exe": - case "AppContainerExe": { - Target = AssemblyName + ".exe"; - IsExe = true; - break; - } - case "Library": { - Target = AssemblyName + ".dll"; - IsLibrary = true; - break; - } - default: { - Target = AssemblyName + ".dll"; - IsLibrary = true; - break; - } - } - - - if (!Expand) { - return; - } - if (Project.ItemGroup != null) { - foreach (var ItemGroup in Project.ItemGroup) { - if (ItemGroup.Reference != null) { - foreach (var Item in ItemGroup?.Reference) { - Reference.Add(Item); - - var Len = Item.Include.IndexOf(','); - var Name = Len > 0 ? Item.Include.Substring(0, Len) : Item.Include; - Console.WriteLine("Library {0}", Name); - - if (Item.Private == "True") { - PrivateReference.Add(Item); - Console.WriteLine("Nuget Package Path {0}", Item.HintPath); - } - else if (ManualAddLibraries.Contains(Name)) { - AdditionalLinkDependency.Add(Name); - Console.WriteLine("Assembly library Path {0}", Name); - } - else if (Item.HintPath != null) { - Console.WriteLine("Link library Path {0}", Item.HintPath); - FixedLinkDependency.Add(Path.GetFileName(Item.HintPath)); - } - } - } - if (ItemGroup.Compile != null) { - foreach (var Item in ItemGroup?.Compile) { - Compile.Add(Item); - CompileAll += Item.Include + " "; - SourceDependency.Add(Item.Include); - } - } - if (ItemGroup.None != null) { - foreach (var Item in ItemGroup?.None) { - None.Add(Item); - } - } - if (ItemGroup.ProjectReference != null) { - foreach (var Item in ItemGroup?.ProjectReference) { - ProjectReference.Add(Item); - - var IncludeFile = Path.Combine(Directory, Item.Include); - - Item.SubProject = new VSProject(IncludeFile, false); - LinkDependency.Add(Item.SubProject.Target); - } - } - } - } - } - } - - - - public partial class ProjectReferenceType { - [System.Xml.Serialization.XmlIgnore] - public VSProject SubProject; - } - } \ No newline at end of file diff --git a/MakeyMakey/xGoedel.Tool.Makey/ParseSolution.cs b/MakeyMakey/xGoedel.Tool.Makey/ParseSolution.cs deleted file mode 100644 index 4a609c599..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/ParseSolution.cs +++ /dev/null @@ -1,288 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using Goedel.FSR; -//using Goedel.Registry; -//using Goedel.Utilities; - -namespace Goedel.Tool.Makey { - - public partial class VSFile { - - } - - - public enum ProjectType { - NULL, - folder, - csproj, - wixproj, - cproj, - portable, - website, - vsix - } - - /// - /// Represents a Visual Studio solution. - /// - /// NB, since the format of the file is not published, it is not possible - /// to know with any certainty how Visual Studio parses it. In particular - /// there may be features of the file format that have not been expressed - /// in any of the examples seen. - /// - /// In particular, we have no way to tell if the file format supports - /// comments or if there is some line wrapping mechanism supported. - /// - public partial class VSSolution : VSFile { - readonly static public Dictionary MapProject = new Dictionary { - { "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", ProjectType.folder}, - { "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", ProjectType.csproj}, - { "{930C7802-8A8C-48F9-8165-68863BCCD9DD}", ProjectType.wixproj}, - { "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}", ProjectType.cproj }, - { "{786C830F-07A1-408B-BD7F-6EE04809D6DB}", ProjectType.portable }, - { "{82b43b9b-a64c-4715-b499-d71e9ca2bd60}", ProjectType.vsix}, - { "{E24C65DC-7377-472B-9ABA-BC803B73C61A}", ProjectType.website} - }; - - public string Directory; - - public string FormatVersion { get; set; } - public string VisualStudioVersion { get; set; } - public string MinimumVisualStudioVersion { get; set; } - - public List Projects { get; set; } = new List(); - - public List SolutionConfigurationPlatforms = new List(); - public List ProjectConfigurationPlatforms = new List(); - public List SolutionProperties = new List(); - public List NestedProjects = new List(); - - public Dictionary ProjectsByGUID = new Dictionary(); - - public VSSolution(string Filename) { - Parse(Filename); - } - - public void Parse(string Filename) { - using (var FileStream = new FileStream( - Filename, FileMode.Open, FileAccess.Read)) { - LexReader LexReader = new LexReader(FileStream); - Parse(LexReader); - } - - } - - - - enum Target { - Base, - Project, - SolutionItems, - ProjectDependencies, - SolutionConfigurationPlatforms, - ProjectConfigurationPlatforms, - SolutionProperties, - NestedProjects, - Unknown - } - - - public void Parse(LexReader LexReader) { - Stack Stack = new Stack(); - - SolutionProject SolutionProject = null; - - - { - var Lexer = new Tokenizer(LexReader); - - var Token = Lexer.GetToken(); - while (Token != Tokenizer.Token.Empty) { - //Console.WriteLine("Token {0}", Token); - - switch (Token) { - case Tokenizer.Token.Start: { - var Push = Target.Unknown; - - switch (Lexer.Tag) { - case "Project": { - SolutionProject = new SolutionProject(Lexer); - Projects.Add(SolutionProject); - - ProjectsByGUID.Add(SolutionProject.ThisGUID, SolutionProject); - - Push = Target.Project; - break; - } - case "ProjectSection": { - if (Lexer.Key == "ProjectDependencies") { - Push = Target.ProjectDependencies; - } - else if (Lexer.Key == "SolutionItems") { - Push = Target.SolutionItems; - } - break; - } - case "Global": { - break; - } - case "GlobalSection": { - if (Lexer.Key == "SolutionConfigurationPlatforms") { - Push = Target.SolutionConfigurationPlatforms; - } - else if (Lexer.Key == "ProjectConfigurationPlatforms") { - Push = Target.ProjectConfigurationPlatforms; - } - else if (Lexer.Key == "SolutionProperties") { - Push = Target.SolutionProperties; - } - else if (Lexer.Key == "NestedProjects") { - Push = Target.NestedProjects; - } - break; - } - } - - Stack.Push(Push); - break; - } - - case Tokenizer.Token.End: { - if (Stack.Count > 0) { - Stack.Pop(); - } - break; - } - - case Tokenizer.Token.TagValue: { - if (Stack.Count == 0) { - switch (Lexer.Tag) { - case "VisualStudioVersion": { - VisualStudioVersion = Lexer.Value; - break; - } - case "MinimumVisualStudioVersion": { - MinimumVisualStudioVersion = Lexer.Value; - break; - } - } - } - else if (Stack.Peek() == Target.ProjectDependencies) { - var KeyValue = new KeyValue(Lexer); - SolutionProject?.ProjectDependencies.Add(KeyValue); - } - else if (Stack.Peek() == Target.SolutionItems) { - var KeyValue = new KeyValue(Lexer); - SolutionProject?.SolutionItems.Add(KeyValue); - } - else if (Stack.Peek() == Target.SolutionConfigurationPlatforms) { - var KeyValue = new KeyValue(Lexer); - SolutionConfigurationPlatforms.Add(KeyValue); - } - else if (Stack.Peek() == Target.ProjectConfigurationPlatforms) { - var KeyValue = new KeyValue(Lexer); - ProjectConfigurationPlatforms.Add(KeyValue); - } - else if (Stack.Peek() == Target.SolutionProperties) { - var KeyValue = new KeyValue(Lexer); - SolutionProperties.Add(KeyValue); - } - else if (Stack.Peek() == Target.NestedProjects) { - var KeyValue = new KeyValue(Lexer); - NestedProjects.Add(KeyValue); - } - break; - } - - case Tokenizer.Token.Line: { - //Console.WriteLine(Lexer.Tag); - break; - } - } - - - Token = Lexer.GetToken(); - } - } - //catch (System.Exception Inner) { - // throw new ParseError(LexReader, Inner); - // } - } - - - public SolutionProject ByGuid (string GUID) { - if (GUID == null) { return null; } - - SolutionProject Result; - ProjectsByGUID.TryGetValue(GUID, out Result); - - return Result; - } - - } - - - public partial class SolutionProject { - public string TypeGUID { get; set; } - public string Name { get; set; } - public string Directory { get; set; } - public string ThisGUID { get; set; } - - public ProjectType ProjectType { - get { return _ProjectType; } - } - - public VSProject Project; - ProjectType _ProjectType = ProjectType.NULL; - - public List SolutionItems = new List(); - public List ProjectDependencies = new List(); - - public SolutionProject(Tokenizer Tokenizer) { - TypeGUID = Tokenizer.Key; - Name = Tokenizer.Value0; - Directory = Tokenizer.Value1; - ThisGUID = Tokenizer.Value2; - - VSSolution.MapProject.TryGetValue(TypeGUID, out _ProjectType); - } - - public bool Recurse () { - return (_ProjectType == ProjectType.csproj) | (_ProjectType == ProjectType.portable); - } - - readonly List KillGUIDs = new List { - "{82b43b9b-a64c-4715-b499-d71e9ca2bd60}" - }; - - public bool MakeUnix () { - if (Project == null) return false; - if (Project.ProjectTypeGuids != null) { - foreach (var Kill in KillGUIDs) { - if (Project.ProjectTypeGuids.IndexOf(Kill) >= 0) { - return false; - } - } - Console.WriteLine("Projects{0}", Project.AssemblyName); - Console.WriteLine("GUIDS: {0}", Project.ProjectTypeGuids); - } - - return Recurse(); - } - - } - - - public partial class KeyValue { - public string Key { get; set; } - public string Value { get; set; } - - public KeyValue(Tokenizer Tokenizer) { - Key = Tokenizer.Tag; - Value = Tokenizer.Value; - } - - } - - } \ No newline at end of file diff --git a/MakeyMakey/xGoedel.Tool.Makey/Project.cs b/MakeyMakey/xGoedel.Tool.Makey/Project.cs deleted file mode 100644 index be321a420..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Project.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -//using Goedel.Registry; -//using Goedel.Utilities; - -namespace Goedel.Tool.Makey { - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - ////[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - //[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - - - [Serializable()] - //[System.Xml.Serialization.XmlRoot(ElementName ="Project", Namespace = "http://schemas.microsoft.com/developer/msbuild/2003", IsNullable = false)] - [System.Xml.Serialization.XmlRoot(ElementName = "Project", IsNullable = false)] - - - - public partial class Project { - /// - [System.Xml.Serialization.XmlAttributeAttribute("Sdk")] - public string Sdk { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("PropertyGroup")] - public List PropertyGroup { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("ItemGroup")] - public List ItemGroup { get; set; } - } - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - //[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - - [Serializable()] - [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class PropertyGroupType { - - /// - [System.Xml.Serialization.XmlElementAttribute("ProjectTypeGuids")] - public string ProjectTypeGuids { get; set; } - - - /// - [System.Xml.Serialization.XmlElementAttribute("ProjectGuid")] - public string ProjectGuid { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("OutputType")] - public string OutputType { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("AssemblyName")] - public string AssemblyName { get; set; } - - } - - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - //[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - - [Serializable()] - [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ItemGroupType { - - /// - [System.Xml.Serialization.XmlElementAttribute("Reference")] - public List Reference { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("Compile")] - public List Compile { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("None")] - public List None { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("ProjectReference")] - public List ProjectReference { get; set; } - - } - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - //[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - - [Serializable()] - [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ReferenceType { - - /// - [System.Xml.Serialization.XmlAttributeAttribute("Include")] - public string Include { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("HintPath")] - public string HintPath { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("Private")] - public string Private { get; set; } - - public string Name => HintPath != null ? Path.GetFileName(HintPath) : null; - - } - - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - //[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - - [Serializable()] - [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class CompileType { - - /// - [System.Xml.Serialization.XmlAttributeAttribute("Include")] - public string Include { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("DependentUpon")] - public string DependentUpon { get; set; } - - - } - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - //[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - - [Serializable()] - [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class NoneType { - - /// - [System.Xml.Serialization.XmlAttributeAttribute("Include")] - public string Include { get; set; } - /// - [System.Xml.Serialization.XmlElementAttribute("Generator")] - public string Generator { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("LastGenOutput")] - public string LastGenOutput { get; set; } - } - - ///// - //[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - //[System.SerializableAttribute()] - //[System.Diagnostics.DebuggerStepThroughAttribute()] - //[System.ComponentModel.DesignerCategoryAttribute("code")] - - [Serializable()] - [System.Xml.Serialization.XmlType(Namespace = "http://schemas.microsoft.com/developer/msbuild/2003")] - public partial class ProjectReferenceType { - - /// - [System.Xml.Serialization.XmlAttributeAttribute("Include")] - public string Include { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("Project")] - public string Project { get; set; } - - /// - [System.Xml.Serialization.XmlElementAttribute("Name")] - public string Name { get; set; } - - } - - } diff --git a/MakeyMakey/xGoedel.Tool.Makey/Tokenizer.cs b/MakeyMakey/xGoedel.Tool.Makey/Tokenizer.cs deleted file mode 100644 index de0d808d8..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Tokenizer.cs +++ /dev/null @@ -1,219 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using Goedel.FSR; - - -// Goedel.Tool.Makey -namespace Goedel.Tool.Makey{ - - - // Prototypes for the actions. These must be implemented in - // the plus class - - /* - public partial class Tokenizer { - public virtual void Reset (int c) { - } - public virtual void AddCurrent (int c) { - } - public virtual void GotTag (int c) { - } - public virtual void GotStartTag (int c) { - } - public virtual void Ignore (int c) { - } - public virtual void GotItem (int c) { - } - public virtual void StartFinalize (int c) { - } - public virtual void EndFinalize (int c) { - } - public virtual void TagValueFinalize (int c) { - } - public virtual void Abort (int c) { - } - } - */ - - public partial class Tokenizer : global::Goedel.FSR.Lexer { - /// - /// Create and initialize a lexical analyzer. - /// - /// The input source. - public Tokenizer(LexReader Reader) : base (Reader) { - } - - /// - /// Create and initialize a lexical analyzer. - /// - /// The input source. - public Tokenizer(Stream Stream) : base(new LexReader(Stream)) { - } - - /// - /// Create and initialize a lexical analyzer. - /// - /// The input source. - public Tokenizer(TextReader TextReader) : base(new LexReader(TextReader)) { - } - - /// - /// Maps characters to character sets - /// - public override byte[] CharacterMappings => Character_Mapping; - - /// - /// State transitions in response to character set - /// - public override short[,] CompressedTransitions => Compressed_Transitions; - - /// - /// Get the next token from the stream - /// - /// The initial starting state - /// The token detected or -1 if an error occurred - public Token GetToken(State StartState) { - return Tokens [GetTokenInt((int)StartState)]; - } - - /// - /// Get the next token from the stream - /// - /// The token detected or -1 if an error occurred - public Token GetToken () { - return GetToken (0); - } - - /// State types - public enum State { - /// Initial - Initial = 0, - /// Begin - Begin = 1, - /// GetTagValue0 - GetTagValue0 = 2, - /// GetTagValue - GetTagValue = 3, - /// HaveOpen - HaveOpen = 4, - /// StartKey1 - StartKey1 = 5, - /// StartParam1 - StartParam1 = 6, - /// StartParam2 - StartParam2 = 7, - /// StartItem1 - StartItem1 = 8, - /// StartItem2 - StartItem2 = 9, - /// StartItem3 - StartItem3 = 10, - /// StartComplete - StartComplete = 11, - /// EndComplete - EndComplete = 12, - /// TagValueComplete - TagValueComplete = 13, - /// LineComplete - LineComplete = 14, - /// Fail - Fail = 15 - }; - - /// Token Types - public enum Token { - /// Could not find a valid token. - INVALID = -1, - /// Empty - Empty = 0, - /// Start - Start = 1, - /// End - End = 2, - /// Line - Line = 3, - /// TagValue - TagValue = 4, - /// Invalid - Invalid = 5 - }; - - - /// Mapping of characters to character groups - static byte [] Character_Mapping = new byte [] { - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 4 , 0 , 0 , 5 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 6 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; - - static short [,] Compressed_Transitions = new short [,] { - {1 , 0 , 0 , 1 , 1 , 1 , 1 }, - {1 , 1 , 12 , 4 , 1 , 1 , 2 }, - {3 , 3 , 13 , 3 , 3 , 3 , 3 }, - {3 , 3 , 13 , 3 , 3 , 3 , 3 }, - {5 , 5 , 15 , 5 , 6 , 5 , 5 }, - {5 , 5 , 5 , 5 , 6 , 5 , 5 }, - {-2 , 7 , -2 , -2 , -2 , -2 , 8 }, - {-2 , 7 , -2 , -2 , -2 , -2 , 8 }, - {9 , 9 , 11 , 9 , 9 , 10 , 9 }, - {9 , 9 , 11 , 9 , 9 , 10 , 9 }, - {9 , 9 , 11 , 9 , 9 , 9 , 9 }, - {-2 , -2 , -2 , -2 , -2 , -2 , -2 }, - {-2 , -2 , -2 , -2 , -2 , -2 , -2 }, - {-2 , -2 , -2 , -2 , -2 , -2 , -2 }, - {-2 , -2 , -2 , -2 , -2 , -2 , -2 }, - {-2 , -2 , -2 , -2 , -2 , -2 , -2 } - }; - - - static Token [] Tokens = new Token [] { - Token.Empty, - Token.End, - Token.TagValue, - Token.TagValue, - Token.Invalid, - Token.Start, - Token.Start, - Token.Start, - Token.Start, - Token.Start, - Token.Start, - Token.Start, - Token.End, - Token.TagValue, - Token.Line, - Token.Invalid - }; - - /// Generated initialization method, is called automatically - /// the FSR to reset - public override void Init () { - Actions = new ActionDelegate[] { - Reset, - AddCurrent, - GotTag, - AddCurrent, - GotTag, - AddCurrent, - GotStartTag, - Ignore, - Ignore, - AddCurrent, - GotItem, - StartFinalize, - EndFinalize, - TagValueFinalize, - Ignore, - Abort - }; - } - } - } - diff --git a/MakeyMakey/xGoedel.Tool.Makey/Tokenizer.fsr b/MakeyMakey/xGoedel.Tool.Makey/Tokenizer.fsr deleted file mode 100644 index c50ff3c0d..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/Tokenizer.fsr +++ /dev/null @@ -1,82 +0,0 @@ -FSR Goedel.Tool.Makey Tokenizer - - // To save effort, we just strip out CR characters as worthless and beneath - // contempt before the lexer - - Charset Digit "0" "9" - Charset alpha "a" "z" - Charset ALPHA "A" "Z" - - Token Empty - Token Start - Token End - Token Line - Token TagValue - Token Invalid - - // Strip out blank lines - State Initial Reset Empty - On " \t" GoTo Initial - On "\n" GoTo Initial - Any GoTo Begin - - State Begin AddCurrent End - On "\n" GoTo EndComplete - On "=" GoTo GetTagValue0 - On "(" GoTo HaveOpen - Any GoTo Begin - - State GetTagValue0 GotTag TagValue - On "\n" GoTo TagValueComplete - Any GoTo GetTagValue - - State GetTagValue AddCurrent TagValue - On "\n" GoTo TagValueComplete - Any GoTo GetTagValue - - - - - State HaveOpen GotTag Invalid - On "\n" GoTo Fail - On ")" GoTo StartParam1 - Any GoTo StartKey1 - - State StartKey1 AddCurrent Start - On ")" GoTo StartParam1 - Any GoTo StartKey1 - - State StartParam1 GotStartTag Start - On " \t" GoTo StartParam2 - On "=" GoTo StartItem1 - - State StartParam2 Ignore Start - On " \t" GoTo StartParam2 - On "=" GoTo StartItem1 - - - State StartItem1 Ignore Start - On "\n" GoTo StartComplete - On "," GoTo StartItem3 - Any GoTo StartItem2 - - State StartItem2 AddCurrent Start - On "\n" GoTo StartComplete - On "," GoTo StartItem3 - Any GoTo StartItem2 - - State StartItem3 GotItem Start - On "\n" GoTo StartComplete - Any GoTo StartItem2 - - - - // Completed items - - State StartComplete StartFinalize Start - State EndComplete EndFinalize End - State TagValueComplete TagValueFinalize TagValue - State LineComplete Ignore Line - - State Fail Abort Invalid - \ No newline at end of file diff --git a/MakeyMakey/xGoedel.Tool.Makey/TokenizerPlus.cs b/MakeyMakey/xGoedel.Tool.Makey/TokenizerPlus.cs deleted file mode 100644 index 4c745d4c1..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/TokenizerPlus.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using System.Text; -using System.Collections.Generic; -//using Goedel.Registry; -using Goedel.FSR; - -namespace Goedel.Tool.Makey { - - /* - * Recoginze the following as tokens: - * - * Start: Label(Item) = Item [, Item] - * End: EndLabel - * TagValue: Item = Item - */ - - - public partial class Tokenizer { - - private static T IfExists (List List, int Index) { - if (List == null) return default(T); - return (List.Count > Index) ? List [Index] : default(T); - } - - - - public override int GetTokenInt(int StartState) { - StateInt = StartState; - - //Note that we call Reset() after setting the initial state - //This allows a reset method to take different actions depending - //on which type of data is being parsed. - Reset(); - - bool Going = Reader.Get(); - while (Going) { - - //Console.Write(Reader.LastChar); - - int c = Reader.LastInt; - int ct = ((c >= 0) & (c < CharacterMappings.Length)) ? - CharacterMappings[c] : 0; - - //Console.WriteLine(" {0} {1} {2}", StateInt, c, ct); - - NextState = CompressedTransitions[StateInt, ct]; - - if (NextState >= 0) { - ActionDelegate Action = Actions[(int)NextState]; - Action(Reader.LastInt); - Going = Reader.Get(); - StateInt = NextState; - } - else { - Going = false; - Reader.UnGet(); - } - } - - return StateInt; - } - - - Accumulate Accumulate = new Accumulate(); - - public string Tag { get; set; } - public string Key { get; set; } - public List Values { get; set; } - - public string Value { get { return Value0; } } - public string Value0 { get { return IfExists(Values, 0); } } - public string Value1 { get { return IfExists(Values, 1); } } - public string Value2 { get { return IfExists(Values, 2); } } - - /// - /// Reset all buffers and output values for the next token. - /// - public override void Reset () { - Values = new List(); - Tag = null; - Clear(); - } - - /// - /// Reset all buffers. - /// - void Clear() { - Accumulate.Clear(); - } - - /// - /// Get the value of the current item and clear the input buffers. - /// - string CurrentItem() { - return Accumulate.CurrentItem(); - } - - //Add data to the current input stripping leading and trailing spaces - void AddCurrent(int c) { - Accumulate.AddCurrent(c); - } - - - /// - /// Do nothing - /// - /// Character that was read - public virtual void Reset(int c) { - Reset(); - } - - /// - /// Complete a start token. This has the pattern - /// Label( {Item} ) = {Item} [, {Item}] - /// - /// Character that was read - public virtual void StartFinalize(int c) { - Values.Add(CurrentItem()); - //Console.WriteLine("Start: |{0}|{1}|", Tag, Key); - foreach(var Val in Values) { - //Console.WriteLine (" |{0}|", Val); - } - } - - /// - /// Complete a TagValue token. This is any line that does not - /// match the Start token pattern that matches the pattern - /// {Item} = {Item} - /// - /// Character that was read - public virtual void TagValueFinalize(int c) { - Values.Add(CurrentItem()); - //Console.WriteLine("Tag: |{0}| = |{1}|", Tag, Value); - } - - /// - /// Complete an End token This is any line that does not - /// match either the Start or TagValue tokens - /// - /// Character that was read - public virtual void EndFinalize(int c) { - - Tag = CurrentItem(); - - if (String.Compare (Tag, 0, "End", 0, 3) != 0) { - NextState = (int)State.LineComplete; - //Console.WriteLine("Line: {0}", Tag); - } - else { - //Console.WriteLine("End: {0}", Tag); - } - - } - - - - /// - /// Abort the current scan and ignore the data. - /// - /// Character that was read - public virtual void Abort(int c) { - - } - - - /// - /// Do nothing - /// - /// Character that was read - public virtual void Ignore(int c) { - } - - - - - /// - /// Do nothing - /// - /// Character that was read - public virtual void GotTag(int c) { - Tag = CurrentItem(); - } - - - - - /// - /// Do nothing - /// - /// Character that was read - public virtual void GotStartTag(int c) { - Key = CurrentItem(); - } - - - /// - /// Do nothing - /// - /// Character that was read - public virtual void GotItem(int c) { - Values.Add(CurrentItem()); - } - - } - } diff --git a/MakeyMakey/xGoedel.Tool.Makey/xGoedel.Tool.Makey.csproj b/MakeyMakey/xGoedel.Tool.Makey/xGoedel.Tool.Makey.csproj deleted file mode 100644 index 688874af2..000000000 --- a/MakeyMakey/xGoedel.Tool.Makey/xGoedel.Tool.Makey.csproj +++ /dev/null @@ -1,46 +0,0 @@ - - - - netstandard2.0 - PHBLogo256.ico - - - - - - - - - - Exceptions.exceptional - True - True - - - GenerateMakefile.script - True - True - - - Tokenizer.fsr - True - True - - - - - - Exceptions.cs - exceptional - - - GenerateMakefile.cs - GScript - - - Tokenizer.cs - fsrcs - - - -