Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 1999 13:20:50 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Duncan Barclay <dmlb@ragnet.demon.co.uk>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: FICL and setting BTX variables
Message-ID:  <36982AA2.3F0FBE1B@newsguy.com>
References:  <XFMail.990109212726.dmlb@computer.my.domain>

next in thread | previous in thread | raw e-mail | index | archive | help
Duncan Barclay wrote:
> 
> However, I can't work out what the voodoo is to set BTX (I think) variables
> from with ficl. I need to set curdev based upon which drive I want to boot
> from, the example code below falls over.
> 
>         /usr/share/examples/.../menu.4th ...
>                 dup 49 = if
>                         drop
>                         1 25 at-xy cr
>                         ." Loading 2.2.6 kernel. Please wait..." cr
>                         set num_ide_disks=1
>                         set curdev=disk2s1a:
>                         boot
>                 then
> 
> I tried a few of the obvious things like
>   s" disk2s1a constant curdev
> but it doesn't work.
> 
> Once I get it working I'll submit my menu's as another example. Thanks

This is being worked on. Well, it would be being worked on if I had
got a single second opinion on how to proceed, but...

Right now you can get around the problem in a somewhat clumsy way.
We intend to let you do it in a non-clumsy way, we just haven't
decided what way would that be.

For now, you can do the following:

			s" set num_ide_disks=1" evaluate drop
			s" set currdev=disk2s1a:" evaluate drop
			s" boot" evaluate drop

Better yet, though would be:

			s" load ${kernelname}" evaluate if s" boot" evaluate abort else
...

Notes:

	* Right now, all builtins return 1 if no error happened, 0
otherwise (btw, Jordan, ANS specifies all bits 1 as the "true" value
:). It is my intention to change this behavior. In fact, I have
already submitted the patches. If I have it my way, errors will use
THROW instead.

	* Right now, you can't set a variable to the name of another
variable. For instance, the default value of prompt is "${currdev}".
Well, you'll find there is no way to set it to that value. There is
no escape character in the parser, and \ are silently removed with a
few exceptions (\\ is translated to \, but still does not escape
anything). Quotes also won't help you there, as they only have
impact on how spaces are interpreted. I have also submitted patches
to deal with this.

	* Right now (yeah, I'm emphasizing it :), EVALUATE doesn't work
according to specs. It will silently ignore the count passed, and
will process the string as a null-terminated string. Needless to
say, I hope :-), I intend to fix this too. Alas, I haven't submitted
this patch yet. Anyway, if you want to create strings to be
evaluated, remember to zero terminate them.

You can create a wrapper for the builtin commands to make things a
little bit easier. I have submitted such a hack to... to -current, I
think. Search for my messages to -current in december and you'll
find it easily. With it, you can then do something like:

	s" /etc"  s" -l"  2 wrap" ls"	\ That is, pass parameters 
					\ as separate strings, 
					\ instead of having to 
					\ evaluate a single string

Notice, this hack is entirely in Forth, and has been tested against
the loader, so you don't have to patch loader's source to use it.

I hope this helped. Feel free to forward me any questions concerning
ficl.

--
Daniel C. Sobral			(8-DCS)
dcs@newsguy.com

	"Heart like a Gabriel, pure and white as ivory,
	soul like a lucifer, black and cold as a piece of lead."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?36982AA2.3F0FBE1B>