From 3e4b81316cc7a0d0446c20f2fd651bf7bcf30f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Fri, 16 Oct 1998 20:38:32 +0200 Subject: [PATCH] It's now possible to use indices() and values() on dirnodes and joinnodes. Rev: lib/master.pike.in:1.33 --- lib/master.pike.in | 67 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/lib/master.pike.in b/lib/master.pike.in index ed0052d462..37ca7ea037 100644 --- a/lib/master.pike.in +++ b/lib/master.pike.in @@ -1,4 +1,4 @@ -/* $Id: master.pike.in,v 1.32 1998/10/16 17:32:11 grubba Exp $ +/* $Id: master.pike.in,v 1.33 1998/10/16 18:38:32 grubba Exp $ * * Master-file for Pike. * @@ -469,6 +469,46 @@ class dirnode } return cache[index]=ind(index); } + + int _cache_full; + void fill_cache() + { + if (_cache_full) { + return; + } + + if (module) { + foreach(indices(module), string index) { + cache[index] = module[index]; + } + } + + foreach(get_dir(dirname), string fname) { + catch { + if (((< ".pike", ".pmod" >)[fname[sizeof(fname)-5..]]) && + !zero_type(`[](fname[..sizeof(fname)-6]))) { + continue; + } + }; + catch { + if ((fname[sizeof(fname)-3..] == ".so") && + !zero_type(`[](fname[..sizeof(fname)-4]))) { + continue; + } + }; + } + _cache_full = 1; + } + array(string) _indices() + { + fill_cache(); + return indices(cache); + } + array(mixed) _values() + { + fill_cache(); + return values(cache); + } }; class joinnode @@ -516,6 +556,31 @@ class joinnode } return ret; } + int _cache_full; + void fill_cache() + { + if (_cache_full) { + return; + } + foreach(joined_modules, object|mapping o) { + foreach(indices(o), string index) { + if (zero_type(cache[index])) { + `[](index); + } + } + } + _cache_full = 1; + } + array(string) _indices() + { + fill_cache(); + return indices(cache); + } + array(mixed) _values() + { + fill_cache(); + return values(cache); + } }; // Variables mustn't be static to allow for replace_master(). -- GitLab