Пример #1
0
 def __init__(self, space):
     W_Object.__init__(self, space)
     self.contents = OrderedDict(space.eq_w, space.hash_w)
Пример #2
0
 def __init__(self, space, w_start, w_end, exclusive):
     W_Object.__init__(self, space)
     self.w_start = w_start
     self.w_end = w_end
     self.exclusive = exclusive
Пример #3
0
 def __init__(self, space, d):
     W_Object.__init__(self, space)
     self.iterator = d.iteritems()
Пример #4
0
 def __init__(self, space):
     W_Object.__init__(self, space)
     self.fd = -1
Пример #5
0
 def __init__(self, space, storage, strategy):
     W_Object.__init__(self, space)
     self.str_storage = storage
     self.strategy = strategy
Пример #6
0
    def __init__(self):
        self.cache = SpaceCache(self)
        self.symbol_cache = {}
        self._executioncontext = None
        self.globals = CellDict()
        self.bootstrap = True
        self.exit_handlers_w = []

        self.w_true = W_TrueObject(self)
        self.w_false = W_FalseObject(self)
        self.w_nil = W_NilObject(self)

        # Force the setup of a few key classes
        self.w_basicobject = self.getclassfor(W_BaseObject)
        self.w_object = self.getclassfor(W_Object)
        self.w_class = self.getclassfor(W_ClassObject)
        self.w_array = self.getclassfor(W_ArrayObject)
        self.w_proc = self.getclassfor(W_ProcObject)
        self.w_fixnum = self.getclassfor(W_FixnumObject)
        self.w_module = self.getclassfor(W_ModuleObject)
        self.w_string = self.getclassfor(W_StringObject)
        self.w_NoMethodError = self.getclassfor(W_NoMethodError)
        self.w_ArgumentError = self.getclassfor(W_ArgumentError)
        self.w_NameError = self.getclassfor(W_NameError)
        self.w_NotImplementedError = self.getclassfor(W_NotImplementedError)
        self.w_IndexError = self.getclassfor(W_IndexError)
        self.w_LoadError = self.getclassfor(W_LoadError)
        self.w_RangeError = self.getclassfor(W_RangeError)
        self.w_RuntimeError = self.getclassfor(W_RuntimeError)
        self.w_StopIteration = self.getclassfor(W_StopIteration)
        self.w_SyntaxError = self.getclassfor(W_SyntaxError)
        self.w_SystemCallError = self.getclassfor(W_SystemCallError)
        self.w_SystemExit = self.getclassfor(W_SystemExit)
        self.w_TypeError = self.getclassfor(W_TypeError)
        self.w_ZeroDivisionError = self.getclassfor(W_ZeroDivisionError)
        self.w_kernel = self.getmoduleobject(Kernel.moduledef)

        self.w_topaz = self.getmoduleobject(Topaz.moduledef)

        for w_cls in [
                self.w_basicobject,
                self.w_object,
                self.w_array,
                self.w_proc,
                self.w_fixnum,
                self.w_string,
                self.w_class,
                self.w_module,
                self.w_NoMethodError,
                self.w_ArgumentError,
                self.w_TypeError,
                self.w_ZeroDivisionError,
                self.w_SystemExit,
                self.w_RangeError,
                self.w_RuntimeError,
                self.w_SystemCallError,
                self.w_LoadError,
                self.w_StopIteration,
                self.w_SyntaxError,
                self.w_kernel,
                self.w_topaz,
                self.getclassfor(W_NilObject),
                self.getclassfor(W_TrueObject),
                self.getclassfor(W_FalseObject),
                self.getclassfor(W_SymbolObject),
                self.getclassfor(W_NumericObject),
                self.getclassfor(W_HashObject),
                self.getclassfor(W_RangeObject),
                self.getclassfor(W_IOObject),
                self.getclassfor(W_FileObject),
                self.getclassfor(W_Dir),
                self.getclassfor(W_EncodingObject),
                self.getclassfor(W_RandomObject),
                self.getclassfor(W_ThreadObject),
                self.getclassfor(W_TimeObject),
                self.getclassfor(W_ExceptionObject),
                self.getclassfor(W_StandardError),
                self.getmoduleobject(Comparable.moduledef),
                self.getmoduleobject(Enumerable.moduledef),
                self.getmoduleobject(Math.moduledef),
                self.getmoduleobject(Process.moduledef),
        ]:
            self.set_const(
                self.w_object,
                self.str_w(self.send(w_cls, self.newsymbol("name"))), w_cls)

        for w_cls in [
                self.getclassfor(W_EnvObject),
                self.getclassfor(W_HashIterator),
        ]:
            self.set_const(
                self.w_topaz,
                self.str_w(self.send(w_cls, self.newsymbol("name"))), w_cls)

        self.w_top_self = W_Object(self, self.w_object)

        # This is bootstrap. We have to delay sending until true, false and nil
        # are defined
        self.send(self.w_object, self.newsymbol("include"), [self.w_kernel])
        self.bootstrap = False

        w_load_path = self.newarray([
            self.newstr_fromstr(
                os.path.join(os.path.dirname(__file__), os.path.pardir,
                             "lib-ruby"))
        ])
        self.globals.set("$LOAD_PATH", w_load_path)
        self.globals.set("$:", w_load_path)

        w_loaded_features = self.newarray([])
        self.globals.set("$LOADED_FEATURES", w_loaded_features)
        self.globals.set('$"', w_loaded_features)
Пример #7
0
 def __init__(self, space, klass):
     W_Object.__init__(self, space, klass)
     self.epoch_seconds = 0
Пример #8
0
 def __init__(self, space, items_w):
     W_Object.__init__(self, space)
     self.items_w = items_w
Пример #9
0
 def __init__(self, space, regexp):
     W_Object.__init__(self, space)
     self.regexp = regexp
Пример #10
0
 def __init__(self, space, klass=None):
     W_Object.__init__(self, space, klass)
     self.random = Random()
Пример #11
0
 def __init__(self, space, msg, klass=None):
     W_Object.__init__(self, space, klass)
     self.msg = msg
     self.frame = None
     self.last_instructions = []
Пример #12
0
 def __init__(self, space, items_w):
     W_Object.__init__(self, space)
     self.items_w = items_w
Пример #13
0
 def __init__(self, space, storage, strategy):
     W_Object.__init__(self, space)
     self.str_storage = storage
     self.strategy = strategy
Пример #14
0
 def __init__(self, space, symbol):
     W_Object.__init__(self, space)
     self.symbol = symbol
Пример #15
0
 def __init__(self, space, block, is_lambda):
     W_Object.__init__(self, space)
     self.block = block
     self.is_lambda = is_lambda
Пример #16
0
 def __init__(self, space):
     W_Object.__init__(self, space)
     self.fd = -1