search for: make_class

Displaying 9 results from an estimated 9 matches for "make_class".

Did you mean: base_class
2004 Apr 26
1
Segfault: .Call and classes with logical slots
Hi, the following example aiming at a class containing a logical slot segfaults under R-1.9.0 when `gctorture(on = TRUE)' is used: Code code (dummy.c): #include <Rdefines.h> SEXP foo() { SEXP ans; PROTECT(ans = NEW_OBJECT(MAKE_CLASS("test"))); SET_SLOT(ans, install("lgl"), allocVector(LGLSXP, 1)); LOGICAL(GET_SLOT(ans, install("lgl")))[0] = TRUE; UNPROTECT(1); return(ans); } R code (dummy.R): dyn.load("dummy.so") setClass("test", representation = representati...
2012 Sep 15
1
Question about copying arguments in C.
...tThingy(int thingysInteger); SEXP constructThingy(SEXP thingysInteger) { SEXP ans, TClass, ti; if(!isInteger(thingysInteger)) error("thingysIntegermust be an integer."); if(constructThingy(INTEGER(thingysInteger)[0])) error("error in getting a thingy"); TClass = MAKE_CLASS("thingy"); PROTECT(ans = NEW_OBJECT(TClass)); // *****QUESTION STARTS HERE***** // CAN I SAY: SET_SLOT(ans, Rf_install("myInteger"), thingysInteger); // IF NOT, CAN I SAY SET_SLOT(ans, Rf_install("myInteger"), AS_INTEGER(thingysInteger));...
2003 Jun 23
3
FW: S4 classes, creating in C
...M(aa); m = INTEGER(adims)[0]; n = INTEGER(adims)[1]; pivot = PROTECT(NEW_INTEGER(m < n ? m : n)); F77_CALL(dgetrf)(&m, &n, REAL(aa), &m, INTEGER(pivot), &info); check_Lapack_error(info, "dtrtrf"); val = PROTECT(NEW_OBJECT(MAKE_CLASS("LUdecomposition"))); SET_SLOT(val, install("a"), aa); SET_SLOT(val, install("pivot"), pivot); UNPROTECT(3); return val; } LUdecomposition is an S4 class defined as setClass("LUdecomposition", representation(...
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
..., area = all year age 0 0 1 > #C code to do the same thing extern "C" __declspec(dllexport) SEXP __stdcall Test(void) { SEXP FLQuant, v, d1, d2, d3, d4, d5, dim, dimnames, names; //Create new S4 object PROTECT(FLQuant = NEW_OBJECT(MAKE_CLASS("FLQuant"))); //Create array for slot //Set dimensions of array PROTECT(dim = allocVector(INTSXP, 5)); INTEGER(dim)[0] = 1; INTEGER(dim)[1] = 1; INTEGER(dim)[2] = 1; INTEGER(dim)[3] = 1; INTEGER(dim)[4] = 1; //Allocate memory...
2005 Jul 26
1
Error registering finalizer
...llocatePtr(count, sizeof(ProbesetGE_t), ProbesetGETypeTag)); } SEXP R_PDNN_newProbesetGE(unsigned count) { SEXP vntObj; SEXP vntClassDef; SEXP vntData; SEXP vntAttr; SEXP vntHandle; unsigned n = 0; PROTECT(vntClassDef = MAKE_CLASS(PROBESET_GE_CLASS_NAME)); n++; PROTECT(vntObj = NEW_OBJECT(vntClassDef)); n++; PROTECT(vntHandle = AllocateProbesetGEPtr(count)); n++; SET_SLOT(vntObj, HandleSlotSymbol, vntHandle); PROTECT(vntData = R_ExternalPtrProtected(vntHandle)); n++; PROTECT(vntAttr = NEW_INTEGER(...
2004 Mar 06
2
.Call: is new attribute of protected object auto-protected
Hi, I have an SEXP obj in a C function called via .Call(). The obj is protected (in fact it is an argument to .Call and therefore automatically protected). If I set an attribute of obj does the attribute become protected too? Here is an example SEXP foo(SEXP obj) { SET_NAMES(obj, NEW_CHARACTER(3)); /* are names protected or not? */ ... } Thanks, Vadim [[alternative HTML version
2010 Feb 18
3
R CMD check: OK in LINUX. Crashes in Windows!
Hi, I have followed the recommended steps for creating a package (rctest). As of now, my goal is simply to understand how various pieces fit together. The package includes: (1) C code with source in sub-directories, compiled to create a static library. (a) There is a single C-struct (dns) a simple 'matrix': {int m; int n; double *d;} (b) C code to create random matrix of a certain size.
2003 Jan 10
6
R-1.6.2 is released
I've rolled up R-1.6.2.tgz a short while ago. This is a minor upgrade, fixing an assortment of bugs. You can get it from the developer site at http://cvs.r-project.org/pub/CRAN/src/base/R-1.6.2.tgz or wait for it to be mirrored at a CRAN site near you. Binaries for various platforms will appear in due course. There is also a version split for floppies, but due to the inclusion of
2003 Jan 10
6
R-1.6.2 is released
I've rolled up R-1.6.2.tgz a short while ago. This is a minor upgrade, fixing an assortment of bugs. You can get it from the developer site at http://cvs.r-project.org/pub/CRAN/src/base/R-1.6.2.tgz or wait for it to be mirrored at a CRAN site near you. Binaries for various platforms will appear in due course. There is also a version split for floppies, but due to the inclusion of