示例#1
0
 private void GenerateGcc(JstpModel model, string outFolder)
 {
     GenCCommand.GenerateCCode(model, outFolder);
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.sdcc_main_c), Path.Combine(outFolder, "main.c"));
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.sdcc_makefile), Path.Combine(outFolder, "makefile"));
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.ADuC847_h), Path.Combine(outFolder, "ADuC847.h"));
 }
示例#2
0
 private void GenerateGcc(JstpModel model, string outFolder)
 {
     GenCCommand.GenerateCCode(model, outFolder);
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.jstp_test_c), Path.Combine(outFolder, "jstp_test.c"));
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.gcc_makefile), Path.Combine(outFolder, "makefile"));
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.gcc_in_txt), Path.Combine(outFolder, "in.txt"));
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(TestResource.run_sh), Path.Combine(outFolder, "run.sh"));
 }
示例#3
0
文件: Jstp.cs 项目: ErwinCat/jstp
        public static void GenerateAndSave(JstpModel model, IFileSystem templateFileSystem, string templateText, string fileToSave)
        {
            Template.NamingConvention = new CSharpNamingConvention();
            Template.RegisterSafeType(typeof(JstpGenModel), _ => _);
            Template.RegisterSafeType(typeof(JstpDescMetaType), o => o.ToString());
            Template.RegisterFilter(typeof(TextFilter));
            if (templateFileSystem!=null) Template.FileSystem = templateFileSystem;

            var template = Template.Parse(templateText);
            var genResult = template.Render(Hash.FromAnonymousObject(new { model = model }));
            File.WriteAllText(fileToSave, genResult);
        }
示例#4
0
        public static void GenerateCCode(JstpModel model, string outFolder)
        {
            var vfs = new VirtualLiquidFileSystem();
            vfs["argArray"] = () => Encoding.UTF8.GetString(CCodeResource._argArray);
            vfs["argObject"] = () => Encoding.UTF8.GetString(CCodeResource._argObject);
            vfs["resObject"] = () => Encoding.UTF8.GetString(CCodeResource._resObject);

            Jstp.GenerateAndSave(model, vfs, Encoding.UTF8.GetString(CCodeResource.jsmn_c), Path.Combine(outFolder, "jsmn.c"));
            Jstp.GenerateAndSave(model, vfs, Encoding.UTF8.GetString(CCodeResource.jsmn_h), Path.Combine(outFolder, "jsmn.h"));
            Jstp.GenerateAndSave(model, vfs, Encoding.UTF8.GetString(CCodeResource.jstp_gen_c), Path.Combine(outFolder, "jstp_gen.c"));
            Jstp.GenerateAndSave(model, vfs, Encoding.UTF8.GetString(CCodeResource.jstp_gen_h), Path.Combine(outFolder, "jstp_gen.h"));
            Jstp.GenerateAndSave(model, vfs, Encoding.UTF8.GetString(CCodeResource.jstp_c), Path.Combine(outFolder, "jstp.c"));
            Jstp.GenerateAndSave(model, vfs, Encoding.UTF8.GetString(CCodeResource.jstp_h), Path.Combine(outFolder, "jstp.h"));
        }
示例#5
0
 private static void GenerateHelp(JstpModel model, string outFolder)
 {
     Jstp.GenerateAndSave(model, null, Encoding.UTF8.GetString(HelpResource.help_html), Path.Combine(outFolder, "help.html"));
 }
示例#6
0
 protected override void InternalRun(JstpModel model, string outFolder)
 {
     GenerateHelp(model, outFolder);
 }
示例#7
0
 protected abstract void InternalRun(JstpModel model, string outFolder);