-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.cpp
57 lines (49 loc) · 1.19 KB
/
lib.cpp
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
51
52
53
54
55
56
57
// Copyright (c) 2009, Nicholas "Indy" Ray. All rights reserved.
// See the LICENSE file for usage, modification, and distribution terms.
#include "lib.h"
#include "types.h"
#include "function.h"
#include "environment.h"
#include <stdio.h>
#include <assert.h>
pointer ploy_display(environment* env, pointer p)
{
}
pointer ploy_display_list(environment* env, pointer p)
{
if(p != NIL)
{
assert(is_type(p, DT_Pair));
putc('(', env->out);
ploy_display(env, car(p));
ploy_display_list(env, cdr(p));
}
else
putc(')', env->out);
return NIL;
}
pointer ploy_display_int(environment* env, pointer p)
{
assert(is_type(p, DT_Int));
fprintf(env->out, "%d", get_int(p));
return NIL;
}
pointer ploy_display_real(environment* env, pointer p)
{
assert(is_type(p, DT_Real));
fprintf(env->out, "%f", get_real(p));
return NIL;
}
pointer ploy_display_char(environment* env, pointer p)
{
assert(is_type(p, DT_Char));
putc(get_char(p), env->out);
return NIL;
}
pointer ploy_display_string(environment* env, pointer p)
{
assert(is_type(p, DT_String));
fputs(get_string(p), env->out);
fputc('\n', env->out);
return NIL;
}