X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/490a9458c8310140a255b30330e9940fb68e27ef..aab1fcdf812a7ebd32b8312c05ffcdd1bf610d2b:/src/composite.c diff --git a/src/composite.c b/src/composite.c index 54cebc00eb..28942fe4f7 100644 --- a/src/composite.c +++ b/src/composite.c @@ -160,10 +160,6 @@ static Lisp_Object Qauto_composition_function; auto-compositions. */ #define MAX_AUTO_COMPOSITION_LOOKBACK 3 -/* Temporary variable used in macros COMPOSITION_XXX. */ -Lisp_Object composition_temp; - - /* 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 @@ -234,7 +230,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars, key = components; else if (NILP (components)) { - key = Fmake_vector (make_number (nchars), Qnil); + key = make_uninit_vector (nchars); if (STRINGP (string)) for (i = 0; i < nchars; i++) { @@ -478,11 +474,11 @@ run_composition_function (ptrdiff_t from, ptrdiff_t to, Lisp_Object prop) 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)); @@ -524,7 +520,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) 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) @@ -538,7 +534,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) } 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; @@ -553,7 +549,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) (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); } @@ -562,7 +558,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) { 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 @@ -580,7 +576,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) } 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; @@ -595,7 +591,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) specbind (Qinhibit_point_motion_hooks, Qt); Fremove_list_of_text_properties (make_number (min_pos), make_number (max_pos), - Fcons (Qauto_composed, Qnil), Qnil); + list1 (Qauto_composed), Qnil); unbind_to (count, Qnil); } } @@ -642,13 +638,7 @@ compose_text (ptrdiff_t start, ptrdiff_t end, Lisp_Object components, Qcomposition, prop, string); } - -static Lisp_Object autocmp_chars (Lisp_Object, ptrdiff_t, ptrdiff_t, - ptrdiff_t, struct window *, - struct face *, Lisp_Object); - - -/* Lisp glyph-string handlers */ +/* Lisp glyph-string handlers. */ /* Hash table for automatic composition. The key is a header of a lgstring (Lispy glyph-string), and the value is a body of a @@ -704,10 +694,6 @@ composition_gstring_from_id (ptrdiff_t id) return HASH_VALUE (h, id); } -static Lisp_Object fill_gstring_header (Lisp_Object, Lisp_Object, - Lisp_Object, Lisp_Object, - Lisp_Object); - bool composition_gstring_p (Lisp_Object gstring) { @@ -797,7 +783,8 @@ static Lisp_Object gstring_work; static Lisp_Object gstring_work_headers; static Lisp_Object -fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lisp_Object font_object, Lisp_Object string) +fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, + Lisp_Object font_object, Lisp_Object string) { ptrdiff_t from, to, from_byte; ptrdiff_t len, i; @@ -837,7 +824,7 @@ fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lis if (len <= 8) header = AREF (gstring_work_headers, len - 1); else - header = Fmake_vector (make_number (len + 1), Qnil); + header = make_uninit_vector (len + 1); } ASET (header, 0, font_object); @@ -905,10 +892,12 @@ fill_gstring_body (Lisp_Object gstring) object. Otherwise return nil. */ static Lisp_Object -autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string) +autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, + ptrdiff_t limit, struct window *win, struct face *face, + Lisp_Object string) { ptrdiff_t count = SPECPDL_INDEX (); - FRAME_PTR f = XFRAME (win->frame); + struct frame *f = XFRAME (win->frame); Lisp_Object pos = make_number (charpos); ptrdiff_t to; ptrdiff_t pt = PT, pt_byte = PT_BYTE; @@ -935,7 +924,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) { - font_object = font_range (charpos, &to, win, face, string); + font_object = font_range (charpos, bytepos, &to, win, face, string); if (! FONT_OBJECT_P (font_object) || (! NILP (re) && to < limit @@ -1019,7 +1008,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, 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; @@ -1679,7 +1668,7 @@ composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt) /* 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)) @@ -1879,14 +1868,12 @@ See `find-composition' for more details. */) && (e <= XINT (pos) ? e > end : s < start)) return list3 (make_number (s), make_number (e), gstring); } - if (!COMPOSITION_VALID_P (start, end, prop)) - return Fcons (make_number (start), Fcons (make_number (end), - Fcons (Qnil, Qnil))); + if (!composition_valid_p (start, end, prop)) + return list3 (make_number (start), make_number (end), Qnil); if (NILP (detail_p)) - return Fcons (make_number (start), Fcons (make_number (end), - Fcons (Qt, Qnil))); + return list3 (make_number (start), make_number (end), Qt); - if (COMPOSITION_REGISTERD_P (prop)) + if (composition_registered_p (prop)) id = COMPOSITION_ID (prop); else { @@ -1899,17 +1886,14 @@ See `find-composition' for more details. */) 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)); relative_p = (method == COMPOSITION_WITH_RULE_ALTCHARS ? Qnil : Qt); mod_func = COMPOSITION_MODIFICATION_FUNC (prop); - tail = Fcons (components, - Fcons (relative_p, - Fcons (mod_func, - Fcons (make_number (width), Qnil)))); + tail = list4 (components, relative_p, mod_func, make_number (width)); } else tail = Qnil;