From 2b7d801591b182a011da78af38d48da8dcd6c02d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 8 Mar 2020 18:42:10 +0100 Subject: [PATCH] :fire: Remove vec --- examples/array_lit.gw | 2 - examples/array_multiple.gw | 9 - examples/binary_tmpl.gw | 1 - examples/class_coverage.gw | 2 - examples/member.gw | 11 +- examples/op2.gw | 14 - examples/static.gw | 12 +- examples/string.gw | 6 - examples/vararg.gw | 6 +- examples/vec3.gw | 46 --- examples/vec4.gw | 44 --- include/lang_private.h | 2 - src/emit/emit.c | 11 +- src/lib/engine.c | 2 - src/lib/string.c | 34 --- src/lib/vec.c | 431 ---------------------------- src/vm/vm.c | 3 +- tests/bug/array.gw | 6 - tests/bug/static_data.gw | 4 - tests/error/vararg_invalid_acces.gw | 2 +- tests/error/vector_too_big.gw | 2 - tests/import/callback2.gw | 7 +- tests/import/coverage.c | 26 -- tests/import/coverage.gw | 8 - tests/match/internal_multi.gw | 2 +- tests/new/pure.gw | 1 - tests/new/pure_member.gw | 1 - tests/tree/balance.gw | 35 --- tests/tree/class_template.gw | 1 - tests/tree/cpy_ast.gw | 1 - tests/tree/func_return_coverage.gw | 4 - tests/tree/push_mem.gw | 2 +- tests/tree/vec_num_dim.gw | 2 - tests/tuple/tuple_member_float.gw | 2 +- 34 files changed, 15 insertions(+), 727 deletions(-) delete mode 100644 examples/vec3.gw delete mode 100644 examples/vec4.gw delete mode 100644 src/lib/vec.c delete mode 100644 tests/error/vector_too_big.gw delete mode 100644 tests/tree/vec_num_dim.gw diff --git a/examples/array_lit.gw b/examples/array_lit.gw index 296985c8..56004e01 100644 --- a/examples/array_lit.gw +++ b/examples/array_lit.gw @@ -16,5 +16,3 @@ int k[1][1]; [ 1.0, 2, 3, 4, 5 ]; [ complex(0.0, 0.0) ]; -[ Vec3(0.0, 0.0, 0.0) ]; -[ Vec4(0.0, 0.0, 0.0, 0.0) ]; diff --git a/examples/array_multiple.gw b/examples/array_multiple.gw index fc09c92d..741ab8e2 100644 --- a/examples/array_multiple.gw +++ b/examples/array_multiple.gw @@ -21,12 +21,3 @@ complex c[4][4]; polar p[4][4]; <<< p[2][3] >>>; <<< p[2][3].mod >>>; - -Vec3 v[4][4]; -<<< v[2][3] >>>; -<<< v[2][3].x >>>; - -Vec4 w[4][4]; -<<< w[2][3] >>>; -<<< w[2][3].w >>>; -<<< a[2][3].i >>>; diff --git a/examples/binary_tmpl.gw b/examples/binary_tmpl.gw index e8e29b73..1903f662 100644 --- a/examples/binary_tmpl.gw +++ b/examples/binary_tmpl.gw @@ -6,6 +6,5 @@ fun void test<~A~>(A a) { <<< a >>>; } 1 => test; 1.3 => test; test(1); -Vec3(23) => test; test(1.3); C->D d => test; diff --git a/examples/class_coverage.gw b/examples/class_coverage.gw index 240b88ac..78bd67a7 100644 --- a/examples/class_coverage.gw +++ b/examples/class_coverage.gw @@ -4,8 +4,6 @@ class C float f; complex c; polar p; - Vec3 v; - Vec4 w; Object o; operator @dtor void () { <<< "dtor" >>>; } } diff --git a/examples/member.gw b/examples/member.gw index 446a3cca..f23f905f 100644 --- a/examples/member.gw +++ b/examples/member.gw @@ -3,30 +3,23 @@ class C int i; float f; complex c; - Vec3 v; - Vec4 w; Object o; fun int m_i() { return i; } fun float m_f() { return f; } fun complex m_c() { return c; } - fun Vec3 m_v() { return v; } - fun Vec4 m_w() { return w; } fun Object m_o() { return o; } } C c; #! read members -<<< c.i, c.c, c.f, c.v, c.w, c.o >>>; +<<< c.i, c.c, c.f, c.o >>>; #! call fun members -<<< c.m_i(), " ", c.m_f(), " ", c.m_c(), " ", - c.m_v(), " ", c.m_w(), " ", c.m_o() >>>; +<<< c.m_i(), " ", c.m_f(), " ", c.m_c(), " ", c.m_o() >>>; #! write members <<< 12 => c.i >>>; <<< 1.2 => c.f >>>; <<< complex(0.1, 2.3) => c.c >>>; -<<< Vec3(0.1, 2.3, 3.4) => c.v >>>; -<<< Vec4(0.1, 2.3, 3.4, 5.4) => c.w >>>; <<< null @=> c.o >>>; diff --git a/examples/op2.gw b/examples/op2.gw index 7d9f0957..da994492 100644 --- a/examples/op2.gw +++ b/examples/op2.gw @@ -8,18 +8,12 @@ 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 => Vec3 (Vec3 c, C d){ <<< c.z => d.f >>>; return Vec3(1.2, 6.1, 2.3);} -operator => Vec4 (Vec4 c, C d){ <<< "Vec4 => C: ", c.w => d.f >>>; return Vec4(1.2, 6.1, 2.3, 9.3);} 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 => float (Vec3 v, float f){ <<< "vec3 => C: ", f, " ", v.x => 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);} -operator => Vec3 (C d, Vec3 c){ <<< c.z => d.f >>>; return Vec3(1.2, 6.1, 2.3);} -operator => Vec4 (C d, Vec4 c){ <<< "Vec4 => C: ", c.w => d.f >>>; return Vec4(1.2, 6.1, 2.3, 9.3);} C c, d; 12.3 => c.f; @@ -28,21 +22,13 @@ C c, d; <<< 2.3 => d >>>; <<< complex(7.2, 1.4) => d >>>; <<< polar(7.2, 1.4) => d >>>; -<<< Vec3(7.2, 1.4, 8.3) >>>; -<<< Vec3(7.2, 1.4, 8.3) => d >>>; -<<< Vec4(7.2, 1.4, 8.3, 2.3) => d >>>; int i; 2 => float f; complex cmp; -Vec3 v; <<< f >>>; -v => f; -Vec4 w; c => i; <<< c.f >>>; <<< f >>>; c => f; c => cmp; -c => v; -c => w; diff --git a/examples/static.gw b/examples/static.gw index f945cb6b..56738ccf 100644 --- a/examples/static.gw +++ b/examples/static.gw @@ -3,35 +3,27 @@ class C static int i; static float f; static complex c; - static Vec3 v; - static Vec4 w; static Object o; fun int m_i() { return i; } fun float m_f() { return f; } fun complex m_c() { return c; } - fun Vec3 m_v() { return v; } - fun Vec4 m_w() { return w; } 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 Vec3 _v() { return v; } - fun static Vec4 _w() { return w; } fun static Object _o() { return o; } } #! read members -<<< C.i, C.c, C.f, C.v, C.w, C.o >>>; +<<< C.i, C.c, C.f, C.o >>>; #! call fun members -<<< C._i(), " ", C._f(), " ", C._c(), " ", C._v(), " ", C._w(), " ", C._o() >>>; +<<< C._i(), " ", C._f(), " ", C._c(), " ", C._o() >>>; #! write members <<< 12 => C.i >>>; <<< 1.2 => C.f >>>; <<< complex(0.1, 2.3) => C.c >>>; -<<< Vec3(0.1, 2.3, 3.4) => C.v >>>; -<<< Vec4(0.1, 2.3, 3.4, 5.4) => C.w >>>; <<< null @=> C.o >>>; diff --git a/examples/string.gw b/examples/string.gw index 802af15b..86a34d59 100644 --- a/examples/string.gw +++ b/examples/string.gw @@ -6,8 +6,6 @@ string s; <<< 1.0 => s >>>; <<< complex(2,1) => s >>>; <<< polar(2,1) => s >>>; -<<< Vec3(2,1,0) => s >>>; -<<< Vec4(2,1,0,-1) => s >>>; <<< "test" => s >>>; #! new <<< "test" => s >>>; #! new <<< s >>>; @@ -24,8 +22,6 @@ string s; { (2.0 +s) @=> string ref str; } { (complex(2,1) + s) @=> string ref str; } { (polar(2,1) + s) @=> string ref str; } -{ (Vec3(2,1, 0) + s) @=> string ref str; } -{ (Vec4(2,1, 0, -1) + s) @=> string ref str; } #!{ ("test" + s) @=> string ref str; } // leak @@ -33,8 +29,6 @@ string s; <<< 11.0 +=> s >>>; <<< complex(21,11) +=> s >>>; <<< polar(22,12) +=> s >>>; -<<< Vec3(22,11,11) +=> s >>>; -<<< Vec4(22,11,11,-11) +=> s >>>; <<< o +=> s >>>; <<< "test" + s >>>; #! also leak <<< null +=> s >>>; #! also hang diff --git a/examples/vararg.gw b/examples/vararg.gw index 0270e4f9..a7b9ae77 100644 --- a/examples/vararg.gw +++ b/examples/vararg.gw @@ -11,13 +11,9 @@ fun void test(...) { else if(i == 3) <<< vararg $ polar >>>; else if(i == 4) - <<< vararg $ Vec3 >>>; - else if(i == 5) - <<< vararg $ Vec4 >>>; - else if(i == 6) <<< vararg $ Object >>>; i++; vararg.end; } test(1); -test(1, 2.3, complex(3, 2), polar(3, 2.1), Vec3(1,2,3), Vec4(1,2,3,4), null); +test(1, 2.3, complex(3, 2), polar(3, 2.1), null); diff --git a/examples/vec3.gw b/examples/vec3.gw deleted file mode 100644 index f1df76b4..00000000 --- a/examples/vec3.gw +++ /dev/null @@ -1,46 +0,0 @@ -Vec3 v, w; - -<<< v == w >>>; -<<< v != w >>>; - -<<< v + w >>>; -<<< v - w >>>; -<<< v * w >>>; -<<< v / w >>>; - - -<<< v.x >>>; -<<< v.y >>>; -<<< v.z >>>; -<<< 1 => v.x >>>; -<<< 2 => v.y >>>; -<<< -12 => v.z >>>; -<<< Vec3(.1, .2, .4) => v >>>; -<<< v >>>; -<<< "set ", v.set(1,2,3) >>>; -<<< "setAll ", v.setAll(1.2) >>>; -<<< "should be 1.2 1.2 1.2 ", v >>>; -<<< "Update ", v.update(2) >>>; -<<< "Update ", v.update(2, .1) >>>; -<<< "Update ", v.supdate(2) >>>; -<<< "Update ", v.supdate(2, .1) >>>; -<<< "magnitude ", v.magnitude() >>>; -<<< "normalize ", v.normalize() >>>; -<<< "interp ", v.interp() >>>; -<<< "interp ", v.interp(2.3) >>>; -<<< "interp ", v.interp(2.3::samp) >>>; - -w.setAll(1); -v+w; -v-w; -v*w; -v/.1; -10.+w; -w+10.; -10.-w; -w-10.; -10./w; -w/10.; -10.*w; -w*10.; -<<< Vec3(23).x >>>; diff --git a/examples/vec4.gw b/examples/vec4.gw deleted file mode 100644 index 3415180c..00000000 --- a/examples/vec4.gw +++ /dev/null @@ -1,44 +0,0 @@ -Vec4 v, w; -<<< v >>>; - -<<< v == w>>>; -<<< v != w>>>; - -<<< v + w>>>; -<<< v - w>>>; -<<< v * w>>>; -<<< v / w>>>; - -<<< 1.3 + w>>>; -<<< 1.4 - w>>>; -<<< 1.4 * w>>>; -<<< 1.5 / w>>>; - -<<< v.x >>>; -<<< v.y >>>; -<<< v.z >>>; -<<< v.w >>>; - -<<< 1 => v.x >>>; -<<< 1 => v.y >>>; -<<< 1 => v.z >>>; -<<< 1 => v.w >>>; -<<< Vec4(.1, .2, .4, .5) => v >>>; - -<<< "set ", v.set(1,2,3,4) >>>; -<<< "setAll ", v.setAll(1.2) >>>; -<<< "should be 1.2 1.2 1.2 ", v >>>; -<<< "magnitude ", v.magnitude() >>>; -<<< "normalize ", v.normalize() >>>; -w.setAll(1); -v+w; -v-w; -v*w; -v*2.0; -.5*v; -v/.2; -v=>w; -v+1.; -v-1.; -1.+w; -w+2.; diff --git a/include/lang_private.h b/include/lang_private.h index 251f18be..c2ba318c 100644 --- a/include/lang_private.h +++ b/include/lang_private.h @@ -2,8 +2,6 @@ #define __LANG_PRIVATE ANN m_bool import_prim(const Gwi gwi); ANN m_bool import_complex(const Gwi gwi); -ANN m_bool import_vec3(const Gwi gwi); -ANN m_bool import_vec4(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/emit/emit.c b/src/emit/emit.c index d4f1baff..d7fb915b 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -418,13 +418,9 @@ ANN static m_bool emit_exp_slice(const Emitter emit, const Exp_Slice* range) { } ANN static void emit_vec_addr(const Emitter emit, const m_uint sz) { - emit_local(emit, sz, 0); - const m_uint offset = emit_local(emit, SZ_INT, 0); - const Instr cpy = emit_add_instr(emit, VecCpy); - cpy->m_val = offset; - cpy->m_val2 = sz; - const Instr instr = emit_add_instr(emit, RegPushMem); - instr->m_val = offset; + regpop(emit, sz - SZ_INT); + const Instr cpy = emit_add_instr(emit, Reg2RegAddr); + cpy->m_val = -SZ_INT; } ANN static m_bool emit_prim_id(const Emitter emit, const Symbol *data) { @@ -1290,6 +1286,7 @@ ANN static m_bool emit_stmt_loop(const Emitter emit, const Stmt_Loop stmt) { const m_uint index = emit_code_size(emit); const Instr cpy = emit_add_instr(emit, Reg2RegAddr); cpy->m_val2 = -SZ_INT; + regpushi(emit, SZ_INT); emit_add_instr(emit, int_post_dec); const Instr op = emit_add_instr(emit, BranchEqInt); CHECK_BB(scoped_stmt(emit, stmt->body, 1)) diff --git a/src/lib/engine.c b/src/lib/engine.c index 30ecede5..8452ec01 100644 --- a/src/lib/engine.c +++ b/src/lib/engine.c @@ -134,8 +134,6 @@ ANN static m_bool import_core_libs(const Gwi gwi) { GWI_BB(gwi_oper_end(gwi, "new", NULL)) GWI_BB(import_prim(gwi)) GWI_BB(import_complex(gwi)) - GWI_BB(import_vec3(gwi)) - GWI_BB(import_vec4(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 f9e0e270..725632d1 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -75,12 +75,6 @@ describe_string_assign(Complex_, m_complex, SZ_COMPLEX,, 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(Vec3_, m_vec3, SZ_VEC3,, - num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + 25, - "#(%.4f, %.4f, %.4f)", lhs.x, lhs.y, lhs.z) -describe_string_assign(Vec4_, m_vec4, SZ_VEC4,, - num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + num_digit((m_uint)lhs.w) + 40, - "#(%.4f, %.4f, %.4f, %.4f)", lhs.x, lhs.y, lhs.z, lhs.w) describe_string_assign(Object_, M_Object, SZ_INT, release(lhs, shred), 16, "%p", (void*)lhs) @@ -121,14 +115,6 @@ describe_string(Complex, m_complex, SZ_COMPLEX, 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(Vec3, m_vec3, SZ_VEC3, - (rhs ? strlen(STRING(rhs)) : 0) + 23 + num_digit((m_uint)lhs.x) + - num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z),, - "@(%.4f, %.4f, %.4f)%s", lhs.x, lhs.y, lhs.z, rhs ? STRING(rhs) : "") -describe_string(Vec4, m_vec4, SZ_VEC4, - (rhs ? strlen(STRING(rhs)) : 0) + 30 + num_digit((m_uint)lhs.x) + - num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + num_digit((m_uint)lhs.w),, - "@(%.4f, %.4f, %.4f, %.4f)%s", lhs.x, lhs.y, lhs.z, lhs.w, 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) : "") @@ -158,12 +144,6 @@ describe_string_plus(Complex_, SZ_COMPLEX, m_complex,, 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(Vec3_, SZ_VEC3, m_vec3,, - num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + 22, "@(%.4f, %.4f, %.4f)", - lhs.x, lhs.y, lhs.z) -describe_string_plus(Vec4_, SZ_VEC4, m_vec4,, - num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + num_digit((m_uint)lhs.z) + 30, "@(%.4f, %.4f, %.4f, %.4f)", - lhs.x, lhs.y, lhs.z, lhs.w) describe_string_plus(Object_, SZ_INT, M_Object, release(lhs, shred), 16, "%p", (void*)lhs) @@ -258,20 +238,6 @@ GWION_IMPORT(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,"Vec3", "string", "string")) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "=>", Vec3_String_Assign)) - GWI_BB(gwi_oper_end(gwi, "+", Vec3_String)) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "+=>", Vec3_String_Plus)) - - GWI_BB(gwi_oper_ini(gwi, "Vec4", "string", "string")) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "=>", Vec4_String_Assign)) - GWI_BB(gwi_oper_end(gwi, "+", Vec4_String)) - GWI_BB(gwi_oper_add(gwi, opck_const_rhs)) - GWI_BB(gwi_oper_end(gwi, "+=>", Vec4_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/src/lib/vec.c b/src/lib/vec.c deleted file mode 100644 index 5273103a..00000000 --- a/src/lib/vec.c +++ /dev/null @@ -1,431 +0,0 @@ -#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 "traverse.h" -#include "parse.h" -#include "import.h" -#include "driver.h" -#include "gwi.h" -#include "gack.h" -#include "emit.h" - -INSTR(VecCpy) { - POP_REG(shred, instr->m_val2); - for(m_uint i = 0; i < instr->m_val2; i += SZ_FLOAT) - *(m_float*)(shred->mem +instr->m_val-instr->m_val2+i) = *(m_float*)(shred->reg+i); - *(m_bit**)(shred->mem + instr->m_val) = (shred->mem + instr->m_val - instr->m_val2); -} - -INSTR(VecMember) { - if(instr->m_val) - *(m_float**)REG(-SZ_INT) = (m_float*)(*(m_bit**)REG(-SZ_INT) + instr->m_val2); - else { - *(m_float*)REG(-SZ_INT) = *(m_float*)(*(m_bit**)REG(-SZ_INT) + instr->m_val2); - PUSH_REG(shred, SZ_FLOAT - SZ_INT); - } -} - -#define describe_vec(func, op) \ -ANN static void vec_##func(const m_bit* v, const int size, const m_float f) { \ - for(int i = size + 1; --i;) \ - *(m_float*)(v + (i-1) * SZ_FLOAT) op##= f; \ -} -describe_vec(Add, +) -describe_vec(Sub, -) -describe_vec(Mul, *) -describe_vec(Div, /) - -static MFUN(vec3_set) { - m_vec3* v = (m_vec3*)MEM(0); - v->x = *(m_float*)MEM(SZ_INT); - v->y = *(m_float*)MEM(SZ_INT + SZ_FLOAT); - v->z = *(m_float*)MEM(SZ_INT + SZ_FLOAT * 2); -} - -static MFUN(vec3_setAll) { - m_vec3* v = *(m_vec3**)MEM(0); - v->x = *(m_float*)MEM(SZ_INT); - v->y = *(m_float*)MEM(SZ_INT); - v->z = *(m_float*)MEM(SZ_INT); -} - -static MFUN(vec3_magnitude) { - const m_vec3* v = *(m_vec3**)MEM(0); - *(m_float*)RETURN = sqrt(v->x * v->x + v->y * v->y + v->z * v->z); -} - -static MFUN(vec3_normalize) { - const m_vec3* v = *(m_vec3**)MEM(0); - const m_float mag = sqrt(v->x * v->x + v->y * v->y + v->z * v->z); - if(mag > 0) - vec_Div((m_bit*)v, 3, mag); -} - -#define describe_vec3_x(name, arg) \ -static MFUN(vec3_##name) { \ - m_vec3* v = *(m_vec3**)MEM(0); \ - v->x = (v->y - v->x) * v->z arg; \ - *(m_float*)RETURN = v->x; \ -} -describe_vec3_x(interp, + v->x) -describe_vec3_x(float, * v->z * (*(m_float*)MEM(SZ_INT)) + v->x) -describe_vec3_x(dur, * (*(m_float*)MEM(SZ_INT) / (m_float)shred->info->vm->bbq->si->sr) + v->x) - -static MFUN(vec3_update) { - m_vec3* v = *(m_vec3**)MEM(0); - v->y = *(m_float*)MEM(SZ_INT); -} - -static MFUN(vec3_update_slew) { - m_vec3* v = *(m_vec3**)MEM(0); - v->y = *(m_float*)MEM(SZ_INT); - v->z = *(m_float*)MEM(SZ_INT + SZ_FLOAT); -} - -static MFUN(vec3_update_set) { - m_vec3* v = *(m_vec3**)MEM(0); - v->x = *(m_float*)MEM(SZ_INT); - v->y = *(m_float*)MEM(SZ_INT); - -} - -static MFUN(vec3_update_set_slew) { - m_vec3* v = *(m_vec3**)MEM(0); - v->x = *(m_float*)MEM(SZ_INT); - v->y = *(m_float*)MEM(SZ_INT); - v->z = *(m_float*)MEM(SZ_INT + SZ_FLOAT); -} - -#define describe_vec3(name, op) \ -static INSTR(Vec3##name) {\ - POP_REG(shred, SZ_VEC3); \ - m_vec3 r, * t = (m_vec3*)REG(-SZ_VEC3); \ - r.x = t->x op (t + 1)->x; \ - r.y = t->y op (t + 1)->y; \ - r.z = t->z op (t + 1)->z; \ - *(m_vec3*)REG(-SZ_VEC3) = r; \ -} -describe_vec3(Add, +) -describe_vec3(Sub, -) -describe_vec3(Mul, *) -describe_vec3(Div, /) - - -#define describe_float_vec3(func) \ -static INSTR(Float##func##Vec3) {\ - POP_REG(shred, SZ_FLOAT); \ - const m_float f = *(m_float*)REG(-SZ_VEC3); \ - const m_vec3 r = *(m_vec3*)REG(-SZ_COMPLEX); \ - vec_Mul((m_bit*)&r, 3, f); \ - *(m_vec3*)REG(-SZ_VEC3) = r; \ -} -describe_float_vec3(Add) -describe_float_vec3(Sub) -describe_float_vec3(Mul) -describe_float_vec3(Div) - -#define describe_vec3_float(func) \ -static INSTR(Vec3##func##Float) {\ - POP_REG(shred, SZ_FLOAT); \ - const m_vec3 r = *(m_vec3*)REG(-SZ_VEC3); \ - const m_float f = *(m_float*)REG(0); \ - vec_##func((m_bit*)&r, 3, f); \ - *(m_vec3*)REG(-SZ_VEC3) = r; \ -} -describe_vec3_float(Add) -describe_vec3_float(Sub) -describe_vec3_float(Mul) -describe_vec3_float(Div) - -static INSTR(Vec3RAssign) { - POP_REG(shred, SZ_INT); - m_vec3* r = *(m_vec3**)REG(0); - r->x = *(m_float*)REG(-SZ_VEC3); - r->y = *(m_float*)REG(-SZ_COMPLEX); - r->z = *(m_float*)REG(-SZ_FLOAT); - *(m_vec3*)REG(0) = *r; -} - -static void vecx_base(const Gwi gwi) { - gwi_item_ini(gwi, "float", "x"); - gwi_item_end(gwi, ae_flag_member, NULL); - gwi_item_ini(gwi, "float", "y"); - gwi_item_end(gwi, ae_flag_member, NULL); - gwi_item_ini(gwi, "float", "z"); - gwi_item_end(gwi, ae_flag_member, NULL); -} - -static GACK(gack_vec3) { - INTERP_PRINTF("%%(%.4f, %.4f, %.4f)", *(m_float*)VALUE, *(m_float*)(VALUE + SZ_FLOAT), *(m_float*)(VALUE + SZ_FLOAT*2)); -} - -EQUALITY_OPER(vec3, SZ_VEC3); - -OP_CHECK(opck_vecx_ctor) { - Exp_Call *call = (Exp_Call*)data; - Exp e = call->args, last = NULL; - if(call->args) - CHECK_ON(check_exp(env, call->args)) - size_t i = 0; - const Type t_float = env->gwion->type[et_float]; - while(e) { - CHECK_BO(check_implicit(env, e, t_float)) - i += SZ_FLOAT; - last = e; - e = e->next; - } - const Type t = call->func->type->e->d.base_type; - while(i > t->size) { - env_err(env, last->pos, "extraneous component of %s value", t->name); - return NULL; - } - if(!call->args) { - call->args = last = new_prim_float(env->gwion->mp, 0.0, loc_cpy(env->gwion->mp, call->func->pos)); - last->type = t_float; - i += SZ_FLOAT; - } - while(i < t->size) { - last = (last->next = new_prim_float(env->gwion->mp, 0.0, loc_cpy(env->gwion->mp, last->pos))); - last->type = t_float; - i += SZ_FLOAT; - } - return t; -} -OP_CHECK(opck_object_dot); - -static OP_EMIT(opem_vec_dot) { - Exp_Dot *member = (Exp_Dot*)data; - member->base->emit_var = 1; - CHECK_BO(emit_exp(emit, member->base, 0)) - const Value v = find_value(member->base->type, member->xid); - if(GET_FLAG(v, func)) { - /*regpushi(emit, (m_uint)v->d.func_ref->code);*/ - const Instr instr = emit_add_instr(emit, RegPushImm); - instr->m_val = (m_uint)v->d.func_ref->code; - return instr; - } - if(!v->from->offset && exp_self(member)->emit_var) - return (Instr)GW_OK; - const Instr instr = emit_add_instr(emit, VecMember); - instr->m_val2 = v->from->offset; - instr->m_val = exp_self(member)->emit_var; - return instr; -} - -GWION_IMPORT(vec3) { - const Type t_vec3 = gwi_class_spe(gwi, "Vec3", SZ_VEC3); - GWI_BB(gwi_gack(gwi, t_vec3, gack_vec3)) - vecx_base(gwi); - gwi_func_ini(gwi, "void", "set"); - gwi_func_arg(gwi, "float", "x"); - gwi_func_arg(gwi, "float", "y"); - gwi_func_arg(gwi, "float", "z"); - GWI_BB(gwi_func_end(gwi, vec3_set, ae_flag_none)) - gwi_func_ini(gwi, "void", "setAll"); - gwi_func_arg(gwi, "float", "x"); - GWI_BB(gwi_func_end(gwi, vec3_setAll, ae_flag_none)) - gwi_func_ini(gwi, "float", "magnitude"); - GWI_BB(gwi_func_end(gwi, vec3_magnitude, ae_flag_none)) - gwi_func_ini(gwi, "void", "normalize"); - GWI_BB(gwi_func_end(gwi, vec3_normalize, ae_flag_none)) - gwi_func_ini(gwi, "float", "interp"); - GWI_BB(gwi_func_end(gwi, vec3_interp, ae_flag_none)) - gwi_func_ini(gwi, "float", "interp"); - gwi_func_arg(gwi, "float", "delta"); - GWI_BB(gwi_func_end(gwi, vec3_float, ae_flag_none)) - gwi_func_ini(gwi, "float", "interp"); - gwi_func_arg(gwi, "dur", "delta"); - GWI_BB(gwi_func_end(gwi, vec3_dur, ae_flag_none)) - gwi_func_ini(gwi, "void", "update"); - gwi_func_arg(gwi, "float", "goal"); - GWI_BB(gwi_func_end(gwi, vec3_update, ae_flag_none)) - gwi_func_ini(gwi, "void", "update"); - gwi_func_arg(gwi, "float", "goal"); - gwi_func_arg(gwi, "float", "slew"); - GWI_BB(gwi_func_end(gwi, vec3_update_slew, ae_flag_none)) - gwi_func_ini(gwi, "void", "supdate"); - gwi_func_arg(gwi, "float", "goalAndValue"); - GWI_BB(gwi_func_end(gwi, vec3_update_set, ae_flag_none)) - gwi_func_ini(gwi, "void", "supdate"); - gwi_func_arg(gwi, "float", "goalAndValue"); - gwi_func_arg(gwi, "float", "slew"); - GWI_BB(gwi_func_end(gwi, vec3_update_set_slew, ae_flag_none)) - GWI_BB(gwi_class_end(gwi)) - - GWI_BB(gwi_oper_ini(gwi, "Vec3", 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, "Vec3", (m_str)OP_ANY_TYPE, NULL)) - GWI_BB(gwi_oper_add(gwi, opck_object_dot)) - GWI_BB(gwi_oper_emi(gwi, opem_vec_dot)) - GWI_BB(gwi_oper_end(gwi, "@dot", NULL)) - - GWI_BB(gwi_oper_ini(gwi, "Vec3", "Vec3", "bool")) - GWI_BB(gwi_oper_end(gwi, "==", vec3_eq)) - GWI_BB(gwi_oper_end(gwi, "!=", vec3_ne)) - GWI_BB(gwi_oper_ini(gwi, "Vec3", "Vec3", "Vec3")) - GWI_BB(gwi_oper_end(gwi, "+", Vec3Add)) - GWI_BB(gwi_oper_end(gwi, "-", Vec3Sub)) - GWI_BB(gwi_oper_end(gwi, "*", Vec3Mul)) - GWI_BB(gwi_oper_end(gwi, "/", Vec3Div)) - GWI_BB(gwi_oper_add(gwi, opck_rassign)) - GWI_BB(gwi_oper_end(gwi, "=>", Vec3RAssign)) - GWI_BB(gwi_oper_ini(gwi, "Vec3", "float", "Vec3")) - GWI_BB(gwi_oper_end(gwi, "+", Vec3AddFloat)) - GWI_BB(gwi_oper_end(gwi, "-", Vec3SubFloat)) - GWI_BB(gwi_oper_end(gwi, "*", Vec3MulFloat)) - GWI_BB(gwi_oper_end(gwi, "/", Vec3DivFloat)) - GWI_BB(gwi_oper_ini(gwi, "float", "Vec3", "Vec3")) - GWI_BB(gwi_oper_end(gwi, "+", FloatAddVec3)) - GWI_BB(gwi_oper_end(gwi, "-", FloatSubVec3)) - GWI_BB(gwi_oper_end(gwi, "*", FloatMulVec3)) - GWI_BB(gwi_oper_end(gwi, "/", FloatDivVec3)) - return GW_OK; -} - -static MFUN(vec4_set) { - m_vec4* v = *(m_vec4**)MEM(0); - v->x = *(m_float*)MEM(SZ_INT); - v->y = *(m_float*)MEM(SZ_INT + SZ_FLOAT); - v->z = *(m_float*)MEM(SZ_INT + SZ_FLOAT * 2); - v->w = *(m_float*)MEM(SZ_INT + SZ_FLOAT * 3); -} - -static MFUN(vec4_setAll) { - m_vec4* v = *(m_vec4**)MEM(0); - v->x = *(m_float*)MEM(SZ_INT); - v->y = *(m_float*)MEM(SZ_INT); - v->z = *(m_float*)MEM(SZ_INT); - v->w = *(m_float*)MEM(SZ_INT); -} - -static MFUN(vec4_magnitude) { - m_vec4* v = *(m_vec4**)MEM(0); - *(m_float*)RETURN = sqrt(v->x * v->x + v->y * v->y + v->z * v->z + v->w * v->w); -} - -static MFUN(vec4_normalize) { - m_vec4* v = *(m_vec4**)MEM(0); - const m_float mag = sqrt(v->x * v->x + v->y * v->y + v->z * v->z + v->w * v->w); - if(mag > 0) - vec_Div((m_bit*)v, 4, mag); -} - -#define describe_vec4(name, op) \ -static INSTR(Vec4##name) {\ - POP_REG(shred, SZ_VEC4); \ - m_vec4 r, * t = (m_vec4*)REG(-SZ_VEC4); \ - r.x = t->x op (t + 1)->x; \ - r.y = t->y op (t + 1)->y; \ - r.z = t->z op (t + 1)->z; \ - r.w = t->w op (t + 1)->w; \ - *(m_vec4*)REG(-SZ_VEC4) = r; \ -} -describe_vec4(Add, +) -describe_vec4(Sub, -) -describe_vec4(Mul, *) -describe_vec4(Div, /) - -#define describe_float_vec4(func) \ -static INSTR(Float##func##Vec4) {\ - POP_REG(shred, SZ_FLOAT); \ - m_float f = *(m_float*)REG(-SZ_VEC4); \ - m_vec4 r = *(m_vec4*)REG(-SZ_VEC3); \ - vec_##func((m_bit*)&r, 4, f); \ - *(m_vec4*)REG(-SZ_VEC4) = r; \ -} -describe_float_vec4(Add) -describe_float_vec4(Sub) -describe_float_vec4(Mul) -describe_float_vec4(Div) - -#define describe_vec4_float(func) \ -static INSTR(Vec4##func##Float) {\ - POP_REG(shred, SZ_FLOAT); \ - m_vec4 r = *(m_vec4*)REG(-SZ_VEC4); \ - m_float f = *(m_float*)REG(0); \ - vec_##func((m_bit*)&r, 4, f); \ - *(m_vec4*)REG(-SZ_VEC4) = r; \ -} -describe_vec4_float(Add) -describe_vec4_float(Sub) -describe_vec4_float(Mul) -describe_vec4_float(Div) - -static INSTR(Vec4RAssign) { - POP_REG(shred, SZ_INT); - m_vec4* r = *(m_vec4**)REG(0); - r->x = *(m_float*)REG(-SZ_VEC4); - r->y = *(m_float*)REG(-SZ_VEC3); - r->z = *(m_float*)REG(-SZ_COMPLEX); - r->w = *(m_float*)REG(-SZ_FLOAT); - *(m_vec4*)REG(0) = *r; -} - -static GACK(gack_vec4) { - INTERP_PRINTF("%%(%.4f, %.4f, %.4f, %.4f)", - *(m_float*)VALUE, - *(m_float*)(VALUE + SZ_FLOAT), - *(m_float*)(VALUE + SZ_FLOAT*2), - *(m_float*)(VALUE + SZ_FLOAT*3)); -} - -EQUALITY_OPER(vec4, SZ_VEC4); - -GWION_IMPORT(vec4) { - const Type t_vec4 = gwi_class_spe(gwi, "Vec4", SZ_VEC4); - GWI_BB(gwi_gack(gwi, t_vec4, gack_vec4)) - vecx_base(gwi); - gwi_item_ini(gwi, "float", "w"); - gwi_item_end(gwi, ae_flag_member, NULL); - gwi_func_ini(gwi, "void", "set"); - gwi_func_arg(gwi, "float", "x"); - gwi_func_arg(gwi, "float", "y"); - gwi_func_arg(gwi, "float", "z"); - gwi_func_arg(gwi, "float", "w"); - CHECK_BB(gwi_func_end(gwi, vec4_set, ae_flag_none)) - gwi_func_ini(gwi, "void", "setAll"); - gwi_func_arg(gwi, "float", "x"); - CHECK_BB(gwi_func_end(gwi, vec4_setAll, ae_flag_none)) - gwi_func_ini(gwi, "float", "magnitude"); - CHECK_BB(gwi_func_end(gwi, vec4_magnitude, ae_flag_none)) - gwi_func_ini(gwi, "void", "normalize"); - CHECK_BB(gwi_func_end(gwi, vec4_normalize, ae_flag_none)) - CHECK_BB(gwi_class_end(gwi)) - - GWI_BB(gwi_oper_ini(gwi, "Vec4", 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, "Vec4", (m_str)OP_ANY_TYPE, NULL)) - GWI_BB(gwi_oper_add(gwi, opck_object_dot)) - GWI_BB(gwi_oper_emi(gwi, opem_vec_dot)) - GWI_BB(gwi_oper_end(gwi, "@dot", NULL)) - - GWI_BB(gwi_oper_ini(gwi, "Vec4", "Vec4", "bool")) - GWI_BB(gwi_oper_end(gwi, "==", vec4_eq)) - GWI_BB(gwi_oper_end(gwi, "!=", vec4_ne)) - CHECK_BB(gwi_oper_ini(gwi, "Vec4", "Vec4", "Vec4")) - CHECK_BB(gwi_oper_end(gwi, "+", Vec4Add)) - CHECK_BB(gwi_oper_end(gwi, "-", Vec4Sub)) - CHECK_BB(gwi_oper_end(gwi, "*", Vec4Mul)) - CHECK_BB(gwi_oper_end(gwi, "/", Vec4Div)) - CHECK_BB(gwi_oper_add(gwi, opck_rassign)) - CHECK_BB(gwi_oper_end(gwi, "=>", Vec4RAssign)) - CHECK_BB(gwi_oper_ini(gwi, "Vec4", "float", "Vec4")) - CHECK_BB(gwi_oper_end(gwi, "+", Vec4AddFloat)) - CHECK_BB(gwi_oper_end(gwi, "-", Vec4SubFloat)) - CHECK_BB(gwi_oper_end(gwi, "*", Vec4MulFloat)) - CHECK_BB(gwi_oper_end(gwi, "/", Vec4DivFloat)) - CHECK_BB(gwi_oper_ini(gwi, "float", "Vec4", "Vec4")) - CHECK_BB(gwi_oper_end(gwi, "+", FloatAddVec4)) - CHECK_BB(gwi_oper_end(gwi, "-", FloatSubVec4)) - CHECK_BB(gwi_oper_end(gwi, "*", FloatMulVec4)) - return (m_bool)gwi_oper_end(gwi, "/", FloatDivVec4); -} diff --git a/src/vm/vm.c b/src/vm/vm.c index fdc31543..1c8af73e 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -424,8 +424,7 @@ regtoreg: *(m_uint*)(reg + (m_int)VAL) = *(m_uint*)(reg + (m_int)VAL2); DISPATCH() regtoregaddr: - *(m_uint**)reg = &*(m_uint*)(reg-SZ_INT); - reg += SZ_INT; + *(m_uint**)(reg + (m_int)VAL) = &*(m_uint*)(reg + (m_int)VAL2); DISPATCH() memsetimm: *(m_uint*)(mem+VAL) = VAL2; diff --git a/tests/bug/array.gw b/tests/bug/array.gw index 89a42d8e..b1122045 100644 --- a/tests/bug/array.gw +++ b/tests/bug/array.gw @@ -5,8 +5,6 @@ class Test_Array float f[4]; complex c[4]; polar p[4]; - Vec3 v[4]; - Vec4 w[4]; i[0]; f[0]; c[0]; @@ -18,15 +16,11 @@ class Test_Array 5.7 => f[0]; complex(2.1, 3.4) => c[0]; polar(2.3, 5.6) => p[0]; - Vec3(2.1, 3.2, 4.3) => v[0]; - Vec4(2.1, 3.2, 4.3, 5.4) => w[0]; i << 1; f << 1.2; c << complex(2.1, 3.4); p << polar(2.3, 5.6); - v << Vec3(2.1, 3.2, 4.3); - w << Vec4(2.1, 3.2, 4.3, 5.4); <<< i.size() >>>; } diff --git a/tests/bug/static_data.gw b/tests/bug/static_data.gw index 85729a8d..a84783c5 100644 --- a/tests/bug/static_data.gw +++ b/tests/bug/static_data.gw @@ -3,13 +3,9 @@ class C static int i; static float f; static complex c; - static Vec3 v; - static Vec4 w; static Object o; } <<< C.i >>>; <<< C.f >>>; <<< C.c >>>; -<<< C.v >>>; -<<< C.w >>>; <<< C.o >>>; diff --git a/tests/error/vararg_invalid_acces.gw b/tests/error/vararg_invalid_acces.gw index ad3a91b0..16fc011c 100644 --- a/tests/error/vararg_invalid_acces.gw +++ b/tests/error/vararg_invalid_acces.gw @@ -4,4 +4,4 @@ fun void test(...) { <<>>; vararg.end; } -Vec3(1.3) => test; +new Object => test; diff --git a/tests/error/vector_too_big.gw b/tests/error/vector_too_big.gw deleted file mode 100644 index a2bf964f..00000000 --- a/tests/error/vector_too_big.gw +++ /dev/null @@ -1,2 +0,0 @@ -#! [contains] extraneous component of - Vec4(0,0,0,0,0); diff --git a/tests/import/callback2.gw b/tests/import/callback2.gw index ef2ea3be..e033c6ac 100644 --- a/tests/import/callback2.gw +++ b/tests/import/callback2.gw @@ -1,14 +1,9 @@ -fun Vec4 test(int i) { <<< "test with arg ", i >>>; } +fun int test(int i) { <<< "test with arg ", i >>>; } -#!typedef Vec4 PT(); -#!test @=> PtrTypeI p; test @=> p; -#!test @=> PT ti; <<< test >>>; -#!<<< ti >>>; <<< p >>>; -#!ti(); <<< "test" >>>; p(2); <<< "end" >>>; diff --git a/tests/import/coverage.c b/tests/import/coverage.c index 26f374b5..ba76a82b 100644 --- a/tests/import/coverage.c +++ b/tests/import/coverage.c @@ -13,8 +13,6 @@ SFUN(coverage_int) { *(m_uint*)RETURN = 0; } SFUN(coverage_float) { *(m_float*)RETURN = 0; } SFUN(coverage_complex) { *(m_complex*)RETURN = 0; } -SFUN(coverage_vec3) { m_vec3 v = {0,0,0}; *(m_vec3*)RETURN = v; } -SFUN(coverage_vec4) { m_vec4 v = {0,0,0,0}; *(m_vec4*)RETURN = v; } GWION_IMPORT(coverage) { GWI_OB(gwi_class_ini(gwi, "Coverage", NULL)) @@ -24,10 +22,6 @@ GWION_IMPORT(coverage) { 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)) - GWI_BB(gwi_func_ini(gwi, "Vec3", "v")) - GWI_BB(gwi_func_end(gwi, coverage_vec3, ae_flag_static)) - GWI_BB(gwi_func_ini(gwi, "Vec4", "w")) - GWI_BB(gwi_func_end(gwi, coverage_vec4, ae_flag_static)) ALLOC_PTR(gwi->gwion->mp, i, m_uint, 5); GWI_BB(gwi_item_ini(gwi,"int", "s_i")) @@ -42,16 +36,6 @@ GWION_IMPORT(coverage) { GWI_BB(gwi_item_ini(gwi,"complex", "s_c")) GWI_BB(gwi_item_end(gwi, ae_flag_static, (void*)c)) - const m_vec3 _v = { 2.1, 2.2, 2.3 }; - ALLOC_PTR(gwi->gwion->mp, v, m_vec3, _v); - GWI_BB(gwi_item_ini(gwi,"Vec3", "s_v")) - GWI_BB(gwi_item_end(gwi, ae_flag_static, (void*)v)) - - const m_vec4 _w = { 2.1, 2.2, 2.3, 2.4 }; - ALLOC_PTR(gwi->gwion->mp, w, m_vec4, _w); - GWI_BB(gwi_item_ini(gwi,"Vec4", "s_w")) - GWI_BB(gwi_item_end(gwi, ae_flag_static, (void*)w)) - 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)) @@ -65,16 +49,6 @@ GWION_IMPORT(coverage) { GWI_BB(gwi_item_ini(gwi,"complex", "sc_c")) GWI_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)cc)) - const m_vec3 _cv = { 2.1, 2.2, 2.3 }; - ALLOC_PTR(gwi->gwion->mp, cv, m_vec3, _cv); - GWI_BB(gwi_item_ini(gwi,"Vec3", "sc_v")) - GWI_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)cv)) - - const m_vec4 _cw = { 2.1, 2.2, 2.3, 2.4 }; - ALLOC_PTR(gwi->gwion->mp, cw, m_vec4, _cw); - GWI_BB(gwi_item_ini(gwi,"Vec4", "sc_w")) - GWI_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)cw)) - 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 2d92e690..2af0d2ec 100644 --- a/tests/import/coverage.gw +++ b/tests/import/coverage.gw @@ -4,25 +4,17 @@ c.s_i; <<< Coverage.i() >>>; <<< Coverage.f() >>>; <<< Coverage.c() >>>; -<<< Coverage.v() >>>; -<<< Coverage.w() >>>; <<< Coverage.s_i >>>; <<< Coverage.s_f >>>; <<< Coverage.s_c >>>; -<<< Coverage.s_v >>>; -<<< Coverage.s_w >>>; <<< Coverage.sc_i >>>; <<< Coverage.sc_f >>>; <<< Coverage.sc_c >>>; -<<< Coverage.sc_v >>>; -<<< Coverage.sc_w >>>; <<< 1 => Coverage.s_i >>>; <<< 1.2 => Coverage.s_f >>>; <<< complex(1.2, 0.1) => Coverage.s_c >>>; -<<< Vec3(1.2, 0.1, 2.6) => Coverage.s_v >>>; -<<< Vec4(1.2, 0.1, 2.6, 4.6) => Coverage.s_w >>>; <<< c.test_array[0][0] >>>; diff --git a/tests/match/internal_multi.gw b/tests/match/internal_multi.gw index c45e141b..5aea3237 100644 --- a/tests/match/internal_multi.gw +++ b/tests/match/internal_multi.gw @@ -1,2 +1,2 @@ #! [contains] must have one -operator @implicit int(Vec3 v, int i) {} +operator @implicit int(int i, int i) {} diff --git a/tests/new/pure.gw b/tests/new/pure.gw index 7768f66c..be0bcf46 100644 --- a/tests/new/pure.gw +++ b/tests/new/pure.gw @@ -4,4 +4,3 @@ fun A pure<~A~>(A i) { return i; } <<< 3 => pure >>>; <<< 4 => pure >>>; <<< 2.2 => pure >>>; -<<< Vec3(2.3) => pure >>>; diff --git a/tests/new/pure_member.gw b/tests/new/pure_member.gw index 35240464..b1470b9a 100644 --- a/tests/new/pure_member.gw +++ b/tests/new/pure_member.gw @@ -5,6 +5,5 @@ fun A pure<~A~>(A i) { return i; } <<< 3 => pure >>>; <<< 4 => pure >>>; <<< 2.2 => pure >>>; -<<< Vec3(2.3) => pure >>>; } C c; diff --git a/tests/tree/balance.gw b/tests/tree/balance.gw index 10f78a24..d0540d88 100644 --- a/tests/tree/balance.gw +++ b/tests/tree/balance.gw @@ -2,15 +2,9 @@ fun float test() {} fun float test(int i) {} fun float test(float f) {} fun float test(complex c) {} -fun float test(Vec3 v) {} -fun float test(Vec4 w) {} fun complex ctest(){} -fun Vec3 vtest(){} -fun Vec4 wtest(){} ctest(); -vtest(); -wtest(); test(); () => test; @@ -23,27 +17,17 @@ test(1.2); test(complex(2.3, 4.5)); complex(2.3, 4.5) => test; -test(Vec3(1.2, 2.3, 3.4)); -Vec3(1.2, 2.3, 3.4) => test; - -test(Vec4(1.2, 2.3, 3.4, 4.5)); -Vec4(1.2, 2.3, 3.4, 4.5) => test; - class C { fun float test() {} fun float test(int i) {} fun float test(float f) {} fun float test(complex c) {} - fun float test(Vec3 v) {} - fun float test(Vec4 w) {} 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) {} - fun static float s_test(Vec3 v) {} - fun static float s_test(Vec4 w) {} } C c; @@ -59,12 +43,6 @@ c.test(1.2); c.test(complex(2.3, 4.5)); complex(2.3, 4.5) => c.test; -c.test(Vec3(1.2, 2.3, 3.4)); -Vec3(1.2, 2.3, 3.4) => c.test; - -c.test(Vec4(1.2, 2.3, 3.4, 4.5)); -Vec4(1.2, 2.3, 3.4, 4.5) => c.test; - c.s_test(); () => c.s_test; @@ -77,12 +55,6 @@ c.s_test(1.2); c.s_test(complex(2.3, 4.5)); complex(2.3, 4.5) => c.s_test; -c.s_test(Vec3(1.2, 2.3, 3.4)); -Vec3(1.2, 2.3, 3.4) => c.s_test; - -c.s_test(Vec4(1.2, 2.3, 3.4, 4.5)); -Vec4(1.2, 2.3, 3.4, 4.5) => c.s_test; - C.s_test(); () => C.s_test; @@ -94,10 +66,3 @@ C.s_test(1.2); C.s_test(complex(2.3, 4.5)); complex(2.3, 4.5) => C.s_test; - -C.s_test(Vec3(1.2, 2.3, 3.4)); -Vec3(1.2, 2.3, 3.4) => C.s_test; - -C.s_test(Vec4(1.2, 2.3, 3.4, 4.5)); -Vec4(1.2, 2.3, 3.4, 4.5) => C.s_test; - diff --git a/tests/tree/class_template.gw b/tests/tree/class_template.gw index c53724e6..82eecab6 100644 --- a/tests/tree/class_template.gw +++ b/tests/tree/class_template.gw @@ -13,7 +13,6 @@ class<~A,B~> C { <~int, int~>C c; <~float, int~>C d; <~polar, int~>C e; -<~Vec3, int~>C f; <~Object, int~>C g; #!C c; <<< c.a >>>; diff --git a/tests/tree/cpy_ast.gw b/tests/tree/cpy_ast.gw index f6d8a12e..f721f246 100644 --- a/tests/tree/cpy_ast.gw +++ b/tests/tree/cpy_ast.gw @@ -3,7 +3,6 @@ class <~A~>C { [ 1 ]; int i,j; typeof(i) k; - Vec3(0); 'a'; true $ int; i++; diff --git a/tests/tree/func_return_coverage.gw b/tests/tree/func_return_coverage.gw index 490211fe..ee5eee6d 100644 --- a/tests/tree/func_return_coverage.gw +++ b/tests/tree/func_return_coverage.gw @@ -1,6 +1,2 @@ fun complex testc() {}; -fun Vec3 testv3() {}; -fun Vec4 testv4() {}; testc(); -testv3(); -testv4(); diff --git a/tests/tree/push_mem.gw b/tests/tree/push_mem.gw index 85b3961b..e71191e1 100644 --- a/tests/tree/push_mem.gw +++ b/tests/tree/push_mem.gw @@ -1,2 +1,2 @@ -fun void test() { complex c; c; Vec3 v; v; Vec4 w; w; } +fun void test() { complex c; c; } test(); diff --git a/tests/tree/vec_num_dim.gw b/tests/tree/vec_num_dim.gw deleted file mode 100644 index 9aea1d1d..00000000 --- a/tests/tree/vec_num_dim.gw +++ /dev/null @@ -1,2 +0,0 @@ -#! a vec3 with only two expressions -[ Vec3(0.0- 0.0, 0.0) ]; diff --git a/tests/tuple/tuple_member_float.gw b/tests/tuple/tuple_member_float.gw index 02d0aec6..cac61c9e 100644 --- a/tests/tuple/tuple_member_float.gw +++ b/tests/tuple/tuple_member_float.gw @@ -1,4 +1,4 @@ -Tuple(.2, Vec3(1), 3) @=> <~float, Vec3, int~>Tuple ref t; +Tuple(.2, null, 3) @=> <~float, Object, int~>Tuple ref t; t[0]; t[1]; 3 => t[2]; -- 2.43.0