aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorStefan Monnier2007-11-21 20:59:47 +0000
committerStefan Monnier2007-11-21 20:59:47 +0000
commit64e16c3c22db9f01922a4f3efb936c4265ccec7a (patch)
tree62cd4f172cedd91260805d9b9951918141dbbe43 /src/buffer.c
parentcb01ce3f055a415bbe4f2be4fbd0e4a7f320d688 (diff)
downloademacs-64e16c3c22db9f01922a4f3efb936c4265ccec7a.tar.gz
emacs-64e16c3c22db9f01922a4f3efb936c4265ccec7a.zip
* lisp.h (struct Lisp_Buffer_Objfwd): Add a `slottype' field.
* data.c (store_symval_forwarding): Get type from buffer_objfwd. Update call to buffer_slot_type_mismatch. * buffer.h (buffer_local_types, PER_BUFFER_TYPE): Remove. (buffer_slot_type_mismatch): Update. * buffer.c (buffer_local_types): Remove. (buffer_slot_type_mismatch): Get the symbol and type as arguments. (defvar_per_buffer): Set the type in the buffer_objfwd.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 045a22c8e31..675992db316 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -99,17 +99,6 @@ DECL_ALIGN (struct buffer, buffer_local_symbols);
99/* A Lisp_Object pointer to the above, used for staticpro */ 99/* A Lisp_Object pointer to the above, used for staticpro */
100static Lisp_Object Vbuffer_local_symbols; 100static Lisp_Object Vbuffer_local_symbols;
101 101
102/* This structure holds the required types for the values in the
103 buffer-local slots. If a slot contains Qnil, then the
104 corresponding buffer slot may contain a value of any type. If a
105 slot contains an integer, then prospective values' tags must be
106 equal to that integer (except nil is always allowed).
107 When a tag does not match, the function
108 buffer_slot_type_mismatch will signal an error.
109
110 If a slot here contains -1, the corresponding variable is read-only. */
111struct buffer buffer_local_types;
112
113/* Flags indicating which built-in buffer-local variables 102/* Flags indicating which built-in buffer-local variables
114 are permanent locals. */ 103 are permanent locals. */
115static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS]; 104static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
@@ -4402,13 +4391,13 @@ evaporate_overlays (pos)
4402 in the slot with offset OFFSET. */ 4391 in the slot with offset OFFSET. */
4403 4392
4404void 4393void
4405buffer_slot_type_mismatch (offset) 4394buffer_slot_type_mismatch (sym, type)
4406 int offset; 4395 Lisp_Object sym;
4396 int type;
4407{ 4397{
4408 Lisp_Object sym;
4409 char *type_name; 4398 char *type_name;
4410 4399
4411 switch (XINT (PER_BUFFER_TYPE (offset))) 4400 switch (type)
4412 { 4401 {
4413 case Lisp_Int: 4402 case Lisp_Int:
4414 type_name = "integers"; 4403 type_name = "integers";
@@ -4426,7 +4415,6 @@ buffer_slot_type_mismatch (offset)
4426 abort (); 4415 abort ();
4427 } 4416 }
4428 4417
4429 sym = PER_BUFFER_SYMBOL (offset);
4430 error ("Only %s should be stored in the buffer-local variable %s", 4418 error ("Only %s should be stored in the buffer-local variable %s",
4431 type_name, SDATA (SYMBOL_NAME (sym))); 4419 type_name, SDATA (SYMBOL_NAME (sym)));
4432} 4420}
@@ -5274,9 +5262,9 @@ defvar_per_buffer (namestring, address, type, doc)
5274 5262
5275 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd; 5263 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd;
5276 XBUFFER_OBJFWD (val)->offset = offset; 5264 XBUFFER_OBJFWD (val)->offset = offset;
5265 XBUFFER_OBJFWD (val)->slottype = type;
5277 SET_SYMBOL_VALUE (sym, val); 5266 SET_SYMBOL_VALUE (sym, val);
5278 PER_BUFFER_SYMBOL (offset) = sym; 5267 PER_BUFFER_SYMBOL (offset) = sym;
5279 PER_BUFFER_TYPE (offset) = type;
5280 5268
5281 if (PER_BUFFER_IDX (offset) == 0) 5269 if (PER_BUFFER_IDX (offset) == 0)
5282 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding 5270 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding