search for: tcl_newbytearrayobj

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

2012 Jun 06
1
tcltk wish: Add tclObj.raw method for converting raw vectors to tclObj
...ne requested it), however there is no corresponding C routine for converting raw vectors into tclObj. I suppose the best way to do this is to create a new C routine in the tcltk package analogous to the other RObject to Tcl object routines: RTcl_ObjFromRawVector. Create a new tclObj pointer, use Tcl_NewByteArrayObj() from the Tcl C API to create a byte array of the same length as the input raw vector, and then loop through the RAWSXP object assigning each element in the vector to the Tcl byte array. I'd be happy to submit code for this patch if requested. This would be extremely helpful. I am using tcl b...
2018 Jul 01
2
[PATCH nbdkit] Add Tcl plugin, for writing plugins in Tcl.
...c_defined ("pwrite")) { + int r; + Tcl_Obj *h = handle, *cmd; + + cmd = Tcl_NewObj (); + Tcl_IncrRefCount (cmd); + Tcl_ListObjAppendElement (0, cmd, Tcl_NewStringObj ("pwrite", -1)); + Tcl_ListObjAppendElement (0, cmd, h); + Tcl_ListObjAppendElement (0, cmd, Tcl_NewByteArrayObj (buf, count)); + Tcl_ListObjAppendElement (0, cmd, Tcl_NewWideIntObj (offset)); + r = Tcl_EvalObjEx (interp, cmd, TCL_EVAL_DIRECT); + Tcl_DecrRefCount (cmd); + if (r != TCL_OK) { + nbdkit_error ("pwrite: %s", Tcl_GetStringResult (interp)); + return -1; + } + re...