Fix documentation
This commit is contained in:
1 parent
a317c07124
commit
ab21b3f30d
27 files changed
+2137
-1043
No files matched your search
@@ -1,4 +1,6 @@
|
||||
/* Main.cpp -- a persistent process, unlike source/examples/
|
||||
/**
|
||||
* @file Main.cpp
|
||||
* @brief Interactive demo: a persistent process, unlike source/examples/
|
||||
* HotReloadDemo/Host (which runs a fixed script and exits). This one
|
||||
* loads Plugin/src/LivePlugin.cpp's compiled output once, then polls
|
||||
* that file's last-write time every second: whenever it changes (i.e.
|
||||
@@ -18,13 +20,18 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
/// Cleared by handleSigint(); the main loop polls this to exit cleanly on Ctrl+C.
|
||||
std::atomic<bool> g_running{true};
|
||||
|
||||
/// SIGINT handler: requests a clean shutdown instead of the default terminate.
|
||||
/// The signal number itself is unused (this is only ever registered for SIGINT).
|
||||
void handleSigint(int /*signal*/)
|
||||
{
|
||||
g_running = false;
|
||||
}
|
||||
|
||||
/// @param kind The event kind to name.
|
||||
/// @return A short, human-readable label for @p kind.
|
||||
const char* eventKindName(HotReloadSymbolEvent kind)
|
||||
{
|
||||
switch (kind)
|
||||
@@ -45,6 +52,8 @@ namespace
|
||||
return "?";
|
||||
}
|
||||
|
||||
/// Logs every symbol event except REMOVED, which onDeletedSymbol() already logs.
|
||||
/// @param event Describes one symbol's outcome.
|
||||
void onSymbolEvent(const HotReloadSymbolEventInfo* event, void* /*userData*/)
|
||||
{
|
||||
if (event->kind == HOT_RELOAD_SYMBOL_REMOVED)
|
||||
@@ -54,6 +63,9 @@ namespace
|
||||
std::printf(" [reload] %-24s %s\n", eventKindName(event->kind), event->name);
|
||||
}
|
||||
|
||||
/// Stands in for @c live_tick once a rebuild removes it.
|
||||
/// @param frame The current frame number.
|
||||
/// @return Always -1.
|
||||
int fallbackForDeletedTick(int frame)
|
||||
{
|
||||
std::printf(
|
||||
@@ -63,6 +75,8 @@ namespace
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// @param symbolName The removed function's real (possibly mangled) name.
|
||||
/// @return The host fallback to redirect old callers to.
|
||||
void* onDeletedSymbol(const char* symbolName, void* /*userData*/)
|
||||
{
|
||||
std::printf(" [reload] REMOVED %s -> falling back to the Host's stub\n", symbolName);
|
||||
@@ -71,6 +85,11 @@ namespace
|
||||
|
||||
}
|
||||
|
||||
/// Runs the interactive demo described in this file's @ref Main.cpp "file comment".
|
||||
/// @param argc Argument count.
|
||||
/// @param argv `argv[1]`, if present, overrides the compiled-in plugin path.
|
||||
/// @return 0 on clean shutdown (Ctrl+C), 1 if the context could not be created or the initial
|
||||
/// load failed.
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Force line buffering regardless of whether stdout is a real
|
||||
|
||||
Reference in new issue
Block a user