summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-2/sugar.hpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-21 08:34:50 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-12-21 08:34:50 -0800
commite720dfea4d7b07cbeb5312dbfd6940fd7fa29633 (patch)
tree1db313595ac31d6f647f8fee0c117eb845ff2f09 /starts/meaning-vm/level-2/sugar.hpp
parent8ab69b673852971103e89eafa15a1dc6385b56ce (diff)
downloadstandingwithresilience-e720dfea4d7b07cbeb5312dbfd6940fd7fa29633.tar.gz
standingwithresilience-e720dfea4d7b07cbeb5312dbfd6940fd7fa29633.zip
=S default assumptions for habit macro
Diffstat (limited to 'starts/meaning-vm/level-2/sugar.hpp')
-rw-r--r--starts/meaning-vm/level-2/sugar.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/starts/meaning-vm/level-2/sugar.hpp b/starts/meaning-vm/level-2/sugar.hpp
index 9065a20..e6d9ea4 100644
--- a/starts/meaning-vm/level-2/sugar.hpp
+++ b/starts/meaning-vm/level-2/sugar.hpp
@@ -22,7 +22,7 @@
#define ahabit(name, argnametoklist, ...) \
intellect::level2::makehabit( \
- name, \
+ ref(#name), \
{_macro_call(_macro_for_each_parens, _macro_habit_argnameref, _macro_habit_commaargnameref _macro_comma_remove_parens(argnametoklist))}, \
(std::function<void(ref)>) \
[=](ref ctx) \
@@ -31,12 +31,16 @@
static int delay = (double(rand()) / RAND_MAX * 400000 + 200000); \
usleep(delay); \
} \
- ref self = name; (void)self; \
+ ref self = ref(#name); (void)self; \
ref result("nothing"); (void)result; \
_macro_call(_macro_for_each_parens, _macro_habit_set_posarg, _macro_habit_set_posarg _macro_comma_remove_parens(argnametoklist)); \
__VA_ARGS__ \
if (result != ref("nothing")) { ctx.link(ref("result"), result); } \
- });
+ }); \
+ { \
+ ref _macro_habit_name(#name); \
+ _macro_call(_macro_for_each_parens, _macro_habit_assume, _macro_habit_assume _macro_comma_remove_parens(argnametoklist)) \
+ }
#define _macro_habit_argnameref(name, tok, ...) \
ref(#name)
#define _macro_habit_commaargnameref(name, tok, ...) \
@@ -49,6 +53,8 @@
ref("missing-information"), ref(#name)); \
} \
ref tok = ctx.linked(ref(#name)) ? ctx[ref(#name)] : ref(#__VA_ARGS__);
+ #define _macro_habit_assume(info, tok, ...) \
+ if ((#__VA_ARGS__)[0] != 0) { intellect::level2::habitassume(_macro_habit_name, ref(#info), ref(#__VA_ARGS__)); }
// seed random number generator statically, for habit delay
namespace _macro_habit {