comparison src/regex.c @ 23670:40072cd9d21c

(regex_compile): Handle translation of multibyte exact-match characters.
author Karl Heuer <kwzh@gnu.org>
date Tue, 10 Nov 1998 07:03:05 +0000
parents dc8ce74d8633
children e2e16f655cff
comparison
equal deleted inserted replaced
23669:32b916f68c79 23670:40072cd9d21c
2901 /* Expects the character in `c'. */ 2901 /* Expects the character in `c'. */
2902 normal_char: 2902 normal_char:
2903 p1 = p - 1; /* P1 points the head of C. */ 2903 p1 = p - 1; /* P1 points the head of C. */
2904 #ifdef emacs 2904 #ifdef emacs
2905 if (bufp->multibyte) 2905 if (bufp->multibyte)
2906 /* Set P to the next character boundary. */ 2906 {
2907 p += MULTIBYTE_FORM_LENGTH (p1, pend - p1) - 1; 2907 c = STRING_CHAR (p1, pend - p1);
2908 c = TRANSLATE (c);
2909 /* Set P to the next character boundary. */
2910 p += MULTIBYTE_FORM_LENGTH (p1, pend - p1) - 1;
2911 }
2908 #endif 2912 #endif
2909 /* If no exactn currently being built. */ 2913 /* If no exactn currently being built. */
2910 if (!pending_exact 2914 if (!pending_exact
2911 2915
2912 /* If last exactn not at current position. */ 2916 /* If last exactn not at current position. */
2931 2935
2932 BUF_PUSH_2 (exactn, 0); 2936 BUF_PUSH_2 (exactn, 0);
2933 pending_exact = b - 1; 2937 pending_exact = b - 1;
2934 } 2938 }
2935 2939
2936 /* Here, C may translated, therefore C may not equal to *P1. */ 2940 #ifdef emacs
2937 while (1) 2941 if (! SINGLE_BYTE_CHAR_P (c))
2942 {
2943 unsigned char work[4], *str;
2944 int i = CHAR_STRING (c, work, str);
2945 int j;
2946 for (j = 0; j < i; j++)
2947 {
2948 BUF_PUSH (str[j]);
2949 (*pending_exact)++;
2950 }
2951 }
2952 else
2953 #endif
2938 { 2954 {
2939 BUF_PUSH (c); 2955 BUF_PUSH (c);
2940 (*pending_exact)++; 2956 (*pending_exact)++;
2941 if (++p1 == p)
2942 break;
2943
2944 /* Rest of multibyte form should be copied literally. */
2945 c = *(unsigned char *)p1;
2946 } 2957 }
2947 break; 2958 break;
2948 } /* switch (c) */ 2959 } /* switch (c) */
2949 } /* while p != pend */ 2960 } /* while p != pend */
2950 2961