search for: set_slot

Displaying 11 results from an estimated 11 matches for "set_slot".

2012 Sep 15
1
Question about copying arguments in C.
...) 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)); // OR DO I NEED TO SAY PROTECT(ti = allocVector(INTSXP, 1)); INTEGER(pns)[0] = INTEGER(thingysInteger)[0]; SET_SLOT(ans,...
2003 Jun 23
3
FW: S4 classes, creating in C
...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(a="matrix", pivot = "integer")...
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 = representation(lgl = "logical")) a...
2008 Mar 15
1
Experimental R_has_slot() utility
...pears to be missing from a fresh checkout of the development branch. $ svn up At revision 44759. $ grep -i has_slot `find include -name '*.h'` $ grep -i _slot `find include -name '*.h'` include/Rdefines.h:#define GET_SLOT(x, what) R_do_slot(x, what) include/Rdefines.h:#define SET_SLOT(x, what, value) R_do_slot_assign(x, what, value) include/Rinternals.h:SEXP R_do_slot(SEXP obj, SEXP name); include/Rinternals.h:SEXP R_do_slot_assign(SEXP obj, SEXP name, SEXP value); ..or did I miss it ? Thanks, L.
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
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
...ar("sex")); SET_STRING_ELT(names, 3, mkChar("season")); SET_STRING_ELT(names, 4, mkChar("area")); setAttrib(dimnames, R_NamesSymbol, names); setAttrib(v, R_DimNamesSymbol, dimnames); //Set data REAL(v)[0] = 2; //Set slot SET_SLOT(FLQuant, install(".Data"), v); UNPROTECT(10); return FLQuant; } --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 1 minor = 7.1 year = 2003 month = 06 day...
2005 Jul 26
1
Error registering finalizer
...P 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(1)); n++; INTEGER(vntAttr)[0] = count; SET_COUNT(vntData, vntAttr); >>>>> Problem comes here <<<<<< R_RegisterCFinali...
2005 Mar 22
2
can R_do_slot_assign change slot type
Hi, It seems that R_do_slot_assign can change the type of an S4 class slot. For example I have a class setClass("ostream", representation(id = "integer", keepOpen = "logical")) and inside a C-function I was able to assign a RAW vector to the id slot. Is this intentional? I remember reading somewhere that the slot type is guaranteed by R. Maybe this doesn't
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.
2017 May 07
6
[RFC v2 0/6] PMU engine counters
...ide effect it shows us a coarse load of several engines, allthough the counters can only report "idle" or "non-idle". Karol Herbst (6): pmu/fuc: add macros for pdaemon pwr counters pmu/fuc: read out counters and store them pmu/fuc: implement GET_SLOTS pmu/fuc: implement SET_SLOT nouveau/debugfs: add interface for current load pmu: setup counters drm/nouveau/include/nvif/device.h | 1 + drm/nouveau/include/nvkm/subdev/pmu.h | 10 + drm/nouveau/nouveau_debugfs.c | 23 + drm/nouveau/nvkm/subdev/pmu/base.c | 8 + drm/nouve...
2017 Jun 05
7
[PATCH v3 0/7] PMU engine counters
...newer. On pre GT215 GPUs there is also PCOUNTERS, but this is ugly so that I only focus on dynamic reclocking starting with GT215 for now. Karol Herbst (7): pmu/fuc: add macros for pmu engine counters pmu/fuc: read out counters and store them pmu/fuc: implement GET_SLOTS pmu/fuc: implement SET_SLOT pmu: add counter_slots field pmu: setup counters nouveau/debugfs: add interface for current load drm/nouveau/include/nvif/device.h | 1 + drm/nouveau/include/nvkm/subdev/pmu.h | 17 + drm/nouveau/nouveau_debugfs.c | 27 + drm/nouveau/nvkm/subdev/pmu/base...