Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / src / textprop.c
index 0e398e4..5db6033 100644 (file)
@@ -1,6 +1,5 @@
 /* Interface code for dealing with text properties.
-   Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
-                 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1993-1995, 1997, 1999-2011 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -68,11 +67,6 @@ Lisp_Object Qfront_sticky, Qrear_nonsticky;
    traversing plists.  */
 #define PLIST_ELT_P(o1, o2) (CONSP (o1) && ((o2)=XCDR (o1), CONSP (o2)))
 
-Lisp_Object Vinhibit_point_motion_hooks;
-Lisp_Object Vdefault_text_properties;
-Lisp_Object Vchar_property_alias_alist;
-Lisp_Object Vtext_property_default_nonsticky;
-
 /* verify_interval_modification saves insertion hooks here
    to be run later by report_interval_modification.  */
 Lisp_Object interval_insert_behind_hooks;
@@ -125,7 +119,7 @@ INTERVAL
 validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force)
 {
   register INTERVAL i;
-  int searchpos;
+  EMACS_INT searchpos;
 
   CHECK_STRING_OR_BUFFER (object);
   CHECK_NUMBER_COERCE_MARKER (*begin);
@@ -161,7 +155,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
     }
   else
     {
-      int len = SCHARS (object);
+      EMACS_INT len = SCHARS (object);
 
       if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)
             && XINT (*end) <= len))
@@ -501,8 +495,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
    if this changes the interval.  */
 
 static INLINE int
-erase_properties (i)
-     INTERVAL i;
+erase_properties (INTERVAL i)
 {
   if (NILP (i->plist))
     return 0;
@@ -519,7 +512,7 @@ INTERVAL
 interval_of (int position, Lisp_Object object)
 {
   register INTERVAL i;
-  int beg, end;
+  EMACS_INT beg, end;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -984,7 +977,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
 /* Return 1 if there's a change in some property between BEG and END.  */
 
 int
-property_change_between_p (int beg, int end)
+property_change_between_p (EMACS_INT beg, EMACS_INT end)
 {
   register INTERVAL i, next;
   Lisp_Object object, pos;
@@ -1173,7 +1166,8 @@ Return t if any property value actually changed, nil otherwise.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
-  register int s, len, modified = 0;
+  register EMACS_INT s, len;
+  register int modified = 0;
   struct gcpro gcpro1;
 
   properties = validate_plist (properties);
@@ -1202,7 +1196,7 @@ Return t if any property value actually changed, nil otherwise.  */)
          skip it.  */
       if (interval_has_all_properties (properties, i))
        {
-         int got = (LENGTH (i) - (s - i->position));
+         EMACS_INT got = (LENGTH (i) - (s - i->position));
          if (got >= len)
            RETURN_UNGCPRO (Qnil);
          len -= got;
@@ -1377,7 +1371,7 @@ void
 set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i)
 {
   register INTERVAL prev_changed = NULL_INTERVAL;
-  register int s, len;
+  register EMACS_INT s, len;
   INTERVAL unchanged;
 
   s = XINT (start);
@@ -1466,7 +1460,8 @@ Use `set-text-properties' if you want to remove all text properties.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
-  register int s, len, modified = 0;
+  register EMACS_INT s, len;
+  register int modified = 0;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -1484,7 +1479,7 @@ Use `set-text-properties' if you want to remove all text properties.  */)
          it covers the entire region.  */
       if (! interval_has_some_properties (properties, i))
        {
-         int got = (LENGTH (i) - (s - i->position));
+         EMACS_INT got = (LENGTH (i) - (s - i->position));
          if (got >= len)
            return Qnil;
          len -= got;
@@ -1551,7 +1546,8 @@ Return t if any property was actually removed, nil otherwise.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
-  register int s, len, modified = 0;
+  register EMACS_INT s, len;
+  register int modified = 0;
   Lisp_Object properties;
   properties = list_of_properties;
 
@@ -1571,7 +1567,7 @@ Return t if any property was actually removed, nil otherwise.  */)
          it covers the entire region.  */
       if (! interval_has_some_properties_list (properties, i))
        {
-         int got = (LENGTH (i) - (s - i->position));
+         EMACS_INT got = (LENGTH (i) - (s - i->position));
          if (got >= len)
            return Qnil;
          len -= got;
@@ -1601,17 +1597,19 @@ Return t if any property was actually removed, nil otherwise.  */)
       if (LENGTH (i) >= len)
        {
          if (! interval_has_some_properties_list (properties, i))
-           if (modified)
-             {
-               if (BUFFERP (object))
-                 signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                      XINT (end) - XINT (start));
-               return Qt;
-             }
-           else
-             return Qnil;
-
-         if (LENGTH (i) == len)
+           {
+             if (modified)
+               {
+                 if (BUFFERP (object))
+                   signal_after_change (XINT (start),
+                                        XINT (end) - XINT (start),
+                                        XINT (end) - XINT (start));
+                 return Qt;
+               }
+             else
+               return Qnil;
+           }
+         else if (LENGTH (i) == len)
            {
              if (!modified && BUFFERP (object))
                modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
@@ -1621,20 +1619,20 @@ Return t if any property was actually removed, nil otherwise.  */)
                                     XINT (end) - XINT (start));
              return Qt;
            }
-
-         /* i has the properties, and goes past the change limit */
-         unchanged = i;
-         i = split_interval_left (i, len);
-         copy_properties (unchanged, i);
-         if (!modified && BUFFERP (object))
-           modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
-         remove_properties (Qnil, properties, i, object);
-         if (BUFFERP (object))
-           signal_after_change (XINT (start), XINT (end) - XINT (start),
-                                XINT (end) - XINT (start));
-         return Qt;
+         else
+           { /* i has the properties, and goes past the change limit.  */
+             unchanged = i;
+             i = split_interval_left (i, len);
+             copy_properties (unchanged, i);
+             if (!modified && BUFFERP (object))
+               modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+             remove_properties (Qnil, properties, i, object);
+             if (BUFFERP (object))
+               signal_after_change (XINT (start), XINT (end) - XINT (start),
+                                    XINT (end) - XINT (start));
+             return Qt;
+           }
        }
-
       if (interval_has_some_properties_list (properties, i))
        {
          if (!modified && BUFFERP (object))
@@ -1658,7 +1656,7 @@ markers).  If OBJECT is a string, START and END are 0-based indices into it.  */
   (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   register INTERVAL i;
-  register int e, pos;
+  register EMACS_INT e, pos;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -1694,7 +1692,7 @@ markers).  If OBJECT is a string, START and END are 0-based indices into it.  */
   (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   register INTERVAL i;
-  register int s, e;
+  register EMACS_INT s, e;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -1806,7 +1804,8 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_
   Lisp_Object res;
   Lisp_Object stuff;
   Lisp_Object plist;
-  int s, e, e2, p, len, modified = 0;
+  EMACS_INT s, e, e2, p, len;
+  int modified = 0;
   struct gcpro gcpro1, gcpro2;
 
   i = validate_interval_range (src, &start, &end, soft);
@@ -1902,12 +1901,12 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp
   i = validate_interval_range (object, &start, &end, soft);
   if (!NULL_INTERVAL_P (i))
     {
-      int s = XINT (start);
-      int e = XINT (end);
+      EMACS_INT s = XINT (start);
+      EMACS_INT e = XINT (end);
 
       while (s < e)
        {
-         int interval_end, len;
+         EMACS_INT interval_end, len;
          Lisp_Object plist;
 
          interval_end = i->position + LENGTH (i);
@@ -1985,7 +1984,7 @@ Lisp_Object
 extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
 {
   Lisp_Object prev = Qnil, head = list;
-  int max = XINT (new_end);
+  EMACS_INT max = XINT (new_end);
 
   for (; CONSP (list); prev = list, list = XCDR (list))
     {
@@ -2059,7 +2058,7 @@ verify_interval_modification (struct buffer *buf, int start, int end)
 
   if (start > end)
     {
-      int temp = start;
+      EMACS_INT temp = start;
       start = end;
       end = temp;
     }
@@ -2229,13 +2228,13 @@ report_interval_modification (Lisp_Object start, Lisp_Object end)
 void
 syms_of_textprop (void)
 {
-  DEFVAR_LISP ("default-text-properties", &Vdefault_text_properties,
+  DEFVAR_LISP ("default-text-properties", Vdefault_text_properties,
               doc: /* Property-list used as default values.
 The value of a property in this list is seen as the value for every
 character that does not have its own value for that property.  */);
   Vdefault_text_properties = Qnil;
 
-  DEFVAR_LISP ("char-property-alias-alist", &Vchar_property_alias_alist,
+  DEFVAR_LISP ("char-property-alias-alist", Vchar_property_alias_alist,
               doc: /* Alist of alternative properties for properties without a value.
 Each element should look like (PROPERTY ALTERNATIVE1 ALTERNATIVE2...).
 If a piece of text has no direct value for a particular property, then
@@ -2244,13 +2243,13 @@ the first non-nil value from the associated alternative properties is
 returned. */);
   Vchar_property_alias_alist = Qnil;
 
-  DEFVAR_LISP ("inhibit-point-motion-hooks", &Vinhibit_point_motion_hooks,
+  DEFVAR_LISP ("inhibit-point-motion-hooks", Vinhibit_point_motion_hooks,
               doc: /* If non-nil, don't run `point-left' and `point-entered' text properties.
 This also inhibits the use of the `intangible' text property.  */);
   Vinhibit_point_motion_hooks = Qnil;
 
   DEFVAR_LISP ("text-property-default-nonsticky",
-              &Vtext_property_default_nonsticky,
+              Vtext_property_default_nonsticky,
               doc: /* Alist of properties vs the corresponding non-stickinesses.
 Each element has the form (PROPERTY . NONSTICKINESS).
 
@@ -2333,5 +2332,3 @@ inherits it if NONSTICKINESS is nil.  The `front-sticky' and
 /*  defsubr (&Scopy_text_properties); */
 }
 
-/* arch-tag: 454cdde8-5f86-4faa-a078-101e3625d479
-   (do not change this comment) */