factor/vm/os-genunix.cpp

38 lines
612 B
C++
Raw Normal View History

2009-05-02 05:04:19 -04:00
#include "master.hpp"
2009-05-04 02:46:13 -04:00
namespace factor
{
2009-09-23 14:05:46 -04:00
void factor_vm::c_to_factor_toplevel(cell quot)
2009-05-02 05:04:19 -04:00
{
c_to_factor(quot,this);
2009-05-02 05:04:19 -04:00
}
2009-05-05 12:33:35 -04:00
void init_signals()
2009-05-02 05:04:19 -04:00
{
unix_init_signals();
}
2009-05-05 12:33:35 -04:00
void early_init() { }
2009-05-02 05:04:19 -04:00
#define SUFFIX ".image"
#define SUFFIX_LEN 6
/* You must delete[] the result yourself. */
2009-05-05 12:33:35 -04:00
const char *default_image_path()
2009-05-02 05:04:19 -04:00
{
const char *path = vm_executable_path();
if(!path)
return "factor.image";
2009-10-02 21:36:19 -04:00
int len = strlen(path);
char *new_path = new char[PATH_MAX + SUFFIX_LEN + 1];
2009-05-02 05:04:19 -04:00
memcpy(new_path,path,len + 1);
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
2009-10-03 12:17:55 -04:00
free(const_cast<char *>(path));
2009-05-02 05:04:19 -04:00
return new_path;
}
2009-05-04 02:46:13 -04:00
}