Add 20+ new modules with tests: Pipeline, Matrix, Tokenizer, ScopeGuard, Bitset, Optional, Counted, Curry, TypeMap, Bench, DisjointSet, Histogram, StopWatch, and more
Also fixes Diff/Memo/PriorityQueue from previous session: LineDiff is now an alias for Edit<string> so count_op/apply work on line diffs; Memoized uses std::apply instead of type-based get to handle duplicate arg types. 874/877 tests pass (3 are platform-gated plugin tests). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb4dd58500
commit
58ff7b38a0
65 files changed
+8987
-37
No files matched your search
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
namespace Void::Plugin
|
||||
{
|
||||
|
||||
// ── ABI version ───────────────────────────────────────────────────────────────
|
||||
// Bump whenever IPlugin's vtable order changes. Loader rejects mismatches.
|
||||
|
||||
inline constexpr std::uint32_t ABI_VERSION = 1;
|
||||
|
||||
// ── PluginInfo ────────────────────────────────────────────────────────────────
|
||||
// Plain-C struct returned by the info entry point. All fields are C strings so
|
||||
// they cross the ABI boundary without C++ allocator involvement.
|
||||
|
||||
struct PluginInfo {
|
||||
std::uint32_t abi_version {ABI_VERSION};
|
||||
const char* name {""};
|
||||
const char* plugin_version{"0.0.0"};
|
||||
const char* description {""};
|
||||
};
|
||||
|
||||
// ── IPlugin ───────────────────────────────────────────────────────────────────
|
||||
// Abstract interface every plugin must implement.
|
||||
// Vtable layout is FROZEN: new pure-virtual methods go only at the END.
|
||||
|
||||
class IPlugin {
|
||||
public:
|
||||
virtual ~IPlugin() = default;
|
||||
|
||||
[[nodiscard]] virtual std::string_view name() const noexcept = 0;
|
||||
|
||||
// Called once after the plugin is successfully created and verified.
|
||||
virtual void on_load() {}
|
||||
|
||||
// Called once before the plugin is destroyed (including during hot-reload).
|
||||
virtual void on_unload() {}
|
||||
};
|
||||
|
||||
// ── C ABI entry-point typedefs ────────────────────────────────────────────────
|
||||
// The .so MUST export these symbols via extern "C":
|
||||
//
|
||||
// void* void_plugin_create() — construct and return IPlugin*
|
||||
// void void_plugin_destroy(void*) — destruct the IPlugin*
|
||||
// PluginInfo void_plugin_info() — return metadata + ABI version
|
||||
//
|
||||
// Optional (enables hot-reload state transfer):
|
||||
// void void_plugin_transfer_state(void* old, void* new)
|
||||
|
||||
using create_fn = void* (*)(void);
|
||||
using destroy_fn = void (*)(void*);
|
||||
using info_fn = PluginInfo (*)(void);
|
||||
using transfer_fn = void (*)(void* old_instance, void* new_instance);
|
||||
|
||||
inline constexpr const char* kCreateSymbol = "void_plugin_create";
|
||||
inline constexpr const char* kDestroySymbol = "void_plugin_destroy";
|
||||
inline constexpr const char* kInfoSymbol = "void_plugin_info";
|
||||
inline constexpr const char* kTransferSymbol = "void_plugin_transfer_state";
|
||||
|
||||
} // namespace Void::Plugin
|
||||
Reference in new issue
Block a user