From 70314b3303f712a0277b80b23bc3613744e6178e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 1 Jun 2020 19:51:17 +0300 Subject: Add builtin weight Also invent the notion of external builtin (builtin_info::function is NULL). --- tests/builtin/driver.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/builtin/driver.cxx b/tests/builtin/driver.cxx index 2583ba2..9fb6d6f 100644 --- a/tests/builtin/driver.cxx +++ b/tests/builtin/driver.cxx @@ -144,15 +144,21 @@ main (int argc, char* argv[]) // Execute the builtin. // - builtin_function* bf (builtins.find (name)); + const builtin_info* bi (builtins.find (name)); - if (bf == nullptr) + if (bi == nullptr) { cerr << "unknown builtin '" << name << "'" << endl; return 1; } + if (bi->function == nullptr) + { + cerr << "external builtin '" << name << "'" << endl; + return 1; + } + uint8_t r; // Storage. - builtin b (bf (r, args, nullfd, nullfd, nullfd, cwd, callbacks)); + builtin b (bi->function (r, args, nullfd, nullfd, nullfd, cwd, callbacks)); return b.wait (); } -- cgit v1.1