From 09e164c02120f05c9364d5d9a8faad2ec0026425 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Wed, 16 Oct 2024 12:52:32 +0200 Subject: Dangling changes --- modules/lang/c++/c_common.hpp | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'modules/lang/c++/c_common.hpp') diff --git a/modules/lang/c++/c_common.hpp b/modules/lang/c++/c_common.hpp index 6999126..968c4c0 100644 --- a/modules/lang/c++/c_common.hpp +++ b/modules/lang/c++/c_common.hpp @@ -4,4 +4,53 @@ namespace saw { namespace lang { struct RemoteC {}; } + +namespace lang_c { +struct config { + std::string prefix; +}; + +struct transfer_binding_state { + struct info { + std::string type; + }; + + std::map hashes; + + struct transpiled_element { + uint32_t crc32; + std::string header; + std::string source; + }; + + std::vector tp_elements; + + error_or find_id_by_crc32(uint32_t hash){ + for(uint64_t iter = 0; iter < tp_elements.size(); ++iter){ + if(tp_elements.at(iter).crc32 == hash){ + return iter; + } + } + + return make_error(); + } + + error_or add_tp_element(uint32_t hash){ + uint64_t id{}; + + try { + language_binding_state::transpiled_element ele; + + ele.crc32 = hash; + + id = tp_elements.size(); + tp_elements.emplace_back(std::move(ele)); + }catch(const std::exception&){ + return make_error(); + } + + return id; + } +}; +} } -- cgit v1.2.3