about summary refs log tree commit diff stats
path: root/010vm.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-15 00:37:29 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-15 00:37:29 -0800
commitef96f57ce264c8e0bd98f6e8622d1c1e2eceafb2 (patch)
treef2113d385fde9c4b9579521402eab5ec9c1f208d /010vm.cc
parent7ecb3374340c02cc2c54abf4a5d4a617f362b4c4 (diff)
downloadmu-ef96f57ce264c8e0bd98f6e8622d1c1e2eceafb2.tar.gz
2441 - never miss any specializations
I was failing to specialize calls containing literals. And then I had to
deal with whether literals should map to numbers or characters. (Answer:
both.)

One of the issues that still remains: shape-shifting recipes can't be
called with literals for addresses, even if it's 0.
Diffstat (limited to '010vm.cc')
-rw-r--r--010vm.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/010vm.cc b/010vm.cc
index 92721d32..0b2888f0 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -484,6 +484,16 @@ bool deeply_equal(const string_tree* a, const string_tree* b) {
       && deeply_equal(a->right, b->right);
 }
 
+bool deeply_equal_types(const string_tree* a, const string_tree* b) {
+  if (!a) return !b;
+  if (!b) return !a;
+  if (a->value == "character" && b->value == "number") return true;
+  if (a->value == "number" && b->value == "character") return true;
+  return a->value == b->value
+      && deeply_equal_types(a->left, b->left)
+      && deeply_equal_types(a->right, b->right);
+}
+
 void dump_memory() {
   for (map<long long int, double>::iterator p = Memory.begin(); p != Memory.end(); ++p) {
     cout << p->first << ": " << no_scientific(p->second) << '\n';
> 2020-03-15 13:41:18 +0530 committer Andinus <andinus@inventati.org> 2020-03-15 13:41:18 +0530 Explain behaviour on media image type' href='/andinus/cetus/commit/README.org?h=v0.5.1&id=16842fa8ade95fcb45ad9d47275633d094769f15'>16842fa ^
50871fc ^















16842fa ^


50871fc ^












f0a905d ^
b34b873 ^


a7e66bc ^


b34b873 ^

bfa2918 ^
6849d7f ^
b34b873 ^
f755d1d ^

7552361 ^
72441e4 ^


7552361 ^
f755d1d ^












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85