36 |
`---------------------------------------*/ |
`---------------------------------------*/ |
37 |
|
|
38 |
#define SHIFTS_ALLOC(Nshifts) \ |
#define SHIFTS_ALLOC(Nshifts) \ |
39 |
(shifts *) xcalloc ((unsigned) (sizeof (shifts) \ |
(shifts_t *) xcalloc ((unsigned) (sizeof (shifts_t) \ |
40 |
+ (Nshifts - 1) * sizeof (short)), 1) |
+ (Nshifts - 1) * sizeof (state_number_t)), 1) |
41 |
|
|
42 |
shifts * |
static shifts_t * |
43 |
shifts_new (int n) |
shifts_new (int nshifts, state_number_t *shifts) |
44 |
{ |
{ |
45 |
shifts *res = SHIFTS_ALLOC (n); |
shifts_t *res = SHIFTS_ALLOC (nshifts); |
46 |
res->nshifts = n; |
res->nshifts = nshifts; |
47 |
|
memcpy (res->shifts, shifts, nshifts * sizeof (shifts[0])); |
48 |
return res; |
return res; |
49 |
} |
} |
50 |
|
|
148 |
} |
} |
149 |
|
|
150 |
|
|
151 |
|
/*--------------------------. |
152 |
|
| Set the shifts of STATE. | |
153 |
|
`--------------------------*/ |
154 |
|
|
155 |
|
void |
156 |
|
state_shifts_set (state_t *state, int nshifts, state_number_t *shifts) |
157 |
|
{ |
158 |
|
state->shifts = shifts_new (nshifts, shifts); |
159 |
|
} |
160 |
|
|
161 |
|
|
162 |
|
|
163 |
/*--------------------------------------------------------------. |
/*--------------------------------------------------------------. |
164 |
| Print on OUT all the lookaheads such that this STATE wants to | |
| Print on OUT all the lookaheads such that this STATE wants to | |
165 |
| reduce this RULE. | |
| reduce this RULE. | |