Initial commit
This commit is contained in:
52
Setup/src/Program.bf
Normal file
52
Setup/src/Program.bf
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Cpp2Beef;
|
||||
using LibClang;
|
||||
|
||||
namespace <ProjectName>.Setup;
|
||||
|
||||
class <ProjectName>Generator : Cpp2BeefGenerator, this(Span<char8*> args)
|
||||
{
|
||||
protected override Span<char8*> Args => args;
|
||||
protected override Flags Flags => .None;
|
||||
|
||||
StreamWriter writer = new .()..Create(TODO)..Write("""
|
||||
// This file was generated by Cpp2Beef
|
||||
|
||||
using System;
|
||||
using System.Interop;
|
||||
|
||||
namespace <ProjectName>;
|
||||
|
||||
|
||||
""");
|
||||
|
||||
protected override StreamWriter GetWriterForHeader(StringView header)
|
||||
{
|
||||
if (header.EndsWith(TODO))
|
||||
return writer;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
[CLink] static extern int32 system(char8*);
|
||||
private static mixin RunCommand(char8* cmd)
|
||||
{
|
||||
Console.WriteLine($"> {StringView(cmd)}");
|
||||
int32 rcode = system(cmd);
|
||||
if (rcode != 0)
|
||||
return rcode;
|
||||
}
|
||||
|
||||
public static int Main(String[] args)
|
||||
{
|
||||
scope <ProjectName>Generator(char8*[?]("--language=c")).Generate(TODO, null);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user