search for: mkcharc

Displaying 17 results from an estimated 17 matches for "mkcharc".

Did you mean: mkchar
2023 Jan 31
1
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
...!= NULL; i++, e++) { + cetype_t enc = known_to_be_latin1 ? CE_LATIN1 : + known_to_be_utf8 ? CE_UTF8 : + CE_NATIVE; + if ( + (utf8locale && !utf8Valid(*e)) + || (mbcslocale && !mbcsValid(*e)) + ) enc = CE_BYTES; + SET_STRING_ELT(ans, i, mkCharCE(*e, enc)); + } #endif } else { PROTECT(ans = allocVector(STRSXP, i)); @@ -416,11 +424,14 @@ if (s == NULL) SET_STRING_ELT(ans, j, STRING_ELT(CADR(args), 0)); else { - SEXP tmp; - if(known_to_be_latin1) tmp = mkCharCE(s, CE_LATIN1); - else if(known_to_be_utf8) tmp = mkChar...
2008 Oct 28
2
A question about the API mkchar()
...g, so only in the English locale could the function work correctly, under other locale, such as Japanese or Chinese, the string will be convert incorrectly. As a matter of fact, those utf-8 code already is Unicode string, and don't need to be converted at all. I also tried to use the SEXP Rf_mkCharCE(const char *, cetype_t);, Parsing the CE_UTF8 as the argument of cetype_t, but the result is worse. It returned the result as ucs code, an kind of Unicode under windows platform. All I want to get is just a SEXP object containing the original utf-8 string, no matter what locale is set currently...
2016 May 12
3
Suggestion: mkString(NULL) should be NA
I would like to propose that Rf_mkString(NULL) and Rf_mkChar(NULL) return NA rather than segfault. Case: the mkString() and mkChar() functions are convenient to wrap strings returned by e.g. external C libraries into an R vector. However sometimes a library returns NULL instead of a string when the result is unavailable. In some C libraries this can happen unexpectedly or is even undocumented. A
2023 Jan 31
1
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
...enc = known_to_be_latin1 ? CE_LATIN1 : > + known_to_be_utf8 ? CE_UTF8 : > + CE_NATIVE; > + if ( > + (utf8locale && !utf8Valid(*e)) > + || (mbcslocale && !mbcsValid(*e)) > + ) enc = CE_BYTES; > + SET_STRING_ELT(ans, i, mkCharCE(*e, enc)); > + } > #endif > } else { > PROTECT(ans = allocVector(STRSXP, i)); > @@ -416,11 +424,14 @@ > if (s == NULL) > SET_STRING_ELT(ans, j, STRING_ELT(CADR(args), 0)); > else { > - SEXP tmp; > - if(known_to_be_latin1) tmp = mkCharCE(...
2017 Jun 11
1
translateChar in NewName in bind.c
...r-project.org Date: Saturday, 10 June, 2017, 9:14 PM In function 'NewName' in bind.c (https://svn.r-project.org/R/trunk/src/main/bind.c), in else if (*CHAR(base)) , 'translateChar' is used. Should it be 'translateCharUTF8' instead? The end result is marked as UTF-8: mkCharCE(cbuf, CE_UTF8) Other cases already use 'translateCharUTF8'.
2023 Jan 30
2
Sys.getenv(): Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' if an environment variable contains \xFF
/Hello. SUMMARY: $ BOOM=$'\xFF' LC_ALL=en_US.UTF-8 Rscript --vanilla -e "Sys.getenv()" Error in substring(x, m + 1L) : invalid multibyte string at '<ff>' $ BOOM=$'\xFF' LC_ALL=en_US.UTF-8 Rscript --vanilla -e "Sys.getenv('BOOM')" [1] "\xff" BACKGROUND: I launch R through an Son of Grid Engine (SGE) scheduler, where the R
2019 May 19
4
most robust way to call R API functions from a secondary thread
...y_onintr(void *data) { Rf_onintr(); return R_NilValue; } // function called by R_UnwindProtect() to cleanup on interrupt void cleanfun(void *data, Rboolean jump) { if (jump) { // terminate threads cleanly ... } } void fun_calling_R_API(void *data) { // call some R API function, e.g. mkCharCE() ... } void *threaded_fun(void *td) { // ... pthread_mutex_lock(&r_api_mutex); // avoid false stack overflow error: intptr_t R_CStackLimit_old = R_CStackLimit; R_CStackLimit = -1; // R_ToplevelExec() below will call PROTECT 4x: if (R_PPStackTop > R_PPStackSize - 4) {...
2014 Jan 21
1
Using unicode from C interface of R
Hi , I am using C interface of R . If a unicode string is read , in what format I could pass it back to R ? I was trying to use the following tpStr = ( char *)val; SET_STRING_ELT(innerList , 0, mkChar(tpStr)); It does not work . If I pass it back from as RAW format to R , what package is there to read it ? I mean package for interpreting RAW data . Thanks, Sandip [[alternative HTML
2016 May 24
2
Suggestion: mkString(NULL) should be NA
...12, 2016 at 1:20 PM, Jeroen Ooms <jeroen.ooms at stat.ucla.edu> > wrote: > > I would like to propose that Rf_mkString(NULL) and Rf_mkChar(NULL) > > return NA rather than segfault. > > An example implementation: https://git.io/vroxm > > With this patch, mkChar(NULL), mkCharCE(NULL, ce) would return > NA_STRING rather than segfault at strlen(NULL). This automatically > fixes mkString(NULL) as well which wraps mkChar (See Rinlinedfuns.h). > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/ma...
2009 Jan 27
2
Package (PR#13475)
Full_Name: Partho Bhowmick Version: 2.8.1 OS: Windows XP Submission from: (NULL) (199.43.48.131) While trying to install package sn (I have tried multiple mirrors), I get the following message trying URL 'http://www.revolution-computing.com/cran/bin/windows/contrib/2.8/sn_0.4-10.zip' Content type 'application/zip' length 320643 bytes (313 Kb) opened URL downloaded 313 Kb
2019 May 20
1
most robust way to call R API functions from a secondary thread
...// function called by R_UnwindProtect() to cleanup on interrupt >> void cleanfun(void *data, Rboolean jump) { >> if (jump) { >> // terminate threads cleanly ... >> } >> } >> void fun_calling_R_API(void *data) { >> // call some R API function, e.g. mkCharCE() ... >> } >> void *threaded_fun(void *td) { >> // ... >> pthread_mutex_lock(&r_api_mutex); >> // avoid false stack overflow error: >> intptr_t R_CStackLimit_old = R_CStackLimit; >> R_CStackLimit = -1; >> // R_ToplevelExec() below wil...
2019 May 20
0
[External] most robust way to call R API functions from a secondary thread
...NilValue; > } > > // function called by R_UnwindProtect() to cleanup on interrupt > void cleanfun(void *data, Rboolean jump) { > if (jump) { > // terminate threads cleanly ... > } > } > > void fun_calling_R_API(void *data) { > // call some R API function, e.g. mkCharCE() ... > } > > void *threaded_fun(void *td) { > > // ... > > pthread_mutex_lock(&r_api_mutex); > > // avoid false stack overflow error: > intptr_t R_CStackLimit_old = R_CStackLimit; > R_CStackLimit = -1; > > > // R_ToplevelExec() below will call P...
2019 May 20
0
most robust way to call R API functions from a secondary thread
...> } > > // function called by R_UnwindProtect() to cleanup on interrupt > void cleanfun(void *data, Rboolean jump) { > if (jump) { > // terminate threads cleanly ... > } > } > > void fun_calling_R_API(void *data) { > // call some R API function, e.g. mkCharCE() ... > } > > void *threaded_fun(void *td) { > > // ... > > pthread_mutex_lock(&r_api_mutex); > > // avoid false stack overflow error: > intptr_t R_CStackLimit_old = R_CStackLimit; > R_CStackLimit = -1; > > > // R_ToplevelExec()...
2012 Jun 22
0
R 2.15.1 is released
...he packages available when lazy-loading as well as when test-loading (since packages such as ETLUtils and agsemisc had top-level calls to library() for undeclared packages). This check is now also available on Windows. C-LEVEL FACILITIES: o C entry points mkChar and mkCharCE now check that the length of the string they are passed does not exceed 2^31-1 bytes: they used to overflow with unpredictable consequences. o C entry points R_GetCurrentSrcref and R_GetSrcFilename have been added to the API to allow debuggers access to the source refe...
2012 Jun 22
0
R 2.15.1 is released
...he packages available when lazy-loading as well as when test-loading (since packages such as ETLUtils and agsemisc had top-level calls to library() for undeclared packages). This check is now also available on Windows. C-LEVEL FACILITIES: o C entry points mkChar and mkCharCE now check that the length of the string they are passed does not exceed 2^31-1 bytes: they used to overflow with unpredictable consequences. o C entry points R_GetCurrentSrcref and R_GetSrcFilename have been added to the API to allow debuggers access to the source refe...
2008 Apr 22
3
R 2.7.0 is released
...lable (and declared in R_Ext/Lapack.h), notably for (reciprocal) condition number estimation of complex matrices. o Experimental utility R_has_slot supplementing R_do_slot. o There is a new public interface to the encoding info stored on CHARSXPs, getCharCE and mkCharCE using the enumeration type cetype_t. o A new header 'R_ext/Visibility.h' contains some definitions for controlling the visibility of entry points, and how to control visibility is now documented in 'Writing R Extensions'. BUG FIXES o pt(x, df...
2008 Apr 22
3
R 2.7.0 is released
...lable (and declared in R_Ext/Lapack.h), notably for (reciprocal) condition number estimation of complex matrices. o Experimental utility R_has_slot supplementing R_do_slot. o There is a new public interface to the encoding info stored on CHARSXPs, getCharCE and mkCharCE using the enumeration type cetype_t. o A new header 'R_ext/Visibility.h' contains some definitions for controlling the visibility of entry points, and how to control visibility is now documented in 'Writing R Extensions'. BUG FIXES o pt(x, df...