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

Diff of /bison/src/LR0.c

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

revision 1.15.2.4 by akim, Mon Nov 19 09:14:26 2001 UTC revision 1.15.2.5 by akim, Mon Nov 19 09:14:53 2001 UTC
# Line 196  new_state (int symbol) Line 196  new_state (int symbol)
196  {  {
197    int n;    int n;
198    core *p;    core *p;
   short *isp1;  
   short *isp2;  
   short *iend;  
199    
200  #if TRACE  #if TRACE
201    fprintf (stderr, "Entering new_state, symbol = %d, state = %d\n",    fprintf (stderr, "Entering new_state, symbol = %d, state = %d\n",
# Line 208  new_state (int symbol) Line 205  new_state (int symbol)
205    if (nstates >= MAXSHORT)    if (nstates >= MAXSHORT)
206      fatal (_("too many states (max %d)"), MAXSHORT);      fatal (_("too many states (max %d)"), MAXSHORT);
207    
208    isp1 = kernel_base[symbol];    n = kernel_end[symbol] - kernel_base[symbol];
   iend = kernel_end[symbol];  
   n = iend - isp1;  
209    
210    p = CORE_ALLOC (n);    p = CORE_ALLOC (n);
211    p->accessing_symbol = symbol;    p->accessing_symbol = symbol;
212    p->number = nstates;    p->number = nstates;
213    p->nitems = n;    p->nitems = n;
214    
215    isp2 = p->items;    shortcpy (p->items, kernel_base[symbol], n);
   while (isp1 < iend)  
     *isp2++ = *isp1++;  
216    
217    last_state->next = p;    last_state->next = p;
218    last_state = p;    last_state = p;
# Line 360  static void Line 353  static void
353  save_shifts (void)  save_shifts (void)
354  {  {
355    shifts *p;    shifts *p;
   short *sp1;  
   short *sp2;  
   short *send;  
356    
357    p = SHIFTS_ALLOC (nshifts);    p = SHIFTS_ALLOC (nshifts);
358    
359    p->number = this_state->number;    p->number = this_state->number;
360    p->nshifts = nshifts;    p->nshifts = nshifts;
361    
362    sp1 = shiftset;    shortcpy (p->shifts, shiftset, nshifts);
   sp2 = p->shifts;  
   send = shiftset + nshifts;  
   
   while (sp1 < send)  
     *sp2++ = *sp1++;  
363    
364    if (last_shift)    if (last_shift)
365      {      {
# Line 603  static void Line 588  static void
588  save_reductions (void)  save_reductions (void)
589  {  {
590    short *isp;    short *isp;
   short *rp1;  
   short *rp2;  
591    int item;    int item;
592    int count;    int count;
593    reductions *p;    reductions *p;
# Line 630  save_reductions (void) Line 613  save_reductions (void)
613        p->number = this_state->number;        p->number = this_state->number;
614        p->nreds = count;        p->nreds = count;
615    
616        rp1 = redset;        shortcpy (p->rules, redset, count);
       rp2 = p->rules;  
       rend = rp1 + count;  
   
       for (/* nothing */; rp1 < rend; ++rp1, ++rp2)  
         *rp2 = *rp1;  
617    
618        if (last_reduction)        if (last_reduction)
619          {          {

Legend:
Removed from v.1.15.2.4  
changed lines
  Added in v.1.15.2.5

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