diff options
| author | Joakim Verona | 2013-09-10 23:52:26 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-09-10 23:52:26 +0200 |
| commit | 63dae8e97d343fd4ebfe3dc08f0e8dc932630a4c (patch) | |
| tree | e5078c5545c777e21944a9ee4199a6f2c6d25ca9 /src/regex.c | |
| parent | 92aeabcc8a007f521a664e3aee092eb80ad0f49a (diff) | |
| download | emacs-63dae8e97d343fd4ebfe3dc08f0e8dc932630a4c.tar.gz emacs-63dae8e97d343fd4ebfe3dc08f0e8dc932630a4c.zip | |
merge upstream
Diffstat (limited to 'src/regex.c')
| -rw-r--r-- | src/regex.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/regex.c b/src/regex.c index 2363fe2a290..1befececd22 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -257,15 +257,10 @@ xrealloc (void *block, size_t size) | |||
| 257 | enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; | 257 | enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; |
| 258 | 258 | ||
| 259 | /* Dummy macros for non-Emacs environments. */ | 259 | /* Dummy macros for non-Emacs environments. */ |
| 260 | # define CHAR_CHARSET(c) 0 | ||
| 261 | # define CHARSET_LEADING_CODE_BASE(c) 0 | ||
| 262 | # define MAX_MULTIBYTE_LENGTH 1 | 260 | # define MAX_MULTIBYTE_LENGTH 1 |
| 263 | # define RE_MULTIBYTE_P(x) 0 | 261 | # define RE_MULTIBYTE_P(x) 0 |
| 264 | # define RE_TARGET_MULTIBYTE_P(x) 0 | 262 | # define RE_TARGET_MULTIBYTE_P(x) 0 |
| 265 | # define WORD_BOUNDARY_P(c1, c2) (0) | 263 | # define WORD_BOUNDARY_P(c1, c2) (0) |
| 266 | # define CHAR_HEAD_P(p) (1) | ||
| 267 | # define SINGLE_BYTE_CHAR_P(c) (1) | ||
| 268 | # define SAME_CHARSET_P(c1, c2) (1) | ||
| 269 | # define BYTES_BY_CHAR_HEAD(p) (1) | 264 | # define BYTES_BY_CHAR_HEAD(p) (1) |
| 270 | # define PREV_CHAR_BOUNDARY(p, limit) ((p)--) | 265 | # define PREV_CHAR_BOUNDARY(p, limit) ((p)--) |
| 271 | # define STRING_CHAR(p) (*(p)) | 266 | # define STRING_CHAR(p) (*(p)) |
| @@ -279,8 +274,6 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; | |||
| 279 | (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1))) | 274 | (c = ((p) == (str2) ? *((end1) - 1) : *((p) - 1))) |
| 280 | # define GET_CHAR_AFTER(c, p, len) \ | 275 | # define GET_CHAR_AFTER(c, p, len) \ |
| 281 | (c = *p, len = 1) | 276 | (c = *p, len = 1) |
| 282 | # define MAKE_CHAR(charset, c1, c2) (c1) | ||
| 283 | # define BYTE8_TO_CHAR(c) (c) | ||
| 284 | # define CHAR_BYTE8_P(c) (0) | 277 | # define CHAR_BYTE8_P(c) (0) |
| 285 | # define CHAR_LEADING_CODE(c) (c) | 278 | # define CHAR_LEADING_CODE(c) (c) |
| 286 | 279 | ||
| @@ -775,10 +768,12 @@ extract_number_and_incr (re_char **source) | |||
| 775 | and the 2 bytes of flags at the start of the range table. */ | 768 | and the 2 bytes of flags at the start of the range table. */ |
| 776 | #define CHARSET_RANGE_TABLE(p) (&(p)[4 + CHARSET_BITMAP_SIZE (p)]) | 769 | #define CHARSET_RANGE_TABLE(p) (&(p)[4 + CHARSET_BITMAP_SIZE (p)]) |
| 777 | 770 | ||
| 771 | #ifdef emacs | ||
| 778 | /* Extract the bit flags that start a range table. */ | 772 | /* Extract the bit flags that start a range table. */ |
| 779 | #define CHARSET_RANGE_TABLE_BITS(p) \ | 773 | #define CHARSET_RANGE_TABLE_BITS(p) \ |
| 780 | ((p)[2 + CHARSET_BITMAP_SIZE (p)] \ | 774 | ((p)[2 + CHARSET_BITMAP_SIZE (p)] \ |
| 781 | + (p)[3 + CHARSET_BITMAP_SIZE (p)] * 0x100) | 775 | + (p)[3 + CHARSET_BITMAP_SIZE (p)] * 0x100) |
| 776 | #endif | ||
| 782 | 777 | ||
| 783 | /* Return the address of end of RANGE_TABLE. COUNT is number of | 778 | /* Return the address of end of RANGE_TABLE. COUNT is number of |
| 784 | ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' | 779 | ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' |
| @@ -1830,6 +1825,8 @@ struct range_table_work_area | |||
| 1830 | int bits; /* flag to record character classes */ | 1825 | int bits; /* flag to record character classes */ |
| 1831 | }; | 1826 | }; |
| 1832 | 1827 | ||
| 1828 | #ifdef emacs | ||
| 1829 | |||
| 1833 | /* Make sure that WORK_AREA can hold more N multibyte characters. | 1830 | /* Make sure that WORK_AREA can hold more N multibyte characters. |
| 1834 | This is used only in set_image_of_range and set_image_of_range_1. | 1831 | This is used only in set_image_of_range and set_image_of_range_1. |
| 1835 | It expects WORK_AREA to be a pointer. | 1832 | It expects WORK_AREA to be a pointer. |
| @@ -1848,15 +1845,6 @@ struct range_table_work_area | |||
| 1848 | #define SET_RANGE_TABLE_WORK_AREA_BIT(work_area, bit) \ | 1845 | #define SET_RANGE_TABLE_WORK_AREA_BIT(work_area, bit) \ |
| 1849 | (work_area).bits |= (bit) | 1846 | (work_area).bits |= (bit) |
| 1850 | 1847 | ||
| 1851 | /* Bits used to implement the multibyte-part of the various character classes | ||
| 1852 | such as [:alnum:] in a charset's range table. */ | ||
| 1853 | #define BIT_WORD 0x1 | ||
| 1854 | #define BIT_LOWER 0x2 | ||
| 1855 | #define BIT_PUNCT 0x4 | ||
| 1856 | #define BIT_SPACE 0x8 | ||
| 1857 | #define BIT_UPPER 0x10 | ||
| 1858 | #define BIT_MULTIBYTE 0x20 | ||
| 1859 | |||
| 1860 | /* Set a range (RANGE_START, RANGE_END) to WORK_AREA. */ | 1848 | /* Set a range (RANGE_START, RANGE_END) to WORK_AREA. */ |
| 1861 | #define SET_RANGE_TABLE_WORK_AREA(work_area, range_start, range_end) \ | 1849 | #define SET_RANGE_TABLE_WORK_AREA(work_area, range_start, range_end) \ |
| 1862 | do { \ | 1850 | do { \ |
| @@ -1865,6 +1853,8 @@ struct range_table_work_area | |||
| 1865 | (work_area).table[(work_area).used++] = (range_end); \ | 1853 | (work_area).table[(work_area).used++] = (range_end); \ |
| 1866 | } while (0) | 1854 | } while (0) |
| 1867 | 1855 | ||
| 1856 | #endif /* emacs */ | ||
| 1857 | |||
| 1868 | /* Free allocated memory for WORK_AREA. */ | 1858 | /* Free allocated memory for WORK_AREA. */ |
| 1869 | #define FREE_RANGE_TABLE_WORK_AREA(work_area) \ | 1859 | #define FREE_RANGE_TABLE_WORK_AREA(work_area) \ |
| 1870 | do { \ | 1860 | do { \ |
| @@ -1876,6 +1866,15 @@ struct range_table_work_area | |||
| 1876 | #define RANGE_TABLE_WORK_USED(work_area) ((work_area).used) | 1866 | #define RANGE_TABLE_WORK_USED(work_area) ((work_area).used) |
| 1877 | #define RANGE_TABLE_WORK_BITS(work_area) ((work_area).bits) | 1867 | #define RANGE_TABLE_WORK_BITS(work_area) ((work_area).bits) |
| 1878 | #define RANGE_TABLE_WORK_ELT(work_area, i) ((work_area).table[i]) | 1868 | #define RANGE_TABLE_WORK_ELT(work_area, i) ((work_area).table[i]) |
| 1869 | |||
| 1870 | /* Bits used to implement the multibyte-part of the various character classes | ||
| 1871 | such as [:alnum:] in a charset's range table. */ | ||
| 1872 | #define BIT_WORD 0x1 | ||
| 1873 | #define BIT_LOWER 0x2 | ||
| 1874 | #define BIT_PUNCT 0x4 | ||
| 1875 | #define BIT_SPACE 0x8 | ||
| 1876 | #define BIT_UPPER 0x10 | ||
| 1877 | #define BIT_MULTIBYTE 0x20 | ||
| 1879 | 1878 | ||
| 1880 | 1879 | ||
| 1881 | /* Set the bit for character C in a list. */ | 1880 | /* Set the bit for character C in a list. */ |