diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-01 00:39:44 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-01 00:39:44 +0000 |
| commit | 5e94ca9f060d2952ef08913234c500a815f734bf (patch) | |
| tree | 169e6c67289b70753aa76edb818f3b1f63112884 /include | |
| parent | 54261d62d47624e9ff4724c42aaa05eaf478e606 (diff) | |
refactor
Diffstat (limited to 'include')
| -rw-r--r-- | include/command/builtin.h | 23 | ||||
| -rw-r--r-- | include/eval.h | 3 | ||||
| -rw-r--r-- | include/global.h | 3 | ||||
| -rw-r--r-- | include/ground.h | 2 | ||||
| -rw-r--r-- | include/handler.h | 2 | ||||
| -rw-r--r-- | include/util/io.h (renamed from include/util.h) | 16 |
6 files changed, 36 insertions, 13 deletions
diff --git a/include/command/builtin.h b/include/command/builtin.h new file mode 100644 index 0000000..f37b844 --- /dev/null +++ b/include/command/builtin.h @@ -0,0 +1,23 @@ +#pragma once + +#include <string> +#include <vector> +#include <array> +#include <cstring> +#include <iostream> + +namespace ov4 +{ + +extern std::vector<std::string> builtin_cmd_list; + +bool exe_bultin_command(char **argv); + +} + +namespace ov4::command +{ + +void quit(); + +} diff --git a/include/eval.h b/include/eval.h index a6157e0..919d03f 100644 --- a/include/eval.h +++ b/include/eval.h @@ -14,7 +14,8 @@ #include <string> #include "global.h" -#include "util.h" +#include "util/io.h" +#include "command/builtin.h" #include "job.h" #include "ground.h" #include "parse.h" diff --git a/include/global.h b/include/global.h index 7d63c1b..5ff04f3 100644 --- a/include/global.h +++ b/include/global.h @@ -11,6 +11,7 @@ extern int verbose; constexpr int MAXLINE = 1024; constexpr int MAXARGS = 128; -extern std::vector<std::string> builtin_cmd_list; + +constexpr bool GLOBAL_DEBUG = true; } diff --git a/include/ground.h b/include/ground.h index 564e6ab..d57f085 100644 --- a/include/ground.h +++ b/include/ground.h @@ -6,7 +6,7 @@ #include <string.h> #include "global.h" -#include "util.h" +#include "util/io.h" #include "job.h" #include "handler.h" diff --git a/include/handler.h b/include/handler.h index 23c9540..f226387 100644 --- a/include/handler.h +++ b/include/handler.h @@ -12,7 +12,7 @@ #include <sys/wait.h> #include <errno.h> -#include "util.h" +#include "util/io.h" #include "job.h" namespace ov4 diff --git a/include/util.h b/include/util/io.h index bab7738..5bdbcbd 100644 --- a/include/util.h +++ b/include/util/io.h @@ -17,7 +17,13 @@ #define LOG !(ov4::GLOBAL_DEBUG && verbose) ? (void)0 : ov4::LogVoidify() & std::clog -namespace ov4 { +namespace ov4 +{ + +struct LogVoidify { void operator&(std::ostream&) const {} }; + +constexpr int DECIMAL = 10; +constexpr int LENGTH = 32; void atomic_print(char *s, bool ignore_wrap = false); void atomic_print(int x); @@ -26,13 +32,5 @@ void atomic_debug(int x); bool isnum(char *s); void reverse(char str[], int length); char *itoa(int num, char* str, int base); -int builtin_cmd(char *c_str); -void builtin_command_quit(); - -constexpr bool GLOBAL_DEBUG = true; -struct LogVoidify { void operator&(std::ostream&) const {} }; - -constexpr int DECIMAL = 10; -constexpr int LENGTH = 32; } |
