The R Project SVN R

Rev

Rev 32492 | Rev 40176 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32492 Rev 33596
Line 19... Line 19...
19
    along <- function(x) { n <- length(x); if (n) 1 : n else NULL }
19
    along <- function(x) { n <- length(x); if (n) 1 : n else NULL }
20
    existsInFrame <- function (x, env) .Internal(exists(x, env, "any", FALSE))
20
    existsInFrame <- function (x, env) .Internal(exists(x, env, "any", FALSE))
21
    getFromFrame <- function (x, env) .Internal(get(x, env, "any", FALSE))
21
    getFromFrame <- function (x, env) .Internal(get(x, env, "any", FALSE))
22
    set <- function (x, value, env) .Internal(assign(x, value, env, FALSE))
22
    set <- function (x, value, env) .Internal(assign(x, value, env, FALSE))
23
    environment <- function () .Internal(environment(NULL))
23
    environment <- function () .Internal(environment(NULL))
24
    mkpromise <- function(expr, env) .Internal(delay(expr, env))
-
 
25
    mkenv <- function() .Internal(new.env(TRUE, NULL))
24
    mkenv <- function() .Internal(new.env(TRUE, NULL))
26
    names <- function(x) .Internal(names(x))
25
    names <- function(x) .Internal(names(x))
27
    lazyLoadDBfetch <- function(key, file, compressed, hook)
26
    lazyLoadDBfetch <- function(key, file, compressed, hook)
28
        .Call("R_lazyLoadDBfetch", key, file, compressed, hook, PACKAGE="base")
27
        .Call("R_lazyLoadDBfetch", key, file, compressed, hook, PACKAGE="base")
29
 
28
 
Line 54... Line 53...
54
               set(vars[i], data$bindings[[i]], e)
53
               set(vars[i], data$bindings[[i]], e)
55
           e
54
           e
56
        }
55
        }
57
    }
56
    }
58
    expr <- quote(lazyLoadDBfetch(key, datafile, compressed, envhook))
57
    expr <- quote(lazyLoadDBfetch(key, datafile, compressed, envhook))
59
    wrap<-function(key) {
58
    setWrapped <- function(x, value, env) {
60
        key <- key # force evaluation
59
    	key <- value
61
        mkpromise(expr, environment())
60
    	.Internal(delayedAssign(x, expr, environment(), env))
62
    }
61
    }	
63
    if (! missing(filter)) {
62
    if (! missing(filter)) {
64
        for (i in along(vars))
63
        for (i in along(vars))
65
            if (filter(vars[i]))
64
            if (filter(vars[i]))
66
                set(vars[i], wrap(map$variables[[i]]), envir)
65
		setWrapped(vars[i], map$variables[[i]], envir)
67
    }
66
    }
68
    else {
67
    else {
69
        for (i in along(vars))
68
        for (i in along(vars))
70
            set(vars[i], wrap(map$variables[[i]]), envir)
69
	    setWrapped(vars[i], map$variables[[i]], envir)
71
    }
70
    }
72
 
71
 
73
    # reduce memory use **** try some more trimming
72
    # reduce memory use **** try some more trimming
74
    map <- NULL
73
    map <- NULL
75
    vars <- NULL
74
    vars <- NULL