]> gitweb.factorcode.org Git - factor.git/blob - vm/os-genunix.cpp
Make segment, context, data_heap, zone more object-oriented, and fix crash when calli...
[factor.git] / vm / os-genunix.cpp
1 #include "master.hpp"
2
3 namespace factor
4 {
5
6 void factor_vm::c_to_factor_toplevel(cell quot)
7 {
8         c_to_factor(quot,this);
9 }
10
11 void init_signals()
12 {
13         unix_init_signals();
14 }
15
16 void early_init() { }
17
18 #define SUFFIX ".image"
19 #define SUFFIX_LEN 6
20
21 /* You must delete[] the result yourself. */
22 const char *default_image_path()
23 {
24         const char *path = vm_executable_path();
25
26         if(!path)
27                 return "factor.image";
28
29         /* We can't call strlen() here because with gcc 4.1.2 this
30         causes an internal compiler error. */
31         int len = 0;
32         const char *iter = path;
33         while(*iter) { len++; iter++; }
34
35         char *new_path = new char[PATH_MAX + SUFFIX_LEN + 1];
36         memcpy(new_path,path,len + 1);
37         memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
38         return new_path;
39 }
40
41 }