chiark / gitweb /
working on new addrmap instead of maskmap - compiles, but have not yet implemented...
[chiark-tcl.git] / base / chiark-tcl.h
index b4fcfb8d551a3481d4e357c5111983ca28075e5e..206f97e909931730cf35315485bcfb915a631a19 100644 (file)
  *               uint VARNAME/VALUE         (VARNAME if ul2bitfields;
  *               ulong VARNAME/VALUE         VALUE if bitfields2ul)
  *
- * Mask maps:
+ * Address ranges (addrmap.c):
  *
- *  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).
+ *  An address range is a slightly efficient partial 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 addrmap should have the same length.
  *
- *  hbytes mask-map lookup MAP-VAR ADDRESS [DEFAULT]   => DATA
+ *  hbytes addr-map lookup MAP-VAR ADDRESS [DEFAULT]   => DATA
  *     Error on missing default or if any prefix longer than ADDRESS.
  *
- *  hbytes mask-map amend MAP-VAR PREFIX PREFIX-LENGTH DATA
+ *  hbytes addr-map amend-range MAP-VAR START END DATA
+ *  hbytes addr-map amend-mask MAP-VAR PREFIX PREFIX-LENGTH DATA
  *     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.
+ *     An address map MAP is
+ *           [list BIT-LENGTH                           \
+ *                 [list START END DATA-VALUE]          \
+ *                 [list START' END' DATA-VALUE']       \
+ *                 ...
+ *            ]
+ *     The list is sorted by ascending START and entries do not overlap.
+ *     START and END are both inclusive.  BIT-LENGTH is in usual Tcl
+ *     integer notation and must be a multiple of 8.
  *
  * Error codes
  *
  * HBYTES LENGTH MISMATCH              when blocks must be exactly same length
  * HBYTES SYNTAX                       supposed hex block had wrong syntax
  * HBYTES VALUE OVERFLOW               value to be conv'd to hex too big/long
- * HBYTES MASKMAP NOMATCH              no addr/mask matches address for lookup
- * HBYTES MASKMAP UNDERRUN             addr value for lookup is too short
- * HBYTES MASKMAP SYNTAX LLENGTH       value for mask-map entry not llength==3
- * HBYTES MASKMAP SYNTAX UNDERRUN      value for mask-map entry hex too short
- * HBYTES MASKMAP SYNTAX OVERRUN       actual mask-map entry hex too short
- * HBYTES MASKMAP SYNTAX ORDER         actual mask-map is disordered
- * HBYTES MASKMAP SYNTAX EXCLBITS      mask-map has 1-bits outside prefix len
+ * HBYTES ADDRMAP NOMATCH              no addr/mask matches address for lookup
+ * HBYTES ADDRMAP UNDERRUN             addr for lookup or amend is too short
+ * HBYTES ADDRMAP OVERRUN              addr for lookup or amend is too long
+ * HBYTES ADDRMAP EXCLBITS             amend-mask 1-bits outside prefix len
+ * HBYTES ADDRMAP BADRANGE             amend-range start > end
+ * HBYTES ADDRMAP VALUE                addr-map string value is erroneous
  * SOCKADDR AFUNIX LENGTH              path for AF_UNIX socket too long
  * SOCKADDR SYNTAX IPV4                bad IPv4 socket address &/or port
  * SOCKADDR SYNTAX OTHER               bad socket addr, couldn't tell what kind
@@ -295,16 +299,16 @@ typedef struct {
   Something_Var sth;
 } HBytes_Var;
 
-/* from maskmap.c */
+/* from addrmap.c */
 
-typedef struct MaskMap_Value MaskMap_Value;
+typedef struct AddrMap_Value AddrMap_Value;
 
 typedef struct {
-  MaskMap_Value *mm;
+  AddrMap_Value *am;
   Something_Var sth;
-} MaskMap_Var;
+} AddrMap_Var;
 
-extern Tcl_ObjType maskmap_type;
+extern Tcl_ObjType addrmap_type;
 
 /* from chop.c */
   /* only do_... functions declared in tables.h */