/home/andy/git/oilshell/oil/cpp/leaky_core.h
Line | Count | Source (jump to first uncovered line) |
1 | | // leaky_core.h: Replacement for core/*.py |
2 | | |
3 | | #ifndef LEAKY_CORE_H |
4 | | #define LEAKY_CORE_H |
5 | | |
6 | | #include <termios.h> |
7 | | |
8 | | #include "mycpp/runtime.h" |
9 | | |
10 | | // Hacky forward declaration |
11 | | namespace builtin_trap { |
12 | | class _TrapHandler; |
13 | | }; |
14 | | |
15 | | namespace pyos { |
16 | | |
17 | | const int TERM_ICANON = ICANON; |
18 | | const int TERM_ECHO = ECHO; |
19 | | const int EOF_SENTINEL = 256; |
20 | | const int NEWLINE_CH = 10; |
21 | | |
22 | | Tuple2<int, int> WaitPid(); |
23 | | Tuple2<int, int> Read(int fd, int n, List<Str*>* chunks); |
24 | | Tuple2<int, int> ReadByte(int fd); |
25 | | Str* ReadLine(); |
26 | | Dict<Str*, Str*>* Environ(); |
27 | | int Chdir(Str* dest_dir); |
28 | | Str* GetMyHomeDir(); |
29 | | Str* GetHomeDir(Str* user_name); |
30 | | |
31 | | class ReadError { |
32 | | public: |
33 | 0 | explicit ReadError(int err_num_) : err_num(err_num_) { |
34 | 0 | } |
35 | | int err_num; |
36 | | }; |
37 | | |
38 | | Str* GetUserName(int uid); |
39 | | Str* OsType(); |
40 | | Tuple3<double, double, double> Time(); |
41 | | void PrintTimes(); |
42 | | bool InputAvailable(int fd); |
43 | | |
44 | | class TermState { |
45 | | public: |
46 | 0 | TermState(int fd, int mask) { |
47 | 0 | assert(0); |
48 | 0 | } |
49 | 0 | void Restore() { |
50 | 0 | assert(0); |
51 | 0 | } |
52 | | }; |
53 | | |
54 | | void SignalState_AfterForkingChild(); |
55 | | |
56 | | class SignalState { |
57 | | public: |
58 | 0 | SignalState() { |
59 | 0 | } |
60 | 0 | void InitShell() { |
61 | 0 | } |
62 | 0 | void AddUserTrap(int sig_num, builtin_trap::_TrapHandler* handler) { |
63 | 0 | NotImplemented(); |
64 | 0 | } |
65 | 0 | void RemoveUserTrap(int sig_num) { |
66 | 0 | NotImplemented(); |
67 | 0 | } |
68 | | int last_sig_num = 0; |
69 | | |
70 | | DISALLOW_COPY_AND_ASSIGN(SignalState) |
71 | | }; |
72 | | |
73 | | } // namespace pyos |
74 | | |
75 | | class _OSError; // declaration from mycpp/myerror.h |
76 | | |
77 | | namespace pyutil { |
78 | | |
79 | | bool IsValidCharEscape(int c); |
80 | | Str* ChArrayToString(List<int>* ch_array); |
81 | | |
82 | | class _ResourceLoader { |
83 | | public: |
84 | | virtual Str* Get(Str* path); |
85 | | }; |
86 | | |
87 | | _ResourceLoader* GetResourceLoader(); |
88 | | |
89 | | void CopyFile(Str* in_path, Str* out_path); |
90 | | |
91 | | Str* GetVersion(_ResourceLoader* loader); |
92 | | |
93 | | Str* ShowAppVersion(Str* app_name, _ResourceLoader* loader); |
94 | | |
95 | | Str* strerror(_OSError* e); |
96 | | |
97 | | Str* BackslashEscape(Str* s, Str* meta_chars); |
98 | | |
99 | | } // namespace pyutil |
100 | | |
101 | | #endif // LEAKY_CORE_H |