emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113674: Do not use global Lisp_Object in compositio


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r113674: Do not use global Lisp_Object in composition macros.
Date: Sat, 03 Aug 2013 18:17:26 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113674
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sat 2013-08-03 22:16:43 +0400
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/coding.c                   coding.c-20091113204419-o5vbwnq5f7feedwu-1077
  src/composite.c                
composite.c-20091113204419-o5vbwnq5f7feedwu-1728
  src/composite.h                
composite.h-20091113204419-o5vbwnq5f7feedwu-1729
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-03 03:29:03 +0000
+++ b/src/ChangeLog     2013-08-03 18:16:43 +0000
@@ -1,5 +1,19 @@
 2013-08-03  Dmitry Antipov  <address@hidden>
 
+       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  <address@hidden>
+
        Drop FRAME_PTR typedef.
        * composite.c, font.c, font.h, fontset.c, fontset.h, frame.c, frame.h:
        * ftfont.c, ftxfont.c, gtkutil.c, gtkutil.h, image.c, keyboard.c:

=== modified file 'src/coding.c'
--- a/src/coding.c      2013-07-20 11:51:53 +0000
+++ b/src/coding.c      2013-08-03 18:16:43 +0000
@@ -7497,7 +7497,7 @@
          /* 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);

=== modified file 'src/composite.c'
--- a/src/composite.c   2013-08-03 03:29:03 +0000
+++ b/src/composite.c   2013-08-03 18:16:43 +0000
@@ -160,10 +160,6 @@
    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
@@ -478,11 +474,11 @@
      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 @@
         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 @@
        }
       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 @@
          (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 @@
     {
       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 @@
        }
       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;
@@ -1012,7 +1008,7 @@
   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;
@@ -1672,7 +1668,7 @@
 
   /* 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))
@@ -1872,7 +1868,7 @@
          && (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);
@@ -1890,7 +1886,7 @@
   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));

=== modified file 'src/composite.h'
--- a/src/composite.h   2013-01-01 09:11:05 +0000
+++ b/src/composite.h   2013-08-03 18:16:43 +0000
@@ -56,9 +56,6 @@
        (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))
 
@@ -83,35 +80,6 @@
    ? 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)                                      \
@@ -233,6 +201,45 @@
 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.  */
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-08-03 03:29:03 +0000
+++ b/src/xdisp.c       2013-08-03 18:16:43 +0000
@@ -5346,7 +5346,7 @@
      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)
@@ -12852,7 +12852,7 @@
 
       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.  */
@@ -12862,7 +12862,7 @@
   /* 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);
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]