1.1 --- a/micropython/inspect.py Sun Feb 17 02:38:04 2008 +0100
1.2 +++ b/micropython/inspect.py Mon Feb 18 01:22:25 2008 +0100
1.3 @@ -959,6 +959,8 @@
1.4
1.5 def __init__(self):
1.6 Module.__init__(self, "__builtins__")
1.7 + self.loaded = 1
1.8 + self.module = None
1.9
1.10 for key in ['ArithmeticError', 'AssertionError', 'AttributeError',
1.11 'BaseException', 'DeprecationWarning', 'EOFError', 'Ellipsis',
1.12 @@ -975,9 +977,20 @@
1.13 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',
1.14 'ValueError', 'Warning', 'ZeroDivisionError',
1.15 'basestring', 'bool', 'buffer', 'complex', 'dict', 'file', 'float',
1.16 - 'frozenset', 'int', 'list', 'long', 'object', 'set', 'slice', 'str',
1.17 + 'frozenset', 'int', # 'list',
1.18 + 'long', 'object', 'set', 'slice', 'str',
1.19 'tuple', 'type', 'unicode', 'xrange']:
1.20 - self[key] = Class(key, self.full_name(), self)
1.21 + self.store(key, Class(key, self.full_name(), self))
1.22 +
1.23 + # NOTE: Temporary measure - provide detailed built-ins.
1.24 +
1.25 + cls = Class("list", self.full_name(), self)
1.26 + cls.set("__iter__", Function("__iter__", cls.full_name(), [], 0, 0, cls))
1.27 + self.store("list", cls)
1.28 +
1.29 + cls = Class("listiterator", self.full_name(), self)
1.30 + cls.set("next", Function("next", cls.full_name(), [], 0, 0, cls))
1.31 + self.store("listiterator", cls)
1.32
1.33 # NOTE: Incomplete: some functions have more than one parameter.
1.34
1.35 @@ -991,6 +1004,13 @@
1.36 'staticmethod', 'sum', 'super', 'unichr', 'vars', 'zip']:
1.37 self[key] = Function(key, self.full_name(), ['arg'], 0, 0, self)
1.38
1.39 + def store(self, name, obj):
1.40 + self.set(name, obj)
1.41 + self.all_objects.add(obj)
1.42 +
1.43 + def vacuum(self):
1.44 + pass
1.45 +
1.46 builtins = Builtins()
1.47
1.48 # vim: tabstop=4 expandtab shiftwidth=4