From 287ddfc25ee60955e2bfc8ba8193309747639f4f Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 5 Aug 2023 11:14:51 -0700 Subject: til_builtins: add "none" builtin Sometimes nested modules are optional, in those cases I've usually been using the "none" module name to indicate this and the ad-hoc setup stuff can easily bypass module setup on that. This commit is a step towards having a "none" builtin that provides a til_module_t.setup() which succeeds but only produces a NULL res_setup when asked to finalize. So if callers just handle a successful finalize case that writes NULL at res_setup equivalent to "disabled", this all Just Works. Currently that's not an expected thing, but future commits will bring everything else on the same page. For callers who want to require the module and not offer "none", they can just put "none" in the explicit exclusions list passed to til_module_setup_full(). --- src/til.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/til.c') diff --git a/src/til.c b/src/til.c index 100621d..ea1e5fb 100644 --- a/src/til.c +++ b/src/til.c @@ -59,6 +59,7 @@ extern til_module_t voronoi_module; /* built-ins (til_builtins.c) */ extern til_module_t _blank_module; +extern til_module_t _none_module; extern til_module_t _noop_module; extern til_module_t _ref_module; @@ -94,6 +95,7 @@ static const til_module_t *modules[] = { /* built-ins at the end */ &_blank_module, + &_none_module, &_noop_module, &_ref_module, }; -- cgit v1.2.1