X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=base%2Fchiark-tcl.h;h=ce00dd9537128a56d8227adc73c6d3eaa125328d;hb=07876950ceee6d28473f347ad2f0c4422c266e32;hp=4422d328c99e3914243f76a7174b376f6b90e809;hpb=12cb589d468d6c93b04dfabe645ce761a81c5328;p=chiark-tcl.git diff --git a/base/chiark-tcl.h b/base/chiark-tcl.h index 4422d32..ce00dd9 100644 --- a/base/chiark-tcl.h +++ b/base/chiark-tcl.h @@ -13,6 +13,31 @@ * 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 trimleft VALUE removes any leading 0 octets + * 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