comparison src/data.c @ 28351:e3d57f7fba49

Use new macro names for handling per-buffer variables.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 27 Mar 2000 12:50:13 +0000
parents 034f252dd69b
children 4b675266db04
comparison
equal deleted inserted replaced
28350:51fbfd80a45f 28351:e3d57f7fba49
736 case Lisp_Misc_Objfwd: 736 case Lisp_Misc_Objfwd:
737 return *XOBJFWD (valcontents)->objvar; 737 return *XOBJFWD (valcontents)->objvar;
738 738
739 case Lisp_Misc_Buffer_Objfwd: 739 case Lisp_Misc_Buffer_Objfwd:
740 offset = XBUFFER_OBJFWD (valcontents)->offset; 740 offset = XBUFFER_OBJFWD (valcontents)->offset;
741 return BUFFER_LOCAL_VALUE (current_buffer, offset); 741 return PER_BUFFER_VALUE (current_buffer, offset);
742 742
743 case Lisp_Misc_Kboard_Objfwd: 743 case Lisp_Misc_Kboard_Objfwd:
744 offset = XKBOARD_OBJFWD (valcontents)->offset; 744 offset = XKBOARD_OBJFWD (valcontents)->offset;
745 return *(Lisp_Object *)(offset + (char *)current_kboard); 745 return *(Lisp_Object *)(offset + (char *)current_kboard);
746 } 746 }
781 case Lisp_Misc_Buffer_Objfwd: 781 case Lisp_Misc_Buffer_Objfwd:
782 { 782 {
783 int offset = XBUFFER_OBJFWD (valcontents)->offset; 783 int offset = XBUFFER_OBJFWD (valcontents)->offset;
784 Lisp_Object type; 784 Lisp_Object type;
785 785
786 type = BUFFER_LOCAL_TYPE (offset); 786 type = PER_BUFFER_TYPE (offset);
787 if (XINT (type) == -1) 787 if (XINT (type) == -1)
788 error ("Variable %s is read-only", XSYMBOL (symbol)->name->data); 788 error ("Variable %s is read-only", XSYMBOL (symbol)->name->data);
789 789
790 if (! NILP (type) && ! NILP (newval) 790 if (! NILP (type) && ! NILP (newval)
791 && XTYPE (newval) != XINT (type)) 791 && XTYPE (newval) != XINT (type))
792 buffer_slot_type_mismatch (offset); 792 buffer_slot_type_mismatch (offset);
793 793
794 BUFFER_LOCAL_VALUE (current_buffer, offset) = newval; 794 PER_BUFFER_VALUE (current_buffer, offset) = newval;
795 } 795 }
796 break; 796 break;
797 797
798 case Lisp_Misc_Kboard_Objfwd: 798 case Lisp_Misc_Kboard_Objfwd:
799 (*(Lisp_Object *)((char *)current_kboard 799 (*(Lisp_Object *)((char *)current_kboard
900 900
901 case Lisp_Misc_Objfwd: 901 case Lisp_Misc_Objfwd:
902 return *XOBJFWD (valcontents)->objvar; 902 return *XOBJFWD (valcontents)->objvar;
903 903
904 case Lisp_Misc_Buffer_Objfwd: 904 case Lisp_Misc_Buffer_Objfwd:
905 return BUFFER_LOCAL_VALUE (current_buffer, 905 return PER_BUFFER_VALUE (current_buffer,
906 XBUFFER_OBJFWD (valcontents)->offset); 906 XBUFFER_OBJFWD (valcontents)->offset);
907 907
908 case Lisp_Misc_Kboard_Objfwd: 908 case Lisp_Misc_Kboard_Objfwd:
909 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset 909 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset
910 + (char *)current_kboard); 910 + (char *)current_kboard);
989 valcontents = XSYMBOL (symbol)->value; 989 valcontents = XSYMBOL (symbol)->value;
990 990
991 if (BUFFER_OBJFWDP (valcontents)) 991 if (BUFFER_OBJFWDP (valcontents))
992 { 992 {
993 int offset = XBUFFER_OBJFWD (valcontents)->offset; 993 int offset = XBUFFER_OBJFWD (valcontents)->offset;
994 int idx = BUFFER_LOCAL_IDX (offset); 994 int idx = PER_BUFFER_IDX (offset);
995 if (idx > 0 995 if (idx > 0
996 && !bindflag 996 && !bindflag
997 && !let_shadows_buffer_binding_p (symbol)) 997 && !let_shadows_buffer_binding_p (symbol))
998 SET_BUFFER_HAS_LOCAL_VALUE_P (buf, idx, 1); 998 SET_PER_BUFFER_VALUE_P (buf, idx, 1);
999 } 999 }
1000 1000
1001 else if (BUFFER_LOCAL_VALUEP (valcontents) 1001 else if (BUFFER_LOCAL_VALUEP (valcontents)
1002 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1002 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1003 { 1003 {
1106 /* For a built-in buffer-local variable, get the default value 1106 /* For a built-in buffer-local variable, get the default value
1107 rather than letting do_symval_forwarding get the current value. */ 1107 rather than letting do_symval_forwarding get the current value. */
1108 if (BUFFER_OBJFWDP (valcontents)) 1108 if (BUFFER_OBJFWDP (valcontents))
1109 { 1109 {
1110 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1110 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1111 if (BUFFER_LOCAL_IDX (offset) != 0) 1111 if (PER_BUFFER_IDX (offset) != 0)
1112 return BUFFER_LOCAL_DEFAULT_VALUE (offset); 1112 return PER_BUFFER_DEFAULT (offset);
1113 } 1113 }
1114 1114
1115 /* Handle user-created local variables. */ 1115 /* Handle user-created local variables. */
1116 if (BUFFER_LOCAL_VALUEP (valcontents) 1116 if (BUFFER_LOCAL_VALUEP (valcontents)
1117 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1117 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1178 in the buffer. Make them work apparently like Lisp_Buffer_Local_Value 1178 in the buffer. Make them work apparently like Lisp_Buffer_Local_Value
1179 variables. */ 1179 variables. */
1180 if (BUFFER_OBJFWDP (valcontents)) 1180 if (BUFFER_OBJFWDP (valcontents))
1181 { 1181 {
1182 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1182 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1183 int idx = BUFFER_LOCAL_IDX (offset); 1183 int idx = PER_BUFFER_IDX (offset);
1184 1184
1185 BUFFER_LOCAL_DEFAULT_VALUE (offset) = value; 1185 PER_BUFFER_DEFAULT (offset) = value;
1186 1186
1187 /* If this variable is not always local in all buffers, 1187 /* If this variable is not always local in all buffers,
1188 set it in the buffers that don't nominally have a local value. */ 1188 set it in the buffers that don't nominally have a local value. */
1189 if (idx > 0) 1189 if (idx > 0)
1190 { 1190 {
1191 struct buffer *b; 1191 struct buffer *b;
1192 1192
1193 for (b = all_buffers; b; b = b->next) 1193 for (b = all_buffers; b; b = b->next)
1194 if (!BUFFER_HAS_LOCAL_VALUE_P (b, idx)) 1194 if (!PER_BUFFER_VALUE_P (b, idx))
1195 BUFFER_LOCAL_VALUE (b, offset) = value; 1195 PER_BUFFER_VALUE (b, offset) = value;
1196 } 1196 }
1197 return value; 1197 return value;
1198 } 1198 }
1199 1199
1200 if (!BUFFER_LOCAL_VALUEP (valcontents) 1200 if (!BUFFER_LOCAL_VALUEP (valcontents)
1408 valcontents = XSYMBOL (variable)->value; 1408 valcontents = XSYMBOL (variable)->value;
1409 1409
1410 if (BUFFER_OBJFWDP (valcontents)) 1410 if (BUFFER_OBJFWDP (valcontents))
1411 { 1411 {
1412 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1412 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1413 int idx = BUFFER_LOCAL_IDX (offset); 1413 int idx = PER_BUFFER_IDX (offset);
1414 1414
1415 if (idx > 0) 1415 if (idx > 0)
1416 { 1416 {
1417 SET_BUFFER_HAS_LOCAL_VALUE_P (current_buffer, idx, 0); 1417 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
1418 BUFFER_LOCAL_VALUE (current_buffer, offset) 1418 PER_BUFFER_VALUE (current_buffer, offset)
1419 = BUFFER_LOCAL_DEFAULT_VALUE (offset); 1419 = PER_BUFFER_DEFAULT (offset);
1420 } 1420 }
1421 return variable; 1421 return variable;
1422 } 1422 }
1423 1423
1424 if (!BUFFER_LOCAL_VALUEP (valcontents) 1424 if (!BUFFER_LOCAL_VALUEP (valcontents)
1530 } 1530 }
1531 } 1531 }
1532 if (BUFFER_OBJFWDP (valcontents)) 1532 if (BUFFER_OBJFWDP (valcontents))
1533 { 1533 {
1534 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1534 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1535 int idx = BUFFER_LOCAL_IDX (offset); 1535 int idx = PER_BUFFER_IDX (offset);
1536 if (idx == -1 || BUFFER_HAS_LOCAL_VALUE_P (buf, idx)) 1536 if (idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
1537 return Qt; 1537 return Qt;
1538 } 1538 }
1539 return Qnil; 1539 return Qnil;
1540 } 1540 }
1541 1541