Hello:
I just try to get started with Pharo to experiment with some benchmarks and would be grateful for some basic hints, since the documentation on pharo-project.org is not to excessive. As far as I read in the documentation of the language shootout[1], I will need the OSProcess package. How can I load this package into the image downloaded from p-p.org? My second problem is to execute code from the command line. I tried a simple example file $ cat test.sq Transcript open; cr; show: 'Hello, world'. $ Squeak\ 4.2.1beta1U.app/Contents/MacOS/Squeak\ VM\ Opt pharo1.0-10418-BETAdev09.08.3.image test.sq But this only leads to a debugger popping up in installSourceFile saying "No content to install". Looks like aStream is nil which should have the data loaded from file:test.sq Any pointers to documentation which might discusses command line related features are very welcome. I actually just need a way to choose a benchmark to be executed from the commandline. The actual code could already be in the image. Many thanks and best regards Stefan [1] http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=squeak&lang2=squeak -- Stefan Marr Software Languages Lab Former Programming Technology Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://prog.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525 -- Stefan Marr Software Languages Lab Former Programming Technology Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://prog.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525 _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Hi,
On Mon, Aug 31, 2009 at 10:46 PM, Stefan Marr<[hidden email]> wrote: > I just try to get started with Pharo to experiment with some > benchmarks and would be grateful for some basic hints, since the > documentation on pharo-project.org is not to excessive. I agree. Please help, we need you > As far as I read in the documentation of the language shootout[1], I > will need the OSProcess package. > > How can I load this package into the image downloaded from p-p.org? ScriptLoader loadLatestPackage: 'OSProcess' from: 'http://www.squeaksource.com/OSProcess' > My second problem is to execute code from the command line. > I tried a simple example file > $ cat test.sq > Transcript open; cr; show: 'Hello, world'. By convention, Smalltalk scripts extension is '.st' and not '.sq'. But that shouldn't change anything. > $ Squeak\ 4.2.1beta1U.app/Contents/MacOS/Squeak\ VM\ Opt pharo1.0-10418-BETAdev09.08.3.image test.sq You have to pass the full path to the script file. Try something like: $ Squeak\ 4.2.1beta1U.app/Contents/MacOS/Squeak\ VM\ Opt pharo1.0-10418-BETAdev09.08.3.image $PWD/test.sq -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
> I agree. Please help, we need you
Well... > ScriptLoader loadLatestPackage: 'OSProcess' from: > 'http://www.squeaksource.com/OSProcess' > > By convention, Smalltalk scripts extension is '.st' and not '.sq'. But > that shouldn't change anything. > > You have to pass the full path to the script file. Try something like: > > $ Squeak\ 4.2.1beta1U.app/Contents/MacOS/Squeak\ VM\ Opt > pharo1.0-10418-BETAdev09.08.3.image $PWD/test.sq perspective. However as a thank you and for my own records, a small tutorial for your google code wiki: =Command-line Scripts with a Headless Pharo= For some tasks like benchmarking and automated testing, an integration with other tools comes in handy. For such use cases, Pharo can be used headless, i.e., without its graphical user interface. This brief tutorial will demonstrate how to use the Debian Language Shootout benchmarks with a fresh Pharo image. ==Step 1: Setup Pharo and a Fresh Image== * download a Pharo image, the sources file, and a VM from the [http://www.pharo-project.org/pharo-download download page] * extract all archives in the same folder * start Pharo, from the commandline, on a MacOSX it should look like this: {{{ "Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \ pharo1.0-10418-BETAdev09.08.3.image }}} ==Step 2: Load OSProcess== For output on the shell, we need an extra package from the SqueakSource repository. It can be loaded by simply executing the following code in a workspace window: {{{ ScriptLoader loadLatestPackage: 'OSProcess' from: 'http://www.squeaksource.com/OSProcess' }}} To execute this code snippet, select it and press cmd+d or use the "do it" item in the context menu. ==Step 3: Load Common Benchmark Code== Now we can load the common parts of all shootout benchmarks into our image. * On way to do this is to grab the code shown [http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=squeak&lang2=squeak here ] and save it to a file called `common.st`. * Open the file browser from the Menu -> Tools -> File Browser. * Select `common.st` and press `filein` to load the code. Now you can close all windows in your image and save and quit it. ==Step 4: Run a Benchmark== * Grab the code of a benchmark like [http://shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&lang=squeak&id=1 Fannkuch ] * Save it to a file named like `fannkuch.st` * Add a run script to the end of the code in `fannkuch.st`, like this: {{{ Tests fannkuch. SmalltalkImage current snapshot: false andQuit: true. }}} * Run it with a headless Pharo: {{{ "Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \ -headless pharo1.0-10418-BETAdev09.08.3.image \ $PWD/fannkuch.st 6 }}} Best regards Stefan > > > -- > Damien Cassou > http://damiencassou.seasidehosting.st > > "Lambdas are relegated to relative obscurity until Java makes them > popular by not having them." James Iry > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- Stefan Marr Software Languages Lab Former Programming Technology Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://prog.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525 _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
>>
> The full path requirement should be considered a bug from my > perspective. mine too and I thought that john fixed that. So did you try without? > However as a thank you and for my own records, a small tutorial for > your google code wiki: GREAT! > =Command-line Scripts with a Headless Pharo= > > For some tasks like benchmarking and automated testing, an integration > with other tools comes in handy. > For such use cases, Pharo can be used headless, i.e., without its > graphical > user interface. > > This brief tutorial will demonstrate how to use the Debian Language > Shootout > benchmarks with a fresh Pharo image. > > ==Step 1: Setup Pharo and a Fresh Image== > > * download a Pharo image, the sources file, and a VM from the > [http://www.pharo-project.org/pharo-download download page] > * extract all archives in the same folder > * start Pharo, from the commandline, on a MacOSX it should look > like this: > {{{ > "Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \ > pharo1.0-10418-BETAdev09.08.3.image > }}} > > ==Step 2: Load OSProcess== > > For output on the shell, we need an extra package from the > SqueakSource > repository. > > It can be loaded by simply executing the following code in a workspace > window: > > {{{ > ScriptLoader loadLatestPackage: 'OSProcess' from: > 'http://www.squeaksource.com/OSProcess' > }}} > > To execute this code snippet, select it and press cmd+d or use the "do > it" > item in the context menu. > > ==Step 3: Load Common Benchmark Code== > > Now we can load the common parts of all shootout benchmarks into our > image. > > * On way to do this is to grab the code shown [http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=squeak&lang2=squeak > here > ] > and save it to a file called `common.st`. > * Open the file browser from the Menu -> Tools -> File Browser. > * Select `common.st` and press `filein` to load the code. > > Now you can close all windows in your image and save and quit it. > > ==Step 4: Run a Benchmark== > > * Grab the code of a benchmark like [http://shootout.alioth.debian.org/gp4/benchmark.php?test=fannkuch&lang=squeak&id=1 > Fannkuch > ] > * Save it to a file named like `fannkuch.st` > * Add a run script to the end of the code in `fannkuch.st`, like > this: > {{{ > Tests fannkuch. > SmalltalkImage current snapshot: false andQuit: true. > }}} > * Run it with a headless Pharo: > {{{ > "Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \ > -headless pharo1.0-10418-BETAdev09.08.3.image \ > $PWD/fannkuch.st 6 > }}} > > > Best regards > Stefan > > > >> >> >> -- >> Damien Cassou >> http://damiencassou.seasidehosting.st >> >> "Lambdas are relegated to relative obscurity until Java makes them >> popular by not having them." James Iry >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > -- > Stefan Marr > Software Languages Lab > Former Programming Technology Lab > Vrije Universiteit Brussel > Pleinlaan 2 / B-1050 Brussels / Belgium > http://prog.vub.ac.be/~smarr > Phone: +32 2 629 3956 > Fax: +32 2 629 3525 > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
I think here you are trying to get to test.sq
I only adjust the incoming image name in the VM looking for ~ for example, and resolving usage of ./ and ../ The additional command line items are then passed to the image unchanged, so it sees only 'test.sq' as the path name. You would have to check the smalltalk code at the point where it gets the command line parm and decide if it's 'test.sq' should that really be './test.sq' You might also try putting './test.sq' on the command line and see if that works. On 2-Sep-09, at 9:23 AM, Stéphane Ducasse wrote: >>> >> The full path requirement should be considered a bug from my >> perspective. > > mine too and I thought that john fixed that. > So did you try without? -- = = = ======================================================================== John M. McIntosh <[hidden email]> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com = = = ======================================================================== _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Stéphane Ducasse
Hi:
On 02 Sep 2009, at 09:23, Stéphane Ducasse wrote: >>> >> The full path requirement should be considered a bug from my >> perspective. > > mine too and I thought that john fixed that. > So did you try without? Even after doing a System->Software Update I need to give the absolute path. This is tested with * Squeak 4.2.1beta1U.app * and pharo1.0-10418-BETAdev09.08.3.image Best regards Stefan _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by johnmci
Ok I will have a look to see how this can be fixed.
On Sep 2, 2009, at 9:43 AM, John M McIntosh wrote: > I think here you are trying to get to test.sq > > I only adjust the incoming image name in the VM looking for ~ for > example, and resolving usage of ./ and ../ > > The additional command line items are then passed to the image > unchanged, so it sees only 'test.sq' as the path name. > You would have to check the smalltalk code at the point where it gets > the command line parm and decide if it's 'test.sq' should that really > be './test.sq' > You might also try putting './test.sq' on the command line and see if > that works. > > > On 2-Sep-09, at 9:23 AM, Stéphane Ducasse wrote: > >>>> >>> The full path requirement should be considered a bug from my >>> perspective. >> >> mine too and I thought that john fixed that. >> So did you try without? > > -- > = > = > = > = > = > ====================================================================== > John M. McIntosh <[hidden email]> Twitter: > squeaker68882 > Corporate Smalltalk Consulting Ltd. http:// > www.smalltalkconsulting.com > = > = > = > = > = > ====================================================================== > > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Stefan Marr-4
Hi Stefan,
On Tue, Sep 1, 2009 at 8:38 PM, Stefan Marr<[hidden email]> wrote: > However as a thank you and for my own records, a small tutorial for > your google code wiki: I've put your text to http://code.google.com/p/pharo/wiki/CommandLine. Thank you very much -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by johnmci
The problem with command-line arguments as a file names, like:
cat myfile.foo is that the location of myfile.foo is determined by using a search path , usually provided in environment PATH var of a shell. I worked in a different unix shells, and some of them, do not adding/using the ./ into the search path by default, which means that cat myfile.foo will end up with 'file not found' message, while cat ./myfile.foo will work fine. i think that squeak should follow the shell semantics and do not try to automatically expand the pure file name, like foo.bar into something like: ./foo.bar, or ~/foo.bar 2009/9/2 John M McIntosh <[hidden email]>: > I think here you are trying to get to test.sq > > I only adjust the incoming image name in the VM looking for ~ for > example, and resolving usage of ./ and ../ > > The additional command line items are then passed to the image > unchanged, so it sees only 'test.sq' as the path name. > You would have to check the smalltalk code at the point where it gets > the command line parm and decide if it's 'test.sq' should that really > be './test.sq' > You might also try putting './test.sq' on the command line and see if > that works. > > > On 2-Sep-09, at 9:23 AM, Stéphane Ducasse wrote: > >>>> >>> The full path requirement should be considered a bug from my >>> perspective. >> >> mine too and I thought that john fixed that. >> So did you try without? > > -- > = > = > = > ======================================================================== > John M. McIntosh <[hidden email]> Twitter: > squeaker68882 > Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com > = > = > = > ======================================================================== > > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
See class ShellSyntax in package CommandShell (be sure to load the
unit tests also). The class comment for ShellSyntax is: My instances implement parsing of strings in a manner similar to a simple Unix command shell. I provide path name expansion in the context of an external file system, and support the syntax required for IO redirection. All file name globbing and PATH searching are implemented in Smalltalk rather than in C library functions or an external command shell. Most of my syntax is applicable for any operating system. Where needed, platform specific methods are in my "platform dependent" category. Currently, Unix and Windows are supported, and other platforms have not been tested. The primary difference between Unix and Windows support is that device names (such as 'C:') are used in Windows path strings. Separate current working directory strings are maintained for all Windows device names. For Unix, a single current working directory path is used. On Windows, this permits the CommandShell 'cd' command to support changing directories to another device without losing track of the current working directory for the previous device. Command pipeline syntax is not supported here. See CommandShell for the implementation of command pipelines. Dave On Mon, Sep 07, 2009 at 08:54:18AM -0700, Igor Stasenko wrote: > The problem with command-line arguments as a file names, like: > > cat myfile.foo > > is that the location of myfile.foo is determined by using a search > path , usually provided in environment PATH var of a shell. > > I worked in a different unix shells, and some of them, do not > adding/using the ./ into the search path by default, which means > that > cat myfile.foo > will end up with 'file not found' message, > while > cat ./myfile.foo > will work fine. > > i think that squeak should follow the shell semantics and do not try > to automatically expand the pure file name, like > foo.bar into something like: ./foo.bar, or ~/foo.bar > > 2009/9/2 John M McIntosh <[hidden email]>: > > I think ??here you are trying to get to test.sq > > > > I only adjust the incoming image name in the VM looking for ~ for > > example, and resolving usage of ./ and ../ > > > > The additional command line items are then passed to the image > > unchanged, so it sees only 'test.sq' ??as the path name. > > You would have to check the smalltalk code at the point where it gets > > the command line parm and decide if it's 'test.sq' should that really > > be './test.sq' > > You might also try putting './test.sq' on the command line and see if > > that works. > > > > > > On 2-Sep-09, at 9:23 AM, St??phane Ducasse wrote: > > > >>>> > >>> The full path requirement should be considered a bug from my > >>> perspective. > >> > >> mine too and I thought that john fixed that. > >> So did you try without? > > > > -- > > = > > = > > = > > ======================================================================== > > John M. McIntosh <[hidden email]> ?? Twitter: > > squeaker68882 > > Corporate Smalltalk Consulting Ltd. ??http://www.smalltalkconsulting.com > > = > > = > > = > > ======================================================================== > > > > > > > > > > > > _______________________________________________ > > Pharo-project mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > > > > -- > Best regards, > Igor Stasenko AKA sig. > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Igor Stasenko
On Tue, Sep 8, 2009 at 1:54 AM, Igor Stasenko<[hidden email]> wrote:
> The problem with command-line arguments as a file names, like: > > cat myfile.foo > > is that the location of myfile.foo is determined by using a search > path , usually provided in environment PATH var of a shell. That's not actually true - the location is always relative to the current working directory. PATH is only used to locate _executables_ to be run, and is not used for finding command line options. > I worked in a different unix shells, and some of them, do not > adding/using the ./ into the search path by default, which means > that > cat myfile.foo > will end up with 'file not found' message, > while > cat ./myfile.foo > will work fine. On which shells do you see this behaviour? I think you may be confusing it with the fact that: myscript.sh myfile.foo won't work, but ./myscript.sh myfile.foo will - which is indeed because '.' is never in PATH. However, it won't make any difference to the ability of the program to locate "myfile.foo". The shell actually plays no part in locating a file specified as an argument on the command line, it's entirely up to the program using that command line how it will handle it. But on all Unix like platforms I've seen, if you pass simply "myfile.foo" to fopen(), it will look for the file in and only in the current working directory of the process. What can confuse the situation is if something changes the current working directory between the user passing in the argument, and the fopen() call being made. This might happen if for example, the command the user executed was actually a wrapper script that cd'd to another directory before running the actual command. (Though such a wrapper script, particularly for a program that did in fact expect files to be passed in on the command line, is arguably broken) Regards, Stuart _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Stefan Marr-4
* Run it with a headless Pharo: {{{ "Squeak 4.2.1beta1U.app/Contents/MacOS/Squeak VM Opt" \ -headless pharo1.0-10418-BETAdev09.08.3.image \ $PWD/fannkuch.st 6 }}} I'm wondering what the 6 does here? |
On Thu, Dec 2, 2010 at 8:30 AM, HwaJong Oh <[hidden email]> wrote:
Provides teh argument 6, which is input to the fannkuch benchmark, no? I'm wondering if anyone has the sources to fannkuch and any other of the c.l.s. benchmarks to hand. If you do please send me an archive. Thanks.
(Yes, I know I can get these form the site, but I'm assuming you've ported them to the current stdio facilities) -- |
Free forum by Nabble | Edit this page |