[ANN] DoItFirst command line goodie on SqueakSource

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] DoItFirst command line goodie on SqueakSource

marcel.taeumel
Hi Dave.

Thanks! Would you mind adding a page on wiki.squeak.org? :-)

Best,
Marcel

Am 08.12.2020 22:20:25 schrieb David T. Lewis <[hidden email]>:

On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
> This is great! +1 for adding this to trunk, leaving the when to Dave.
>

Done.

To see available command line options on a unix-like system:

$ squeak squeak.image -- -h
DoItFirst image arguments:
--doit argumentlist "evaluate each argument as a doIt expression"
--evaluate arg "evaluate arg, print result then exit"
--file filename "evaluate contents of filename, print result then exit"
--filein filelist "file in each file named in fileList"
--cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options"
--debug "enter a debugger as soon as possible in the startUp processing"
--help "print this message"
some arguments have single character synonyms, -f is a synonym for --file, -d for --doit
single '-' may be used instead of '--', -help is interpreted as --help

Dave



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] DoItFirst command line goodie on SqueakSource

David T. Lewis
On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
> Hi Dave.
>
> Thanks! Would you mind adding a page on wiki.squeak.org? :-)

Good idea, I will do this some time soon.

Dave


>
> Best,
> Marcel
> Am 08.12.2020 22:20:25 schrieb David T. Lewis <[hidden email]>:
> On Sat, Dec 05, 2020 at 09:33:26AM +0100, Fabio Niephaus wrote:
> > This is great! +1 for adding this to trunk, leaving the when to Dave.
> >
>
> Done.
>
> To see available command line options on a unix-like system:
>
> $ squeak squeak.image -- -h
> DoItFirst image arguments:
> --doit argumentlist "evaluate each argument as a doIt expression"
> --evaluate arg "evaluate arg, print result then exit"
> --file filename "evaluate contents of filename, print result then exit"
> --filein filelist "file in each file named in fileList"
> --cwd path "set FileDirectory defaultDirectory to path prior to evaluating other options"
> --debug "enter a debugger as soon as possible in the startUp processing"
> --help "print this message"
> some arguments have single character synonyms, -f is a synonym for --file, -d for --doit
> single '-' may be used instead of '--', -help is interpreted as --help
>
> Dave
>

>


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] DoItFirst command line goodie on SqueakSource

stes
In reply to this post by stes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


tim Rowledge wrote:
> I hope those are all useful things to learn;

Yes they are ... thanks for posting the Fibonacci category and script.

> the stdout thing may be an issue, at least for the 5.3 release image.

My personal impression is that the best way to run the Fibonacci program,
is through the "DoItFirst" package.

For example I tested both with a 5.3 and a 6.0alpha image:

 # pfexec squeak squeak.image InstallDoItFirst.st
 # pfexec squeak squeak.image -- -e 'Smalltalk version'
   Squeak5.3
 # pfexec squeak squeak.image -- --filein Fibonacci.st --evaluate '100 fibonacci'
   file in /export/home/stes/5.3/Fibonacci.st
   354224848179261915075

but the same result in 6.0alpha:

 # pfexec squeak squeak.image -- --filein Fibonacci.st -e '100 fibonacci'
   file in /export/home/stes/Fibonacci.st
   354224848179261915075
 # pfexec squeak squeak.image -- -e 'Smalltalk version'
   Squeak6.0alpha

This is with a recent Stack VM , version 5.0.2885 (from VMMaker-oscog-eem.2885)

Note that I use a "pfexec" (profile exec) to raise the privilege of the VM,
to be able to set priorities (proc_prioctrl privilege) just to suppress the
warning about pthread_setsched.

In any case as far as I can see the "DoItFirst" package is a convenient way,
to file in small pieces of code like the fibonacci method that you posted,
and then evaluate some code in a batch oriented command-line way.

David Stes

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJf0g/zAAoJEAwpOKXMq1MalvIIAIYz3bgTn5DX+tbUtFze/DyG
xSIHEVlVqvWf0idecCBmog9kufZzyiLE+G7+Ia7WK8bPVkyLMgqD6r1YRe46WeZT
O8a6w8sttMkqiCpbgBR9fUDhpc81ZGbm898e2PENNq/kAJNRBbFkdicA/S3yd6+R
mC75JasFRh+a4pEJsr9e8hc8sZoaCEyBSsE9DYptcxCd5ZHR7OYyO57clkfgVhY1
fnVclQNp5U4026+arthjeIShR0U7AlF5sJUZmlRlT7pUNaY9isVtLQ/jOz30ZL2e
/56soGHphRpTm97G8tV4mOgLAAp7V5rf2nn42fSFtzazHkwlmebsXbh5EdySreo=
=dc5v
-----END PGP SIGNATURE-----

Reply | Threaded
Open this post in threaded view
|

DoIfFirst command option processing documentation (was: [ANN] DoItFirst command line goodie on SqueakSource)

David T. Lewis
In reply to this post by marcel.taeumel
On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
> Hi Dave.
>
> Thanks! Would you mind adding a page on wiki.squeak.org? :-)
>

I made a new swiki page for "DoItFirst command option processing":

  http://wiki.squeak.org/squeak/6655


I have tried to describe the full process starting with VM command
line processing, then later explaining how DoItFirst participates in
the process, as well as and how and when it parses and evaluates the
command line options that it recognizes.

This has always been a somewhat confusing topic and I am sure that I
will have made some errors and omissions, but hopefully this helps to
tie the pieces together.

Note that I am writing from the perspective of a VM invoked from unix
command line, so some details will be different for other platforms.
But the explanations of option processing in the image are applicable
for any platform or VM.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: DoIfFirst command option processing documentation (was: [ANN] DoItFirst command line goodie on SqueakSource)

timrowledge


> On 2020-12-12, at 10:22 AM, David T. Lewis <[hidden email]> wrote:
>
> On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
>> Hi Dave.
>>
>> Thanks! Would you mind adding a page on wiki.squeak.org? :-)
>>
>
> I made a new swiki page for "DoItFirst command option processing":
>
>  http://wiki.squeak.org/squeak/6655

I made a couple of readability edits that seem to help in Safari - take a look to see if it causes any issues with other browsers.
Mostly I changed the really annoyingly ugly --- stuff that gets merged into a single line with non-breaking hyphen, which keeps the little gap and makes it easy to tell a singe - from a --

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
All the simple programs have been written, and all the good names taken.



Reply | Threaded
Open this post in threaded view
|

Re: DoIfFirst command option processing documentation (was: [ANN] DoItFirst command line goodie on SqueakSource)

David T. Lewis
On Sat, Dec 12, 2020 at 10:52:58AM -0800, tim Rowledge wrote:

>
>
> > On 2020-12-12, at 10:22 AM, David T. Lewis <[hidden email]> wrote:
> >
> > On Wed, Dec 09, 2020 at 11:23:37AM +0100, Marcel Taeumel wrote:
> >> Hi Dave.
> >>
> >> Thanks! Would you mind adding a page on wiki.squeak.org? :-)
> >>
> >
> > I made a new swiki page for "DoItFirst command option processing":
> >
> >  http://wiki.squeak.org/squeak/6655
>
> I made a couple of readability edits that seem to help in Safari - take a look to see if it causes any issues with other browsers.
> Mostly I changed the really annoyingly ugly --- stuff that gets merged into a single line with non-breaking hyphen, which keeps the little gap and makes it easy to tell a singe - from a --
>
> tim
>

Thanks a lot Tim, it looks good on Firefox.

I don't really want to admit how much time I wasted this morning
trying to get those little dash thingies to render on the swiki,
thanks for doing it the right way.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: DoIfFirst command option processing documentation (was: [ANN] DoItFirst command line goodie on SqueakSource)

timrowledge


> On 2020-12-12, at 11:25 AM, David T. Lewis <[hidden email]> wrote:
>
> I don't really want to admit how much time I wasted this morning
> trying to get those little dash thingies to render on the swiki,

The page history will reveal how many times it took me...


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful random insult:- If what you don't know can't hurt you, she's practically invulnerable.



12