The R Project SVN R

Rev

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

Rev 33359 Rev 33397
Line 63... Line 63...
63
                }
63
                }
64
                name
64
                name
65
            }
65
            }
66
        }
66
        }
67
 
67
 
68
        if (is.null(from) || is.environment(from)) {
68
        if (is.environment(from)) {
69
            if (! missing(variables))
69
            if (! missing(variables))
70
                vars <- variables
70
                vars <- variables
71
            else vars <- ls(from, all = TRUE)
71
            else vars <- ls(from, all = TRUE)
72
        }
72
        }
73
        else if (is.list(from)) {
73
        else if (is.list(from)) {
74
            vars <- names(from)
74
            vars <- names(from)
75
            if (length(vars) != length(from) || any(nchar(vars) == 0))
75
            if (length(vars) != length(from) || any(nchar(vars) == 0))
76
                stop("source list must have names for all elements")
76
                stop("source list must have names for all elements")
77
        }
77
        }
-
 
78
        else {
-
 
79
            print(sys.calls())   # DJM debugging
78
        else stop("source must be an environment or a list");
80
            stop("source must be an environment or a list")
-
 
81
        }
79
 
82
 
80
        for (i in seq(along = vars)) {
83
        for (i in seq(along = vars)) {
81
            if (is.null(from) || is.environment(from))
84
            if (is.environment(from))
82
                key <- lazyLoadDBinsertVariable(vars[i], from, datafile,
85
                key <- lazyLoadDBinsertVariable(vars[i], from, datafile,
83
                                                ascii, compress,  envhook)
86
                                                ascii, compress,  envhook)
84
            else key <- lazyLoadDBinsertListElement(from, i, datafile, ascii,
87
            else key <- lazyLoadDBinsertListElement(from, i, datafile, ascii,
85
                                                    compress, envhook)
88
                                                    compress, envhook)
86
            assign(vars[i], key, env = varenv)
89
            assign(vars[i], key, env = varenv)
Line 106... Line 109...
106
    baseFileBase <- file.path(.Library,"base","R","base")
109
    baseFileBase <- file.path(.Library,"base","R","base")
107
 
110
 
108
    if (file.info(baseFileBase)["size"] < 20000) # crude heuristic
111
    if (file.info(baseFileBase)["size"] < 20000) # crude heuristic
109
        stop("may already be using lazy loading on base");
112
        stop("may already be using lazy loading on base");
110
 
113
 
111
    basevars <- ls(NULL,all=TRUE)
114
    basevars <- ls(baseenv(), all=TRUE)
112
    basevars <- basevars[! basevars %in% omit]
115
    basevars <- basevars[! basevars %in% omit]
113
 
116
 
114
# **** need prims too since some prims have several names (is.name, is.symbol)
117
# **** need prims too since some prims have several names (is.name, is.symbol)
115
#    basevars <- ls(NULL,all=TRUE)
118
#    basevars <- ls(baseenv(), all=TRUE)
116
#    notPrim <- sapply(basevars, function(n)
119
#    notPrim <- sapply(basevars, function(n)
117
#        ! typeof(get(n, NULL)) %in% c("builtin","special"))
120
#        ! typeof(get(n, baseenv())) %in% c("builtin","special"))
118
#    makeLazyLoadDB(NULL, baseFileBase, variables = basevars[notPrim])
121
#    makeLazyLoadDB(baseenv(), baseFileBase, variables = basevars[notPrim])
119
 
122
 
120
    makeLazyLoadDB(NULL, baseFileBase, variables = basevars)
123
    makeLazyLoadDB(baseenv(), baseFileBase, variables = basevars)
121
#    q(save = "no", runLast = FALSE)
124
#    q(save = "no", runLast = FALSE)
122
})
125
})