aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 9e0e9eef0b1..fbbbf1b8434 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -482,11 +482,6 @@ struct buffer_text
482 482
483struct buffer 483struct buffer
484{ 484{
485 /* HEADER.NEXT is the next buffer, in chain of all buffers, including killed
486 buffers. This chain, starting from all_buffers, is used only for garbage
487 collection, in order to collect killed buffers properly. Note that large
488 vectors and large pseudo-vector objects are all on another chain starting
489 from large_vectors. */
490 struct vectorlike_header header; 485 struct vectorlike_header header;
491 486
492 /* The name of this buffer. */ 487 /* The name of this buffer. */
@@ -750,6 +745,9 @@ struct buffer
750 In an indirect buffer, this is the own_text field of another buffer. */ 745 In an indirect buffer, this is the own_text field of another buffer. */
751 struct buffer_text *text; 746 struct buffer_text *text;
752 747
748 /* Next buffer, in chain of all buffers, including killed ones. */
749 struct buffer *next;
750
753 /* Char position of point in buffer. */ 751 /* Char position of point in buffer. */
754 ptrdiff_t pt; 752 ptrdiff_t pt;
755 753
@@ -959,6 +957,27 @@ bset_width_table (struct buffer *b, Lisp_Object val)
959 b->INTERNAL_FIELD (width_table) = val; 957 b->INTERNAL_FIELD (width_table) = val;
960} 958}
961 959
960/* Number of Lisp_Objects at the beginning of struct buffer.
961 If you add, remove, or reorder Lisp_Objects within buffer
962 structure, make sure that this is still correct. */
963
964#define BUFFER_LISP_SIZE \
965 ((offsetof (struct buffer, own_text) - header_size) / word_size)
966
967/* Size of the struct buffer part beyond leading Lisp_Objects, in word_size
968 units. Rounding is needed for --with-wide-int configuration. */
969
970#define BUFFER_REST_SIZE \
971 ((((sizeof (struct buffer) - offsetof (struct buffer, own_text)) \
972 + (word_size - 1)) & ~(word_size - 1)) / word_size)
973
974/* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE
975 is required for GC, but BUFFER_REST_SIZE is set up just to be consistent
976 with other pseudovectors. */
977
978#define BUFFER_PVEC_INIT(b) \
979 XSETPVECTYPESIZE (b, PVEC_BUFFER, BUFFER_LISP_SIZE, BUFFER_REST_SIZE)
980
962/* Convenient check whether buffer B is live. */ 981/* Convenient check whether buffer B is live. */
963 982
964#define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name))) 983#define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name)))
@@ -986,7 +1005,7 @@ extern struct buffer *all_buffers;
986/* Used to iterate over the chain above. */ 1005/* Used to iterate over the chain above. */
987 1006
988#define FOR_EACH_BUFFER(b) \ 1007#define FOR_EACH_BUFFER(b) \
989 for ((b) = all_buffers; (b); (b) = (b)->header.next.buffer) 1008 for ((b) = all_buffers; (b); (b) = (b)->next)
990 1009
991/* This points to the current buffer. */ 1010/* This points to the current buffer. */
992 1011