search for: tcl_getbytearrayfromobj

Displaying 2 results from an estimated 2 matches for "tcl_getbytearrayfromobj".

2009 Jun 15
0
Wishlist: as.raw [or similar] support for tcl strings (PR#13758)
...indeed have the NULLs: > .Tcl("binary scan $tcls H* tmps") <Tcl> 1 > tclvalue("tmps") [1] "48657265206172652031004865726520697320320000416e642066696e616c6c79207468726565000000" I would naively suggest something like tclrawvalue() and/or as.raw() utilizing Tcl_GetByteArrayFromObj A good discussion of the basics of this issue for general tcl embedding can be found here: http://www2.tcl.tk/1180 For those who might be wondering "what the heck are you doing trying to pass binary data from tcl?", the answer is that non-blocking I/O does not work on windows, and timeo...
2018 Jul 01
2
[PATCH nbdkit] Add Tcl plugin, for writing plugins in Tcl.
...jAppendElement (0, cmd, Tcl_NewWideIntObj (offset)); + r = Tcl_EvalObjEx (interp, cmd, TCL_EVAL_DIRECT); + Tcl_DecrRefCount (cmd); + if (r != TCL_OK) { + nbdkit_error ("pread: %s", Tcl_GetStringResult (interp)); + return -1; + } + + res = Tcl_GetObjResult (interp); + res_bin = Tcl_GetByteArrayFromObj (res, &res_len); + if (res_len < count) { + nbdkit_error ("pread: buffer returned from pread is too small"); + return -1; + } + + memcpy (buf, res_bin, count); + return 0; +} + +static int +tcl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) +{ +...