comparison src/buffer.h @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents f15b9906481d
children 4135e9f40991 d7ddb3e565de
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
23 /* Accessing the parameters of the current buffer. */ 23 /* Accessing the parameters of the current buffer. */
24 24
25 /* These macros come in pairs, one for the char position 25 /* These macros come in pairs, one for the char position
26 and one for the byte position. */ 26 and one for the byte position. */
27 27
28 /* Position of beginning of buffer. */ 28 /* Position of beginning of buffer. */
29 #define BEG (1) 29 #define BEG (1)
30 #define BEG_BYTE (1) 30 #define BEG_BYTE (1)
31 31
32 /* Position of beginning of accessible range of buffer. */ 32 /* Position of beginning of accessible range of buffer. */
33 #define BEGV (current_buffer->begv) 33 #define BEGV (current_buffer->begv)
34 #define BEGV_BYTE (current_buffer->begv_byte) 34 #define BEGV_BYTE (current_buffer->begv_byte)
35 35
36 /* Position of point in buffer. The "+ 0" makes this 36 /* Position of point in buffer. The "+ 0" makes this
37 not an l-value, so you can't assign to it. Use SET_PT instead. */ 37 not an l-value, so you can't assign to it. Use SET_PT instead. */
38 #define PT (current_buffer->pt + 0) 38 #define PT (current_buffer->pt + 0)
39 #define PT_BYTE (current_buffer->pt_byte + 0) 39 #define PT_BYTE (current_buffer->pt_byte + 0)
40 40
41 /* Position of gap in buffer. */ 41 /* Position of gap in buffer. */
42 #define GPT (current_buffer->text->gpt) 42 #define GPT (current_buffer->text->gpt)
43 #define GPT_BYTE (current_buffer->text->gpt_byte) 43 #define GPT_BYTE (current_buffer->text->gpt_byte)
44 44
45 /* Position of end of accessible range of buffer. */ 45 /* Position of end of accessible range of buffer. */
46 #define ZV (current_buffer->zv) 46 #define ZV (current_buffer->zv)
47 #define ZV_BYTE (current_buffer->zv_byte) 47 #define ZV_BYTE (current_buffer->zv_byte)
48 48
49 /* Position of end of buffer. */ 49 /* Position of end of buffer. */
50 #define Z (current_buffer->text->z) 50 #define Z (current_buffer->text->z)
51 #define Z_BYTE (current_buffer->text->z_byte) 51 #define Z_BYTE (current_buffer->text->z_byte)
52 52
53 /* Macros for the addresses of places in the buffer. */ 53 /* Macros for the addresses of places in the buffer. */
54 54
55 /* Address of beginning of buffer. */ 55 /* Address of beginning of buffer. */
56 #define BEG_ADDR (current_buffer->text->beg) 56 #define BEG_ADDR (current_buffer->text->beg)
57 57
58 /* Address of beginning of accessible range of buffer. */ 58 /* Address of beginning of accessible range of buffer. */
59 #define BEGV_ADDR (BYTE_POS_ADDR (current_buffer->begv_byte)) 59 #define BEGV_ADDR (BYTE_POS_ADDR (current_buffer->begv_byte))
60 60
61 /* Address of point in buffer. */ 61 /* Address of point in buffer. */
62 #define PT_ADDR (BYTE_POS_ADDR (current_buffer->pt_byte)) 62 #define PT_ADDR (BYTE_POS_ADDR (current_buffer->pt_byte))
63 63
64 /* Address of beginning of gap in buffer. */ 64 /* Address of beginning of gap in buffer. */
65 #define GPT_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte - 1) 65 #define GPT_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte - 1)
66 66
67 /* Address of end of gap in buffer. */ 67 /* Address of end of gap in buffer. */
68 #define GAP_END_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte + current_buffer->text->gap_size - 1) 68 #define GAP_END_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte + current_buffer->text->gap_size - 1)
69 69
70 /* Address of end of accessible range of buffer. */ 70 /* Address of end of accessible range of buffer. */
71 #define ZV_ADDR (BYTE_POS_ADDR (current_buffer->zv_byte)) 71 #define ZV_ADDR (BYTE_POS_ADDR (current_buffer->zv_byte))
72 72
73 /* Address of end of buffer. */ 73 /* Address of end of buffer. */
74 #define Z_ADDR (current_buffer->text->beg + current_buffer->text->gap_size + current_buffer->text->z_byte - 1) 74 #define Z_ADDR (current_buffer->text->beg + current_buffer->text->gap_size + current_buffer->text->z_byte - 1)
75 75
76 /* Size of gap. */ 76 /* Size of gap. */
77 #define GAP_SIZE (current_buffer->text->gap_size) 77 #define GAP_SIZE (current_buffer->text->gap_size)
78 78
99 (BEGV <= GPT && GPT_BYTE <= (BYTEPOS) ? GPT_BYTE : BEGV_BYTE) 99 (BEGV <= GPT && GPT_BYTE <= (BYTEPOS) ? GPT_BYTE : BEGV_BYTE)
100 100
101 /* Similar macros to operate on a specified buffer. 101 /* Similar macros to operate on a specified buffer.
102 Note that many of these evaluate the buffer argument more than once. */ 102 Note that many of these evaluate the buffer argument more than once. */
103 103
104 /* Position of beginning of buffer. */ 104 /* Position of beginning of buffer. */
105 #define BUF_BEG(buf) (1) 105 #define BUF_BEG(buf) (1)
106 #define BUF_BEG_BYTE(buf) (1) 106 #define BUF_BEG_BYTE(buf) (1)
107 107
108 /* Position of beginning of accessible range of buffer. */ 108 /* Position of beginning of accessible range of buffer. */
109 #define BUF_BEGV(buf) ((buf)->begv) 109 #define BUF_BEGV(buf) ((buf)->begv)
110 #define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) 110 #define BUF_BEGV_BYTE(buf) ((buf)->begv_byte)
111 111
112 /* Position of point in buffer. */ 112 /* Position of point in buffer. */
113 #define BUF_PT(buf) ((buf)->pt) 113 #define BUF_PT(buf) ((buf)->pt)
114 #define BUF_PT_BYTE(buf) ((buf)->pt_byte) 114 #define BUF_PT_BYTE(buf) ((buf)->pt_byte)
115 115
116 /* Position of gap in buffer. */ 116 /* Position of gap in buffer. */
117 #define BUF_GPT(buf) ((buf)->text->gpt) 117 #define BUF_GPT(buf) ((buf)->text->gpt)
118 #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) 118 #define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte)
119 119
120 /* Position of end of accessible range of buffer. */ 120 /* Position of end of accessible range of buffer. */
121 #define BUF_ZV(buf) ((buf)->zv) 121 #define BUF_ZV(buf) ((buf)->zv)
122 #define BUF_ZV_BYTE(buf) ((buf)->zv_byte) 122 #define BUF_ZV_BYTE(buf) ((buf)->zv_byte)
123 123
124 /* Position of end of buffer. */ 124 /* Position of end of buffer. */
125 #define BUF_Z(buf) ((buf)->text->z) 125 #define BUF_Z(buf) ((buf)->text->z)
126 #define BUF_Z_BYTE(buf) ((buf)->text->z_byte) 126 #define BUF_Z_BYTE(buf) ((buf)->text->z_byte)
127 127
128 /* Address of beginning of buffer. */ 128 /* Address of beginning of buffer. */
129 #define BUF_BEG_ADDR(buf) ((buf)->text->beg) 129 #define BUF_BEG_ADDR(buf) ((buf)->text->beg)
195 if ((start) - BUF_BEG (buf) < BUF_BEG_UNCHANGED (buf)) \ 195 if ((start) - BUF_BEG (buf) < BUF_BEG_UNCHANGED (buf)) \
196 BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \ 196 BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \
197 } \ 197 } \
198 } \ 198 } \
199 while (0) 199 while (0)
200 200
201 201
202 /* Macros to set PT in the current buffer, or another buffer. */ 202 /* Macros to set PT in the current buffer, or another buffer. */
203 203
204 #define SET_PT(position) (set_point (current_buffer, (position))) 204 #define SET_PT(position) (set_point (current_buffer, (position)))
205 #define TEMP_SET_PT(position) (temp_set_point (current_buffer, (position))) 205 #define TEMP_SET_PT(position) (temp_set_point (current_buffer, (position)))
334 334
335 /* Macros for accessing a character or byte, 335 /* Macros for accessing a character or byte,
336 or converting between byte positions and addresses, 336 or converting between byte positions and addresses,
337 in a specified buffer. */ 337 in a specified buffer. */
338 338
339 /* Return the address of character at byte position POS in buffer BUF. 339 /* Return the address of character at byte position POS in buffer BUF.
340 Note that both arguments can be computed more than once. */ 340 Note that both arguments can be computed more than once. */
341 341
342 #define BUF_BYTE_ADDRESS(buf, pos) \ 342 #define BUF_BYTE_ADDRESS(buf, pos) \
343 ((buf)->text->beg + (pos) - 1 \ 343 ((buf)->text->beg + (pos) - 1 \
344 + ((pos) >= (buf)->text->gpt_byte ? (buf)->text->gap_size : 0)) 344 + ((pos) >= (buf)->text->gpt_byte ? (buf)->text->gap_size : 0))
345 345
346 /* Return the address of character at char position POS in buffer BUF. 346 /* Return the address of character at char position POS in buffer BUF.
347 Note that both arguments can be computed more than once. */ 347 Note that both arguments can be computed more than once. */
348 348
349 #define BUF_CHAR_ADDRESS(buf, pos) \ 349 #define BUF_CHAR_ADDRESS(buf, pos) \
350 ((buf)->text->beg + buf_charpos_to_bytepos ((buf), (pos)) - 1 \ 350 ((buf)->text->beg + buf_charpos_to_bytepos ((buf), (pos)) - 1 \
351 + ((pos) >= (buf)->text->gpt ? (buf)->text->gap_size : 0)) 351 + ((pos) >= (buf)->text->gpt ? (buf)->text->gap_size : 0))
394 /* Actual address of buffer contents. If REL_ALLOC is defined, 394 /* Actual address of buffer contents. If REL_ALLOC is defined,
395 this address might change when blocks are relocated which can 395 this address might change when blocks are relocated which can
396 e.g. happen when malloc is called. So, don't pass a pointer 396 e.g. happen when malloc is called. So, don't pass a pointer
397 into a buffer's text to functions that malloc. */ 397 into a buffer's text to functions that malloc. */
398 unsigned char *beg; 398 unsigned char *beg;
399 399
400 int gpt; /* Char pos of gap in buffer. */ 400 int gpt; /* Char pos of gap in buffer. */
401 int z; /* Char pos of end of buffer. */ 401 int z; /* Char pos of end of buffer. */
402 int gpt_byte; /* Byte pos of gap in buffer. */ 402 int gpt_byte; /* Byte pos of gap in buffer. */
403 int z_byte; /* Byte pos of end of buffer. */ 403 int z_byte; /* Byte pos of end of buffer. */
404 int gap_size; /* Size of buffer's gap. */ 404 int gap_size; /* Size of buffer's gap. */
485 for a buffer-local variable is stored in that variable's slot 485 for a buffer-local variable is stored in that variable's slot
486 in buffer_local_flags as a Lisp integer. If the index is -1, 486 in buffer_local_flags as a Lisp integer. If the index is -1,
487 this means the variable is always local in all buffers. */ 487 this means the variable is always local in all buffers. */
488 #define MAX_PER_BUFFER_VARS 50 488 #define MAX_PER_BUFFER_VARS 50
489 char local_flags[MAX_PER_BUFFER_VARS]; 489 char local_flags[MAX_PER_BUFFER_VARS];
490 490
491 /* Set to the modtime of the visited file when read or written. 491 /* Set to the modtime of the visited file when read or written.
492 -1 means visited file was nonexistent. 492 -1 means visited file was nonexistent.
493 0 means visited file modtime unknown; in no case complain 493 0 means visited file modtime unknown; in no case complain
494 about any mismatch on next save attempt. */ 494 about any mismatch on next save attempt. */
495 int modtime; 495 int modtime;
577 But we can't store it in the struct buffer_text 577 But we can't store it in the struct buffer_text
578 because local variables have to be right in the struct buffer. 578 because local variables have to be right in the struct buffer.
579 So we copy it around in set_buffer_internal. 579 So we copy it around in set_buffer_internal.
580 This comes before `name' because it is marked in a special way. */ 580 This comes before `name' because it is marked in a special way. */
581 Lisp_Object undo_list; 581 Lisp_Object undo_list;
582 582
583 /* Analogous to mode_line_format for the line displayed at the top 583 /* Analogous to mode_line_format for the line displayed at the top
584 of windows. Nil means don't display that line. */ 584 of windows. Nil means don't display that line. */
585 Lisp_Object header_line_format; 585 Lisp_Object header_line_format;
586 586
587 /* Keys that are bound local to this buffer. */ 587 /* Keys that are bound local to this buffer. */
710 or nil if that window no longer displays this buffer. */ 710 or nil if that window no longer displays this buffer. */
711 Lisp_Object last_selected_window; 711 Lisp_Object last_selected_window;
712 712
713 /* Incremented each time the buffer is displayed in a window. */ 713 /* Incremented each time the buffer is displayed in a window. */
714 Lisp_Object display_count; 714 Lisp_Object display_count;
715 715
716 /* Widths of left and right marginal areas for windows displaying 716 /* Widths of left and right marginal areas for windows displaying
717 this buffer. */ 717 this buffer. */
718 Lisp_Object left_margin_width, right_margin_width; 718 Lisp_Object left_margin_width, right_margin_width;
719 719
720 /* Non-nil means indicate lines not displaying text (in a style 720 /* Non-nil means indicate lines not displaying text (in a style
727 /* If scrolling the display because point is below the bottom of a 727 /* If scrolling the display because point is below the bottom of a
728 window showing this buffer, try to choose a window start so 728 window showing this buffer, try to choose a window start so
729 that point ends up this number of lines from the top of the 729 that point ends up this number of lines from the top of the
730 window. Nil means that scrolling method isn't used. */ 730 window. Nil means that scrolling method isn't used. */
731 Lisp_Object scroll_up_aggressively; 731 Lisp_Object scroll_up_aggressively;
732 732
733 /* If scrolling the display because point is above the top of a 733 /* If scrolling the display because point is above the top of a
734 window showing this buffer, try to choose a window start so 734 window showing this buffer, try to choose a window start so
735 that point ends up this number of lines from the bottom of the 735 that point ends up this number of lines from the bottom of the
736 window. Nil means that scrolling method isn't used. */ 736 window. Nil means that scrolling method isn't used. */
737 Lisp_Object scroll_down_aggressively; 737 Lisp_Object scroll_down_aggressively;