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
|
<% listEnclosures <- function(){
empty <- environmentName(emptyenv())
e <- parent.env(parent.frame(1));
n <- environmentName(e);
i <- 1
while (n != empty){
if (n == '') n <- attributes(e)$name[1]
cat('ENV:',i,n,'------------------------------\n');
vars <- ls(envir=e)
if (length(vars) > 10)
cat('\t',vars[1:10],'....\n')
else
cat('\t',vars,'\n')
e <- parent.env(e)
n <- environmentName(e)
i <- i + 1
}
}
listFrames <- function(){
f <- sys.frames();
len <- length(f) - 1 ;
if (len < 1) return(invisible());
cat("in listFrames\n")
for ( i in len:1 ){
cat('FRAME:',len-i,'----------------\n')
vars <- ls(envir=f[[i]])
if (length(vars) > 10)
cat('\t',vars[1:10],'....\n')
else
cat('\t',vars,'\n')
}
} -%>
<HTML>
<BODY>
<H1>Call Stack</H1>
<pre>
<% listFrames() %>
</pre>
<H1>Enclosures</H1>
<pre>
<% listEnclosures() %>
</pre>
</BODY>
</HTML>
|