1.1 --- a/templates/types.h Fri Feb 10 16:51:17 2017 +0100
1.2 +++ b/templates/types.h Fri Feb 10 17:52:47 2017 +0100
1.3 @@ -21,11 +21,20 @@
1.4
1.5 #include <stddef.h> /* size_t */
1.6
1.7 +/* Define code and position types, populated by enum values defined for each
1.8 + program specifically. */
1.9 +
1.10 +typedef unsigned short __code;
1.11 +typedef unsigned short __pos;
1.12 +typedef unsigned short __pcode;
1.13 +typedef unsigned short __ppos;
1.14 +
1.15 /* Attribute tables are lists of codes confirming the presence of attributes. */
1.16
1.17 typedef struct __table
1.18 {
1.19 - const unsigned int size, attrs[];
1.20 + const __pos size;
1.21 + const __code attrs[];
1.22 } __table;
1.23
1.24 /* Parameter tables are lists of codes confirming the presence of parameters, as
1.25 @@ -34,12 +43,13 @@
1.26
1.27 typedef struct __param
1.28 {
1.29 - unsigned short code, pos;
1.30 + __code code;
1.31 + __pos pos;
1.32 } __param;
1.33
1.34 typedef struct __ptable
1.35 {
1.36 - const unsigned int size;
1.37 + const __ppos size;
1.38 const __param params[];
1.39 } __ptable;
1.40
1.41 @@ -61,12 +71,12 @@
1.42 __obj * value; /* attribute value */
1.43 };
1.44 struct {
1.45 - unsigned int min; /* minimum number of parameters */
1.46 + __ppos min; /* minimum number of parameters */
1.47 const __ptable * ptable; /* parameter table */
1.48 };
1.49 struct {
1.50 - unsigned int code; /* parameter table code for key */
1.51 - unsigned int pos; /* parameter table position for key */
1.52 + __pcode code; /* parameter table code for key */
1.53 + __ppos pos; /* parameter table position for key */
1.54 };
1.55 struct {
1.56 struct __attr (*inv)(); /* unbound callable details */
1.57 @@ -89,7 +99,7 @@
1.58 typedef struct __obj
1.59 {
1.60 const __table * table; /* attribute table */
1.61 - unsigned int pos; /* position of attribute indicating class */
1.62 + __ppos pos; /* position of attribute indicating class */
1.63 __attr attrs[]; /* attributes */
1.64 } __obj;
1.65