* hbytes chopto VAR NEWVARLENGTH => suffix (removed from VAR)
* (too short? error)
*
+ * hbytes range VALUE START SIZE => substring (or error)
+ *
* hbytes compare A B
* => -2 A is lexically earlier than B and not a prefix of B (A<B)
* -1 A is prefix of B but not equal (A<B)
return TCL_OK;
}
+int do_hbytes_range(ClientData cd, Tcl_Interp *ip,
+ HBytes_Value v, int start, int size,
+ HBytes_Value *result) {
+ const Byte *data;
+ int l;
+
+ l= hbytes_len(&v);
+ if (start<0 || size<0 || l<start+size)
+ return staticerr(ip, "hbytes range subscripts out of range");
+
+ data= hbytes_data(&v);
+ hbytes_array(result, data+start, size);
+ return TCL_OK;
+}
+
int do__hbytes(ClientData cd, Tcl_Interp *ip,
const HBytes_SubCommand *subcmd,
int objc, Tcl_Obj *const *objv) {
a hb
b hb
=> int
+ range
+ v hb
+ start int
+ size int
+ => hb
prepend
v hbv
str ...
* hbytes chopto VAR NEWVARLENGTH => suffix (removed from VAR)
* (too short? error)
*
+ * hbytes range VALUE START SIZE => substring (or error)
+ *
* hbytes compare A B
* => -2 A is lexically earlier than B and not a prefix of B (A<B)
* -1 A is prefix of B but not equal (A<B)
return TCL_OK;
}
+int do_hbytes_range(ClientData cd, Tcl_Interp *ip,
+ HBytes_Value v, int start, int size,
+ HBytes_Value *result) {
+ const Byte *data;
+ int l;
+
+ l= hbytes_len(&v);
+ if (start<0 || size<0 || l<start+size)
+ return staticerr(ip, "hbytes range subscripts out of range");
+
+ data= hbytes_data(&v);
+ hbytes_array(result, data+start, size);
+ return TCL_OK;
+}
+
int do__hbytes(ClientData cd, Tcl_Interp *ip,
const HBytes_SubCommand *subcmd,
int objc, Tcl_Obj *const *objv) {