search for: isstring

Displaying 20 results from an estimated 51 matches for "isstring".

2015 Mar 10
4
[LLVMdev] n-bit bytes for clang/llvm
...uiuc.edu/pipermail/llvmdev/2009-September/thread.html#26025 with the consensus seemingly being "quite doable, please get a good patch and submit". However the current code appears (to my neophyte eyes) to be explicitly 8-bit, e.g. one instance called out in the mail thread remains: /// isString - This method returns true if this is an array of i8. bool ConstantDataSequential::isString() const { return isa<ArrayType>(getType()) && getElementType()->isIntegerTy(8); } I didn't find anything related beyond this mail thread such as a discussion of a patch but of course...
2010 Jun 19
1
more powerful iconv
...isLatin1 = FALSE, isUTF8 = FALSE; + Rboolean isRawx = (TYPEOF(x) == RAWSXP); - if(TYPEOF(x) != STRSXP) - error(_("'x' must be a character vector")); + if(TYPEOF(x) != STRSXP && !isRawx) + error(_("'x' must be a character vector or raw")); if(!isString(CADR(args)) || length(CADR(args)) != 1) error(_("invalid '%s' argument"), "from"); if(!isString(CADDR(args)) || length(CADDR(args)) != 1) error(_("invalid '%s' argument"), "to"); if(!isString(CADDDR(args)) || length(CADDDR(args...
2006 Jun 22
2
.Call and data frames
...e (actually C++ side) I use code like this: SEXP colnames = getAttrib(df, R_NamesSymbol) cname = string(CHAR(STRING_ELT(colnames,i)) SEXP coldata = VECTOR_ELT(df,i) (data for i-th column) if(isReal(colData)) x = REAL(colData)[j]; else if(isInteger(colData)) i = INTEGER(colData)[j]; else if(isString(colData)) s = CHAR(STRING_ELT(colData,j)) The problem is that the last test (isString) never passes, even when I pass in a frame for which one or more cols contain character strings. When the column contains strings the isVector(colData) test passes, but no matter how I try to fetch the string...
2020 Jan 20
1
Minor bug in error message in datetime.c
Hi, I have spotted a minor bug in do_strptime() function. Here is a patch: ?--- a/src/main/datetime.c +++ b/src/main/datetime.c @@ -1048,7 +1048,7 @@ SEXP attribute_hidden do_strptime(SEXP call, SEXP op, SEXP args, SEXP env) if(!isString((x = CAR(args)))) error(_("invalid '%s' argument"), "x"); if(!isString((sformat = CADR(args))) || XLENGTH(sformat) == 0) - error(_("invalid '%s' argument"), "x"); + error(_("invalid '%s' argument"...
2006 Jan 11
9
Prototype & Cookies
Has anyone written any "cookie" class using prototype? Basically, what I am looking for is if there is an easy way to store mutiple cookies in a single cookie using hash or something - easy writing and retrieval (updating the cookie value). For eg - If I had 25 cookies for my domain 5 of the cookies would either get dropped or not be set (as there is a limit of 20 cookies per domain).
2001 Apr 14
1
Postscript font bugs (and a suggestion) (PR#914)
...9;t know how to fix it. 2. The ?postscript help topic refers to .ps.profile; the actual variable name is .ps.prolog. The C source in main/devPS.c has this on lines 606-608, with the incorrect name in the error message: prolog = findVar(install(".ps.prolog"), R_GlobalEnv); if(!isString(prolog)) error("Object .ps.profile is not a character vector"); 3. And this is a suggestion, not a bug: I'd like to change the font definitions by changing the .ps.prolog instructions, but devPS.c puts the PSEncodeFont(fp, encoding); line after the place where .ps.prol...
2009 Mar 18
1
sprintf("%d", integer(0)) aborts
...48148) +++ sprintf.c (working copy) @@ -79,13 +79,13 @@ static R_StringBuffer outbuff = {NULL, 0, MAXELTSIZE}; Rboolean use_UTF8; - outputString = R_AllocStringBuffer(0, &outbuff); - /* grab the format string */ nargs = length(args); format = CAR(args); - if (!isString(format) || length(format) == 0) + if (!isString(format)) error(_("'fmt' is not a non-empty character vector")); + if (length(format) == 0) + return allocVector(STRSXP, 0) ; args = CDR(args); nargs--; if(nargs >= 100) error(_("only 100...
2011 Mar 18
1
[Patch suggestion] Adding 3rd arg to tempfile() to set extension
...y(op, args); - pattern = CAR(args); n1 = length(pattern); - tempdir = CADR(args); n2 = length(tempdir); + pattern = CAR(args); n1 = length(pattern); args = CDR(args); + tempdir = CAR(args); n2 = length(tempdir); args = CDR(args); + fileext = CAR(args); n3 = length(fileext); if (!isString(pattern)) error(_("invalid filename pattern")); if (!isString(tempdir)) error(_("invalid '%s' value"), "tempdir"); + if (!isString(fileext)) + error(_("invalid pattern for end-of-filename")); if (n1 < 1) error(_("no 'pat...
2019 Nov 01
3
R C api for 'inherits' S3 and S4 objects
...is is unfortunately not possible for S4 classes. I would kindly request new function in R C api so it can be achieved for S4 classes with no risk of allocation. For reference mentioned functions below. Thank you. Jan Gorecki // S3 inheritance bool INHERITS(SEXP x, SEXP char_) { SEXP klass; if (isString(klass = getAttrib(x, R_ClassSymbol))) { for (int i=0; i<LENGTH(klass); i++) { if (STRING_ELT(klass, i) == char_) return true; } } return false; } // S4 inheritance bool Rinherits(SEXP x, SEXP char_) { SEXP vec = PROTECT(ScalarString(char_)); SEXP call = PROTECT(lang3(sym_in...
2015 Mar 11
3
[LLVMdev] n-bit bytes for clang/llvm
...uiuc.edu/pipermail/llvmdev/2009-September/thread.html#26025 with the consensus seemingly being "quite doable, please get a good patch and submit". However the current code appears (to my neophyte eyes) to be explicitly 8-bit, e.g. one instance called out in the mail thread remains: /// isString - This method returns true if this is an array of i8. bool ConstantDataSequential::isString() const {   return isa<ArrayType>(getType()) && getElementType()->isIntegerTy(8); } I didn't find anything related beyond this mail thread such as a discussion of a patch but of course...
2010 Jul 16
2
[LLVMdev] Strange behavior when converting arrays to strings
...e null terminating character is added as part of the string and becomes the 11th character. This becomes a problem when the data is streamed out to a buffer because a NULL is inserted in the middle. Below is the code for getAsString: 1: std::string ConstantArray::getAsString() const { 2: assert(isString() && "Not a string!"); 3: std::string Result; 4: Result.reserve(getNumOperands()); 5: for (unsigned i = 0, e = getNumOperands(); i != e; ++i) 6: Result.push_back((char)cast<ConstantInt>(getOperand(i))->getZExtValue()); 7: return Result; 8: } I think tha...
2016 Sep 16
1
getGraphicsEvent() questions, minor feature/tweak request, and patch(es).
...its -------------- next part -------------- Index: src/main/gevents.c =================================================================== --- src/main/gevents.c (revision 71269) +++ src/main/gevents.c (working copy) @@ -135,7 +135,7 @@ checkArity(op, args); prompt = CAR(args); - if (!isString(prompt) || !length(prompt)) error(_("invalid prompt")); + if ((!isString(prompt) || !length(prompt)) && (TYPEOF(prompt) != LGLSXP || asChar(prompt) != R_NaString)) error(_("invalid prompt")); /* NB: cleanup of event handlers must be done by driver in onExit ha...
2019 Nov 01
4
[External] R C api for 'inherits' S3 and S4 objects
...unction in R > > C api so it can be achieved for S4 classes with no risk of allocation. > > For reference mentioned functions below. Thank you. > > Jan Gorecki > > > > // S3 inheritance > > bool INHERITS(SEXP x, SEXP char_) { > > SEXP klass; > > if (isString(klass = getAttrib(x, R_ClassSymbol))) { > > for (int i=0; i<LENGTH(klass); i++) { > > if (STRING_ELT(klass, i) == char_) return true; > > } > > } > > return false; > > } > > // S4 inheritance > > bool Rinherits(SEXP x, SEXP char_) { &g...
2017 May 22
2
DebugInfo, Metadata usage
...e analyzer\checker and want to implement checker for variables. In that case, I want to retrieve some information about types of variables or identify that the variable is either string or not. As an example, for strings which can be char or string type I came up with a solution to find it out via isString or isCString methods. But for strings whose type is wchar my approach is not working. Cause, internally in IR wchar string is an array of integers. I looked up some information about how to get types of variables that were got from the source level in IR level. (I've been reading some info in...
2007 Nov 19
1
(PR#10437) segfault on functions with 'source' attribute
I am not sure why you would want to do that, but the C code does assume source attributes were put there by R, and changing tests from !isNull to isString in a few places will fix that. If there is a character vector "source" attribute it should be used: that is the point of such attributes. On Mon, 19 Nov 2007, karl at huftis.org wrote: > Full_Name: Karl Ove Hufthammer > Version: 2.6.0 > OS: Linux (Fedora 7) > Submission f...
2005 Aug 22
2
RFC: "loop connections"
...new->private = (void*) malloc(sizeof(struct loopconn)); if(!new->private) { free(new->description); free(new->class); free(new); - error(_("allocation of text connection failed")); + error(_("allocation of loop connection failed")); + } + new->text = isString(data); + if (new->text) { + new->fgetc = &text_fgetc; + text_init(new, data); + } else { + new->read = &raw_read; + raw_init(new, data); } - text_init(new, text); return new; } -static void outtext_close(Rconnection con) +static void outloop_close(Rconnection...
2010 Jul 28
0
[LLVMdev] Strange behavior when converting arrays to strings
...e null terminating character is added as part of the string and becomes the 11th character. This becomes a problem when the data is streamed out to a buffer because a NULL is inserted in the middle. Below is the code for getAsString: 1: std::string ConstantArray::getAsString() const { 2: assert(isString() && "Not a string!"); 3: std::string Result; 4: Result.reserve(getNumOperands()); 5: for (unsigned i = 0, e = getNumOperands(); i != e; ++i) 6: Result.push_back((char)cast<ConstantInt>(getOperand(i))->getZExtValue()); 7: return Result; 8: } I think tha...
2017 May 24
2
DebugInfo, Metadata usage
...160) @_ZNSt3__15wcoutE, i32* getelementptr inbounds ([17 x i32], [17 x i32]* @.str.2, i32 0, i32 0)) to label %invoke.cont38 unwind label %lpad5, !dbg !5551 I'm digging around Verifier, Metadata, DebugInfo, though, it comes to me that I miss something Is it some design decision that isString method does not return TRUE for wide-character string? Should I do some additional analysis for constants(like collect meta for all instructions in all functions and build a map after)? Who knows sources where I could find some examples dealing with constants' metadata? And again, in advan...
2010 Jan 18
5
[LLVMdev] [patch] Union Types - work in progress
...type classification instead of enumerating the options. The ConstantUnion ctor or ConstantUnion::get should assert that the constant has type that matches one of the elements of the union. @@ -928,7 +949,7 @@ /// if the elements of the array are all ConstantInt's. bool ConstantArray::isString() const { // Check the element type for i8... - if (!getType()->getElementType()->isInteger(8)) + if (getType()->getElementType() != Type::getInt8Ty(getContext())) return false; // Check the elements to make sure they are all integers, not constant // expressions. Yo...
2014 Oct 17
1
Making parent.env<- an error for package namespaces and package imports
...orking copy) @@ -356,6 +356,24 @@ return( ENCLOS(arg) ); } +static Rboolean R_IsImportsEnv(SEXP env) +{ + if (isNull(env) || !isEnvironment(env)) + return FALSE; + if (ENCLOS(env) != R_BaseNamespace) + return FALSE; + SEXP name = getAttrib(env, R_NameSymbol); + if (!isString(name) || length(name) != 1) + return FALSE; + + const char *imports_prefix = "imports:"; + const char *name_string = CHAR(STRING_ELT(name, 0)); + if (!strncmp(name_string, imports_prefix, strlen(imports_prefix))) + return TRUE; + else + return FALSE; +} +...