/[bison]/bison/src/state.c
ViewVC logotype

Diff of /bison/src/state.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by akim, Sun Jun 30 17:29:36 2002 UTC revision 1.10 by akim, Sun Jun 30 17:30:29 2002 UTC
# Line 36  Line 36 
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    
# Line 147  state_new (symbol_number_t accessing_sym Line 148  state_new (symbol_number_t accessing_sym
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.                                             |

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26