[Pharo-project] Launching class form command line ...
Hi All, How does Pharo execute classes from the command line? Is there a way to specify the class and the method to be called? Are command line arguments available? I want to put the same mechanism in Redline Smalltalk. Rgs, James.
How does Pharo execute classes from the command line?
You can pass the filename of a .cs/.st file to the VM that gets filed-in on startup.
Is there a way to specify the class and the method to be called?
Not directly.
Are command line arguments available?
$ squeak --help Usage: squeak [<option>...] [<imageName> [<argument>...]] squeak [<option>...] -- [<argument>...] FBDev <option>s: -fbdev <dev> use framebuffer device <dev> (default: /dev/fb) -kbmap <file> load keymap from <file> (default: use kernel keymap) -msdev <dev> use mouse device <dev> (default: /dev/psaux) -msproto <protocol> use the given <protocol> for the mouse (default: ps2) -vtlock disallow all vt switching (for any reason) -vtswitch enable keyboard vt switching (Alt+FNx) Common <option>s: -encoding <enc> set the internal character encoding (default: MacRoman) -help print this help message, then exit -memory <size>[mk] use fixed heap size (added to image size) -mmap <size>[mk] limit dynamic heap size (default: 1024m) -noevents disable event-driven input support -notimer disable interval timer for low-res clock -pathenc <enc> set encoding for pathnames (default: UTF-8) -plugins <path> specify alternative plugin location (see manpage) -textenc <enc> set encoding for external text (default: UTF-8) -version print version information, then exit -vm-<sys>-<dev> use the <dev> driver for <sys> (see below) Deprecated: -display <dpy> quivalent to '-vm-display-X11 -display <dpy>' -headless quivalent to '-vm-display-X11 -headless' -nodisplay quivalent to '-vm-display-null' -nosound quivalent to '-vm-sound-null' -quartz quivalent to '-vm-display-Quartz' Notes: <imageName> defaults to `squeak.image'. -vtlock disables keyboard vt switching even when -vtswitch is enabled If `-memory' is not specified then the heap will grow dynamically. <argument>s are ignored, but are processed by the Squeak image. The first <argument> normally names a Squeak `script' to execute. Precede <arguments> by `--' to use default image. Available drivers: vm-sound-null vm-sound-custom vm-display-custom vm-display-null vm-display-fbdev -- Lukas Renggli www.lukas-renggli.ch
On Sep 21, 2010, at 8:16 53AM, Lukas Renggli wrote:
How does Pharo execute classes from the command line?
You can pass the filename of a .cs/.st file to the VM that gets filed-in on startup.
Is there a way to specify the class and the method to be called?
Not directly.
Are command line arguments available?
$ squeak --help Usage: squeak [<option>...] [<imageName> [<argument>...]] squeak [<option>...] -- [<argument>...]
BTW, dunno if it's a crossplatform Cog issue ( haven't checked others) but in John's new OSX Cog-based VMs (last tested 5.8b9), it doesn't look like the arguments are present in systemAttributes at position 2 onwards. Thus, ProjectLauncher will fail to execute scripts at all. In -help:
-encoding <enc> set the internal character encoding (default: MacRoman)
Sounds strangel, should probably be updated to Latin1/ removed (depending on how it's actually used)? Also, nonrelated to the VM, the comment in SmalltalkImage>>#documentPath seems misleading (not to mention the method name itself), there seems to be no conversion by the vm to absolute path going on in neither OSX nor Windows, the string is passed through raw. This is reinforced by the --help mentioning:
The first <argument> _normally_ names a Squeak `script' to execute.
Cheers, Henry
2010/9/21 Henrik Johansen <henrik.s.johansen@veloxit.no>:
On Sep 21, 2010, at 8:16 53AM, Lukas Renggli wrote:
How does Pharo execute classes from the command line?
You can pass the filename of a .cs/.st file to the VM that gets filed-in on startup.
Is there a way to specify the class and the method to be called?
Not directly.
Are command line arguments available?
$ squeak --help Usage: squeak [<option>...] [<imageName> [<argument>...]] Â Â Â squeak [<option>...] -- [<argument>...]
BTW, dunno if it's a crossplatform Cog issue ( haven't checked others) but in John's new OSX Cog-based VMs (last tested 5.8b9), it doesn't look like the arguments are present in systemAttributes at position 2 onwards. Thus, ProjectLauncher will fail to execute scripts at all.
In -help:
 -encoding <enc>    set the internal character encoding (default: MacRoman)
Sounds strangel, should probably be updated to Latin1/ removed (depending on how it's actually used)?
I bet less than 1 out of 1000 machines running squeak shall use this MacRoman thing nowadays. Nicolas
Also, nonrelated to the VM, the comment in SmalltalkImage>>#documentPath  seems misleading (not to mention the method name itself), there seems to be no conversion by the vm to absolute path going on in neither OSX nor Windows, the string is passed through raw. This is reinforced by the --help mentioning:
The first <argument> _normally_ names a Squeak `script' to execute.
Cheers, Henry
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On Sep 21, 2010, at 4:21 22PM, Nicolas Cellier wrote:
2010/9/21 Henrik Johansen <henrik.s.johansen@veloxit.no>:
On Sep 21, 2010, at 8:16 53AM, Lukas Renggli wrote:
How does Pharo execute classes from the command line?
You can pass the filename of a .cs/.st file to the VM that gets filed-in on startup.
Is there a way to specify the class and the method to be called?
Not directly.
Are command line arguments available?
$ squeak --help Usage: squeak [<option>...] [<imageName> [<argument>...]] squeak [<option>...] -- [<argument>...]
BTW, dunno if it's a crossplatform Cog issue ( haven't checked others) but in John's new OSX Cog-based VMs (last tested 5.8b9), it doesn't look like the arguments are present in systemAttributes at position 2 onwards. Thus, ProjectLauncher will fail to execute scripts at all.
In -help:
-encoding <enc> set the internal character encoding (default: MacRoman)
Sounds strangel, should probably be updated to Latin1/ removed (depending on how it's actually used)?
I bet less than 1 out of 1000 machines running squeak shall use this MacRoman thing nowadays.
Nicolas
Just ran -help on 5.2.5 and 5.8b9, the -encoding option is not mentioned in any of those. The only current use case I could think of would be Cuis, who might want to set it to Latin15 in order to interpret ⬠correctly. Sure, the StrikeFonts (taken from Cuis) included in Pharo/Squeak actually cover Latin15 as well, but everywhere else, encoding of ByteStrings is assumed to be Latin1... So better with some visual discrepancies, namely displaying ¤ as â¬, ⬠as ?, etc. than reading/writing the wrong characters to/from external sources Cheers, Henry
On Tue, Sep 21, 2010 at 04:44:19PM +0200, Henrik Johansen wrote:
On Sep 21, 2010, at 4:21 22PM, Nicolas Cellier wrote:
2010/9/21 Henrik Johansen <henrik.s.johansen@veloxit.no>:
On Sep 21, 2010, at 8:16 53AM, Lukas Renggli wrote:
How does Pharo execute classes from the command line?
You can pass the filename of a .cs/.st file to the VM that gets filed-in on startup.
Is there a way to specify the class and the method to be called?
Not directly.
Are command line arguments available?
$ squeak --help Usage: squeak [<option>...] [<imageName> [<argument>...]] squeak [<option>...] -- [<argument>...]
BTW, dunno if it's a crossplatform Cog issue ( haven't checked others) but in John's new OSX Cog-based VMs (last tested 5.8b9), it doesn't look like the arguments are present in systemAttributes at position 2 onwards. Thus, ProjectLauncher will fail to execute scripts at all.
In -help:
-encoding <enc> set the internal character encoding (default: MacRoman)
Sounds strangel, should probably be updated to Latin1/ removed (depending on how it's actually used)?
I bet less than 1 out of 1000 machines running squeak shall use this MacRoman thing nowadays.
Nicolas
Just ran -help on 5.2.5 and 5.8b9, the -encoding option is not mentioned in any of those.
The only current use case I could think of would be Cuis, who might want to set it to Latin15 in order to interpret ? correctly. Sure, the StrikeFonts (taken from Cuis) included in Pharo/Squeak actually cover Latin15 as well, but everywhere else, encoding of ByteStrings is assumed to be Latin1... So better with some visual discrepancies, namely displaying ? as ?, ? as ?, etc. than reading/writing the wrong characters to/from external sources
Regarding command line arguments available to the image, see #getSystemAttribute: Squeak has #argumentAt: for getting command line options passed to the image. This is no longer present in Pharo, but the implementation is just this: argumentAt: i "Answer the i-th argument of the command line, or nil if not so many argument." ^self getSystemAttribute: 2 + i Dave
participants (5)
-
David T. Lewis -
Henrik Johansen -
James Ladd -
Lukas Renggli -
Nicolas Cellier