diff options
Diffstat (limited to 'starts/meaning-vm/level-1')
-rw-r--r-- | starts/meaning-vm/level-1/baseref.hpp | 2 | ||||
-rw-r--r-- | starts/meaning-vm/level-1/funcs.cpp | 23 | ||||
-rw-r--r-- | starts/meaning-vm/level-1/funcs.hpp | 2 | ||||
-rw-r--r-- | starts/meaning-vm/level-1/ref.cpp | 31 | ||||
-rw-r--r-- | starts/meaning-vm/level-1/ref.hpp | 2 |
5 files changed, 26 insertions, 34 deletions
diff --git a/starts/meaning-vm/level-1/baseref.hpp b/starts/meaning-vm/level-1/baseref.hpp index 6215225..187b5df 100644 --- a/starts/meaning-vm/level-1/baseref.hpp +++ b/starts/meaning-vm/level-1/baseref.hpp @@ -48,7 +48,7 @@ struct baseref : public level0::baseref<ref> template <typename... Ref> ref operator()(Ref... args) { return self.template fun<Ref...>()(args...); } - std::string dump(ref skipmarkertype, ref skipmarkertarget); + std::string dump(ref skipmarkertype, ref skipmarkertarget) { return level1::dump(self, skipmarkertype, skipmarkertarget); }; private: template <typename... Refs> diff --git a/starts/meaning-vm/level-1/funcs.cpp b/starts/meaning-vm/level-1/funcs.cpp index 07f0eba..72d3c27 100644 --- a/starts/meaning-vm/level-1/funcs.cpp +++ b/starts/meaning-vm/level-1/funcs.cpp @@ -89,5 +89,28 @@ concept* hyphenate(concept* a, concept* b) return getnamed(getname(a) + "-" + getname(b)); } +std::string dump(concept* what, concept* skipmarkertype, concept* skipmarkertarget) +{ + if (what->linked(skipmarkertype, skipmarkertarget)) { + return {}; + } + std::string ret; + for (auto & link : ref(what).links()) { + if (link.first == concepts::name) { continue; } + if (ret.size() == 0) { + ret = ref(what).name() + ":\n"; + } + ret += " " + link.first.name() + ": " + link.second.name() + "\n"; + } + what->link(skipmarkertype, skipmarkertarget); + for (auto & link : ref(what).links()) { + if (link.first.ptr() == skipmarkertype && link.second.ptr() == skipmarkertarget) { + continue; + } + ret += dump(link.second, skipmarkertype, skipmarkertarget); + } + return ret; +} + } } diff --git a/starts/meaning-vm/level-1/funcs.hpp b/starts/meaning-vm/level-1/funcs.hpp index 741a5af..4b53ddd 100644 --- a/starts/meaning-vm/level-1/funcs.hpp +++ b/starts/meaning-vm/level-1/funcs.hpp @@ -20,5 +20,7 @@ concept* hyphenate(concept* a, concept* b); concept* alloc(std::any val); +std::string dump(concept * what, concept * skipmarkertype, concept * skipmarkertarget); + } } diff --git a/starts/meaning-vm/level-1/ref.cpp b/starts/meaning-vm/level-1/ref.cpp deleted file mode 100644 index 8d74b50..0000000 --- a/starts/meaning-vm/level-1/ref.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "ref.hpp" - -#include "concepts.hpp" - - -using namespace intellect; -using namespace level1; -using namespace concepts; - -std::string ref::dump(ref skipmarkertype, ref skipmarkertarget) -{ - if (linked(skipmarkertype, skipmarkertarget)) { - return {}; - } - std::string ret; - for (auto & link : links()) { - if (link.first == concepts::name) { continue; } - if (ret.size() == 0) { - ret = name() + ":\n"; - } - ret += " " + link.first.name() + ": " + link.second.name() + "\n"; - } - link(skipmarkertype, skipmarkertarget); - for (auto & link : links()) { - if (link.first == skipmarkertype && link.second == skipmarkertarget) { - continue; - } - ret += link.second.dump(skipmarkertype, skipmarkertarget); - } - return ret; -} diff --git a/starts/meaning-vm/level-1/ref.hpp b/starts/meaning-vm/level-1/ref.hpp index 3f2214d..fdd7dfd 100644 --- a/starts/meaning-vm/level-1/ref.hpp +++ b/starts/meaning-vm/level-1/ref.hpp @@ -9,8 +9,6 @@ namespace level1 { struct ref : public baseref<ref> { using baseref<ref>::baseref; - - std::string dump(ref skipmarkertype, ref skipmarkertarget); }; } |