mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-04-30 19:09:26 +08:00
* Fix #571: Add per-instance IO redirection via set_print_handler/set_println_handler The print_string and println_string functions were previously registered as static functions writing directly to stdout, making it impossible to redirect ChaiScript output to custom destinations (e.g., GUI windows, loggers, or buffers). This moves their registration from Bootstrap::bootstrap() to ChaiScript_Basic::build_eval_system() as lambdas that dispatch through configurable std::function handlers, allowing each ChaiScript instance to independently redirect its output via set_print_handler() and set_println_handler(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review: add IO redirection section to cheatsheet Documents set_print_handler() and set_println_handler() with usage examples for GUI embedding and output capture. Requested by @lefticus in PR #657 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review: define println in terms of print, expose set_print_handler to ChaiScript Remove separate println_handler — println_string now dispatches through the single print handler with a newline appended. Only set_print_handler is needed to redirect all output. The set_print_handler function is also registered in the ChaiScript engine, so scripts can capture and redirect their own output. Requested by @lefticus in PR #657 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review: populate null print handler when No_IO is set When No_IO is active, the default m_print_handler is now a no-op instead of writing to stdout. The stdout handler is only installed when No_IO is not set. Users can still override the handler via set_print_handler() even with No_IO enabled. Requested by @lefticus in PR #657 review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: leftibot <leftibot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| chaiscript_algebraic.hpp | ||
| chaiscript_common.hpp | ||
| chaiscript_engine.hpp | ||
| chaiscript_eval.hpp | ||
| chaiscript_optimizer.hpp | ||
| chaiscript_parser.hpp | ||
| chaiscript_posix.hpp | ||
| chaiscript_prelude_docs.hpp | ||
| chaiscript_prelude.hpp | ||
| chaiscript_tracer.hpp | ||
| chaiscript_unknown.hpp | ||
| chaiscript_windows.hpp | ||