Esempio n. 1
0
 SquirrelDebugValue[] BuildObjectTable(XmlNodeList xobjs)
 {
     SquirrelDebugValue[] table = new SquirrelDebugValue[xobjs.Count];
     for (int i = 0; i < xobjs.Count; i++)
     {
         table[i] = new SquirrelDebugValue();
     }
     foreach (XmlElement e in xobjs)
     {
         int                idx     = Convert.ToInt32(e.GetAttribute("ref"));
         String             _typeof = e.GetAttribute("typeof");
         String             type    = e.GetAttribute("type");
         SquirrelDebugValue val     = table[idx];
         val.Value = "{" + UnpackType(type) + "}";
         val.Type  = _typeof != null && _typeof != "" ? "{" + _typeof + "}" : UnpackType(type);
         foreach (XmlNode n in e.ChildNodes)
         {
             if (n.Name == "e")
             {
                 XmlElement         c     = (XmlElement)n;
                 String             ktype = c.GetAttribute("kt");
                 String             kval  = c.GetAttribute("kv");
                 String             vtype = c.GetAttribute("vt");
                 String             vval  = c.GetAttribute("v");
                 SquirrelDebugValue theval;
                 if (vtype == "t" || vtype == "a" || vtype == "x" || vtype == "y")
                 {
                     theval = table[Convert.ToInt32(vval)];
                 }
                 else
                 {
                     theval = new SquirrelDebugValue(vval, UnpackType(vtype));
                 }
                 val.AddChild(new SquirrelDebugObject(kval, theval));
             }
         }
     }
     return(table);
 }
Esempio n. 2
0
 public SquirrelDebugObject(string name, SquirrelDebugValue val)
 {
     Name  = name;
     Value = val;
 }
Esempio n. 3
0
 public SquirrelDebugObject()
 {
     id    = 0;
     Name  = "??";
     Value = null;
 }
Esempio n. 4
0
        void BuildStackFrames(XmlNodeList xcalls, SquirrelDebugValue[] objstable, List <SquirrelStackFrame> frames)
        {
            int nframe = 0;

            foreach (XmlElement call in xcalls)
            {
                SquirrelStackFrame frame = new SquirrelStackFrame();
                frame.Address  = (ulong)nframe++;
                frame.Function = call.GetAttribute("fnc") + "()";
                frame.Source   = UnFixupPath(call.GetAttribute("src"));
                frame.Line     = Convert.ToInt32(call.GetAttribute("line"));
                if (frame.Source != "NATIVE")
                {
                    foreach (XmlNode n in call.ChildNodes)
                    {
                        if (n.Name == "w")
                        {
                            SquirrelDebugObject watch = new SquirrelDebugObject();
                            XmlElement          loc   = (XmlElement)n;
                            watch.id   = Convert.ToUInt32(loc.GetAttribute("id"));
                            watch.Name = loc.GetAttribute("exp");
                            String             status = loc.GetAttribute("status");
                            SquirrelDebugValue theval;
                            if (status == "ok")
                            {
                                //String _typeof = loc.GetAttribute("typeof");
                                String type = loc.GetAttribute("type");
                                String val  = loc.GetAttribute("val");


                                if (type == "t" || type == "a" || type == "x" || type == "y")
                                {
                                    theval = objstable[Convert.ToInt32(val)];
                                }
                                else
                                {
                                    theval = new SquirrelDebugValue(val, UnpackType(type));
                                }
                                watch.Value = theval;
                                frame.Watches.Add(watch.Name, watch);
                            }

                            /*else
                             * {
                             *  theval = new SquirrelDebugValue("<cannot evaluate>", "<cannot evaluate>");
                             * }*/
                        }
                        if (n.Name == "l")
                        {
                            SquirrelDebugObject lvar = new SquirrelDebugObject();
                            XmlElement          loc  = (XmlElement)n;
                            lvar.Name = loc.GetAttribute("name");
                            String             type = loc.GetAttribute("type");
                            String             val  = loc.GetAttribute("val");
                            SquirrelDebugValue theval;
                            if (type == "t" || type == "a" || type == "x" || type == "y")
                            {
                                theval = objstable[Convert.ToInt32(val)];
                            }
                            else
                            {
                                theval = new SquirrelDebugValue(val, UnpackType(type));
                            }
                            lvar.Value = theval;
                            frame.Locals.Add(lvar);
                        }
                    }
                }
                frames.Add(frame);
            }
        }