chore(furdb): initialize furdb
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#ifndef COMMAND_HPP
|
||||
#define COMMAND_HPP
|
||||
|
||||
#include "context.hpp"
|
||||
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
struct command_info {
|
||||
std::string_view commandName;
|
||||
std::vector<std::string_view> args;
|
||||
};
|
||||
|
||||
class command {
|
||||
public:
|
||||
command() = default;
|
||||
virtual ~command() = default;
|
||||
|
||||
command(command&&) noexcept = default;
|
||||
command& operator=(command&&) noexcept = default;
|
||||
command(const command&) = delete;
|
||||
command& operator=(const command&) = delete;
|
||||
public:
|
||||
virtual void execute(context& ctx, const command_info& info) = 0;
|
||||
public:
|
||||
static command_info parse(std::string_view line);
|
||||
};
|
||||
|
||||
class quit_command final : public command {
|
||||
public:
|
||||
void execute(context& ctx, const command_info& info) override;
|
||||
};
|
||||
|
||||
class run_command final : public command {
|
||||
public:
|
||||
void execute(context& ctx, const command_info& info) override;
|
||||
};
|
||||
|
||||
#endif // COMMAND_HPP
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef CONTEXT_HPP
|
||||
#define CONTEXT_HPP
|
||||
|
||||
#include <furvm/context.hpp>
|
||||
#include <furvm/executor.hpp>
|
||||
#include <furvm/fwd.hpp>
|
||||
#include <furvm/module.hpp>
|
||||
|
||||
struct context {
|
||||
furvm::context_p context = std::make_shared<furvm::context>();
|
||||
furvm::mod_h mod;
|
||||
furvm::executor_h executor;
|
||||
furvm::function_h mainFunction;
|
||||
|
||||
bool running = true;
|
||||
|
||||
void run();
|
||||
};
|
||||
|
||||
#endif // CONTEXT_HPP
|
||||
Reference in New Issue
Block a user