Files
furlang/furvm/include/furvm/fwd.hpp
T
CHatingPython a1e43576cc this code is a mess and I am losing my mind
This commit does not work and I am so down I don't even bother
committing to conventional commits until I fix this mess.
2026-07-19 21:38:00 +02:00

243 lines
3.9 KiB
C++

#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
/**
* @enum instruction_t
* @brief Furvm's instruction type.
*/
enum class instruction_t : byte;
/**
* @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, generic_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_allocator.hpp
template <typename T>
class thing_allocator;
// 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 = thing_allocator>
class thing;
/**
* @brief Furvm thing's index.
*/
using thing_id = std::uint32_t;
/**
* @brief A handle to a thing.
*/
using thing_h = handle<thing<thing_allocator>, refcount_header<thing_id>>;
// 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 An alias to a executor shared pointer.
*/
using executor_p = std::shared_ptr<executor>;
/**
* @brief Furvm executor's index.
*/
using executor_id = std::uint32_t;
/**
* @brief A handle to an executor.
*/
using executor_h = handle<executor, refcount_header<executor_id>>;
// 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