Use _ instead or - where proper, according to the style I have been

using.

Overload "?" so it will also show loader.4th commands.
This commit is contained in:
Daniel C. Sobral 2000-09-16 21:04:49 +00:00
parent ae7c64e466
commit 818c39998e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65949
2 changed files with 35 additions and 17 deletions

View File

@ -57,7 +57,7 @@ include /boot/support.4th
only forth also support-functions also builtins definitions only forth also support-functions also builtins definitions
: boot : boot
0= if ( interpreted ) get-arguments then 0= if ( interpreted ) get_arguments then
\ Unload only if a path was passed \ Unload only if a path was passed
dup if dup if
@ -83,7 +83,7 @@ only forth also support-functions also builtins definitions
; ;
: boot-conf : boot-conf
0= if ( interpreted ) get-arguments then 0= if ( interpreted ) get_arguments then
0 1 unload drop 0 1 unload drop
load_kernel_and_modules load_kernel_and_modules
?dup 0= if 0 1 autoboot then ?dup 0= if 0 1 autoboot then
@ -282,5 +282,23 @@ only forth definitions also support-functions
\ Return to strict forth vocabulary \ Return to strict forth vocabulary
: #type
over - >r
type
r> spaces
;
: .? 2 spaces 2swap 15 #type 2 spaces type cr ;
: ?
['] ? execute
s" boot-conf" s" load kernel and modules, then autoboot" .?
s" read-conf" s" read a configuration file" .?
s" enable-module" s" enable loading of a module" .?
s" disable-module" s" disable loading of a module" .?
s" toggle-module" s" toggle loading of a module" .?
s" show-module" s" show module load data" .?
;
only forth also only forth also

View File

@ -1493,7 +1493,7 @@ also builtins
abort" Unable to load a kernel!" abort" Unable to load a kernel!"
; ;
: set-defaultoptions ( -- ) : set_defaultoptions ( -- )
s" kernel_options" getenv dup -1 = if s" kernel_options" getenv dup -1 = if
drop drop
else else
@ -1511,7 +1511,7 @@ also builtins
pick pick
; ;
: drop-args ( aN uN ... a1 u1 N -- ) : drop_args ( aN uN ... a1 u1 N -- )
0 ?do 2drop loop 0 ?do 2drop loop
; ;
@ -1519,7 +1519,7 @@ also builtins
dup dup
; ;
: queue-argv ( aN uN ... a1 u1 N a u -- a u aN uN ... a1 u1 N+1 ) : queue_argv ( aN uN ... a1 u1 N a u -- a u aN uN ... a1 u1 N+1 )
>r >r
over 2* 1+ -roll over 2* 1+ -roll
r> r>
@ -1527,7 +1527,7 @@ also builtins
1+ 1+
; ;
: unqueue-argv ( aN uN ... a1 u1 N -- aN uN ... a2 u2 N-1 a1 u1 ) : unqueue_argv ( aN uN ... a1 u1 N -- aN uN ... a2 u2 N-1 a1 u1 )
1- -rot 1- -rot
; ;
@ -1547,28 +1547,28 @@ also builtins
r> r>
; ;
: concat-argv ( aN uN ... a1 u1 N -- a u ) : concat_argv ( aN uN ... a1 u1 N -- a u )
strlen(argv) allocate if out_of_memory throw then strlen(argv) allocate if out_of_memory throw then
0 2>r 0 2>r
begin begin
argc argc
while while
unqueue-argv unqueue_argv
2r> 2swap 2r> 2swap
strcat strcat
s" " strcat s" " strcat
2>r 2>r
repeat repeat
drop-args drop_args
2r> 2r>
; ;
: set-tempoptions ( addrN lenN ... addr1 len1 N -- addr len 1 | 0 ) : set_tempoptions ( addrN lenN ... addr1 len1 N -- addr len 1 | 0 )
\ Save the first argument, if it exists and is not a flag \ Save the first argument, if it exists and is not a flag
argc if argc if
0 argv[] drop c@ [char] - <> if 0 argv[] drop c@ [char] - <> if
unqueue-argv 2>r \ Filename unqueue_argv 2>r \ Filename
1 >r \ Filename present 1 >r \ Filename present
else else
0 >r \ Filename not present 0 >r \ Filename not present
@ -1579,33 +1579,33 @@ also builtins
\ If there are other arguments, assume they are flags \ If there are other arguments, assume they are flags
?dup if ?dup if
concat-argv concat_argv
2dup s" temp_options" setenv 2dup s" temp_options" setenv
drop free if free_error throw then drop free if free_error throw then
else else
set-defaultoptions set_defaultoptions
then then
\ Bring back the filename, if one was provided \ Bring back the filename, if one was provided
r> if 2r> 1 else 0 then r> if 2r> 1 else 0 then
; ;
: get-arguments ( -- addrN lenN ... addr1 len1 N ) : get_arguments ( -- addrN lenN ... addr1 len1 N )
0 0
begin begin
\ Get next word on the command line \ Get next word on the command line
parse-word parse-word
?dup while ?dup while
queue-argv queue_argv
repeat repeat
drop ( empty string ) drop ( empty string )
; ;
: load_kernel_and_modules ( args -- flag ) : load_kernel_and_modules ( args -- flag )
set-tempoptions set_tempoptions
argc >r argc >r
s" temp_options" getenv dup -1 <> if s" temp_options" getenv dup -1 <> if
queue-argv queue_argv
else else
drop drop
then then