chiark / gitweb /
mask-map nonoverlapping representation - wip (needs compile errors fixing and debuggi...
[chiark-tcl.git] / hbytes / hbytes.h
index b49301f02a935950b0c9a17c725ce395dde0671e..b4fcfb8d551a3481d4e357c5111983ca28075e5e 100644 (file)
  *               uint VARNAME/VALUE         (VARNAME if ul2bitfields;
  *               ulong VARNAME/VALUE         VALUE if bitfields2ul)
  *
+ * Mask maps:
+ *
+ *  A maskmap is a slightly efficient mapping from addresses to
+ *  arbitrary data values.  An address is a number of octets expressed
+ *  as an hbytes.  All the addresses covered by the same maskmap
+ *  should have the same length (even though constructing the maskmap
+ *  does not involve specifying that length).
+ *
  *  hbytes mask-map lookup MAP-VAR ADDRESS [DEFAULT]   => DATA
- *     error on missing default or if any prefix longer than address
+ *     Error on missing default or if any prefix longer than ADDRESS.
+ *
  *  hbytes mask-map amend MAP-VAR PREFIX PREFIX-LENGTH DATA
- *     a maskmap MAP is [list [list PREFIX PREFIX-LENGTH DATA]] sorted
- *     first by descending PREFIX-LENGTH and then by ascending PREFIX
- *     each PREFIX _in the map_ is truncated to the shortest number of
- *     pairs of hex digits which can represent it
+ *     Sets all of the addresses in PREFIX/PREFIX-LENGTH to the
+ *     relevant value.
+ *
+ *  Representation:
+ *     A maskmap MAP is [list [list PREFIX PREFIX-LENGTH DATA]].
+ *     The list is sorted by ascending PREFIX and entries do not overlap.
+ *     Each PREFIX in the map is truncated to the shortest number of
+ *     pairs of hex digits which can represent it.
  *
  * Error codes
  *
  * TUNTAP IFNAME LENGTH                tun/tap interface name too long
  * TUNTAP MTU OVERRUN                  tun/tap mtu limited to 2^16 bytes
  *
- * Refs: HMAC: RFC2104
- */
+ * Refs: HMAC: RFC2104 */
 
 #ifndef HBYTES_H
 #define HBYTES_H
@@ -202,15 +214,17 @@ void sockaddr_free(const SockAddr_Value*);
 typedef struct { /* semi-opaque - read only, and then only where commented */
   Tcl_Interp *ip; /* valid, non-0 and useable if set */
   Tcl_Obj *obj; /* non-0 iff set (but only test for 0/non-0) */
+  Tcl_Obj *xargs;
   int llength;
 } ScriptToInvoke;
 
 void scriptinv_init(ScriptToInvoke *si);
-int scriptinv_set(ScriptToInvoke *si, Tcl_Interp *ip, Tcl_Obj *newscript);
+int scriptinv_set(ScriptToInvoke *si, Tcl_Interp *ip,
+                 Tcl_Obj *newscript, Tcl_Obj *xargs);
 void scriptinv_cancel(ScriptToInvoke *si); /* then don't invoke */
   /* no separate free function - just cancel */
 
-void scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj **argv);
+void scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv);
 
 /* from idtable.c */