1.1 --- a/templates/types.h Tue Nov 29 23:13:18 2016 +0100
1.2 +++ b/templates/types.h Wed Nov 30 16:18:17 2016 +0100
1.3 @@ -32,6 +32,7 @@
1.4
1.5 typedef struct __obj __obj;
1.6 typedef struct __fragment __fragment;
1.7 +typedef struct __mapping __mapping;
1.8
1.9 typedef struct __attr
1.10 {
1.11 @@ -54,6 +55,7 @@
1.12 double floatvalue; /* floating point value */
1.13 char * strvalue; /* string value */
1.14 __fragment * seqvalue; /* sequence data */
1.15 + __mapping * mapvalue; /* mapping data */
1.16 };
1.17 } __attr;
1.18
1.19 @@ -77,6 +79,20 @@
1.20
1.21 #define __FRAGMENT_SIZE(NUMBER) (NUMBER * sizeof(__attr) + 2 * sizeof(unsigned int))
1.22
1.23 +/* Mappings are simple collections of fragment references used to hold the
1.24 + "buckets" used in hash tables. Here, separate lists of keys and values hold
1.25 + attributes referring to the actual keys and corresponding values. */
1.26 +
1.27 +#define __MAPPING_BUCKETS 10
1.28 +
1.29 +typedef struct __mapping
1.30 +{
1.31 + __fragment *keys[__MAPPING_BUCKETS];
1.32 + __fragment *values[__MAPPING_BUCKETS];
1.33 +} __mapping;
1.34 +
1.35 +#define __MAPPING_SIZE(NUMBER) (2 * NUMBER * sizeof(__fragment *) + sizeof(unsigned int))
1.36 +
1.37 /* Special instance position value. The pos member of __obj refers to the
1.38 special type attribute for classes, indicating which position holds the
1.39 attribute describing the class type. For instances, it is set to zero. */