int k[1][1];
-<<<i, j, o, p, r, s, t, k>>>;
+<<<i, " ", j, " ", o, " ", p, " ", r, " ", s, " ", t, " ", k>>>;
[ 1.0, 2, 3, 4, 5 ];
[ #(0.0, 0.0) ];
[ -d lcov ] || mkdir lcov
-#[ -z "$TRAVIS_BUILD_DIR" ] || {
-# BASE_DIR=$PWD
-# cd tests/test_plugin || return
-# for file in *.c
-# do
-# sed 's/\.c//' <<< "$file"
-# test_test_plugin "$(sed 's/\.c//' <<< "$file")"
-# done
-# cd "$BASE_DIR" || return
-#}
-
lcov --no-external --capture --directory src --output-file "$OUTFILE"
[ -z "$TRAVIS_BUILD_DIR" ] || {
BASE_DIR="$PWD"
-cd tests/test_plugins || exit
+cd tests/import || exit
for test_file in *.c
do test_plugin "${test_file:0:-2}"
done
+++ /dev/null
-INC = -I../../include -I../../util/include -I../../ast/include
-CC ?= gcc
-
-SRC = ${NAME}.c
-OBJ = $(SRC:.c=.o)
-CFLAGS = $(../../gwion -C 2>&1 | grep CFLAGS) ${INC}
-LDFLAGS = $(../../gwion -C 2>&1 | grep LDFLAGS)
-
-# os specific
-ifeq ($(shell uname), Linux)
-LDFLAGS += -shared
-else
-LDFLAGS += -bundle -undefined dynamic_lookup
-endif
-
-all: ${NAME}.so
-
-
-${NAME}.so: ${OBJ}
-ifeq (${USE_LD}, 1)
- ${LD} $^ -o ${NAME}.so ${LDFLAGS}
-else
- ${CC} $^ -o ${NAME}.so ${LDFLAGS}
-endif
-
-clean:
- rm -f ${OBJ} ${NAME}.so
-
-.c.o:
- ${CC} -fPIC ${CFLAGS} -c $< -o $(<:.c=.o) -g
-
-install: ${NAME}.so
- install ${NAME}.so ${GWION_ADD_DIR}
-
-uninstall:
- rm ${GWION_ADD_DIR}/${NAME}.so
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-MFUN(test_mfun){}
-
-GWION_IMPORT(array_test) {
- Type t_invalid_var_name;
- CHECK_BB((t_invalid_var_name = gwi_mk_type(gwi, "invalid_var_name", SZ_INT, t_object)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_name, NULL, NULL))
- CHECK_BB(gwi_item_ini(gwi,"int[]", "int_array"))
- CHECK_BB(gwi_item_end(gwi, 0, NULL)) // import array var
- CHECK_BB(gwi_func_ini(gwi, "float[][]", "f", test_mfun))
- CHECK_BB(gwi_func_end(gwi, 0))
- CHECK_BB(gwi_func_ini(gwi, "float[][]", "g", test_mfun))
- CHECK_BB(gwi_func_end(gwi, 0))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-MFUN(test_mfun){}
-GWION_IMPORT(begin_class) {
- Type t_invalid_var_name;
- CHECK_OB((t_invalid_var_name = gwi_mk_type(gwi, "invalid_var_name", SZ_INT, t_object)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_name, NULL, NULL))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_name, NULL, NULL))
- return GW_OK;
-}
+++ /dev/null
-#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 "instr.h"
-#include "import.h"
-#include "func.h"
-
-struct ret_info {
- Instr instr;
- m_uint offset;
- m_uint size;
-};
-
-static INSTR(my_ret) { GWDEBUG_EXE
- struct ret_info* info = (struct ret_info*)instr->m_val;
- POP_MEM(shred, info->offset);
- vector_set(shred->code->instr, shred->pc, (vtype)info->instr);
- shred->code = *(VM_Code*)instr->ptr;
- POP_REG(shred, info->size)
- if(shred->mem == shred->_reg + SIZEOF_REG)
- POP_REG(shred, SZ_INT)
- POP_REG(shred, shred->code->stack_depth);
- shred->pc = instr->m_val2;
- free(info);
- *(m_int*)shred->reg = 2;
- PUSH_REG(shred, SZ_INT);
-}
-
-static SFUN(cb_func) {
- m_uint i;
- Func f = *(Func*)MEM(0);
- if(!f){
- Except(shred, "NullCallbackException");
- }
- m_uint offset = shred->mem - (shred->_reg + SIZEOF_REG);
- PUSH_MEM(shred, offset);
- Instr instr = mp_alloc(Instr);
- struct ret_info* info = (struct ret_info*)xmalloc(sizeof(struct ret_info));
- info->offset = offset;
- info->size = f->def->ret_type->size;
- instr->execute = my_ret;
- *(VM_Code*)instr->ptr = shred->code;
- instr->m_val = (m_uint)info;
- instr->m_val2 = shred->pc;
- for(i = 0; i < vector_size(f->code->instr); i++) {
- Instr in = (Instr)vector_at(f->code->instr, i);
- if(in->execute == FuncReturn ||
- in->execute == my_ret) {
- info->instr = in;
- vector_set(f->code->instr, i, (vtype)instr);
- }
- }
- *(m_int*)RETURN = 1;
- shred->pc = 0;
- shred->code = f->code;
-}
-
-GWION_IMPORT(callback) {
- CHECK_BB(gwi_fptr_ini(gwi, "Vec4", "PtrType"))
- CHECK_BB(gwi_fptr_end(gwi, 0))
-
- const Type t_callback = gwi_mk_type(gwi, "Callback", SZ_INT, t_object);
- CHECK_BB(gwi_class_ini(gwi, t_callback, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, "int", "callback", cb_func))
- CHECK_BB(gwi_func_arg(gwi, "PtrType", "func"))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-int i;
-int j;
-int K;
-fun Vec4 test() { <<<"test">>>; }
-fun void test2(PtrType t) { Callback.callback(t); }
-
-test @=> PtrType t;
-<<<Callback.callback(t)>>>;
-<<<Callback.callback(t)>>>;
-<<<Callback.callback(t)>>>;
-Callback.callback(t);
-test2(t);
-test2(t);
-spork ~test2(t);
-spork ~Callback.callback(t);
-me.yield();
+++ /dev/null
-fun Vec4 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">>>;
-Callback.callback(p, 6);
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static m_int o_map_key;
-static m_int o_map_value;
-#define MAP_KEY(a) *((M_Object*)(a->data + o_map_key))
-#define MAP_VAL(a) *((M_Object*)(a->data + o_map_value))
-static CTOR(class_template_ctor) {
- /*char* name = strdup(o->type_ref->name);*/
- /*char* tmp = strsep(&name, "@");*/
- /*char* name1 = strsep(&name, "@");*/
-/*Type t1 = nspc_lookup_type1(o->type_ref->info->parent, insert_symbol(name1));*/
- /*Type t2 = nspc_lookup_type0(shred->vm->emit->env->curr, insert_symbol(name));*/
-/*free(tmp);*/
-/**(M_Object*)(o->data) = new_array(t1->size, 0, t1->array_depth);*/
- /**(M_Object*)(o->data + SZ_INT) = new_array(t2->size, 0, t2->array_depth);*/
-}
-
-static MFUN(class_template_set) {
-
-}
-
-GWION_IMPORT(class_template) {
- Type t_class_template;
- const m_str list[2] = { "A", "B" };
- gwi_tmpl_ini(gwi, 2, list);
- CHECK_OB((t_class_template = gwi_mk_type(gwi, "ClassTemplate", SZ_INT, t_object)))
- CHECK_BB(gwi_class_ini(gwi, t_class_template, class_template_ctor, NULL))
- gwi_tmpl_end(gwi);
- CHECK_BB(gwi_item_ini(gwi, "A[]", "key"))
- CHECK_BB((o_map_key = gwi_item_end(gwi, ae_flag_member | ae_flag_template, NULL)))
- CHECK_BB(gwi_item_ini(gwi, "B[]", "value"))
- CHECK_BB((o_map_value = gwi_item_end(gwi, ae_flag_member, NULL)))
-
-
- /*gwi_func_ini(gwi, "B", "set", class_template_set);*/
- /*gwi_func_end(gwi, ae_flag_member);*/
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-//class child {}
-//template<~A, B~>
-//class C{ A key; B value; }
-//<~int, int~>C c1;
-//<float, float>C c2;
-//<<<c1>>>;
-//<<<c2>>>;
-//<<<c2.value>>>;
-
-<~int, int~>ClassTemplate ct;
-<<<ct.key>>>;
-//<float, float>ClassTemplate ct2;
-//<<<ct2.key>>>;
-//<child, float>ClassTemplate ct3;
-//<<<ct3.key>>>;
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-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) {
- Type t_coverage;
- CHECK_OB((t_coverage = gwi_mk_type(gwi, "Coverage", SZ_INT, t_object)))
- CHECK_BB(gwi_class_ini(gwi, t_coverage, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, "int", "i", coverage_int))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
- CHECK_BB(gwi_func_ini(gwi, "float", "f", coverage_float))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
- CHECK_BB(gwi_func_ini(gwi, "complex", "c", coverage_complex))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
- CHECK_BB(gwi_func_ini(gwi, "Vec3", "v", coverage_vec3))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
- CHECK_BB(gwi_func_ini(gwi, "Vec4", "w", coverage_vec4))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
-
- m_uint* i = (m_uint*)xmalloc(sizeof(m_uint));
- *i = 5;
- CHECK_BB(gwi_item_ini(gwi,"int", "s_i"))
- CHECK_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, i))
- m_float* f = (m_float*)xmalloc(sizeof(m_float));
- *f = 2.1;
- CHECK_BB(gwi_item_ini(gwi,"float", "s_f"))
- CHECK_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)f))
-
- m_complex* c = (m_complex*)xmalloc(sizeof(m_complex));
- *c = 2.1;
- CHECK_BB(gwi_item_ini(gwi,"complex", "s_c"))
- CHECK_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)c))
-
- m_vec3* v = (m_vec3*)xmalloc(sizeof(m_vec3));
- v->x = 2.1;
- v->y = 2.2;
- v->z = 2.3;
- CHECK_BB(gwi_item_ini(gwi,"Vec3", "s_v"))
- CHECK_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)v))
-
- m_vec4* w = (m_vec4*)xmalloc(sizeof(m_vec4));
- w->x = 2.1;
- w->y = 2.2;
- w->z = 2.3;
- w->w = 2.4;
- CHECK_BB(gwi_item_ini(gwi,"Vec4", "s_w"))
- CHECK_BB(gwi_item_end(gwi, ae_flag_static | ae_flag_const, (void*)w))
-
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-float f;
-Coverage c;
-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 >>>;
-
-<<< 1 => Coverage.s_i >>>;
-<<< 1.2 => Coverage.s_f >>>;
-<<< #(1.2, 0.1) => Coverage.s_c >>>;
-<<< @(1.2, 0.1, 2.6) => Coverage.s_v >>>;
-<<< @(1.2, 0.1, 2.6, 4.6) => Coverage.s_w >>>;
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "absyn.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "operator.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-MFUN(test_mfun){}
-GWION_IMPORT(end_class) {
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-GWION_IMPORT(enum_test) {
- CHECK_BB(gwi_enum_ini(gwi, NULL))
- CHECK_BB(gwi_enum_add(gwi, "ENUM0", 0))
- CHECK_BB(gwi_enum_add(gwi, "ENUM1", 1))
- CHECK_BB(gwi_enum_add(gwi, "ENUM2", 2))
- CHECK_BB(gwi_enum_add(gwi, "ENUM3", 3))
- CHECK_BB(gwi_enum_add(gwi, "ENUM4", 4))
- CHECK_BB(gwi_enum_add(gwi, "ENUM5", 5))
- CHECK_BB(gwi_enum_add(gwi, "ENUM6", 6))
- CHECK_BB(gwi_enum_add(gwi, "ENUM7", 7))
- CHECK_BB(gwi_enum_add(gwi, "ENUM8", 8))
- CHECK_BB(gwi_enum_add(gwi, "ENUM9", 9))
- CHECK_BB(gwi_enum_end(gwi))
-
- CHECK_BB(gwi_enum_ini(gwi, "test"))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM0", 0))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM1", 1))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM2", 2))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM3", 3))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM4", 4))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM5", 5))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM6", 6))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM7", 7))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM8", 8))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM9", 9))
- CHECK_BB(gwi_enum_end(gwi))
-
- Type t_enum;
- CHECK_OB((t_enum = gwi_mk_type(gwi, "Enum", 0, NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_enum, NULL, NULL))
- CHECK_BB(gwi_enum_ini(gwi, 0))
- CHECK_BB(gwi_enum_add(gwi, "ENUM0", 0))
- CHECK_BB(gwi_enum_add(gwi, "ENUM1", 1))
- CHECK_BB(gwi_enum_add(gwi, "ENUM2", 2))
- CHECK_BB(gwi_enum_add(gwi, "ENUM3", 3))
- CHECK_BB(gwi_enum_add(gwi, "ENUM4", 4))
- CHECK_BB(gwi_enum_add(gwi, "ENUM5", 5))
- CHECK_BB(gwi_enum_add(gwi, "ENUM6", 6))
- CHECK_BB(gwi_enum_add(gwi, "ENUM7", 7))
- CHECK_BB(gwi_enum_add(gwi, "ENUM8", 8))
- CHECK_BB(gwi_enum_add(gwi, "ENUM9", 9))
- CHECK_BB(gwi_enum_end(gwi))
-
- CHECK_BB(gwi_enum_ini(gwi, "Enumtest"))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM0", 0))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM1", 1))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM2", 2))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM3", 3))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM4", 4))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM5", 5))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM6", 6))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM7", 7))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM8", 8))
- CHECK_BB(gwi_enum_add(gwi, "TYPED_ENUM9", 9))
- CHECK_BB(gwi_enum_end(gwi))
- CHECK_BB(gwi_class_end(gwi))
-
- return GW_OK;
-}
+++ /dev/null
-// untyped global enum
-<<<ENUM0>>>;
-<<<ENUM1>>>;
-<<<ENUM2>>>;
-<<<ENUM3>>>;
-<<<ENUM4>>>;
-<<<ENUM5>>>;
-<<<ENUM6>>>;
-<<<ENUM7>>>;
-<<<ENUM8>>>;
-<<<ENUM9>>>;
-
-// typed global enum
-<<<TYPED_ENUM0>>>;
-<<<TYPED_ENUM1>>>;
-<<<TYPED_ENUM2>>>;
-<<<TYPED_ENUM3>>>;
-<<<TYPED_ENUM4>>>;
-<<<TYPED_ENUM5>>>;
-<<<TYPED_ENUM6>>>;
-<<<TYPED_ENUM7>>>;
-<<<TYPED_ENUM8>>>;
-<<<TYPED_ENUM9>>>;
-
-// in class
-// untyped global enum
-<<<Enum.ENUM0>>>;
-<<<Enum.ENUM1>>>;
-<<<Enum.ENUM2>>>;
-<<<Enum.ENUM3>>>;
-<<<Enum.ENUM4>>>;
-<<<Enum.ENUM5>>>;
-<<<Enum.ENUM6>>>;
-<<<Enum.ENUM7>>>;
-<<<Enum.ENUM8>>>;
-<<<Enum.ENUM9>>>;
-
-// Enum.typed global enum
-<<<Enum.TYPED_ENUM0>>>;
-<<<Enum.TYPED_ENUM1>>>;
-<<<Enum.TYPED_ENUM2>>>;
-<<<Enum.TYPED_ENUM3>>>;
-<<<Enum.TYPED_ENUM4>>>;
-<<<Enum.TYPED_ENUM5>>>;
-<<<Enum.TYPED_ENUM6>>>;
-<<<Enum.TYPED_ENUM7>>>;
-<<<Enum.TYPED_ENUM8>>>;
-<<<Enum.TYPED_ENUM9>>>;
+++ /dev/null
-#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"
-#include "instr.h"
-
-GWION_IMPORT(extend_array_test) {
- Type t_array_ext;
- CHECK_OB((t_array_ext = gwi_mk_type(gwi, "ArrayExt", SZ_INT, NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_array_ext, NULL, NULL))
- Type_Decl* td = new_type_decl(new_id_list(insert_symbol("float"), 0), 0);
- Exp e = new_exp_prim_int(1, 0);
- Array_Sub array = new_array_sub(e);
- add_type_decl_array(td, array);
- CHECK_BB(gwi_class_ext(gwi, td))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-ArrayExt a;
-<<<a>>>;
-<<<a.size()>>>;
+++ /dev/null
-#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 "instr.h"
-#include "import.h"
-
-static CTOR(ev_ctor) { printf(" %p this to test ctor\n", (void*)o); }
-
-GWION_IMPORT(extend_event_test) {
- Type t_ev ;
- CHECK_OB((t_ev = gwi_mk_type(gwi, "Ev", SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_ev, ev_ctor, NULL))
- Type_Decl* td = new_type_decl(new_id_list(insert_symbol("Event"), 0), 0);
- CHECK_BB(gwi_class_ext(gwi, td))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-Ev ev;
-<<<ev>>>;
+++ /dev/null
-#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 "instr.h"
-#include "import.h"
-
-GWION_IMPORT(extend_pair_test) {
- m_str types[] = { "A", "B" };
- Type t_pair_ext ;
- CHECK_OB((t_pair_ext = gwi_mk_type(gwi, "PairExt", SZ_INT , NULL)))
- CHECK_BB(gwi_tmpl_ini(gwi, 2, types))
- CHECK_BB(gwi_class_ini(gwi, t_pair_ext, NULL, NULL))
- CHECK_BB(gwi_tmpl_end(gwi))
- Type_Decl* td = new_type_decl(new_id_list(insert_symbol("Pair"), 0), 0);
- Type_Decl* td0 = new_type_decl(new_id_list(insert_symbol("A"), 0), 0);
- Type_Decl* td1 = new_type_decl(new_id_list(insert_symbol("B"), 0), 0);
- Type_List tl1 = new_type_list(td1, NULL);
- Type_List tl0 = new_type_list(td0, tl1);
- td->types = tl0;
- CHECK_BB(gwi_class_ext(gwi, td))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-<~int, int~>PairExt p;
-<<<p>>>;
-<<<p.key>>>;
-<<<p.val>>>;
+++ /dev/null
-#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"
-#include "instr.h"
-
-SFUN(coverage_int) {
- puts("test");
- *(m_int*)RETURN = *(m_int*)MEM(0);
-}
-
-GWION_IMPORT(global_func_test) {
- CHECK_BB(gwi_func_ini(gwi, "int", "test", coverage_int))
- CHECK_BB(gwi_func_arg(gwi, "int", "i"))
- CHECK_BB(gwi_func_end(gwi, 0))
- return GW_OK;
-}
+++ /dev/null
-<<<1 => test>>>;
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-
-GWION_IMPORT(global_var_test) {
-// ALLOC_PTR(i, m_uint, 1);
- M_Object i = new_string(NULL, "test");
- CHECK_BB(gwi_item_ini(gwi,"string", "i"))
- CHECK_BB(gwi_item_end(gwi, 0, i))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_mfun){}
-GWION_IMPORT(invalid_arg_test) {
- Type t_invalid_var_type ;
- CHECK_OB((t_invalid_var_type = gwi_mk_type(gwi, "invalid_var_type",
- SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_type, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, "int[]", "func", test_mfun))
- CHECK_BB(gwi_func_arg(gwi, ".int", "i"))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
-
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_mfun){}
-GWION_IMPORT(inalid_array_test) {
- Type t_invalid_var_type;
- CHECK_OB((t_invalid_var_type = gwi_mk_type(gwi, "invalid_var_type",
- SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_type, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, "int[]", "func", test_mfun))
- CHECK_BB(gwi_func_arg(gwi, "int[][]", "i"))
- CHECK_BB(gwi_func_arg(gwi, "int", "j[]"))
- CHECK_BB(gwi_func_arg(gwi, "int[]", "k[]"))
- CHECK_BB(gwi_func_arg(gwi, "int", "l"))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
-
- CHECK_BB(gwi_func_ini(gwi, "int[]", "func", test_mfun))
- CHECK_BB(gwi_func_arg(gwi, "int", "j[][]"))
- CHECK_BB(gwi_func_arg(gwi, "int[]", "+k[][][]"))
- CHECK_BB(gwi_func_arg(gwi, "int", "l"))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
-
- CHECK_BB(gwi_func_ini(gwi, "int[]", "func", test_mfun))
- CHECK_BB(gwi_func_arg(gwi, "+int", "j[][]"))
- CHECK_BB(gwi_func_arg(gwi, "int[]", "+k[][][]"))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
-
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_mfun){}
-GWION_IMPORT(invalid_func_test) {
- Type t_invalid_var_type ;
- CHECK_OB((t_invalid_var_type = gwi_mk_type(gwi, "invalid_var_type",
- SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_type, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, ".int", "i", test_mfun))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
-
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_mfun){}
-GWION_IMPORT(invalid_type1_test) {
- Type t_invalid_var_type;
- CHECK_OB((t_invalid_var_type = gwi_mk_type(gwi, "invalid_var_type",
- SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_type, NULL, NULL))
- CHECK_BB(gwi_item_ini(gwi,"i|nt", "test"))
- CHECK_BB(gwi_item_end(gwi, 0, NULL))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_mfun){}
-GWION_IMPORT(invalid_type2_test) {
- Type t_invalid_var_type ;
- CHECK_OB((t_invalid_var_type = gwi_mk_type(gwi, "invalid_var_type",
- SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_type, NULL, NULL))
- CHECK_BB(gwi_item_ini(gwi,".int", "test"))
- CHECK_BB(gwi_item_end(gwi, 0, NULL))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "absyn.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_mfun){}
-GWION_IMPORT(invalid_type3_test) {
- Type t_invalid_var_type ;
- CHECK_OB((t_invalid_var_type = gwi_mk_type(gwi, ".invalid_var_type",
- SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_invalid_var_type, NULL, NULL))
- CHECK_BB(gwi_item_ini(gwi,".int", "test"))
- CHECK_BB(gwi_item_end(gwi, 0, NULL))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-<~int, float~>Map pp;
-<<<pp>>>;
-<<<pp.size()>>>;
-<<<pp.set(1, 2)>>>;
-<<<pp.get(1)>>>;
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-
-static MFUN(test_mfun){}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-GWION_IMPORT(op_err_test) {
- gwi_oper_ini(gwi, "int", "int", "int"); // ignore the check
- gwi_oper_end(gwi, 220, NULL); // ignore the check.
- CHECK_BB(gwi_oper_ini(gwi, "int", "int", "int"))
- CHECK_BB(gwi_oper_end(gwi, op_chuck, NULL))
- return GW_OK;
-}
+++ /dev/null
-#include <stdlib.h>
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-GWION_IMPORT(static_string_test) {
- CHECK_BB(gwi_item_ini(gwi, "string", "self"))
- M_Object obj = new_string(NULL, "test static string");
- CHECK_BB(gwi_item_end(gwi, ae_flag_global, obj))
- return GW_OK;
-}
+++ /dev/null
-//<<<StaticString.self>>>;
-<<<self>>>;
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(template_arg_fun) {}
-
-GWION_IMPORT(template_arg_test) {
- Type t_template_arg;
- CHECK_OB((t_template_arg = gwi_mk_type(gwi, "TemplateArg", SZ_INT , NULL)))
- CHECK_BB(gwi_class_ini(gwi, t_template_arg, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, "int", "set", template_arg_fun))
- CHECK_BB(gwi_func_arg(gwi, "Pair<Ptr<int>,float>","test"))
- CHECK_BB(gwi_func_end(gwi, 0))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-static MFUN(test_func) { puts("test"); }
-GWION_IMPORT(typedef_test) {
- Type t_func_typedef;
- CHECK_OB((t_func_typedef = gwi_mk_type(gwi, "FuncTypedef", SZ_INT , NULL)))
- CHECK_BB(gwi_fptr_ini(gwi, "void", "PtrType"))
- CHECK_BB(gwi_fptr_end(gwi, 0))
-
- CHECK_BB(gwi_class_ini(gwi, t_func_typedef, NULL, NULL))
- CHECK_BB(gwi_fptr_ini(gwi, "void", "PtrType"))
- CHECK_BB(gwi_fptr_end(gwi, ae_flag_static))
- CHECK_BB(gwi_func_ini(gwi, "void", "test_func", test_func))
- CHECK_BB(gwi_func_end(gwi, ae_flag_static))
- CHECK_BB(gwi_item_ini(gwi, "PtrType", "ptr"))
- CHECK_BB(gwi_item_end(gwi, ae_flag_static, NULL))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-fun void test(){ <<<"test">>>; }
-PtrType ptr;
-test();
-test @=> ptr;
-ptr();
-
-
-FuncTypedef.test_func();
-<<<FuncTypedef.test_func @=> FuncTypedef.ptr>>>;
-<FuncTypedef.PtrType> _ptr;
-<<<FuncTypedef.ptr>>>;
-FuncTypedef.ptr();
-
+++ /dev/null
-#include "gwion_util.h"
-#include "gwion_ast.h"
-#include "oo.h"
-#include "vm.h"
-#include "env.h"
-#include "type.h"
-#include "object.h"
-#include "instr.h"
-#include "import.h"
-
-GWION_IMPORT(union_test) {
- CHECK_BB(gwi_union_ini(gwi, NULL))
- CHECK_BB(gwi_union_add(gwi,"float", "f"))
- CHECK_BB(gwi_union_add(gwi,"int", "i"))
- CHECK_BB(gwi_union_end(gwi, 0))
- return GW_OK;
-}
+++ /dev/null
-Union u;
-<<<u.i>>>;
-<<<12 => u.f>>>;
-<<<1 => u.i>>>;
-<<<u.i>>>;
-<<<u.f>>>;
-<<<0 => u.i>>>;
-<<<null @=> u.o>>>;
+++ /dev/null
-#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"
-#include "vararg.h"
-
-static MFUN(m_test) {
- printf("%p\n", *(M_Object*)MEM(0));
-}
-
-static MFUN(m_variadic) {
- M_Object str_obj = *(M_Object*)MEM(SZ_INT);
- if(!str_obj)return;
- m_str str = STRING(str_obj);
- struct Vararg_* arg = *(struct Vararg_**)MEM(SZ_INT*2);
-
- while(arg->i < arg->s) {
- if(*str == 'i') {
- printf("%" INT_F "\n", *(m_int*)(arg->d + arg->o));
- arg->o += SZ_INT;
- } else if(*str == 'f') {
- printf("%f\n", *(m_float*)(arg->d + arg->o));
- arg->o += SZ_FLOAT;
- } else if(*str == 'o') {
- printf("%p\n", (void*)*(M_Object*)(arg->d + arg->o));
- arg->o += SZ_INT;
- }
- arg->i++;
- str++;
- }
- free_vararg(arg);
-}
-
-GWION_IMPORT(variadic test) {
- const Type t_variadic = gwi_mk_type(gwi, "Variadic", SZ_INT, t_object);
- CHECK_BB(gwi_class_ini(gwi, t_variadic, NULL, NULL))
- CHECK_BB(gwi_func_ini(gwi, "void", "member", m_variadic))
- CHECK_BB(gwi_func_arg(gwi, "string", "format"))
- CHECK_BB(gwi_func_end(gwi, ae_flag_variadic))
- CHECK_BB(gwi_func_ini(gwi, "void", "test", m_test))
- CHECK_BB(gwi_func_end(gwi, 0))
- CHECK_BB(gwi_class_end(gwi))
- return GW_OK;
-}
+++ /dev/null
-<<<"test builtin variadic function">>>;
-Variadic v;
-"iiii" => string format;
-<<<v, " ", format $ Object>>>;
-v.member(format, 1,2,3,4);
-v.member(format, 1,2,3,4);
-v.test();
-v.member(format, 1,2,3,4);
-v.member(format, 1,2,3,4);
-v.test();
-v.member(format, 1,2,3,4);
-v.member(format, 1,2,3,4);
-v.test();