The R Project SVN R

Rev

Rev 87901 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 87901 Rev 88921
Line 819... Line 819...
819
 
819
 
820
    return result;
820
    return result;
821
}
821
}
822
 
822
 
823
/* Return the current environment. */
823
/* Return the current environment. */
-
 
824
/* The _current environment_ is taken to be the top closure call
-
 
825
   environment on the context stack, or .GlobalEnv if there is none.
-
 
826
   An alternative would be the environment in which a .Call or similar
-
 
827
   expression is evaluated. This is currently not recorded; doing so
-
 
828
   would incur some overhead that does not seem warranted.
-
 
829
 */
824
SEXP R_GetCurrentEnv(void) {
830
SEXP R_GetCurrentEnv(void) {
-
 
831
    RCNTXT *cptr = R_GlobalContext;
-
 
832
    while (cptr->nextcontext != NULL) {
-
 
833
	if ((cptr->callflag & CTXT_FUNCTION) != 0)
-
 
834
	    return cptr->cloenv;
-
 
835
	else cptr = cptr->nextcontext;
-
 
836
    }
825
    return R_GlobalContext->sysparent;
837
    return R_GlobalEnv;
826
}
838
}
827
 
839
 
828
 
840
 
829
/*
841
/*
830
  This is a simple interface for evaluating R expressions
842
  This is a simple interface for evaluating R expressions