7

What is the best way to print - syntax colored and well formatted - code from Pharo/Squeak on paper?

1) Is there a way to print directly from within Pharo/Squeak? (i use it on macosx)
2) Is there a way to export syntax colored, well formatted code from Pharo/Squak?
3) Are there external tools to color and format a filed out piece of code?

Helene Bilbo
  • 1,142
  • 7
  • 20

5 Answers5

3

For the appendix in my master thesis I used the Pier CMS-to-LaTeX converter in the Pier-Documentation package. However, this plugin only takes class comments and method comments into consideration, it does not print the source code. Pier also provides a package ShoutPier for syntax highlighting of Smalltalk code, so I guess it would require little work to bring the two together. You can find the mentioned extension packages in http://source.lukas-renggli.ch/pieraddons.html.

Lukas Renggli
  • 8,754
  • 23
  • 46
  • Thank you. I was able to get some nice printouts using PRLatexBuilder. – Helene Bilbo Jul 11 '10 at 10:09
  • Nevertheless i hoped something like this would be a common task and built into the standard system.. But it seems people don’t print code on paper so often? – Helene Bilbo Jul 11 '10 at 10:11
  • Earlier versions of Squeak (around version 3.0) had a HTML exporter similar to the file-out mechanism still present today. I guess that could have worked for printing. It was removed at some point because nobody used it and it broke over time. – Lukas Renggli Jul 11 '10 at 11:57
1

Here's how I did it on my Mac, I think this should work on other platforms too.

  1. Save your categories to a Monticello local folder on your disk -- see the Pharo manual on how to do this: http://book.pharo-project.org/book/PharoTools/Monticello/?_s=hdGOLc_FXsvVY1iR&_k=YYH-Ln8f5mtWZ8z2&_n&148

  2. Browse to this folder, and unzip the .mcz file

  3. You'll see all your code in snapshot/source.st file

  4. You'll need to edit this a bit, to remove the ! characters for e.g., there might be a tool to do this?

-Eric.

Eric Clack
  • 1,886
  • 1
  • 15
  • 28
  • A slightly simpler method: in Pharo you can use File Out on a class and this will generate a .st file (on my Mac I have to open the Pharo package contents to find this file), then proceed with step 4 above. – Eric Clack Feb 09 '13 at 13:37
1

There is webdoc project, which allows you navigating code in web browser: http://ss3.gemstone.com/ss/webdoc.html (and of course you can print code from your favorite web browser)..

Igor Stasenko
  • 1,037
  • 5
  • 8
1

Pharo browsers seem to use syntax highlighting.

What difficulty are you having reading Smalltalk code using the browsers and senders/implementors ?

Edit: Would something that produces UML give the overview you're looking for? The Dandelion website only shows downloads for old Squeak versions - I don't know if they would work with Pharo.

And perhaps this GSoC project "Generate UML diagrams from Smalltalk code for Pharo" suggests not.

igouy
  • 2,547
  • 17
  • 16
  • 1
    The Pharo browsers are good. It’s just my desk is so much bigger than my screen - so i can have a look at so much more code at once - and i think it’s easier to get the „big picture“. At the moment i print screenshots from the Pharo browser for each class - this gives me something in the spirit of crc-cards (http://c2.com/doc/crc/draw.html) – Helene Bilbo Jul 10 '10 at 11:44
  • @roy-fleming - I was never even slightly tempted to do that with Smalltalk so it's quite puzzling to me. – igouy Jul 16 '10 at 14:08
0

1) Install shout from www.squeaksource.com

2) I don't know. May be you can customize shout.

3) In gnu-smalltalk you have a smalltalk mode for emacs. But I am not pretty sure to understand what you are looking for.

mathk
  • 7,973
  • 6
  • 45
  • 74
  • I’m looking for a way to read smalltalk code. And i wanted to print it on paper (the question was not about „pretty-print“ in the smalltalk-browser). – Helene Bilbo Jul 08 '10 at 06:58