duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit f1bfb94c77a890cf58af003bbe5778ffc13d8074
parent e363a6960aba03ad13fd1d351232a43001739c5c
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Wed,  5 Oct 2022 08:26:44 -0400

cc/lib: implement memset()

Diffstat:
Mfs/app/cos/cvm.c | 1-
Mfs/cc/lib.fs | 2++
Mfs/tests/cc/lib.fs | 5+++++
3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/app/cos/cvm.c b/fs/app/cos/cvm.c @@ -1,5 +1,4 @@ // This doesn't compile. It's a prototype of what it will look like. -// TODO: memset() // TODO: fseek() fopen() fclose() // TODO: implement "static" logic for global variables // TODO: allow usage of system structs diff --git a/fs/cc/lib.fs b/fs/cc/lib.fs @@ -6,6 +6,8 @@ 0 const NULL (S str -- len ) : strlen c@ ; +(S a c n -- ) +: memset swap fill ; $100 MemIO :new const _sio diff --git a/fs/tests/cc/lib.fs b/fs/tests/cc/lib.fs @@ -6,6 +6,11 @@ testbegin :cfunc int foo() { return strlen("Hello World!"); } foo 12 #eq +create foo 4 nc, 1 2 3 4 +:cfunc void bar(int a) { memset(a, 0, 4); } +foo bar +foo @ 0 #eq + :cfunc void foo(char *str, int n1, int n2, int n3, int n4) { printf(str, n1, n2, n3, n4, "foo %d %b %w %x %s"); } S" bar" 42 43 44 45 capture foo S" foo 45 2c 002b 0000002a bar" #s=