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
;
12 /* map register names to [0..NREGS] */
16 if (s
[0] == '.' && s
[1] && !s
[2]) /* ".x" is mapped to 'x' */
17 return (unsigned char) s
[1];
19 dict_init(&mapdict
, NREGS
, -1, 1, 1);
22 i
= dict_idx(&mapdict
, s
);
24 dict_put(&mapdict
, s
, 0);
25 i
= dict_idx(&mapdict
, s
);
30 /* return the name mapped to id; returns a static buffer */
31 char *map_name(int id
)
33 static char map_buf
[NMLEN
];
35 return dict_key(&mapdict
, id
- MAPBEG
);