static void Main(string[] args) { try { System.Collections.Hashtable HT = new System.Collections.Hashtable(); HT["Canon Eos 5D Mark II body"] = 2176; HT["Nikon D700 body"] = 1997; HT["Sony DSLR-A900 body"] = 2345; System.Console.WriteLine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)); CoG C = new CoG(); C.LoadTemplates( System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\..\\..\\..\\src\\sample_template.txt"); C.EmitTemplate("sample_template", "HT=", HT); C.EmitTemplate("sample_template", "HT=", HT); System.Console.Write(C.GetOutputAndClear()); } catch (Exception E) { System.Console.WriteLine("Exception: " + E.ToString()); } return; }
public static void GenerateSpecFromVar(CoG cog, string templateName, string specName, string specFilename, SpecVars SV) { // write template to StringBuilder StringBuilder SB = new StringBuilder(); cog.EmitTemplate(SB, templateName, "SV=", SV); // write template to file G25.CG.Shared.Util.WriteFile(specFilename, SB.ToString()); }
public static void GenerateMakefileFromVar(CoG cog, string templateName, string specName, string makefileFilename, string algebraName, SpecVars SV) { // write template to StringBuilder StringBuilder SB = new StringBuilder(); cog.EmitTemplate(SB, templateName, "SV=", SV, "SPEC_NAME=", specName, "ALGEBRA_NAME=", algebraName, "WINDOWS=", IsWindows(), "MACOSX=", GetPlatformID() == PlatformID.MacOSX, "LINUX=", GetPlatformID() == PlatformID.Unix ); // write template to file G25.CG.Shared.Util.WriteFile(makefileFilename, SB.ToString()); }
public static void GenerateMyDoubleFromVar(CoG cog, string filename, SpecVars SV) { // get name of template string templateName = "not_set"; if (SV.OutputLanguage == "cpp") { templateName = "myDouble_cpp_header"; } // write template to StringBuilder StringBuilder SB = new StringBuilder(); cog.EmitTemplate(SB, templateName); // write template to file G25.CG.Shared.Util.WriteFile(filename, SB.ToString()); }