keithlisp/lisp_types.h

35 lines
654 B
C

#ifndef _LISP_TYPES_H
#define _LISP_TYPES_H
#define LISP_T_CONS 0
#define LISP_T_ATOM 1
#define LISP_T_INT 2
#define LISP_T_FLOAT 3
#define LISP_T_STRING 4
#define LISP_T_FUNPTR 5
typedef struct lisp_value lisp_value;
typedef struct lisp_cons lisp_cons;
typedef int lisp_atom;
typedef char lisp_string;
typedef void (*lisp_native_fun)(lisp_cons*, lisp_value*);
struct lisp_value {
union {
lisp_cons* cons;
lisp_atom atom;
long _int;
float _float;
lisp_string* string;
lisp_native_fun funptr;
} value;
char type;
} __attribute__((packed));
struct lisp_cons {
lisp_value car;
lisp_value cdr;
} __attribute__((packed));
#endif