links to this page:    
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 8:07 pm UTC on 27 December 2008
Here is an addition to VMMaker that enables browsing of C source for the interpreter and plugins.

It implements #asCString and #asCString: for object memory, interpreter, and plugin classes, and adds browser support for all Browser and MessageSet browsers.

In a browser, the 'What to show' menu will include selections for 'translate to C' and 'translate to inlined C'.

A cache of code generators is maintained in VMMaker to provide fast display of generated C source in browser windows. If a translatable class or method is changed, all affected cache entries are invalidated, and new code generators are created on demand.

In SmartSyntaxPluginTMethod, handling of selectors for 'primitive' directive has been changed to maintain the actual selector name (for method lookup from a browser), and adds selectorOverride to implement the primitive name generation.

How to load SlangBrowser (dtl Dec 2008):

1) Add the base support into VMMaker. If you are using a recent VMMaker from the SqueakSource (VMMaker-dtl.111.mcz or later), this support will already be already present. Otherwise, load SlangBrowser-VMMaker-dtl.cs.gz.

2) Add the SlangBrowser package. You can find this as package SlangBrowser in the VMMaker project on SqueakSource, otherwise load SlangBrowser-Package-dtl.cs.gz.

3) Update CodeHolder and browser menus so that C translation will be offered as a menu pick in system browers. If you are using a Squeak 3.8 image, or any of the forks derived from 3.8, then load CodeHolderMenuRegistration-sq3-8-dtl.cs.gz. I you are using Squeak 3.9 or later, or any other image with Traits support, then load CodeHolderMenuRegistration-sq3-9-dtl.cs.gz.

SlangBrowser was original posted in January 2007 as follows. I am leaving the posting here for reference, but please use the above instructions instead (dtl Dec 2008):

The code is separated into one change set for the browser tools, and another for VMMaker. The browser tools changes allow a package (e.g. VMMaker) to register additional display options for browser code windows. The VMMaker changes provide the actual C code generation for browsers.

There are some differences between the Squeak 3.8 and 3.9 versions due to Traits, and due to the elimination of alternate syntax display in 3.9.

For Squeak 3.8 with VMMaker 3.8b6, use these changes sets:

For Squeak 3.9 with VMMaker 3.8b6, use these change sets:

The CodeHolderMenuRegistration changes are posted on Mantis at http://bugs.squeak.org/view.php?id=5932.

Contributed by Dave Lewis under MIT and/or SqueakL, 04-Jan-2007.

Comment from Tim Rowledge Dec 07 - this is very cool. I dare say some might have nitpicks with the precise mechanism of the menu changes but the intent is both clear and beneficial. The almost-instant C translation of Slang is extremely interesting.