port.h
858 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
#ifndef PYTHON_PORT_H
#define PYTHON_PORT_H
namespace MicroPython {
class ScriptProvider {
public:
virtual const char * contentOfScript(const char * name) = 0;
};
class ExecutionEnvironment {
public:
ExecutionEnvironment();
static ExecutionEnvironment * currentExecutionEnvironment();
void runCode(const char * );
virtual const char * inputText(const char * prompt) {
return nullptr;
}
virtual void displaySandbox() {
}
virtual void printText(const char * text, size_t length) {
}
protected:
bool m_sandboxIsDisplayed;
};
void init(void * heapStart, void * heapEnd);
void deinit();
void registerScriptProvider(ScriptProvider * s);
};
// Will implement :
// mp_lexer_new_from_file -> Ask the context about a file
// mp_import_stat
// mp_hal_stdout_tx_strn_cooked -> Tell the context Python printed text
// mp_hal_input
#endif