-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLispVM.cpp
More file actions
40 lines (32 loc) · 755 Bytes
/
LispVM.cpp
File metadata and controls
40 lines (32 loc) · 755 Bytes
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
#include "LispVM.h"
LispVM::LispVM(int argc, char** argv)
{
cl_boot(argc, argv);
atexit(cl_shutdown);
std::cout << "Starting LispVM " << this << std::endl;
}
LispVM::~LispVM()
{
}
cl_object LispVM::send_string(const std::string& s)
{
return cl_safe_eval(c_string_to_object(s.c_str()), Cnil, Cnil);
}
void LispVM::def_c_funct(const std::string& s, cl_objectfn_fixed fun,
int num_args)
{
return cl_def_c_function(c_string_to_object(s.c_str()),
fun, num_args);
}
void hello_world()
{
std::cout << "Hello world " << std::endl;
}
int main()
{
std::cout << "hello world!" << std::endl;
LispVM a();
LispVM::def_c_funct("hello-world", (cl_objectfn_fixed)hello_world, 0);
LispVM::send_string("(hello-world)");
return 0;
}