简体   繁体   中英

How can I dump all the source code from a Squeak Smalltalk image?

I've downloaded the source code of Scratch, which is written in Squeak Smalltalk . I can browse the source in Squeak, but what I really want is a big text file. The image is based on Squeak 2.8.

I'm a total Squeak newbie. So far, I'm loving it, and my impression of the language and environment is that dumping all the source code in this image to a file can probably be done in about 3 lines of code, if only I knew my way around better. Can you supply the 3 lines of code?

I won't complain if it ends up being 4 lines (or more likely, 1 line).

Untested, but:

Smalltalk allClasses do: [:each | each fileOut]

This should dump three million.st files, named after each class in the system.

Welcome and happy smalltalking!

EDIT: As it seems, this wouldn't work in early squeaks, I've been testing around and it looks the following should work in a Scratch source code image:

SystemOrganization categories do: [:each | SystemOrganization fileOutCategory: each]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM