]> Nishi Git Mirror - gwion.git/commitdiff
:fire: Really move int.c to prim.c and split funcs
authorfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 8 Feb 2019 17:02:33 +0000 (18:02 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Fri, 8 Feb 2019 17:02:33 +0000 (18:02 +0100)
src/lib/int.c [deleted file]
src/lib/prim.c

diff --git a/src/lib/int.c b/src/lib/int.c
deleted file mode 100644 (file)
index 06070ff..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "instr.h"
-#include "object.h"
-#include "import.h"
-
-#define CHECK_OP(op, check, func) _CHECK_OP(op, check, int_##func)
-
-GWION_IMPORT(int) {
-  CHECK_BB(gwi_oper_ini(gwi, "int", "int", "int"))
-  CHECK_BB(gwi_oper_end(gwi, op_add,         int_plus))
-  CHECK_BB(gwi_oper_end(gwi, op_sub,        int_minus))
-  CHECK_BB(gwi_oper_end(gwi, op_mul,        int_mul))
-  CHECK_BB(gwi_oper_end(gwi, op_div,       int_div))
-  CHECK_BB(gwi_oper_end(gwi, op_mod,      int_modulo))
-  CHECK_BB(gwi_oper_end(gwi, op_and,          int_and))
-  CHECK_BB(gwi_oper_end(gwi, op_or,           int_or))
-  CHECK_BB(gwi_oper_end(gwi, op_eq,           int_eq))
-  CHECK_BB(gwi_oper_end(gwi, op_ne,              int_neq))
-  CHECK_BB(gwi_oper_end(gwi, op_gt,           int_gt))
-  CHECK_BB(gwi_oper_end(gwi, op_ge,          int_ge))
-  CHECK_BB(gwi_oper_end(gwi, op_lt,              int_lt))
-  CHECK_BB(gwi_oper_end(gwi, op_le,          int_le))
-  CHECK_BB(gwi_oper_end(gwi, op_shr,  int_sr))
-  CHECK_BB(gwi_oper_end(gwi, op_shl,   int_sl))
-  CHECK_BB(gwi_oper_end(gwi, op_sand,        int_sand))
-  CHECK_BB(gwi_oper_end(gwi, op_sor,         int_sor))
-  CHECK_BB(gwi_oper_end(gwi, op_sxor,        int_xor))
-  CHECK_OP(chuck,        rassign, r_assign)
-  CHECK_OP(radd,    rassign, r_plus)
-  CHECK_OP(rsub,  rassign, r_minus)
-  CHECK_OP(rmul,  rassign, r_mul)
-  CHECK_OP(rdiv, rassign, r_div)
-  CHECK_OP(rmod, rassign, r_modulo)
-  CHECK_OP(rsl,          rassign, r_sl)
-  CHECK_OP(rsr,          rassign, r_sr)
-  CHECK_OP(rsand,        rassign, r_sand)
-  CHECK_OP(rsor,         rassign, r_sor)
-  CHECK_OP(rsxor,        rassign, r_sxor)
-  CHECK_BB(gwi_oper_ini(gwi, NULL, "int", "int"))
-  CHECK_BB(gwi_oper_add(gwi,  opck_unary_meta))
-  CHECK_BB(gwi_oper_end(gwi,  op_sub,       int_negate))
-  CHECK_BB(gwi_oper_add(gwi,  opck_unary_meta))
-  CHECK_BB(gwi_oper_end(gwi,  op_not, IntNot))
-  CHECK_OP(inc,   unary, pre_inc)
-  CHECK_OP(dec, unary, pre_dec)
-  CHECK_BB(gwi_oper_end(gwi,  op_cmp, int_cmp))
-  CHECK_BB(gwi_oper_ini(gwi, "int", NULL, "int"))
-  CHECK_OP(inc,   post,  post_inc)
-  CHECK_OP(dec, post,  post_dec)
-  CHECK_BB(gwi_enum_ini(gwi, "bool"))
-  CHECK_BB(gwi_enum_add(gwi, "false", 0))
-  CHECK_BB(gwi_enum_add(gwi, "true", 1))
-  CHECK_BB(gwi_enum_end(gwi))
-  gwi_item_ini(gwi, "bool", "maybe");
-  gwi_item_end(gwi, 0, NULL);
-  return GW_OK;
-}
index 933e44a8e5975dfb1df720095aa8aa4b8c2f064c..ce575e13d62d7096baa165ac57d76745a93f96c7 100644 (file)
 
 GWION_IMPORT(int_op) {
   CHECK_BB(gwi_oper_ini(gwi, "int", "int", "int"))
-  CHECK_BB(gwi_oper_end(gwi, op_add,         int_plus))
-  CHECK_BB(gwi_oper_end(gwi, op_sub,        int_minus))
-  CHECK_BB(gwi_oper_end(gwi, op_mul,        int_mul))
-  CHECK_BB(gwi_oper_end(gwi, op_div,       int_div))
-  return gwi_oper_end(gwi, op_mod,      int_modulo);
+  CHECK_BB(gwi_oper_end(gwi, op_add, int_plus))
+  CHECK_BB(gwi_oper_end(gwi, op_sub, int_minus))
+  CHECK_BB(gwi_oper_end(gwi, op_mul, int_mul))
+  CHECK_BB(gwi_oper_end(gwi, op_div, int_div))
+  return   gwi_oper_end(gwi, op_mod, int_modulo);
 }
 
 static GWION_IMPORT(int_logical) {
-  CHECK_BB(gwi_oper_end(gwi, op_and,          int_and))
-  CHECK_BB(gwi_oper_end(gwi, op_or,           int_or))
-  CHECK_BB(gwi_oper_end(gwi, op_eq,           int_eq))
-  CHECK_BB(gwi_oper_end(gwi, op_ne,              int_neq))
-  CHECK_BB(gwi_oper_end(gwi, op_gt,           int_gt))
-  CHECK_BB(gwi_oper_end(gwi, op_ge,          int_ge))
-  CHECK_BB(gwi_oper_end(gwi, op_lt,              int_lt))
-  CHECK_BB(gwi_oper_end(gwi, op_le,          int_le))
+  CHECK_BB(gwi_oper_end(gwi, op_and,  int_and))
+  CHECK_BB(gwi_oper_end(gwi, op_or,   int_or))
+  CHECK_BB(gwi_oper_end(gwi, op_eq,   int_eq))
+  CHECK_BB(gwi_oper_end(gwi, op_ne,   int_neq))
+  CHECK_BB(gwi_oper_end(gwi, op_gt,   int_gt))
+  CHECK_BB(gwi_oper_end(gwi, op_ge,   int_ge))
+  CHECK_BB(gwi_oper_end(gwi, op_lt,   int_lt))
+  CHECK_BB(gwi_oper_end(gwi, op_le,   int_le))
   CHECK_BB(gwi_oper_end(gwi, op_shr,  int_sr))
-  CHECK_BB(gwi_oper_end(gwi, op_shl,   int_sl))
-  CHECK_BB(gwi_oper_end(gwi, op_sand,        int_sand))
-  CHECK_BB(gwi_oper_end(gwi, op_sor,         int_sor))
-  return gwi_oper_end(gwi, op_sxor, int_xor);
+  CHECK_BB(gwi_oper_end(gwi, op_shl,  int_sl))
+  CHECK_BB(gwi_oper_end(gwi, op_sand, int_sand))
+  CHECK_BB(gwi_oper_end(gwi, op_sor,  int_sor))
+  return   gwi_oper_end(gwi, op_sxor, int_xor);
 }
 
 static GWION_IMPORT(int_r) {
@@ -56,11 +56,11 @@ static GWION_IMPORT(int_unary) {
   CHECK_BB(gwi_oper_end(gwi,  op_sub,       int_negate))
   CHECK_BB(gwi_oper_add(gwi,  opck_unary_meta))
   CHECK_BB(gwi_oper_end(gwi,  op_not, IntNot))
-  CHECK_OP(inc,   unary, pre_inc)
+  CHECK_OP(inc, unary, pre_inc)
   CHECK_OP(dec, unary, pre_dec)
   CHECK_BB(gwi_oper_end(gwi,  op_cmp, int_cmp))
   CHECK_BB(gwi_oper_ini(gwi, "int", NULL, "int"))
-  CHECK_OP(inc,   post,  post_inc)
+  CHECK_OP(inc, post, post_inc)
   CHECK_BB(gwi_oper_add(gwi, opck_post))
   CHECK_BB(gwi_oper_end(gwi, op_dec, int_post_dec))
   return GW_OK;