kapplicative.c (564B)
1 /* 2 ** kapplicative.c 3 ** Kernel Applicatives 4 ** See Copyright Notice in klisp.h 5 */ 6 7 #include "kobject.h" 8 #include "kstate.h" 9 #include "kapplicative.h" 10 #include "kmem.h" 11 #include "kgc.h" 12 13 /* GC: Assumes underlying is rooted */ 14 TValue kwrap(klisp_State *K, TValue underlying) 15 { 16 Applicative *new_app = klispM_new(K, Applicative); 17 18 /* header + gc_fields */ 19 klispC_link(K, (GCObject *) new_app, K_TAPPLICATIVE, 20 K_FLAG_CAN_HAVE_NAME); 21 22 /* applicative specific fields */ 23 new_app->underlying = underlying; 24 return gc2app(new_app); 25 }