summaryrefslogtreecommitdiff
path: root/modules/tools
diff options
context:
space:
mode:
authorClaudius 'keldu' Holeksa <mail@keldu.de>2024-07-26 14:06:16 +0200
committerClaudius 'keldu' Holeksa <mail@keldu.de>2024-07-26 14:06:16 +0200
commit4244c69184602efff78b77ea72a5da44b650b4ad (patch)
tree249cddb3d9877faf582cac48b790eb1eb3fd1575 /modules/tools
parent3ad1f9e4147cf64627793d4003b50039d86ce995 (diff)
reworks preparing for rpc translation
Diffstat (limited to 'modules/tools')
-rw-r--r--modules/tools/c++/c_rpc_gen_iface.hpp113
-rw-r--r--modules/tools/c++/lang_bind/c_rpc.hpp7
-rw-r--r--modules/tools/c++/lang_bind/c_rpc_base.hpp7
-rw-r--r--modules/tools/c++/lang_bind/c_rpc_headers.hpp7
4 files changed, 21 insertions, 113 deletions
diff --git a/modules/tools/c++/c_rpc_gen_iface.hpp b/modules/tools/c++/c_rpc_gen_iface.hpp
deleted file mode 100644
index d91af43..0000000
--- a/modules/tools/c++/c_rpc_gen_iface.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-#pragma once
-
-#include "c_gen_iface.hpp"
-
-namespace saw {
-namespace binding {
-/**
- * Language Binding for RPC Interfaces
- */
-struct RpcC {};
-}
-
-namespace impl {
-template<typename T, uint64_t L>
-struct lang_bind<schema::Primitive<T,L>, binding::RpcC> {
- using Schema = schema::Primitive<T,L>;
-
- static error_or<void> generate(const language_binding_conf& cfg, language_binding_state& state){
- constexpr uint32_t hash = schema_hash<Schema>::apply();
- {
- std::string hash_type_str = cfg.prefix + "_" + std::to_string(hash) + "_t";
- auto emp = state.hashes.emplace(std::make_pair(hash, hash_type_str));
- if(emp.second) {
- /**
- * We want this id to access the vector
- */
- auto& tpe = state.tp_elements;
- uint64_t id;
- {
- auto eoid = state.add_tp_element(hash);
- if(eoid.is_error()){
- return std::move(eoid.get_error());
- }
- id = eoid.get_value();
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).header, "typedef ");
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).header, c_primitive_string<Schema>::value.view());
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).header, " ");
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).header, hash_type_str);
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).header, ";\n");
- if(eov.is_error()){
- return eov;
- }
- }
- /**
- * Translation in source
- */
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).source, "namespace {\n");
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_translation_func<Schema>(tpe.at(id).source, cfg.prefix, true);
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).source, " {\n\tcpp_output.set(*c_input);\n");
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).source, "\treturn void_t{};\n}\n");
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_translation_func<Schema>(tpe.at(id).source, cfg.prefix, false);
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = lang_bind_helper::append_string(tpe.at(id).source, " {\n\t*c_output = cpp_output.get();\n\treturn void_t{};\n}\n}");
- if(eov.is_error()){
- return eov;
- }
- }
-
- }
- }
-
- return void_t{};l
- }
-};
-}
-}
diff --git a/modules/tools/c++/lang_bind/c_rpc.hpp b/modules/tools/c++/lang_bind/c_rpc.hpp
new file mode 100644
index 0000000..75c2f7c
--- /dev/null
+++ b/modules/tools/c++/lang_bind/c_rpc.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "c_rpc_types.hpp"
+
+namespace saw {
+
+}
diff --git a/modules/tools/c++/lang_bind/c_rpc_base.hpp b/modules/tools/c++/lang_bind/c_rpc_base.hpp
new file mode 100644
index 0000000..cddae54
--- /dev/null
+++ b/modules/tools/c++/lang_bind/c_rpc_base.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace saw {
+namespace lang {
+struct RpcC {};
+}
+}
diff --git a/modules/tools/c++/lang_bind/c_rpc_headers.hpp b/modules/tools/c++/lang_bind/c_rpc_headers.hpp
new file mode 100644
index 0000000..931eb2c
--- /dev/null
+++ b/modules/tools/c++/lang_bind/c_rpc_headers.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "c_rpc_base.hpp"
+
+namespace saw {
+
+}