* composite.h (composition_temp): Remove declaration.
(COMPOSITION_METHOD, COMPOSITION_VALID_P): Replace with...
(composition_method, composition_valid_p): ...inline functions.
* composite.c (composition_temp): Remove.
(run_composition_function, update_compositions)
(composition_compute_stop_pos, composition_adjust_point)
(Ffind_composition_internal):
* coding.c (handle_composition_annotation):
* xdisp.c (handle_composition_prop, check_point_in_composition):
Related users changed.
+2013-08-03 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Do not use global Lisp_Object in composition macros.
+ * composite.h (composition_temp): Remove declaration.
+ (COMPOSITION_METHOD, COMPOSITION_VALID_P): Replace with...
+ (composition_method, composition_valid_p): ...inline functions.
+ * composite.c (composition_temp): Remove.
+ (run_composition_function, update_compositions)
+ (composition_compute_stop_pos, composition_adjust_point)
+ (Ffind_composition_internal):
+ * coding.c (handle_composition_annotation):
+ * xdisp.c (handle_composition_prop, check_point_in_composition):
+ Related users changed.
+
2013-08-03 Dmitry Antipov <dmantipov@yandex.ru>
Drop FRAME_PTR typedef.
/* We found a composition. Store the corresponding
annotation data in BUF. */
int *head = buf;
- enum composition_method method = COMPOSITION_METHOD (prop);
+ enum composition_method method = composition_method (prop);
int nchars = COMPOSITION_LENGTH (prop);
ADD_COMPOSITION_DATA (buf, nchars, 0, method);
auto-compositions. */
#define MAX_AUTO_COMPOSITION_LOOKBACK 3
-/* Temporary variable used in macros COMPOSITION_XXX. */
-Lisp_Object composition_temp;
-
-\f
/* Return COMPOSITION-ID of a composition at buffer position
CHARPOS/BYTEPOS and length NCHARS. The `composition' property of
the sequence is PROP. STRING, if non-nil, is a string that
valid too. */
if (from > BEGV
&& find_composition (from - 1, -1, &start, &end, &prop, Qnil)
- && !COMPOSITION_VALID_P (start, end, prop))
+ && !composition_valid_p (start, end, prop))
from = start;
if (to < ZV
&& find_composition (to, -1, &start, &end, &prop, Qnil)
- && !COMPOSITION_VALID_P (start, end, prop))
+ && !composition_valid_p (start, end, prop))
to = end;
if (!NILP (Ffboundp (func)))
call2 (func, make_number (from), make_number (to));
latter to the copy of it. */
if (from > BEGV
&& find_composition (from - 1, -1, &start, &end, &prop, Qnil)
- && COMPOSITION_VALID_P (start, end, prop))
+ && composition_valid_p (start, end, prop))
{
min_pos = start;
if (end > to)
}
else if (from < ZV
&& find_composition (from, -1, &start, &from, &prop, Qnil)
- && COMPOSITION_VALID_P (start, from, prop))
+ && composition_valid_p (start, from, prop))
{
if (from > to)
max_pos = from;
(to - 1). */
while (from < to - 1
&& find_composition (from, to, &start, &from, &prop, Qnil)
- && COMPOSITION_VALID_P (start, from, prop)
+ && composition_valid_p (start, from, prop)
&& from < to - 1)
run_composition_function (start, from, prop);
}
{
if (from < to
&& find_composition (to - 1, -1, &start, &end, &prop, Qnil)
- && COMPOSITION_VALID_P (start, end, prop))
+ && composition_valid_p (start, end, prop))
{
/* TO should be also at composition boundary. But,
insertion or deletion will make two compositions adjacent
}
else if (to < ZV
&& find_composition (to, -1, &start, &end, &prop, Qnil)
- && COMPOSITION_VALID_P (start, end, prop))
+ && composition_valid_p (start, end, prop))
{
run_composition_function (start, end, prop);
max_pos = end;
if (charpos < endpos
&& find_composition (charpos, endpos, &start, &end, &prop, string)
&& start >= charpos
- && COMPOSITION_VALID_P (start, end, prop))
+ && composition_valid_p (start, end, prop))
{
cmp_it->stop_pos = endpos = start;
cmp_it->ch = -1;
/* At first check the static composition. */
if (get_property_and_range (new_pt, Qcomposition, &val, &beg, &end, Qnil)
- && COMPOSITION_VALID_P (beg, end, val))
+ && composition_valid_p (beg, end, val))
{
if (beg < new_pt /* && end > new_pt <- It's always the case. */
&& (last_pt <= beg || last_pt >= end))
&& (e <= XINT (pos) ? e > end : s < start))
return list3 (make_number (s), make_number (e), gstring);
}
- if (!COMPOSITION_VALID_P (start, end, prop))
+ if (!composition_valid_p (start, end, prop))
return list3 (make_number (start), make_number (end), Qnil);
if (NILP (detail_p))
return list3 (make_number (start), make_number (end), Qt);
if (id >= 0)
{
Lisp_Object components, relative_p, mod_func;
- enum composition_method method = COMPOSITION_METHOD (prop);
+ enum composition_method method = composition_method (prop);
int width = composition_table[id]->width;
components = Fcopy_sequence (COMPOSITION_COMPONENTS (prop));
(COMPOSITION-ID . (LENGTH COMPONENTS . MODIFICATION-FUNC))
They don't check validity of PROP. */
-/* Temporary variable used only in the following macros. */
-extern Lisp_Object composition_temp;
-
/* Return 1 if the composition is already registered. */
#define COMPOSITION_REGISTERD_P(prop) INTEGERP (XCAR (prop))
? XCDR (XCDR (XCDR (prop))) \
: CONSP (prop) ? XCDR (prop) : Qnil)
-/* Return the method of composition. */
-#define COMPOSITION_METHOD(prop) \
- (COMPOSITION_REGISTERD_P (prop) \
- ? composition_table[COMPOSITION_ID (prop)]->method \
- : (composition_temp = XCDR (XCAR (prop)), \
- (NILP (composition_temp) \
- ? COMPOSITION_RELATIVE \
- : (INTEGERP (composition_temp) || STRINGP (composition_temp)) \
- ? COMPOSITION_WITH_ALTCHARS \
- : COMPOSITION_WITH_RULE_ALTCHARS)))
-
-/* Return 1 if the composition is valid. It is valid if length of
- the composition equals to (END - START). */
-#define COMPOSITION_VALID_P(start, end, prop) \
- (CONSP (prop) \
- && (COMPOSITION_REGISTERD_P (prop) \
- ? (COMPOSITION_ID (prop) >= 0 \
- && COMPOSITION_ID (prop) <= n_compositions \
- && CONSP (XCDR (prop))) \
- : (composition_temp = XCAR (prop), \
- (CONSP (composition_temp) \
- && (composition_temp = XCDR (composition_temp), \
- (NILP (composition_temp) \
- || STRINGP (composition_temp) \
- || VECTORP (composition_temp) \
- || INTEGERP (composition_temp) \
- || CONSP (composition_temp)))))) \
- && (end - start) == COMPOSITION_LENGTH (prop))
-
/* Return the Nth glyph of composition specified by CMP. CMP is a
pointer to `struct composition'. */
#define COMPOSITION_GLYPH(cmp, n) \
extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object,
Lisp_Object);
+/* Return the method of composition. */
+COMPOSITE_INLINE enum composition_method
+composition_method (Lisp_Object prop)
+{
+ Lisp_Object temp;
+
+ return (COMPOSITION_REGISTERD_P (prop)
+ ? composition_table[COMPOSITION_ID (prop)]->method
+ : (temp = XCDR (XCAR (prop)),
+ (NILP (temp)
+ ? COMPOSITION_RELATIVE
+ : (INTEGERP (temp) || STRINGP (temp))
+ ? COMPOSITION_WITH_ALTCHARS
+ : COMPOSITION_WITH_RULE_ALTCHARS)));
+}
+
+/* Return 1 if the composition is valid. It is valid if
+ length of the composition equals to (END - START). */
+COMPOSITE_INLINE bool
+composition_valid_p (ptrdiff_t start, ptrdiff_t end, Lisp_Object prop)
+{
+ Lisp_Object temp;
+
+ return (CONSP (prop)
+ && (COMPOSITION_REGISTERD_P (prop)
+ ? (COMPOSITION_ID (prop) >= 0
+ && COMPOSITION_ID (prop) <= n_compositions
+ && CONSP (XCDR (prop)))
+ : (temp = XCAR (prop),
+ (CONSP (temp)
+ && (temp = XCDR (temp),
+ (NILP (temp)
+ || STRINGP (temp)
+ || VECTORP (temp)
+ || INTEGERP (temp)
+ || CONSP (temp))))))
+ && (end - start) == COMPOSITION_LENGTH (prop));
+}
+
/* Macros for lispy glyph-string. This is completely different from
struct glyph_string. */
composition (in the case that the composition is from the current
buffer), draw a glyph composed from the composition components. */
if (find_composition (pos, -1, &start, &end, &prop, string)
- && COMPOSITION_VALID_P (start, end, prop)
+ && composition_valid_p (start, end, prop)
&& (STRINGP (it->string) || (PT <= start || PT >= end)))
{
if (start < pos)
if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
&& find_composition (prev_pt, -1, &start, &end, &prop, buffer)
- && COMPOSITION_VALID_P (start, end, prop)
+ && composition_valid_p (start, end, prop)
&& start < prev_pt && end > prev_pt)
/* The last point was within the composition. Return 1 iff
point moved out of the composition. */
/* Check a composition at the current point. */
return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf)
&& find_composition (pt, -1, &start, &end, &prop, buffer)
- && COMPOSITION_VALID_P (start, end, prop)
+ && composition_valid_p (start, end, prop)
&& start < pt && end > pt);
}