chiark / gitweb /
mask-map amend implemented, but untested
[chiark-tcl.git] / base / tables-examples.tct
index 1a02eb6..9165827 100644 (file)
@@ -2,8 +2,14 @@ Type hb:                       HBytes_Value @
 Init hb                                hbytes_sentinel(&@);
 
 Type hbv:                      HBytes_Var @
-Init hbv                       @.hb=0; @.obj=0; @.var=0; @.copied=0;
-Fini hbv                       fini_hbv(ip, rc, &@);
+Init hbv                       @.hb=0; init_somethingv(&@.sth);
+Fini hbv                       fini_somethingv(ip, rc, &@.sth);
+
+Type constv(Tcl_ObjType*):     Tcl_Obj *@
+
+Type maskmapv:                 MaskMap_Var @
+Init maskmapv                  @.mm=0; init_somethingv(&@.sth);
+Fini maskmapv                  fini_somethingv(ip, rc, &@.sth);
 
 Type sockaddr:                 SockAddr_Value @
 Init sockaddr                  sockaddr_clear(&@);
@@ -13,6 +19,8 @@ Type ulong:                   uint32_t @
 Type long:                     long @
 Type string:                   const char *@
 
+Type charfrom(const char *opts, const char *what):     int
+
 H-Include      "hbytes.h"
 
 Table toplevel TopLevel_Command
@@ -22,13 +30,25 @@ Table toplevel TopLevel_Command
        dgram-socket
                subcmd  enum(DgramSocket_SubCommand,"dgram-socket subcommand")
                ...     obj
-       tuntap-socket
-               subcmd  enum(TunSocket_SubCommand,"tuntap-socket subcommand")
-               ...     obj
+       tuntap-socket-raw
+           subcmd enum(TunSocket_SubCommand,"tuntap-socket-raw subcommand")
+           ... obj
        ulong
                subcmd  enum(ULong_SubCommand,"ulong subcommand")
                ...     obj
 
+Table maskmap MaskMap_SubCommand
+       lookup
+               map     constv(&maskmap_type)
+               addr    hb
+               ?def    obj
+               =>      obj
+       amend
+               map     maskmapv
+               prefix  obj
+               preflen obj
+               data    obj
+
 Table ulong ULong_SubCommand
        ul2int
                v       ulong
@@ -161,6 +181,9 @@ Table hbytes HBytes_SubCommand
                prop    enum(HashAlgPropInfo, "prop")
                alg     enum(HashAlgInfo, "alg")
                =>      int
+       mask-map
+               subcmd  enum(MaskMap_SubCommand, "hbytes mask-map subcommand")
+               ...     obj
 
 Table padmethodinfo PadMethodInfo
        pkcs5
@@ -183,7 +206,7 @@ Table dgram_socket DgramSocket_SubCommand
                sock    iddata(&dgram_socks)
                ?script obj
 
-Table tuntap_socket TunSocket_SubCommand
+Table tuntap_socket_raw TunSocket_SubCommand
        create
                ?ifname string
                =>      iddata(&tuntap_socks)