Hi
I would like to use I would like to pass a file as argument, I know that this is possible and I should read the manual. ;) any hints is welcome.
What I do not know is how can I print on stdoutput? Should I create a primitive (argh) for that? Would be neat to have that per default (may be this is the time for me to learn something new writing a primitive)
Stef
I would like to use I would like to pass a file as argument, I know that this is possible and I should read the manual. ;) any hints is welcome.
Simply pass the arguments after the image-name, that should work with the Unix and the Mac VM. By default the image will try to file-in the first argument (it assumes it is a script), so you probably need to change that (somewhere in a start-up method) an put your own parse code in there. The code "SmalltalkImage current extractParameters" answers a collection of command line parameters.
What I do not know is how can I print on stdoutput? Should I create a primitive (argh) for that? Would be neat to have that per default (may be this is the time for me to learn something new writing a primitive)
As far as I know this only works on the Unix VM with OS Process.
Once I wrote a plugin for Squeak to directly access the Posix filesystem functions on Unix, because of the bugs with file-access in Squeak. This also allowed to read and write to stdout, stdin and stderr by performing the primitives on the file-handles 0, 1 and 2 respectively. I can show you that code if you like.
Lukas
On 12 août 06, at 11:19, Lukas Renggli wrote:
I would like to use I would like to pass a file as argument, I know that this is possible and I should read the manual. ;) any hints is welcome.
Simply pass the arguments after the image-name, that should work with the Unix and the Mac VM. By default the image will try to file-in the first argument (it assumes it is a script), so you probably need to change that (somewhere in a start-up method) an put your own parse code in there. The code "SmalltalkImage current extractParameters" answers a collection of command line parameters.
What I do not know is how can I print on stdoutput? Should I create a primitive (argh) for that? Would be neat to have that per default (may be this is the time for me to learn something new writing a primitive)
As far as I know this only works on the Unix VM with OS Process.
Once I wrote a plugin for Squeak to directly access the Posix filesystem functions on Unix, because of the bugs with file-access in Squeak. This also allowed to read and write to stdout, stdin and stderr by performing the primitives on the file-handles 0, 1 and 2 respectively. I can show you that code if you like.
Yes I want to see that. I think that having a StdOut class as in VW is realllllly cool. This way we can really use squeak to script!
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
Once I wrote a plugin for Squeak to directly access the Posix filesystem functions on Unix, because of the bugs with file-access in Squeak. This also allowed to read and write to stdout, stdin and stderr by performing the primitives on the file-handles 0, 1 and 2 respectively. I can show you that code if you like.
Yes I want to see that. I think that having a StdOut class as in VW is realllllly cool. This way we can really use squeak to script!
The problem is, that something like stdout, stdin and stderr does not exist on all platforms.
Lukas
2006/8/12, Lukas Renggli renggli@gmail.com:
Once I wrote a plugin for Squeak to directly access the Posix filesystem functions on Unix, because of the bugs with file-access in Squeak. This also allowed to read and write to stdout, stdin and stderr by performing the primitives on the file-handles 0, 1 and 2 respectively. I can show you that code if you like.
Yes I want to see that. I think that having a StdOut class as in VW is realllllly cool. This way we can really use squeak to script!
The problem is, that something like stdout, stdin and stderr does not exist on all platforms.
So noone should be allowed to use it?
Philippe
Philippe Marschall puso en su mail :
So noone should be allowed to use it?
Philippe
No, VM builders should take any advantage what a particular OS / hardware combination could have.
Off course , the bad news is some Squeakers not have some "advantage"
I wish John let what Sophie VM could be used by regular Squeak. With his richer fonts set inside, with his several windows, with his only one archive and all inside (perceived by the user, under of hood the story is more complex)
Edgar
__________________________________________________ Pregunt�. Respond�. Descubr�. Todo lo que quer�as saber, y lo que ni imaginabas, est� en Yahoo! Respuestas (Beta). �Probalo ya! http://www.yahoo.com.ar/respuestas
On Sat, Aug 12, 2006 at 11:53:37AM +0200, Lukas Renggli wrote:
Once I wrote a plugin for Squeak to directly access the Posix filesystem functions on Unix, because of the bugs with file-access in Squeak. This also allowed to read and write to stdout, stdin and stderr by performing the primitives on the file-handles 0, 1 and 2 respectively. I can show you that code if you like.
Yes I want to see that. I think that having a StdOut class as in VW is realllllly cool. This way we can really use squeak to script!
The problem is, that something like stdout, stdin and stderr does not exist on all platforms.
OSProcess thisOSProcess stdOut OSProcess thisOSProcess stdErr OSProcess thisOSProcess stdErr
This works on Unix/Linux/OS X. It used to work on Windows, but I think this was broken with some recent security enhancments (sic) to the Windows VM FilePlugin.
OSProcess is organized such that platform-specific subclasses implement the OS dependent stuff. It's intended to be extended for any platform. Likewise for the OSPP plugin, the platform-specific subclasses are generated for different platforms. Currently this is Unix (which covers Linux and OS X) and Windows, although the Windows version is not distributed with VM downloads (rightly so, given that it is no longer compatible with the security features of the Windows VM).
I'm not necessarily planning to actually do any other platform extensions, but please feel free to extend it in any way you want. I try to keep things backward compatible, so you would be fairly safe in doing your own platform-specific subclasses it you want.
Dave
On Sat, Aug 12, 2006 at 09:47:14AM -0400, David T. Lewis wrote:
OSProcess thisOSProcess stdOut OSProcess thisOSProcess stdErr OSProcess thisOSProcess stdErr
Sorry, I meant to say: OSProcess thisOSProcess stdOut OSProcess thisOSProcess stdErr OSProcess thisOSProcess stdIn
On Windows, this would interact with the console: OSProcess thisOSProcess openConsole OSProcess thisOSProcess closeConsole
Dave
On Sat, Aug 12, 2006 at 10:38:14AM +0200, st?phane ducasse wrote:
Hi
I would like to use I would like to pass a file as argument, I know that this is possible and I should read the manual. ;) any hints is welcome.
What I do not know is how can I print on stdoutput? Should I create a primitive (argh) for that? Would be neat to have that per default (may be this is the time for me to learn something new writing a primitive)
Hi Stef,
I'm not sure what you mean by "using Squeak to script", but did you have in mind something like the following in CommandShell:
script: aScriptString onFailureDo: aBlockWithOneParameter "A script is a String containing a list of commands separated by Character cr. Evaluate each command in aScriptString until a failure is encountered. On failure, answer the result of evaluating aBlockWithOneParameter with the last proxy to have been evaluated as its parameter. Otherwise, answer the last process proxy to have been evaluated."
"CommandShell new open; script: 'who help ls -l NOSUCHFILE help' onFailureDo: [:p | 'the proxy that failed was ', p printString]"
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby. So OSProcees seems good for my goal. I will wrap it into Stdoutput to have the same as in VW :) and play with it.
Stef
On 12 août 06, at 15:53, David T. Lewis wrote:
On Sat, Aug 12, 2006 at 10:38:14AM +0200, st?phane ducasse wrote:
Hi
I would like to use I would like to pass a file as argument, I know that this is possible and I should read the manual. ;) any hints is welcome.
What I do not know is how can I print on stdoutput? Should I create a primitive (argh) for that? Would be neat to have that per default (may be this is the time for me to learn something new writing a primitive)
Hi Stef,
I'm not sure what you mean by "using Squeak to script", but did you have in mind something like the following in CommandShell:
script: aScriptString onFailureDo: aBlockWithOneParameter "A script is a String containing a list of commands separated by Character cr. Evaluate each command in aScriptString until a failure is encountered. On failure, answer the result of evaluating aBlockWithOneParameter with the last proxy to have been evaluated as its parameter. Otherwise, answer the last process proxy to have been evaluated."
"CommandShell new open; script: 'who help ls -l NOSUCHFILE help' onFailureDo: [:p | 'the proxy that failed was ', p printString]"
On 12-Aug-06, at 1:29 PM, stéphane ducasse wrote:
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby.
But..... we've been able to start the system with a commandline argument for a script filename for nearly ten years now. If all you need to add is printing some result to stdout and if simply opening the file and writing to it won't work then just make a trivial stdPlugin.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RCM: Randomly Corrupt Microcode
On 12 août 06, at 23:42, tim Rowledge wrote:
On 12-Aug-06, at 1:29 PM, stéphane ducasse wrote:
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby.
But..... we've been able to start the system with a commandline argument for a script filename for nearly ten years now. If all you need to add is printing some result to stdout and if simply opening the file and writing to it won't work then just make a trivial stdPlugin.
Yes but I do not know how to do it and I think that it would be ****really**** important to have that per default and also on most of the platforms.
Stef
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RCM: Randomly Corrupt Microcode
stéphane ducasse ducasse@iam.unibe.ch writes:
Yes but I do not know how to do it and I think that it would be ****really**** important to have that per default and also on most of the platforms.
It would be nice. While these things might be easy for experienced people, they are real nuisance for newbies. Why not go ahead and set all this up so that new users can Just Do It ?
By the way, another thing you want to do is make errors print stack traces and compile errors on stdout and/or a log file, when the image is in script-running mode. Otherwise, whenever there is an error, the user will see nothing happen except that Squeak freezes!
-Lex
tim Rowledge wrote:
On 12-Aug-06, at 1:29 PM, stéphane ducasse wrote:
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby.
But..... we've been able to start the system with a commandline argument for a script filename for nearly ten years now. If all you need to add is printing some result to stdout and if simply opening the file and writing to it won't work then just make a trivial stdPlugin.
What for? Just FFI printf() and friends.
Cheers, - Andreas
On 15 août 06, at 01:57, Andreas Raab wrote:
tim Rowledge wrote:
On 12-Aug-06, at 1:29 PM, stéphane ducasse wrote:
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby.
But..... we've been able to start the system with a commandline argument for a script filename for nearly ten years now. If all you need to add is printing some result to stdout and if simply opening the file and writing to it won't work then just make a trivial stdPlugin.
What for? Just FFI printf() and friends.
How do I do that?
Stef
Cheers,
- Andreas
stéphane ducasse wrote:
What for? Just FFI printf() and friends.
How do I do that?
Something like here:
puts: aString <cdecl: void 'puts' (char*)> ^self externalCallFailed
printf() itself is more complex since it's a varargs call and we don't support that out of the box.
Cheers, - Andreas
On 15 août 06, at 19:17, Andreas Raab wrote:
puts: aString <cdecl: void 'puts' (char*)> ^self externalCallFailed
I tried to compile that in 3.9 but it did not work
I tried
puts: aString <cdecl: void 'puts (char*)'> ^self externalCallFailed
Bu then should I define a C file and compile it somewhere?
Stef
HAHAHAHAH!!!
Ron
-----Original Message----- From: squeak-dev-bounces@lists.squeakfoundation.org [mailto:squeak-dev- bounces@lists.squeakfoundation.org] On Behalf Of Andreas Raab Sent: Tuesday, August 15, 2006 8:46 PM To: The general-purpose Squeak developers list Subject: Re: About using squeak to script...
stéphane ducasse wrote:
puts: aString <cdecl: void 'puts' (char*)> ^self externalCallFailed
I tried to compile that in 3.9 but it did not work
Needless to say that you *do* need to install the FFI for this to work ;-)
Cheers,
- Andreas
On 16 août 06, at 02:46, Andreas Raab wrote:
stéphane ducasse wrote:
puts: aString <cdecl: void 'puts' (char*)> ^self externalCallFailed
I tried to compile that in 3.9 but it did not work
Needless to say that you *do* need to install the FFI for this to work ;-)
:) indeed I tried in only image where FFI was removed.
Il giorno sab, 12/08/2006 alle 22.29 +0200, stéphane ducasse ha scritto:
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby. So OSProcees seems good for my goal. I will wrap it into Stdoutput to have the same as in VW :) and play with it.
If you're on a Unix system, you should be able to use a WriteStream on the special dev file /dev/stdout.
Giovanni
On 8/16/06, Giovanni Corriga giovanni@corriga.net wrote:
If you're on a Unix system, you should be able to use a WriteStream on the special dev file /dev/stdout.
Indeed it works : FileStream fileNamed: '/dev/stdout' do: [:stdout | stdout nextPutAll: 'hello outside']
On mac I had to run squeak from a command-line by running this: /Developer/Applications/Squeak/Squeak\ 3.8.12beta4U.app/Contents/MacOS/Squeak\ VM\ Opt /Developer/Applications/Squeak/3.9/base3.9g-7054.image
But that could be wrapped in a script or maybe using the unix VM.
On 8/20/06, Damien Pollet damien.pollet@gmail.com wrote:
On mac I had to run squeak from a command-line by running this:
I had to do that to see the output... I thought it would go to system.log or console.log (visible using Console.app or a good ol' tail -f) but apparently running apps by double-clicking them is not exactly the same as executing the binary from a shell...
Am 20.08.2006 um 18:52 schrieb Damien Pollet:
On 8/20/06, Damien Pollet damien.pollet@gmail.com wrote:
On mac I had to run squeak from a command-line by running this:
I had to do that to see the output... I thought it would go to system.log or console.log (visible using Console.app or a good ol' tail -f) but apparently running apps by double-clicking them is not exactly the same as executing the binary from a shell...
On OS X 10.4 you can use either Console.app or
tail -f /Library/Logs/Console/`id -u`/console.log
This returns nil for me (might ask John, why)
FileStream fileNamed: '/dev/stdout'
but this works (on the class-side of class StdOut):
puts: aString <cdecl: void 'puts' (char*) module: 'libSystem.dylib'> ^ExternalFunction externalCallFailed
then
StdOut puts: 'Hello World'
- Bert -
Thanks bert! I think that this is the kind of features that could bring a lot of scripters to squeak.
On OS X 10.4 you can use either Console.app or
tail -f /Library/Logs/Console/`id -u`/console.log
This returns nil for me (might ask John, why)
FileStream fileNamed: '/dev/stdout'
but this works (on the class-side of class StdOut):
puts: aString <cdecl: void 'puts' (char*) module: 'libSystem.dylib'> ^ExternalFunction externalCallFailed
then
StdOut puts: 'Hello World'
- Bert -
2006/8/20, Bert Freudenberg bert@impara.de:
Am 20.08.2006 um 18:52 schrieb Damien Pollet:
On 8/20/06, Damien Pollet damien.pollet@gmail.com wrote:
On mac I had to run squeak from a command-line by running this:
I had to do that to see the output... I thought it would go to system.log or console.log (visible using Console.app or a good ol' tail -f) but apparently running apps by double-clicking them is not exactly the same as executing the binary from a shell...
On OS X 10.4 you can use either Console.app or
tail -f /Library/Logs/Console/`id -u`/console.log
This returns nil for me (might ask John, why)
FileStream fileNamed: '/dev/stdout'
but this works (on the class-side of class StdOut):
puts: aString <cdecl: void 'puts' (char*) module: 'libSystem.dylib'> ^ExternalFunction externalCallFailed
then
StdOut puts: 'Hello World'
- Bert -
Hi Bert,
Do you have an idea how can I do it on windows?
Thanks
Math
Mathieu SUEN wrote:
2006/8/20, Bert Freudenberg bert@impara.de:
Am 20.08.2006 um 18:52 schrieb Damien Pollet:
On 8/20/06, Damien Pollet damien.pollet@gmail.com wrote:
On mac I had to run squeak from a command-line by running this:
I had to do that to see the output... I thought it would go to system.log or console.log (visible using Console.app or a good ol' tail -f) but apparently running apps by double-clicking them is not exactly the same as executing the binary from a shell...
On OS X 10.4 you can use either Console.app or
tail -f /Library/Logs/Console/`id -u`/console.log
This returns nil for me (might ask John, why)
FileStream fileNamed: '/dev/stdout'
but this works (on the class-side of class StdOut):
puts: aString <cdecl: void 'puts' (char*) module: 'libSystem.dylib'> ^ExternalFunction externalCallFailed
then
StdOut puts: 'Hello World'
- Bert -
Hi Bert,
Do you have an idea how can I do it on windows?
Thanks
Math
Upgrade to Linux.
- Bert -
Hi Bert,
Do you have an idea how can I do it on windows?
Thanks
Math
Upgrade to Linux.
- Bert -
NOOOOOOOO!!!!!!!!!!!
LINUX IS AWFUL. AWFUL AWFUL AWFUL AWFUL
YOU CAN'T HARDLY DO ANYTHING ON LINUX WITHOUT CRASHING THE FLAMING MACHINE. EVERYONE WHO SAYS OTHERWISE IS A LIAR. THEY WILL PROTEST LOUDLY THAT LINUX IS STABLE AND 'HAS NEVER CRASHED FOR THEM' BUT THEY LIE. IT IS AN OCEAN OF UNMITIGATED SUCKEYNESS.
I HAVN'T BEEN ABLE TO WORK ON CROQUET FOR AGES NOW.
LINUX HAS DRIVEN ME INSANE!!!
WHATEVER YOU DO, STAY WITH WINDOWS. BILL GATES IS A HERO!!!
Alan Grimes a écrit :
Hi Bert,
Do you have an idea how can I do it on windows?
Thanks
Math
Upgrade to Linux.
- Bert -
NOOOOOOOO!!!!!!!!!!!
LINUX IS AWFUL. AWFUL AWFUL AWFUL AWFUL
YOU CAN'T HARDLY DO ANYTHING ON LINUX WITHOUT CRASHING THE FLAMING MACHINE. EVERYONE WHO SAYS OTHERWISE IS A LIAR. THEY WILL PROTEST LOUDLY THAT LINUX IS STABLE AND 'HAS NEVER CRASHED FOR THEM' BUT THEY LIE. IT IS AN OCEAN OF UNMITIGATED SUCKEYNESS.
I HAVN'T BEEN ABLE TO WORK ON CROQUET FOR AGES NOW.
LINUX HAS DRIVEN ME INSANE!!!
WHATEVER YOU DO, STAY WITH WINDOWS. BILL GATES IS A HERO!!!
I see I think the most difficlut problem is version number and that why it make things crach.
(Build the package 3.4.876.2 whith gcc 3.5.12-4 with the kernel 2.6.11-4 and the module a-v3.56.4 on fedora core 4 and don't forget to use python 2.3.5 but you want to use a other cool package but it don't work with kernel 2.6.11 and you try to load but.....biiiiiiiiip your a dead)
By the way take a look also to F-Script, a scripting engine for Mac OS X. It is a Smalltalk-like scripting engine and I find it very cool, with some unique feature like message boradcasting: http://www.oreillynet.com/pub/a/mac/2001/11/30/scripting_fscript.html Bye bye
On 8/16/06, Giovanni Corriga giovanni@corriga.net wrote:
Il giorno sab, 12/08/2006 alle 22.29 +0200, stéphane ducasse ha scritto:
For the moment I would like to have the possibility to launch the vm with a script and see the results on the command line like ruby. So OSProcees seems good for my goal. I will wrap it into Stdoutput to have the same as in VW :) and play with it.
If you're on a Unix system, you should be able to use a WriteStream on the special dev file /dev/stdout.
Giovanni
On 8/22/06, Giovanni Giorgi daitangio@gmail.com wrote:
By the way take a look also to F-Script,
I've had it installed for ages, but not doing as much cocoa development as I'd like, I probably launched it for the third time today :)
I quickly parsed the documentation, but didn't find if FScript can declare methods of his own and how... is it done in the browser ? If yes the problem is that the "message pattern+ body expression" syntax isn't practical when there sould be several method declarations in a single chunk of text...
Philippe is working on that so that you can add class and methods. So far if I remember correctly you can only define script.
I guess that this is the same that the pepsi syntax [
] On 23 août 06, at 12:11, Damien Pollet wrote:
On 8/22/06, Giovanni Giorgi daitangio@gmail.com wrote:
By the way take a look also to F-Script,
I've had it installed for ages, but not doing as much cocoa development as I'd like, I probably launched it for the third time today :)
I quickly parsed the documentation, but didn't find if FScript can declare methods of his own and how... is it done in the browser ? If yes the problem is that the "message pattern+ body expression" syntax isn't practical when there sould be several method declarations in a single chunk of text...
-- Damien Pollet type less, do more
squeak-dev@lists.squeakfoundation.org