public static string GetRawSourceFilename(Specification S) { return(MainGenerator.GetClassOutputPath(S, "SmvType")); }
public static string GetRawTestSuiteFilename(Specification S) { return(MainGenerator.GetClassOutputPath(S, "TestSuite")); }
/// <summary> /// Generates a source file with the GOM class definition. /// </summary> /// <param name="S"></param> /// <param name="cgd"></param> /// <param name="FT"></param> /// <returns></returns> public static string GenerateCode(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT) { G25.GOM gom = S.m_GOM; string className = FT.GetMangledName(S, gom.Name); // get range vector type G25.SMV rangeVectorType = G25.CG.Shared.OMinit.GetRangeVectorType(S, FT, cgd, gom); string rangeVectorSMVname = FT.GetMangledName(S, rangeVectorType.Name); // get filename, list of generated filenames List <string> generatedFiles = new List <string>(); string sourceFilename = MainGenerator.GetClassOutputPath(S, className); generatedFiles.Add(sourceFilename); // get StringBuilder where all generated code goes StringBuilder SB = new StringBuilder(); // get a new 'cgd' where all ouput goes to the one StringBuilder SB cgd = new G25.CG.Shared.CGdata(cgd, SB, SB, SB); // output license, copyright G25.CG.Shared.Util.WriteCopyright(SB, S); G25.CG.Shared.Util.WriteLicense(SB, S); // open namespace G25.CG.Shared.Util.WriteOpenNamespace(SB, S); // write class comment G25.CG.CSJ.GOM.WriteComment(SB, S, cgd, FT, gom); // open class G25.CG.Shared.Util.WriteOpenClass(SB, S, G25.CG.Shared.AccessModifier.AM_public, className, null, null); // write member variables G25.CG.CSJ.GOM.WriteMemberVariables(SB, S, cgd, FT, gom); // write constructors G25.CG.CSJ.GOM.WriteConstructors(SB, S, cgd, FT, gom, className, rangeVectorSMVname); // write set functions G25.CG.CSJ.GOM.WriteSetIdentity(SB, S, cgd, FT); G25.CG.CSJ.GOM.WriteSetCopy(SB, S, cgd, FT); G25.CG.CSJ.GOM.WriteSetVectorImages(S, cgd, FT, false, false); // false, false = matrixMode, transpose G25.CG.CSJ.GOM.WriteSetVectorImages(S, cgd, FT, true, false); // true, false = matrixMode, transpose G25.CG.CSJ.GOM.WriteSOMtoGOMcopy(S, cgd, FT); // write shortcuts for functions G25.CG.Shared.Shortcut.WriteFunctionShortcuts(SB, S, cgd, FT, gom); // close class G25.CG.Shared.Util.WriteCloseClass(SB, S, className); // close namespace G25.CG.Shared.Util.WriteCloseNamespace(SB, S); // write all to file G25.CG.Shared.Util.WriteFile(sourceFilename, SB.ToString()); return(sourceFilename); }
/// <summary> /// Generates a source file with the GMV class definition. /// </summary> /// <param name="S"></param> /// <param name="cgd"></param> /// <param name="FT"></param> /// <returns></returns> public static string GenerateCode(Specification S, G25.CG.Shared.CGdata cgd, FloatType FT) { G25.GMV gmv = S.m_GMV; string className = FT.GetMangledName(S, gmv.Name); // get filename, list of generated filenames List <string> generatedFiles = new List <string>(); string sourceFilename = MainGenerator.GetClassOutputPath(S, className); generatedFiles.Add(sourceFilename); // get StringBuilder where all generated code goes StringBuilder SB = new StringBuilder(); // get a new 'cgd' where all ouput goes to the one StringBuilder SB cgd = new G25.CG.Shared.CGdata(cgd, SB, SB, SB); // output license, copyright G25.CG.Shared.Util.WriteCopyright(SB, S); G25.CG.Shared.Util.WriteLicense(SB, S); // open namespace G25.CG.Shared.Util.WriteOpenNamespace(SB, S); // write class comment G25.CG.CSJ.GMV.WriteComment(SB, S, cgd, FT, gmv); // open class string[] implements = new string[] { MvInterface.GetMvInterfaceName(S, FT) }; G25.CG.Shared.Util.WriteOpenClass(SB, S, G25.CG.Shared.AccessModifier.AM_public, className, null, implements); // write member vars WriteMemberVariables(SB, S, cgd, FT, gmv); // write constructors WriteConstructors(SB, S, cgd, FT, gmv, className); WriteGetGuC(SB, S, cgd, FT); // write 'set' functions G25.CG.CSJ.GMV.WriteSetZero(SB, S, cgd, FT); G25.CG.CSJ.GMV.WriteSetScalar(SB, S, cgd, FT); G25.CG.CSJ.GMV.WriteSetCompressedArray(SB, S, cgd, FT); G25.CG.CSJ.GMV.WriteSetExpandedArray(SB, S, cgd, FT); G25.CG.CSJ.GMV.WriteGMVtoGMVcopy(SB, S, cgd, FT); G25.CG.CSJ.GMV.WriteSMVtoGMVcopy(SB, S, cgd, FT); // write 'get coordinate' functions G25.CG.CSJ.GMV.WriteGetCoord(SB, S, cgd, FT); // write SetGroupUsage() G25.CG.CSJ.GMV.WriteSetGroupUsage(SB, S, cgd, FT); // write 'reserve group' functions G25.CG.CSJ.GMV.WriteReserveGroup(SB, S, cgd, FT); // write 'set coordinate' functions G25.CG.CSJ.GMV.WriteSetCoord(SB, S, cgd, FT); // write 'largest coordinate' functions G25.CG.CSJ.GMV.WriteLargestCoordinates(SB, S, cgd, FT); // write compress functions G25.CG.CSJ.GMV.WriteCompress(SB, S, cgd, FT); // write 'toString' functions G25.CG.CSJ.GMV.WriteToString(SB, S, cgd, FT, gmv); // write multivector interface implementation G25.CG.CSJ.GMV.WriteMultivectorInterface(SB, S, cgd, FT); // write shortcuts for functions G25.CG.Shared.Shortcut.WriteFunctionShortcuts(SB, S, cgd, FT, gmv); // close class G25.CG.Shared.Util.WriteCloseClass(SB, S, className); // close namespace G25.CG.Shared.Util.WriteCloseNamespace(SB, S); // write all to file G25.CG.Shared.Util.WriteFile(sourceFilename, SB.ToString()); return(sourceFilename); }
public static string GetRawSourceFilename(Specification S, FloatType FT) { return(MainGenerator.GetClassOutputPath(S, GetMvInterfaceName(S, FT))); }
public static string GetRawSourceFilename(Specification S) { return(MainGenerator.GetClassOutputPath(S, S.m_namespace)); }
public static string GetRawANTLRgrammarFilename(Specification S) { return(MainGenerator.GetClassOutputPath(S, S.m_namespace, "g")); }
public static string GetRawParseExceptionSourceFilename(Specification S) { return(MainGenerator.GetClassOutputPath(S, "ParseException")); }
/// <summary> /// Generates a source file with the SMV class definition. /// </summary> /// <param name="S"></param> /// <param name="cgd"></param> /// <param name="smv"></param> /// <param name="FT"></param> /// <returns></returns> public static string GenerateCode(Specification S, G25.CG.Shared.CGdata cgd, G25.SMV smv, FloatType FT) { string className = FT.GetMangledName(S, smv.Name); // get filename, list of generated filenames List <string> generatedFiles = new List <string>(); string sourceFilename = MainGenerator.GetClassOutputPath(S, className); generatedFiles.Add(sourceFilename); // get StringBuilder where all generated code goes StringBuilder SB = new StringBuilder(); // get a new 'cgd' where all ouput goes to the one StringBuilder SB cgd = new G25.CG.Shared.CGdata(cgd, SB, SB, SB); // output license, copyright G25.CG.Shared.Util.WriteCopyright(SB, S); G25.CG.Shared.Util.WriteLicense(SB, S); // open namespace G25.CG.Shared.Util.WriteOpenNamespace(SB, S); // write class comment G25.CG.CSJ.SMV.WriteComment(SB, S, cgd, FT, smv); // open class string[] implements = new string[] { MvInterface.GetMvInterfaceName(S, FT) }; G25.CG.Shared.Util.WriteOpenClass(SB, S, G25.CG.Shared.AccessModifier.AM_public, className, null, implements); // member variables G25.CG.CSJ.SMV.WriteMemberVariables(SB, S, cgd, FT, smv); // indices into arrays G25.CG.CSJ.SMV.WriteSMVcoordIndices(SB, S, FT, smv); // special type to safeguard coordinates order in functions G25.CG.CSJ.SMV.WriteCoordinateOrder(SB, S, FT, smv); // get coordinates //G25.CG.CSJ.SMV.WriteGetCoordinates(SB, S, cgd, FT, smv); // write multivector interface implementation G25.CG.CSJ.SMV.WriteMultivectorInterface(SB, S, cgd, FT, smv); // write constructors G25.CG.CSJ.SMV.WriteConstructors(SB, S, cgd, FT, smv); // write set functions G25.CG.CSJ.SMV.WriteSetFunctions(SB, S, cgd, FT, smv); // write largest coordinate functions G25.CG.CSJ.SMV.WriteLargestCoordinateFunctions(S, cgd, FT, smv); // write 'toString' functions G25.CG.CSJ.GMV.WriteToString(SB, S, cgd, FT, smv); // write get/set coords G25.CG.CSJ.SMV.WriteGetSetCoord(SB, S, cgd, FT, smv); // write shortcuts for functions G25.CG.Shared.Shortcut.WriteFunctionShortcuts(SB, S, cgd, FT, smv); // close class G25.CG.Shared.Util.WriteCloseClass(SB, S, className); // close namespace G25.CG.Shared.Util.WriteCloseNamespace(SB, S); // write all to file G25.CG.Shared.Util.WriteFile(sourceFilename, SB.ToString()); return(sourceFilename); }