Displaying 20 results from an estimated 70 matches for "cstr".
Did you mean:
xcstr
2012 Apr 28
2
Character string to R object
I've been creating some R tools that manipulate objective functions for optimization. In
so doing, I create a character string with R code, and then want to have it in my
workspace. Currently -- and this works fine -- I write the code out, then use source() to
bring it in again. Example:
cstr<-"jack<-function(x){\n cat(\"Silly x:\")\n print(x) \n }\n"
write(cstr, file='tfile.txt')
jack<-source('tfile.txt')$value # You need the value element!
print(jack)
However, I feel it would be more elegant if I could avoid the file, and am sure I must...
2005 Jan 31
1
[LLVMdev] Question about Global Variable
Hi,
Sorry for bothering you guys again.
I got problem when I am trying to recover the Global Variable Initial value. What I did is like the following
ConstantArray *Cstr = dyn_cast<ConstantArray>(gI->getInitializer());
// the above instruction enable me to get the content of initial string of global variable, like char a[10] ="test global";
And then I make some change for the Cstr and write it back to the global variable by gI->setInitialize...
2004 Oct 12
1
[LLVMdev] Re: Hide visible string in variable (Chris Lattner)
...>
> 1. Read the string data as a constant (It's an instance of ConstantArray,
> which you get form the Globalvaraible with getInitializer() as you are
> doing.
Following your suggestion, I got some progress. Thanks again. But I am still stuck in some problems.
Constant *Cstr = GV->getInitializer();
After that, I tried to use
a.
for(unsigned i=0;i<Cstr->getNumOperands();++i){
Cstr->getOperand(i);
}
b. for(User::op_iterator I=Cstr->op_begin(),E=Cstr->op_end(); I!=E;++I){
std::cerr<<*I;...
2004 Dec 09
1
[LLVMdev] Question about insert call func with pionter parameter
Hi,
I got a problem when I am trying to insert a call function with pointer arguments.
The function C proto-type is the following,
void stat_func(char *);
>ConstantArray *Cstr = dyn_cast<ConstantArray>(gI->getInitializer());
......
>Function *exFunc = M->getOrInsertFunction("stat_func", Type::VoidTy, PointerType::get(Type::SByteTy),0);
>std::vector<Value*> Args(1);
>Args[0] = constantArray::get(Cstr->getAsString());
>CallInst *...
2004 Oct 19
1
[LLVMdev] Re:question about Insert callInst to call a function in library
...randKey =(gI->getInitializer());
}
}
}
void DecodeStr::DecodeString(Module *M){
std::cerr<<"filename "<<M->getModuleIdentifier()<<endl;
for(Module::giterator gI = M->gbegin(),gE=M->gend();gI!=gE;++gI){
unsigned i=0;
if(ConstantArray *Cstr = dyn_cast<ConstantArray>(gI->getInitializer())){
if(Cstr->getType()->getElementType()->isInteger())
{
std::vector<Constant*> HideString;
Constant *Key=ConstantInt::get(Cstr->getType()->getElementType(),randKey);
for(unsigned i=0;i<Cstr->getNumO...
2019 Dec 04
2
Rootless wiki page is not up to date?
If I run a docker image with the mesos containerizer and altering the
dovecot config mentioned here[1]
I think the root detection is incorrect because it looks like dovecot is
still thinking it is root. I still get errors like:
>> log(829825): Fatal: We couldn't drop root group privileges
(wanted=10053(dovecot), gid=0(root), egid=0(root))
Why does it want to drop to root, if we
2004 Jul 07
9
Windows 2K outperform Linux/Samba very much?
...ollow VB program to compute the time when check files' property
Operation System:
Windows 2000 professional
// ...
Set objFSO = CreateObject("Scripting.FileSystemObject")
thistime = thisnow
If objFSO.FileExists(fn) Then
totle = totle & "Check file time " & CStr(thisnow - thistime) + " ms" + vbCrLf
thistime = thisnow
Set objFile = objFSO.GetFile(fn)
totle = totle & "Get object time " & CStr(thisnow - thistime) + " ms" + vbCrLf
thistime = thisnow
temp = DateValue(CStr(objFile.DateLastModified))
totle = totle...
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...self.current >= self.list.size {
+ None
+ } else {
+ let elem = unsafe { self.list.ptr.offset(self.current as isize) };
+ self.current += 1;
+ Some(elem)
+ }
+ }
+}
+
+fn arg_string_list(v: &[&str]) -> Result<Vec<ffi::CString>, Error> {
let mut w = Vec::new();
for x in v.iter() {
let y: &str = x;
- let s = ffi::CString::new(y).unwrap();
- w.push(s.as_ptr());
+ w.push(ffi::CString::new(y)?);
+ }
+ Ok(w)
+}
+
+fn free_string_list(l: *const *const c_char) {
+ fo...
2020 Aug 19
0
/usr/include/dovecot/str.h
FYI, I am building on alpine 3.10 and 3.11 I am getting this build[1]
error. I think these header files of dovecot are not correct. Or are
they?
I changed line 35 in /usr/include/dovecot/str.h
from
str_append_max(str, cstr, max_len);
to
str_append_max(str, (const char *)cstr, max_len);
[1]
/usr/include/dovecot/str.h: In function 'void str_append_n(string_t*,
const void*, size_t)':
/usr/include/dovecot/str.h:35:22: error: invalid conversion from 'const
void*' to 'const char*' [-fpermissive...
2007 Nov 30
0
[LLVMdev] GC patches again
...the implementation can be tuned later.
About the interface:
+ PooledStringPtr intern(const std::string &Str);
Instead of taking an std::string, please provide two versions:
PooledStringPtr intern(const char *StrStart, const char *StrEnd);
and:
PooledStringPtr intern(const char *CStr) { return intern(CStr,
CStr+strlen(CStr); }
This discourages string abuse/copying: std::string is not very
efficient.
Also, in PooledStringPtr, please make the accessor not return an
std::string.
//===-- gc-5-funattr.patch (+120 -47) -------------------------===//
Adds these methods to F...
2005 Feb 02
1
[LLVMdev] RE: Question about Global Variable
Thanks for your reply.
After I change Cstr to gI, it compiled successfully. Thanks again.
Another question is for constructing getelementpt.
// C code
char gStrA[10] = "test str"; // here is Global variable,gStrA and initializer "test str"
char gStrB[10]= "test str2";
main(){
int = i;
char *pGVars[20...
2015 Sep 14
2
TableGen MCInstrDesc Instruction Size Zero
Dear all,
I am trying to write an AsmParser and a CodeEmitter for simple ADD
instruction.
Here is what I have in the TestGenInstrInfo.td:
*extern const MCInstrDesc TestInsts[] = {...{ 23, 3, 1, 0, 0, 0, 0x0ULL,
nullptr, nullptr, OperandInfo13, 0, nullptr }, // Inst #23 = ADD8_rr...}*
I parse the instruction successfully but I am not sure what I did wrong
that the Size (as you can see in
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...ashmap (l: *const *const c_char) -> collections::HashMap<String, String> {
+ let mut map = collections::HashMap::new();
+ let mut iter = NullTerminatedIter::new(l);
+ while let Some(key) = iter.next() {
+ if let Some(val) = iter.next() {
+ let key = unsafe { ffi::CStr::from_ptr(key) }.to_str().unwrap();
+ let val = unsafe { ffi::CStr::from_ptr(val) }.to_str().unwrap();
+ map.insert(key.to_string(), val.to_string());
+ } else {
+ panic!(\"odd number of items in hash table\");
+ }
+ }
+ map
+}
+
+fn st...
2024 Jun 18
1
[PATCH v2 3/8] rust: drm: add driver abstractions
...ex 000000000000..cd594a32f9e4
--- /dev/null
+++ b/rust/kernel/drm/drv.rs
@@ -0,0 +1,141 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+//! DRM driver core.
+//!
+//! C header: [`include/linux/drm/drm_drv.h`](srctree/include/linux/drm/drm_drv.h)
+
+use crate::{bindings, drm, private::Sealed, str::CStr, types::ForeignOwnable};
+use macros::vtable;
+
+/// Driver use the GEM memory manager. This should be set for all modern drivers.
+pub const FEAT_GEM: u32 = bindings::drm_driver_feature_DRIVER_GEM;
+/// Driver supports mode setting interfaces (KMS).
+pub const FEAT_MODESET: u32 = bindings::drm_dri...
2024 Sep 02
2
[PATCH v2 3/8] rust: drm: add driver abstractions
...gt; +++ b/rust/kernel/drm/drv.rs
> @@ -0,0 +1,141 @@
> +// SPDX-License-Identifier: GPL-2.0 OR MIT
> +
> +//! DRM driver core.
> +//!
> +//! C header: [`include/linux/drm/drm_drv.h`](srctree/include/linux/drm/drm_drv.h)
> +
> +use crate::{bindings, drm, private::Sealed, str::CStr, types::ForeignOwnable};
> +use macros::vtable;
> +
> +/// Driver use the GEM memory manager. This should be set for all modern drivers.
> +pub const FEAT_GEM: u32 = bindings::drm_driver_feature_DRIVER_GEM;
> +/// Driver supports mode setting interfaces (KMS).
> +pub const FEAT_MO...
2019 Jun 27
4
Re: [PATCH 9/9] Rust bindings: Complete bindings
Patch 9 is a kind of dumping ground of all kinds of stuff. It may be
better to spend some time with git rebase -i trying to work this into
more coherent patches.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live
2012 Apr 05
0
[LLVMdev] Difference between 2.9 and 3.0 in intel ASM printer
...8] c"data.u\00"
@g_touch_window_y = global i32 0
@_language_text = global %string zeroinitializer
@"Hello\00" = internal constant [6 x i8] c"Hello\00"
@is_foreign_lang = global i1 false
@"english\00" = internal constant [8 x i8] c"english\00"
@"cstr\00" = internal constant [5 x i8] c"cstr\00"
declare %string* @to__PZ6string__PKc(i8*) nounwind
declare void @AddPointer__v__iPKci(i32, i8*, i32) nounwind
declare void @dL__v__PZ6string(%string*) nounwind
declare zeroext i1 @ne__b__PZ6stringPZ6string(%string*, %string*) nounwind...
2019 Jul 07
2
[libnbd PATCH] RFC: Add bindings for Rust language
...; return Err(NbdError::from_libnbd());";
+ "}";
+ ]
+ in
+ let trans =
+ match ret with
+ | RBool
+ | RErr
+ | RFd
+ | RInt
+ | RInt64 -> []
+ | RConstString -> [
+ "let ret = unsafe { CStr::from_ptr(ret) };";
+ "let ret = ret.to_str().unwrap();";
+ ]
+ | RString -> [
+ "let c_str = unsafe { CStr::from_ptr(ret as *const c_char) };";
+ "let ret = c_str.to_string_lossy().into_owned();";
+ &...
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...+ }
}
}
@@ -193,60 +198,81 @@ impl<'a, T> Iterator for RawListIter<'a, T> {
}
}
-
-fn arg_string_list (v: &Vec<&str>) -> Vec<*const i8> {
- let length = v.len();
+fn arg_string_list(v: &[&str]) -> Result<Vec<ffi::CString>, Error> {
let mut w = Vec::new();
for x in v.iter() {
let y: &str = x;
- let s = ffi::CString::new(y).unwrap();
- w.push(s.as_ptr());
+ w.push(ffi::CString::new(y)?);
+ }
+ Ok(w)
+}
+
+fn free_string_list(l: *const *const c_char) {
+ fo...
2004 Jun 08
5
fast mkChar
Hi,
To speed up reading of large (few million lines) CSV files I am writing
custom read functions (in C). By timing various approaches I figured out
that one of the bottlenecks in reading character fields is the mkChar()
function which on each call incurs a lot of garbage-collection-related
overhead.
I wonder if there is a "vectorized" version of mkChar, say mkChar2(char
**, int