native -⁼
This commit is contained in:
parent
f155792856
commit
ab49bb5d3d
@ -87,4 +87,5 @@ void arith_init() {
|
||||
c(BFn,bi_mul)->ident = c(BFn,bi_div)->ident = c(BFn,bi_and)->ident = c(BFn,bi_eq)->ident = c(BFn,bi_ge)->ident = c(BFn,bi_pow)->ident = c(BFn,bi_not)->ident = m_i32(1);
|
||||
c(BFn,bi_floor)->ident = m_f64(1.0/0.0);
|
||||
c(BFn,bi_ceil )->ident = m_f64(-1.0/0.0);
|
||||
c(BFn, bi_sub)->im = sub_c1;
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
void print_funBI(B x) { printf("%s", pfn_repr(c(Fun,x)->extra)); }
|
||||
B funBI_uc1(B t, B o, B x) { return c(BFn,t)->uc1(t, o, x); }
|
||||
B funBI_ucw(B t, B o, B w, B x) { return c(BFn,t)->ucw(t, o, w, x); }
|
||||
B funBI_im(B t, B x) { return c(BFn,t)->im(t, x); }
|
||||
B funBI_identity(B x) { return inc(c(BFn,x)->ident); }
|
||||
|
||||
|
||||
@ -315,4 +316,5 @@ void fns_init() {
|
||||
TIi(t_funBI,identity) = funBI_identity;
|
||||
TIi(t_funBI,fn_uc1) = funBI_uc1;
|
||||
TIi(t_funBI,fn_ucw) = funBI_ucw;
|
||||
TIi(t_funBI,fn_im) = funBI_im;
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ typedef struct BFn {
|
||||
B ident;
|
||||
BBB2B uc1;
|
||||
BBBB2B ucw;
|
||||
BB2B im;
|
||||
} BFn;
|
||||
typedef struct BMd2 {
|
||||
struct Md2;
|
||||
|
||||
@ -468,9 +468,9 @@ void base_init() { // very first init function
|
||||
TIi(t_funBI,freeF) = TIi(t_md1BI,freeF) = TIi(t_md2BI,freeF) = builtin_free;
|
||||
assert((MD1_TAG>>1) == (MD2_TAG>>1)); // just to be sure it isn't changed incorrectly, `isMd` depends on this
|
||||
|
||||
#define FA(N,X) { BFn* f = mm_alloc(sizeof(BFn), t_funBI); f->c2=N##_c2; f->c1=N##_c1; f->extra=pf_##N; f->ident=bi_N; f->uc1=def_fn_uc1; f->ucw=def_fn_ucw; gc_add(bi_##N = tag(f,FUN_TAG)); }
|
||||
#define FM(N,X) { BFn* f = mm_alloc(sizeof(BFn), t_funBI); f->c2=c2_bad; f->c1=N##_c1; f->extra=pf_##N; f->ident=bi_N; f->uc1=def_fn_uc1; f->ucw=def_fn_ucw; gc_add(bi_##N = tag(f,FUN_TAG)); }
|
||||
#define FD(N,X) { BFn* f = mm_alloc(sizeof(BFn), t_funBI); f->c2=N##_c2; f->c1=c1_bad; f->extra=pf_##N; f->ident=bi_N; f->uc1=def_fn_uc1; f->ucw=def_fn_ucw; gc_add(bi_##N = tag(f,FUN_TAG)); }
|
||||
#define FA(N,X) { BFn* f = mm_alloc(sizeof(BFn), t_funBI); f->c2=N##_c2; f->c1=N##_c1; f->extra=pf_##N; f->ident=bi_N; f->uc1=def_fn_uc1; f->ucw=def_fn_ucw; f->im=def_fn_im; gc_add(bi_##N = tag(f,FUN_TAG)); }
|
||||
#define FM(N,X) { BFn* f = mm_alloc(sizeof(BFn), t_funBI); f->c2=c2_bad; f->c1=N##_c1; f->extra=pf_##N; f->ident=bi_N; f->uc1=def_fn_uc1; f->ucw=def_fn_ucw; f->im=def_fn_im; gc_add(bi_##N = tag(f,FUN_TAG)); }
|
||||
#define FD(N,X) { BFn* f = mm_alloc(sizeof(BFn), t_funBI); f->c2=N##_c2; f->c1=c1_bad; f->extra=pf_##N; f->ident=bi_N; f->uc1=def_fn_uc1; f->ucw=def_fn_ucw; f->im=def_fn_im; gc_add(bi_##N = tag(f,FUN_TAG)); }
|
||||
FOR_PFN(FA,FM,FD)
|
||||
#undef FA
|
||||
#undef FM
|
||||
|
||||
Loading…
Reference in New Issue
Block a user