summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/helpers.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/helpers.hpp')
-rw-r--r--starts/meaning-vm/helpers.hpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/starts/meaning-vm/helpers.hpp b/starts/meaning-vm/helpers.hpp
index d69519c..f1b9e36 100644
--- a/starts/meaning-vm/helpers.hpp
+++ b/starts/meaning-vm/helpers.hpp
@@ -2,5 +2,23 @@
#include "concept.hpp"
-#define r(concept) \
- ref concept = #concept
+#include <sstream>
+
+template <typename... T>
+void __helper_init_ref_names(std::string names, T &... refrefs)
+{
+ std::stringstream ss(names);
+ ref* refptrs[] = {&refrefs...};
+ for (std::size_t i = 0; i < sizeof...(refrefs); ++ i) {
+ std::string name;
+ ss >> name;
+ if (name[name.size() - 1] == ',') {
+ name = name.substr(0, name.size() - 1);
+ }
+ refptrs[i]->ptr = ref(name).ptr;
+ }
+}
+
+#define decl(...) \
+ ref __VA_ARGS__; \
+ __helper_init_ref_names(#__VA_ARGS__, __VA_ARGS__)