简体   繁体   English

如何从 Squeak Smalltalk 图像中转储所有源代码?

[英]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 .我已经下载了 Scratch 的源代码,它是用Squeak Smalltalk编写的。 I can browse the source in Squeak, but what I really want is a big text file.我可以在 Squeak 中浏览源代码,但我真正想要的是一个大文本文件。 The image is based on Squeak 2.8.该图像基于 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.到目前为止,我很喜欢它,我对语言和环境的印象是,如果我能更好地了解我的方法,将这张图像中的所有源代码转储到一个文件中大概可以用大约 3 行代码完成。 Can you supply the 3 lines of code?你能提供3行代码吗?

I won't complain if it ends up being 4 lines (or more likely, 1 line).如果它最终变成 4 行(或更可能是 1 行),我不会抱怨。

Untested, but:未经测试,但是:

Smalltalk allClasses do: [:each | each fileOut]

This should dump three million.st files, named after each class in the system.这应该转储三百万个文件,以系统中的每个 class 命名。

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:编辑:看起来,这在早期的吱吱声中不起作用,我一直在测试,看起来以下应该在 Scratch 源代码图像中工作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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