Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 1998 20:56:16 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Andrzej Bialecki <abial@nask.pl>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: BootFORTH - demo floppy
Message-ID:  <367CE5E0.D2ACFAE2@newsguy.com>
References:  <Pine.BSF.4.02A.9812192234070.20141-100000@korin.warman.org.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrzej Bialecki wrote:
> 
> The built-ins I was talking about are the original bootloader commands,
> such as set, show, load, boot, reboot, pnpscan, ls etc..., which need
> closer integrations with Forth engine. Namely, they should recognize the
> state (either interpretive, or compiling), and be able to accept
> parameters either from command line (like: "load -t userconfig_script
> kernel.config" when interpreting), or from the stack (like:
> 
>         s" kernel.config"
>         s" userconfig_script"
>         s" -t"
>         load
> 
> when compiling). As it is now, we cannot use the full Forth power to
> program booting behaviour because of this deficiency.

Well, aside from being... well... ugly, you _can_ wrap it like:

80 constant Buffersize
Create Buffer Buffersize allot

: cat
  >r over >r	\ save sizes
  dup >r	\ save original append position
  swap move	\ append
  r> r@ +	\ skip newly added string
  bl over c!	\ add a space...
  1+		\ ...and skip it
  r> r> + 1+	\ new size
;

: concatenate_command_and_arguments
  >r		\ Save number of strings
  buffer 0	\ Destination of copy
  r> 0 do	\ Copy all strings
    cat
  loop

  0 rot c!	\ Null-terminate the buffer, because of problems with
evaluate

  Buffer swap	\ return begin-of-buffer, size
;

: insert_command
  rot 1+
;

: wrapper
  insert_command
  concatenate_command_and_arguments
  evaluate
;

: wrap" postpone s" postpone wrapper ; immediate

And then do:

>         s" kernel.config"
>         s" userconfig_script"
>         s" -t"
          3
>         wrap" load"

in compile mode (inside a definition).

I'll see what I can do after I get the source, but that will have to
wait a new hd. Meanwhile...

1) Could someone please add a key pause to "words"? :-)
2) Could someone please add the 30-years old traditional
"ok<newline>" prompt in interpreting mode?
3) I noticed "evaluate" is working with null-ended string, ignoring
completely the count on the stack. Not good.

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

	"This never happened to the other fellow!"
		- The second James Bond


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?367CE5E0.D2ACFAE2>