Browse Source

Created a new top-level target executable ("Cxxi") and fixed the Generator to be a proper library.

pull/1/head
triton 13 years ago
parent
commit
5d0e8b99e3
  1. 4
      build/premake4.lua
  2. 9
      src/Cxxi/Cxxi.lua
  3. 19
      src/Cxxi/Program.cs
  4. 11
      src/Generator/Driver.cs
  5. 2
      src/Generator/Generator.lua
  6. 4
      src/Generator/Utils/Utils.cs

4
build/premake4.lua

@ -32,9 +32,9 @@ solution "Cxxi" @@ -32,9 +32,9 @@ solution "Cxxi"
group "Tests"
IncludeTests()
group "Cxxi"
group "Libraries"
include (srcdir .. "/Cxxi/Cxxi.lua")
include (srcdir .. "/Bridge/Bridge.lua")
include (srcdir .. "/Generator/Generator.lua")
include (srcdir .. "/Generator.Tests/Generator.Tests.lua")
include (srcdir .. "/Parser/Parser.lua")

9
src/Cxxi/Cxxi.lua

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
project "Cxxi"
kind "ConsoleApp"
language "C#"
location "."
files { "**.cs" }
links { "System", "System.Core", "Bridge", "Generator" }

19
src/Generator/Program.cs → src/Cxxi/Program.cs

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
using System;
using System;
using System.IO;
using System.Reflection;
using Mono.Options;
namespace Cxxi
{
public class Program
internal class Program
{
static void ShowHelp(OptionSet options)
{
@ -115,7 +115,7 @@ namespace Cxxi @@ -115,7 +115,7 @@ namespace Cxxi
return true;
}
public static void Main(String[] args)
public static void Main(string[] args)
{
var options = new DriverOptions();
@ -132,16 +132,5 @@ namespace Cxxi @@ -132,16 +132,5 @@ namespace Cxxi
driver.ProcessCode();
driver.GenerateCode();
}
public static void Run(ILibrary library)
{
var options = new DriverOptions();
var driver = new Driver(options, library);
driver.Setup();
driver.ParseCode();
driver.ProcessCode();
driver.GenerateCode();
}
}
}
}

11
src/Generator/Driver.cs

@ -122,6 +122,17 @@ namespace Cxxi @@ -122,6 +122,17 @@ namespace Cxxi
generator.Generate(unit);
}
}
public static void Run(ILibrary library)
{
var options = new DriverOptions();
var driver = new Driver(options, library);
driver.Setup();
driver.ParseCode();
driver.ProcessCode();
driver.GenerateCode();
}
}
public class DriverOptions

2
src/Generator/Generator.lua

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
project "Generator"
kind "ConsoleApp"
kind "SharedLib"
language "C#"
location "."

4
src/Generator/Utils/Utils.cs

@ -160,12 +160,12 @@ namespace Cxxi @@ -160,12 +160,12 @@ namespace Cxxi
}
}
static class AssemblyHelpers
public static class AssemblyHelpers
{
public static IEnumerable<System.Type> FindDerivedTypes(this Assembly assembly,
System.Type baseType)
{
return assembly.GetTypes().Where(baseType.IsAssignableFrom);
}
}
}
}

Loading…
Cancel
Save