| 82 | #define NEW_EXPR(type, ...) new_expr((type), (const te_expr*[]){__VA_ARGS__}) |
| 83 | |
| 84 | static te_expr *new_expr(const int type, const te_expr *parameters[]) { |
| 85 | const int arity = ARITY(type); |
| 86 | const int psize = sizeof(void*) * arity; |
| 87 | const int size = (sizeof(te_expr) - sizeof(void*)) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0); |
| 88 | te_expr *ret = malloc(size); |
| 89 | memset(ret, 0, size); |
| 90 | if (arity && parameters) { |
| 91 | memcpy(ret->parameters, parameters, psize); |
| 92 | } |
| 93 | ret->type = type; |
| 94 | ret->bound = 0; |
| 95 | return ret; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | void te_free_parameters(te_expr *n) { |