Displaying 17 results from an estimated 17 matches for "rcntxt".
Did you mean:
cntxt
2023 Feb 11
1
scan(..., skip=1e11): infinite loop; cannot interrupt
...l, SEXP op, SEXP args, SEXP rho)
{
SEXP ans, file, sep, what, stripwhite, dec, quotes, comstr;
- int c, flush, fill, blskip, multiline, escapes, skipNul;
+ int c = 0, flush, fill, blskip, multiline, escapes, skipNul;
R_xlen_t nmax, nlines, nskip;
const char *p, *encoding;
RCNTXT cntxt;
@@ -952,7 +952,7 @@
if(!data.con->canread)
error(_("cannot read from this connection"));
}
- for (R_xlen_t i = 0; i < nskip; i++) /* MBCS-safe */
+ for (R_xlen_t i = 0; i < nskip && c != R_EOF; i++) /* MBCS-safe */
while ((c = scanchar(FALSE, &...
2004 Oct 02
1
RCC compatibility patch
Would you consider the following patch to eval.c to allow compatibility
with RCC? (It's in the applyClosure function.)
@@ -432,6 +432,14 @@
SEXP f, a, tmp;
RCNTXT cntxt;
+#ifdef RCC
+ SEXP comp;
+ PROTECT(comp = getAttrib(op, install("RCC_CompiledSymbol")));
+ if (comp != R_NilValue) /* compiled version exists */
+ op = comp;
+ UNPROTECT(1);
+#endif /* RCC */
+
/* formals = list of formal parameters */
/* actuals = va...
2023 Mar 13
0
scan(..., skip=1e11): infinite loop; cannot interrupt
...{
>???????SEXP?ans,?file,?sep,?what,?stripwhite,?dec,?quotes,?comstr;
>?-????int?c,?flush,?fill,?blskip,?multiline,?escapes,?skipNul;
>?+????int?c?=?0,?flush,?fill,?blskip,?multiline,?escapes,?skipNul;
>???????R_xlen_t?nmax,?nlines,?nskip;
>???????const?char?*p,?*encoding;
>???????RCNTXT?cntxt;
>?@@?-952,7?+952,7?@@
>????????if(!data.con->canread)
>????error(_("cannot?read?from?this?connection"));
>????}
>?-?for?(R_xlen_t?i?=?0;?i?<?nskip;?i++)?/*?MBCS-safe?*/
>?+?for?(R_xlen_t?i?=?0;?i?<?nskip?&&?c?!=?R_EOF;?i++)?/*?MBCS-safe?*/
>???...
1998 Jan 03
1
R-beta: NextMethod(.Generic) bug
I'm a day-old R newbie (but a war-weary S veteran), with couple of
first-day questions:
In R 0.61, this code fails.
Ops.test <- function(e1,e2)
{
e1 <- NextMethod(.Generic)
e1
}
x <- 4
class(x) <- "test"
y <- x < 3
The error message is "Error in NextMethod(.Generic) : negative length vectors
are not allowed.".
I assume it is a bug.
2023 Feb 11
1
scan(..., skip=1e11): infinite loop; cannot interrupt
Hello, All:
I have a 4.54 GB file that I'm trying to read in chunks using
"scan(..., skip=__)". It works as expected for small values of "skip"
but goes into an infinite loop for "skip=1e11" and similar large values
of skip: I cannot even interrupt it; I must kill R. Below please find
sessionInfo() with a toy example.
My real problem is a large
2024 Apr 25
1
Big speedup in install.packages() by re-using connections
...aseObject((SEXP)sentinel);
+}
+static CURLM *get_mhnd(void)
+{
+ if (!mhnd_sentinel) {
+ SEXP sentinel = PROTECT(R_MakeExternalPtr(NULL, R_NilValue, R_NilValue));
+ R_PreserveObject(sentinel);
+ UNPROTECT(1);
+ // Avoid leaking the sentinel before setting the finalizer
+ RCNTXT cntxt;
+ begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_BaseEnv, R_BaseEnv,
+ R_NilValue, R_NilValue);
+ cntxt.cend = &rollback_mhnd_sentinel;
+ cntxt.cenddata = sentinel;
+ R_RegisterCFinalizerEx(sentinel, cleanup_mhnd, TRUE);
+ // Succeeded, no n...
2009 Mar 03
1
profiler and loops
...lay with CTXT_LOOP (this is again in
eval.c within the do_for function)
begincontext(&cntxt, CTXT_LOOP, R_NilValue, rho, R_BaseEnv, R_NilValue,
R_NilValue);
which as the name implies, begins the context of the for loop. The
begincontext function looks like this :
void begincontext(RCNTXT * cptr, int flags,
SEXP syscall, SEXP env, SEXP sysp,
SEXP promargs, SEXP callfun)
{
cptr->nextcontext = R_GlobalContext;
cptr->cstacktop = R_PPStackTop;
cptr->evaldepth = R_EvalDepth;
cptr->callflag = flags;
cptr->call = syscall;
cptr->cloenv =...
2016 Jun 04
1
RProfmem output format
...:360 :360 :1064 :2040 :"raw"
The question is why this is not reported as:
192 :
360 :
360 :
1064 :
2040 :"raw"
This was/is because C function R_OutputStackTrace() - part of
src/main/memory.c - looks like:
static void R_OutputStackTrace(FILE *file)
{
int newline = 0;
RCNTXT *cptr;
for (cptr = R_GlobalContext; cptr; cptr = cptr->nextcontext) {
if ((cptr->callflag & (CTXT_FUNCTION | CTXT_BUILTIN))
&& TYPEOF(cptr->call) == LANGSXP) {
SEXP fun = CAR(cptr->call);
if (!newline) newline = 1;
fpr...
bug/suggestion: debugger should respect option "deparse.max.lines" when printing the call (PR#13647)
2009 Apr 09
0
bug/suggestion: debugger should respect option "deparse.max.lines" when printing the call (PR#13647)
.../src/main/eval.c R-2.8.1-patched/src/main/eval.c
*** R-2.8.1/src/main/eval.c 2008-10-05 18:05:02.000000000 -0400
--- R-2.8.1-patched/src/main/eval.c 2009-04-09 09:45:03.000000000 -0400
***************
*** 526,531 ****
--- 526,532 ----
volatile SEXP newrho;
SEXP f, a, tmp;
RCNTXT cntxt;
+ int itmp;
/* formals = list of formal parameters */
/* actuals = values to be bound to formals */
***************
*** 609,615 ****
--- 610,621 ----
SET_DEBUG(newrho, DEBUG(op));
if (DEBUG(op)) {
Rprintf("debugging in: ");
+
+ itmp = a...
2019 Jul 13
2
Mitigating Stalls Caused by Call Deparse on Error
...?? setVar(install(".Traceback"), s, R_GlobalEnv); */
@@ -1440,9 +1440,11 @@
??? ?PrintWarnings();
???? }
?}
-
+/*
+ * Return the traceback without deparsing the calls
+ */
?attribute_hidden
-SEXP R_GetTraceback(int skip)
+SEXP R_GetTracebackParsed(int skip)
?{
???? int nback = 0, ns;
???? RCNTXT *c;
@@ -1467,7 +1469,9 @@
??? ???? if (skip > 0)
??? ??? ?skip--;
??? ???? else {
-?? ??? ?SETCAR(t, deparse1m(c->call, 0, DEFAULTDEPARSE));
+??????????????? // Extra paranoid PROTECTS
+?? ??? ?SETCAR(t, PROTECT(duplicate(c->call)));
+??????????????? UNPROTECT(1);
??? ??? ?if (c->srcref...
2024 Apr 25
1
Big speedup in install.packages() by re-using connections
I'd like to raise this again now that 4.4 is out.
Below is a more complete patch which includes a function to properly
cleanup libcurl when R quits. Implementing this is a little tricky
because libcurl is a separate "module" in R, perhaps there is a better
way, but this works:
view: https://github.com/r-devel/r-svn/pull/166/files
patch:
2019 Jul 14
2
[External] Mitigating Stalls Caused by Call Deparse on Error
...-1440,9 +1440,11 @@
> ??? ?PrintWarnings();
> ???? }
> ?}
> -
> +/*
> + * Return the traceback without deparsing the calls
> + */
> ?attribute_hidden
> -SEXP R_GetTraceback(int skip)
> +SEXP R_GetTracebackParsed(int skip)
> ?{
> ???? int nback = 0, ns;
> ???? RCNTXT *c;
> @@ -1467,7 +1469,9 @@
> ??? ???? if (skip > 0)
> ??? ??? ?skip--;
> ??? ???? else {
> -?? ??? ?SETCAR(t, deparse1m(c->call, 0, DEFAULTDEPARSE));
> +??????????????? // Extra paranoid PROTECTS
> +?? ??? ?SETCAR(t, PROTECT(duplicate(c->call)));
> +???????????????...
2011 Aug 14
0
Improved version of Rprofmem
...*********************/
-#ifndef R_MEMORY_PROFILING
-
-SEXP attribute_hidden do_Rprofmem(SEXP call, SEXP op, SEXP args, SEXP rho)
+static void R_OutputStackTrace (void)
{
- error(_("memory profiling is not available on this system"));
- return R_NilValue; /* not reached */
-}
+ RCNTXT *cptr;
+ int newline;
-#else
-static int R_IsMemReporting; /* Rboolean more appropriate? */
-static FILE *R_MemReportingOutfile;
-static R_size_t R_MemReportingThreshold;
+ newline = R_MemReportingToTerminal | R_MemDetailsReporting;
-static void R_OutputStackTrace(FILE *file)
-{
- int...
2024 Sep 02
1
Big speedup in install.packages() by re-using connections
...ic CURLM *get_mhnd(void)
> +{
> + if (!mhnd_sentinel) {
> + SEXP sentinel = PROTECT(R_MakeExternalPtr(NULL, R_NilValue, R_NilValue));
> + R_PreserveObject(sentinel);
> + UNPROTECT(1);
> + // Avoid leaking the sentinel before setting the finalizer
> + RCNTXT cntxt;
> + begincontext(&cntxt, CTXT_CCODE, R_NilValue, R_BaseEnv, R_BaseEnv,
> + R_NilValue, R_NilValue);
> + cntxt.cend = &rollback_mhnd_sentinel;
> + cntxt.cenddata = sentinel;
> + R_RegisterCFinalizerEx(sentinel, cleanup_mhnd, TRUE);...
2019 Jul 16
1
[External] Mitigating Stalls Caused by Call Deparse on Error
...-
>>> +/*
>>> + * Return the traceback without deparsing the calls
>>> + */
>>> attribute_hidden
>>> -SEXP R_GetTraceback(int skip)
>>> +SEXP R_GetTracebackParsed(int skip)
>>> {
>>> int nback = 0, ns;
>>> RCNTXT *c;
>>> @@ -1467,7 +1469,9 @@
>>> if (skip > 0)
>>> skip--;
>>> else {
>>> - SETCAR(t, deparse1m(c->call, 0, DEFAULTDEPARSE));
>>> + // Extra paranoid PROTECTS
>>> + SETCAR(t...
2019 Jul 14
0
[External] Mitigating Stalls Caused by Call Deparse on Error
...-1440,9 +1440,11 @@
> ??? ?PrintWarnings();
> ???? }
> ?}
> -
> +/*
> + * Return the traceback without deparsing the calls
> + */
> ?attribute_hidden
> -SEXP R_GetTraceback(int skip)
> +SEXP R_GetTracebackParsed(int skip)
> ?{
> ???? int nback = 0, ns;
> ???? RCNTXT *c;
> @@ -1467,7 +1469,9 @@
> ??? ???? if (skip > 0)
> ??? ??? ?skip--;
> ??? ???? else {
> -?? ??? ?SETCAR(t, deparse1m(c->call, 0, DEFAULTDEPARSE));
> +??????????????? // Extra paranoid PROTECTS
> +?? ??? ?SETCAR(t, PROTECT(duplicate(c->call)));
> +???????????????...
2019 Jul 15
0
[External] Mitigating Stalls Caused by Call Deparse on Error
...>> ???? }
>> ?}
>> -
>> +/*
>> + * Return the traceback without deparsing the calls
>> + */
>> ?attribute_hidden
>> -SEXP R_GetTraceback(int skip)
>> +SEXP R_GetTracebackParsed(int skip)
>> ?{
>> ???? int nback = 0, ns;
>> ???? RCNTXT *c;
>> @@ -1467,7 +1469,9 @@
>> ??? ???? if (skip > 0)
>> ??? ??? ?skip--;
>> ??? ???? else {
>> -?? ??? ?SETCAR(t, deparse1m(c->call, 0, DEFAULTDEPARSE));
>> +??????????????? // Extra paranoid PROTECTS
>> +?? ??? ?SETCAR(t, PROTECT(duplicate(c->ca...