1 /* mapping register/macro names to indices */
6 #define MAPBEG 256 /* the entries reserved for .x names */
8 /* register, macro, or environments names */
9 static struct dict
*mapdict
;
11 /* map register names to [0..NREGS] */
15 if (s
[0] == '.' && s
[1] && !s
[2]) /* ".x" is mapped to 'x' */
16 return (unsigned char) s
[1];
18 mapdict
= dict_make(-1, 1, 1);
19 i
= dict_idx(mapdict
, s
);
21 dict_put(mapdict
, s
, 0);
22 i
= dict_idx(mapdict
, s
);
27 /* return the name mapped to id; returns a static buffer */
28 char *map_name(int id
)
30 static char map_buf
[NMLEN
];
32 return dict_key(mapdict
, id
- MAPBEG
);