1 /* Markers: examining, setting and killing.
2 Copyright (C) 1985, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
4 This file is part of SXEmacs
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 SXEmacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Synched up with: FSF 19.30. */
22 /* This file has been Mule-ized. */
24 /* Note that markers are currently kept in an unordered list.
25 This means that marker operations may be inefficient if
26 there are a bunch of markers in the buffer. This probably
27 won't have a significant impact on redisplay (which uses
28 markers), but if it does, it wouldn't be too hard to change
29 to an ordered gap array. (Just copy the code from extents.c.)
37 static Lisp_Object mark_marker(Lisp_Object obj)
39 Lisp_Marker *marker = XMARKER(obj);
41 /* DO NOT mark through the marker's chain.
42 The buffer's markers chain does not preserve markers from gc;
43 Instead, markers are removed from the chain when they are freed
49 XSETBUFFER(buf, marker->buffer);
54 print_marker(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
56 Lisp_Marker *marker = XMARKER(obj);
60 error("printing unreadable object #<marker 0x%lx>",
63 write_c_string(GETTEXT("#<marker "), printcharfun);
65 write_c_string(GETTEXT("in no buffer"), printcharfun);
67 sprintf(buf, "at %ld in ", (long)marker_position(obj));
68 write_c_string(buf, printcharfun);
69 print_internal(marker->buffer->name, printcharfun, 0);
71 sprintf(buf, " 0x%lx>", (long)marker);
72 write_c_string(buf, printcharfun);
75 static int marker_equal(Lisp_Object obj1, Lisp_Object obj2, int depth)
77 Lisp_Marker *marker1 = XMARKER(obj1);
78 Lisp_Marker *marker2 = XMARKER(obj2);
80 return ((marker1->buffer == marker2->buffer) &&
81 (marker1->memind == marker2->memind ||
82 /* All markers pointing nowhere are equal */
86 static unsigned long marker_hash(Lisp_Object obj, int depth)