mirror of
https://github.com/nineties/planckforth
synced 2024-12-25 21:58:22 +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
|
||||
;
|
||||
|
||||
\ ( 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
|
||||
: type ( c-addr -- )
|
||||
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
|
||||
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 +! -!
|
||||
|
||||
if else then unless begin until again while repeat
|
||||
|
@ -2530,6 +2542,15 @@ need-defined (read)
|
|||
|
||||
( === 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
|
||||
rdrop
|
||||
argc @ 1 > if
|
||||
|
|
Loading…
Reference in a new issue