search for: scanchar

Displaying 6 results from an estimated 6 matches for "scanchar".

Did you mean: sanchal
1999 Oct 30
1
read.table problem on Linux/Alpha (seg faults caused by isspace(R_EOF)) (PR#303)
...ix. --- R-0.65.1/src/main/scan.c.orig Wed Sep 29 11:11:45 1999 +++ R-0.65.1/src/main/scan.c Fri Oct 29 17:34:22 1999 @@ -124,7 +124,7 @@ if (bufp >= &buffer[MAXELTSIZE - 2]) continue; *bufp++ = c; - } while (!isspace(c = scanchar()) && c != R_EOF); + } while ((c = scanchar()) != R_EOF && !isspace(c)); while (c==' ' || c=='\t') c=scanchar(); if (c=='\n' || c=='\r' || c==R_EOF) @@ -647,7 +647,7 @@ } }...
2023 Feb 11
1
scan(..., skip=1e11): infinite loop; cannot interrupt
...encoding; RCNTXT cntxt; @@ -952,7 +952,7 @@ if(!data.con->canread) error(_("cannot read from this connection")); } - for (R_xlen_t i = 0; i < nskip; i++) /* MBCS-safe */ + for (R_xlen_t i = 0; i < nskip && c != R_EOF; i++) /* MBCS-safe */ while ((c = scanchar(FALSE, &data)) != '\n' && c != R_EOF); } Making it interruptible is a bit more work: we need to ensure that a valid context is set up and check regularly for an interrupt. --- src/main/scan.c (revision 83797) +++ src/main/scan.c (working copy) @@ -835,7 +835,7 @@ attri...
2023 Mar 13
0
scan(..., skip=1e11): infinite loop; cannot interrupt
...urrent?R?devel?(r83976),?if?EOF?is?reached,?the?outer?loop?keeps?going,?i?keeps?incrementing?until?nskip. The?outer?loop?could?be?made?to?also?stop?on?EOF. Alternatively,?not?using?nested?loop?is?possible,?like?the?following. ?if?(nskip)?for?(R_xlen_t?i?=?0,?j?=?10000;?;?)?{?/*?MBCS-safe?*/ ?c?=?scanchar(FALSE,?&data); ?if?(!j--)?{ ?????R_CheckUserInterrupt(); ?????j?=?10000; ?} ?if?((c?==?'\n'?&&?++i?==?nskip)?||?c?==?R_EOF) ?????break; ?} ----------- On?2/11/23?09:33,?Ivan?Krylov?wrote: >?On?Fri,?10?Feb?2023?23:38:55?-0600 >?Spencer?Graves?<spencer.graves?using?prod...
2004 Jun 30
2
Slow IO: was [R] naive question
...y to read a CSV file) to an equivalent C code. It turned out to be 20 - 50 times slower. I can see at least two main reasons why R's IO is so slow (I didn't profile this though): A) it reads from a connection char-by-char as opposed to the buffered read. Reading each char requires a call to scanchar() which then calls Rconn_fgetc() (with some non-trivial overhead). Rconn_fgetc() on its part is defined somewhere else (not in scan.c) and therefore the call can not be inlined, etc. B) mkChar, which is used very extensively, is too slow. There are ways to minimize the number of calls to mkChar, bu...
2023 Feb 11
1
scan(..., skip=1e11): infinite loop; cannot interrupt
Hello, All: I have a 4.54 GB file that I'm trying to read in chunks using "scan(..., skip=__)". It works as expected for small values of "skip" but goes into an infinite loop for "skip=1e11" and similar large values of skip: I cannot even interrupt it; I must kill R. Below please find sessionInfo() with a toy example. My real problem is a large
2008 Jun 11
1
read.table() causes segfault with incorrect data (PR#11627)
Full_Name: Juho Vuori Version: 2.7.0 (2008-04-22) OS: Linux poseidon.fimr.fi 2.6.23.17-88.fc7PAE #1 SMP Thu May 15 00:22:53 EDT 2008 i686 i686 i386 GNU/Linux Submission from: (NULL) (193.166.188.194) Calling read.table() twice the following way causes a segmentation fault in R. Run R and type the following commands: > read.table(stdin()) 0: 1 2 3 1: 3 2: Error in scan(file, what, nmax, sep,