diff options
| author | Gerd Moellmann | 2001-10-05 09:44:50 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-10-05 09:44:50 +0000 |
| commit | f35d5badef50cfed221dfb94bb5868af3607d39e (patch) | |
| tree | e6c40637ad998260e30016db0a99e34e8e717c9f | |
| parent | cf29bf99c77d733e39d5b12d8555d6c2edc544b6 (diff) | |
| download | emacs-f35d5badef50cfed221dfb94bb5868af3607d39e.tar.gz emacs-f35d5badef50cfed221dfb94bb5868af3607d39e.zip | |
Use SYMBOL_VALUE/SET_SYMBOL_VALUE.
(Qcyclic_variable_indirection): New variable.
(Fkeywordp): Check for internedness differently.
(Fmakunbound): Simplify the test if symbol is a constant.
(indirect_variable, Findirect_variable): New functions.
(swap_in_symval_forwarding): If SYMBOL is an alias, use the
aliased symbol.
(let_shadows_buffer_binding_p): Check for variable aliases.
(set_internal): Simplify the test if SYMBOL is a constant. If
SYMBOL has a buffer-local value and is an alias, use the aliased
symbol instead.
(syms_of_data): Initialze Qcyclic_variable_indirection and defsubr
Sindirect_variable.
| -rw-r--r-- | src/data.c | 156 |
1 files changed, 111 insertions, 45 deletions
diff --git a/src/data.c b/src/data.c index f84ee1b03ca..85a5980d1c1 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -65,6 +65,7 @@ Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; | |||
| 65 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; | 65 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; |
| 66 | Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; | 66 | Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; |
| 67 | Lisp_Object Qvoid_variable, Qvoid_function, Qcyclic_function_indirection; | 67 | Lisp_Object Qvoid_variable, Qvoid_function, Qcyclic_function_indirection; |
| 68 | Lisp_Object Qcyclic_variable_indirection; | ||
| 68 | Lisp_Object Qsetting_constant, Qinvalid_read_syntax; | 69 | Lisp_Object Qsetting_constant, Qinvalid_read_syntax; |
| 69 | Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch; | 70 | Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch; |
| 70 | Lisp_Object Qend_of_file, Qarith_error, Qmark_inactive; | 71 | Lisp_Object Qend_of_file, Qarith_error, Qmark_inactive; |
| @@ -307,7 +308,7 @@ interned in the initial obarray.") | |||
| 307 | { | 308 | { |
| 308 | if (SYMBOLP (object) | 309 | if (SYMBOLP (object) |
| 309 | && XSYMBOL (object)->name->data[0] == ':' | 310 | && XSYMBOL (object)->name->data[0] == ':' |
| 310 | && EQ (XSYMBOL (object)->obarray, initial_obarray)) | 311 | && SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (object)) |
| 311 | return Qt; | 312 | return Qt; |
| 312 | return Qnil; | 313 | return Qnil; |
| 313 | } | 314 | } |
| @@ -596,7 +597,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, "Return t if SYMBOL's value is not v | |||
| 596 | Lisp_Object valcontents; | 597 | Lisp_Object valcontents; |
| 597 | CHECK_SYMBOL (symbol, 0); | 598 | CHECK_SYMBOL (symbol, 0); |
| 598 | 599 | ||
| 599 | valcontents = XSYMBOL (symbol)->value; | 600 | valcontents = SYMBOL_VALUE (symbol); |
| 600 | 601 | ||
| 601 | if (BUFFER_LOCAL_VALUEP (valcontents) | 602 | if (BUFFER_LOCAL_VALUEP (valcontents) |
| 602 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 603 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| @@ -618,9 +619,7 @@ DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, "Make SYMBOL's value be | |||
| 618 | register Lisp_Object symbol; | 619 | register Lisp_Object symbol; |
| 619 | { | 620 | { |
| 620 | CHECK_SYMBOL (symbol, 0); | 621 | CHECK_SYMBOL (symbol, 0); |
| 621 | if (NILP (symbol) || EQ (symbol, Qt) | 622 | if (XSYMBOL (symbol)->constant) |
| 622 | || (XSYMBOL (symbol)->name->data[0] == ':' | ||
| 623 | && EQ (XSYMBOL (symbol)->obarray, initial_obarray))) | ||
| 624 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); | 623 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
| 625 | Fset (symbol, Qunbound); | 624 | Fset (symbol, Qunbound); |
| 626 | return symbol; | 625 | return symbol; |
| @@ -746,7 +745,53 @@ SUBR must be a built-in function. Value, if non-nil, is a list\n\ | |||
| 746 | } | 745 | } |
| 747 | 746 | ||
| 748 | 747 | ||
| 749 | /* Getting and setting values of symbols */ | 748 | /*********************************************************************** |
| 749 | Getting and Setting Values of Symbols | ||
| 750 | ***********************************************************************/ | ||
| 751 | |||
| 752 | /* Return the symbol holding SYMBOL's value. Signal | ||
| 753 | `cyclic-variable-indirection' if SYMBOL's chain of variable | ||
| 754 | indirections contains a loop. */ | ||
| 755 | |||
| 756 | Lisp_Object | ||
| 757 | indirect_variable (symbol) | ||
| 758 | Lisp_Object symbol; | ||
| 759 | { | ||
| 760 | Lisp_Object tortoise, hare; | ||
| 761 | |||
| 762 | hare = tortoise = symbol; | ||
| 763 | |||
| 764 | while (XSYMBOL (hare)->indirect_variable) | ||
| 765 | { | ||
| 766 | hare = XSYMBOL (hare)->value; | ||
| 767 | if (!XSYMBOL (hare)->indirect_variable) | ||
| 768 | break; | ||
| 769 | |||
| 770 | hare = XSYMBOL (hare)->value; | ||
| 771 | tortoise = XSYMBOL (tortoise)->value; | ||
| 772 | |||
| 773 | if (EQ (hare, tortoise)) | ||
| 774 | Fsignal (Qcyclic_variable_indirection, Fcons (symbol, Qnil)); | ||
| 775 | } | ||
| 776 | |||
| 777 | return hare; | ||
| 778 | } | ||
| 779 | |||
| 780 | |||
| 781 | DEFUN ("indirect-variable", Findirect_variable, Sindirect_variable, 1, 1, 0, | ||
| 782 | "Return the variable at the end of OBJECT's variable chain.\n\ | ||
| 783 | If OBJECT is a symbol, follow all variable indirections and return the final\n\ | ||
| 784 | variable. If OBJECT is not a symbol, just return it.\n\ | ||
| 785 | Signal a cyclic-variable-indirection error if there is a loop in the\n\ | ||
| 786 | variable chain of symbols.") | ||
| 787 | (object) | ||
| 788 | Lisp_Object object; | ||
| 789 | { | ||
| 790 | if (SYMBOLP (object)) | ||
| 791 | object = indirect_variable (object); | ||
| 792 | return object; | ||
| 793 | } | ||
| 794 | |||
| 750 | 795 | ||
| 751 | /* Given the raw contents of a symbol value cell, | 796 | /* Given the raw contents of a symbol value cell, |
| 752 | return the Lisp value of the symbol. | 797 | return the Lisp value of the symbol. |
| @@ -852,12 +897,12 @@ store_symval_forwarding (symbol, valcontents, newval, buf) | |||
| 852 | 897 | ||
| 853 | default: | 898 | default: |
| 854 | def: | 899 | def: |
| 855 | valcontents = XSYMBOL (symbol)->value; | 900 | valcontents = SYMBOL_VALUE (symbol); |
| 856 | if (BUFFER_LOCAL_VALUEP (valcontents) | 901 | if (BUFFER_LOCAL_VALUEP (valcontents) |
| 857 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 902 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 858 | XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval; | 903 | XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval; |
| 859 | else | 904 | else |
| 860 | XSYMBOL (symbol)->value = newval; | 905 | SET_SYMBOL_VALUE (symbol, newval); |
| 861 | } | 906 | } |
| 862 | } | 907 | } |
| 863 | 908 | ||
| @@ -870,7 +915,7 @@ swap_in_global_binding (symbol) | |||
| 870 | { | 915 | { |
| 871 | Lisp_Object valcontents, cdr; | 916 | Lisp_Object valcontents, cdr; |
| 872 | 917 | ||
| 873 | valcontents = XSYMBOL (symbol)->value; | 918 | valcontents = SYMBOL_VALUE (symbol); |
| 874 | if (!BUFFER_LOCAL_VALUEP (valcontents) | 919 | if (!BUFFER_LOCAL_VALUEP (valcontents) |
| 875 | && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 920 | && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 876 | abort (); | 921 | abort (); |
| @@ -903,6 +948,7 @@ swap_in_symval_forwarding (symbol, valcontents) | |||
| 903 | Lisp_Object symbol, valcontents; | 948 | Lisp_Object symbol, valcontents; |
| 904 | { | 949 | { |
| 905 | register Lisp_Object tem1; | 950 | register Lisp_Object tem1; |
| 951 | |||
| 906 | tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer; | 952 | tem1 = XBUFFER_LOCAL_VALUE (valcontents)->buffer; |
| 907 | 953 | ||
| 908 | if (NILP (tem1) | 954 | if (NILP (tem1) |
| @@ -910,6 +956,9 @@ swap_in_symval_forwarding (symbol, valcontents) | |||
| 910 | || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame | 956 | || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame |
| 911 | && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) | 957 | && ! EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))) |
| 912 | { | 958 | { |
| 959 | if (XSYMBOL (symbol)->indirect_variable) | ||
| 960 | symbol = indirect_variable (symbol); | ||
| 961 | |||
| 913 | /* Unload the previously loaded binding. */ | 962 | /* Unload the previously loaded binding. */ |
| 914 | tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); | 963 | tem1 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); |
| 915 | Fsetcdr (tem1, | 964 | Fsetcdr (tem1, |
| @@ -953,8 +1002,9 @@ find_symbol_value (symbol) | |||
| 953 | { | 1002 | { |
| 954 | register Lisp_Object valcontents; | 1003 | register Lisp_Object valcontents; |
| 955 | register Lisp_Object val; | 1004 | register Lisp_Object val; |
| 1005 | |||
| 956 | CHECK_SYMBOL (symbol, 0); | 1006 | CHECK_SYMBOL (symbol, 0); |
| 957 | valcontents = XSYMBOL (symbol)->value; | 1007 | valcontents = SYMBOL_VALUE (symbol); |
| 958 | 1008 | ||
| 959 | if (BUFFER_LOCAL_VALUEP (valcontents) | 1009 | if (BUFFER_LOCAL_VALUEP (valcontents) |
| 960 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 1010 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| @@ -1019,13 +1069,18 @@ let_shadows_buffer_binding_p (symbol) | |||
| 1019 | struct specbinding *p; | 1069 | struct specbinding *p; |
| 1020 | 1070 | ||
| 1021 | for (p = specpdl_ptr - 1; p >= specpdl; p--) | 1071 | for (p = specpdl_ptr - 1; p >= specpdl; p--) |
| 1022 | if (p->func == 0 | 1072 | if (p->func == NULL |
| 1023 | && CONSP (p->symbol) | 1073 | && CONSP (p->symbol)) |
| 1024 | && EQ (symbol, XCAR (p->symbol)) | 1074 | { |
| 1025 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | 1075 | Lisp_Object let_bound_symbol = XCAR (p->symbol); |
| 1026 | return 1; | 1076 | if ((EQ (symbol, let_bound_symbol) |
| 1077 | || (XSYMBOL (let_bound_symbol)->indirect_variable | ||
| 1078 | && EQ (symbol, indirect_variable (let_bound_symbol)))) | ||
| 1079 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | ||
| 1080 | break; | ||
| 1081 | } | ||
| 1027 | 1082 | ||
| 1028 | return 0; | 1083 | return p >= specpdl; |
| 1029 | } | 1084 | } |
| 1030 | 1085 | ||
| 1031 | /* Store the value NEWVAL into SYMBOL. | 1086 | /* Store the value NEWVAL into SYMBOL. |
| @@ -1054,14 +1109,13 @@ set_internal (symbol, newval, buf, bindflag) | |||
| 1054 | return newval; | 1109 | return newval; |
| 1055 | 1110 | ||
| 1056 | CHECK_SYMBOL (symbol, 0); | 1111 | CHECK_SYMBOL (symbol, 0); |
| 1057 | if (NILP (symbol) || EQ (symbol, Qt) | 1112 | if (SYMBOL_CONSTANT_P (symbol) |
| 1058 | || (XSYMBOL (symbol)->name->data[0] == ':' | 1113 | && (NILP (Fkeywordp (symbol)) |
| 1059 | && EQ (XSYMBOL (symbol)->obarray, initial_obarray) | 1114 | || !EQ (newval, SYMBOL_VALUE (symbol)))) |
| 1060 | && !EQ (newval, symbol))) | ||
| 1061 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); | 1115 | return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
| 1062 | 1116 | ||
| 1063 | innercontents = valcontents = XSYMBOL (symbol)->value; | 1117 | innercontents = valcontents = SYMBOL_VALUE (symbol); |
| 1064 | 1118 | ||
| 1065 | if (BUFFER_OBJFWDP (valcontents)) | 1119 | if (BUFFER_OBJFWDP (valcontents)) |
| 1066 | { | 1120 | { |
| 1067 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 1121 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| @@ -1071,11 +1125,12 @@ set_internal (symbol, newval, buf, bindflag) | |||
| 1071 | && !let_shadows_buffer_binding_p (symbol)) | 1125 | && !let_shadows_buffer_binding_p (symbol)) |
| 1072 | SET_PER_BUFFER_VALUE_P (buf, idx, 1); | 1126 | SET_PER_BUFFER_VALUE_P (buf, idx, 1); |
| 1073 | } | 1127 | } |
| 1074 | |||
| 1075 | else if (BUFFER_LOCAL_VALUEP (valcontents) | 1128 | else if (BUFFER_LOCAL_VALUEP (valcontents) |
| 1076 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 1129 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 1077 | { | 1130 | { |
| 1078 | /* valcontents is a struct Lisp_Buffer_Local_Value. */ | 1131 | /* valcontents is a struct Lisp_Buffer_Local_Value. */ |
| 1132 | if (XSYMBOL (symbol)->indirect_variable) | ||
| 1133 | symbol = indirect_variable (symbol); | ||
| 1079 | 1134 | ||
| 1080 | /* What binding is loaded right now? */ | 1135 | /* What binding is loaded right now? */ |
| 1081 | current_alist_element | 1136 | current_alist_element |
| @@ -1195,7 +1250,7 @@ default_value (symbol) | |||
| 1195 | register Lisp_Object valcontents; | 1250 | register Lisp_Object valcontents; |
| 1196 | 1251 | ||
| 1197 | CHECK_SYMBOL (symbol, 0); | 1252 | CHECK_SYMBOL (symbol, 0); |
| 1198 | valcontents = XSYMBOL (symbol)->value; | 1253 | valcontents = SYMBOL_VALUE (symbol); |
| 1199 | 1254 | ||
| 1200 | /* For a built-in buffer-local variable, get the default value | 1255 | /* For a built-in buffer-local variable, get the default value |
| 1201 | rather than letting do_symval_forwarding get the current value. */ | 1256 | rather than letting do_symval_forwarding get the current value. */ |
| @@ -1266,7 +1321,7 @@ for this variable.") | |||
| 1266 | register Lisp_Object valcontents, current_alist_element, alist_element_buffer; | 1321 | register Lisp_Object valcontents, current_alist_element, alist_element_buffer; |
| 1267 | 1322 | ||
| 1268 | CHECK_SYMBOL (symbol, 0); | 1323 | CHECK_SYMBOL (symbol, 0); |
| 1269 | valcontents = XSYMBOL (symbol)->value; | 1324 | valcontents = SYMBOL_VALUE (symbol); |
| 1270 | 1325 | ||
| 1271 | /* Handle variables like case-fold-search that have special slots | 1326 | /* Handle variables like case-fold-search that have special slots |
| 1272 | in the buffer. Make them work apparently like Lisp_Buffer_Local_Value | 1327 | in the buffer. Make them work apparently like Lisp_Buffer_Local_Value |
| @@ -1368,7 +1423,7 @@ The function `default-value' gets the default value and `set-default' sets it.") | |||
| 1368 | 1423 | ||
| 1369 | CHECK_SYMBOL (variable, 0); | 1424 | CHECK_SYMBOL (variable, 0); |
| 1370 | 1425 | ||
| 1371 | valcontents = XSYMBOL (variable)->value; | 1426 | valcontents = SYMBOL_VALUE (variable); |
| 1372 | if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) | 1427 | if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) |
| 1373 | error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data); | 1428 | error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data); |
| 1374 | 1429 | ||
| @@ -1376,23 +1431,23 @@ The function `default-value' gets the default value and `set-default' sets it.") | |||
| 1376 | return variable; | 1431 | return variable; |
| 1377 | if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 1432 | if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 1378 | { | 1433 | { |
| 1379 | XMISCTYPE (XSYMBOL (variable)->value) = Lisp_Misc_Buffer_Local_Value; | 1434 | XMISCTYPE (SYMBOL_VALUE (variable)) = Lisp_Misc_Buffer_Local_Value; |
| 1380 | return variable; | 1435 | return variable; |
| 1381 | } | 1436 | } |
| 1382 | if (EQ (valcontents, Qunbound)) | 1437 | if (EQ (valcontents, Qunbound)) |
| 1383 | XSYMBOL (variable)->value = Qnil; | 1438 | SET_SYMBOL_VALUE (variable, Qnil); |
| 1384 | tem = Fcons (Qnil, Fsymbol_value (variable)); | 1439 | tem = Fcons (Qnil, Fsymbol_value (variable)); |
| 1385 | XCAR (tem) = tem; | 1440 | XCAR (tem) = tem; |
| 1386 | newval = allocate_misc (); | 1441 | newval = allocate_misc (); |
| 1387 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; | 1442 | XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; |
| 1388 | XBUFFER_LOCAL_VALUE (newval)->realvalue = XSYMBOL (variable)->value; | 1443 | XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); |
| 1389 | XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer (); | 1444 | XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer (); |
| 1390 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; | 1445 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; |
| 1391 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; | 1446 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; |
| 1392 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; | 1447 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; |
| 1393 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; | 1448 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; |
| 1394 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; | 1449 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; |
| 1395 | XSYMBOL (variable)->value = newval; | 1450 | SET_SYMBOL_VALUE (variable, newval); |
| 1396 | return variable; | 1451 | return variable; |
| 1397 | } | 1452 | } |
| 1398 | 1453 | ||
| @@ -1421,7 +1476,7 @@ Use `make-local-hook' instead.") | |||
| 1421 | 1476 | ||
| 1422 | CHECK_SYMBOL (variable, 0); | 1477 | CHECK_SYMBOL (variable, 0); |
| 1423 | 1478 | ||
| 1424 | valcontents = XSYMBOL (variable)->value; | 1479 | valcontents = SYMBOL_VALUE (variable); |
| 1425 | if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) | 1480 | if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) |
| 1426 | error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data); | 1481 | error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data); |
| 1427 | 1482 | ||
| @@ -1442,14 +1497,14 @@ Use `make-local-hook' instead.") | |||
| 1442 | XCAR (tem) = tem; | 1497 | XCAR (tem) = tem; |
| 1443 | newval = allocate_misc (); | 1498 | newval = allocate_misc (); |
| 1444 | XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; | 1499 | XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; |
| 1445 | XBUFFER_LOCAL_VALUE (newval)->realvalue = XSYMBOL (variable)->value; | 1500 | XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); |
| 1446 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; | 1501 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; |
| 1447 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; | 1502 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; |
| 1448 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; | 1503 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; |
| 1449 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; | 1504 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; |
| 1450 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; | 1505 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; |
| 1451 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; | 1506 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; |
| 1452 | XSYMBOL (variable)->value = newval; | 1507 | SET_SYMBOL_VALUE (variable, newval);; |
| 1453 | } | 1508 | } |
| 1454 | /* Make sure this buffer has its own value of symbol. */ | 1509 | /* Make sure this buffer has its own value of symbol. */ |
| 1455 | tem = Fassq (variable, current_buffer->local_var_alist); | 1510 | tem = Fassq (variable, current_buffer->local_var_alist); |
| @@ -1461,7 +1516,7 @@ Use `make-local-hook' instead.") | |||
| 1461 | find_symbol_value (variable); | 1516 | find_symbol_value (variable); |
| 1462 | 1517 | ||
| 1463 | current_buffer->local_var_alist | 1518 | current_buffer->local_var_alist |
| 1464 | = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (XSYMBOL (variable)->value)->cdr)), | 1519 | = Fcons (Fcons (variable, XCDR (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (variable))->cdr)), |
| 1465 | current_buffer->local_var_alist); | 1520 | current_buffer->local_var_alist); |
| 1466 | 1521 | ||
| 1467 | /* Make sure symbol does not think it is set up for this buffer; | 1522 | /* Make sure symbol does not think it is set up for this buffer; |
| @@ -1469,7 +1524,7 @@ Use `make-local-hook' instead.") | |||
| 1469 | { | 1524 | { |
| 1470 | Lisp_Object *pvalbuf; | 1525 | Lisp_Object *pvalbuf; |
| 1471 | 1526 | ||
| 1472 | valcontents = XSYMBOL (variable)->value; | 1527 | valcontents = SYMBOL_VALUE (variable); |
| 1473 | 1528 | ||
| 1474 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; | 1529 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; |
| 1475 | if (current_buffer == XBUFFER (*pvalbuf)) | 1530 | if (current_buffer == XBUFFER (*pvalbuf)) |
| @@ -1482,9 +1537,9 @@ Use `make-local-hook' instead.") | |||
| 1482 | for this buffer now. If C code modifies the variable before we | 1537 | for this buffer now. If C code modifies the variable before we |
| 1483 | load the binding in, then that new value will clobber the default | 1538 | load the binding in, then that new value will clobber the default |
| 1484 | binding the next time we unload it. */ | 1539 | binding the next time we unload it. */ |
| 1485 | valcontents = XBUFFER_LOCAL_VALUE (XSYMBOL (variable)->value)->realvalue; | 1540 | valcontents = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (variable))->realvalue; |
| 1486 | if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) | 1541 | if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) |
| 1487 | swap_in_symval_forwarding (variable, XSYMBOL (variable)->value); | 1542 | swap_in_symval_forwarding (variable, SYMBOL_VALUE (variable)); |
| 1488 | 1543 | ||
| 1489 | return variable; | 1544 | return variable; |
| 1490 | } | 1545 | } |
| @@ -1500,7 +1555,7 @@ From now on the default value will apply in this buffer.") | |||
| 1500 | 1555 | ||
| 1501 | CHECK_SYMBOL (variable, 0); | 1556 | CHECK_SYMBOL (variable, 0); |
| 1502 | 1557 | ||
| 1503 | valcontents = XSYMBOL (variable)->value; | 1558 | valcontents = SYMBOL_VALUE (variable); |
| 1504 | 1559 | ||
| 1505 | if (BUFFER_OBJFWDP (valcontents)) | 1560 | if (BUFFER_OBJFWDP (valcontents)) |
| 1506 | { | 1561 | { |
| @@ -1532,7 +1587,7 @@ From now on the default value will apply in this buffer.") | |||
| 1532 | forwarded objects won't work right. */ | 1587 | forwarded objects won't work right. */ |
| 1533 | { | 1588 | { |
| 1534 | Lisp_Object *pvalbuf; | 1589 | Lisp_Object *pvalbuf; |
| 1535 | valcontents = XSYMBOL (variable)->value; | 1590 | valcontents = SYMBOL_VALUE (variable); |
| 1536 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; | 1591 | pvalbuf = &XBUFFER_LOCAL_VALUE (valcontents)->buffer; |
| 1537 | if (current_buffer == XBUFFER (*pvalbuf)) | 1592 | if (current_buffer == XBUFFER (*pvalbuf)) |
| 1538 | { | 1593 | { |
| @@ -1563,7 +1618,7 @@ See `modify-frame-parameters'.") | |||
| 1563 | 1618 | ||
| 1564 | CHECK_SYMBOL (variable, 0); | 1619 | CHECK_SYMBOL (variable, 0); |
| 1565 | 1620 | ||
| 1566 | valcontents = XSYMBOL (variable)->value; | 1621 | valcontents = SYMBOL_VALUE (variable); |
| 1567 | if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents) | 1622 | if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents) |
| 1568 | || BUFFER_OBJFWDP (valcontents)) | 1623 | || BUFFER_OBJFWDP (valcontents)) |
| 1569 | error ("Symbol %s may not be frame-local", XSYMBOL (variable)->name->data); | 1624 | error ("Symbol %s may not be frame-local", XSYMBOL (variable)->name->data); |
| @@ -1576,19 +1631,19 @@ See `modify-frame-parameters'.") | |||
| 1576 | } | 1631 | } |
| 1577 | 1632 | ||
| 1578 | if (EQ (valcontents, Qunbound)) | 1633 | if (EQ (valcontents, Qunbound)) |
| 1579 | XSYMBOL (variable)->value = Qnil; | 1634 | SET_SYMBOL_VALUE (variable, Qnil); |
| 1580 | tem = Fcons (Qnil, Fsymbol_value (variable)); | 1635 | tem = Fcons (Qnil, Fsymbol_value (variable)); |
| 1581 | XCAR (tem) = tem; | 1636 | XCAR (tem) = tem; |
| 1582 | newval = allocate_misc (); | 1637 | newval = allocate_misc (); |
| 1583 | XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; | 1638 | XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; |
| 1584 | XBUFFER_LOCAL_VALUE (newval)->realvalue = XSYMBOL (variable)->value; | 1639 | XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); |
| 1585 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; | 1640 | XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; |
| 1586 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; | 1641 | XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; |
| 1587 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; | 1642 | XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; |
| 1588 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; | 1643 | XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; |
| 1589 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; | 1644 | XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; |
| 1590 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; | 1645 | XBUFFER_LOCAL_VALUE (newval)->cdr = tem; |
| 1591 | XSYMBOL (variable)->value = newval; | 1646 | SET_SYMBOL_VALUE (variable, newval); |
| 1592 | return variable; | 1647 | return variable; |
| 1593 | } | 1648 | } |
| 1594 | 1649 | ||
| @@ -1612,11 +1667,13 @@ BUFFER defaults to the current buffer.") | |||
| 1612 | 1667 | ||
| 1613 | CHECK_SYMBOL (variable, 0); | 1668 | CHECK_SYMBOL (variable, 0); |
| 1614 | 1669 | ||
| 1615 | valcontents = XSYMBOL (variable)->value; | 1670 | valcontents = SYMBOL_VALUE (variable); |
| 1616 | if (BUFFER_LOCAL_VALUEP (valcontents) | 1671 | if (BUFFER_LOCAL_VALUEP (valcontents) |
| 1617 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | 1672 | || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
| 1618 | { | 1673 | { |
| 1619 | Lisp_Object tail, elt; | 1674 | Lisp_Object tail, elt; |
| 1675 | |||
| 1676 | variable = indirect_variable (variable); | ||
| 1620 | for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) | 1677 | for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) |
| 1621 | { | 1678 | { |
| 1622 | elt = XCAR (tail); | 1679 | elt = XCAR (tail); |
| @@ -1654,7 +1711,7 @@ BUFFER defaults to the current buffer.") | |||
| 1654 | 1711 | ||
| 1655 | CHECK_SYMBOL (variable, 0); | 1712 | CHECK_SYMBOL (variable, 0); |
| 1656 | 1713 | ||
| 1657 | valcontents = XSYMBOL (variable)->value; | 1714 | valcontents = SYMBOL_VALUE (variable); |
| 1658 | 1715 | ||
| 1659 | /* This means that make-variable-buffer-local was done. */ | 1716 | /* This means that make-variable-buffer-local was done. */ |
| 1660 | if (BUFFER_LOCAL_VALUEP (valcontents)) | 1717 | if (BUFFER_LOCAL_VALUEP (valcontents)) |
| @@ -2731,6 +2788,7 @@ syms_of_data () | |||
| 2731 | Qargs_out_of_range = intern ("args-out-of-range"); | 2788 | Qargs_out_of_range = intern ("args-out-of-range"); |
| 2732 | Qvoid_function = intern ("void-function"); | 2789 | Qvoid_function = intern ("void-function"); |
| 2733 | Qcyclic_function_indirection = intern ("cyclic-function-indirection"); | 2790 | Qcyclic_function_indirection = intern ("cyclic-function-indirection"); |
| 2791 | Qcyclic_variable_indirection = intern ("cyclic-variable-indirection"); | ||
| 2734 | Qvoid_variable = intern ("void-variable"); | 2792 | Qvoid_variable = intern ("void-variable"); |
| 2735 | Qsetting_constant = intern ("setting-constant"); | 2793 | Qsetting_constant = intern ("setting-constant"); |
| 2736 | Qinvalid_read_syntax = intern ("invalid-read-syntax"); | 2794 | Qinvalid_read_syntax = intern ("invalid-read-syntax"); |
| @@ -2816,6 +2874,11 @@ syms_of_data () | |||
| 2816 | Fput (Qcyclic_function_indirection, Qerror_message, | 2874 | Fput (Qcyclic_function_indirection, Qerror_message, |
| 2817 | build_string ("Symbol's chain of function indirections contains a loop")); | 2875 | build_string ("Symbol's chain of function indirections contains a loop")); |
| 2818 | 2876 | ||
| 2877 | Fput (Qcyclic_variable_indirection, Qerror_conditions, | ||
| 2878 | Fcons (Qcyclic_variable_indirection, error_tail)); | ||
| 2879 | Fput (Qcyclic_variable_indirection, Qerror_message, | ||
| 2880 | build_string ("Symbol's chain of variable indirections contains a loop")); | ||
| 2881 | |||
| 2819 | Fput (Qvoid_variable, Qerror_conditions, | 2882 | Fput (Qvoid_variable, Qerror_conditions, |
| 2820 | Fcons (Qvoid_variable, error_tail)); | 2883 | Fcons (Qvoid_variable, error_tail)); |
| 2821 | Fput (Qvoid_variable, Qerror_message, | 2884 | Fput (Qvoid_variable, Qerror_message, |
| @@ -3014,6 +3077,7 @@ syms_of_data () | |||
| 3014 | staticpro (&Qbool_vector); | 3077 | staticpro (&Qbool_vector); |
| 3015 | staticpro (&Qhash_table); | 3078 | staticpro (&Qhash_table); |
| 3016 | 3079 | ||
| 3080 | defsubr (&Sindirect_variable); | ||
| 3017 | defsubr (&Ssubr_interactive_form); | 3081 | defsubr (&Ssubr_interactive_form); |
| 3018 | defsubr (&Seq); | 3082 | defsubr (&Seq); |
| 3019 | defsubr (&Snull); | 3083 | defsubr (&Snull); |
| @@ -3143,3 +3207,5 @@ init_data () | |||
| 3143 | signal (SIGEMT, arith_error); | 3207 | signal (SIGEMT, arith_error); |
| 3144 | #endif /* uts */ | 3208 | #endif /* uts */ |
| 3145 | } | 3209 | } |
| 3210 | |||
| 3211 | |||