The R Project SVN R

Rev

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

Rev 73185 Rev 73311
Line 14... Line 14...
14
 
14
 
15
  If no expression is provided, i.e., the call is \code{on.exit()}, then
15
  If no expression is provided, i.e., the call is \code{on.exit()}, then
16
  the current \code{on.exit} code is removed.
16
  the current \code{on.exit} code is removed.
17
}
17
}
18
\usage{
18
\usage{
19
on.exit(expr = NULL, add = FALSE)
19
on.exit(expr = NULL, add = FALSE, after = TRUE)
20
}
20
}
21
\arguments{
21
\arguments{
22
  \item{expr}{an expression to be executed.}
22
  \item{expr}{an expression to be executed.}
23
  \item{add}{if TRUE, add \code{expr} to be executed after any previously
23
  \item{add}{if TRUE, add \code{expr} to be executed after any previously
24
    set expressions; otherwise (the default) \code{expr} will overwrite
24
    set expressions (or before if \code{after} is FALSE); otherwise (the
25
    any previously set expressions.}
25
    default) \code{expr} will overwrite any previously set expressions.}
-
 
26
  \item{after}{if \code{add} is TRUE and \code{after} is FALSE, then
-
 
27
    \code{expr} will be added on top of the expressions that were already
-
 
28
    registered. The resulting last in first out order is useful for freeing
-
 
29
    or closing resources in reverse order.}
26
}
30
}
27
\details{
31
\details{
28
  The \code{expr} argument passed to \code{on.exit} is recorded without
32
  The \code{expr} argument passed to \code{on.exit} is recorded without
29
  evaluation.  If it is not subsequently removed/replaced by another
33
  evaluation.  If it is not subsequently removed/replaced by another
30
  \code{on.exit} call in the same function, it is evaluated in the
34
  \code{on.exit} call in the same function, it is evaluated in the