Mercurial > hg > xemacs-beta
comparison src/regex.c @ 458:c33ae14dd6d0 r21-2-44
Import from CVS: tag r21-2-44
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:42:25 +0200 |
parents | e7ef97881643 |
children | 223736d75acb |
comparison
equal
deleted
inserted
replaced
457:4b9290a33024 | 458:c33ae14dd6d0 |
---|---|
4757 | 4757 |
4758 case charset: | 4758 case charset: |
4759 case charset_not: | 4759 case charset_not: |
4760 { | 4760 { |
4761 REGISTER unsigned char c; | 4761 REGISTER unsigned char c; |
4762 boolean not = (re_opcode_t) *(p - 1) == charset_not; | 4762 boolean not_p = (re_opcode_t) *(p - 1) == charset_not; |
4763 | 4763 |
4764 DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); | 4764 DEBUG_PRINT2 ("EXECUTING charset%s.\n", not_p ? "_not" : ""); |
4765 | 4765 |
4766 REGEX_PREFETCH (); | 4766 REGEX_PREFETCH (); |
4767 c = TRANSLATE (*d); /* The character to match. */ | 4767 c = TRANSLATE (*d); /* The character to match. */ |
4768 | 4768 |
4769 /* Cast to `unsigned' instead of `unsigned char' in case the | 4769 /* Cast to `unsigned' instead of `unsigned char' in case the |
4770 bit list is a full 32 bytes long. */ | 4770 bit list is a full 32 bytes long. */ |
4771 if (c < (unsigned) (*p * BYTEWIDTH) | 4771 if (c < (unsigned) (*p * BYTEWIDTH) |
4772 && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) | 4772 && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) |
4773 not = !not; | 4773 not_p = !not_p; |
4774 | 4774 |
4775 p += 1 + *p; | 4775 p += 1 + *p; |
4776 | 4776 |
4777 if (!not) goto fail; | 4777 if (!not_p) goto fail; |
4778 | 4778 |
4779 SET_REGS_MATCHED (); | 4779 SET_REGS_MATCHED (); |
4780 INC_CHARPTR (d); /* XEmacs change */ | 4780 INC_CHARPTR (d); /* XEmacs change */ |
4781 break; | 4781 break; |
4782 } | 4782 } |
4784 #ifdef MULE | 4784 #ifdef MULE |
4785 case charset_mule: | 4785 case charset_mule: |
4786 case charset_mule_not: | 4786 case charset_mule_not: |
4787 { | 4787 { |
4788 REGISTER Emchar c; | 4788 REGISTER Emchar c; |
4789 boolean not = (re_opcode_t) *(p - 1) == charset_mule_not; | 4789 boolean not_p = (re_opcode_t) *(p - 1) == charset_mule_not; |
4790 | 4790 |
4791 DEBUG_PRINT2 ("EXECUTING charset_mule%s.\n", not ? "_not" : ""); | 4791 DEBUG_PRINT2 ("EXECUTING charset_mule%s.\n", not_p ? "_not" : ""); |
4792 | 4792 |
4793 REGEX_PREFETCH (); | 4793 REGEX_PREFETCH (); |
4794 c = charptr_emchar ((const Bufbyte *) d); | 4794 c = charptr_emchar ((const Bufbyte *) d); |
4795 c = TRANSLATE_EXTENDED_UNSAFE (c); /* The character to match. */ | 4795 c = TRANSLATE_EXTENDED_UNSAFE (c); /* The character to match. */ |
4796 | 4796 |
4797 if (EQ (Qt, unified_range_table_lookup (p, c, Qnil))) | 4797 if (EQ (Qt, unified_range_table_lookup (p, c, Qnil))) |
4798 not = !not; | 4798 not_p = !not_p; |
4799 | 4799 |
4800 p += unified_range_table_bytes_used (p); | 4800 p += unified_range_table_bytes_used (p); |
4801 | 4801 |
4802 if (!not) goto fail; | 4802 if (!not_p) goto fail; |
4803 | 4803 |
4804 SET_REGS_MATCHED (); | 4804 SET_REGS_MATCHED (); |
4805 INC_CHARPTR (d); | 4805 INC_CHARPTR (d); |
4806 break; | 4806 break; |
4807 } | 4807 } |
5267 } | 5267 } |
5268 | 5268 |
5269 else if ((re_opcode_t) p1[3] == charset | 5269 else if ((re_opcode_t) p1[3] == charset |
5270 || (re_opcode_t) p1[3] == charset_not) | 5270 || (re_opcode_t) p1[3] == charset_not) |
5271 { | 5271 { |
5272 int not = (re_opcode_t) p1[3] == charset_not; | 5272 int not_p = (re_opcode_t) p1[3] == charset_not; |
5273 | 5273 |
5274 if (c < (unsigned char) (p1[4] * BYTEWIDTH) | 5274 if (c < (unsigned char) (p1[4] * BYTEWIDTH) |
5275 && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) | 5275 && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) |
5276 not = !not; | 5276 not_p = !not_p; |
5277 | 5277 |
5278 /* `not' is equal to 1 if c would match, which means | 5278 /* `not_p' is equal to 1 if c would match, which means |
5279 that we can't change to pop_failure_jump. */ | 5279 that we can't change to pop_failure_jump. */ |
5280 if (!not) | 5280 if (!not_p) |
5281 { | 5281 { |
5282 p[-3] = (unsigned char) pop_failure_jump; | 5282 p[-3] = (unsigned char) pop_failure_jump; |
5283 DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); | 5283 DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); |
5284 } | 5284 } |
5285 } | 5285 } |