From 1ddd7de5b15f52c13a5c084445253655a94bd970 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Thu, 20 Jan 2022 23:57:13 +0000 Subject: =?UTF-8?q?Implement=20a=20very=20basic=20=E2=8E=95RUN=20command?= =?UTF-8?q?=20which=20runs=20the=20code=20from=20a=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 7266f28..55a72ad 100644 --- a/functions.c +++ b/functions.c @@ -147,13 +147,19 @@ runfunc(Function f, Array *left, Array *right) return dyadfunctiondefs[f.code](left, right); else return monadfunctiondefs[f.code](right); - }else{ + }else if(f.type == FunctypeOp){ /* TODO assumes prim op, not dop */ if(f.operator.dyadic) return dyadoperatordefs[f.operator.code](f.operator.left, f.operator.right, left, right); else return monadoperatordefs[f.operator.code](f.operator.left, left, right); - } + }else if(f.type == FunctypeQuad){ + if(left) + return f.quad->dyadfn(left, right); + else + return f.quad->monadfn(right); + }else + return nil; } Array * -- cgit v1.2.3