Added mathsym+tcc and boost against all advice
This commit is contained in:
parent
58ae49dd99
commit
90702a435d
136 changed files with 14409 additions and 0 deletions
40
eo/contrib/mathsym/eval/c_compile.c
Normal file
40
eo/contrib/mathsym/eval/c_compile.c
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <stdio.h>
|
||||
#include <libtcc.h>
|
||||
#include <math.h>
|
||||
|
||||
static TCCState* s = 0;
|
||||
|
||||
extern void symc_init() {
|
||||
if (s != 0) {
|
||||
tcc_delete(s);
|
||||
}
|
||||
s = tcc_new();
|
||||
|
||||
if (s == 0) {
|
||||
fprintf(stderr, "Tiny cc doesn't function properly");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
extern void symc_compile(const char* func_str) {
|
||||
//printf("Compiling %s\n", func_str);
|
||||
tcc_compile_string(s, func_str);
|
||||
}
|
||||
|
||||
extern void symc_link() {
|
||||
tcc_relocate(s);
|
||||
}
|
||||
|
||||
extern void* symc_get_fun(const char* func_name) {
|
||||
unsigned long val;
|
||||
tcc_get_symbol(s, &val, func_name);
|
||||
return (void*) val;
|
||||
}
|
||||
|
||||
extern void* symc_make(const char* func_str, const char* func_name) {
|
||||
symc_init();
|
||||
symc_compile(func_str);
|
||||
symc_link();
|
||||
return symc_get_fun(func_name);
|
||||
}
|
||||
|
||||
Reference in a new issue