search for: unwrap

Displaying 20 results from an estimated 223 matches for "unwrap".

2019 Jul 31
0
Re: [PATCH] Rust bindings: Implement Event features
...this test -- it's just a single-threaded test with just one handle. > + { > + let mut g = guestfs::Handle::create().expect("create"); > + g.set_event_callback( > + |_, _, _, _| { > + let mut data = (&close_invoked).lock().unwrap(); > + *data += 1; > + }, > + &[guestfs::Event::Close], > + ) > + .unwrap(); Check that the close_invoked count is still 0 before the block ending. > diff --git a/rust/tests/420_log_messages.rs b/rust/tests/420_log_messages....
2020 Apr 15
2
question on the signature of malloc
Hi all, consider the following function from Core.cpp in LLVM 9.0.0: LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef B, LLVMTypeRef Ty, const char *Name) { Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty)); AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), ITy, u...
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
...single-threaded test with just one handle. > > > + { > > + let mut g = guestfs::Handle::create().expect("create"); > > + g.set_event_callback( > > + |_, _, _, _| { > > + let mut data = (&close_invoked).lock().unwrap(); > > + *data += 1; > > + }, > > + &[guestfs::Event::Close], > > + ) > > + .unwrap(); > > Check that the close_invoked count is still 0 before the block ending. > > > diff --git a/rust/tests/420_log...
2019 Jul 30
4
[PATCH] Rust bindings: Implement Event features
...s_error(), operation) +} + +impl<'a> base::Handle<'a> { pub(crate) fn get_error_from_handle(&self, operation: &'static str) -> Error { let c_msg = unsafe { guestfs_last_error(self.g) }; let message = unsafe { utils::char_ptr_to_string(c_msg).unwrap() }; diff --git a/rust/src/event.rs b/rust/src/event.rs new file mode 100644 index 000000000..942feec69 --- /dev/null +++ b/rust/src/event.rs @@ -0,0 +1,158 @@ +/* libguestfs Rust bindings + * Copyright (C) 2019 Hiroyuki Katsura <hiroyuki.katsura.0513@gmail.com> + * + * This library is free s...
2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
..." could not create handle {:?}", e)), + }; + g.set_event_callback( + |e, _, _, _| match e { + Event::Close => print!("c"), + _ => print!("o"), + }, + &EVENT_ALL, + ) + .unwrap(); + let eh = g + .set_event_callback(|_, _, _, _| print!("n"), &EVENT_ALL) + .unwrap(); + g.set_trace(true).unwrap(); + g.delete_event_callback(eh).unwrap(); + g.set_trace(false).unwrap(); + } + let _v = vec![0; 1024 * 1024]; +...
2015 Jul 25
4
[LLVMdev] [un]wrapping llvm:DITypeRef
In trying to write a C binding for DIBuilder of llvm 3.6.1, I can't see a way to unwrap llvm::DITypeRef, declared in include/llvm/IR/DebugInfo.h. This is a class with one data member, a pointer to Metadata. If I try to make my C type a struct with one pointer, I can't cast it to DITypeRef. If I try to go inside the classes and use the pointer, I can cast, but can't construct...
2008 Mar 27
4
dsl_dataset_t pointer during ''zfs create'' changes
I''ve noticed that the dsl_dataset_t that points to a given dataset changes during the life time of a ''zfs create'' command. We start out with one dsl_dataset_t* during dmu_objset_create_sync() but by the time we are later mounting the dataset we have a different in memory dsl_dataset_t* referring to the same dataset. This causes me a big issue with per dataset
2008 May 18
1
[LLVMdev] Duplicate wrapper function in LLVM-C.
Hi (Gordon). There appears to be two wrapper functions for DerivedType::refineAbstractTypeTo() in llvm-c (Core.h, Core.cpp): void LLVMRefineAbstractType(LLVMTypeRef AbstractType, LLVMTypeRef ConcreteType){ DerivedType *Ty = unwrap<DerivedType>(AbstractType); Ty->refineAbstractTypeTo(unwrap(ConcreteType)); } void LLVMRefineType(LLVMTypeRef AbstractTy, LLVMTypeRef ConcreteTy) { unwrap<DerivedType>(AbstractTy)->refineAbstractTypeTo(unwrap(ConcreteTy)); } The attached patch removes the first one. Regards...
2019 Apr 24
2
[DebugInfo] DWARF C API
...ains all DWARF DIEs in the object file. For this I used ``` DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DWARFContext, LLVMDWARFContextRef) ``` then defined some C functions ``` LLVMDWARFContextRef LLVMCreateDWARFContext(LLVMBinaryRef Bin) { std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(*unwrap(Bin)); return wrap(DICtx.release()); } void LLVMPrintDWARFContext(LLVMDWARFContextRef C) { DIDumpOptions DumpOpts; DumpOpts.DumpType = DIDT_DebugInfo; // I only care about the .debug_info section unwrap(C)->dump(outs(), DumpOpts); } ``` However, I got a segfault when trying to dump the...
2015 Jul 26
0
[LLVMdev] [un]wrapping llvm:DITypeRef
On Sun, 26 Jul 2015 at 06:48 Rodney M. Bates <rodney_bates at lcwb.coop> wrote: > In trying to write a C binding for DIBuilder of llvm 3.6.1, I can't see a > way to unwrap > llvm::DITypeRef, declared in include/llvm/IR/DebugInfo.h. This is a class > with one > data member, a pointer to Metadata. > > If I try to make my C type a struct with one pointer, I can't cast it to > DITypeRef. > If I try to go inside the classes and use the pointer, I...
2015 Jul 27
2
[LLVMdev] [un]wrapping llvm:DITypeRef
On 07/25/2015 08:57 PM, Andrew Wilkins wrote: > On Sun, 26 Jul 2015 at 06:48 Rodney M. Bates <rodney_bates at lcwb.coop <mailto:rodney_bates at lcwb.coop>> wrote: > > In trying to write a C binding for DIBuilder of llvm 3.6.1, I can't see a way to unwrap > llvm::DITypeRef, declared in include/llvm/IR/DebugInfo.h. This is a class with one > data member, a pointer to Metadata. > > If I try to make my C type a struct with one pointer, I can't cast it to DITypeRef. > If I try to go inside the classes and use the poin...
2008 Apr 26
0
[LLVMdev] ParamAttr Patch - Alignment fix
...e <cstdlib> > #include <cstring> > @@ -798,6 +799,101 @@ > return wrap(--I); > } > > +void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr Param) { Rename Param -> Attr or PA or something. > + LLVMParamAttr P = (LLVMParamAttr)Param; > + Argument *A = unwrap<Argument>(Arg); > + > + switch (P) { > + case LLVMByValParamAttr: > + A->setByValAttr(true); > + break; > + case LLVMNoAliasParamAttr: > + A->setNoAliasAttr(true); > + break; > + case LLVMStructRetParamAttr: > + A->setS...
2008 Apr 24
2
[LLVMdev] ParamAttr Patch - Alignment fix
Hi.. Updated so you now set alignment through LLVMInstrSetAlignment. Anders Johnsen -------------- next part -------------- A non-text attachment was scrubbed... Name: ParamAttr.patch Type: text/x-diff Size: 7420 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080424/cb72b4bb/attachment.patch>
2019 Apr 24
2
[DebugInfo] DWARF C API
...tion const&, llvm::DWARFSectionKind) (DWARFUnit.cpp:44) by 0x5000AAE: llvm::DWARFContext::parseNormalUnits()::{lambda(llvm::DWARFSection const&)#1}::operator()(llvm::DWARFSection const&) const (DWARFContext.cpp:881) However, I can't see how this error can relate to the wrapping/unwrapping macros generating C structure? Thanks a lot for your time Son Tuan Vu On Wed, Apr 24, 2019 at 11:03 PM David Blaikie <dblaikie at gmail.com> wrote: > Might be worth running under valgrind or the LLVM sanitizers? (could > help diagnose what's going wrong more specifically th...
2008 Apr 26
2
[LLVMdev] ParamAttr Patch - Alignment fix
...> > @@ -798,6 +799,101 @@ > > return wrap(--I); > > } > > > > +void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr Param) { > > Rename Param -> Attr or PA or something. > > > + LLVMParamAttr P = (LLVMParamAttr)Param; > > + Argument *A = unwrap<Argument>(Arg); > > + > > + switch (P) { > > + case LLVMByValParamAttr: > > + A->setByValAttr(true); > > + break; > > + case LLVMNoAliasParamAttr: > > + A->setNoAliasAttr(true); > > + break; > > + case L...
2015 Jul 27
0
[LLVMdev] [un]wrapping llvm:DITypeRef
...> > On 07/25/2015 08:57 PM, Andrew Wilkins wrote: >> On Sun, 26 Jul 2015 at 06:48 Rodney M. Bates <rodney_bates at lcwb.coop <mailto:rodney_bates at lcwb.coop>> wrote: >> >> In trying to write a C binding for DIBuilder of llvm 3.6.1, I can't see a way to unwrap >> llvm::DITypeRef, declared in include/llvm/IR/DebugInfo.h. This is a class with one >> data member, a pointer to Metadata. >> >> If I try to make my C type a struct with one pointer, I can't cast it to DITypeRef. >> If I try to go inside the clas...
2007 Apr 09
5
Python plugin (Python API for Compiz)
Here is my python loader plugin which loads plain python scripts as full plugins. There is not much documentation, but I have included a few examples to get you going. triangle - Just a basic plugin which shows a triangle on a button press. This shows using ctypes to pass values from compiz to the python opengl bindings. basiczoom - Zooms in on the screen (basically) inactive - This is a port
2003 Apr 25
6
Wildcard TDM400P (TDM40B) connectors
Hi, I'm no phone guy but I've been having quite a bit of fun messing with Asterisk. I just unwrapped my new Wildcard TDM400P (TDM40B) which is the new 4 port FXS PCI card. It has 4 RJ45 connectors and I'd like to hookup 4 regular phones which are RJ11. If I crip RJ45 connectors to the phone cords do I simple use the center two pins (pins 4 and 5)? Thanks, Randy Smith Tiger Mountain Te...
2015 Jul 28
0
[LLVMdev] [un]wrapping llvm:DITypeRef
> On 2015-Jul-25, at 15:44, Rodney M. Bates <rodney_bates at lcwb.coop> wrote: > > In trying to write a C binding for DIBuilder of llvm 3.6.1, I can't see a way to unwrap > llvm::DITypeRef, declared in include/llvm/IR/DebugInfo.h. This is a class with one > data member, a pointer to Metadata. > > If I try to make my C type a struct with one pointer, I can't cast it to DITypeRef. > If I try to go inside the classes and use the pointer, I can cast...
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...) -> 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 struct_list<T, S: convert::From&...