Hi,
Using latest SVN Squeak, I'm having trouble passing arguments to an image. As far as I can see from the usage, it looks like "squeak foo.image bar" should pass bar as an argument to the image. Instead, though, I get a load error (the problem seems to be that Squeak is trying to load the url "file:bar" using the CodeLoader). Is this a bug, or am I doing something wrong? Cheers, Patrick _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Thu, May 17, 2007 at 01:53:44AM -0700, Patrick Collison wrote:
> Hi, > > Using latest SVN Squeak, I'm having trouble passing arguments to an image. > > As far as I can see from the usage, it looks like "squeak foo.image > bar" should pass bar as an argument to the image. Instead, though, I > get a load error (the problem seems to be that Squeak is trying to > load the url "file:bar" using the CodeLoader). > > Is this a bug, or am I doing something wrong? Patrick, By convention, the first argument after the image name and any VM arguments is used to name a script file that is evaluated when the image starts. For most Squeak images, you give the name of the script file in the form of a fully qualified url such as 'file:///home/myaccount/mysqueakdir/myscript.st'. The script file can contain Smalltalk expressions in "bang format", the same format used for file-in and file-out. Thus you could have a script file called "myscript.st" containing a Smalltalk expression like this: "Smalltalk inspect ! " There is a preference setting that you can use to control this: help... -> preferences... -> general -> readDocumentAtStartup I am guessing that you are using a Unix VM; if so, there is a man page ("man squeak") that gives some explanation. Also, "squeak -h" will give some help, and there is a note at the bottom of the help output that says "The first <argument> normally names a Squeak `script' to execute." Dave _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Patrick Collison
On May 17, 2007, at 10:53 , Patrick Collison wrote:
> Hi, > > Using latest SVN Squeak, I'm having trouble passing arguments to an > image. > > As far as I can see from the usage, it looks like "squeak foo.image > bar" should pass bar as an argument to the image. Instead, though, I > get a load error (the problem seems to be that Squeak is trying to > load the url "file:bar" using the CodeLoader). The argument is passed into the image just fine. The active AutoStart launcher interprets the first argument as a script file and tells CodeLoader to load that file. If it is not there this fails of course. You can pass an empty argument as first option after the image name followed by your other arguments, or deactivate the launcher in your image. - Bert - _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by David T. Lewis
On 17/05/07, David T. Lewis <[hidden email]> wrote:
> There is a preference setting that you can use to control this: > help... -> preferences... -> general -> readDocumentAtStartup Ah, that's exactly what I was hoping to find. Thanks for your help. Patrick _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Bert Freudenberg
On Thursday 17 May 2007 4:38 pm, Bert Freudenberg wrote:
> You can pass an empty argument as first option after the image name > followed by your other arguments, or deactivate the launcher in your > image. squeak squeak.image /dev/null arg1 bag arg2 of arg3 of chips results in error[1]. But squeak squeak.image '' arg1 ..... and then printing "SmalltalkImage current extractParameters" gives: a Dictionary('ARG1'->'bag' 'ARG2'->'of' 'ARG3'->'chips' ) The first case fails because String>>unzipped doesn't check for isEmptyOrNil on self. With the patch: self isEmptyOrNil ifTrue: [^'']. the first line works as expected. Regards .. Subbu _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On May 17, 2007, at 14:45 , subbukk wrote: > On Thursday 17 May 2007 4:38 pm, Bert Freudenberg wrote: >> You can pass an empty argument as first option after the image name >> followed by your other arguments, or deactivate the launcher in your >> image. > squeak squeak.image /dev/null arg1 bag arg2 of arg3 of chips > results in error[1]. But > squeak squeak.image '' arg1 ..... > and then printing "SmalltalkImage current extractParameters" gives: > a Dictionary('ARG1'->'bag' 'ARG2'->'of' 'ARG3'->'chips' ) > > The first case fails because String>>unzipped doesn't check for > isEmptyOrNil > on self. With the patch: > self isEmptyOrNil ifTrue: [^'']. > > the first line works as expected. The first case should not fail silently. The error is on purpose (though it might be more meaningful). - Bert - _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Thursday 17 May 2007 6:23 pm, Bert Freudenberg wrote:
> The first case should not fail silently. The error is on purpose > (though it might be more meaningful). True. Gzip files always begin with 0x1f and 0x8b, but this pre-condition is not satisfied by all senders, so there must be a way to inform them about the error. It did seem weird that CodeLoader>>installSourceFile: aStream .. contents _ aStream ascii upToEnd unzipped. treats first argument as a *.st and then falls back to *.gz. Gzip files are easier to detect than *.st, so shouldn't the order be the other way around? BTW, is an empty file a valid *.st file (as a trivial case, of course)? filein and change browser handle it gracefully. Regards .. Subbu _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |