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. 17
      src/Cxxi/Program.cs
  4. 11
      src/Generator/Driver.cs
  5. 2
      src/Generator/Generator.lua
  6. 2
      src/Generator/Utils/Utils.cs

4
build/premake4.lua

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

9
src/Cxxi/Cxxi.lua

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

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

@ -1,11 +1,11 @@
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Mono.Options; using Mono.Options;
namespace Cxxi namespace Cxxi
{ {
public class Program internal class Program
{ {
static void ShowHelp(OptionSet options) static void ShowHelp(OptionSet options)
{ {
@ -115,7 +115,7 @@ namespace Cxxi
return true; return true;
} }
public static void Main(String[] args) public static void Main(string[] args)
{ {
var options = new DriverOptions(); var options = new DriverOptions();
@ -132,16 +132,5 @@ namespace Cxxi
driver.ProcessCode(); driver.ProcessCode();
driver.GenerateCode(); 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
generator.Generate(unit); 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 public class DriverOptions

2
src/Generator/Generator.lua

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

2
src/Generator/Utils/Utils.cs

@ -160,7 +160,7 @@ namespace Cxxi
} }
} }
static class AssemblyHelpers public static class AssemblyHelpers
{ {
public static IEnumerable<System.Type> FindDerivedTypes(this Assembly assembly, public static IEnumerable<System.Type> FindDerivedTypes(this Assembly assembly,
System.Type baseType) System.Type baseType)

Loading…
Cancel
Save