summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starts/meaning-vm/level-1/sugar.cpp1
-rw-r--r--starts/meaning-vm/level-2/baseref.hpp13
-rw-r--r--starts/meaning-vm/level-2/habits.cpp15
-rw-r--r--starts/meaning-vm/level-2/habits.hpp10
-rw-r--r--starts/meaning-vm/level-2/level-2.hpp1
-rw-r--r--starts/meaning-vm/level2.cpp9
6 files changed, 42 insertions, 7 deletions
diff --git a/starts/meaning-vm/level-1/sugar.cpp b/starts/meaning-vm/level-1/sugar.cpp
index 025c68e..8585387 100644
--- a/starts/meaning-vm/level-1/sugar.cpp
+++ b/starts/meaning-vm/level-1/sugar.cpp
@@ -10,6 +10,7 @@ using namespace concepts;
namespace intellect {
namespace level1 {
+ // no way to specify allocator
ref a(ref group)
{
static unsigned long long gid = 0;
diff --git a/starts/meaning-vm/level-2/baseref.hpp b/starts/meaning-vm/level-2/baseref.hpp
index 8fbcc91..644f4b8 100644
--- a/starts/meaning-vm/level-2/baseref.hpp
+++ b/starts/meaning-vm/level-2/baseref.hpp
@@ -1,10 +1,8 @@
#pragma once
#include "common.hpp"
-
#include "funcs.hpp"
-
-#include "../level-1/common.hpp"
+#include "../level-1/baseref.hpp"
#include <functional>
@@ -21,10 +19,13 @@ struct baseref : public level1::baseref<ref>
template <typename... Refs>
ref operator()(ref first, Refs... rest) { return level2::dohabit(self, {first, rest...}); }
- template <typename... Pairs>
- ref operator()(std::initializer_list<ref> first, Pairs... rest) { return level2::dohabit(self, {first, rest...}); }
-
+ ref operator()(std::initializer_list<std::initializer_list<ref>> pairs) { return level2::dohabit(self, pairs); }
ref operator()() { return level2::dohabit(self); }
+
+ template <typename... Refs>
+ ref act(ref habit, Refs... rest) { return level2::dohabit(habit, {self, rest...}); }
+
+ void replace(ref other) { *self.ptr() = *other.ptr(); }
};
}
diff --git a/starts/meaning-vm/level-2/habits.cpp b/starts/meaning-vm/level-2/habits.cpp
index 13589cc..dfb9014 100644
--- a/starts/meaning-vm/level-2/habits.cpp
+++ b/starts/meaning-vm/level-2/habits.cpp
@@ -2,7 +2,9 @@
#include "../level-1/sugar.hpp"
#include "sugar.hpp"
-using namespace intellect::level2;
+namespace intellect {
+namespace level2 {
+
int createhabits()
{
decls(link, source, type, target);
@@ -375,3 +377,14 @@ int createhabits()
});
return 0;
}
+
+void ensurehabitscreated()
+{
+ static int sentinel = createhabits();
+ (void)(sentinel);
+}
+
+static int sentinel = (ensurehabitscreated(), 1);
+
+}
+}
diff --git a/starts/meaning-vm/level-2/habits.hpp b/starts/meaning-vm/level-2/habits.hpp
new file mode 100644
index 0000000..0bff7f7
--- /dev/null
+++ b/starts/meaning-vm/level-2/habits.hpp
@@ -0,0 +1,10 @@
+#include "common.hpp"
+
+namespace intellect {
+namespace level2 {
+
+void ensurehabitscreated(); // for running from static code, for construction order
+
+
+}
+}
diff --git a/starts/meaning-vm/level-2/level-2.hpp b/starts/meaning-vm/level-2/level-2.hpp
index 7c7dd9a..88b4474 100644
--- a/starts/meaning-vm/level-2/level-2.hpp
+++ b/starts/meaning-vm/level-2/level-2.hpp
@@ -4,3 +4,4 @@
#include "concepts.hpp"
#include "sugar.hpp"
#include "ref.hpp"
+#include "habits.hpp"
diff --git a/starts/meaning-vm/level2.cpp b/starts/meaning-vm/level2.cpp
new file mode 100644
index 0000000..c04a5cc
--- /dev/null
+++ b/starts/meaning-vm/level2.cpp
@@ -0,0 +1,9 @@
+#include "level-2/level-2.hpp"
+
+#include <iostream>
+
+using namespace intellect::level2;
+
+int main()
+{
+}