Sake = Rake for Smalltalk?
francisco.j.garau at jpmorgan.com
francisco.j.garau at jpmorgan.com
Thu Apr 27 17:44:04 UTC 2006
Stef,
For your Mac, you could ask Marcel Weiher a copy of his Smalltalk Shell
Script (stsh). He has demoed it at the last UK Smalltalk meeting and it
looks really cool. It is scripting language (like csh) but with Smalltalk
sintax. Also, very fast...
Here a couple of examples:
===
#!/usr/local/bin/stsh
# -- how the stsh framework runs an interactive command
vi:=MPWCommandFilter filterWithCommandNamed:'vi' args:NSArray array
target:stdout.
vi setIsTarget:0.
vi startRunning.
===
#!/usr/local/bin/stsh
#-- initialize a PDF document object with the file passed on the command
line
pdf:=MPWPDFFile alloc initWithPdfData:(NSData dataWithContentsOfFile:(args
objectAtIndex:1)).
pdf parseXrefTables.
#-- log a description of the pdf to the console (standard out )
stdout println:pdf.
#-- get the first page object from the pdf file, log it
page := (pdf pages objectAtIndex:0).
stdout println:page.
#-- get the 'content stream' of that page, resolving pdf indirect object
reference
content := (page objectForKey:'Contents') referencedValue.
#-- get the (decoded) data from the content stream (the content stream is
usually compressed)
data := content data.
#-- replace the content stream's encoded data with the uncompressed data
we just got
content setEncodedData:data.
#-- remove the filter that indicates this data is compressed
content setObject:nil forKey:'Filter'.
#-- replace the stream length with the uncompressed length
content dict setObject:(MPWPSInteger integer:data length)
forStringKey:'Length'.
#-- log the resulting dictionary / pdf object
stdout println:content.
#-- write the resulting PDF object
writer := MPWPDFWriter streamWithTarget:MPWPDFByteStream stream.
writer outputPDFFile:pdf.
writer close.
writer target target writeToFile:'out.pdf' atomically:1.
---
Francisco Garau
0207 777 1362 - x71362
This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.
More information about the Squeak-dev
mailing list
|