From 4f9b5304d929c6982d87fb0c131d3a980b21c8c1 Mon Sep 17 00:00:00 2001 From: erg Date: Fri, 1 May 2009 17:42:51 +0000 Subject: [PATCH] Add min, max and system functions --- cmd/gvpr/compile.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/gvpr/compile.c b/cmd/gvpr/compile.c index bada6a43c..2f7f1b1e2 100644 --- a/cmd/gvpr/compile.c +++ b/cmd/gvpr/compile.c @@ -43,6 +43,8 @@ #include #define ISEDGE(e) (AGTYPE(e)&2) +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define MAX(a,b) ((a)>(b)?(a):(b)) #include @@ -1157,6 +1159,15 @@ getval(Expr_t * pgm, Exnode_t * node, Exid_t * sym, Exref_t * ref, case F_log: v.floating = log(args[0].floating); break; + case F_min: + v.floating = MIN(args[0].floating, args[1].floating); + break; + case F_max: + v.floating = MAX(args[0].floating, args[1].floating); + break; + case F_sys: + v.integer = system(args[0].string); + break; case F_hasattr: case F_get: objp = INT2PTR(Agobj_t *, args[0].integer); -- 2.40.0