summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-1
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-09 02:38:38 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-09 02:38:38 -0800
commitf5ec96b6f4f88065b4cc6c24057af15d1f025ad4 (patch)
tree26e8674e087f1523134a77d008971c0f1e6c6ad1 /starts/meaning-vm/level-1
parent5ef775d2612ad98b58c6cf8396adac35e883910d (diff)
downloadstandingwithresilience-f5ec96b6f4f88065b4cc6c24057af15d1f025ad4.tar.gz
standingwithresilience-f5ec96b6f4f88065b4cc6c24057af15d1f025ad4.zip
move level-1 dump up into baseref so derived can use
Diffstat (limited to 'starts/meaning-vm/level-1')
-rw-r--r--starts/meaning-vm/level-1/baseref.hpp2
-rw-r--r--starts/meaning-vm/level-1/funcs.cpp23
-rw-r--r--starts/meaning-vm/level-1/funcs.hpp2
-rw-r--r--starts/meaning-vm/level-1/ref.cpp31
-rw-r--r--starts/meaning-vm/level-1/ref.hpp2
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);
};
}