Esempio n. 1
0
        internal object s_new(RBasic r, params object[] o)
        {
            RModule mod = new RModule(ruby, null, (RMetaObject)r);

            ruby.CallInit(r, o);
            return(mod);
        }
Esempio n. 2
0
 internal RModule(RModule o) :
     base(o)
 {
 }
Esempio n. 3
0
 internal object s_new(RBasic r, params object[] o)
 {
     RModule mod = new RModule(ruby, null, (RMetaObject)r);
     ruby.CallInit(r, o);
     return mod;
 }
Esempio n. 4
0
 internal RModule(RModule o) :
     base(o)
 {
 }
Esempio n. 5
0
/*        
        internal object[] CallArgs(RNode nd, object self)
        {
            RThread th = GetCurrentContext();
            Block tempBlock = th.block;
            if ((ITER)th.iter.Peek() == ITER.PRE)
            {
                th.block = th.block.prev;
            }
            th.iter.Push(ITER.NOT);
            object[] ret = nd.SetupArgs(this, self, nd.args);
            th.block = tempBlock;
            th.iter.Pop();
            return ret;
        }
        internal object[] CallArgs(RNCall nd, object self, out object receiver)
        {
            RThread th = GetCurrentContext();
            Block tempBlock = th.block;
            if ((ITER)th.iter.Peek() == ITER.PRE)
            {
                th.block = th.block.prev;
            }
            th.iter.Push(ITER.NOT);
            object[] ret = nd.SetupArgs(this, self, out receiver);
            th.block = tempBlock;
            th.iter.Pop();
            return ret;
        }
        internal object CallIter(RNode nd, object self)
        {
            RThread th = GetCurrentContext();
            Block tempBlock = th.block;
            if ((ITER)th.iter.Peek() == ITER.PRE)
            {
                th.block = th.block.prev;
            }
            th.iter.Push(ITER.NOT);
            object ret = Eval(self, nd.iter);
            th.block = tempBlock;
            th.iter.Pop();
            return ret;
        }
*/        
        //
        private void InitEnvironment(RThread th)
        {
            ////Scope.ScopeMode oldvmode = th.PushScope();
            ////th.PushTag(Tag.TAG.PROT_NONE);
            /*
            try
            {
            */
                missing = intern("method_missing");
                idEq = intern("==");
                idEql = intern("eql?");

                cObject = new RClass(this, "Object", null);
                class_tbl[intern("Object")] = cObject;
                cModule = new RModule(this, "Module", cObject);
                cClass = new RClass(this, "Class", cModule);
                class_tbl[intern("Class")] = cClass;
                cObject.klass = new RSingletonClass(cClass);
                cObject.klass.AttachSingleton(cObject);
                cModule.klass = new RSingletonClass(cObject.klass);
                cModule.klass.AttachSingleton(cModule);
                cClass.klass = new RSingletonClass(cModule.klass);
                cClass.klass.AttachSingleton(cClass);
                mKernel = new RKernel(this, "Kernel");
                RMetaObject.IncludeModule(cObject, mKernel);
                mKernel.Init(this);
                REnumerable.Init(this);
                evalInit();
                RString.Init(this);
                RException.Init(this);
                RThreadClass.Init(this);
                RThreadGroupClass.Init(this);
                RNumeric.Init(this);
                RInteger.Init(this);
                RFixnum.Init(this);
                RFloat.Init(this);
                RBignum.Init(this);
                RArray.Init(this);
                RHashClass.Init(this);
                RRegexpClass.Init(this);
                RIOClass.Init(this);
                RProcClass.Init(this);
                RTimeClass.Init(this);
                loader = Loader.Init(this);
                ////RDotNetClass.Init(this);

                versionInit();
        
                threadMain.Init(this);

                th.rClass = cObject;
                /*
                topCRef = new RNCRef(cObject);
                th.cRef = topCRef;
                th.frame.self = topSelf;
                th.frame.cBase = topCRef;
                */

                progInit();
            /*
            }
            catch (eTagJump)
            {
                       errorPrint(th);
            }
            */
            /*
            catch (Exception e)
            {
                errorPrint(th, e);
            }
            */
            ////th.PopTag(true);
            ////th.PopScope(oldvmode);
        }
Esempio n. 6
0
 //
 public RModule DefineModule(string name)
 {
     uint id = intern(name);
     if (cObject.IsConstDefined(id))
     {
         object o = cObject.ConstGet(id);
         if (o is RModule) return (RModule)o;
         throw new eTypeError(name + " is not a module");
     }
     RModule module = new RModule(this, name);
     return module;
 }