FileStream stdout nextPutAll: 'something';crlf. Works great, but FileStream stdin next. Never returns :/. Whatever I try. Any idea? On Mon, Jan 30, 2012 at 1:29 AM, Guillermo Polito <guillermopolito@gmail.com
wrote:
On Sun, Jan 29, 2012 at 6:58 PM, Sven Van Caekenberghe <sven@beta9.be>wrote:
Hi Guillermo,
On 29 Jan 2012, at 21:11, Guillermo Polito wrote:
I've spent a few hours playing with Alien+FFI and I did want to have a Command line interface to play and use as a quick browser.
Gofer it squeaksource: 'CLInterface'; package: 'ConfigurationOfCLInterface'; load.
ConfigurationOfCLInterface load.
To play with it write a script, for example startCLI.st, with the following:
CLInterface start
And then, from the command line
CogVM -vm-display-null <image> startCLI.st
What it does support? - executes smalltalk expressions - handles the errors and shows them into the stdout (so it does not explode :P) - stores variables as a workspace Since I used standard C functions (fgets and printf only) this should work on every platform from scratch (having a VM with FFI working, of course)...
The problems I've ran so far: - blocking FFI blocks the vm. I've not tried yet to use threads through FFI (and I don't know if it works. Does it?). But It should be great to start a headless seaside server with a command line :/.
Ok, it's a very simple thing, but it allows to execute a expression from a remote server via ssh without doing much :).
Guille
Cool, but why do you need to access those C functions ? You do know that you can access std* from Smalltalk, do you ?
No! :D
Have a look at the FileStream class 'stdio' category.
will do :). Will that solve the vm-block issue?
Apart from that, nice small, readable and useful hack.
Thanks :P.
Regards,
Sven