summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/habit-starts
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-08 07:05:40 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-08 07:05:40 -0800
commit65c656eb18216d54d753df2a62eb6d2f5eaa0edc (patch)
treeb46eb1b692484ab299d23c27f2dcd973a44df3db /starts/meaning-vm/habit-starts
parent866a37a12e722f4aa89df56d05ac8666c308a63d (diff)
downloadstandingwithresilience-65c656eb18216d54d753df2a62eb6d2f5eaa0edc.tar.gz
standingwithresilience-65c656eb18216d54d753df2a62eb6d2f5eaa0edc.zip
move habit macro into level-2
Diffstat (limited to 'starts/meaning-vm/habit-starts')
-rw-r--r--starts/meaning-vm/habit-starts/habit.hpp23
-rw-r--r--starts/meaning-vm/habit-starts/rhythm.cpp3
2 files changed, 1 insertions, 25 deletions
diff --git a/starts/meaning-vm/habit-starts/habit.hpp b/starts/meaning-vm/habit-starts/habit.hpp
deleted file mode 100644
index 5c6f5e8..0000000
--- a/starts/meaning-vm/habit-starts/habit.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-#include <stdlib.h> // int rand(); void srand(int seed);
-#include <time.h> // int time(0);
-#include <unistd.h> // usleep(unsigned int usecs)
-
-__attribute__ ((visibility ("hidden"))) int __seed = (srand(time(0)), time(0));
-#define habitdelay \
- static int thisdelay = (double(rand()) / RAND_MAX * 400000 + 200000); \
- usleep(thisdelay)
-
-#undef self
-#define ahabit(name, ...) \
- a(habit, name); \
- (name).fun((std::function<ref(ref)>) \
- [=](ref ctx) \
- { \
- habitdelay; \
- ref self = name; \
- (void)self; \
- __VA_ARGS__ \
- return intellect::level1::concepts::nothing; \
- });
diff --git a/starts/meaning-vm/habit-starts/rhythm.cpp b/starts/meaning-vm/habit-starts/rhythm.cpp
index 3085da0..56172e8 100644
--- a/starts/meaning-vm/habit-starts/rhythm.cpp
+++ b/starts/meaning-vm/habit-starts/rhythm.cpp
@@ -4,7 +4,7 @@
// Ideally, a human would run the rhythm.
#include "../level-1/level-1.hpp"
-#include "habit.hpp"
+#include "../level-2/level-2.hpp"
#include <iostream>
@@ -121,7 +121,6 @@ int main()
});
ahabit(wait-habit,
{
- habitdelay;
usleep(micros);
});