search for: new_list

Displaying 18 results from an estimated 18 matches for "new_list".

Did you mean: new_ist
2005 May 17
1
returning an empty list.
I would like to return an empty list from a C function. This I would do as: if (file.exists()) { /* do something */ } else { SEXP empty_list; PROTECT(empty_list = NEW_LIST(0)); UNPROTECT(1); return empty_list; } The PROTECT, UNPROTECT lines seemed like overkill to me, but as far as I understood the documentation this seemed like the correct usage. It seems like I could really just do the following: return NEW_LIST(0); but I thought I'd better ask fir...
2003 Nov 18
1
How to return a big treelike list from .Call Interface (protect stack overflow)
I try to create a big treelike list structure using the RDefines/RInternal macros. The tree carries information at each node (attribute list) and at each leaf (vector). My understanding is that for each node I add to the binary tree I have to call PROTECT(newnode = NEW_LIST(2)); and cannot UNPROTECT before I return the whole tree. Same story for node attributes and leaf vectors. However, this way I easily reach the limit of the proteckt stack at 10000 (BTW this error is not catched). How can I increase the protect stack? Is there a better way to create such an R stru...
2006 May 23
1
protect
...ing to do with R (more specifically, I need to close various files). Would I then need to protect foo, as in SEXP bar; bar = foo(); "close the file in C++" return bar; Finally, I am also assigning values to the components of a list. Would the following be ok SEXP bar; PROTECT(bar = NEW_LIST(2)); SET_VECTOR_ELT(bar, 0, ScalarInteger(test()); (where test is a function returning int, which again has nothing to do with R - it interfaces to an extern library), or do I need to hedge myself against garbage collection in the SET_VECTOR_ELT macro? /Kasper
2010 Apr 03
0
FXlistBox.fillItems() segmentation fault - Found Work-around
As my prior posts show, I was getting very random segmentation faults when repeatedly clearing items from a listbox and then repopulating the items. I was using the following statements: mylistbox.clearItems() mylistbox.fillItems(new_list) This would work for awhile, but after enough iterations of clearing and replacing the items in the listbox it would segmentation faults at the .fillItems call. I found a workaround. If instead, I do: mylistbox.clearItems() new_list.each { |item| mylistbox.appendItem(item) } the app works fine...
2007 May 02
0
Selected value in a combobox
I''m using ActiveScaffold. In the file house_helper.rb I have written the code: def house_form_column(record, input_name) ... list = House.find(:all, :include => ''city'') new_list=... ... list do |element| if record = element.name selec=element.id end end select_tag ''X'',options_for_select(new_list, selected=selec), {:multiple => false} ... to visualize a combobox with some data. The information is visualised correctly but I c...
2001 Sep 10
1
not safe to return vector pointer
Hello All, I recently upgraded from R-1.1.1 to R-1.2.2. I have an R function that uses .Call() to return a list from C code. The C code has the form: SEXP function(SEXP var) { SEXP rlist ; PROTECT(rlist = NEW_LIST(3)) ; VECTOR_PTR(rlist)[0] = NEW_INTEGER(1) ; VECTOR_PTR(rlist)[1] = NEW_STRING(1) ; ... UNPROTECT(1) ; return(rlist) ; } When I try to .Call("function",...) from R I get the following error message: Error: not safe to return vector pointer Why is it no longer safe...
2000 Apr 01
1
Bug ? mine or ? in R core
...bug=INTEGER(dbg)[0], transposing=(int)LOGICAL(tx)[0]; /*true if transposing, not used here*/ long maximum=(long)REAL(max)[0]; long j=1,k=1, /* row counters*/ buffsize=(long)REAL(bs)[0], /* prealloc if row count NA*/ length,offset,t_offset; /* counts into output buf*/ NCOLS=1; PROTECT(ans=NEW_LIST(2)); /*create answer [0] = data, [1]=stat */ PROTECT(stat=NEW_INTEGER(1)); /* numeric status vector */ PROTECT(data=NEW_CHARACTER(buffsize)); while(1){ for (i=1; i<= NCOLS; i++){ offset=((i-1)*maximum)+(j-1); } DBG(2,"writing to data"); STRING(data)[offset]=COPY_TO_USER_STR...
2006 May 18
5
Overriding default DELETE behavior with logical deletes
Hello! I am trying to figure out how to implement *logical deletes* instead of physical deletes using ActiveRecord. Basically, in many applications that deal with E-Commerce, you really can''t physically delete almost anything, because records must be kept for auditing and customer service tracking purposes. In the past, I''ve implemented logical deletes as follows: 1.
2003 Dec 10
0
C++: SET_LENGTH() Over Many Iterations?
...OTECT(int_vect = NEW_INTEGER(0)); for (int i = 0; i < n_reps; ++i) { Rprintf(" ** Iteration %d:\n", i + 1); if (full_alloc) INTEGER_POINTER(int_vect)[i] = i; else PUSH_BACK_INTEGER(int_vect, i); } SEXP out, names, cls; PROTECT(out = NEW_LIST(1)); SET_VECTOR_ELT(out, 0, int_vect); PROTECT(names = NEW_CHARACTER(1)); SET_STRING_ELT(names, 0, COPY_TO_USER_STRING("integer.vector")); SET_NAMES(out, names); PROTECT(cls = NEW_CHARACTER(1)); SET_STRING_ELT(cls, 0, COPY_TO_USER_STRING("pushback"));...
2005 Jul 12
1
allocation of large matrix failing
...hat size and it returns instantly, so I am inclined to think that this is not a memory/GC issue, but I submit it may be. <code> int numHits = seq.GetNumberHits(); Rprintf("numHits:%d\n", numHits); Rprintf("before allocation...\n"); SEXP oligos, matrix; PROTECT(oligos = NEW_LIST(numHits)); Rprintf("allocated oligo list...\n"); PROTECT(matrix = NEW_INTEGER(numHits*8)); Rprintf("entering looop...\n"); <output> entering sequence loop. numHits:333559 before allocation... allocated oligo list... It hangs here everytime (never printing "enterin...
2004 Jan 09
1
Call and memory
...),as.integer(k)); } SEXP mList( SEXP Xi, SEXP Ni, SEXP ki ) { double *pX=NUMERIC_POINTER(Xi); int N=INTEGER_POINTER(Ni)[0]; int k=INTEGER_POINTER(ki)[0]; SEXP alist; SEXP avector; SEXP nvector; SEXP rvector; SEXP kvector; int n; int i; transposeMatrix(pX,N,k); n=4; PROTECT(alist=NEW_LIST(n)); PROTECT(avector=NEW_NUMERIC(200)); for (i=0;i<200;i++) { NUMERIC_POINTER(avector)[i]=pX[i]; } SET_ELEMENT(alist,0,avector); UNPROTECT(1); PROTECT(nvector=NEW_INTEGER(1)); INTEGER_POINTER(nvector)[0]=N; SET_ELEMENT(alist,1,nvector); UNPROTECT(1); PROTECT(rvector=NEW_NUMERIC(1));...
2013 Jun 27
3
Read a text file into R with .Call()
Hi, I want to read a text file into R with .Call(). So I define some NEW_CHARACTER() to store the chracters read and use SET_STRING_ELT to fill the elements. e.g. PROTECT(qNames = NEW_CHARACTER(10000)); char *foo; // This foo holds the string I want. while(foo = readLine(FN)){ SET_STRING_ELT(qNames, i, mkChar(foo))); } In this way, I can get the desired character from qNames. The only problem
2011 Dec 04
0
Core Dump upon IMAP Login with latest HG (2.1) c067025026ed
...box_set__foreach_end = <value optimized out> box_set = <value optimized out> #1 0x00007fa68d371003 in mailbox_alloc (list=<value optimized out>, vname=0x21ec318 "INBOX", flags=MAILBOX_FLAG_DROP_RECENT) at mail-storage.c:643 _data_stack_cur_id = 4 new_list = 0x22149b0 storage = 0x221b760 box = 0x222a9f0 __FUNCTION__ = "mailbox_alloc" #2 0x000000000040d8de in select_open (cmd=0x22259c0, readonly=false) at cmd-select.c:285 client = 0x2224e30 status = {messages = 2808, recent = 0, unseen = 0, uidvalidity = 0...
2003 Dec 12
3
C++: Appending Values onto an R-Vector.
Hi folks. I posted this question a few days ago, but maybe it got lost because of the code I included with it. I'm having a problem using the SET_LENGTH() macro in an R extension I'm writing in C++. In a function within the extension I use SET_LENGTH() to resize R vectors so as to allow the concatenation of single values onto the vectors -- it's a "push back" function to
2010 Feb 23
0
dovecot 2.0_b3 autocreate plugin bug.
...in.c:279 euser = 0x80885e0 #4 0xb7f4e6be in hook_mailbox_allocated (box=0x808ae28) at mail-storage-hooks.c:180 hooks = 0x80885cc #5 0xb7f4d0ef in mailbox_alloc (list=0x8089808, name=0x8066c00 "Drafts", flags=0) at mail-storage.c:497 _data_stack_cur_id = 4 new_list = 0x8089808 storage = 0x808a010 box = 0x808ae28 #6 0xb7eada02 in autocreate_mailbox (namespaces=0x8087078) at autocreate-plugin.c:28 No locals. #7 autocreate_mailboxes (namespaces=0x8087078) at autocreate-plugin.c:50 user = 0x8087800 env_name = "\000\000\000\0...
2013 Mar 25
86
[PATCH 00/28] libxl: ocaml: improve the bindings
The following series of patches fill in most of the gaps in the OCaml bindings to libxl, to make them useful for clients such as xapi/xenopsd (from XCP). There are a number of bugfixes to the existing bindings as well. I have an experimental version of xenopsd that successfully uses the new bindings. An earlier version of the first half of the series was submitted to the last by Ian Campbell on
2009 Jan 30
8
[PATCH 0/7] ocfs2: Directory indexing support
The following patches implement indexed directory support in Ocfs2, mostly according to the design doc I wrote up a while ago: http://oss.oracle.com/osswiki/OCFS2/DesignDocs/IndexedDirectories The patches have been rebased on top of 2.6.29-rc2. It should be trivial to put them into merge_window. Things are what I'd call complete now. I'd like to get these into the merge_window branch
2009 Mar 17
33
[git patches] Ocfs2 updates for 2.6.30
Hi, The following patches comprise the bulk of Ocfs2 updates for the 2.6.30 merge window. Aside from larger, more involved fixes, we're adding the following features, which I will describe in the order their patches are mailed. Sunil's exported some more state to our debugfs files, and consolidated some other aspects of our debugfs infrastructure. This will further aid us in debugging