Esempio n. 1
0
        public override string TargetTypeName(TypePrimitive itemType)
        {
            if (itemType.IsBoolean())
            {
                return("bool");
            }

            if (itemType.IsInteger())
            {
                return("int");
            }

            if (itemType.IsScalar())
            {
                return(CodeGenerator.ScalarTypeName);
            }

            return(@"/*<Unknown type>*/");
        }
Esempio n. 2
0
        //private static readonly Regex LlVarOnlyRegex = new Regex(@"^\b" + LlVarNamePrefix + @"[0-9A-F][0-9A-F][0-9A-F][0-9A-F]\b$", RegexOptions.ECMAScript);


        /// <summary>
        /// Low level processing requires the use of MathematicaScalar primitive values only. This method extracts
        /// the a primitive value of the given type as a MathematicaScalar primitive value.
        /// </summary>
        /// <param name="langType"></param>
        /// <returns></returns>
        public static ValuePrimitive <MathematicaScalar> GetDefaultScalarValue(this TypePrimitive langType)
        {
            MathematicaScalar scalar;

            if (langType.IsNumber())
            {
                scalar = MathematicaScalar.Create(SymbolicUtils.Cas, 0);
            }

            else if (langType.IsBoolean())
            {
                scalar = MathematicaScalar.Create(SymbolicUtils.Cas, "False");
            }

            else
            {
                throw new InvalidOperationException();
            }

            return(ValuePrimitive <MathematicaScalar> .Create(langType, scalar));
        }