public string GetStringValue(StackValue val, Heap heap, int langblock, int maxArraySize, int maxOutputDepth, bool forPrint = false)
        {
            if (formatParams == null)
                formatParams = new OutputFormatParameters(maxArraySize, maxOutputDepth);

            switch (val.optype)
            {
                case AddressType.Int:
                    return val.opdata.ToString();
                case AddressType.Double:
                    return val.opdata_d.ToString(core.Options.FormatToPrintFloatingPoints);
                case AddressType.Null:
                    return "null";
                case AddressType.Pointer:
                    return GetClassTrace(val, heap, langblock, forPrint);
                case AddressType.ArrayPointer:
                    HashSet<int> pointers = new HashSet<int>{(int)val.opdata};
                    string arrTrace = GetArrayTrace((int)val.opdata, heap, langblock, pointers, forPrint);
                    if (forPrint)
                        return "{" + arrTrace + "}";
                    else
                        return "{ " + arrTrace + " }";
                case AddressType.FunctionPointer:
                    return "fptr: " + val.opdata.ToString();
                case AddressType.Boolean:
                    return (val.opdata == 0) ? "false" : "true";
                case AddressType.String:
                    if (forPrint)
                        return GetStringTrace((int)val.opdata, heap);
                    else
                        return "\"" + GetStringTrace((int)val.opdata, heap) + "\"";
                case AddressType.Char:
                    Char character = ProtoCore.Utils.EncodingUtils.ConvertInt64ToCharacter(val.opdata);
                    if (forPrint)
                        return character.ToString();
                    else
                        return "'" + character + "'";
                default:
                    return "null"; // "Value not yet supported for tracing";
            }
        }
        public string PrintClass(StackValue val, Heap heap, int langblock, int maxArraySize, int maxOutputDepth, bool forPrint)
        {
            if (null == formatParams)
                formatParams = new OutputFormatParameters(maxArraySize, maxOutputDepth);

            return GetClassTrace(val, heap, langblock, forPrint);
        }
 public string GetCoreDump()
 {
     formatParams = new OutputFormatParameters();
     return GetGlobalVarTrace(null);
 }
 public void GetCoreDump(out List<string> variableTraces, int maxArraySize, int maxOutputDepth)
 {
     variableTraces = new List<string>();
     formatParams = new OutputFormatParameters(maxArraySize, maxOutputDepth);
     GetGlobalVarTrace(variableTraces);
 }
Exemple #5
0
 public void GetCoreDump(out List <string> variableTraces, int maxArraySize, int maxOutputDepth)
 {
     variableTraces = new List <string>();
     formatParams   = new OutputFormatParameters(maxArraySize, maxOutputDepth);
     GetGlobalVarTrace(variableTraces);
 }
Exemple #6
0
 public string GetCoreDump()
 {
     formatParams = new OutputFormatParameters();
     return(GetGlobalVarTrace(null));
 }
Exemple #7
0
        public string GetStringValue(StackValue val, Heap heap, int langblock, int maxArraySize, int maxOutputDepth, bool forPrint = false)
        {
            if (formatParams == null)
            {
                formatParams = new OutputFormatParameters(maxArraySize, maxOutputDepth);
            }

            if (val.IsInteger)
            {
                return(val.IntegerValue.ToString());
            }
            else if (val.IsDouble)
            {
                return(val.DoubleValue.ToString("F6"));
            }
            else if (val.IsNull)
            {
                return("null");
            }
            else if (val.IsPointer)
            {
                return(GetClassTrace(val, heap, langblock, forPrint));
            }
            else if (val.IsArray)
            {
                HashSet <int> pointers = new HashSet <int> {
                    val.ArrayPointer
                };
                string arrTrace = GetArrayTrace(val, heap, langblock, pointers, forPrint);
                if (forPrint)
                {
                    return("{" + arrTrace + "}");
                }
                else
                {
                    return("{ " + arrTrace + " }");
                }
            }
            else if (val.IsFunctionPointer)
            {
                ProcedureNode procNode;
                if (runtimeCore.DSExecutable.FuncPointerTable.TryGetFunction(val, runtimeCore, out procNode))
                {
                    string className = String.Empty;
                    if (procNode.ClassID != Constants.kGlobalScope)
                    {
                        className = runtimeCore.DSExecutable.classTable.GetTypeName(procNode.ClassID).Split('.').Last() + ".";
                    }

                    return("function: " + className + procNode.Name);
                }
                return("function: " + val.FunctionPointer.ToString());
            }
            else if (val.IsBoolean)
            {
                return(val.BooleanValue ? "true" : "false");
            }
            else if (val.IsString)
            {
                if (forPrint)
                {
                    return(heap.ToHeapObject <DSString>(val).Value);
                }
                else
                {
                    return("\"" + heap.ToHeapObject <DSString>(val).Value + "\"");
                }
            }
            else if (val.IsChar)
            {
                Char character = Convert.ToChar(val.CharValue);
                if (forPrint)
                {
                    return(character.ToString());
                }
                else
                {
                    return("'" + character + "'");
                }
            }
            else
            {
                return("null"); // "Value not yet supported for tracing";
            }
        }
Exemple #8
0
        public string GetStringValue(StackValue val, Heap heap, int langblock, int maxArraySize, int maxOutputDepth, bool forPrint = false)
        {
            if (formatParams == null)
                formatParams = new OutputFormatParameters(maxArraySize, maxOutputDepth);

            if (val.IsInteger)
            {
                return val.IntegerValue.ToString();
            }
            else if (val.IsDouble)
            {
                return val.DoubleValue.ToString("F6");
            }
            else if (val.IsNull)
            {
                return "null";
            }
            else if (val.IsPointer)
            {
                return GetClassTrace(val, heap, langblock, forPrint);
            }
            else if (val.IsArray)
            {
                HashSet<int> pointers = new HashSet<int> { val.ArrayPointer };
                string arrTrace = GetArrayTrace(val, heap, langblock, pointers, forPrint);
                if (forPrint)
                    return "{" + arrTrace + "}";
                else
                    return "{ " + arrTrace + " }";
            }
            else if (val.IsFunctionPointer)
            {
                ProcedureNode procNode;
                if (runtimeCore.DSExecutable.FuncPointerTable.TryGetFunction(val, runtimeCore, out procNode))
                {
                    string className = String.Empty;
                    if (procNode.ClassID != Constants.kGlobalScope)
                    {
                        className = runtimeCore.DSExecutable.classTable.GetTypeName(procNode.ClassID).Split('.').Last() + ".";
                    }

                    return "function: " + className + procNode.Name;
                }
                return "function: " + val.FunctionPointer.ToString();
            }
            else if (val.IsBoolean)
            {
                return val.BooleanValue ? "true" : "false";
            }
            else if (val.IsString)
            {
                if (forPrint)
                    return heap.ToHeapObject<DSString>(val).Value;
                else
                    return "\"" + heap.ToHeapObject<DSString>(val).Value + "\"";
            }
            else if (val.IsChar)
            {
                Char character = Convert.ToChar(val.CharValue);
                if (forPrint)
                    return character.ToString();
                else
                    return "'" + character + "'";
            }
            else
            {
                return "null"; // "Value not yet supported for tracing";
            }
        }
Exemple #9
0
        public string GetStringValue(StackValue val, Heap heap, int langblock, int maxArraySize, int maxOutputDepth, bool forPrint = false)
        {
            if (formatParams == null)
                formatParams = new OutputFormatParameters(maxArraySize, maxOutputDepth);

            switch (val.optype)
            {
                case AddressType.Int:
                    return val.opdata.ToString();
                case AddressType.Double:
                    return val.RawDoubleValue.ToString(runtimeCore.Options.FormatToPrintFloatingPoints);
                case AddressType.Null:
                    return "null";
                case AddressType.Pointer:
                    return GetClassTrace(val, heap, langblock, forPrint);
                case AddressType.ArrayPointer:
                    HashSet<int> pointers = new HashSet<int>{(int)val.opdata};
                    string arrTrace = GetArrayTrace(val, heap, langblock, pointers, forPrint);
                    if (forPrint)
                        return "{" + arrTrace + "}";
                    else
                        return "{ " + arrTrace + " }";
                case AddressType.FunctionPointer:
                    ProcedureNode procNode;
                    if (runtimeCore.DSExecutable.FuncPointerTable.TryGetFunction(val, runtimeCore, out procNode))
                    {
                        string className = String.Empty;
                        if (procNode.classScope != Constants.kGlobalScope)
                        {
                            className = runtimeCore.DSExecutable.classTable.GetTypeName(procNode.classScope).Split('.').Last() + ".";
                        }

                        return "function: " + className + procNode.name; 
                    }
                    return "function: " + val.opdata.ToString();

                case AddressType.Boolean:
                    return (val.opdata == 0) ? "false" : "true";
                case AddressType.String:
                    if (forPrint)
                        return heap.ToHeapObject<DSString>(val).Value;
                    else
                        return "\"" + heap.ToHeapObject<DSString>(val).Value + "\"";                    
                case AddressType.Char:
                    Char character = ProtoCore.Utils.EncodingUtils.ConvertInt64ToCharacter(val.opdata);
                    if (forPrint)
                        return character.ToString();
                    else
                        return "'" + character + "'";
                default:
                    return "null"; // "Value not yet supported for tracing";
            }
        }