Esempio n. 1
0
File: LpObject.cs Progetto: baban/lp
        protected static LpObject to_s(LpObject self, LpObject[] args = null, LpObject block = null)
        {
            var hashCode = self.GetHashCode();
            var str      = string.Format("<obj {0}>", hashCode.ToString("x4"));

            return(LpString.initialize(str));
        }
Esempio n. 2
0
File: LpArray.cs Progetto: baban/lp
        static LpObject inspect(LpObject self, LpObject[] args, LpObject block = null)
        {
            var vs = self.arrayValues.Select <LpObject, string>((a, b) => a.funcall("inspect", null).stringValue.ToString()).ToArray();
            var s  = string.Join(", ", vs);

            return(LpString.initialize("[" + s + "]"));
        }
Esempio n. 3
0
        LpObject convertReturnValue(object result)
        {
            if (null == result)
            {
                return(LpNl.initialize());
            }

            var t = result.GetType();

            switch (t.ToString())
            {
            case "System.UInt16":
            case "System.UInt32":
            case "System.UInt64":
            case "System.Int16":
            case "System.Int32":
            case "System.Int64":
                return(LpNumeric.initialize((int)result));

            case "System.Double":
                return(LpNumeric.initialize((double)result));

            case "System.String":
            case "System.Symbol":
                return(LpString.initialize((string)result));

            default:
                return(LpNl.initialize());
            }
        }
Esempio n. 4
0
File: LpObject.cs Progetto: baban/lp
        protected static LpObject methods_(LpObject self, LpObject[] args, LpObject block = null)
        {
            var keys = new List <string>();

            foreach (string k in self.methods.Keys)
            {
                keys.Add(k);
            }
            return(LpArray.initialize(keys.ToArray().Select((s) => LpString.initialize(s)).ToArray()));
        }
Esempio n. 5
0
File: LpHash.cs Progetto: baban/lp
        static LpObject to_s(LpObject self, LpObject[] args, LpObject block = null)
        {
            string pairs = "";

            if (self.hashValues.Count() > 0)
            {
                string s = self.hashValues.ToArray()
                           .Select((pair) => {
                    return(pair.Key.funcall("to_s", new LpObject[] { }, null).stringValue + " => " + pair.Value.funcall("to_s", new LpObject[] { }, null).stringValue);
                })
                           .Aggregate((a, b) => a + ", " + b);
                pairs = s;
            }
            pairs = "{ " + pairs + " }";
            var ret = LpString.initialize(pairs);

            return(ret);
        }
Esempio n. 6
0
File: LpObject.cs Progetto: baban/lp
 protected static LpObject class_(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize(self.class_name));
 }
Esempio n. 7
0
 protected static LpObject inspect(LpObject self, LpObject[] args, LpObject block = null)
 {
     Debug.WriteLine(self.doubleValue.ToString());
     return(LpString.initialize(self.doubleValue.ToString()));
 }
Esempio n. 8
0
 protected static LpObject to_s(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize(self.doubleValue.ToString()));
 }
Esempio n. 9
0
 protected static LpObject inspect(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize(string.Format(":{0}", self.stringValue)));
 }
Esempio n. 10
0
File: LpClass.cs Progetto: baban/lp
        protected static LpObject to_s(LpObject self, LpObject[] args, LpObject block = null)
        {
            var str = string.Format("#<{0}:{1:x8}>", className, self.GetHashCode());

            return(LpString.initialize(str));
        }
Esempio n. 11
0
 protected static LpObject inspect(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize("nl"));
 }
Esempio n. 12
0
 protected static LpObject to_s(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize(""));
 }
Esempio n. 13
0
File: LpMacro.cs Progetto: baban/lp
 private static LpObject inspect(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize(string.Format("Macro.new({0})", self.stringValue)));
 }
Esempio n. 14
0
File: LpBool.cs Progetto: baban/lp
 protected static LpObject to_s(LpObject self, LpObject[] args, LpObject block = null)
 {
     return(LpString.initialize(self.boolValue == true ? "true" : "false"));
 }