Am I misunderstanding something about the I6 stack? Am I doing something stupid? I just can’t see it.
[code]
To clear the match list: (- ClearMatchList(); -)
To restore the match list: (- RestoreMatchList(); -)
To report (item - an object) (this is reporting):
say “Matched [the item].”;
Every turn:
clear the match list;
if the player’s command matches “[any thing]”:
iterate over the match list with reporting;
restore the match list;
To iterate over the match list with (func - phrase thing -> nothing ): (- LoopOverMatchList({func}); -)
Include (-
[ ClearMatchList;
SaveMatchGlobals();
print "ClearMatchList: saving parsetoken_nesting value of ", parsetoken_nesting, “.^”;
@push parsetoken_nesting;
parsetoken_nesting = 0;
];
[ RestoreMatchList;
print "RestoreMatchList: parsetoken_nesting is ", parsetoken_nesting, “.^”;
@pull parsetoken_nesting;
print "RestoreMatchList: parsetoken_nesting restored to ", parsetoken_nesting, “.^”;
RestoreMatchGlobals();
];
[ LoopOverMatchList func i;
for (i=0: i<number_matched: i++) {
indirect(func, match_list–>i);
}
];
[ SaveMatchGlobals i t;
@push match_from; @push token_filter; @push match_length;
@push number_of_classes; @push oops_from;
for (i=0: i<number_matched: i++) {
t = match_list–>i; @push t;
t = match_classes–>i; @push t;
t = match_scores–>i; @push t;
}
@push number_matched;
parsetoken_nesting++;
print "SaveMatchGlobals: parsetoken_nesting incremented to “, parsetoken_nesting, " - number_matched = “, number_matched,”.^”;
];
[ RestoreMatchGlobals i t;
parsetoken_nesting–;
print "RestoreMatchGlobals: parsetoken_nesting decremented to ", parsetoken_nesting, “.^”;
@pull number_matched;
for (i=0: i<number_matched: i++) {
@pull t; match_scores–>i = t;
@pull t; match_classes–>i = t;
@pull t; match_list–>i = t;
}
@pull oops_from; @pull number_of_classes;
@pull match_length; @pull token_filter; @pull match_from;
];
-)
Test is a room.
There is a blue ball in test. There is a green ball in test.
There is a container called a red bucket in test. There is a container called an orange bucket in test.
Test me with “get blue”[/code]
This code gives a stack underflow the first time it tries to pull something. Where did the stack go?