From 532a7f5b0785dd51f02b83936762f1d17047ac21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 8 Mar 2020 18:52:24 +0100 Subject: [PATCH] :fire: Remove complex --- examples/array_lit.gw | 1 - examples/array_multiple.gw | 8 -- examples/class_coverage.gw | 2 - examples/complex.gw | 22 --- examples/member.gw | 7 +- examples/op2.gw | 6 - examples/polar.gw | 17 --- examples/static.gw | 8 +- examples/string.gw | 8 -- examples/vararg.gw | 6 +- include/lang_private.h | 1 - src/lib/complex.c | 212 ----------------------------- src/lib/engine.c | 1 - src/lib/string.c | 33 ----- tests/bug/array.gw | 9 -- tests/bug/static_data.gw | 2 - tests/error/complex_too_big.gw | 2 - tests/error/divide_by_zero.gw | 2 +- tests/error/polar_too_big.gw | 2 - tests/import/coverage.c | 14 -- tests/import/coverage.gw | 4 - tests/tree/balance.gw | 17 --- tests/tree/class_template.gw | 1 - tests/tree/func_return_coverage.gw | 2 - tests/tree/push_mem.gw | 2 - 25 files changed, 6 insertions(+), 383 deletions(-) delete mode 100644 examples/complex.gw delete mode 100644 examples/polar.gw delete mode 100644 src/lib/complex.c delete mode 100644 tests/error/complex_too_big.gw delete mode 100644 tests/error/polar_too_big.gw delete mode 100644 tests/tree/func_return_coverage.gw delete mode 100644 tests/tree/push_mem.gw diff --git a/examples/array_lit.gw b/examples/array_lit.gw index 56004e01..bfd65600 100644 --- a/examples/array_lit.gw +++ b/examples/array_lit.gw @@ -15,4 +15,3 @@ int k[1][1]; <<< i, " ", j, " ", o, " ", p, " ", r, " ", s, " ", t, " ", k >>>; [ 1.0, 2, 3, 4, 5 ]; -[ complex(0.0, 0.0) ]; diff --git a/examples/array_multiple.gw b/examples/array_multiple.gw index 741ab8e2..5e34564a 100644 --- a/examples/array_multiple.gw +++ b/examples/array_multiple.gw @@ -13,11 +13,3 @@ int i[4][4]; float f[4][4]; <<< f[2][3] >>>; <<< 12.345 => f[2][3] >>>; - -complex c[4][4]; -<<< c[2][3] >>>; -<<< c[2][3].re >>>; - -polar p[4][4]; -<<< p[2][3] >>>; -<<< p[2][3].mod >>>; diff --git a/examples/class_coverage.gw b/examples/class_coverage.gw index 78bd67a7..2d585f59 100644 --- a/examples/class_coverage.gw +++ b/examples/class_coverage.gw @@ -2,8 +2,6 @@ class C { int i; float f; - complex c; - polar p; Object o; operator @dtor void () { <<< "dtor" >>>; } } diff --git a/examples/complex.gw b/examples/complex.gw deleted file mode 100644 index 1a6bccb4..00000000 --- a/examples/complex.gw +++ /dev/null @@ -1,22 +0,0 @@ -complex a, b; -a; -a.re; -a.im; -a == b; -a != b; -a + b; - -<<< a - b >>>; -a * b; -a / b; -a => b; -a +=> b; -a -=> b; -a *=> b; -a /=> b; - -<<< "end" >>>; -12 => a.re; -1.4 => a.im; -<<< a.re >>>; -<<< a.im >>>; diff --git a/examples/member.gw b/examples/member.gw index f23f905f..20419340 100644 --- a/examples/member.gw +++ b/examples/member.gw @@ -2,24 +2,21 @@ class C { int i; float f; - complex c; Object o; fun int m_i() { return i; } fun float m_f() { return f; } - fun complex m_c() { return c; } fun Object m_o() { return o; } } C c; #! read members -<<< c.i, c.c, c.f, c.o >>>; +<<< c.i, c.f, c.o >>>; #! call fun members -<<< c.m_i(), " ", c.m_f(), " ", c.m_c(), " ", c.m_o() >>>; +<<< c.m_i(), " ", c.m_f(), " ", c.m_o() >>>; #! write members <<< 12 => c.i >>>; <<< 1.2 => c.f >>>; -<<< complex(0.1, 2.3) => c.c >>>; <<< null @=> c.o >>>; diff --git a/examples/op2.gw b/examples/op2.gw index da994492..9056c3f1 100644 --- a/examples/op2.gw +++ b/examples/op2.gw @@ -6,22 +6,16 @@ class C operator => float (C c, C d){ <<< "float => C: ", c.f => d.f >>>; return 2.0;} operator => int (int i, C d){ <<< "int => C: ", i => d.f >>>; return 2;} operator => float (float f, C d){ <<< "float => C: ", f => d.f >>>; return 2.0;} -operator => complex (complex c, C d){ <<< "complex => C: ", c.re => d.f >>>; return complex(1.2, 6.1);} -operator => polar (polar c, C d){ <<< "complex => C: ", c.mod => d.f >>>; return polar(2.3, 4.1);} operator => float (C d, int c){ <<< "int => C: ", c => d.f >>>; return 2.0;} operator => float (C d, float f){ <<< "C => float: ", f => d.f >>>; return 2.0;} -operator => complex (C d, complex c){ <<< "complex => C: ", c.re => d.f >>>; return complex(1.2, 6.1);} -operator => polar (C d, polar c){ <<< "complex => C: ", c.mod => d.f >>>; return polar(2.3, 4.1);} C c, d; 12.3 => c.f; <<< c => d >>>; <<< 2 => d >>>; <<< 2.3 => d >>>; -<<< complex(7.2, 1.4) => d >>>; -<<< polar(7.2, 1.4) => d >>>; int i; 2 => float f; diff --git a/examples/polar.gw b/examples/polar.gw deleted file mode 100644 index d4d0e6a5..00000000 --- a/examples/polar.gw +++ /dev/null @@ -1,17 +0,0 @@ -polar b; -polar a; -a.mod; -a.phase; -a; -a == b; -a != b; -a + b; -a - b; -a * b; -a / b; -a +=> b; -a -=> b; -a *=> b; -a /=> b; -1 => a.mod; -1 => a.phase; diff --git a/examples/static.gw b/examples/static.gw index 56738ccf..90fe87f3 100644 --- a/examples/static.gw +++ b/examples/static.gw @@ -2,28 +2,24 @@ class C { static int i; static float f; - static complex c; static Object o; fun int m_i() { return i; } fun float m_f() { return f; } - fun complex m_c() { return c; } fun Object m_o() { return o; } fun static int _i() { return i; } fun static float _f() { return f; } - fun static complex _c() { return c; } fun static Object _o() { return o; } } #! read members -<<< C.i, C.c, C.f, C.o >>>; +<<< C.i, C.f, C.o >>>; #! call fun members -<<< C._i(), " ", C._f(), " ", C._c(), " ", C._o() >>>; +<<< C._i(), " ", C._f(), " ", C._o() >>>; #! write members <<< 12 => C.i >>>; <<< 1.2 => C.f >>>; -<<< complex(0.1, 2.3) => C.c >>>; <<< null @=> C.o >>>; diff --git a/examples/string.gw b/examples/string.gw index 86a34d59..6473e1bb 100644 --- a/examples/string.gw +++ b/examples/string.gw @@ -4,8 +4,6 @@ string s; #!null @=> s; <<< 1 => s >>>; <<< 1.0 => s >>>; -<<< complex(2,1) => s >>>; -<<< polar(2,1) => s >>>; <<< "test" => s >>>; #! new <<< "test" => s >>>; #! new <<< s >>>; @@ -20,15 +18,9 @@ string s; { (1 + s) @=> string ref str; } { (2.0 +s) @=> string ref str; } -{ (complex(2,1) + s) @=> string ref str; } -{ (polar(2,1) + s) @=> string ref str; } -#!{ ("test" + s) @=> string ref str; } // leak - <<< 11 +=> s >>>; <<< 11.0 +=> s >>>; -<<< complex(21,11) +=> s >>>; -<<< polar(22,12) +=> s >>>; <<< o +=> s >>>; <<< "test" + s >>>; #! also leak <<< null +=> s >>>; #! also hang diff --git a/examples/vararg.gw b/examples/vararg.gw index a7b9ae77..8d1df413 100644 --- a/examples/vararg.gw +++ b/examples/vararg.gw @@ -7,13 +7,9 @@ fun void test(...) { else if(i == 1) <<< vararg $ float >>>; else if(i == 2) - <<< vararg $ complex >>>; - else if(i == 3) - <<< vararg $ polar >>>; - else if(i == 4) <<< vararg $ Object >>>; i++; vararg.end; } test(1); -test(1, 2.3, complex(3, 2), polar(3, 2.1), null); +test(1, 2.3, null); diff --git a/include/lang_private.h b/include/lang_private.h index c2ba318c..61d650e3 100644 --- a/include/lang_private.h +++ b/include/lang_private.h @@ -1,7 +1,6 @@ #ifndef __LANG_PRIVATE #define __LANG_PRIVATE ANN m_bool import_prim(const Gwi gwi); -ANN m_bool import_complex(const Gwi gwi); ANN m_bool import_object(const Gwi gwi); ANN m_bool import_vararg(const Gwi gwi); ANN m_bool import_string(const Gwi gwi); diff --git a/src/lib/complex.c b/src/lib/complex.c deleted file mode 100644 index 4a3c176c..00000000 --- a/src/lib/complex.c +++ /dev/null @@ -1,212 +0,0 @@ -#include -#include "gwion_util.h" -#include "gwion_ast.h" -#include "gwion_env.h" -#include "vm.h" -#include "instr.h" -#include "object.h" -#include "gwion.h" -#include "operator.h" -#include "import.h" - -#include "gwi.h" -#include "gack.h" -#include "emit.h" - -#define describe(name, op) \ -static INSTR(Complex##name) {\ - POP_REG(shred, SZ_COMPLEX); \ - *(m_complex*)REG(-SZ_COMPLEX) op##= *(m_complex*)REG(0); \ -} -describe(Add, +) -describe(Sub, -) -describe(Mul, *) -describe(Div, /) - -static INSTR(ComplexRAssign) { - POP_REG(shred, SZ_INT); - **(m_complex**)REG(0) = *(m_complex*)REG(-SZ_COMPLEX); -} - -#define describe_r(name, op) \ -static INSTR(ComplexR##name) {\ - POP_REG(shred, SZ_INT); \ - *(m_complex*)REG(-SZ_COMPLEX) = (**(m_complex**)REG(0) op##= (*(m_complex*)REG(-SZ_COMPLEX))); \ -} -describe_r(Add, +) -describe_r(Sub, -) -describe_r(Mul, *) -describe_r(Div, /) - -INSTR(ComplexReal) { -// if(!instr->m_val) { // other case skipped in emit.c - *(m_float*)REG(-SZ_INT) = **(m_float**)REG(-SZ_INT); - PUSH_REG(shred, SZ_FLOAT - SZ_INT); -// } -} - -INSTR(ComplexImag) { - if(instr->m_val) { - const m_float* f = *(m_float**)REG(-SZ_INT); - *(const m_float**)REG(-SZ_INT) = (f + 1); - } else { - const m_float* f = *(m_float**)REG(-SZ_INT); - *(m_float*)REG(-SZ_INT) = *(f + 1); - PUSH_REG(shred, SZ_FLOAT - SZ_INT); - } -} - -#if defined __clang__ && defined BUILD_ON_WINDOWS -#define POLAR(a, b, c) m_complex a = { b, c }; -#else -#define POLAR(a, b, c) m_complex a = b + c *I; -#endif - -#define polar_def1(name, op) \ -static INSTR(Polar##name) { \ - POP_REG(shred, SZ_COMPLEX); \ - const m_complex a = *(m_complex*)REG(-SZ_COMPLEX); \ - const m_complex b = *(m_complex*)REG(0); \ - const m_float re = creal(a) * cos(cimag(a)) op creal(b) * cos(cimag(b)); \ - const m_float im = creal(a) * sin(cimag(a)) op creal(b) * sin(cimag(b)); \ - POLAR(c, hypot(re, im), atan2(im, re)) \ - *(m_complex*)REG(-SZ_COMPLEX) = c; \ -} - -polar_def1(Add, +) -polar_def1(Sub, -) - -#define polar_def2(name, op1, op2) \ -static INSTR(Polar##name) {\ - POP_REG(shred, SZ_COMPLEX); \ - const m_complex a = *(m_complex*)REG(-SZ_COMPLEX); \ - const m_complex b = *(m_complex*)REG(0); \ - const m_float mag = creal(a) op1 creal(b); \ - const m_float phase = cimag(a) op2 cimag(b); \ - POLAR(c, mag, phase); \ - *(m_complex*)REG(-SZ_COMPLEX) = c; \ -} -polar_def2(Mul, *, +) -polar_def2(Div, /, -) - -#define polar_def1_r(name, op) \ -static INSTR(PolarR##name) {\ - POP_REG(shred, SZ_INT); \ - const m_complex a = *(m_complex*)REG(-SZ_COMPLEX); \ - const m_complex b = **(m_complex**)REG(0); \ - const m_float re = creal(a) * cos(cimag(a)) op creal(b) * cos(cimag(b)); \ - const m_float im = creal(a) * sin(cimag(a)) op creal(b) * sin(cimag(b)); \ - POLAR(c, hypot(re, im), atan2(im, re)) \ - *(m_complex*)REG(-SZ_COMPLEX) = **(m_complex**)REG(0) = c; \ -} -polar_def1_r(Add, +) -polar_def1_r(Sub, -) - -#define polar_def2_r(name, op1, op2) \ -static INSTR(PolarR##name) { \ - POP_REG(shred, SZ_INT); \ - const m_complex a = *(m_complex*)REG(-SZ_COMPLEX); \ - const m_complex b = **(m_complex**)REG(0); \ - const m_float mag = creal(a) op1 creal(b); \ - const m_float phase = cimag(a) op2 cimag(b); \ - POLAR(c, mag, phase); \ - *(m_complex*)REG(-SZ_COMPLEX) = **(m_complex**)REG(0) = c; \ -} -polar_def2_r(Mul, *, +) -polar_def2_r(Div, /, -) - -static GACK(gack_complex) { - INTERP_PRINTF("#(%.4f, %.4f)", *(m_float*)VALUE, *(m_float*)(VALUE + SZ_FLOAT)); -} - -static GACK(gack_polar) { - INTERP_PRINTF("%%(%4f, %.4f*pi)", *(m_float*)VALUE, *(m_float*)(VALUE + SZ_FLOAT) / M_PI); -} - -EQUALITY_OPER(complex, SZ_COMPLEX) -OP_CHECK(opck_vecx_ctor); - -#define opem(type, first_name) static OP_EMIT(opem_##type##_dot) { \ - const Exp_Dot *dot = (Exp_Dot*)data; \ - const Exp base = dot->base; \ - base->emit_var = 1; \ - if(emit_exp(emit, base, 0) < 0) return (Instr)GW_OK; \ - const m_bool is_first = !strcmp(#first_name, s_name(dot->xid)); \ - if(is_first && exp_self(dot)->emit_var) \ - return (Instr)GW_OK; \ - const Instr instr = emit_add_instr(emit, is_first ? ComplexReal : ComplexImag);\ - instr->m_val = exp_self(dot)->emit_var; \ - return (Instr)GW_OK; \ -} -opem(complex, re) -opem(polar, mod) - -OP_CHECK(opck_object_dot); -GWION_IMPORT(complex) { - const Type t_complex = gwi_class_spe(gwi, "complex", SZ_COMPLEX); - GWI_BB(gwi_gack(gwi, t_complex, gack_complex)) - gwi_item_ini(gwi, "float", "re"); - GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) - gwi_item_ini(gwi, "float", "im"); - GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) - GWI_BB(gwi_class_end(gwi)) - const Type t_polar = gwi_class_spe(gwi, "polar", SZ_COMPLEX); - GWI_BB(gwi_gack(gwi, t_polar, gack_polar)) - GWI_BB(gwi_item_ini(gwi, "float", "mod")) - GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) - GWI_BB(gwi_item_ini(gwi, "float", "phase")) - GWI_BB(gwi_item_end(gwi, ae_flag_member, NULL)) - GWI_BB(gwi_class_end(gwi)) - - GWI_BB(gwi_oper_ini(gwi, "complex", NULL, NULL)) - GWI_BB(gwi_oper_add(gwi, opck_vecx_ctor)) - GWI_BB(gwi_oper_end(gwi, "@ctor", NULL)) - GWI_BB(gwi_oper_ini(gwi, "polar", NULL, NULL)) - GWI_BB(gwi_oper_add(gwi, opck_vecx_ctor)) - GWI_BB(gwi_oper_end(gwi, "@ctor", NULL)) - GWI_BB(gwi_oper_ini(gwi, "complex", "complex", "bool")) - GWI_BB(gwi_oper_end(gwi, "==", complex_eq)) - GWI_BB(gwi_oper_end(gwi, "!=", complex_ne)) - GWI_BB(gwi_oper_ini(gwi, "complex", "complex", "complex")) - GWI_BB(gwi_oper_end(gwi, "+", ComplexAdd)) - GWI_BB(gwi_oper_end(gwi, "-", ComplexSub)) - GWI_BB(gwi_oper_end(gwi, "*", ComplexMul)) - GWI_BB(gwi_oper_end(gwi, "/", ComplexDiv)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "=>", ComplexRAssign)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "+=>", ComplexRAdd)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "-=>", ComplexRSub)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "*=>", ComplexRMul)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "/=>", ComplexRDiv)) - GWI_BB(gwi_oper_ini(gwi, "polar", "polar", "bool")) - GWI_BB(gwi_oper_end(gwi, "==", complex_eq)) - GWI_BB(gwi_oper_end(gwi, "!=", complex_ne)) - GWI_BB(gwi_oper_ini(gwi, "polar", "polar", "polar")) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "=>", ComplexRAssign)) - GWI_BB(gwi_oper_end(gwi, "+", PolarAdd)) - GWI_BB(gwi_oper_end(gwi, "-", PolarSub)) - GWI_BB(gwi_oper_end(gwi, "*", PolarMul)) - GWI_BB(gwi_oper_end(gwi, "/", PolarDiv)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "+=>", PolarRAdd)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "-=>", PolarRSub)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "*=>", PolarRMul)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "/=>", PolarRDiv)) - GWI_BB(gwi_oper_ini(gwi, "complex", (m_str)OP_ANY_TYPE, NULL)) - GWI_BB(gwi_oper_add(gwi, opck_object_dot)) - GWI_BB(gwi_oper_emi(gwi, opem_complex_dot)) - GWI_BB(gwi_oper_end(gwi, "@dot", NULL)) - GWI_BB(gwi_oper_ini(gwi, "polar", (m_str)OP_ANY_TYPE, NULL)) - GWI_BB(gwi_oper_add(gwi, opck_object_dot)) - GWI_BB(gwi_oper_emi(gwi, opem_polar_dot)) - GWI_BB(gwi_oper_end(gwi, "@dot", NULL)) - return GW_OK; -} diff --git a/src/lib/engine.c b/src/lib/engine.c index 8452ec01..644546d6 100644 --- a/src/lib/engine.c +++ b/src/lib/engine.c @@ -133,7 +133,6 @@ ANN static m_bool import_core_libs(const Gwi gwi) { GWI_BB(gwi_oper_emi(gwi, opem_new)) GWI_BB(gwi_oper_end(gwi, "new", NULL)) GWI_BB(import_prim(gwi)) - GWI_BB(import_complex(gwi)) GWI_BB(import_vararg(gwi)) GWI_BB(import_string(gwi)) GWI_BB(import_shred(gwi)) diff --git a/src/lib/string.c b/src/lib/string.c index 725632d1..4a3b084a 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -1,6 +1,5 @@ #include #include -#include #include #include "gwion_util.h" #include "gwion_ast.h" @@ -69,12 +68,6 @@ describe_string_assign(Int_, m_int, SZ_INT,, describe_string_assign(Float_, m_float, SZ_FLOAT,, num_digit((m_uint)lhs) + 6, "%.4f", lhs) -describe_string_assign(Complex_, m_complex, SZ_COMPLEX,, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + 16, - "#(%.4f, %.4f)", creal(lhs), cimag(lhs)) -describe_string_assign(Polar_, m_complex, SZ_COMPLEX,, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs) / M_PI) + 16, - "#(%.4f, %.4f)", creal(lhs), cimag(lhs)/M_PI) describe_string_assign(Object_, M_Object, SZ_INT, release(lhs, shred), 16, "%p", (void*)lhs) @@ -109,12 +102,6 @@ describe_string(Int, m_int, SZ_INT, describe_string(Float, m_float, SZ_FLOAT, (num_digit((m_uint)lhs) + 5 + (rhs ? strlen(STRING(rhs)) : 0) + 1),, "%.4f%s", lhs, rhs ? STRING(rhs) : "") -describe_string(Complex, m_complex, SZ_COMPLEX, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + (rhs ? strlen(STRING(rhs)) : 0) + 16,, - "#(%.4f, %.4f)%s", creal(lhs), cimag(lhs), rhs ? STRING(rhs) : "") -describe_string(Polar, m_complex, SZ_COMPLEX, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs) / M_PI) + (rhs ? strlen(STRING(rhs)) : 0) + 20,, - "%%(%.4f, %.4f*pi)%s", creal(lhs), cimag(lhs) / M_PI, rhs ? STRING(rhs) : "") describe_string(Object, M_Object, SZ_INT, 17 + (rhs ? strlen(STRING(rhs)) : 0), /*release(lhs, shred)*/, "%p%s", (void*)lhs, rhs ? STRING(rhs) : "") @@ -138,12 +125,6 @@ describe_string_plus(Int_, SZ_INT, m_int,, num_digit((m_uint)lhs), "%"INT_F, lhs) describe_string_plus(Float_, SZ_FLOAT, m_float,, num_digit((m_uint)lhs) + 6, "%.4f", lhs) -describe_string_plus(Complex_, SZ_COMPLEX, m_complex,, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + 18, "#(%.4f, %.4f)", - creal(lhs), cimag(lhs)) -describe_string_plus(Polar_, SZ_COMPLEX, m_complex,, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + 18, "%%(%.4f, %.4f)", - creal(lhs), cimag(lhs) / M_PI) describe_string_plus(Object_, SZ_INT, M_Object, release(lhs, shred), 16, "%p", (void*)lhs) @@ -224,20 +205,6 @@ GWION_IMPORT(string) { GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) GWI_BB(gwi_oper_end(gwi, "+=>", Float_String_Plus)) - GWI_BB(gwi_oper_ini(gwi, "complex", "string", "string")) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "=>", Complex_String_Assign)) - GWI_BB(gwi_oper_end(gwi, "+", Complex_String)) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "+=>", Complex_String_Plus)) - - GWI_BB(gwi_oper_ini(gwi, "polar", "string", "string")) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "=>", Polar_String_Assign)) - GWI_BB(gwi_oper_end(gwi, "+", Polar_String)) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "+=>", Polar_String_Plus)) - GWI_BB(gwi_oper_ini(gwi, "Object", "string", "string")) GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) GWI_BB(gwi_oper_end(gwi, "=>", Object_String_Assign)) diff --git a/tests/bug/array.gw b/tests/bug/array.gw index b1122045..90b52c28 100644 --- a/tests/bug/array.gw +++ b/tests/bug/array.gw @@ -1,26 +1,17 @@ class Test_Array { - int i[4]; float f[4]; - complex c[4]; - polar p[4]; i[0]; f[0]; - c[0]; - p[0]; v[0]; w[0]; 2 => i[0]; 5.7 => f[0]; - complex(2.1, 3.4) => c[0]; - polar(2.3, 5.6) => p[0]; i << 1; f << 1.2; - c << complex(2.1, 3.4); - p << polar(2.3, 5.6); <<< i.size() >>>; } diff --git a/tests/bug/static_data.gw b/tests/bug/static_data.gw index a84783c5..f3c96bc3 100644 --- a/tests/bug/static_data.gw +++ b/tests/bug/static_data.gw @@ -2,10 +2,8 @@ class C { static int i; static float f; - static complex c; static Object o; } <<< C.i >>>; <<< C.f >>>; -<<< C.c >>>; <<< C.o >>>; diff --git a/tests/error/complex_too_big.gw b/tests/error/complex_too_big.gw deleted file mode 100644 index 896c8a39..00000000 --- a/tests/error/complex_too_big.gw +++ /dev/null @@ -1,2 +0,0 @@ -#! [contains] extraneous component of complex value - complex(0,0,0,0); diff --git a/tests/error/divide_by_zero.gw b/tests/error/divide_by_zero.gw index 659e93f5..82ea9f1e 100644 --- a/tests/error/divide_by_zero.gw +++ b/tests/error/divide_by_zero.gw @@ -1,2 +1,2 @@ #! [contains] ZeroDivideException -[ complex(0.0, 0/0) ]; +[ 0/0 ]; diff --git a/tests/error/polar_too_big.gw b/tests/error/polar_too_big.gw deleted file mode 100644 index adff42cf..00000000 --- a/tests/error/polar_too_big.gw +++ /dev/null @@ -1,2 +0,0 @@ -#! [contains] extraneous component of polar value -polar(0,0,0,0); diff --git a/tests/import/coverage.c b/tests/import/coverage.c index ba76a82b..4f89da3f 100644 --- a/tests/import/coverage.c +++ b/tests/import/coverage.c @@ -1,4 +1,3 @@ -#include "complex.h" #include "gwion_util.h" #include "gwion_ast.h" #include "gwion_env.h" @@ -12,7 +11,6 @@ SFUN(coverage_int) { *(m_uint*)RETURN = 0; } SFUN(coverage_float) { *(m_float*)RETURN = 0; } -SFUN(coverage_complex) { *(m_complex*)RETURN = 0; } GWION_IMPORT(coverage) { GWI_OB(gwi_class_ini(gwi, "Coverage", NULL)) @@ -20,8 +18,6 @@ GWION_IMPORT(coverage) { GWI_BB(gwi_func_end(gwi, coverage_int, ae_flag_static)) GWI_BB(gwi_func_ini(gwi, "float", "f")) GWI_BB(gwi_func_end(gwi, coverage_float, ae_flag_static)) - GWI_BB(gwi_func_ini(gwi, "complex", "c")) - GWI_BB(gwi_func_end(gwi, coverage_complex, ae_flag_static)) ALLOC_PTR(gwi->gwion->mp, i, m_uint, 5); GWI_BB(gwi_item_ini(gwi,"int", "s_i")) @@ -31,11 +27,6 @@ GWION_IMPORT(coverage) { GWI_BB(gwi_item_ini(gwi,"int", "s_f")) GWI_BB(gwi_item_end(gwi, ae_flag_static, (void*)f)) - const m_complex _c = 2.1 + 2.2*I; - ALLOC_PTR(gwi->gwion->mp, c, m_complex, _c); - GWI_BB(gwi_item_ini(gwi,"complex", "s_c")) - GWI_BB(gwi_item_end(gwi, ae_flag_static, (void*)c)) - ALLOC_PTR(gwi->gwion->mp, ci, m_uint, 5); GWI_BB(gwi_item_ini(gwi,"int", "sc_i")) GWI_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, ci)) @@ -44,11 +35,6 @@ GWION_IMPORT(coverage) { GWI_BB(gwi_item_ini(gwi,"float", "sc_f")) GWI_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)cf)) - const m_complex _cc = 2.1 + 2.2*I; - ALLOC_PTR(gwi->gwion->mp, cc, m_complex, _cc); - GWI_BB(gwi_item_ini(gwi,"complex", "sc_c")) - GWI_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)cc)) - GWI_BB(gwi_item_ini(gwi,"int[][]", "test_array")) GWI_BB(gwi_item_end(gwi, ae_flag_none, NULL)) diff --git a/tests/import/coverage.gw b/tests/import/coverage.gw index 2af0d2ec..7b1227dc 100644 --- a/tests/import/coverage.gw +++ b/tests/import/coverage.gw @@ -3,18 +3,14 @@ Coverage c; c.s_i; <<< Coverage.i() >>>; <<< Coverage.f() >>>; -<<< Coverage.c() >>>; <<< Coverage.s_i >>>; <<< Coverage.s_f >>>; -<<< Coverage.s_c >>>; <<< Coverage.sc_i >>>; <<< Coverage.sc_f >>>; -<<< Coverage.sc_c >>>; <<< 1 => Coverage.s_i >>>; <<< 1.2 => Coverage.s_f >>>; -<<< complex(1.2, 0.1) => Coverage.s_c >>>; <<< c.test_array[0][0] >>>; diff --git a/tests/tree/balance.gw b/tests/tree/balance.gw index d0540d88..007d2a4b 100644 --- a/tests/tree/balance.gw +++ b/tests/tree/balance.gw @@ -1,10 +1,7 @@ fun float test() {} fun float test(int i) {} fun float test(float f) {} -fun float test(complex c) {} -fun complex ctest(){} -ctest(); test(); () => test; @@ -14,20 +11,15 @@ test(1); test(1.2); 1.2 => test; -test(complex(2.3, 4.5)); -complex(2.3, 4.5) => test; - class C { fun float test() {} fun float test(int i) {} fun float test(float f) {} - fun float test(complex c) {} fun static float s_test() {} fun static float s_test(int i) {} fun static float s_test(float f) {} - fun static float s_test(complex c) {} } C c; @@ -40,9 +32,6 @@ c.test(1); c.test(1.2); 1.2 => c.test; -c.test(complex(2.3, 4.5)); -complex(2.3, 4.5) => c.test; - c.s_test(); () => c.s_test; @@ -52,9 +41,6 @@ c.s_test(1); c.s_test(1.2); 1.2 => c.s_test; -c.s_test(complex(2.3, 4.5)); -complex(2.3, 4.5) => c.s_test; - C.s_test(); () => C.s_test; @@ -63,6 +49,3 @@ C.s_test(1); C.s_test(1.2); 1.2 => C.s_test; - -C.s_test(complex(2.3, 4.5)); -complex(2.3, 4.5) => C.s_test; diff --git a/tests/tree/class_template.gw b/tests/tree/class_template.gw index 82eecab6..2c687b99 100644 --- a/tests/tree/class_template.gw +++ b/tests/tree/class_template.gw @@ -12,7 +12,6 @@ class<~A,B~> C { #!<<< C >>>; <~int, int~>C c; <~float, int~>C d; -<~polar, int~>C e; <~Object, int~>C g; #!C c; <<< c.a >>>; diff --git a/tests/tree/func_return_coverage.gw b/tests/tree/func_return_coverage.gw deleted file mode 100644 index ee5eee6d..00000000 --- a/tests/tree/func_return_coverage.gw +++ /dev/null @@ -1,2 +0,0 @@ -fun complex testc() {}; -testc(); diff --git a/tests/tree/push_mem.gw b/tests/tree/push_mem.gw deleted file mode 100644 index e71191e1..00000000 --- a/tests/tree/push_mem.gw +++ /dev/null @@ -1,2 +0,0 @@ -fun void test() { complex c; c; } -test(); -- 2.43.0