25 |
/* These macros come in pairs, one for the char position |
/* These macros come in pairs, one for the char position |
26 |
and one for the byte position. */ |
and one for the byte position. */ |
27 |
|
|
28 |
/* Position of beginning of buffer. */ |
/* Position of beginning of buffer. */ |
29 |
#define BEG (1) |
#define BEG (1) |
30 |
#define BEG_BYTE (1) |
#define BEG_BYTE (1) |
31 |
|
|
32 |
/* Position of beginning of accessible range of buffer. */ |
/* Position of beginning of accessible range of buffer. */ |
33 |
#define BEGV (current_buffer->begv) |
#define BEGV (current_buffer->begv) |
34 |
#define BEGV_BYTE (current_buffer->begv_byte) |
#define BEGV_BYTE (current_buffer->begv_byte) |
35 |
|
|
36 |
/* Position of point in buffer. The "+ 0" makes this |
/* 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. */ |
not an l-value, so you can't assign to it. Use SET_PT instead. */ |
38 |
#define PT (current_buffer->pt + 0) |
#define PT (current_buffer->pt + 0) |
39 |
#define PT_BYTE (current_buffer->pt_byte + 0) |
#define PT_BYTE (current_buffer->pt_byte + 0) |
40 |
|
|
41 |
/* Position of gap in buffer. */ |
/* Position of gap in buffer. */ |
42 |
#define GPT (current_buffer->text->gpt) |
#define GPT (current_buffer->text->gpt) |
43 |
#define GPT_BYTE (current_buffer->text->gpt_byte) |
#define GPT_BYTE (current_buffer->text->gpt_byte) |
44 |
|
|
45 |
/* Position of end of accessible range of buffer. */ |
/* Position of end of accessible range of buffer. */ |
46 |
#define ZV (current_buffer->zv) |
#define ZV (current_buffer->zv) |
47 |
#define ZV_BYTE (current_buffer->zv_byte) |
#define ZV_BYTE (current_buffer->zv_byte) |
48 |
|
|
49 |
/* Position of end of buffer. */ |
/* Position of end of buffer. */ |
50 |
#define Z (current_buffer->text->z) |
#define Z (current_buffer->text->z) |
51 |
#define Z_BYTE (current_buffer->text->z_byte) |
#define Z_BYTE (current_buffer->text->z_byte) |
52 |
|
|
53 |
/* Macros for the addresses of places in the buffer. */ |
/* Macros for the addresses of places in the buffer. */ |
54 |
|
|
55 |
/* Address of beginning of buffer. */ |
/* Address of beginning of buffer. */ |
56 |
#define BEG_ADDR (current_buffer->text->beg) |
#define BEG_ADDR (current_buffer->text->beg) |
57 |
|
|
58 |
/* Address of beginning of accessible range of buffer. */ |
/* Address of beginning of accessible range of buffer. */ |
59 |
#define BEGV_ADDR (BYTE_POS_ADDR (current_buffer->begv_byte)) |
#define BEGV_ADDR (BYTE_POS_ADDR (current_buffer->begv_byte)) |
60 |
|
|
61 |
/* Address of point in buffer. */ |
/* Address of point in buffer. */ |
62 |
#define PT_ADDR (BYTE_POS_ADDR (current_buffer->pt_byte)) |
#define PT_ADDR (BYTE_POS_ADDR (current_buffer->pt_byte)) |
63 |
|
|
64 |
/* Address of beginning of gap in buffer. */ |
/* Address of beginning of gap in buffer. */ |
65 |
#define GPT_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte - 1) |
#define GPT_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte - 1) |
66 |
|
|
67 |
/* Address of end of gap in buffer. */ |
/* 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) |
#define GAP_END_ADDR (current_buffer->text->beg + current_buffer->text->gpt_byte + current_buffer->text->gap_size - 1) |
69 |
|
|
70 |
/* Address of end of accessible range of buffer. */ |
/* Address of end of accessible range of buffer. */ |
71 |
#define ZV_ADDR (BYTE_POS_ADDR (current_buffer->zv_byte)) |
#define ZV_ADDR (BYTE_POS_ADDR (current_buffer->zv_byte)) |
72 |
|
|
73 |
/* Address of end of buffer. */ |
/* Address of end of buffer. */ |
74 |
#define Z_ADDR (current_buffer->text->beg + current_buffer->text->gap_size + current_buffer->text->z_byte - 1) |
#define Z_ADDR (current_buffer->text->beg + current_buffer->text->gap_size + current_buffer->text->z_byte - 1) |
75 |
|
|
76 |
/* Size of gap. */ |
/* Size of gap. */ |
101 |
/* Similar macros to operate on a specified buffer. |
/* Similar macros to operate on a specified buffer. |
102 |
Note that many of these evaluate the buffer argument more than once. */ |
Note that many of these evaluate the buffer argument more than once. */ |
103 |
|
|
104 |
/* Position of beginning of buffer. */ |
/* Position of beginning of buffer. */ |
105 |
#define BUF_BEG(buf) (1) |
#define BUF_BEG(buf) (1) |
106 |
#define BUF_BEG_BYTE(buf) (1) |
#define BUF_BEG_BYTE(buf) (1) |
107 |
|
|
108 |
/* Position of beginning of accessible range of buffer. */ |
/* Position of beginning of accessible range of buffer. */ |
109 |
#define BUF_BEGV(buf) ((buf)->begv) |
#define BUF_BEGV(buf) ((buf)->begv) |
110 |
#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) |
#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) |
111 |
|
|
112 |
/* Position of point in buffer. */ |
/* Position of point in buffer. */ |
113 |
#define BUF_PT(buf) ((buf)->pt) |
#define BUF_PT(buf) ((buf)->pt) |
114 |
#define BUF_PT_BYTE(buf) ((buf)->pt_byte) |
#define BUF_PT_BYTE(buf) ((buf)->pt_byte) |
115 |
|
|
116 |
/* Position of gap in buffer. */ |
/* Position of gap in buffer. */ |
117 |
#define BUF_GPT(buf) ((buf)->text->gpt) |
#define BUF_GPT(buf) ((buf)->text->gpt) |
118 |
#define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) |
#define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) |
119 |
|
|
120 |
/* Position of end of accessible range of buffer. */ |
/* Position of end of accessible range of buffer. */ |
121 |
#define BUF_ZV(buf) ((buf)->zv) |
#define BUF_ZV(buf) ((buf)->zv) |
122 |
#define BUF_ZV_BYTE(buf) ((buf)->zv_byte) |
#define BUF_ZV_BYTE(buf) ((buf)->zv_byte) |
123 |
|
|
124 |
/* Position of end of buffer. */ |
/* Position of end of buffer. */ |
125 |
#define BUF_Z(buf) ((buf)->text->z) |
#define BUF_Z(buf) ((buf)->text->z) |
126 |
#define BUF_Z_BYTE(buf) ((buf)->text->z_byte) |
#define BUF_Z_BYTE(buf) ((buf)->text->z_byte) |
127 |
|
|
197 |
} \ |
} \ |
198 |
} \ |
} \ |
199 |
while (0) |
while (0) |
200 |
|
|
201 |
|
|
202 |
/* Macros to set PT in the current buffer, or another buffer. */ |
/* Macros to set PT in the current buffer, or another buffer. */ |
203 |
|
|
336 |
or converting between byte positions and addresses, |
or converting between byte positions and addresses, |
337 |
in a specified buffer. */ |
in a specified buffer. */ |
338 |
|
|
339 |
/* Return the address of character at byte position POS in buffer BUF. |
/* Return the address of character at byte position POS in buffer BUF. |
340 |
Note that both arguments can be computed more than once. */ |
Note that both arguments can be computed more than once. */ |
341 |
|
|
342 |
#define BUF_BYTE_ADDRESS(buf, pos) \ |
#define BUF_BYTE_ADDRESS(buf, pos) \ |
343 |
((buf)->text->beg + (pos) - 1 \ |
((buf)->text->beg + (pos) - 1 \ |
344 |
+ ((pos) >= (buf)->text->gpt_byte ? (buf)->text->gap_size : 0)) |
+ ((pos) >= (buf)->text->gpt_byte ? (buf)->text->gap_size : 0)) |
345 |
|
|
346 |
/* Return the address of character at char position POS in buffer BUF. |
/* Return the address of character at char position POS in buffer BUF. |
347 |
Note that both arguments can be computed more than once. */ |
Note that both arguments can be computed more than once. */ |
348 |
|
|
349 |
#define BUF_CHAR_ADDRESS(buf, pos) \ |
#define BUF_CHAR_ADDRESS(buf, pos) \ |
396 |
e.g. happen when malloc is called. So, don't pass a pointer |
e.g. happen when malloc is called. So, don't pass a pointer |
397 |
into a buffer's text to functions that malloc. */ |
into a buffer's text to functions that malloc. */ |
398 |
unsigned char *beg; |
unsigned char *beg; |
399 |
|
|
400 |
int gpt; /* Char pos of gap in buffer. */ |
int gpt; /* Char pos of gap in buffer. */ |
401 |
int z; /* Char pos of end of buffer. */ |
int z; /* Char pos of end of buffer. */ |
402 |
int gpt_byte; /* Byte pos of gap in buffer. */ |
int gpt_byte; /* Byte pos of gap in buffer. */ |
487 |
this means the variable is always local in all buffers. */ |
this means the variable is always local in all buffers. */ |
488 |
#define MAX_PER_BUFFER_VARS 50 |
#define MAX_PER_BUFFER_VARS 50 |
489 |
char local_flags[MAX_PER_BUFFER_VARS]; |
char local_flags[MAX_PER_BUFFER_VARS]; |
490 |
|
|
491 |
/* Set to the modtime of the visited file when read or written. |
/* Set to the modtime of the visited file when read or written. |
492 |
-1 means visited file was nonexistent. |
-1 means visited file was nonexistent. |
493 |
0 means visited file modtime unknown; in no case complain |
0 means visited file modtime unknown; in no case complain |
531 |
displaying this buffer. */ |
displaying this buffer. */ |
532 |
unsigned prevent_redisplay_optimizations_p : 1; |
unsigned prevent_redisplay_optimizations_p : 1; |
533 |
|
|
|
/* Changes in the buffer are recorded here for undo. |
|
|
t means don't record anything. |
|
|
This information belongs to the base buffer of an indirect buffer, |
|
|
But we can't store it in the struct buffer_text |
|
|
because local variables have to be right in the struct buffer. |
|
|
So we copy it around in set_buffer_internal. |
|
|
This comes before `name' because it is marked in a special way. */ |
|
|
Lisp_Object undo_list; |
|
|
|
|
534 |
/* Everything from here down must be a Lisp_Object. */ |
/* Everything from here down must be a Lisp_Object. */ |
535 |
|
|
536 |
/* The name of this buffer. */ |
/* The name of this buffer. */ |
570 |
Lisp_Object mode_name; |
Lisp_Object mode_name; |
571 |
/* Mode line element that controls format of mode line. */ |
/* Mode line element that controls format of mode line. */ |
572 |
Lisp_Object mode_line_format; |
Lisp_Object mode_line_format; |
573 |
|
|
574 |
|
/* Changes in the buffer are recorded here for undo. |
575 |
|
t means don't record anything. |
576 |
|
This information belongs to the base buffer of an indirect buffer, |
577 |
|
But we can't store it in the struct buffer_text |
578 |
|
because local variables have to be right in the struct buffer. |
579 |
|
So we copy it around in set_buffer_internal. |
580 |
|
This comes before `name' because it is marked in a special way. */ |
581 |
|
Lisp_Object undo_list; |
582 |
|
|
583 |
/* Analogous to mode_line_format for the line displayed at the top |
/* Analogous to mode_line_format for the line displayed at the top |
584 |
of windows. Nil means don't display that line. */ |
of windows. Nil means don't display that line. */ |
585 |
Lisp_Object header_line_format; |
Lisp_Object header_line_format; |
712 |
|
|
713 |
/* Incremented each time the buffer is displayed in a window. */ |
/* Incremented each time the buffer is displayed in a window. */ |
714 |
Lisp_Object display_count; |
Lisp_Object display_count; |
715 |
|
|
716 |
/* Widths of left and right marginal areas for windows displaying |
/* Widths of left and right marginal areas for windows displaying |
717 |
this buffer. */ |
this buffer. */ |
718 |
Lisp_Object left_margin_width, right_margin_width; |
Lisp_Object left_margin_width, right_margin_width; |
729 |
that point ends up this number of lines from the top of the |
that point ends up this number of lines from the top of the |
730 |
window. Nil means that scrolling method isn't used. */ |
window. Nil means that scrolling method isn't used. */ |
731 |
Lisp_Object scroll_up_aggressively; |
Lisp_Object scroll_up_aggressively; |
732 |
|
|
733 |
/* If scrolling the display because point is above the top of a |
/* If scrolling the display because point is above the top of a |
734 |
window showing this buffer, try to choose a window start so |
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 |
that point ends up this number of lines from the bottom of the |