chore: flat out the file structure
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
#ifndef FURVM_FWD_HPP
|
||||
#define FURVM_FWD_HPP
|
||||
|
||||
#include <cstddef> // IWYU pragma: export
|
||||
#include <cstdint> // IWYU pragma: export
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* @brief Furlang's virtual machine.
|
||||
*/
|
||||
namespace furvm {
|
||||
|
||||
/**
|
||||
* @brief A byte.
|
||||
*
|
||||
* There's nothing more to it.
|
||||
*/
|
||||
using byte = std::uint8_t;
|
||||
|
||||
/**
|
||||
* @brief An offset into bytecode.
|
||||
*/
|
||||
using bytecode_pos = std::uint64_t;
|
||||
|
||||
/**
|
||||
* @brief Handle header with reference count.
|
||||
*/
|
||||
template <typename Id>
|
||||
class refcount_header;
|
||||
|
||||
/**
|
||||
* @brief Generic handle header.
|
||||
*/
|
||||
template <typename Id>
|
||||
class generic_header;
|
||||
|
||||
/**
|
||||
* @brief Generic furvm object handle.
|
||||
*
|
||||
* @tparam Value Type of the handle's value.
|
||||
* @tparam Header Type of the handle's header.
|
||||
*/
|
||||
template <typename Value, typename Header>
|
||||
class handle;
|
||||
|
||||
/**
|
||||
* @brief Container for the handles.
|
||||
*
|
||||
* @tparam Handle Type of the container's handle.
|
||||
*/
|
||||
template <typename Handle, typename = void>
|
||||
class handle_container;
|
||||
|
||||
// constant.hpp
|
||||
|
||||
/**
|
||||
* @brief Constant index.
|
||||
*
|
||||
* An index to the constant in module's constant pool.
|
||||
*/
|
||||
using constant_index = std::uint16_t;
|
||||
|
||||
/**
|
||||
* @enum constant_t
|
||||
* @brief Constant type.
|
||||
*/
|
||||
enum class constant_t : std::uint8_t;
|
||||
|
||||
/**
|
||||
* @class constant
|
||||
* @brief Constant.
|
||||
*/
|
||||
class constant;
|
||||
|
||||
// instruction.hpp
|
||||
|
||||
struct instruction_argument;
|
||||
|
||||
/**
|
||||
* @struct instruction
|
||||
* @brief Furvm's instruction.
|
||||
*/
|
||||
struct instruction;
|
||||
|
||||
// function.hpp
|
||||
|
||||
/**
|
||||
* @enum function_t
|
||||
* @brief Function type.
|
||||
*/
|
||||
enum class function_t : std::uint8_t;
|
||||
|
||||
/**
|
||||
* @class function
|
||||
* @brief Function.
|
||||
*
|
||||
* A furvm function.
|
||||
*/
|
||||
class function;
|
||||
|
||||
/**
|
||||
* @brief Furvm function's index.
|
||||
*/
|
||||
using function_id = std::uint16_t;
|
||||
|
||||
/**
|
||||
* @brief A handle to a furvm function.
|
||||
*/
|
||||
using function_h = handle<function, refcount_header<function_id>>;
|
||||
|
||||
// module.hpp
|
||||
|
||||
struct mod_type;
|
||||
|
||||
using mod_type_id = std::uint32_t;
|
||||
|
||||
using mod_type_h = handle<mod_type, generic_header<mod_type_id>>;
|
||||
|
||||
/**
|
||||
* @class mod
|
||||
* @brief Module.
|
||||
*
|
||||
* A furvm module. Translation unit of furlang.
|
||||
*/
|
||||
class mod;
|
||||
|
||||
/**
|
||||
* @brief An alias to a module shared pointer.
|
||||
*/
|
||||
using mod_p = std::shared_ptr<mod>;
|
||||
|
||||
/**
|
||||
* @brief An alias for a module's identifier.
|
||||
*/
|
||||
using mod_id = std::string;
|
||||
|
||||
/**
|
||||
* @brief A handle to a furvm module.
|
||||
*/
|
||||
using mod_h = handle<mod, refcount_header<mod_id>>;
|
||||
|
||||
// thing.hpp
|
||||
|
||||
/**
|
||||
* @class bad_thing_access
|
||||
* @brief Bad thing access exception.
|
||||
*/
|
||||
class bad_thing_access;
|
||||
|
||||
using thing_type_id = std::uint32_t;
|
||||
|
||||
/**
|
||||
* @class thing
|
||||
* @brief Furvm thing.
|
||||
*
|
||||
* A stack element. Think of it like of a value in C++ or I guess a class in java.
|
||||
*/
|
||||
template <template <typename> typename Allocator = std::allocator>
|
||||
class thing;
|
||||
|
||||
/**
|
||||
* @brief Furvm thing's index.
|
||||
*/
|
||||
using thing_id = std::uint32_t;
|
||||
|
||||
// executor.hpp
|
||||
|
||||
/**
|
||||
* @brief A variable index type.
|
||||
*/
|
||||
using variable_t = std::uint16_t;
|
||||
|
||||
/**
|
||||
* @enum executor_flags
|
||||
* @brief Flags of an executor.
|
||||
*/
|
||||
enum class executor_flags : std::uint32_t;
|
||||
|
||||
/**
|
||||
* @class executor
|
||||
* @brief Furvm executor.
|
||||
*
|
||||
* Furvm executors are like threads.
|
||||
*/
|
||||
class executor;
|
||||
|
||||
/**
|
||||
* @brief Furvm executor's index.
|
||||
*/
|
||||
using executor_id = std::uint32_t;
|
||||
|
||||
// context.hpp
|
||||
|
||||
/**
|
||||
* @class context
|
||||
* @brief Context.
|
||||
*
|
||||
* A furvm context.
|
||||
*/
|
||||
class context;
|
||||
|
||||
/**
|
||||
* @brief An alias to a context shared pointer.
|
||||
*/
|
||||
using context_p = std::shared_ptr<context>;
|
||||
|
||||
// exceptions.hpp:
|
||||
|
||||
/**
|
||||
* @class stack_underflow
|
||||
* @brief Stack underflow exception.
|
||||
*/
|
||||
class stack_underflow;
|
||||
|
||||
} // namespace furvm
|
||||
|
||||
#endif // FURVM_FWD_HPP
|
||||
Reference in New Issue
Block a user