search for: externalptr

Displaying 20 results from an estimated 61 matches for "externalptr".

2008 Jan 29
2
Problem with new("externalptr")
Hi, It seems that new("externalptr") is always returning the same instance, and not a new one as one would expect from a call to new(). Of course this is hard to observe: > new("externalptr") <pointer: (nil)> > new("externalptr") <pointer: (nil)> since not a lot of details are dis...
2012 Dec 25
2
reinterpreting externalptr in R
...to build a wrapper for an c-function to use it in R. I would like to define a generic function, which gives back a void pointer. On the R side, I know what this pointer is pointing to, whether it is an integer or an string, or something else... but I need to somehow reinterpret the resulting "externalptr" into another form... a function that looks like the following: *void* test(){ std::string str="test"; return str.c_str(); }* when I call this from R: *str <- test() typeof(str) % result is: "externalptr"* how could I reinterpret this to a charcterarray, to...
2018 Jan 31
0
Scraping info from a web site?
...d" into R? ????? I found recommendations for the "rvest" package to "Easily Harvest (Scrape) Web Pages".? I tried the following: URL <- 'https://www.battleforthenet.com/scoreboard/' library(rvest) Bftn <- read_html(URL) str(Bftn) List of 2 ?$ node:<externalptr> ?$ doc :<externalptr> ?- attr(*, "class")= chr [1:2] "xml_document" "xml_node" ?????? However, I don't know what to do with <externalptr>. ????? The "Selectorgadget" vignette with rvest suggested selecting what I wanted on the web...
2012 May 11
1
Passing externalptr to .C()
...sing R objects other than atomic vectors, functions, lists and environments to .C() is now deprecated and will give a warning. Most cases (especially NULL) are actually coding errors. NULL will be disallowed in future. This seems to make sense, except that this case includes externalptrs. I have quite a bit of code, designed to interface with various external hardware devices, which uses this sort of idiom: # for example getDeviceInfo <- function(handle) { .C("groovyDevice_getDeviceInfo", PACKAGE="groovyDevice", handle, status = as.integer(0))[-1...
2016 Sep 15
1
Finalizer execution order question
Given an externalptr object 'pool' which protects an R object 'prot': # SEXP prot = (a dynamically updated list with handles) SEXP pool = R_MakeExternalPtr(p, R_NilValue, prot); R_RegisterCFinalizerEx(pool, fin_pool, TRUE); WRE explains that 'prot' remains in existence as long as 'p...
2018 Mar 18
0
`@<-` modify its argument when slot is externalptr
On Sun, 18 Mar 2018, Jialin Ma wrote: > Dear all, > > I am confused about the inconsistent behaviors of `@<-` operator when > used in different ways. Consider the following example: > > library(inline) > > # Function to generate an externalptr object with random address > new_extptr <- cfunction(c(), ' > SEXP val = PROTECT(ScalarLogical(1)); > SEXP out = PROTECT(R_MakeExternalPtr(&val, R_NilValue, val)); > UNPROTECT(2); > return(out); > ') > > setClass("S4ClassHoldingExtptr"...
2012 Oct 02
1
ffsave problems
...5 6 .. $ PhysicalFirstCol : int 1 1 1 1 1 1 .. $ PhysicalLastCol : int 1 1 1 1 1 1 .. - attr(*, "Dim")= int 65640757 6 .. - attr(*, "Dimorder")= int 1 2 $ physical: List of 6 .. $ fecha : list() .. ..- attr(*, "physical")=Class 'ff_pointer' <externalptr> .. .. ..- attr(*, "vmode")= chr "double" .. .. ..- attr(*, "maxlength")= int 65640757 .. .. ..- attr(*, "pattern")= chr "clone" .. .. ..- attr(*, "filename")= chr "C:/Users/ADMIN-~1/AppData/Local/Temp/RtmpqmcfGU/clone10d86...
2018 Mar 18
3
`@<-` modify its argument when slot is externalptr
Dear all, I am confused about the inconsistent behaviors of `@<-` operator when used in different ways. Consider the following example: library(inline) # Function to generate an externalptr object with random address new_extptr <- cfunction(c(), ' SEXP val = PROTECT(ScalarLogical(1)); SEXP out = PROTECT(R_MakeExternalPtr(&val, R_NilValue, val)); UNPROTECT(2); return(out); ') setClass("S4ClassHoldingExtptr", contains = "externalptr&q...
2020 Apr 03
0
The finalizer of the externalPtr does not work when closing R?
...() and set onexit to nonzero. Here: https://github.com/wch/r-source/blob/9353ddfa8d30069ad8975e0364307d710f2488d5/src/include/Rinternals.h#L1279-L1280 Gabor On Fri, Apr 3, 2020 at 1:56 PM Wang Jiefei <szwjf08 at gmail.com> wrote: > > Hi all, > > I found that the finalizer of the externalPtr is not called when R is > quitting. However, manually calling GC() works fine. This behavior is > observed on devel R 2020-04-02 r78142 on Win and R 3.6.3 on Ubuntu. I make > a reproducible package here: https://github.com/Jiefei-Wang/example > > Here is the detail of how to reprodu...
2020 Apr 03
0
[External] The finalizer of the externalPtr does not work when closing R?
...lected language). Memory leaks are not an issue -- unless you are doing very unusual things your OS will reclaim memory resources used by your process when it exits, cleanly or otherwise. Best, luke On Fri, 3 Apr 2020, Wang Jiefei wrote: > Hi all, > > I found that the finalizer of the externalPtr is not called when R is > quitting. However, manually calling GC() works fine. This behavior is > observed on devel R 2020-04-02 r78142 on Win and R 3.6.3 on Ubuntu. I make > a reproducible package here: https://github.com/Jiefei-Wang/example > > Here is the detail of how to reprodu...
2017 Apr 14
2
potential bug in attribute handling for externalptr
Is the following expected behavior? > mkext <- inline::cfunction(language="C", body='return R_MakeExternalPtr(NULL, install("tag"), R_NilValue);') > x <- mkext() > y <- x > attr(y, "foo") <- "bar" > attributes(x) $foo [1] "bar" I would expect that modifying y's attributes should not affect x. [Tested on R version 3.3.3 x86_64-apple-...
2020 Apr 03
4
The finalizer of the externalPtr does not work when closing R?
Hi all, I found that the finalizer of the externalPtr is not called when R is quitting. However, manually calling GC() works fine. This behavior is observed on devel R 2020-04-02 r78142 on Win and R 3.6.3 on Ubuntu. I make a reproducible package here: https://github.com/Jiefei-Wang/example Here is the detail of how to reproduce the problem, I create...
2011 Oct 13
1
Package snow: is there any way to check if a cluster is "acticve"
Is there a 'proper' way of checking if cluster is active. For example, I create a cluster called .PBcluster > str(.PBcluster) List of 4 $ :List of 3 ..$ con :Classes 'sockconn', 'connection' atomic [1:1] 3 .. .. ..- attr(*, "conn_id")=<externalptr> ..$ host: chr "localhost" ..$ rank: int 1 ..- attr(*, "class")= chr "SOCKnode" $ :List of 3 .... Then I stop it with > stopCluster(.PBcluster) > .PBcluster [[1]] $con Error in summary.connection(x) : invalid connection > str(.PBcluster) List of...
2009 Oct 27
1
Rjava, RImageJ, and/or S4 question.
...(RImageJ) img <- IJ$openImage( file.choose() ) #pick an available .tif file img$show() # make the image object visible # An image is now displayed # find out about the objects involved > str(IJ) Formal class 'jobjRef' [package "rJava"] with 2 slots ..@ jobj :<externalptr> ..@ jclass: chr "ij/IJ" > str(img) Formal class 'jobjRef' [package "rJava"] with 2 slots ..@ jobj :<externalptr> ..@ jclass: chr "java/lang/Object" # now use an IJ java method to find out existing screen size IJ$getScreenSize() [1] &quo...
2009 May 10
2
In C, a fast way to slice a vector?
Hello, Suppose in the following code, PROTECT(sr = R_tryEval( .... )) sr is a RAWSXP vector. I wish to return another RAWSXP starting at position 13 onwards (base=0). I could create another RAWSXP of the correct length and then memcpy the required bytes and length to this new one. However is there a more efficient method? Regards Saptarshi Guha
2007 Jul 25
6
Using R_MakeExternalPtr
...unsure how to solve. I am looking to pass a C++ class object to R so that it may be passed back to another C++ function later on to be used. I'm quite new to R and this is my first time writing a package, so I hope you can bear with me. The following is how I create the class and use R_MakeExternalPtr(). This occurs in a function called "soamInit": Session* sesPtr = conPtr->createSession(attributes); void* temp = session; SEXP out = R_MakeExternalPtr(temp, R_NilValue, R_NilValue); return out; The following is how I try to retrieve the class object in a different...
2010 Jan 24
1
recursive data-structures in R - An S4 "node" Class
Hi, In an effort to learn S4 objects, I am trying to port some c based tree code to S4 object. My immediate goal is to use .Call() interface for calling my c code from R. My long term goal is to understand how to write c structs that follows S4 classes and not the other-way-around. The c struct for the node is : typedef struct node{ int c; int n; inode **nodes; //length = n } inode; I
2011 Jul 23
2
xml2-config issues
...ffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E No ability to remove finalizers on externalptr objects in this verison of R checking for sed... /bin/sed checking for pkg-config... /usr/bin/pkg-config checking for xml2-config... no Cannot find xml2-config ERROR: configuration failed for package ‘XML’ * removing ‘/home/amathew/R/i686-pc-linux-gnu-library/2.13/XML’ The downloaded packages are...
2010 Jul 15
0
impute2mach GenABEL conversion problem
...the files I no longer get an error message. The error message that I get on the full file is: Error in checkSlotAssignment(object, name, value) : assignment of an object of class "NULL" is not valid for slot "data" in an object of class "databel"; is(value, "externalptr") is not TRUE The screen out put is: impute2mach(geno = "chr22_1000G.gen",info = "chr22_info", sample = "1000G.sample",machbase = "chr22_test", maketext = F, order_info = c(2:7), skip_info = 0) Options in effect: --infile = chr22_1000G.gen...
2006 Apr 21
0
Questions on version arg to setClass and serialized instances
I have a few questions and thoughts regarding class versioning and serialized S4 class instances. How is the version argument to setClass is intended to work? It appears to want an externalptr, but that seems odd to me. setClass("FOO", representation(x="numeric"), version="1.2.3") Error in validObject(.Object) : invalid class "classRepresentation" object: invalid object for slot "versionKey" in class "classRepresent...