The R Project SVN R

Rev

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

Rev 48600 Rev 48623
Line 48... Line 48...
48
 *			at exit from the closure (normal or abnormal).
48
 *			at exit from the closure (normal or abnormal).
49
 *	cend		a pointer to function which executes if there is
49
 *	cend		a pointer to function which executes if there is
50
 *			non-local return (i.e. an error)
50
 *			non-local return (i.e. an error)
51
 *	cenddata	a void pointer to data for cend to use
51
 *	cenddata	a void pointer to data for cend to use
52
 *	vmax		the current setting of the R_alloc stack
52
 *	vmax		the current setting of the R_alloc stack
-
 
53
 *	srcref		the srcref at the time of the call
53
 *
54
 *
54
 *  Context types can be one of:
55
 *  Context types can be one of:
55
 *
56
 *
56
 *	CTXT_TOPLEVEL	The toplevel context
57
 *	CTXT_TOPLEVEL	The toplevel context
57
 *	CTXT_BREAK	target for "break"
58
 *	CTXT_BREAK	target for "break"
Line 180... Line 181...
180
    R_BCNodeStackTop = cptr->nodestack;
181
    R_BCNodeStackTop = cptr->nodestack;
181
# ifdef BC_INT_STACK
182
# ifdef BC_INT_STACK
182
    R_BCIntStackTop = cptr->intstack;
183
    R_BCIntStackTop = cptr->intstack;
183
# endif
184
# endif
184
#endif
185
#endif
-
 
186
    R_Srcref = cptr->srcref;
185
}
187
}
186
 
188
 
187
 
189
 
188
/* jumpfun - jump to the named context */
190
/* jumpfun - jump to the named context */
189
 
191
 
Line 240... Line 242...
240
    cptr->nodestack = R_BCNodeStackTop;
242
    cptr->nodestack = R_BCNodeStackTop;
241
# ifdef BC_INT_STACK
243
# ifdef BC_INT_STACK
242
    cptr->intstack = R_BCIntStackTop;
244
    cptr->intstack = R_BCIntStackTop;
243
# endif
245
# endif
244
#endif
246
#endif
-
 
247
    cptr->srcref = R_Srcref;
245
    R_GlobalContext = cptr;
248
    R_GlobalContext = cptr;
246
}
249
}
247
 
250
 
248
 
251
 
249
/* endcontext - end an execution context */
252
/* endcontext - end an execution context */
Line 392... Line 395...
392
 
395
 
393
SEXP attribute_hidden R_syscall(int n, RCNTXT *cptr)
396
SEXP attribute_hidden R_syscall(int n, RCNTXT *cptr)
394
{
397
{
395
    /* negative n counts back from the current frame */
398
    /* negative n counts back from the current frame */
396
    /* positive n counts up from the globalEnv */
399
    /* positive n counts up from the globalEnv */
-
 
400
    SEXP result;
-
 
401
    
397
    if (n > 0)
402
    if (n > 0)
398
	n = framedepth(cptr) - n;
403
	n = framedepth(cptr) - n;
399
    else
404
    else
400
	n = - n;
405
	n = - n;
401
    if(n < 0)
406
    if(n < 0)
402
	errorcall(R_GlobalContext->call,
407
	errorcall(R_GlobalContext->call,
403
		  _("not that many frames on the stack"));
408
		  _("not that many frames on the stack"));
404
    while (cptr->nextcontext != NULL) {
409
    while (cptr->nextcontext != NULL) {
405
	if (cptr->callflag & CTXT_FUNCTION ) {
410
	if (cptr->callflag & CTXT_FUNCTION ) {
406
	    if (n == 0)
411
	    if (n == 0) {
407
		return (duplicate(cptr->call));
412
	    	PROTECT(result = duplicate(cptr->call));
-
 
413
	    	if (cptr->srcref && !isNull(cptr->srcref))
-
 
414
	    	    setAttrib(result, R_SrcrefSymbol, duplicate(cptr->srcref));
-
 
415
	    	UNPROTECT(1);
-
 
416
	    	return result;
408
	    else
417
	    } else
409
		n--;
418
		n--;
410
	}
419
	}
411
	cptr = cptr->nextcontext;
420
	cptr = cptr->nextcontext;
412
    }
421
    }
413
    if (n == 0 && cptr->nextcontext == NULL)
422
    if (n == 0 && cptr->nextcontext == NULL) {
414
	return (duplicate(cptr->call));
423
	PROTECT(result = duplicate(cptr->call));
-
 
424
	if (!isNull(cptr->srcref))
-
 
425
	    setAttrib(result, R_SrcrefSymbol, duplicate(cptr->srcref));
-
 
426
	UNPROTECT(1);
-
 
427
	return result;
-
 
428
    }
415
    errorcall(R_GlobalContext->call, _("not that many frames on the stack"));
429
    errorcall(R_GlobalContext->call, _("not that many frames on the stack"));
416
    return R_NilValue;	/* just for -Wall */
430
    return R_NilValue;	/* just for -Wall */
417
}
431
}
418
 
432
 
419
SEXP attribute_hidden R_sysfunction(int n, RCNTXT *cptr)
433
SEXP attribute_hidden R_sysfunction(int n, RCNTXT *cptr)