-
Notifications
You must be signed in to change notification settings - Fork 0
/
TinyCInterpreter.h
executable file
·41 lines (35 loc) · 1.17 KB
/
TinyCInterpreter.h
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
#ifndef C99_INTERPRETER_H
#define C99_INTERPRETER_H
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <assert.h>
#include <map>
#include <vector>
#include "libtcc.h"
struct tcc_func_list {
std::string scriptContent_;
std::map<std::string, void*> funcs_;
void* code_mem_;
};
class c99Interpreter {
public:
c99Interpreter();
~c99Interpreter();
int setSearchPath(const char* path);
int compileScript(const char* scriptContent, const char* scriptName);
int addCustomSymbols(const char* symbol_name, void* func);
int buildSymbol(const char* scriptName);
const tcc_func_list* getScript(const char* scriptName);
const void* getFunInScript(const char* scriptName, const char* funcName);
private:
void systemSymbols();
void utilsSymbols();
int analyse_export_funcs(const char* source, std::vector<std::string>& funcs);
private:
std::string searchPath_;
TCCState* tcc_sym_;
std::map<std::string, tcc_func_list> scripts_;
static int tcc_state_used_;
};
#endif