Guest User

Untitled

a guest
Jan 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #ifndef TCO_H_
  2. #define TCO_H_
  3.  
  4. #include "stdarg.h"
  5.  
  6. void (*nextfun)(void *);
  7. void *nextarg;
  8.  
  9. #define CALL(fun, arg) \
  10. do { \
  11. nextfun = fun; \
  12. nextarg = arg; \
  13. while(nextfun) \
  14. nextfun(nextarg); \
  15. } while(0);
  16.  
  17.  
  18. #define CALL2(fun, arg) \
  19. do { \
  20. nextfun = fun; \
  21. nextarg = arg; \
  22. return; \
  23. } while(0);
  24.  
  25. #define RETURN CALL2(NULL, NULL)
  26.  
  27. typedef struct conscell_str {
  28. void *car;
  29. void *cdr;
  30. } *conscell;
  31.  
  32.  
  33. #define cons(x, y) cons_f((void *)x, (void *)y)
  34. conscell cons_f(void *car, void *cdr);
  35.  
  36. #define car(x) ((conscell)x)->car
  37. #define cdr(x) ((conscell)x)->cdr
  38. #define integer(x) (uint64_t)(x)
  39.  
  40. /*conscell list(...); */
  41.  
  42. #endif
Add Comment
Please, Sign In to add comment