[pypy-svn] r47848 - pypy/dist/pypy/lang/smalltalk/tools
tverwaes at codespeak.net
tverwaes at codespeak.net
Wed Oct 24 18:43:27 CEST 2007
Author: tverwaes
Date: Wed Oct 24 18:43:27 2007
New Revision: 47848
Added:
pypy/dist/pypy/lang/smalltalk/tools/
pypy/dist/pypy/lang/smalltalk/tools/analyseimage.py
pypy/dist/pypy/lang/smalltalk/tools/autopath.py
- copied unchanged from r47799, pypy/dist/pypy/bin/autopath.py
Log:
Adding nice smalltalk tools (print all strings in image)
Added: pypy/dist/pypy/lang/smalltalk/tools/analyseimage.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/smalltalk/tools/analyseimage.py Wed Oct 24 18:43:27 2007
@@ -0,0 +1,26 @@
+import autopath
+import py
+from pypy.lang.smalltalk import squeakimage as sq
+from pypy.lang.smalltalk import model as sqm
+
+mini_image = py.magic.autopath().dirpath().dirpath().join('mini.image')
+
+def test_miniimageexists():
+ assert mini_image.check(dir=False)
+
+def get_miniimage():
+ return sq.ImageReader(sq.Stream(mini_image.open()))
+
+def printStringsInImage():
+ example = get_miniimage()
+ example.initialize()
+
+ image = sq.SqueakImage()
+ image.from_reader(example)
+
+ for each in image.objects:
+ if isinstance(each,sqm.W_BytesObject):
+ print ''.join(each.bytes)
+
+if __name__ == '__main__':
+ printStringsInImage()
More information about the Pypy-commit
mailing list