#ifndef BUILTIN_H_85dfb9ef1b9889cd01b60306e12f5e8e #define BUILTIN_H_85dfb9ef1b9889cd01b60306e12f5e8e #include #include #include #include "gc.h" /* Names of fundamental builtin values */ #define BI_UNDEFINED "undefined" #define BI_STRUCTURE "structure" #define BI_TEMPLATE "template" #define BI_LAMBDA "lambda" #define BI_POS_NAN "+NaN" #define BI_NEG_NAN "-NaN" #define BI_POS_INFINITY "+infinity" #define BI_NEG_INFINITY "-infinity" /* Name of builtin function */ #define BI_STRING_TO_NUMBER "string->number" /* Ex: _SLOT_VALUE(STRUCTURE, v, NAME) */ #define _SLOT_VALUE(t,v,s) (_get_struct(v)->slots[t ## _SLOT_ ## s]) #define STRUCTURE_SLOT_SUPERS 0 #define STRUCTURE_SLOT_NSLOTS 1 #define STRUCTURE_SLOT_CALLABLE 2 #define STRUCTURE_SLOTS 3 #define TEMPLATE_SLOT_GLOBAL_VARS 0 #define TEMPLATE_SLOT_INSTANCE_VARS 1 #define TEMPLATE_SLOT_FRAME_VARS 2 #define TEMPLATE_SLOT_BYTE_CODE 3 #define TEMPLATE_SLOT_TAIL_CALL 4 #define TEMPLATE_SLOT_ARG_LIST 5 #define TEMPLATE_SLOT_CONTEXT 6 #define TEMPLATE_SLOT_CONTINUATION 7 #define TEMPLATE_SLOTS 8 #define LAMBDA_SLOT_GLOBAL_VARS 0 #define LAMBDA_SLOT_INSTANCE_VARS 1 #define LAMBDA_SLOT_FRAME_VARS 2 #define LAMBDA_SLOT_BYTE_CODE 3 #define LAMBDA_SLOT_TAIL_CALL 4 #define LAMBDA_SLOT_ARG_LIST 5 #define LAMBDA_SLOT_CONTEXT 6 #define LAMBDA_SLOT_CONTINUATION 7 #define LAMBDA_SLOTS 8 value_t get_structure_type(void); value_t get_template_type(void); value_t get_lambda_type(void); void builtin_init(void); void register_builtin(const char *name, value_t value); value_t lookup_builtin(const char *name); /* True if 'value' is (1) a structure, and (2) an instance of 'type'. */ bool struct_is_a(value_t value, value_t type); #endif /* vim:set sw=2 expandtab: */