-
Notifications
You must be signed in to change notification settings - Fork 8
/
scm.h
50 lines (35 loc) · 1.28 KB
/
scm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef SCM_H
#define SCM_H
#include <stdio.h>
#include <limits.h>
/************************* util.c *************************/
void scm_fatal(char *fmt, ...);
/************************ model.c *************************/
/* scm_int must be large enough to hold any Scheme fixnum.
*/
typedef long scm_int;
/* A scm_object can be any of Scheme's many types: boolean,
* the empty list, number, symbol, pair, vector, etc.
* For now we only have fixnums which will fit in a long.
*/
typedef long scm_object;
/* Trival conversions to and from fixnum since they are
* the only type for now.
*/
#define scm_fixnum_make(val) ((scm_object)(val))
#define scm_fixnum_value(object) ((scm_int)(object))
/* Assume a two's complement hardware representation.
*
* Ensure that any number can be algebraically negated
* and the result is still in the acceptable range.
*/
#define scm_fixnum_min ((((scm_int)1) \
<< (8 * sizeof(scm_object) - 1)) + 1)
#define scm_fixnum_max (-(scm_fixnum_min))
/************************* read.c *************************/
scm_object scm_read(FILE *in);
/************************* eval.c *************************/
scm_object scm_eval(scm_object expression);
/************************ print.c *************************/
int scm_write(FILE *out, scm_object object);
#endif