*
* hbytes range VALUE START SIZE => substring (or error)
* hbytes overwrite VAR START VALUE
+ * hbytes trimleft VALUE removes any leading 0 octets
* hbytes repeat VALUE COUNT => COUNT copies of VALUE
*
* hbytes h2ulong HEX => ulong (HEX len must be 4)
return TCL_OK;
}
+int do_hbytes_trimleft(ClientData cd, Tcl_Interp *ip, HBytes_Var v) {
+ const Byte *o, *p, *e;
+ o= p= hbytes_data(v.hb);
+ e= p + hbytes_len(v.hb);
+
+ while (p<e && !*p) p++;
+ if (p != o)
+ hbytes_unprepend(v.hb, p-o);
+
+ return TCL_OK;
+}
+
int do_hbytes_repeat(ClientData cd, Tcl_Interp *ip,
HBytes_Value sub, int count, HBytes_Value *result) {
int sub_l;
v hbv
start int
sub hb
+ trimleft
+ v hbv
zeroes
length int
=> hb
*
* hbytes range VALUE START SIZE => substring (or error)
* hbytes overwrite VAR START VALUE
+ * hbytes trimleft VALUE removes any leading 0 octets
* hbytes repeat VALUE COUNT => COUNT copies of VALUE
*
* hbytes h2ulong HEX => ulong (HEX len must be 4)
return TCL_OK;
}
+int do_hbytes_trimleft(ClientData cd, Tcl_Interp *ip, HBytes_Var v) {
+ const Byte *o, *p, *e;
+ o= p= hbytes_data(v.hb);
+ e= p + hbytes_len(v.hb);
+
+ while (p<e && !*p) p++;
+ if (p != o)
+ hbytes_unprepend(v.hb, p-o);
+
+ return TCL_OK;
+}
+
int do_hbytes_repeat(ClientData cd, Tcl_Interp *ip,
HBytes_Value sub, int count, HBytes_Value *result) {
int sub_l;