parent $foundation
object $command_cache
var $root dbref 'command_cache
var $root child_index 1
var $root fertile 1
var $root manager $command_cache
var $root owned [$command_cache]
var $root owners [$]
var $root writable []
var $root readable ['parameters, 'methods, 'code]
var $root inited 1
var $command_cache cache 0
var $command_cache command_cache 0
var $command_cache shortcut_cache 0
method command_cache
(> .perms(sender(), 'this) <);
return command_cache;
.
method rehash_command_cache
var obj, list, tmp, c, part;
(> .perms(sender(), 'this) <);
.purge_cache();
if (.has_ancestor($location)) {
for obj in (.contents())
.add_to_command_environment(obj);
}
for obj in (.ancestors()) {
// do not define anything on $has_commands
if (obj == $has_commands)
break;
tmp = (| obj.commands() |);
if (tmp) {
for c in (tmp) {
for part in ((explode(c[1])[1]).explode_template_word())
.add_to_command_cache(part, obj);
}
}
// verbs will be phased out eventually
tmp = (| obj.verbs() |);
if (tmp) {
for c in (tmp) {
for part in ((explode(c[1])[1]).explode_template_word())
.add_to_command_cache(part, obj);
}
}
tmp = (| obj.shortcuts() |);
if (tmp) {
for c in (tmp)
(| .add_to_shortcut_cache(c, obj) |);
}
}
.
method purge_command_cache
(> .perms(sender(), 'this) <);
cache = #[];
.
method purge_cache
(> .perms(sender(), 'this) <);
command_cache = #[];
shortcut_cache = #[];
.
method add_to_command_cache
arg command, definer;
(> .perms(sender(), 'this) <);
command_cache = command_cache.add_elem(command, definer);
.