]> Nishi Git Mirror - gwion.git/commitdiff
:art: Add time and dur operators
authorJérémie Astor <fennecdjay@gmail.com>
Wed, 18 Nov 2020 19:00:51 +0000 (20:00 +0100)
committerJérémie Astor <fennecdjay@gmail.com>
Wed, 18 Nov 2020 19:00:51 +0000 (20:00 +0100)
src/lib/prim.c

index 49eb2126378b170e605750f023da2414f7af4623..442aaf134364792f61366e289114f2f67f585a38 100644 (file)
@@ -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))