X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=hbytes%2Fhbytes.h;h=23cad209c11840758e99052d62198efd632bca04;hb=29d695bbfb0f42019af456fc8a7a3137e9745806;hp=4422d328c99e3914243f76a7174b376f6b90e809;hpb=12cb589d468d6c93b04dfabe645ce761a81c5328;p=chiark-tcl.git diff --git a/hbytes/hbytes.h b/hbytes/hbytes.h index 4422d32..23cad20 100644 --- a/hbytes/hbytes.h +++ b/hbytes/hbytes.h @@ -13,6 +13,30 @@ * hbytes chopto VAR NEWVARLENGTH => suffix (removed from VAR) * (too short? error) * + * hbytes range VALUE START SIZE => substring (or error) + * hbytes overwrite VAR START VALUE + * hbytes repeat VALUE COUNT => COUNT copies of VALUE + * + * hbytes h2ulong HEX => ulong (HEX len must be 4) + * hbytes ulong2h UL => hex + * + * ulong ul2bitfields VALUE [SIZE TYPE [TYPE-ARG...] ...] => 0/1 + * ulong bitfields2ul BASE [SIZE TYPE [TYPE-ARG...] ...] => ULONG + * goes from left (MSbit) to right (LSbit) where + * SIZE is size in bits + * TYPE [TYPE-ARGS...] is as below + * zero + * ignore + * fixed ULONG-VALUE + * uint VARNAME/VALUE (VARNAME if ul2bitfields; + * ulong VARNAME/VALUE VALUE if bitfields2ul) + * + * ulong ul2int ULONG => INT can fail if >INT_MAX + * ulong int2ul INT => ULONG can fail if <0 + * + * hbytes shift l|r ULONG BITS fails if BITS >32 + * hbytes mask A B => A & B + * * hbytes compare A B * => -2 A is lexically earlier than B and not a prefix of B (A