Exemple #1
0
 private static void WriteDeclaration(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
 {
     // extern MANGLED_TYPENAME MANGLED_CONSTANT_NAME;
     if (C.Comment.Length > 0)
     {
         SB.AppendLine("/** " + C.Comment + " */");
     }
     SB.Append("extern ");
     SB.Append(FT.GetMangledName(S, C.Type.GetName()));
     SB.Append(" ");
     SB.Append(FT.GetMangledName(S, C.Name));
     SB.AppendLine(";");
 }
Exemple #2
0
        private static void WriteDefinition(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
        {
            // assume only SMV constants for now
            G25.SMV     smv  = C.Type as G25.SMV;
            ConstantSMV Csmv = C as ConstantSMV;

            string className = FT.GetMangledName(S, smv.Name);

            // MANGLED_TYPENAME MANGLED_CONSTANT_NAME = {...}
            SB.Append(className);
            SB.Append(" ");
            SB.Append(FT.GetMangledName(S, C.Name));

            if (smv.NbNonConstBasisBlade > 0)
            {
                // MANGLED_TYPENAME MANGLED_CONSTANT_NAME(...)
                SB.Append("(" + className + "::" + G25.CG.Shared.SmvUtil.GetCoordinateOrderConstant(S, smv));

                for (int c = 0; c < smv.NbNonConstBasisBlade; c++)
                {
                    SB.Append(", ");
                    SB.Append(FT.DoubleToString(S, Csmv.Value[c]));
                }

                SB.Append(")");
            }

            SB.AppendLine(";");
        }
Exemple #3
0
        private static void WriteDefinition(StringBuilder SB, Specification S, G25.CG.Shared.CGdata cgd, FloatType FT, G25.Constant C)
        {
            // assume only SMV constants for now
            G25.SMV     smv  = C.Type as G25.SMV;
            ConstantSMV Csmv = C as ConstantSMV;

            // MANGLED_TYPENAME MANGLED_CONSTANT_NAME = {...}
            SB.Append(FT.GetMangledName(S, C.Type.GetName()));
            SB.Append(" ");
            SB.Append(FT.GetMangledName(S, C.Name));
            SB.Append(" = {");

            if (smv.NbNonConstBasisBlade == 0)
            {
                // 'C' does not allow empty structs, so there is a filler that must be initialized
                SB.Append("0");
            }
            else
            {
                if (S.m_coordStorage == COORD_STORAGE.ARRAY)
                {
                    SB.Append("{");
                }

                for (int c = 0; c < smv.NbNonConstBasisBlade; c++)
                {
                    if (c > 0)
                    {
                        SB.Append(", ");
                    }
                    SB.Append(FT.DoubleToString(S, Csmv.Value[c]));
                }

                if (S.m_coordStorage == COORD_STORAGE.ARRAY)
                {
                    SB.Append("}");
                }
            }


            SB.AppendLine("};");
        }