From ece51b626c3cb747f61c5d8f6885ba1678d39588 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Mon, 11 Jan 2021 19:28:33 +0900 Subject: [PATCH] Add --version and --runtime --- bootstrap.fs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bootstrap.fs b/bootstrap.fs index 246dc06..d9afe9c 100644 --- a/bootstrap.fs +++ b/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