-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy path6M62 Patches.i7x
191 lines (164 loc) · 6.63 KB
/
6M62 Patches.i7x
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
Version 2/220105 of 6M62 Patches by Friends of I7 begins here.
Use authorial modesty.
Volume intfiction.org/t/46906
[The original version of this function assumes that both sides of the relation are the same kind of value (or that
both are objects of some kind that need not be the same kind). The latter is reasonably common, but not guaranteed.
This implementation actually checks.]
Include (-
[ Relation_ShowOtoO relation sym x relation_property t1 t2 N1 obj1 obj2;
relation_property = RlnGetF(relation, RR_STORAGE);
t1 = KindBaseTerm(RlnGetF(relation, RR_KIND), 0); ! Kind of left term
t2 = KindBaseTerm(RlnGetF(relation, RR_KIND), 1); ! Kind of right term
if (t1 == OBJECT_TY) {
objectloop (obj1 provides relation_property) {
obj2 = obj1.relation_property;
if (sym && obj2 < obj1) continue;
if (obj2 == 0) continue;
if (x == 0) { print (string) RlnGetF(relation, RR_DESCRIPTION), ":^"; x=1; }
print " ", (The) obj1;
if (sym) print " == "; else print " >=> ";
if (t2 == OBJECT_TY) {
print (the) obj2, "^";
} else {
PrintKindValuePair(t2, obj2);
print "^";
}
}
} else {
N1 = KOVDomainSize(t1);
for (obj1=1: obj1<=N1: obj1++) {
obj2 = GProperty(t1, obj1, relation_property);
if (sym && obj2 < obj1) continue;
if (obj2 == 0) continue;
if (x == 0) { print (string) RlnGetF(relation, RR_DESCRIPTION), ":^"; x=1; }
print " ";
PrintKindValuePair(t1, obj1);
if (sym) print " == "; else print " >=> ";
if (t2 == OBJECT_TY) {
print (the) obj2, "^";
} else {
PrintKindValuePair(t2, obj2);
print "^";
}
}
}
];
-) instead of "Show One to One" in "Relations.i6t".
Volume intfiction.org/t/50338
[Having a "rulebook producing a list of [something]" crashes the interpreter because only
the "weak kind" (e.g. "list") is passed to the template functions, when a "strong kind"
(e.g. "list of text") is expected. This replacement fixed the issue by making the compiler
pass in the "strong kind" instead.]
Section A - List Type fixes - in place of Section SR5/4/8 in Standard Rules by Graham Nelson
To make no decision
(documented at ph_nodecision): (- rfalse; -) - in to only.
To rule succeeds
(documented at ph_succeeds):
(- RulebookSucceeds(); rtrue; -) - in to only.
To rule fails
(documented at ph_fails):
(- RulebookFails(); rtrue; -) - in to only.
[Fix here:]
To rule succeeds with result (val - a value)
(documented at ph_succeedswith):
(- RulebookSucceeds({-strong-kind:rule-return-kind},{-return-value-from-rule:val}); rtrue; -) - in to only.
To decide if rule succeeded
(documented at ph_succeeded):
(- (RulebookSucceeded()) -).
To decide if rule failed
(documented at ph_failed):
(- (RulebookFailed()) -).
To decide which rulebook outcome is the outcome of the rulebook
(documented at ph_rulebookoutcome):
(- (ResultOfRule()) -).
Volume intfiction.org/t/50840
[ A bug in TEXT_TY_BlobAccess can cause BlkValueWrite: writing to index out
of range errors when looping through words in a line or lines in a block
of text. Analysis and solution by Peter Bates. ]
Include (-
Replace TEXT_TY_BlobAccess;
-) after "Definitions.i6t".
Include (-
[ TEXT_TY_BlobAccess txt blobtype ctxt wanted rtxt
p1 p2 cp1 cp2 r;
if (txt==0) return 0;
if (blobtype == CHR_BLOB) return TEXT_TY_CharacterLength(txt);
cp1 = txt-->0; p1 = TEXT_TY_Temporarily_Transmute(txt);
cp2 = rtxt-->0; p2 = TEXT_TY_Temporarily_Transmute(rtxt);
TEXT_TY_Transmute(ctxt);
! ########### insertion begins ###########
if (ctxt) BlkMakeMutable(ctxt);
! ########### insertion ends ###########
r = TEXT_TY_BlobAccessI(txt, blobtype, ctxt, wanted, rtxt);
TEXT_TY_Untransmute(txt, p1, cp1);
TEXT_TY_Untransmute(rtxt, p2, cp2);
return r;
];
-) after "Output.i6t".
Volume https://intfiction.org/t/53835/3
Include (- Replace HeapMakeSpace; -) before "Flex.i6t".
Include (-
[ HeapMakeSpace size multiple newblocksize newblock B n hsize; ! MODIFIED
for (::) {
if (multiple) {
hsize = BLK_DATA_MULTI_OFFSET; ! ADDED
if (HeapNetFreeSpace(multiple) >= size) rtrue;
} else {
hsize = BLK_DATA_OFFSET; ! ADDED
if (HeapLargestFreeBlock(0) >= size) rtrue;
}
newblocksize = 1;
for (n=0: (n<SMALLEST_BLK_WORTH_ALLOCATING) || (newblocksize<(size+hsize)): n++) ! MODIFIED
newblocksize = newblocksize*2;
! while (newblocksize < size+hsize) { n++; newblocksize = newblocksize*2; } ! DELETED
newblock = VM_AllocateMemory(newblocksize);
if (newblock == 0) rfalse;
newblock->BLK_HEADER_N = n;
newblock-->BLK_HEADER_KOV = 0;
newblock-->BLK_HEADER_RCOUNT = 0;
newblock->BLK_HEADER_FLAGS = BLK_FLAG_MULTIPLE;
newblock-->BLK_NEXT = NULL;
newblock-->BLK_PREV = NULL;
for (B = Flex_Heap-->BLK_NEXT:B ~= NULL:B = B-->BLK_NEXT)
if (B-->BLK_NEXT == NULL) {
B-->BLK_NEXT = newblock;
newblock-->BLK_PREV = B;
jump Linked;
}
Flex_Heap-->BLK_NEXT = newblock;
newblock-->BLK_PREV = Flex_Heap;
.Linked; ;
#ifdef BLKVALUE_TRACE;
print "Increasing heap to free space map: "; FlexDebugDecomposition(Flex_Heap, 0);
#endif;
}
rtrue;
];
-) after "Make Space" in "Flex.i6t".
Volume https://intfiction.org/t/53835/4
Include (-
Array Flex_Heap -> MEMORY_HEAP_SIZE + BLK_DATA_MULTI_OFFSET; ! allow room for head-free-block
-) instead of "The Heap" in "Flex.i6t".
Include (-
[ HeapInitialise n bsize blk2;
blk2 = Flex_Heap + BLK_DATA_MULTI_OFFSET; ! MODIFIED
Flex_Heap->BLK_HEADER_N = 4;
Flex_Heap-->BLK_HEADER_KOV = 0;
Flex_Heap-->BLK_HEADER_RCOUNT = MAX_POSITIVE_NUMBER;
Flex_Heap->BLK_HEADER_FLAGS = BLK_FLAG_MULTIPLE;
Flex_Heap-->BLK_NEXT = blk2;
Flex_Heap-->BLK_PREV = NULL;
for (bsize=1: bsize < MEMORY_HEAP_SIZE: bsize=bsize*2) n++;
blk2->BLK_HEADER_N = n;
blk2-->BLK_HEADER_KOV = 0;
blk2-->BLK_HEADER_RCOUNT = 0;
blk2->BLK_HEADER_FLAGS = BLK_FLAG_MULTIPLE;
blk2-->BLK_NEXT = NULL;
blk2-->BLK_PREV = Flex_Heap;
];
-) instead of "Initialisation" in "Flex.i6t".
6M62 Patches ends here.
---- Documentation ----
Changelog
v. 2/220105: Add Heap Size fixes by Otis the Dog per https://intfiction.org/t/53835
v. 2/210913: Add TEXT_TY_BlobAccess fix by Peter Bates per intfiction.org/t/50840