File: dynlex.r

package info (click to toggle)
rapache 1.2.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,248 kB
  • sloc: sh: 18,629; ansic: 10,417; perl: 5,675; javascript: 2,800; makefile: 307
file content (44 lines) | stat: -rw-r--r-- 1,067 bytes parent folder | download | duplicates (4)
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
dynlex <- function() {
	setContentType("text/html")
	 listEnclosures <- function(env=NULL){
		empty <- environmentName(emptyenv())
		if (!is.null(env)) e <- env		
		else e <- parent.frame();
		n <- environmentName(e);
		i <- 0
		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')
		}
	}
	cat("<HTML> <BODY> <H1>Call Stack</H1> <pre>")
	listFrames()
	cat("</pre> <H1>Enclosures</H1> <pre>")
	listEnclosures(sys.frame(sys.nframe()))
	cat("</pre> ")
	cat("returning",OK,"</BODY> </HTML>")
	OK
}