예제 #1
0
 object f_load(RBasic r, params object[] args)
 {
     object[] argv = new object[2];
     ruby.ScanArgs(args, "11", argv);
     ruby.Load(argv[0], RBasic.RTest(argv[1]));
     return(true);
 }
예제 #2
0
        public virtual bool RespondTo(object[] argv)
        {
            object[] args = new object[2];
            ruby.ScanArgs(argv, "11", args);
            uint id = ruby.ToID(args[0]);

            return(RespondTo(id, !RTest(args[1])));
        }
예제 #3
0
        static internal object match_aref(RBasic r, params object[] args)
        {
            object[] argv = new object[2];
            NetRuby  rb   = r.ruby;

            rb.ScanArgs(args, "11", argv);
            if (argv[1] != null)
            {
                return(((RMatchData)r).ToArray().ARef(args));
            }
            return(((RMatchData)r)[RInteger.ToInt(rb, args[0])]);
        }
예제 #4
0
파일: Time.cs 프로젝트: retahc/old-code
        static internal object s_at(RBasic r, params object[] args)
        {
            NetRuby rb = r.ruby;

            object[] argv   = new object[2];
            long     tmv    = 0;
            long     usec   = 0;
            RTime    result = null;
            int      cnt    = rb.ScanArgs(args, "11", argv);

            if (argv[0] is RTime)
            {
                DateTime tm = ((RTime)argv[0]).ToDateTime();
                if (cnt == 2)
                {
                    usec   = RInteger.ToLong(rb, argv[1]);
                    usec  *= 10;
                    result = new RTime(rb, tm.ToFileTime() + usec);
                }
                else
                {
                    result = new RTime(rb, tm);
                }
                result.CopyFormat((RTime)argv[0]);
            }
            else
            {
                if (cnt == 2)
                {
                    tmv   = RInteger.ToLong(rb, argv[0]);
                    usec  = RInteger.ToLong(rb, argv[1]);
                    usec *= 10;
                }
                else
                {
                    tmv = RInteger.ToLong(rb, argv[0]);
                }
                // Adjust Unix Epoch to .NET
                tmv   *= 1000;  // mill second
                tmv   *= 10000; // 100-nanosecond
                tmv   += epoch;
                tmv   += usec;
                result = new RTime(rb, tmv);
            }
            return(result);
        }