aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-12-29 00:07:16 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2026-01-06 17:19:52 +0200
commitc7b41b47d038fd4973da05224b7aa29efaae1784 (patch)
treead439ff996aa5121bced46bdb7e42eb419702be0 /mod
parentd501b2c9ebab6f5b90c808ea0e5fde912818707d (diff)
downloadfwd-c7b41b47d038fd4973da05224b7aa29efaae1784.tar.gz
fwd-c7b41b47d038fd4973da05224b7aa29efaae1784.zip
work towards a simple integer vector implementation
+ Hopefully shows that useful programs can be implemented with the rules present + Still missing at least external functions with non-void returns
Diffstat (limited to 'mod')
-rw-r--r--mod/mem.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mod/mem.c b/mod/mem.c
index 5303ffa..96d6d0e 100644
--- a/mod/mem.c
+++ b/mod/mem.c
@@ -24,6 +24,15 @@ long fwdfree(fwd_extern_args_t args)
return 0;
}
+long fwdptradd(fwd_extern_args_t args)
+{
+ assert(args.argc == 2);
+ void *ptr = FWD_ARG(args, 0, void *, FWD_PTR);
+ int64_t add = FWD_ARG_T(args, 1, int64_t);
+ FWD_RET(FWD_PTR, (char *)ptr + add);
+ return 0;
+}
+
int fwdopen(fwd_state_t *state)
{
FWD_REGISTER(state, fwdmalloc,
@@ -34,5 +43,8 @@ int fwdopen(fwd_state_t *state)
FWD_REGISTER(state, fwdfree,
FWD_VOID, FWD_PTR);
+
+ FWD_REGISTER(state, fwdptradd,
+ FWD_PTR, FWD_PTR, FWD_T(int64_t));
return 0;
}