/[emacs]/emacs/src/buffer.h
ViewVC logotype

Diff of /emacs/src/buffer.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.87 by lektu, Tue Feb 4 14:03:11 2003 UTC revision 1.88 by monnier, Thu Apr 17 21:52:01 2003 UTC
# Line 62  Boston, MA 02111-1307, USA.  */ Line 62  Boston, MA 02111-1307, USA.  */
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 - BEG_BYTE)
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 - BEG_BYTE)
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 - BEG_BYTE)
75    
76  /* Size of gap.  */  /* Size of gap.  */
77  #define GAP_SIZE (current_buffer->text->gap_size)  #define GAP_SIZE (current_buffer->text->gap_size)
# Line 102  Boston, MA 02111-1307, USA.  */ Line 102  Boston, MA 02111-1307, USA.  */
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) (BEG)
106  #define BUF_BEG_BYTE(buf) (1)  #define BUF_BEG_BYTE(buf) (BEG_BYTE)
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)
# Line 129  Boston, MA 02111-1307, USA.  */ Line 129  Boston, MA 02111-1307, USA.  */
129  #define BUF_BEG_ADDR(buf) ((buf)->text->beg)  #define BUF_BEG_ADDR(buf) ((buf)->text->beg)
130    
131  /* Address of beginning of gap of buffer.  */  /* Address of beginning of gap of buffer.  */
132  #define BUF_GPT_ADDR(buf) ((buf)->text->beg + (buf)->text->gpt_byte - 1)  #define BUF_GPT_ADDR(buf) ((buf)->text->beg + (buf)->text->gpt_byte - BEG_BYTE)
133    
134  /* Address of end of buffer.  */  /* Address of end of buffer.  */
135  #define BUF_Z_ADDR(buf) ((buf)->text->beg + (buf)->text->gap_size + (buf)->text->z_byte - 1)  #define BUF_Z_ADDR(buf) ((buf)->text->beg + (buf)->text->gap_size + (buf)->text->z_byte - BEG_BYTE)
136    
137  /* Address of end of gap in buffer.  */  /* Address of end of gap in buffer.  */
138  #define BUF_GAP_END_ADDR(buf) ((buf)->text->beg + (buf)->text->gpt_byte + (buf)->text->gap_size - 1)  #define BUF_GAP_END_ADDR(buf) ((buf)->text->beg + (buf)->text->gpt_byte + (buf)->text->gap_size - BEG_BYTE)
139    
140  /* Size of gap.  */  /* Size of gap.  */
141  #define BUF_GAP_SIZE(buf) ((buf)->text->gap_size)  #define BUF_GAP_SIZE(buf) ((buf)->text->gap_size)
# Line 280  else Line 280  else
280  /* Return the address of byte position N in current buffer.  */  /* Return the address of byte position N in current buffer.  */
281    
282  #define BYTE_POS_ADDR(n) \  #define BYTE_POS_ADDR(n) \
283    (((n) >= GPT_BYTE ? GAP_SIZE : 0) + (n) + BEG_ADDR - 1)    (((n) >= GPT_BYTE ? GAP_SIZE : 0) + (n) + BEG_ADDR - BEG_BYTE)
284    
285  /* Return the address of char position N.  */  /* Return the address of char position N.  */
286    
287  #define CHAR_POS_ADDR(n)                        \  #define CHAR_POS_ADDR(n)                        \
288    (((n) >= GPT ? GAP_SIZE : 0)                  \    (((n) >= GPT ? GAP_SIZE : 0)                  \
289     + buf_charpos_to_bytepos (current_buffer, n) \     + buf_charpos_to_bytepos (current_buffer, n) \
290     + BEG_ADDR - 1)     + BEG_ADDR - BEG_BYTE)
291    
292  /* Convert a character position to a byte position.  */  /* Convert a character position to a byte position.  */
293    
# Line 303  else Line 303  else
303    
304  #define PTR_BYTE_POS(ptr) \  #define PTR_BYTE_POS(ptr) \
305  ((ptr) - (current_buffer)->text->beg                                        \  ((ptr) - (current_buffer)->text->beg                                        \
306   - (ptr - (current_buffer)->text->beg < (unsigned) GPT_BYTE ? 0 : GAP_SIZE) \   - (ptr - (current_buffer)->text->beg <= (unsigned) (GPT_BYTE - BEG_BYTE) ? 0 : GAP_SIZE) \
307   + 1)   + BEG_BYTE)
308    
309  /* Return character at position POS.  */  /* Return character at position POS.  */
310    
# Line 327  extern int _fetch_multibyte_char_len; Line 327  extern int _fetch_multibyte_char_len;
327    
328  #define FETCH_MULTIBYTE_CHAR(pos)                                       \  #define FETCH_MULTIBYTE_CHAR(pos)                                       \
329    (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0)        \    (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0)        \
330                                 + (pos) + BEG_ADDR - 1),                 \                                 + (pos) + BEG_ADDR - BEG_BYTE),                  \
331     _fetch_multibyte_char_len                                            \     _fetch_multibyte_char_len                                            \
332        = ((pos) >= GPT_BYTE ? ZV_BYTE : GPT_BYTE) - (pos),               \        = ((pos) >= GPT_BYTE ? ZV_BYTE : GPT_BYTE) - (pos),               \
333     STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))     STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
# Line 340  extern int _fetch_multibyte_char_len; Line 340  extern int _fetch_multibyte_char_len;
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) - BEG_BYTE            \
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) \
350  ((buf)->text->beg + buf_charpos_to_bytepos ((buf), (pos)) - 1   \  ((buf)->text->beg + buf_charpos_to_bytepos ((buf), (pos)) - BEG_BYTE    \
351   + ((pos) >= (buf)->text->gpt ? (buf)->text->gap_size : 0))   + ((pos) >= (buf)->text->gpt ? (buf)->text->gap_size : 0))
352    
353  /* Convert PTR, the address of a char in buffer BUF,  /* Convert PTR, the address of a char in buffer BUF,
# Line 355  extern int _fetch_multibyte_char_len; Line 355  extern int _fetch_multibyte_char_len;
355    
356  #define BUF_PTR_BYTE_POS(buf, ptr)                              \  #define BUF_PTR_BYTE_POS(buf, ptr)                              \
357  ((ptr) - (buf)->text->beg                                       \  ((ptr) - (buf)->text->beg                                       \
358   - (ptr - (buf)->text->beg < (unsigned) BUF_GPT_BYTE ((buf))    \   - (ptr - (buf)->text->beg <= (unsigned) (BUF_GPT_BYTE ((buf)) - BEG_BYTE)\
359      ? 0 : BUF_GAP_SIZE ((buf)))                                 \      ? 0 : BUF_GAP_SIZE ((buf)))                                 \
360   + 1)   + BEG_BYTE)
361    
362  /* Return the character at byte position POS in buffer BUF.   */  /* Return the character at byte position POS in buffer BUF.   */
363    
# Line 378  extern int _fetch_multibyte_char_len; Line 378  extern int _fetch_multibyte_char_len;
378  #define BUF_FETCH_MULTIBYTE_CHAR(buf, pos)                              \  #define BUF_FETCH_MULTIBYTE_CHAR(buf, pos)                              \
379    (_fetch_multibyte_char_p                                              \    (_fetch_multibyte_char_p                                              \
380       = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0)          \       = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0)          \
381          + (pos) + BUF_BEG_ADDR (buf) - 1),                              \          + (pos) + BUF_BEG_ADDR (buf) - BEG_BYTE),                       \
382     _fetch_multibyte_char_len                                            \     _fetch_multibyte_char_len                                            \
383       = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_ZV_BYTE (buf) : BUF_GPT_BYTE (buf)) \       = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_ZV_BYTE (buf) : BUF_GPT_BYTE (buf)) \
384          - (pos)),                                                       \          - (pos)),                                                       \

Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26