From owner-freebsd-hackers Sat Jan 9 20:23:21 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA25635 for freebsd-hackers-outgoing; Sat, 9 Jan 1999 20:23:21 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA25630 for ; Sat, 9 Jan 1999 20:23:19 -0800 (PST) (envelope-from dcs@newsguy.com) Received: from newsguy.com by peach.ocn.ne.jp (8.9.1a/OCN) id NAA04142; Sun, 10 Jan 1999 13:22:33 +0900 (JST) Message-ID: <36982AA2.3F0FBE1B@newsguy.com> Date: Sun, 10 Jan 1999 13:20:50 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.5 [en] (Win98; I) X-Accept-Language: pt-BR,ja MIME-Version: 1.0 To: Duncan Barclay CC: freebsd-hackers@FreeBSD.ORG Subject: Re: FICL and setting BTX variables References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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