diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-03-11 21:32:55 +0100 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-03-11 21:33:06 +0100 |
commit | ad01375558d3f276299d4690c95b94eff9ad8a8b (patch) | |
tree | ae9023dfbf1afd802a992d32592e0cdd03b8571a | |
parent | 2fac9606ec57bb12c89fb7b65a5364904411a72b (diff) |
tools: better error printing
-rw-r--r-- | modules/tools/c++/c_gen_iface.hpp | 21 | ||||
-rw-r--r-- | modules/tools/tests/c_iface.cpp | 4 |
2 files changed, 25 insertions, 0 deletions
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<schema::Function<Input, Output>, 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<schema::TestEmptyInterface>(res,src); std::cout<<"\n"<<res<<"\n"<<std::endl; + std::cout<<"\nSource\n"<<src<<"\n"<<std::endl; } SAW_TEST("CIface One Function Interface"){ @@ -77,6 +78,7 @@ SAW_TEST("CIface One Function Interface"){ std::string src; test_generate<schema::TestOneFunctionInterface>(res, src); std::cout<<"\n"<<res<<"\n"<<std::endl; + std::cout<<"\nSource\n"<<src<<"\n"<<std::endl; } SAW_TEST("CIface Multi Function Interface"){ @@ -86,6 +88,7 @@ SAW_TEST("CIface Multi Function Interface"){ std::string src; test_generate<schema::TestMultiFunctionInterface>(res, src); std::cout<<"\n"<<res<<"\n"<<std::endl; + std::cout<<"\nSource\n"<<src<<"\n"<<std::endl; } SAW_TEST("CIface Array Function Interface"){ @@ -95,5 +98,6 @@ SAW_TEST("CIface Array Function Interface"){ std::string src; test_generate<schema::TestArrayFunctionInterface>(res, src); std::cout<<"\n"<<res<<"\n"<<std::endl; + std::cout<<"\nSource\n"<<src<<"\n"<<std::endl; } } |