|
|
First Steps in Susie Smalltalk Scripting
by Peter William Lount version 1, 20050303 5:25am PDT I'm working on some new features for Smalltalk.org and a couple of other web sites. I'm testing out various scripting technolgies and deployment scenarios. I've spend some time with Susie Smalltalk and have produced some nice results considering how minimal a Smalltalk she is. I like what I see as Smalltalk is a much better scripting language for many reasons than many of the alternatives. First the resulting html page which is stand alone here and below for your immediate viewing pleasure. Yes, it's simply a generated list of the classes in Susie Smalltalk. The important issue is that it's generated live and dynamic every time this page id redisplayed. By being dynamic when I upgrade to a new version of Susie (we've had three new versions in the last week or so this list will automatically be updated. That's what dynamic systems are about, being up to date live as it happens.
Live Susie Smalltalk Class Hierarchy
by Peter William Lount Susie Smalltalk base classes (plus a couple of new ones from the script that generates this page). Generated with Susie Smalltalk live each page refresh. All of the content within this box was generated from within this script. From a base install of Susie on the FreeBSD server to this script running was about five hours of work and that included debugging the Susie virtual machine compiling script. Object
Method
Scheduler
Parser
CommonGatewayInterface
Block
Random
Semaphore
UndefinedObject
Smalltalk
Socket
SystemInfo
TCP
Switch
Symbol
Transcript
DirectoryEntry
File
Process
Directory
Unix
Context
ParserNode
CascadeNode
TemporaryNode
ReturnNode
MessageNode
BodyNode
PrimitiveNode
LiteralNode
InstNode
ArgumentNode
AssignNode
BlockNode
ValueNode
Magnitude
Date
Char
Number
Integer
LongInteger
Float
Fraction
Collection
Bag
Interval
IndexedCollection
Dictionary
SymbolTable
Array
ByteArray
String
List
Set
Behavior
Metaclass
Class
Link
Boolean
False
True
Encoder
In the box below and here is the actual script file that generates the above. It has some extra unused code in it from my experiments and could be cleaned up a bit. #!/path/to/susie/susie-0.2/susie "Susie Class Hierarchy html test.] By Peter William Lount http://www.smalltalk.org, peter@smalltalk.org. Copyright 2005, all rights reserved. This example is licensed under the BSD License. See FreeBSD.org for a copy." Object subclass: #CommonGatewayInterface instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: ''! !CommonGatewayInterface class methodsFor: ''! cgiContentHeader smalltalk print: 'Content-type: text/html'; print: ''. ! ! !Class methodsFor: ''! hierarchyHTML ^ self hierarchyHTML: 0! hierarchyHTML: n | result | result := String new. gap := String new. (1 to: n) do: [ :i | gap := gap + ' ']. "result := result + '<div>'." result := result + '<div style="padding-left: ' + (20 * n) + 'px;">' + name + '</div>'. "result := result + '<span>' + name + '</span></div>'." self subClasses do: [ :c| result := result + (Char newline asString) + (c hierarchyHTML: n+1) ]. ^ result! ! Object subclass: #SystemInfo instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: ''! !SystemInfo class methods! classes | aClassNameString | aClassNameString := Object hierarchy. (File name: 'Object_hierarchy.txt' open: 'w') print: aClassNameString; close. ! classesHTML | aClassNameString | aClassNameString := Object hierarchyHTML. (File name: 'Object_hierarchy.txt' open: 'w') print: aClassNameString; close. ! ! "This is our 'Do it' that executes some of the above methods." CommonGatewayInterface cgiContentHeader. smalltalk print: '<b>Live Susie Smalltalk Class Hierarchy</b><br>' + 'by Peter William Lount<br><br>' + '<b><a href="/versions/SusieSmalltalk.html" >Susie Smalltalk</a> ' + 'base classes</b> (plus a couple of new ones from the script that generates this pager). ' + 'Generated with Susie Smalltalk live each page refresh. ' + 'All of the content within this box was generated from within this script. ' + 'From a base install of Susie on the ' + '<a href="http://activeinfo.ca/technologies/FreeBSD.html" target=activeinfo>FreeBSD</a> server ' + 'to this script running was about five hours of work and that included debugging the Susie ' + 'virtual machine compiling script.' + '<br><br>' + (Char newline asString) + Object hierarchyHTML + (Char newline asString) + '</body></html>'. ! ps. Many thanks to Dave W. for reminding me about html quoting to properly display the html tags. Resources Susie Smalltalk subclasses.sts Subclasses html script file. Copyright 1 9 9 9 - 2 0 1 0 b y S m a l l t a l k . o r g "! , A l l R i g h t s R e s e r v e d . |
|