X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl.git;a=blobdiff_plain;f=base%2Ftables-examples.tct;h=d2e00384f7af16f552ff4c2f2d5c140336892be3;hp=922f844ac4e47938078ea99abd78184e63182a14;hb=07876950ceee6d28473f347ad2f0c4422c266e32;hpb=aa983421528c717a29c402c0cb4c8438b96fd860 diff --git a/base/tables-examples.tct b/base/tables-examples.tct index 922f844..d2e0038 100644 --- a/base/tables-examples.tct +++ b/base/tables-examples.tct @@ -1,15 +1,57 @@ Type hb: HBytes_Value @ Init hb hbytes_sentinel(&@); + Type hbv: HBytes_Var @ Init hbv @.hb=0; @.obj=0; @.var=0; Fini hbv fini_hbv(ip, rc, &@); +Type sockaddr: SockAddr_Value @ +Init sockaddr sockaddr_clear(&@); + +Type sockid: DgramSockID @ +Type ulong: unsigned long @ + H-Include "hbytes.h" -Untabled +Table toplevel TopLevel_Command hbytes subcmd enum(HBytes_SubCommand, "hbytes subcommand") - obj ... + ... obj + dgram-socket + subcmd enum(DgramSocket_SubCommand,"dgram-socket subcommand") + ... obj + ulong + subcmd enum(ULong_SubCommand,"ulong subcommand") + ... obj + +Table ulong ULong_SubCommand + shift + right charfrom("lr", "shift direction") + v ulong + bits int + => ulong + mask + a ulong + b ulong + => ulong + compare + a ulong + b ulong + => int + ul2int + v ulong + => int + int2ul + v int + => ulong + ul2bitfields + value ulong + ... obj + => int + bitfields2ul + base ulong + ... obj + => ulong Table hbytes HBytes_SubCommand raw2h @@ -18,20 +60,41 @@ Table hbytes HBytes_SubCommand h2raw hex hb => obj + ulong2h + value ulong + => hb + h2ulong + hex hb + => ulong + ushort2h + value ulong + => hb + h2ushort + hex hb + => ulong length v hb => int + compare + a hb + b hb + => int + range + v hb + start int + size int + => hb prepend v hbv - str ... + ... str append v hbv - str ... + ... str rep-info v obj => obj concat - str ... + ... str => hb unprepend v hbv @@ -45,12 +108,28 @@ Table hbytes HBytes_SubCommand v hbv length int => hb + overwrite + v hbv + start int + sub hb + trimleft + v hbv + zeroes + length int + => hb + repeat + v hb + count int + => hb + random + length int + => hb pkcs5 meth enum(PadMethod, "hbytes pad subcommand") v hbv block obj => int - blockciph + blockcipher encrypt charfrom("de","encrypt/decrypt") v hbv alg enum(BlockCipherAlgInfo, "alg") @@ -58,13 +137,27 @@ Table hbytes HBytes_SubCommand mode enum(BlockCipherModeInfo, "mode") ?iv hb => hb -# hash -# alg enum(HashAlgInfo, "hash alg") -# message hb -# => hb -# hmac -# alg enum(HashAlgInfo, "hash alg for hmac") -# message hb -# key hb -# maclen int -# => hb + hash + alg enum(HashAlgInfo, "hash alg") + message hb + => hb + hmac + alg enum(HashAlgInfo, "hash alg for hmac") + message hb + key obj + ?maclen obj + => hb + +Table dgram_socket DgramSocket_SubCommand + create + local sockaddr + => sockid + close + sock sockid + transmit + sock sockid + data hb + remote sockaddr + on-receive + sock sockid + ?script obj