mirror of
https://github.com/nineties/planckforth
synced 2025-01-13 08:01:10 +01:00
Add --version and --runtime
This commit is contained in:
parent
b407d70a4a
commit
ece51b626c
1 changed files with 22 additions and 1 deletions
23
bootstrap.fs
23
bootstrap.fs
|
@ -1233,6 +1233,18 @@ decimal \ set default to decimal
|
||||||
drop 1- 0 swap c! drop
|
drop 1- 0 swap c! drop
|
||||||
;
|
;
|
||||||
|
|
||||||
|
\ ( c-addr1 c-addr2 u -- f )
|
||||||
|
: strneq
|
||||||
|
begin dup 0> while
|
||||||
|
1- >r
|
||||||
|
dup 1+ >r c@
|
||||||
|
swap dup 1+ >r c@
|
||||||
|
<> if rdrop rdrop rdrop false exit then
|
||||||
|
r> r> r>
|
||||||
|
repeat
|
||||||
|
3drop true
|
||||||
|
;
|
||||||
|
|
||||||
\ Print string
|
\ Print string
|
||||||
: type ( c-addr -- )
|
: type ( c-addr -- )
|
||||||
begin dup c@ dup while \ while c<>\0
|
begin dup c@ dup while \ while c<>\0
|
||||||
|
@ -2501,7 +2513,7 @@ need-defined (read)
|
||||||
2rot -2rot 2tuck 2over 2nip 2swap 2dup 2drop 3dup 3drop depth
|
2rot -2rot 2tuck 2over 2nip 2swap 2dup 2drop 3dup 3drop depth
|
||||||
rp0 rp@ rp! r> >r r@ rdrop rpick rdepth
|
rp0 rp@ rp! r> >r r@ rdrop rpick rdepth
|
||||||
|
|
||||||
allocate allot memcpy strlen streq strcpy strcpy,
|
allocate allot memcpy strlen streq strneq strcpy strcpy,
|
||||||
cell cell+ cell- cells char+ char- chars align aligned +! -!
|
cell cell+ cell- cells char+ char- chars align aligned +! -!
|
||||||
|
|
||||||
if else then unless begin until again while repeat
|
if else then unless begin until again while repeat
|
||||||
|
@ -2530,6 +2542,15 @@ need-defined (read)
|
||||||
|
|
||||||
( === End of bootstrap === )
|
( === End of bootstrap === )
|
||||||
|
|
||||||
|
:noname
|
||||||
|
1 arg s" --version" 10 strneq if
|
||||||
|
." PlanckForth " version type cr bye
|
||||||
|
else 1 arg s" --runtime" 10 strneq if
|
||||||
|
runtime type cr bye
|
||||||
|
then then
|
||||||
|
; execute
|
||||||
|
|
||||||
|
|
||||||
:noname
|
:noname
|
||||||
rdrop
|
rdrop
|
||||||
argc @ 1 > if
|
argc @ 1 > if
|
||||||
|
|
Loading…
Reference in a new issue