From 9d1324ec4856460fc8df45f81a069b083e454a41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 18 Nov 2020 20:00:51 +0100 Subject: [PATCH] :art: Add time and dur operators --- src/lib/prim.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/prim.c b/src/lib/prim.c index 49eb2126..442aaf13 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -208,12 +208,19 @@ static GWION_IMPORT(dur) { GWI_BB(gwi_oper_cond(gwi, "dur", BranchEqFloat, BranchNeqFloat)) GWI_BB(gwi_oper_ini(gwi, "dur", "dur", "dur")) CHECK_FF("=>", rassign, r_assign) + CHECK_FF("+=>", rassign, r_plus) + CHECK_FF("-=>", rassign, r_minus) + CHECK_FF("*=>", rassign, r_mul) + CHECK_FF("/=>", rassign, r_div) GWI_BB(gwi_oper_end(gwi, "+", FloatPlus)) GWI_BB(gwi_oper_end(gwi, "-", FloatMinus)) GWI_BB(gwi_oper_end(gwi, "*", FloatTimes)) GWI_BB(gwi_oper_ini(gwi, "dur", "dur", "float")) GWI_BB(gwi_oper_end(gwi, "/", FloatDivide)) + GWI_BB(gwi_oper_ini(gwi, "dur", "float", "dur")) + GWI_BB(gwi_oper_end(gwi, "/", FloatDivide)) + GWI_BB(gwi_oper_ini(gwi, "dur", "dur", "int")) GWI_BB(gwi_oper_end(gwi, ">", float_gt)) GWI_BB(gwi_oper_end(gwi, ">=", float_ge)) @@ -242,6 +249,8 @@ static GWION_IMPORT(time) { CHECK_FF("=>", rassign, r_assign) GWI_BB(gwi_oper_ini(gwi, "time", "dur", "time")) GWI_BB(gwi_oper_end(gwi, "+", FloatPlus)) + GWI_BB(gwi_oper_ini(gwi, "time", "time", "dur")) + GWI_BB(gwi_oper_end(gwi, "-", FloatMinus)) GWI_BB(gwi_oper_ini(gwi, "dur", "time", "time")) CHECK_FF("=>", rassign, r_assign) GWI_BB(gwi_oper_end(gwi, "+", FloatPlus)) -- 2.43.0