aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/buffer.c22
-rw-r--r--src/buffer.h20
-rw-r--r--src/data.c7
-rw-r--r--src/lisp.h1
5 files changed, 23 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9f99493e668..8349b4dfeba 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,18 @@
12007-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lisp.h (struct Lisp_Buffer_Objfwd): Add a `slottype' field.
4 * data.c (store_symval_forwarding): Get type from buffer_objfwd.
5 Update call to buffer_slot_type_mismatch.
6 * buffer.h (buffer_local_types, PER_BUFFER_TYPE): Remove.
7 (buffer_slot_type_mismatch): Update.
8 * buffer.c (buffer_local_types): Remove.
9 (buffer_slot_type_mismatch): Get the symbol and type as arguments.
10 (defvar_per_buffer): Set the type in the buffer_objfwd.
11
12007-11-21 Jason Rumney <jasonr@gnu.org> 122007-11-21 Jason Rumney <jasonr@gnu.org>
2 13
3 * w32bdf.c (w32_init_bdf_font, w32_BDF_to_x_font): CreateFileMapping 14 * w32bdf.c (w32_init_bdf_font, w32_BDF_to_x_font):
4 returns NULL on failure. 15 CreateFileMapping returns NULL on failure.
5 16
62007-11-21 Stefan Monnier <monnier@iro.umontreal.ca> 172007-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
7 18
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
diff --git a/src/buffer.h b/src/buffer.h
index 37f499f0351..a308d20e491 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -818,18 +818,6 @@ extern struct buffer buffer_local_flags;
818 that don't have such names. */ 818 that don't have such names. */
819 819
820extern struct buffer buffer_local_symbols; 820extern struct buffer buffer_local_symbols;
821
822/* This structure holds the required types for the values in the
823 buffer-local slots. If a slot contains Qnil, then the
824 corresponding buffer slot may contain a value of any type. If a
825 slot contains an integer, then prospective values' tags must be
826 equal to that integer (except nil is always allowed).
827 When a tag does not match, the function
828 buffer_slot_type_mismatch will signal an error.
829
830 If a slot here contains -1, the corresponding variable is read-only. */
831
832extern struct buffer buffer_local_types;
833 821
834extern void delete_all_overlays P_ ((struct buffer *)); 822extern void delete_all_overlays P_ ((struct buffer *));
835extern void reset_buffer P_ ((struct buffer *)); 823extern void reset_buffer P_ ((struct buffer *));
@@ -843,7 +831,7 @@ extern void set_buffer_internal P_ ((struct buffer *));
843extern void set_buffer_internal_1 P_ ((struct buffer *)); 831extern void set_buffer_internal_1 P_ ((struct buffer *));
844extern void set_buffer_temp P_ ((struct buffer *)); 832extern void set_buffer_temp P_ ((struct buffer *));
845extern void record_buffer P_ ((Lisp_Object)); 833extern void record_buffer P_ ((Lisp_Object));
846extern void buffer_slot_type_mismatch P_ ((int)) NO_RETURN; 834extern void buffer_slot_type_mismatch P_ ((Lisp_Object, int)) NO_RETURN;
847extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT)); 835extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
848extern void mmap_set_vars P_ ((int)); 836extern void mmap_set_vars P_ ((int));
849 837
@@ -995,11 +983,5 @@ extern int last_per_buffer_idx;
995#define PER_BUFFER_SYMBOL(OFFSET) \ 983#define PER_BUFFER_SYMBOL(OFFSET) \
996 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols)) 984 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
997 985
998/* Return the type of the per-buffer variable at offset OFFSET in the
999 buffer structure. */
1000
1001#define PER_BUFFER_TYPE(OFFSET) \
1002 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_types))
1003
1004/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1 986/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
1005 (do not change this comment) */ 987 (do not change this comment) */
diff --git a/src/data.c b/src/data.c
index 2ee84f01a14..4a63eb7d2f5 100644
--- a/src/data.c
+++ b/src/data.c
@@ -930,7 +930,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
930 break; 930 break;
931 931
932 case Lisp_Misc_Boolfwd: 932 case Lisp_Misc_Boolfwd:
933 *XBOOLFWD (valcontents)->boolvar = NILP (newval) ? 0 : 1; 933 *XBOOLFWD (valcontents)->boolvar = !NILP (newval);
934 break; 934 break;
935 935
936 case Lisp_Misc_Objfwd: 936 case Lisp_Misc_Objfwd:
@@ -970,12 +970,11 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
970 case Lisp_Misc_Buffer_Objfwd: 970 case Lisp_Misc_Buffer_Objfwd:
971 { 971 {
972 int offset = XBUFFER_OBJFWD (valcontents)->offset; 972 int offset = XBUFFER_OBJFWD (valcontents)->offset;
973 Lisp_Object type; 973 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
974 974
975 type = PER_BUFFER_TYPE (offset);
976 if (! NILP (type) && ! NILP (newval) 975 if (! NILP (type) && ! NILP (newval)
977 && XTYPE (newval) != XINT (type)) 976 && XTYPE (newval) != XINT (type))
978 buffer_slot_type_mismatch (offset); 977 buffer_slot_type_mismatch (symbol, XINT (type));
979 978
980 if (buf == NULL) 979 if (buf == NULL)
981 buf = current_buffer; 980 buf = current_buffer;
diff --git a/src/lisp.h b/src/lisp.h
index aa160f44593..49013ad7631 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1226,6 +1226,7 @@ struct Lisp_Buffer_Objfwd
1226 int type : 16; /* = Lisp_Misc_Buffer_Objfwd */ 1226 int type : 16; /* = Lisp_Misc_Buffer_Objfwd */
1227 unsigned gcmarkbit : 1; 1227 unsigned gcmarkbit : 1;
1228 int spacer : 15; 1228 int spacer : 15;
1229 Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String. */
1229 int offset; 1230 int offset;
1230 }; 1231 };
1231 1232