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=f2146a552c6dc23b1c3518ce7604a415c27ca09a;hp=2c6711a07210b265442d3048fc26a5b3adc7d502;hb=29d695bbfb0f42019af456fc8a7a3137e9745806;hpb=503f816f2157f764c7c93c873047aad4ca63e10d diff --git a/base/tables-examples.tct b/base/tables-examples.tct index 2c6711a..f2146a5 100644 --- a/base/tables-examples.tct +++ b/base/tables-examples.tct @@ -1,15 +1,57 @@ Type hb: HBytes_Value @ -Init hb @.start=0; @.end=0; +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,50 +60,102 @@ 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 -# length int -# => hb -# unappend -# v hbv -# length int -# => hb -# chopto -# v hbv -# length int -# => hb -# pkcs5 -# meth enum(PadMethod, "hbytes pad subcommand") -# obj ... -# blockcipher -# encrypt charfrom("de","encrypt/decrypt") -# v hbv -# alg enum(BlockCipherAlgInfo, "alg") -# 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 - -#Table padmethod PadMethod -# pa 1, 0 + unprepend + v hbv + length int + => hb + unappend + v hbv + length int + => hb + chopto + v hbv + length int + => hb + overwrite + v hbv + start int + sub hb + 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 + blockcipher + encrypt charfrom("de","encrypt/decrypt") + v hbv + alg enum(BlockCipherAlgInfo, "alg") + key obj + 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 obj + ?maclen obj + => hb -#EntryExtra PadMethod -# int pad, algname; +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