The R Project SVN R

Rev

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

Rev 60153 Rev 60407
Line 18... Line 18...
18
 
18
 
19
local({
19
local({
20
    makeLazyLoadDB <- function(from, filebase, compress = TRUE, ascii = FALSE,
20
    makeLazyLoadDB <- function(from, filebase, compress = TRUE, ascii = FALSE,
21
                               variables) {
21
                               variables) {
22
 
22
 
23
        envlist <- function(e) {
23
        envlist <- function(e)
24
            names <- ls(e, all=TRUE)
-
 
25
            list <- .Call("R_getVarsFromFrame", names, e, FALSE, PACKAGE="base")
24
            .Internal(getVarsFromFrame(ls(e, all = TRUE), e, FALSE))
26
            names(list) <- names
-
 
27
            list
-
 
28
        }
-
 
29
 
25
 
30
        envtable <- function() {
26
        envtable <- function() {
31
            idx <- 0
27
            idx <- 0
32
            envs <- NULL
28
            envs <- NULL
33
            enames <- character(0)
29
            enames <- character(0)
Line 48... Line 44...
48
            }
44
            }
49
            list(insert = insert, getenv = getenv, getname = getname)
45
            list(insert = insert, getenv = getenv, getname = getname)
50
        }
46
        }
51
 
47
 
52
        lazyLoadDBinsertValue <- function(value, file, ascii, compress, hook)
48
        lazyLoadDBinsertValue <- function(value, file, ascii, compress, hook)
53
            .Call("R_lazyLoadDBinsertValue", value, file, ascii, compress, hook,
49
            .Internal(lazyLoadDBinsertValue(value, file, ascii, compress, hook))
54
                  PACKAGE = "base")
-
 
55
 
50
 
56
        lazyLoadDBinsertListElement <- function(x, i, file, ascii, compress, hook)
51
        lazyLoadDBinsertListElement <- function(x, i, file, ascii, compress, hook)
57
            .Call("R_lazyLoadDBinsertValue", x[[i]], file, ascii, compress, hook,
52
            .Internal(lazyLoadDBinsertValue(x[[i]], file, ascii, compress, hook))
58
                  PACKAGE = "base")
-
 
59
 
53
 
60
        lazyLoadDBinsertVariable <- function(n, e, file, ascii, compress, hook) {
54
        lazyLoadDBinsertVariable <- function(n, e, file, ascii, compress, hook) {
61
            x <- .Call("R_getVarsFromFrame", n, e, FALSE, PACKAGE="base")
55
            x <- .Internal(getVarsFromFrame(n, e, FALSE))
62
           .Call("R_lazyLoadDBinsertValue", x[[1]], file, ascii, compress, hook,
56
            .Internal(lazyLoadDBinsertValue(x[[1L]], file, ascii, compress, hook))
63
                  PACKAGE = "base")
-
 
64
        }
57
        }
65
 
58
 
66
        mapfile <- paste(filebase, "rdx", sep = ".")
59
        mapfile <- paste(filebase, "rdx", sep = ".")
67
        datafile <- paste(filebase, "rdb", sep = ".")
60
        datafile <- paste(filebase, "rdb", sep = ".")
68
        close(file(datafile, "w")) # truncate to zero
61
        close(file(datafile, "w")) # truncate to zero
Line 131... Line 124...
131
 
124
 
132
    basevars <- ls(baseenv(), all.names=TRUE)
125
    basevars <- ls(baseenv(), all.names=TRUE)
133
    prims <- basevars[sapply(basevars, function(n) is.primitive(get(n, baseenv())))]
126
    prims <- basevars[sapply(basevars, function(n) is.primitive(get(n, baseenv())))]
134
    basevars <- basevars[! basevars %in% c(omit, prims)]
127
    basevars <- basevars[! basevars %in% c(omit, prims)]
135
 
128
 
136
# **** need prims too since some prims have several names (is.name, is.symbol)
-
 
137
#    basevars <- ls(baseenv(), all=TRUE)
-
 
138
#    notPrim <- sapply(basevars, function(n)
-
 
139
#        ! typeof(get(n, baseenv())) %in% c("builtin","special"))
-
 
140
#    makeLazyLoadDB(baseenv(), baseFileBase, variables = basevars[notPrim])
-
 
141
 
-
 
142
    makeLazyLoadDB(baseenv(), baseFileBase, variables = basevars)
129
    makeLazyLoadDB(baseenv(), baseFileBase, variables = basevars)
143
#    q(save = "no", runLast = FALSE)
-
 
144
})
130
})