summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-1/funcs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/level-1/funcs.cpp')
-rw-r--r--starts/meaning-vm/level-1/funcs.cpp23
1 files changed, 23 insertions, 0 deletions
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;
+}
+
}
}