/* Make syntax table lookup grant data in gl_state. */
#define SYNTAX(c) syntax_property (c, 1)
-/* Convert the pointer to the char to BEG-based offset from the start. */
-#define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d))
-/* Strings are 0-indexed, buffers are 1-indexed; pun on the boolean
- result to get the right base index. */
-#define POS_AS_IN_BUFFER(p) \
- ((p) + (NILP (gl_state.object) || BUFFERP (gl_state.object)))
-
#define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte)
#define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte)
#define RE_STRING_CHAR(p, multibyte) \
gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */
{
- ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos));
+ ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (startpos);
SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
}
ptrdiff_t charpos;
gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */
- charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos));
+ charpos = SYNTAX_TABLE_BYTE_TO_CHAR (pos);
SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
result = re_match_2_internal (bufp, (re_char *) string1, size1,
int c1, c2;
int s1, s2;
int dummy;
- ptrdiff_t offset = PTR_TO_OFFSET (d);
+ ptrdiff_t offset = POINTER_TO_OFFSET (d);
ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1;
UPDATE_SYNTAX_TABLE (charpos);
GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
int c1, c2;
int s1, s2;
int dummy;
- ptrdiff_t offset = PTR_TO_OFFSET (d);
+ ptrdiff_t offset = POINTER_TO_OFFSET (d);
ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
UPDATE_SYNTAX_TABLE (charpos);
PREFETCH ();
int c1, c2;
int s1, s2;
int dummy;
- ptrdiff_t offset = PTR_TO_OFFSET (d);
+ ptrdiff_t offset = POINTER_TO_OFFSET (d);
ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1;
UPDATE_SYNTAX_TABLE (charpos);
GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
is the character at D, and S2 is the syntax of C2. */
int c1, c2;
int s1, s2;
- ptrdiff_t offset = PTR_TO_OFFSET (d);
+ ptrdiff_t offset = POINTER_TO_OFFSET (d);
ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
UPDATE_SYNTAX_TABLE (charpos);
PREFETCH ();
is the character at D, and S2 is the syntax of C2. */
int c1, c2;
int s1, s2;
- ptrdiff_t offset = PTR_TO_OFFSET (d);
+ ptrdiff_t offset = POINTER_TO_OFFSET (d);
ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1;
UPDATE_SYNTAX_TABLE (charpos);
GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
mcnt);
PREFETCH ();
{
- ptrdiff_t offset = PTR_TO_OFFSET (d);
+ ptrdiff_t offset = POINTER_TO_OFFSET (d);
ptrdiff_t pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
UPDATE_SYNTAX_TABLE (pos1);
}
extern unsigned char const syntax_spec_code[0400];
-/* Convert the byte offset BYTEPOS into a character position,
+/* Convert the regexp BYTEOFFSET into a character position,
for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT.
The value is meant for use in code that does nothing when
for speed. */
INLINE ptrdiff_t
-SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos)
+SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t byteoffset)
{
return (! parse_sexp_lookup_properties
? 0
: STRINGP (gl_state.object)
- ? string_byte_to_char (gl_state.object, bytepos)
+ ? string_byte_to_char (gl_state.object, byteoffset)
: BUFFERP (gl_state.object)
? ((buf_bytepos_to_charpos
(XBUFFER (gl_state.object),
- (bytepos + BUF_BEGV_BYTE (XBUFFER (gl_state.object)) - 1))))
+ (byteoffset + BUF_BEGV_BYTE (XBUFFER (gl_state.object))))))
: NILP (gl_state.object)
- ? BYTE_TO_CHAR (bytepos + BEGV_BYTE - 1)
- : bytepos);
+ ? BYTE_TO_CHAR (byteoffset + BEGV_BYTE)
+ : byteoffset);
}
/* Make syntax table state (gl_state) good for CHARPOS, assuming it is