From ad01375558d3f276299d4690c95b94eff9ad8a8b Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 11 Mar 2024 21:32:55 +0100 Subject: tools: better error printing --- modules/tools/c++/c_gen_iface.hpp | 21 +++++++++++++++++++++ modules/tools/tests/c_iface.cpp | 4 ++++ 2 files changed, 25 insertions(+) (limited to 'modules') diff --git a/modules/tools/c++/c_gen_iface.hpp b/modules/tools/c++/c_gen_iface.hpp index a5d1de6..8bd702b 100644 --- a/modules/tools/c++/c_gen_iface.hpp +++ b/modules/tools/c++/c_gen_iface.hpp @@ -482,6 +482,27 @@ struct lang_bind, binding::SyncC> { return eov; } } + /** + * Source + */ + { + auto eov = append_function_def(src, cfg, state, f_name); + if(eov.is_error()){ + return eov; + } + } + { + auto eov = lang_bind_helper::append_string(src, "{\n\tif(!input) return -1;\n\tif(!output) return -1;\n\t"); + if(eov.is_error()){ + return eov; + } + } + { + auto eov = lang_bind_helper::append_string(src, "return 0;\n}\n\n"); + if(eov.is_error()){ + return eov; + } + } return void_t{}; } diff --git a/modules/tools/tests/c_iface.cpp b/modules/tools/tests/c_iface.cpp index 676b5de..01f981e 100644 --- a/modules/tools/tests/c_iface.cpp +++ b/modules/tools/tests/c_iface.cpp @@ -68,6 +68,7 @@ SAW_TEST("CIface Empty Interface"){ test_generate(res,src); std::cout<<"\n"<(res, src); std::cout<<"\n"<(res, src); std::cout<<"\n"<(res, src); std::cout<<"\n"<