示例#1
0
 public static string GetRawTestSuiteFilename(Specification S)
 {
     return(MainGenerator.GetClassOutputPath(S, "TestSuite"));
 }
示例#2
0
 public static string GetRawSourceFilename(Specification S, FloatType FT)
 {
     return(MainGenerator.GetClassOutputPath(S, GetMvInterfaceName(S, FT)));
 }
示例#3
0
        /// <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);

            // using ...
            Util.WriteGenericUsing(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);
        }
示例#4
0
        /// <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);

            // using ...
            Util.WriteGenericUsing(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);

            // 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);
        }
示例#5
0
 public static string GetRawSourceFilename(Specification S)
 {
     return(MainGenerator.GetClassOutputPath(S, S.m_namespace));
 }
示例#6
0
        /// <summary>
        /// Generates a source file with the SOM class definition.
        /// </summary>
        /// <param name="S"></param>
        /// <param name="cgd"></param>
        /// <param name="som"></param>
        /// <param name="FT"></param>
        /// <returns></returns>
        public static string GenerateCode(Specification S, G25.CG.Shared.CGdata cgd, G25.SOM som, FloatType FT)
        {
            string className = FT.GetMangledName(S, som.Name);

            // get range vector type
            G25.SMV rangeVectorType    = G25.CG.Shared.OMinit.GetRangeVectorType(S, FT, cgd, som);
            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.SOM.WriteComment(SB, S, cgd, FT, som);

            // open class
            G25.CG.Shared.Util.WriteOpenClass(SB, S, G25.CG.Shared.AccessModifier.AM_public, className, null, null);

            // write member variables
            G25.CG.CSJ.SOM.WriteMemberVariables(SB, S, cgd, FT, som);

            // write constructors
            G25.CG.CSJ.SOM.WriteConstructors(SB, S, cgd, FT, som, rangeVectorSMVname);

            // write set functions
            G25.CG.Shared.OMinit.WriteSetIdentity(S, cgd, FT, som);
            G25.CG.Shared.OMinit.WriteSetCopy(S, cgd, FT, som);
            G25.CG.Shared.OMinit.WriteSetVectorImages(S, cgd, FT, som);
            G25.CG.Shared.OMinit.WriteSetMatrix(S, cgd, FT, som, false); // false = !transpose
            G25.CG.Shared.OMinit.WriteSetMatrix(S, cgd, FT, som, true);  // true = transpose
            G25.CG.CSJ.SOM.WriteGOMtoSOMcopy(S, cgd, FT, som);

            // write shortcuts for functions
            G25.CG.Shared.Shortcut.WriteFunctionShortcuts(SB, S, cgd, FT, som);

            // 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);
        }
示例#7
0
 public static string GetRawSourceFilename(Specification S)
 {
     return(MainGenerator.GetClassOutputPath(S, "ReportUsage"));
 }
示例#8
0
 public static string GetRawParseExceptionSourceFilename(Specification S)
 {
     return(MainGenerator.GetClassOutputPath(S, "ParseException"));
 }