commit b875ee51be39e376a4fd705fc3725f840bfe77a6
parent 9fb0055e78430ab8713d0f5ca585d54def5d4a4a
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Wed, 14 Sep 2022 16:08:19 -0400
cc: fix broken ! op
Diffstat:
4 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/app/cos/tools/blkpack.c b/fs/app/cos/tools/blkpack.c
@@ -1,5 +1,6 @@
// This doesn't actually work, I'm just drafting how it would look.
-// TODO: add ! operator
+// TODO: add while
+// TODO: have support for 8/16 bit wide operations
#[ 10 const BUMP_GRANULARITY ]#
diff --git a/fs/cc/tok.fs b/fs/cc/tok.fs
@@ -24,9 +24,9 @@
\ with a symbol that is also a 1 char symbol and all 3 chars symbols begin with
\ 2 chars that are also a 2 chars symbol.
\ list of 1 char symbols
-create symbols1 ," +-*/~&<>=[](){}.%^?:;,|^#\""
+create symbols1 ," +-*/~&<>=[](){}.%^?:;,|^#\"!"
-: isSym1? ( c -- f ) symbols1 26 [c]? 0>= ;
+: isSym1? ( c -- f ) symbols1 27 [c]? 0>= ;
\ list of 2 chars symbols
create symbols2 ," <=>===!=&&||++---><<>>+=-=*=/=%=&=^=|=/**///#["
diff --git a/fs/tests/cc/cc.fs b/fs/tests/cc/cc.fs
@@ -41,6 +41,8 @@ capture helloworld S" Hello World!" #s=
42 capture multretvoid S" Answer to the universe" #s=
-1 0 lts #
-1 0 ltu not #
+0 boolnot 1 #eq
+42 boolnot 0 #eq
\ and what about inline functions?
:cfunc int myinline() { return 42; }
diff --git a/fs/tests/cc/test.c b/fs/tests/cc/test.c
@@ -165,3 +165,6 @@ extern int lts(int a, int b) {
extern int ltu(unsigned int a, unsigned int b) {
return a < b;
}
+extern int boolnot(int x) {
+ return !x;
+}