/[pcre]/code/trunk/pcre_dfa_exec.c
ViewVC logotype

Diff of /code/trunk/pcre_dfa_exec.c

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

revision 518 by ph10, Tue May 18 15:47:01 2010 UTC revision 530 by ph10, Tue Jun 1 13:42:06 2010 UTC
# Line 475  if (*first_op == OP_REVERSE) Line 475  if (*first_op == OP_REVERSE)
475    
476      {      {
477      gone_back = (current_subject - max_back < start_subject)?      gone_back = (current_subject - max_back < start_subject)?
478        current_subject - start_subject : max_back;        (int)(current_subject - start_subject) : max_back;
479      current_subject -= gone_back;      current_subject -= gone_back;
480      }      }
481    
# Line 492  if (*first_op == OP_REVERSE) Line 492  if (*first_op == OP_REVERSE)
492      int back = GET(end_code, 2+LINK_SIZE);      int back = GET(end_code, 2+LINK_SIZE);
493      if (back <= gone_back)      if (back <= gone_back)
494        {        {
495        int bstate = end_code - start_code + 2 + 2*LINK_SIZE;        int bstate = (int)(end_code - start_code + 2 + 2*LINK_SIZE);
496        ADD_NEW_DATA(-bstate, 0, gone_back - back);        ADD_NEW_DATA(-bstate, 0, gone_back - back);
497        }        }
498      end_code += GET(end_code, 1);      end_code += GET(end_code, 1);
# Line 528  else Line 528  else
528        ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);        ((*this_start_code == OP_CBRA || *this_start_code == OP_SCBRA)? 2:0);
529      do      do
530        {        {
531        ADD_NEW(end_code - start_code + length, 0);        ADD_NEW((int)(end_code - start_code + length), 0);
532        end_code += GET(end_code, 1);        end_code += GET(end_code, 1);
533        length = 1 + LINK_SIZE;        length = 1 + LINK_SIZE;
534        }        }
# Line 755  for (;;) Line 755  for (;;)
755            if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int));            if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int));
756            if (offsetcount >= 2)            if (offsetcount >= 2)
757              {              {
758              offsets[0] = current_subject - start_subject;              offsets[0] = (int)(current_subject - start_subject);
759              offsets[1] = ptr - start_subject;              offsets[1] = (int)(ptr - start_subject);
760              DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP,              DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP,
761                offsets[1] - offsets[0], current_subject));                offsets[1] - offsets[0], current_subject));
762              }              }
# Line 778  for (;;) Line 778  for (;;)
778        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
779        case OP_ALT:        case OP_ALT:
780        do { code += GET(code, 1); } while (*code == OP_ALT);        do { code += GET(code, 1); } while (*code == OP_ALT);
781        ADD_ACTIVE(code - start_code, 0);        ADD_ACTIVE((int)(code - start_code), 0);
782        break;        break;
783    
784        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
# Line 786  for (;;) Line 786  for (;;)
786        case OP_SBRA:        case OP_SBRA:
787        do        do
788          {          {
789          ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);          ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE), 0);
790          code += GET(code, 1);          code += GET(code, 1);
791          }          }
792        while (*code == OP_ALT);        while (*code == OP_ALT);
# Line 795  for (;;) Line 795  for (;;)
795        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
796        case OP_CBRA:        case OP_CBRA:
797        case OP_SCBRA:        case OP_SCBRA:
798        ADD_ACTIVE(code - start_code + 3 + LINK_SIZE,  0);        ADD_ACTIVE((int)(code - start_code + 3 + LINK_SIZE),  0);
799        code += GET(code, 1);        code += GET(code, 1);
800        while (*code == OP_ALT)        while (*code == OP_ALT)
801          {          {
802          ADD_ACTIVE(code - start_code + 1 + LINK_SIZE,  0);          ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE),  0);
803          code += GET(code, 1);          code += GET(code, 1);
804          }          }
805        break;        break;
# Line 810  for (;;) Line 810  for (;;)
810        ADD_ACTIVE(state_offset + 1, 0);        ADD_ACTIVE(state_offset + 1, 0);
811        code += 1 + GET(code, 2);        code += 1 + GET(code, 2);
812        while (*code == OP_ALT) code += GET(code, 1);        while (*code == OP_ALT) code += GET(code, 1);
813        ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);        ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE), 0);
814        break;        break;
815    
816        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
817        case OP_SKIPZERO:        case OP_SKIPZERO:
818        code += 1 + GET(code, 2);        code += 1 + GET(code, 2);
819        while (*code == OP_ALT) code += GET(code, 1);        while (*code == OP_ALT) code += GET(code, 1);
820        ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);        ADD_ACTIVE((int)(code - start_code + 1 + LINK_SIZE), 0);
821        break;        break;
822    
823        /*-----------------------------------------------------------------*/        /*-----------------------------------------------------------------*/
# Line 2359  for (;;) Line 2359  for (;;)
2359          points to the byte after the end of the class. If there is a          points to the byte after the end of the class. If there is a
2360          quantifier, this is where it will be. */          quantifier, this is where it will be. */
2361    
2362          next_state_offset = ecode - start_code;          next_state_offset = (int)(ecode - start_code);
2363    
2364          switch (*ecode)          switch (*ecode)
2365            {            {
# Line 2430  for (;;) Line 2430  for (;;)
2430            md,                                   /* static match data */            md,                                   /* static match data */
2431            code,                                 /* this subexpression's code */            code,                                 /* this subexpression's code */
2432            ptr,                                  /* where we currently are */            ptr,                                  /* where we currently are */
2433            ptr - start_subject,                  /* start offset */            (int)(ptr - start_subject),           /* start offset */
2434            local_offsets,                        /* offset vector */            local_offsets,                        /* offset vector */
2435            sizeof(local_offsets)/sizeof(int),    /* size of same */            sizeof(local_offsets)/sizeof(int),    /* size of same */
2436            local_workspace,                      /* workspace vector */            local_workspace,                      /* workspace vector */
# Line 2441  for (;;) Line 2441  for (;;)
2441    
2442          if (rc == PCRE_ERROR_DFA_UITEM) return rc;          if (rc == PCRE_ERROR_DFA_UITEM) return rc;
2443          if ((rc >= 0) == (codevalue == OP_ASSERT || codevalue == OP_ASSERTBACK))          if ((rc >= 0) == (codevalue == OP_ASSERT || codevalue == OP_ASSERTBACK))
2444              { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }              { ADD_ACTIVE((int)(endasscode + LINK_SIZE + 1 - start_code), 0); }
2445          }          }
2446        break;        break;
2447    
# Line 2468  for (;;) Line 2468  for (;;)
2468              cb.callout_number   = code[LINK_SIZE+2];              cb.callout_number   = code[LINK_SIZE+2];
2469              cb.offset_vector    = offsets;              cb.offset_vector    = offsets;
2470              cb.subject          = (PCRE_SPTR)start_subject;              cb.subject          = (PCRE_SPTR)start_subject;
2471              cb.subject_length   = end_subject - start_subject;              cb.subject_length   = (int)(end_subject - start_subject);
2472              cb.start_match      = current_subject - start_subject;              cb.start_match      = (int)(current_subject - start_subject);
2473              cb.current_position = ptr - start_subject;              cb.current_position = (int)(ptr - start_subject);
2474              cb.pattern_position = GET(code, LINK_SIZE + 3);              cb.pattern_position = GET(code, LINK_SIZE + 3);
2475              cb.next_item_length = GET(code, 3 + 2*LINK_SIZE);              cb.next_item_length = GET(code, 3 + 2*LINK_SIZE);
2476              cb.capture_top      = 1;              cb.capture_top      = 1;
# Line 2521  for (;;) Line 2521  for (;;)
2521              md,                                   /* fixed match data */              md,                                   /* fixed match data */
2522              asscode,                              /* this subexpression's code */              asscode,                              /* this subexpression's code */
2523              ptr,                                  /* where we currently are */              ptr,                                  /* where we currently are */
2524              ptr - start_subject,                  /* start offset */              (int)(ptr - start_subject),           /* start offset */
2525              local_offsets,                        /* offset vector */              local_offsets,                        /* offset vector */
2526              sizeof(local_offsets)/sizeof(int),    /* size of same */              sizeof(local_offsets)/sizeof(int),    /* size of same */
2527              local_workspace,                      /* workspace vector */              local_workspace,                      /* workspace vector */
# Line 2533  for (;;) Line 2533  for (;;)
2533            if (rc == PCRE_ERROR_DFA_UITEM) return rc;            if (rc == PCRE_ERROR_DFA_UITEM) return rc;
2534            if ((rc >= 0) ==            if ((rc >= 0) ==
2535                  (condcode == OP_ASSERT || condcode == OP_ASSERTBACK))                  (condcode == OP_ASSERT || condcode == OP_ASSERTBACK))
2536              { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }              { ADD_ACTIVE((int)(endasscode + LINK_SIZE + 1 - start_code), 0); }
2537            else            else
2538              { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }              { ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
2539            }            }
# Line 2554  for (;;) Line 2554  for (;;)
2554            md,                                   /* fixed match data */            md,                                   /* fixed match data */
2555            start_code + GET(code, 1),            /* this subexpression's code */            start_code + GET(code, 1),            /* this subexpression's code */
2556            ptr,                                  /* where we currently are */            ptr,                                  /* where we currently are */
2557            ptr - start_subject,                  /* start offset */            (int)(ptr - start_subject),           /* start offset */
2558            local_offsets,                        /* offset vector */            local_offsets,                        /* offset vector */
2559            sizeof(local_offsets)/sizeof(int),    /* size of same */            sizeof(local_offsets)/sizeof(int),    /* size of same */
2560            local_workspace,                      /* workspace vector */            local_workspace,                      /* workspace vector */
# Line 2606  for (;;) Line 2606  for (;;)
2606            md,                                   /* fixed match data */            md,                                   /* fixed match data */
2607            code,                                 /* this subexpression's code */            code,                                 /* this subexpression's code */
2608            ptr,                                  /* where we currently are */            ptr,                                  /* where we currently are */
2609            ptr - start_subject,                  /* start offset */            (int)(ptr - start_subject),           /* start offset */
2610            local_offsets,                        /* offset vector */            local_offsets,                        /* offset vector */
2611            sizeof(local_offsets)/sizeof(int),    /* size of same */            sizeof(local_offsets)/sizeof(int),    /* size of same */
2612            local_workspace,                      /* workspace vector */            local_workspace,                      /* workspace vector */
# Line 2623  for (;;) Line 2623  for (;;)
2623    
2624            do { end_subpattern += GET(end_subpattern, 1); }            do { end_subpattern += GET(end_subpattern, 1); }
2625              while (*end_subpattern == OP_ALT);              while (*end_subpattern == OP_ALT);
2626            next_state_offset = end_subpattern - start_code + LINK_SIZE + 1;            next_state_offset =
2627                (int)(end_subpattern - start_code + LINK_SIZE + 1);
2628    
2629            /* If the end of this subpattern is KETRMAX or KETRMIN, we must            /* If the end of this subpattern is KETRMAX or KETRMIN, we must
2630            arrange for the repeat state also to be added to the relevant list.            arrange for the repeat state also to be added to the relevant list.
# Line 2631  for (;;) Line 2632  for (;;)
2632    
2633            repeat_state_offset = (*end_subpattern == OP_KETRMAX ||            repeat_state_offset = (*end_subpattern == OP_KETRMAX ||
2634                                   *end_subpattern == OP_KETRMIN)?                                   *end_subpattern == OP_KETRMIN)?
2635              end_subpattern - start_code - GET(end_subpattern, 1) : -1;              (int)(end_subpattern - start_code - GET(end_subpattern, 1)) : -1;
2636    
2637            /* If we have matched an empty string, add the next state at the            /* If we have matched an empty string, add the next state at the
2638            current character pointer. This is important so that the duplicate            current character pointer. This is important so that the duplicate
# Line 2695  for (;;) Line 2696  for (;;)
2696          cb.callout_number   = code[1];          cb.callout_number   = code[1];
2697          cb.offset_vector    = offsets;          cb.offset_vector    = offsets;
2698          cb.subject          = (PCRE_SPTR)start_subject;          cb.subject          = (PCRE_SPTR)start_subject;
2699          cb.subject_length   = end_subject - start_subject;          cb.subject_length   = (int)(end_subject - start_subject);
2700          cb.start_match      = current_subject - start_subject;          cb.start_match      = (int)(current_subject - start_subject);
2701          cb.current_position = ptr - start_subject;          cb.current_position = (int)(ptr - start_subject);
2702          cb.pattern_position = GET(code, 2);          cb.pattern_position = GET(code, 2);
2703          cb.next_item_length = GET(code, 2 + LINK_SIZE);          cb.next_item_length = GET(code, 2 + LINK_SIZE);
2704          cb.capture_top      = 1;          cb.capture_top      = 1;
# Line 2748  for (;;) Line 2749  for (;;)
2749        {        {
2750        if (offsetcount >= 2)        if (offsetcount >= 2)
2751          {          {
2752          offsets[0] = md->start_used_ptr - start_subject;          offsets[0] = (int)(md->start_used_ptr - start_subject);
2753          offsets[1] = end_subject - start_subject;          offsets[1] = (int)(end_subject - start_subject);
2754          }          }
2755        match_count = PCRE_ERROR_PARTIAL;        match_count = PCRE_ERROR_PARTIAL;
2756        }        }

Legend:
Removed from v.518  
changed lines
  Added in v.530

  ViewVC Help
Powered by ViewVC 1.1.5