[ENH] Command-line argument access in the image

Brian Rice water at tunes.org
Tue Dec 27 18:50:16 PST 2005


Hello all,

I've added access to C's argc/argv via a new VM primitive and some  
image-side code. This process required a full and incompatible  
bootstrap, so make sure to run "make distclean" before pulling and  
rebuilding VM's and full image. The alpha repository and the current  
tarball are both updated.

I've added a couple of demonstration arguments that the image will  
automatically process, --load which takes a filename to load on  
startup, and --eval which evaluates the following expression on startup.

You can see the handler code in src/mobius/image.slate:
http://slate.tunes.org/repos/main/src/mobius/image.slate

at the end of the file. As you can see, the argc are available as  
"globals StartupArguments" or just StartupArguments, of course, and  
is just an Array of Strings. Currently there is a limit of 1024  
characters to input from the VM, but I will figure out how to safely  
remove that limit shortly.

Also, boot.c currently processes its arguments in a simplistic way,  
so that extra arguments that you want to pass to the image must be  
followed by the image name. E.g.

"slate --load src/lib/memoryarea.slate slate.image"

Is generally needed; you cannot skip the image name yet. I may write  
some code that does guess-work in trying to figure out if the last  
argument is a valid image name, and then have it try the default if  
that doesn't work.

Oh yeah, these command-line arguments are not used when bootstrapping  
a usual general-purpose image (yet), since startupActions is only  
invoked when re-starting, so to speak.

--
-Brian
http://tunes.org/~water/brice.vcf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : /archives/slate/attachments/20051227/11b99f4c/PGP.pgp


More information about the Slate mailing list