57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
#ifndef BUILTIN_H_85dfb9ef1b9889cd01b60306e12f5e8e
|
|
#define BUILTIN_H_85dfb9ef1b9889cd01b60306e12f5e8e
|
|
|
|
#include <assert.h>
|
|
#include <inttypes.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "gc.h"
|
|
|
|
/* Names of fundamental builtin values */
|
|
#define BI_UNDEFINED "undefined"
|
|
#define BI_STRUCTURE "structure"
|
|
#define BI_LAMBDA "lambda"
|
|
#define BI_TEMPLATE "template"
|
|
#define BI_POS_NAN "+NaN"
|
|
#define BI_NEG_NAN "-NaN"
|
|
#define BI_POS_INFINITY "+infinity"
|
|
#define BI_NEG_INFINITY "-infinity"
|
|
|
|
/* Names of builtin functions */
|
|
#define BI_VALUES "values"
|
|
#define BI_FREEZE "freeze!"
|
|
#define BI_IMMUTABLE_P "immutable?"
|
|
#define BI_REGISTER_FINALIZER "register-finalizer"
|
|
#define BI_STRING_TO_NUMBER "string->number"
|
|
#define BI_STRING_TO_BUILTIN "string->builtin"
|
|
#define BI_BUILTIN_TO_STRING "builtin->string"
|
|
#define BI_DISPLAY "display"
|
|
#define BI_CURRENT_CONTEXT "current-context"
|
|
#define BI_CALL_WITH_CONTEXT "call-with-context"
|
|
|
|
/* Lambda: Instances of this structure are fundamental callable objects. */
|
|
#define LAMBDA_SLOT_GLOBAL_VARS 0
|
|
#define LAMBDA_SLOT_INSTANCE_VARS 1
|
|
#define LAMBDA_SLOT_BYTE_CODE 2
|
|
#define LAMBDA_SLOT_TAIL_CALL 3
|
|
#define LAMBDA_SLOTS 4
|
|
|
|
/* Template: Instances of this structure describe what a LAMBDA
|
|
* will look like when instanciated with the 'lambda' bytecode. */
|
|
#define TEMPLATE_SLOT_GLOBAL_VARS 0
|
|
#define TEMPLATE_SLOT_INSTANCE_VARS 1
|
|
#define TEMPLATE_SLOT_BYTE_CODE 2
|
|
#define TEMPLATE_SLOT_TAIL_CALL 3
|
|
#define TEMPLATE_SLOTS 4
|
|
|
|
value_t get_lambda_type(void);
|
|
value_t get_template_type(void);
|
|
|
|
void builtin_init(void);
|
|
void register_builtin(const char *name, value_t value);
|
|
value_t lookup_builtin(const char *name);
|
|
value_t reverse_lookup_builtin(value_t value);
|
|
|
|
#endif
|
|
/* vim:set sw=2 expandtab: */
|