/* Header file for the buffer manipulation primitives.
Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Free Software Foundation, Inc.
This file is part of GNU Emacs.
and store the charpos in CHARPOS and the bytepos in BYTEPOS. */
#define DECODE_POSITION(charpos, bytepos, pos) \
-if (1) \
+do \
{ \
Lisp_Object __pos = (pos); \
if (NUMBERP (__pos)) \
else \
wrong_type_argument (Qinteger_or_marker_p, __pos); \
} \
-else
+while (0)
/* Return the address of byte position N in current buffer. */
/* Variables used locally in FETCH_MULTIBYTE_CHAR. */
extern unsigned char *_fetch_multibyte_char_p;
-extern int _fetch_multibyte_char_len;
/* Return character code of multi-byte form at position POS. If POS
doesn't point the head of valid multi-byte form, only the byte at
#define FETCH_MULTIBYTE_CHAR(pos) \
(_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0) \
- + (pos) + BEG_ADDR - BEG_BYTE), \
- _fetch_multibyte_char_len \
- = ((pos) >= GPT_BYTE ? ZV_BYTE : GPT_BYTE) - (pos), \
- STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
+ + (pos) + BEG_ADDR - BEG_BYTE), \
+ STRING_CHAR (_fetch_multibyte_char_p, 0))
+
+/* Return character at position POS. If the current buffer is unibyte
+ and the character is not ASCII, make the returning character
+ multibyte. */
+
+#define FETCH_CHAR_AS_MULTIBYTE(pos) \
+ (!NILP (current_buffer->enable_multibyte_characters) \
+ ? FETCH_MULTIBYTE_CHAR ((pos)) \
+ : unibyte_to_multibyte_table[(FETCH_BYTE ((pos)))])
+
\f
/* Macros for accessing a character or byte,
or converting between byte positions and addresses,
(_fetch_multibyte_char_p \
= (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0) \
+ (pos) + BUF_BEG_ADDR (buf) - BEG_BYTE), \
- _fetch_multibyte_char_len \
- = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_ZV_BYTE (buf) : BUF_GPT_BYTE (buf)) \
- - (pos)), \
- STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
+ STRING_CHAR (_fetch_multibyte_char_p, 0))
\f
/* Define the actual buffer data structures. */
successive elements in its marker `chain'
are the other markers referring to this buffer. */
struct Lisp_Marker *markers;
+
+ /* Usually 0. Temporarily set to 1 in decode_coding_gap to
+ prevent Fgarbage_collect from shrinking the gap and loosing
+ not-yet-decoded bytes. */
+ int inhibit_shrinking;
};
/* This is the structure that the buffer Lisp object points to. */
Check out mark_buffer (alloc.c) to see why. */
- EMACS_INT size;
+ EMACS_UINT size;
/* Next buffer, in chain of all buffers including killed buffers.
This chain is used only for garbage collection, in order to
EMACS_INT overlay_center;
/* Everything from here down must be a Lisp_Object. */
+ /* buffer-local Lisp variables start at `undo_list',
+ tho only the ones from `name' on are GC'd normally. */
+
+ /* 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;
/* The name of this buffer. */
Lisp_Object name;
Lisp_Object filename;
/* Dir for expanding relative file names. */
Lisp_Object directory;
- /* True iff this buffer has been backed up (if you write to the
+ /* True if this buffer has been backed up (if you write to the
visited file and it hasn't been backed up, then a backup will
be made). */
/* This isn't really used by the C code, so could be deleted. */
/* Mode line element that controls format of mode line. */
Lisp_Object mode_line_format;
- /* 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;
-
/* Analogous to mode_line_format for the line displayed at the top
of windows. Nil means don't display that line. */
Lisp_Object header_line_format;
that don't have such names. */
extern struct buffer buffer_local_symbols;
-
-/* This structure holds the required types for the values in the
- buffer-local slots. If a slot contains Qnil, then the
- corresponding buffer slot may contain a value of any type. If a
- slot contains an integer, then prospective values' tags must be
- equal to that integer (except nil is always allowed).
- When a tag does not match, the function
- buffer_slot_type_mismatch will signal an error.
-
- If a slot here contains -1, the corresponding variable is read-only. */
-
-extern struct buffer buffer_local_types;
\f
extern void delete_all_overlays P_ ((struct buffer *));
extern void reset_buffer P_ ((struct buffer *));
extern void set_buffer_internal_1 P_ ((struct buffer *));
extern void set_buffer_temp P_ ((struct buffer *));
extern void record_buffer P_ ((Lisp_Object));
-extern void buffer_slot_type_mismatch P_ ((int)) NO_RETURN;
+extern void buffer_slot_type_mismatch P_ ((Lisp_Object, int)) NO_RETURN;
extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
extern void mmap_set_vars P_ ((int));
} \
} while (0)
+EXFUN (Fbuffer_live_p, 1);
EXFUN (Fbuffer_name, 1);
EXFUN (Fget_file_buffer, 1);
EXFUN (Fnext_overlay_change, 1);
We assume you know which buffer it's pointing into. */
#define OVERLAY_POSITION(P) \
- (GC_MARKERP (P) ? marker_position (P) : (abort (), 0))
+ (MARKERP (P) ? marker_position (P) : (abort (), 0))
\f
/***********************************************************************
#define PER_BUFFER_SYMBOL(OFFSET) \
(*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
-/* Return the type of the per-buffer variable at offset OFFSET in the
- buffer structure. */
-
-#define PER_BUFFER_TYPE(OFFSET) \
- (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_types))
-
/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
(do not change this comment) */