[pypy-svn] r18723 - in pypy/dist/pypy: annotation module/__builtin__ rpython rpython/l3interp rpython/l3interp/test rpython/ootypesystem rpython/ootypesystem/test translator/js translator/llvm translator/locality translator/locality/test translator/squeak translator/squeak/test

arigo at codespeak.net arigo at codespeak.net
Mon Oct 17 19:13:11 CEST 2005


Author: arigo
Date: Mon Oct 17 19:13:08 2005
New Revision: 18723

Modified:
   pypy/dist/pypy/annotation/model.py
   pypy/dist/pypy/module/__builtin__/importing.py
   pypy/dist/pypy/rpython/l3interp/convertgraph.py   (props changed)
   pypy/dist/pypy/rpython/l3interp/test/test_convert.py   (props changed)
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/ootypesystem/ootype.py
   pypy/dist/pypy/rpython/ootypesystem/rclass.py
   pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py
   pypy/dist/pypy/translator/js/codewriter.py
   pypy/dist/pypy/translator/llvm/codewriter.py
   pypy/dist/pypy/translator/locality/   (props changed)
   pypy/dist/pypy/translator/locality/test/   (props changed)
   pypy/dist/pypy/translator/squeak/gensqueak.py
   pypy/dist/pypy/translator/squeak/test/test_squeaktrans.py
Log:
* fixeol
* untabify


Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Mon Oct 17 19:13:08 2005
@@ -482,10 +482,10 @@
 def lltype_to_annotation(T):
     s = ll_to_annotation_map.get(T)
     if s is None:
-	if isinstance(T, ootype.Instance):
-	    return SomeOOInstance(T)
+        if isinstance(T, ootype.Instance):
+            return SomeOOInstance(T)
         else:
-	    return SomePtr(T)
+            return SomePtr(T)
     else:
         return s
 

Modified: pypy/dist/pypy/module/__builtin__/importing.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/importing.py	(original)
+++ pypy/dist/pypy/module/__builtin__/importing.py	Mon Oct 17 19:13:08 2005
@@ -282,7 +282,7 @@
         return None
     else:
         # ImportError
-	msg = "No module named %s" % modulename
+        msg = "No module named %s" % modulename
         raise OperationError(space.w_ImportError, w(msg))
 
 # __________________________________________________________________

Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Mon Oct 17 19:13:08 2005
@@ -641,9 +641,9 @@
         assert isinstance(inst, ootype._instance)
         assert isinstance(message, str)
         bm = getattr(inst, message)
-	m = bm.meth
-	m._checkargs(args)
-	return self.op_direct_call(m, inst, *args)
+        m = bm.meth
+        m._checkargs(args)
+        return self.op_direct_call(m, inst, *args)
 
     def op_ooupcast(self, INST, inst):
         return ootype.ooupcast(INST, inst)

Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py	Mon Oct 17 19:13:08 2005
@@ -21,13 +21,13 @@
         self._name = name
         self._superclass = superclass
 
-	self._methods = frozendict()
+        self._methods = frozendict()
         self._fields = frozendict()
 
-	self._add_fields(fields)
-	self._add_methods(methods)
+        self._add_fields(fields)
+        self._add_methods(methods)
 
-    	self._null = _null_instance(self)
+        self._null = _null_instance(self)
         self._class = _class(self)
         
     def _defl(self):
@@ -46,7 +46,7 @@
         for name, defn in fields.iteritems():
             if self._lookup(name) is not None:
                 raise TypeError("Cannot add field %r: method already exists" % name)
-	
+        
             if self._superclass is not None:
                 if self._superclass._has_field(name):
                     raise TypeError("Field %r exists in superclass" % name)
@@ -65,7 +65,7 @@
                 if ootype != typeOf(default):
                     raise TypeError("Expected type %r for default" % ootype)
 
-	self._fields.update(fields)
+        self._fields.update(fields)
 
     def _add_methods(self, methods):
         # Note to the unwary: _add_methods adds *methods* whereas
@@ -73,8 +73,8 @@
         # if you are in the right state of mind (swiss?), but
         # certainly not necessarily if not.
         for name, method in methods.iteritems():
-	    if self._has_field(name):
-	        raise TypeError("Can't add method %r: field already exists" % name)
+            if self._has_field(name):
+                raise TypeError("Can't add method %r: field already exists" % name)
             if not isinstance(typeOf(method), Meth):
                 raise TypeError("added methods must be _meths, not %s" % type(defn))
         self._methods.update(methods)
@@ -91,7 +91,7 @@
             self._fields[name]
             return True
         except KeyError:
-	    if self._superclass is None:
+            if self._superclass is None:
                 return False
 
             return self._superclass._has_field(name)
@@ -100,7 +100,7 @@
         try:
             return self._fields[name][0]
         except KeyError:
-	    if self._superclass is None:
+            if self._superclass is None:
                 raise TypeError("No field names %r" % name)
 
             return self._superclass._field_type(name)
@@ -116,18 +116,18 @@
         return meth
 
     def _allfields(self):
-	if self._superclass is None:
-	    all = {}
-	else:
-	    all = self._superclass._allfields()
-	all.update(self._fields)
-	return all
+        if self._superclass is None:
+            all = {}
+        else:
+            all = self._superclass._allfields()
+        all.update(self._fields)
+        return all
 
 class StaticMethod(OOType):
 
     def __init__(self, args, result):
-    	self.ARGS = tuple(args)
-	self.RESULT = result
+        self.ARGS = tuple(args)
+        self.RESULT = result
 
     def _example(self):
         _retval = self.RESULT._example()
@@ -195,7 +195,7 @@
 
    def _checkargs(self, args):
        if len(args) != len(self._TYPE.ARGS):
-	   raise TypeError,"calling %r with wrong argument number: %r" % (self._TYPE, args)
+           raise TypeError,"calling %r with wrong argument number: %r" % (self._TYPE, args)
 
        for a, ARG in zip(args, self._TYPE.ARGS):
            if not isCompatibleType(typeOf(a), ARG):

Modified: pypy/dist/pypy/rpython/ootypesystem/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rclass.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/rclass.py	Mon Oct 17 19:13:08 2005
@@ -24,21 +24,21 @@
     def __init__(self, rtyper, classdef, does_need_gc=True):
         AbstractInstanceRepr.__init__(self, rtyper, classdef)
 
-	self.baserepr = None
+        self.baserepr = None
         b = self.classdef.basedef
         if b is not None:
-	    self.baserepr = getinstancerepr(rtyper, b)
+            self.baserepr = getinstancerepr(rtyper, b)
             b = self.baserepr.lowleveltype
 
         self.lowleveltype = ootype.Instance(classdef.cls.__name__, b, {}, {})
         self.prebuiltinstances = {}   # { id(x): (x, _ptr) }
-	self.object_type = self.lowleveltype
+        self.object_type = self.lowleveltype
 
     def _setup_repr(self):
-	if self.baserepr is not None:
-	    self.allfields = self.baserepr.allfields.copy()
-	else:
-	    self.allfields = {}
+        if self.baserepr is not None:
+            self.allfields = self.baserepr.allfields.copy()
+        else:
+            self.allfields = {}
         self.allmethods = {}
 
         fields = {}
@@ -46,8 +46,8 @@
 
         for name, attrdef in attrs:
             if not attrdef.readonly:
-		repr = self.rtyper.getrepr(attrdef.s_value)
-		self.allfields[name] = repr
+                repr = self.rtyper.getrepr(attrdef.s_value)
+                self.allfields[name] = repr
                 oot = repr.lowleveltype
                 fields[name] = oot
 
@@ -56,20 +56,20 @@
         methods = {}
         baseInstance = self.lowleveltype._superclass
 
-	for classdef in self.classdef.getmro():
-	    attrs = classdef.attrs.items()
-	    for name, attrdef in attrs:
-		if attrdef.readonly:
-		    try:
-			impl = self.classdef.cls.__dict__[name]
-		    except KeyError:
-			pass
-		    else:
-			f, inputs, ret = getsignature(self.rtyper, impl)
-			M = ootype.Meth([r.lowleveltype for r in inputs[1:]], ret.lowleveltype)
-			m = ootype.meth(M, _name=name, _callable=impl)
-			methods[name] = m
-	
+        for classdef in self.classdef.getmro():
+            attrs = classdef.attrs.items()
+            for name, attrdef in attrs:
+                if attrdef.readonly:
+                    try:
+                        impl = self.classdef.cls.__dict__[name]
+                    except KeyError:
+                        pass
+                    else:
+                        f, inputs, ret = getsignature(self.rtyper, impl)
+                        M = ootype.Meth([r.lowleveltype for r in inputs[1:]], ret.lowleveltype)
+                        m = ootype.meth(M, _name=name, _callable=impl)
+                        methods[name] = m
+        
         ootype.addMethods(self.lowleveltype, methods)
             
     def rtype_getattr(self, hop):
@@ -127,21 +127,21 @@
             [inputconst(ootype.Void, self.lowleveltype)], self.lowleveltype)
 
     def initialize_prebuilt_instance(self, value, result):
-	# then add instance attributes from this level
-	for name, (oot, default) in self.lowleveltype._allfields().items():
-	    if oot is ootype.Void:
-		llattrvalue = None
-	    elif name == '_hash_cache_': # hash() support
-		llattrvalue = hash(value)
-	    else:
-		try:
-		    attrvalue = getattr(value, name)
-		except AttributeError:
-		    warning("prebuilt instance %r has no attribute %r" % (
-			value, name))
-		    continue
-		llattrvalue = self.allfields[name].convert_const(attrvalue)
-	    setattr(result, name, llattrvalue)
+        # then add instance attributes from this level
+        for name, (oot, default) in self.lowleveltype._allfields().items():
+            if oot is ootype.Void:
+                llattrvalue = None
+            elif name == '_hash_cache_': # hash() support
+                llattrvalue = hash(value)
+            else:
+                try:
+                    attrvalue = getattr(value, name)
+                except AttributeError:
+                    warning("prebuilt instance %r has no attribute %r" % (
+                        value, name))
+                    continue
+                llattrvalue = self.allfields[name].convert_const(attrvalue)
+            setattr(result, name, llattrvalue)
 
 
 class __extend__(pairtype(InstanceRepr, InstanceRepr)):

Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_ooclean.py	Mon Oct 17 19:13:08 2005
@@ -20,12 +20,12 @@
     def check_ootype(v):
         t = v.concretetype
         assert isinstance(t, ootype.Primitive) or isinstance(t, ootype.OOType)
-	
+        
     for block in graph.iterblocks():
-    	for var in block.getvariables():
-	    check_ootype(var)
-	for const in block.getconstants():
-	    check_ootype(const)
+        for var in block.getvariables():
+            check_ootype(var)
+        for const in block.getconstants():
+            check_ootype(const)
 
 def test_simple():
     def f(a, b):
@@ -108,10 +108,10 @@
 
 def test_override():
     def dummyfn(flag):
-	if flag:
-	    inst = HasAMethod()
-	else:
-	    inst = OverridesAMethod()
+        if flag:
+            inst = HasAMethod()
+        else:
+            inst = OverridesAMethod()
         return inst.f()
     result = interpret(dummyfn, [True], type_system='ootype')
     assert result == 1

Modified: pypy/dist/pypy/translator/js/codewriter.py
==============================================================================
--- pypy/dist/pypy/translator/js/codewriter.py	(original)
+++ pypy/dist/pypy/translator/js/codewriter.py	Mon Oct 17 19:13:08 2005
@@ -169,8 +169,8 @@
                 self.append('%s = %s(%s)' % (targetvar, functionref, args))
 
     def cast(self, targetvar, fromtype, fromvar, targettype):
-    	if fromtype == 'void' and targettype == 'void':
-		return
+        if fromtype == 'void' and targettype == 'void':
+                return
         if targettype == fromtype:
             self.append("%(targetvar)s = %(fromvar)s" % locals())
         elif targettype in ('int','uint',):

Modified: pypy/dist/pypy/translator/llvm/codewriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/codewriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/codewriter.py	Mon Oct 17 19:13:08 2005
@@ -112,8 +112,8 @@
             tail_ = ''
         else:
             tail_ = tail
-	if tail_:
-		tail_ += ' '
+        if tail_:
+                tail_ += ' '
         args = ", ".join(["%s %s" % item for item in zip(argtypes, argrefs)])
         if except_label:
             self.genllvm.exceptionpolicy.invoke(self, targetvar, tail_, cconv, returntype, functionref, args, label, except_label)
@@ -124,8 +124,8 @@
                 self.indent("%s = %scall %s %s %s(%s)" % (targetvar, tail_, cconv, returntype, functionref, args))
 
     def cast(self, targetvar, fromtype, fromvar, targettype):
-    	if fromtype == 'void' and targettype == 'void':
-		return
+        if fromtype == 'void' and targettype == 'void':
+                return
         self.indent("%(targetvar)s = cast %(fromtype)s "
                         "%(fromvar)s to %(targettype)s" % locals())
 

Modified: pypy/dist/pypy/translator/squeak/gensqueak.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/gensqueak.py	(original)
+++ pypy/dist/pypy/translator/squeak/gensqueak.py	Mon Oct 17 19:13:08 2005
@@ -19,7 +19,7 @@
 def camel_case(str):
     words = str.split('_')
     for i in range(1, len(words)):
-	words[i] = words[i].capitalize()
+        words[i] = words[i].capitalize()
     return ''.join(words)
 
 def arg_names(func, names = None):
@@ -27,54 +27,54 @@
     #    http://docs.python.org/ref/types.html#l2h-139
     co = func.func_code
     if not names:
-	names = co.co_varnames
+        names = co.co_varnames
     return names[:co.co_argcount]
 
 def selector(name, args):
     s = name
     if args:
-	s += '_'
-	for arg in args:
-	    s += arg + ':'
+        s += '_'
+        for arg in args:
+            s += arg + ':'
     return camel_case(s)
 
 def signature(sel, args):
     if (':' in sel):
-	parts = []
-	names = sel.split(':')
-#	assert len(names) == len(args)
-	while args:
-	    parts.append(names.pop(0) + ': ' + args.pop(0))
-	return ' '.join(parts)
+        parts = []
+        names = sel.split(':')
+#       assert len(names) == len(args)
+        while args:
+            parts.append(names.pop(0) + ': ' + args.pop(0))
+        return ' '.join(parts)
     elif not sel[0].isalnum():
-#	assert len(args) == 1
+#       assert len(args) == 1
         return "%s %s" %(sel, args[0])
     else:
-#	assert len(args) == 0
-	return sel
+#       assert len(args) == 0
+        return sel
 
 
 class LoopFinder:
     def __init__(self, startblock):
-	self.loops = {}
-	self.parents = {startblock: startblock}
-	self.temps = {}
-	self.seen = []
-	self.visit_Block(startblock)
+        self.loops = {}
+        self.parents = {startblock: startblock}
+        self.temps = {}
+        self.seen = []
+        self.visit_Block(startblock)
     def visit_Block(self, block, switches=[]):
-	#self.temps.has_key()
-	self.seen.append(block)
-	if block.exitswitch:
-	    switches.append(block)
-	    self.parents[block] = block
-	for link in block.exits:
-	    self.visit_Link(link, switches) 
+        #self.temps.has_key()
+        self.seen.append(block)
+        if block.exitswitch:
+            switches.append(block)
+            self.parents[block] = block
+        for link in block.exits:
+            self.visit_Link(link, switches) 
     def visit_Link(self, link, switches):
-	if link.target in switches:
-	    self.loops[link.target] = True
-	if not link.target in self.seen:
-	    self.parents[link.target] = self.parents[link.prevblock]
-	    self.visit_Block(link.target, switches)
+        if link.target in switches:
+            self.loops[link.target] = True
+        if not link.target in self.seen:
+            self.parents[link.target] = self.parents[link.prevblock]
+            self.visit_Block(link.target, switches)
 
 class GenSqueak:
 
@@ -84,66 +84,66 @@
         self.modname = (modname or
                         translator.functions[0].__name__)
         self.sqnames = {
-	    Constant(None).key:  'nil',
-	    Constant(False).key: 'false',
-	    Constant(True).key:  'true',
-	}
+            Constant(None).key:  'nil',
+            Constant(False).key: 'false',
+            Constant(True).key:  'true',
+        }
         self.seennames = {}
         self.pendingfunctions = []
         self.pendingclasses = []
         self.pendingmethods = []
-	self.classes = [] 
-	self.methods = [] 
+        self.classes = [] 
+        self.methods = [] 
 
-	t = self.translator
-	func = t.functions[0]
-	graph = t.getflowgraph(func)
-	simplify_graph(graph)
+        t = self.translator
+        func = t.functions[0]
+        graph = t.getflowgraph(func)
+        simplify_graph(graph)
         remove_direct_loops(t, graph)
         checkgraph(graph)
-	#self.translator.view()
+        #self.translator.view()
 
         self.nameof(func) #add to pending
         file = self.sqdir.join('%s.st' % func.__name__).open('w')
         self.gen_source(file)
-	file.close()
-	#self.translator.view()
+        file.close()
+        #self.translator.view()
 
 
     def gen_source(self, file):
-	while self.pendingfunctions or self.pendingclasses or self.pendingmethods:
-	    while self.pendingfunctions:
-		func = self.pendingfunctions.pop()
-		self.gen_sqfunction(func, file)
-	    while self.pendingclasses:
-		inst = self.pendingclasses.pop()
-		self.gen_sqclass(inst, file)
-	    while self.pendingmethods:
-		(inst, meth) = self.pendingmethods.pop()
-		self.gen_sqmethod(inst, meth, file)
+        while self.pendingfunctions or self.pendingclasses or self.pendingmethods:
+            while self.pendingfunctions:
+                func = self.pendingfunctions.pop()
+                self.gen_sqfunction(func, file)
+            while self.pendingclasses:
+                inst = self.pendingclasses.pop()
+                self.gen_sqclass(inst, file)
+            while self.pendingmethods:
+                (inst, meth) = self.pendingmethods.pop()
+                self.gen_sqmethod(inst, meth, file)
 
     def gen_sqclass(self, inst, f):
-	self.classes.append(inst)
-	print >> f, """%s subclass: #%s
-	instanceVariableNames: '%s'
-	classVariableNames: ''
-	poolDictionaries: ''
-	category: 'PyPy-Test'!
-	""" % (
-	    self.nameof_Instance(inst._superclass), 
-	    self.nameof_Instance(inst),
-	    ' '.join(inst._fields.iterkeys()))
+        self.classes.append(inst)
+        print >> f, """%s subclass: #%s
+        instanceVariableNames: '%s'
+        classVariableNames: ''
+        poolDictionaries: ''
+        category: 'PyPy-Test'!
+        """ % (
+            self.nameof_Instance(inst._superclass), 
+            self.nameof_Instance(inst),
+            ' '.join(inst._fields.iterkeys()))
 
     def gen_sqmethod(self, inst, meth, f):
-	if (inst, meth) in self.methods:
-	    return
-	self.methods.append((inst, meth))
-	print >> f, "!%s methodsFor: 'methods' stamp: 'pypy 1/1/2000 00:00'!" % (
+        if (inst, meth) in self.methods:
+            return
+        self.methods.append((inst, meth))
+        print >> f, "!%s methodsFor: 'methods' stamp: 'pypy 1/1/2000 00:00'!" % (
             self.nameof_Instance(inst))
-	print >> f, "%s" % meth
-	print >> f, '	"XXX methods not generated yet"'
-	print >> f, "! !"
-	print >> f
+        print >> f, "%s" % meth
+        print >> f, '   "XXX methods not generated yet"'
+        print >> f, "! !"
+        print >> f
 
 
     def gen_sqfunction(self, func, f):
@@ -156,128 +156,128 @@
             else:
                 raise TypeError, "expr(%r)" % (v,)
 
-	def oper(op):
-	    args = [expr(arg) for arg in op.args]
-	    if op.opname == "oosend":
-		name = op.args[0].value
-		receiver = args[1]
-		args = args[2:]
-		self.note_meth(op.args[1].concretetype, name)
-	    elif op.opname == "oogetfield":
-		receiver = args[0]
-		name = op.args[1].value
-		args = args[2:]
-	    elif op.opname == "oosetfield":
-		receiver = args[0]
-		name = op.args[1].value
-		args = args[2:]
-	    else:
-		name = op.opname
-		receiver = args[0]
-		args = args[1:]
-	    argnames = ['with'] * len(args)
-	    if argnames:
-		argnames[0] = ''
-	    sel = selector(name, argnames)
-	    if op.opname != "oosend":
-		sel = selectormap.get(sel, sel)
-	    return "%s := %s %s." % (expr(op.result), receiver, signature(sel, args))
-
-	def render_return(args):
-	    if len(args) == 2:
-		# exception
-		exc_cls = expr(args[0])
-		exc_val = expr(args[1])
-		yield "(PyOperationError class: %s value: %s) signal." % (exc_cls, exc_val)
-	    else:
-		# regular return block
-		retval = expr(args[0])
-		yield "^%s" % retval
-
-	def render_link(link):
-	    block = link.target
-	    if link.args:
-		for i in range(len(link.args)):
-		    yield '%s := %s.' % (expr(block.inputargs[i]), expr(link.args[i]))
-	    for line in render_block(block):
-		yield line
-
-	def render_block(block):
-	    if loops.has_key(block):
-		if not loops[block]:
-		    yield '"skip1"'
-		    return
-		yield "["
-	    for op in block.operations:
-		yield "%s" % oper(op)
-	    if len(block.exits) == 0:
+        def oper(op):
+            args = [expr(arg) for arg in op.args]
+            if op.opname == "oosend":
+                name = op.args[0].value
+                receiver = args[1]
+                args = args[2:]
+                self.note_meth(op.args[1].concretetype, name)
+            elif op.opname == "oogetfield":
+                receiver = args[0]
+                name = op.args[1].value
+                args = args[2:]
+            elif op.opname == "oosetfield":
+                receiver = args[0]
+                name = op.args[1].value
+                args = args[2:]
+            else:
+                name = op.opname
+                receiver = args[0]
+                args = args[1:]
+            argnames = ['with'] * len(args)
+            if argnames:
+                argnames[0] = ''
+            sel = selector(name, argnames)
+            if op.opname != "oosend":
+                sel = selectormap.get(sel, sel)
+            return "%s := %s %s." % (expr(op.result), receiver, signature(sel, args))
+
+        def render_return(args):
+            if len(args) == 2:
+                # exception
+                exc_cls = expr(args[0])
+                exc_val = expr(args[1])
+                yield "(PyOperationError class: %s value: %s) signal." % (exc_cls, exc_val)
+            else:
+                # regular return block
+                retval = expr(args[0])
+                yield "^%s" % retval
+
+        def render_link(link):
+            block = link.target
+            if link.args:
+                for i in range(len(link.args)):
+                    yield '%s := %s.' % (expr(block.inputargs[i]), expr(link.args[i]))
+            for line in render_block(block):
+                yield line
+
+        def render_block(block):
+            if loops.has_key(block):
+                if not loops[block]:
+                    yield '"skip1"'
+                    return
+                yield "["
+            for op in block.operations:
+                yield "%s" % oper(op)
+            if len(block.exits) == 0:
                 for line in render_return(block.inputargs):
-		    yield line
+                    yield line
                 return
-	    elif block.exitswitch is None:
+            elif block.exitswitch is None:
                 # single-exit block
                 assert len(block.exits) == 1
-		for line in render_link(block.exits[0]):
-		    yield line
-	    else:
+                for line in render_link(block.exits[0]):
+                    yield line
+            else:
                 #exitswitch
-		if loops.has_key(block):
-		    if loops[block]:
-			loops[block] = False
-			yield "%s] whileTrue: [" % expr(block.exitswitch)
-			for line in render_link(block.exits[True]):
-			    yield "    %s" % line
-			yield "]."
-			for line in render_link(block.exits[False]):
-			    yield "%s" % line
-		else:
-		    yield "%s ifTrue: [" % expr(block.exitswitch)
-		    for line in render_link(block.exits[True]):
-			yield "    %s" % line
-		    yield "] ifFalse: [" 
-		    for line in render_link(block.exits[False]):
-			yield "    %s" % line
-		    yield "]"
+                if loops.has_key(block):
+                    if loops[block]:
+                        loops[block] = False
+                        yield "%s] whileTrue: [" % expr(block.exitswitch)
+                        for line in render_link(block.exits[True]):
+                            yield "    %s" % line
+                        yield "]."
+                        for line in render_link(block.exits[False]):
+                            yield "%s" % line
+                else:
+                    yield "%s ifTrue: [" % expr(block.exitswitch)
+                    for line in render_link(block.exits[True]):
+                        yield "    %s" % line
+                    yield "] ifFalse: [" 
+                    for line in render_link(block.exits[False]):
+                        yield "    %s" % line
+                    yield "]"
 
         t = self.translator
         graph = t.getflowgraph(func)
 
         start = graph.startblock
-	args = [expr(arg) for arg in start.inputargs]
-	print >> f, '%s' % signature(self.nameof(func), args)
+        args = [expr(arg) for arg in start.inputargs]
+        print >> f, '%s' % signature(self.nameof(func), args)
     
-	loops = LoopFinder(start).loops
+        loops = LoopFinder(start).loops
 
-	for line in render_block(start):
-	    print >> f, '	%s' % line
-	print >> f
+        for line in render_block(start):
+            print >> f, '       %s' % line
+        print >> f
 
     def nameof(self, obj):
         key = Constant(obj).key
         try:
             return self.sqnames[key]
         except KeyError:
-	    for cls in type(obj).__mro__:
-		meth = getattr(self,
-			       'nameof_' + cls.__name__.replace(' ', ''),
-			       None)
-		if meth:
-		    break
-	    else:
-		types = ['nameof_'+t.__name__ for t in type(obj).__mro__]
-		raise Exception, "nameof(%r): no method %s" % (obj, types)
-	    name = meth(obj)
+            for cls in type(obj).__mro__:
+                meth = getattr(self,
+                               'nameof_' + cls.__name__.replace(' ', ''),
+                               None)
+                if meth:
+                    break
+            else:
+                types = ['nameof_'+t.__name__ for t in type(obj).__mro__]
+                raise Exception, "nameof(%r): no method %s" % (obj, types)
+            name = meth(obj)
             self.sqnames[key] = name
             return name
 
     def nameof_int(self, i):
-	return str(i)
+        return str(i)
 
     def nameof_str(self, s):
-	return "'s'"
+        return "'s'"
 
     def nameof_function(self, func):
-	#XXX this should actually be a StaticMeth
+        #XXX this should actually be a StaticMeth
         printable_name = '(%s:%d) %s' % (
             func.func_globals.get('__name__', '?'),
             func.func_code.co_firstlineno,
@@ -292,28 +292,28 @@
                 print "skipped", printable_name
                 return self.skipped_function(func)
         name = self.unique_name(func.__name__)
-	args = arg_names(func)
-	sel = selector(name, args)
+        args = arg_names(func)
+        sel = selector(name, args)
         self.pendingfunctions.append(func)
         return sel
 
     def nameof_Instance(self, inst):
-	if inst is None:
-	    #empty superclass
-	    return "Object"
-	self.note_Instance(inst)
-	return "Py%s" % inst._name.capitalize()
+        if inst is None:
+            #empty superclass
+            return "Object"
+        self.note_Instance(inst)
+        return "Py%s" % inst._name.capitalize()
 
     def note_Instance(self, inst):
-	if inst not in self.classes:
-	    if inst not in self.pendingclasses:
-		self.pendingclasses.append(inst)
+        if inst not in self.classes:
+            if inst not in self.pendingclasses:
+                self.pendingclasses.append(inst)
 
     def note_meth(self, inst, meth):
         bm = (inst, meth)
-	if bm not in self.methods:
-	    if bm not in self.pendingmethods:
-		self.pendingmethods.append(bm)
+        if bm not in self.methods:
+            if bm not in self.pendingmethods:
+                self.pendingmethods.append(bm)
 
     def unique_name(self, basename):
         n = self.seennames.get(basename, 0)

Modified: pypy/dist/pypy/translator/squeak/test/test_squeaktrans.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/test/test_squeaktrans.py	(original)
+++ pypy/dist/pypy/translator/squeak/test/test_squeaktrans.py	Mon Oct 17 19:13:08 2005
@@ -6,9 +6,9 @@
 
 def looping(i = (int), j = (int)):
     while i > 0:
-	i -= 1
-	while j > 0:
-	    j -= 1
+        i -= 1
+        while j > 0:
+            j -= 1
 
 class TestSqueakTrans:
 



More information about the Pypy-commit mailing list