search for: alloclist

Displaying 20 results from an estimated 23 matches for "alloclist".

2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
...-65,6 +65,7 @@ * "timeout" ./connections.c * "check.bounds" + * "check.condition" * "error" * "error.messages" * "show.error.messages" @@ -248,9 +249,9 @@ char *p; #ifdef HAVE_RL_COMPLETION_MATCHES + PROTECT(v = val = allocList(22)); +#else PROTECT(v = val = allocList(21)); -#else - PROTECT(v = val = allocList(20)); #endif SET_TAG(v, install("prompt")); @@ -289,6 +290,10 @@ SETCAR(v, ScalarLogical(0)); /* no checking */ v = CDR(v); + SET_TAG(v, install("check.condition"));...
2017 Mar 03
0
Control statements with condition with greater than one should give error (not just warning) [PATCH]
..."check.bounds" > + * "check.condition" > * "error" > * "error.messages" > * "show.error.messages" > @@ -248,9 +249,9 @@ > char *p; > #ifdef HAVE_RL_COMPLETION_MATCHES > + PROTECT(v = val = allocList(22)); > +#else > PROTECT(v = val = allocList(21)); > -#else > - PROTECT(v = val = allocList(20)); > #endif > SET_TAG(v, install("prompt")); > @@ -289,6 +290,10 @@ > SETCAR(v, ScalarLogical(0)); /* no checking */ > v = CDR(...
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
..."check.condition" > > * "error" > > * "error.messages" > > * "show.error.messages" > > @@ -248,9 +249,9 @@ > > char *p; > > > #ifdef HAVE_RL_COMPLETION_MATCHES > > + PROTECT(v = val = allocList(22)); > > +#else > > PROTECT(v = val = allocList(21)); > > -#else > > - PROTECT(v = val = allocList(20)); > > #endif > > > SET_TAG(v, install("prompt")); > > @@ -289,6 +290,10 @@ > > SETCAR(v, ScalarLogi...
2024 Jul 06
1
API for converting LANGSXP to LISTSXP?
...t; and LISTSXP by using SET_TYPEOF. However, this is soon going to be > disallowed in packages. Would you mind providing an example where a package needs to take an existing LISTSXP and convert it to a LANGSXP (or vice versa)? I think that Luke Tierney intended to replace the uses of SET_TYPEOF(allocList(...), LANGSXP) with allocLang(...). At least it's easy to manually convert between the two by replacing the head of the list using LCONS(CAR(list), CDR(list)) or CONS(CAR(lang), CDR(lang)): in a call, the rest of the arguments are ordinary LISTSXPs. -- Best regards, Ivan
2011 Jan 26
2
Dealing with R list objects in C/C++
...r tests/Embedding, but can't figure out the correct way. Below is my code snippet: #include <Rinternals.h> // Rf_initEmbeddedR and other setups already performed SEXP arg, ret; // this actually creates a pairlist. I can't find any API that creates a list PROTECT(arg = allocList(3)); // I want the first element to be type integer, second double, and third a vector. INTEGER(arg)[0] = 1; // <- runtime exception: "INTEGER() can only be applied to a 'integer', not a 'pairlist' REAL(arg)[1] = 2.5; // control never reach...
1997 Dec 12
3
R-beta: R-0.60.1 on hpux10.2
Hello R-helpers, I tried to do "make test" , and it is failing: data() Error: stack overflow ?data Error: Stack overflow data(rivers) Error: incorrect tag type R also initially it balked at: apropos("\\\\[") So, I skipped it :-) This stuff is working on R-0.50-a4 that I have. Anyone built R-0.60.1 on hpux?? Best regards, Osman
1999 Nov 23
1
Internal data types
...kes more sense to me to loop in C and create the entire data structure there, but I'm not quite sure how to approach this. I think that what I want to do is actually create the appropriate SEXPR for a list, with each element being a vector (numeric or string). This would presumably be through allocList() and allocVector(), but how then do I access individual elements of an SEXPR (list or vector) from C? (i.e., are there access functions that I'm missing, or do I have to wade through the structure definition of SEXPR?) Also, if I create the whole object in C, should I use dup=TRUE or FALSE in...
2008 Apr 24
1
Calling R functions with multiple arguments from C
...st under the discussion Calling R function from within C code that I've modified. I've read that discussion, but still got stuck. Could anybody point me in the right direction? SEXP foo(SEXP fn, SEXP elmt1, SEXP elmt2, SEXP rho) { SEXP R_fcall, args, ans,s; PROTECT( args = s = allocList(2)); PROTECT( R_fcall = lang2(fn, R_NilValue) ); SETCAR(s,elmt1); SET_TAG(s,install("x")); s = CDR(s); SETCAR(s,elmt2); SET_TAG(s,install("y")); SETCADR( R_fcall, args); PROTECT( ans = eval(R_fcall, rho) ); UNPROTECT(3); return ans;...
2024 Jun 06
4
clarifying and adjusting the C API for R
...API()) name loc apitype 1 Rf_AdobeSymbol2utf8 R_ext/GraphicsDevice.h eapi 2 alloc3DArray WRE api 3 allocArray WRE api 4 allocLang WRE api 5 allocList WRE api 6 allocMatrix WRE api The 'apitype' field has three possible levels | api | stable (ideally) API | | eapi | experimental API | | emb | embedding API | Entry points in the embedded API would typ...
1997 Nov 28
3
R-alpha: Problems with dimnames and names
...Nov 24 23:43:05 1996 +++ R-0.50-a4.patched/src/main/cov.c Fri Nov 28 11:21:23 1997 @@ -390,7 +390,7 @@ } if(isNull(y)) { x = getAttrib(x, R_DimNamesSymbol); - if(!isNull(x) && !isNull(CADR(x))) { + if(ncx > 1 && !isNull(x) && !isNull(CADR(x))) { PROTECT(ind = allocList(2)); CAR(ind) = CADR(x); CADR(ind) = CADR(x); @@ -401,7 +401,7 @@ else { x = getAttrib(x, R_DimNamesSymbol); y = getAttrib(y, R_DimNamesSymbol); - if((!isNull(x) && !isNull(CADR(x))) || (!isNull(y) && !isNull(CADR(y)))) { + if((ncx > 1 && !isNull(x) &amp...
2008 Apr 05
2
Adding a Matrix Exponentiation Operator
...nt must be a scalar integer")); e = asInteger(y); if (e < -1) error(_("exponent must be >= -1")); else if (e == 1) return x; else if (e == -1) { /* return matrix inverse via solve() */ SEXP p1, p2, inv; PROTECT(p1 = p2 = allocList(2)); SET_TYPEOF(p1, LANGSXP); CAR(p2) = install("solve.default"); p2 = CDR(p2); CAR(p2) = x; inv = eval(p1, rho); UNPROTECT(1); return inv; } PROTECT(matrix = allocVector(mode, nrows * ncols)); PROTECT(tmp = allocVector(...
2024 Jun 07
1
clarifying and adjusting the C API for R
...loc apitype > 1 Rf_AdobeSymbol2utf8 R_ext/GraphicsDevice.h eapi > 2 alloc3DArray WRE api > 3 allocArray WRE api > 4 allocLang WRE api > 5 allocList WRE api > 6 allocMatrix WRE api > > The 'apitype' field has three possible levels > > | api | stable (ideally) API | > | eapi | experimental API | > | emb | embedding API | > >...
2024 Jun 09
1
clarifying and adjusting the C API for R
...loc apitype > 1 Rf_AdobeSymbol2utf8 R_ext/GraphicsDevice.h eapi > 2 alloc3DArray WRE api > 3 allocArray WRE api > 4 allocLang WRE api > 5 allocList WRE api > 6 allocMatrix WRE api > > The 'apitype' field has three possible levels > > | api | stable (ideally) API | > | eapi | experimental API | > | emb | embedding API | > >...
2024 Jul 05
2
API for converting LANGSXP to LISTSXP?
Hi, A common idiom in the R sources is to convert objects between LANGSXP and LISTSXP by using SET_TYPEOF. However, this is soon going to be disallowed in packages. From what I can see, there isn't currently a direct way to convert between these two object types using the available API. At the R level, one can convert calls to pairlists with: >
2024 Jun 07
1
clarifying and adjusting the C API for R
...loc apitype > 1 Rf_AdobeSymbol2utf8 R_ext/GraphicsDevice.h eapi > 2 alloc3DArray WRE api > 3 allocArray WRE api > 4 allocLang WRE api > 5 allocList WRE api > 6 allocMatrix WRE api > > The 'apitype' field has three possible levels > > | api | stable (ideally) API | > | eapi | experimental API | > | emb | embedding API | > >...
1999 Nov 24
0
R-Oracle (was Internal data types)
...but I'm not quite sure how to approach > > this. > > Use .Call is the key. > > > I think that what I want to do is actually create the appropriate SEXPR > > for a list, with each element being a vector (numeric or string). This > > would presumably be through allocList() and allocVector(), but how then > > do I access individual elements of an SEXPR (list or vector) from C? > > (i.e., are there access functions that I'm missing, or do I have to wade > > through the structure definition of SEXPR?) > > See the `R-external' manual. T...
2024 Jun 07
1
[External] Re: clarifying and adjusting the C API for R
...? ? ?1 Rf_AdobeSymbol2utf8 R_ext/GraphicsDevice.h? ? eapi > ? ? ?2? ? ? ? alloc3DArray? ? ? ? ? ? ? ? ? ? WRE? ? ?api > ? ? ?3? ? ? ? ? allocArray? ? ? ? ? ? ? ? ? ? WRE? ? ?api > ? ? ?4? ? ? ? ? ?allocLang? ? ? ? ? ? ? ? ? ? WRE? ? ?api > ? ? ?5? ? ? ? ? ?allocList? ? ? ? ? ? ? ? ? ? WRE? ? ?api > ? ? ?6? ? ? ? ?allocMatrix? ? ? ? ? ? ? ? ? ? WRE? ? ?api > > The 'apitype' field has three possible levels > > ? ? ?| api? | stable (ideally) API | > ? ? ?| eapi | experimental API? ? ?| > ? ? ?| emb? | emb...
2019 Jul 13
2
Mitigating Stalls Caused by Call Deparse on Error
...NPROTECT(1); ???? return s; ?} +/* + * Return the traceback with calls deparsed + */ +attribute_hidden +SEXP R_GetTraceback(int skip) +{ +??? int nback = 0; +??? SEXP s, t, u, v; +??? s = PROTECT(R_GetTracebackParsed(skip)); +??? for(t = s; t != R_NilValue; t = CDR(t)) nback++; +??? u = v = PROTECT(allocList(nback)); ? +??? for(t = s; t != R_NilValue; t = CDR(t), v=CDR(v)) { +??????? SETCAR(v, PROTECT(deparse1m(CAR(t), 0, DEFAULTDEPARSE))); +??????? UNPROTECT(1); +??? } +??? UNPROTECT(1); +??? return u; +} + ?SEXP attribute_hidden do_traceback(SEXP call, SEXP op, SEXP args, SEXP rho) ?{ ???? int skip;
2024 Jun 08
1
[External] Re: clarifying and adjusting the C API for R
...beSymbol2utf8 R_ext/GraphicsDevice.h eapi > > 2 alloc3DArray WRE api > > 3 allocArray WRE api > > 4 allocLang WRE api > > 5 allocList WRE api > > 6 allocMatrix WRE api > > > > The 'apitype' field has three possible levels > > > > | api | stable (ideally) API | > > | eapi | experimental API...
2019 Jul 14
2
[External] Mitigating Stalls Caused by Call Deparse on Error
...the traceback with calls deparsed > + */ > +attribute_hidden > +SEXP R_GetTraceback(int skip) > +{ > +??? int nback = 0; > +??? SEXP s, t, u, v; > +??? s = PROTECT(R_GetTracebackParsed(skip)); > +??? for(t = s; t != R_NilValue; t = CDR(t)) nback++; > +??? u = v = PROTECT(allocList(nback)); > ? > +??? for(t = s; t != R_NilValue; t = CDR(t), v=CDR(v)) { > +??????? SETCAR(v, PROTECT(deparse1m(CAR(t), 0, DEFAULTDEPARSE))); > +??????? UNPROTECT(1); > +??? } > +??? UNPROTECT(1); > +??? return u; > +} > + > ?SEXP attribute_hidden do_traceback(SEXP call...