Mercurial > hg > xemacs-beta
comparison src/symbols.c @ 5125:b5df3737028a ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 24 Feb 2010 01:58:04 -0600 |
parents | 623d57b7fbe8 4234fd5a7b17 |
children | a9c41067dd88 |
comparison
equal
deleted
inserted
replaced
5124:623d57b7fbe8 | 5125:b5df3737028a |
---|---|
1 /* "intern" and friends -- moved here from lread.c and data.c | 1 /* "intern" and friends -- moved here from lread.c and data.c |
2 Copyright (C) 1985-1989, 1992-1994 Free Software Foundation, Inc. | 2 Copyright (C) 1985-1989, 1992-1994 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 2000, 2001, 2002 Ben Wing. | 3 Copyright (C) 1995, 2000, 2001, 2002, 2010 Ben Wing. |
4 | 4 |
5 This file is part of XEmacs. | 5 This file is part of XEmacs. |
6 | 6 |
7 XEmacs is free software; you can redistribute it and/or modify it | 7 XEmacs is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
52 objects. This ought to be cleaned up. */ | 52 objects. This ought to be cleaned up. */ |
53 | 53 |
54 #include <config.h> | 54 #include <config.h> |
55 #include "lisp.h" | 55 #include "lisp.h" |
56 | 56 |
57 #include "bytecode.h" /* for COMPILED_FUNCTION_ANNOTATION_HACK, | |
58 defined in bytecode.h and used here. */ | |
57 #include "buffer.h" /* for Vbuffer_defaults */ | 59 #include "buffer.h" /* for Vbuffer_defaults */ |
58 #include "console-impl.h" | 60 #include "console-impl.h" |
59 #include "elhash.h" | 61 #include "elhash.h" |
60 | 62 |
61 Lisp_Object Qad_advice_info, Qad_activate; | 63 Lisp_Object Qad_advice_info, Qad_activate; |
175 } | 177 } |
176 return obarray; | 178 return obarray; |
177 } | 179 } |
178 | 180 |
179 Lisp_Object | 181 Lisp_Object |
180 intern_int (const Ibyte *str) | 182 intern_istring (const Ibyte *str) |
181 { | 183 { |
182 Bytecount len = qxestrlen (str); | 184 Bytecount len = qxestrlen (str); |
183 Lisp_Object obarray = Vobarray; | 185 Lisp_Object obarray = Vobarray; |
184 | 186 |
185 if (!VECTORP (obarray) || XVECTOR_LENGTH (obarray) == 0) | 187 if (!VECTORP (obarray) || XVECTOR_LENGTH (obarray) == 0) |
195 } | 197 } |
196 | 198 |
197 Lisp_Object | 199 Lisp_Object |
198 intern (const CIbyte *str) | 200 intern (const CIbyte *str) |
199 { | 201 { |
200 return intern_int ((Ibyte *) str); | 202 return intern_istring ((Ibyte *) str); |
201 } | 203 } |
202 | 204 |
203 Lisp_Object | 205 Lisp_Object |
204 intern_converting_underscores_to_dashes (const CIbyte *str) | 206 intern_converting_underscores_to_dashes (const CIbyte *str) |
205 { | 207 { |
208 Bytecount i; | 210 Bytecount i; |
209 strcpy (tmp, str); | 211 strcpy (tmp, str); |
210 for (i = 0; i < len; i++) | 212 for (i = 0; i < len; i++) |
211 if (tmp[i] == '_') | 213 if (tmp[i] == '_') |
212 tmp[i] = '-'; | 214 tmp[i] = '-'; |
213 return intern_int ((Ibyte *) tmp); | 215 return intern_istring ((Ibyte *) tmp); |
214 } | 216 } |
215 | 217 |
216 DEFUN ("intern", Fintern, 1, 2, 0, /* | 218 DEFUN ("intern", Fintern, 1, 2, 0, /* |
217 Return the canonical symbol whose name is STRING. | 219 Return the canonical symbol whose name is STRING. |
218 If there is none, one is created by this function and returned. | 220 If there is none, one is created by this function and returned. |
598 if ( | 600 if ( |
599 #ifdef HAVE_SHLIB | 601 #ifdef HAVE_SHLIB |
600 !(unloading_module && UNBOUNDP(newval)) && | 602 !(unloading_module && UNBOUNDP(newval)) && |
601 #endif | 603 #endif |
602 (symbol_is_constant (sym, val) | 604 (symbol_is_constant (sym, val) |
603 || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym)))) | 605 #ifndef NO_NEED_TO_HANDLE_21_4_CODE |
606 || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym)) | |
607 #endif | |
608 )) | |
604 signal_error_1 (Qsetting_constant, | 609 signal_error_1 (Qsetting_constant, |
605 UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); | 610 UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); |
606 } | 611 } |
607 | 612 |
608 /* Verify that it's ok to make SYM buffer-local. This rejects | 613 /* Verify that it's ok to make SYM buffer-local. This rejects |
711 | 716 |
712 /* FSFmacs */ | 717 /* FSFmacs */ |
713 DEFUN ("define-function", Fdefine_function, 2, 2, 0, /* | 718 DEFUN ("define-function", Fdefine_function, 2, 2, 0, /* |
714 Set SYMBOL's function definition to NEWDEF, and return NEWDEF. | 719 Set SYMBOL's function definition to NEWDEF, and return NEWDEF. |
715 Associates the function with the current load file, if any. | 720 Associates the function with the current load file, if any. |
721 If NEWDEF is a compiled-function object, stores the function name in | |
722 the `annotated' slot of the compiled-function (retrievable using | |
723 `compiled-function-annotation'). | |
716 */ | 724 */ |
717 (symbol, newdef)) | 725 (symbol, newdef)) |
718 { | 726 { |
719 /* This function can GC */ | 727 /* This function can GC */ |
720 Ffset (symbol, newdef); | 728 Ffset (symbol, newdef); |
721 LOADHIST_ATTACH (Fcons (Qdefun, symbol)); | 729 LOADHIST_ATTACH (Fcons (Qdefun, symbol)); |
730 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK | |
731 if (COMPILED_FUNCTIONP (newdef)) | |
732 XCOMPILED_FUNCTION (newdef)->annotated = symbol; | |
733 #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */ | |
722 return newdef; | 734 return newdef; |
723 } | 735 } |
724 | 736 |
725 DEFUN ("subr-name", Fsubr_name, 1, 1, 0, /* | 737 DEFUN ("subr-name", Fsubr_name, 1, 1, 0, /* |
726 Return name of function SUBR. | 738 Return name of function SUBR. |
727 SUBR must be a built-in function. | 739 SUBR must be a built-in function. |
728 */ | 740 */ |
729 (subr)) | 741 (subr)) |
730 { | 742 { |
731 const char *name; | 743 const Ascbyte *name; |
732 CHECK_SUBR (subr); | 744 CHECK_SUBR (subr); |
733 | 745 |
734 name = XSUBR (subr)->name; | 746 name = XSUBR (subr)->name; |
735 return make_string ((const Ibyte *)name, strlen (name)); | 747 return make_string ((const Ibyte *)name, strlen (name)); |
736 } | 748 } |
737 | 749 |
738 DEFUN ("special-form-p", Fspecial_form_p, 1, 1, 0, /* | 750 DEFUN ("special-operator-p", Fspecial_operator_p, 1, 1, 0, /* |
739 Return whether SUBR is a special form. | 751 Return whether SUBR is a special operator. |
740 | 752 |
741 A special form is a built-in function (a subr, that is a function | 753 A special operator is a built-in function (a subr, that is a function |
742 implemented in C, not Lisp) which does not necessarily evaluate all its | 754 implemented in C, not Lisp) which does not necessarily evaluate all its |
743 arguments. Much of the basic XEmacs Lisp syntax is implemented by means of | 755 arguments. Much of the basic XEmacs Lisp syntax is implemented by means of |
744 special forms; examples are `let', `condition-case', `defun', `setq' and so | 756 special operators; examples are `let', `condition-case', `setq', and so |
745 on. | 757 on. |
746 | 758 |
747 If you intend to write a Lisp function that does not necessarily evaluate | 759 If you intend to write a Lisp function that does not necessarily evaluate |
748 all its arguments, the portable (across emacs variants, and across Lisp | 760 all its arguments, the portable (across emacs variants, and across Lisp |
749 implementations) way to go about it is to write a macro instead. See | 761 implementations) way to go about it is to write a macro instead. See |
768 | 780 |
769 | 781 |
770 /**********************************************************************/ | 782 /**********************************************************************/ |
771 /* symbol-value */ | 783 /* symbol-value */ |
772 /**********************************************************************/ | 784 /**********************************************************************/ |
785 | |
786 /* | |
787 NOTE NOTE NOTE: | |
788 --------------- | |
789 | |
790 There are various different uses of "magic" with regard to symbols, | |
791 and they need to be distinguished: | |
792 | |
793 1. `symbol-value-magic' class of objects (struct symbol_value_magic): | |
794 A set of Lisp object types used as the value of a variable with any | |
795 behavior other than just a plain repository of a value. This | |
796 includes buffer-local variables, console-local variables, read-only | |
797 variables, variable aliases, variables that are linked to a C | |
798 variable, etc. The more specific types are: | |
799 | |
800 -- `symbol-value-forward': Variables that forward to a C variable. | |
801 NOTE:This includes built-in buffer-local and console-local | |
802 variables, since they forward to an element in a buffer or | |
803 console structure. | |
804 | |
805 -- `symbol-value-buffer-local': Variables on which | |
806 `make-local-variable' or `make-variable-buffer-local' have | |
807 been called. | |
808 | |
809 -- `symbol-value-lisp-magic': See below. | |
810 | |
811 -- `symbol-value-varalias': Variable aliases. | |
812 | |
813 2. `symbol-value-lisp-magic': Variables on which | |
814 `dontusethis-set-symbol-value-handler' have been called. These | |
815 variables are extra-magic in that operations that would normally | |
816 change their value instead get forwarded out to Lisp handlers, | |
817 which can do anything they want. (NOTE: Handlers for getting a | |
818 variable's value aren't implemented yet.) | |
819 | |
820 3. "magicfun" handlers on C-forwarding variables, declared with any | |
821 of the following: | |
822 | |
823 -- DEFVAR_LISP_MAGIC | |
824 -- DEFVAR_INT_MAGIC | |
825 -- DEFVAR_BOOL_MAGIC, | |
826 -- DEFVAR_BUFFER_LOCAL_MAGIC | |
827 -- DEFVAR_BUFFER_DEFAULTS_MAGIC | |
828 -- DEFVAR_CONSOLE_LOCAL_MAGIC | |
829 -- DEFVAR_CONSOLE_DEFAULTS_MAGIC | |
830 | |
831 Here, the "magic function" is a handler that is notified whenever the | |
832 value of a variable is changed, so that some other updating can take | |
833 place (e.g. setting redisplay-related dirty bits, updating a cache, | |
834 etc.). | |
835 | |
836 Note that DEFVAR_LISP_MAGIC does *NOT* have anything to do with | |
837 `symbol-value-lisp-magic'. The former refers to variables that can | |
838 hold an arbitrary Lisp object and forward to a C variable declared | |
839 `Lisp_Object foo', and have a "magicfun" as just described; the | |
840 latter are variables that have Lisp-level handlers that function | |
841 in *PLACE* of normal variable-setting mechanisms, and are established | |
842 with `dontusethis-set-symbol-value-handler', as described above. | |
843 */ | |
773 | 844 |
774 /* If the contents of the value cell of a symbol is one of the following | 845 /* If the contents of the value cell of a symbol is one of the following |
775 three types of objects, then the symbol is "magic" in that setting | 846 three types of objects, then the symbol is "magic" in that setting |
776 and retrieving its value doesn't just set or retrieve the raw | 847 and retrieving its value doesn't just set or retrieve the raw |
777 contents of the value cell. None of these objects can escape to | 848 contents of the value cell. None of these objects can escape to |
1114 case SYMVAL_CONST_OBJECT_FORWARD: | 1185 case SYMVAL_CONST_OBJECT_FORWARD: |
1115 case SYMVAL_CONST_SPECIFIER_FORWARD: | 1186 case SYMVAL_CONST_SPECIFIER_FORWARD: |
1116 return *((Lisp_Object *)symbol_value_forward_forward (fwd)); | 1187 return *((Lisp_Object *)symbol_value_forward_forward (fwd)); |
1117 | 1188 |
1118 case SYMVAL_DEFAULT_BUFFER_FORWARD: | 1189 case SYMVAL_DEFAULT_BUFFER_FORWARD: |
1119 return (*((Lisp_Object *)((char *) XBUFFER (Vbuffer_defaults) | 1190 return (*((Lisp_Object *)((Rawbyte *) XBUFFER (Vbuffer_defaults) |
1120 + ((char *)symbol_value_forward_forward (fwd) | 1191 + ((Rawbyte *)symbol_value_forward_forward (fwd) |
1121 - (char *)&buffer_local_flags)))); | 1192 - (Rawbyte *)&buffer_local_flags)))); |
1122 | 1193 |
1123 | 1194 |
1124 case SYMVAL_CURRENT_BUFFER_FORWARD: | 1195 case SYMVAL_CURRENT_BUFFER_FORWARD: |
1125 case SYMVAL_CONST_CURRENT_BUFFER_FORWARD: | 1196 case SYMVAL_CONST_CURRENT_BUFFER_FORWARD: |
1126 assert (buffer); | 1197 assert (buffer); |
1127 return (*((Lisp_Object *)((char *)buffer | 1198 return (*((Lisp_Object *)((Rawbyte *)buffer |
1128 + ((char *)symbol_value_forward_forward (fwd) | 1199 + ((Rawbyte *)symbol_value_forward_forward (fwd) |
1129 - (char *)&buffer_local_flags)))); | 1200 - (Rawbyte *)&buffer_local_flags)))); |
1130 | 1201 |
1131 case SYMVAL_DEFAULT_CONSOLE_FORWARD: | 1202 case SYMVAL_DEFAULT_CONSOLE_FORWARD: |
1132 return (*((Lisp_Object *)((char *) XCONSOLE (Vconsole_defaults) | 1203 return (*((Lisp_Object *)((Rawbyte *) XCONSOLE (Vconsole_defaults) |
1133 + ((char *)symbol_value_forward_forward (fwd) | 1204 + ((Rawbyte *)symbol_value_forward_forward (fwd) |
1134 - (char *)&console_local_flags)))); | 1205 - (Rawbyte *)&console_local_flags)))); |
1135 | 1206 |
1136 case SYMVAL_SELECTED_CONSOLE_FORWARD: | 1207 case SYMVAL_SELECTED_CONSOLE_FORWARD: |
1137 case SYMVAL_CONST_SELECTED_CONSOLE_FORWARD: | 1208 case SYMVAL_CONST_SELECTED_CONSOLE_FORWARD: |
1138 assert (console); | 1209 assert (console); |
1139 return (*((Lisp_Object *)((char *)console | 1210 return (*((Lisp_Object *)((Rawbyte *)console |
1140 + ((char *)symbol_value_forward_forward (fwd) | 1211 + ((Rawbyte *)symbol_value_forward_forward (fwd) |
1141 - (char *)&console_local_flags)))); | 1212 - (Rawbyte *)&console_local_flags)))); |
1142 | 1213 |
1143 case SYMVAL_UNBOUND_MARKER: | 1214 case SYMVAL_UNBOUND_MARKER: |
1144 return valcontents; | 1215 return valcontents; |
1145 | 1216 |
1146 default: | 1217 default: |
1162 or symbol-value-buffer-local, and if there's a handler, we should | 1233 or symbol-value-buffer-local, and if there's a handler, we should |
1163 have already called it. */ | 1234 have already called it. */ |
1164 Lisp_Object valcontents = fetch_value_maybe_past_magic (sym, Qt); | 1235 Lisp_Object valcontents = fetch_value_maybe_past_magic (sym, Qt); |
1165 const struct symbol_value_forward *fwd | 1236 const struct symbol_value_forward *fwd |
1166 = XSYMBOL_VALUE_FORWARD (valcontents); | 1237 = XSYMBOL_VALUE_FORWARD (valcontents); |
1167 int offset = ((char *) symbol_value_forward_forward (fwd) | 1238 int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) |
1168 - (char *) &buffer_local_flags); | 1239 - (Rawbyte *) &buffer_local_flags); |
1169 int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); | 1240 int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); |
1170 int (*magicfun) (Lisp_Object simm, Lisp_Object *val, Lisp_Object in_object, | 1241 int (*magicfun) (Lisp_Object simm, Lisp_Object *val, Lisp_Object in_object, |
1171 int flags) = symbol_value_forward_magicfun (fwd); | 1242 int flags) = symbol_value_forward_magicfun (fwd); |
1172 | 1243 |
1173 *((Lisp_Object *) (offset + (char *) XBUFFER (Vbuffer_defaults))) | 1244 *((Lisp_Object *) (offset + (Rawbyte *) XBUFFER (Vbuffer_defaults))) |
1174 = value; | 1245 = value; |
1175 | 1246 |
1176 if (mask > 0) /* Not always per-buffer */ | 1247 if (mask > 0) /* Not always per-buffer */ |
1177 { | 1248 { |
1178 /* Set value in each buffer which hasn't shadowed the default */ | 1249 /* Set value in each buffer which hasn't shadowed the default */ |
1181 struct buffer *b = XBUFFER (XCDR (elt)); | 1252 struct buffer *b = XBUFFER (XCDR (elt)); |
1182 if (!(b->local_var_flags & mask)) | 1253 if (!(b->local_var_flags & mask)) |
1183 { | 1254 { |
1184 if (magicfun) | 1255 if (magicfun) |
1185 magicfun (sym, &value, wrap_buffer (b), 0); | 1256 magicfun (sym, &value, wrap_buffer (b), 0); |
1186 *((Lisp_Object *) (offset + (char *) b)) = value; | 1257 *((Lisp_Object *) (offset + (Rawbyte *) b)) = value; |
1187 } | 1258 } |
1188 } | 1259 } |
1189 } | 1260 } |
1190 } | 1261 } |
1191 | 1262 |
1202 or symbol-value-buffer-local, and if there's a handler, we should | 1273 or symbol-value-buffer-local, and if there's a handler, we should |
1203 have already called it. */ | 1274 have already called it. */ |
1204 Lisp_Object valcontents = fetch_value_maybe_past_magic (sym, Qt); | 1275 Lisp_Object valcontents = fetch_value_maybe_past_magic (sym, Qt); |
1205 const struct symbol_value_forward *fwd | 1276 const struct symbol_value_forward *fwd |
1206 = XSYMBOL_VALUE_FORWARD (valcontents); | 1277 = XSYMBOL_VALUE_FORWARD (valcontents); |
1207 int offset = ((char *) symbol_value_forward_forward (fwd) | 1278 int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) |
1208 - (char *) &console_local_flags); | 1279 - (Rawbyte *) &console_local_flags); |
1209 int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); | 1280 int mask = XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); |
1210 int (*magicfun) (Lisp_Object simm, Lisp_Object *val, Lisp_Object in_object, | 1281 int (*magicfun) (Lisp_Object simm, Lisp_Object *val, Lisp_Object in_object, |
1211 int flags) = symbol_value_forward_magicfun (fwd); | 1282 int flags) = symbol_value_forward_magicfun (fwd); |
1212 | 1283 |
1213 *((Lisp_Object *) (offset + (char *) XCONSOLE (Vconsole_defaults))) | 1284 *((Lisp_Object *) (offset + (Rawbyte *) XCONSOLE (Vconsole_defaults))) |
1214 = value; | 1285 = value; |
1215 | 1286 |
1216 if (mask > 0) /* Not always per-console */ | 1287 if (mask > 0) /* Not always per-console */ |
1217 { | 1288 { |
1218 /* Set value in each console which hasn't shadowed the default */ | 1289 /* Set value in each console which hasn't shadowed the default */ |
1221 struct console *d = XCONSOLE (console); | 1292 struct console *d = XCONSOLE (console); |
1222 if (!(d->local_var_flags & mask)) | 1293 if (!(d->local_var_flags & mask)) |
1223 { | 1294 { |
1224 if (magicfun) | 1295 if (magicfun) |
1225 magicfun (sym, &value, console, 0); | 1296 magicfun (sym, &value, console, 0); |
1226 *((Lisp_Object *) (offset + (char *) d)) = value; | 1297 *((Lisp_Object *) (offset + (Rawbyte *) d)) = value; |
1227 } | 1298 } |
1228 } | 1299 } |
1229 } | 1300 } |
1230 } | 1301 } |
1231 | 1302 |
1298 return; | 1369 return; |
1299 | 1370 |
1300 case SYMVAL_CURRENT_BUFFER_FORWARD: | 1371 case SYMVAL_CURRENT_BUFFER_FORWARD: |
1301 if (magicfun) | 1372 if (magicfun) |
1302 magicfun (sym, &newval, wrap_buffer (current_buffer), 0); | 1373 magicfun (sym, &newval, wrap_buffer (current_buffer), 0); |
1303 *((Lisp_Object *) ((char *) current_buffer | 1374 *((Lisp_Object *) ((Rawbyte *) current_buffer |
1304 + ((char *) symbol_value_forward_forward (fwd) | 1375 + ((Rawbyte *) symbol_value_forward_forward (fwd) |
1305 - (char *) &buffer_local_flags))) | 1376 - (Rawbyte *) &buffer_local_flags))) |
1306 = newval; | 1377 = newval; |
1307 return; | 1378 return; |
1308 | 1379 |
1309 case SYMVAL_DEFAULT_CONSOLE_FORWARD: | 1380 case SYMVAL_DEFAULT_CONSOLE_FORWARD: |
1310 set_default_console_slot_variable (sym, newval); | 1381 set_default_console_slot_variable (sym, newval); |
1311 return; | 1382 return; |
1312 | 1383 |
1313 case SYMVAL_SELECTED_CONSOLE_FORWARD: | 1384 case SYMVAL_SELECTED_CONSOLE_FORWARD: |
1314 if (magicfun) | 1385 if (magicfun) |
1315 magicfun (sym, &newval, Vselected_console, 0); | 1386 magicfun (sym, &newval, Vselected_console, 0); |
1316 *((Lisp_Object *) ((char *) XCONSOLE (Vselected_console) | 1387 *((Lisp_Object *) ((Rawbyte *) XCONSOLE (Vselected_console) |
1317 + ((char *) symbol_value_forward_forward (fwd) | 1388 + ((Rawbyte *) symbol_value_forward_forward (fwd) |
1318 - (char *) &console_local_flags))) | 1389 - (Rawbyte *) &console_local_flags))) |
1319 = newval; | 1390 = newval; |
1320 return; | 1391 return; |
1321 | 1392 |
1322 default: | 1393 default: |
1323 ABORT (); | 1394 ABORT (); |
1990 | 2061 |
1991 case SYMVAL_CURRENT_BUFFER_FORWARD: | 2062 case SYMVAL_CURRENT_BUFFER_FORWARD: |
1992 { | 2063 { |
1993 const struct symbol_value_forward *fwd | 2064 const struct symbol_value_forward *fwd |
1994 = XSYMBOL_VALUE_FORWARD (valcontents); | 2065 = XSYMBOL_VALUE_FORWARD (valcontents); |
1995 return (*((Lisp_Object *)((char *) XBUFFER (Vbuffer_defaults) | 2066 return (*((Lisp_Object *)((Rawbyte *) XBUFFER (Vbuffer_defaults) |
1996 + ((char *)symbol_value_forward_forward (fwd) | 2067 + ((Rawbyte *)symbol_value_forward_forward (fwd) |
1997 - (char *)&buffer_local_flags)))); | 2068 - (Rawbyte *)&buffer_local_flags)))); |
1998 } | 2069 } |
1999 | 2070 |
2000 case SYMVAL_SELECTED_CONSOLE_FORWARD: | 2071 case SYMVAL_SELECTED_CONSOLE_FORWARD: |
2001 { | 2072 { |
2002 const struct symbol_value_forward *fwd | 2073 const struct symbol_value_forward *fwd |
2003 = XSYMBOL_VALUE_FORWARD (valcontents); | 2074 = XSYMBOL_VALUE_FORWARD (valcontents); |
2004 return (*((Lisp_Object *)((char *) XCONSOLE (Vconsole_defaults) | 2075 return (*((Lisp_Object *)((Rawbyte *) XCONSOLE (Vconsole_defaults) |
2005 + ((char *)symbol_value_forward_forward (fwd) | 2076 + ((Rawbyte *)symbol_value_forward_forward (fwd) |
2006 - (char *)&console_local_flags)))); | 2077 - (Rawbyte *)&console_local_flags)))); |
2007 } | 2078 } |
2008 | 2079 |
2009 case SYMVAL_BUFFER_LOCAL: | 2080 case SYMVAL_BUFFER_LOCAL: |
2010 case SYMVAL_SOME_BUFFER_LOCAL: | 2081 case SYMVAL_SOME_BUFFER_LOCAL: |
2011 { | 2082 { |
2437 | 2508 |
2438 case SYMVAL_CURRENT_BUFFER_FORWARD: | 2509 case SYMVAL_CURRENT_BUFFER_FORWARD: |
2439 { | 2510 { |
2440 const struct symbol_value_forward *fwd | 2511 const struct symbol_value_forward *fwd |
2441 = XSYMBOL_VALUE_FORWARD (valcontents); | 2512 = XSYMBOL_VALUE_FORWARD (valcontents); |
2442 int offset = ((char *) symbol_value_forward_forward (fwd) | 2513 int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) |
2443 - (char *) &buffer_local_flags); | 2514 - (Rawbyte *) &buffer_local_flags); |
2444 int mask = | 2515 int mask = |
2445 XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); | 2516 XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); |
2446 | 2517 |
2447 if (mask > 0) | 2518 if (mask > 0) |
2448 { | 2519 { |
2449 int (*magicfun) (Lisp_Object sym, Lisp_Object *val, | 2520 int (*magicfun) (Lisp_Object sym, Lisp_Object *val, |
2450 Lisp_Object in_object, int flags) = | 2521 Lisp_Object in_object, int flags) = |
2451 symbol_value_forward_magicfun (fwd); | 2522 symbol_value_forward_magicfun (fwd); |
2452 Lisp_Object oldval = * (Lisp_Object *) | 2523 Lisp_Object oldval = * (Lisp_Object *) |
2453 (offset + (char *) XBUFFER (Vbuffer_defaults)); | 2524 (offset + (Rawbyte *) XBUFFER (Vbuffer_defaults)); |
2454 if (magicfun) | 2525 if (magicfun) |
2455 (magicfun) (variable, &oldval, wrap_buffer (current_buffer), 0); | 2526 (magicfun) (variable, &oldval, wrap_buffer (current_buffer), 0); |
2456 *(Lisp_Object *) (offset + (char *) current_buffer) | 2527 *(Lisp_Object *) (offset + (Rawbyte *) current_buffer) |
2457 = oldval; | 2528 = oldval; |
2458 current_buffer->local_var_flags &= ~mask; | 2529 current_buffer->local_var_flags &= ~mask; |
2459 } | 2530 } |
2460 return variable; | 2531 return variable; |
2461 } | 2532 } |
2531 | 2602 |
2532 case SYMVAL_SELECTED_CONSOLE_FORWARD: | 2603 case SYMVAL_SELECTED_CONSOLE_FORWARD: |
2533 { | 2604 { |
2534 const struct symbol_value_forward *fwd | 2605 const struct symbol_value_forward *fwd |
2535 = XSYMBOL_VALUE_FORWARD (valcontents); | 2606 = XSYMBOL_VALUE_FORWARD (valcontents); |
2536 int offset = ((char *) symbol_value_forward_forward (fwd) | 2607 int offset = ((Rawbyte *) symbol_value_forward_forward (fwd) |
2537 - (char *) &console_local_flags); | 2608 - (Rawbyte *) &console_local_flags); |
2538 int mask = | 2609 int mask = |
2539 XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); | 2610 XINT (*((Lisp_Object *) symbol_value_forward_forward (fwd))); |
2540 | 2611 |
2541 if (mask > 0) | 2612 if (mask > 0) |
2542 { | 2613 { |
2543 int (*magicfun) (Lisp_Object sym, Lisp_Object *val, | 2614 int (*magicfun) (Lisp_Object sym, Lisp_Object *val, |
2544 Lisp_Object in_object, int flags) = | 2615 Lisp_Object in_object, int flags) = |
2545 symbol_value_forward_magicfun (fwd); | 2616 symbol_value_forward_magicfun (fwd); |
2546 Lisp_Object oldval = * (Lisp_Object *) | 2617 Lisp_Object oldval = * (Lisp_Object *) |
2547 (offset + (char *) XCONSOLE (Vconsole_defaults)); | 2618 (offset + (Rawbyte *) XCONSOLE (Vconsole_defaults)); |
2548 if (magicfun) | 2619 if (magicfun) |
2549 magicfun (variable, &oldval, Vselected_console, 0); | 2620 magicfun (variable, &oldval, Vselected_console, 0); |
2550 *(Lisp_Object *) (offset + (char *) XCONSOLE (Vselected_console)) | 2621 *(Lisp_Object *) (offset + (Rawbyte *) XCONSOLE (Vselected_console)) |
2551 = oldval; | 2622 = oldval; |
2552 XCONSOLE (Vselected_console)->local_var_flags &= ~mask; | 2623 XCONSOLE (Vselected_console)->local_var_flags &= ~mask; |
2553 } | 2624 } |
2554 return variable; | 2625 return variable; |
2555 } | 2626 } |
3523 reinit_symbols_early (void) | 3594 reinit_symbols_early (void) |
3524 { | 3595 { |
3525 } | 3596 } |
3526 | 3597 |
3527 static void | 3598 static void |
3528 defsymbol_massage_name_1 (Lisp_Object *location, const char *name, int dump_p, | 3599 defsymbol_massage_name_1 (Lisp_Object *location, const Ascbyte *name, |
3529 int multiword_predicate_p) | 3600 int dump_p, int multiword_predicate_p) |
3530 { | 3601 { |
3531 char temp[500]; | 3602 char temp[500]; |
3532 int len = strlen (name) - 1; | 3603 int len = strlen (name) - 1; |
3533 int i; | 3604 int i; |
3534 | 3605 |
3545 for (i = 0; i < len; i++) | 3616 for (i = 0; i < len; i++) |
3546 if (temp[i] == '_') | 3617 if (temp[i] == '_') |
3547 temp[i] = '-'; | 3618 temp[i] = '-'; |
3548 *location = Fintern (make_string ((const Ibyte *) temp, len), Qnil); | 3619 *location = Fintern (make_string ((const Ibyte *) temp, len), Qnil); |
3549 if (dump_p) | 3620 if (dump_p) |
3550 staticpro (location); | 3621 staticpro_1 (location, name); |
3551 else | 3622 else |
3552 staticpro_nodump (location); | 3623 staticpro_nodump_1 (location, name); |
3553 } | 3624 } |
3554 | 3625 |
3555 void | 3626 void |
3556 defsymbol_massage_name_nodump (Lisp_Object *location, const char *name) | 3627 defsymbol_massage_name_nodump (Lisp_Object *location, const Ascbyte *name) |
3557 { | 3628 { |
3558 defsymbol_massage_name_1 (location, name, 0, 0); | 3629 defsymbol_massage_name_1 (location, name, 0, 0); |
3559 } | 3630 } |
3560 | 3631 |
3561 void | 3632 void |
3562 defsymbol_massage_name (Lisp_Object *location, const char *name) | 3633 defsymbol_massage_name (Lisp_Object *location, const Ascbyte *name) |
3563 { | 3634 { |
3564 defsymbol_massage_name_1 (location, name, 1, 0); | 3635 defsymbol_massage_name_1 (location, name, 1, 0); |
3565 } | 3636 } |
3566 | 3637 |
3567 void | 3638 void |
3568 defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location, | 3639 defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location, |
3569 const char *name) | 3640 const Ascbyte *name) |
3570 { | 3641 { |
3571 defsymbol_massage_name_1 (location, name, 0, 1); | 3642 defsymbol_massage_name_1 (location, name, 0, 1); |
3572 } | 3643 } |
3573 | 3644 |
3574 void | 3645 void |
3575 defsymbol_massage_multiword_predicate (Lisp_Object *location, const char *name) | 3646 defsymbol_massage_multiword_predicate (Lisp_Object *location, |
3647 const Ascbyte *name) | |
3576 { | 3648 { |
3577 defsymbol_massage_name_1 (location, name, 1, 1); | 3649 defsymbol_massage_name_1 (location, name, 1, 1); |
3578 } | 3650 } |
3579 | 3651 |
3580 void | 3652 void |
3581 defsymbol_nodump (Lisp_Object *location, const char *name) | 3653 defsymbol_nodump (Lisp_Object *location, const Ascbyte *name) |
3582 { | 3654 { |
3583 *location = Fintern (make_string_nocopy ((const Ibyte *) name, | 3655 *location = Fintern (make_string_nocopy ((const Ibyte *) name, |
3584 strlen (name)), | 3656 strlen (name)), |
3585 Qnil); | 3657 Qnil); |
3586 staticpro_nodump (location); | 3658 staticpro_nodump_1 (location, name); |
3587 } | 3659 } |
3588 | 3660 |
3589 void | 3661 void |
3590 defsymbol (Lisp_Object *location, const char *name) | 3662 defsymbol (Lisp_Object *location, const Ascbyte *name) |
3591 { | 3663 { |
3592 *location = Fintern (make_string_nocopy ((const Ibyte *) name, | 3664 *location = Fintern (make_string_nocopy ((const Ibyte *) name, |
3593 strlen (name)), | 3665 strlen (name)), |
3594 Qnil); | 3666 Qnil); |
3595 staticpro (location); | 3667 staticpro_1 (location, name); |
3596 } | 3668 } |
3597 | 3669 |
3598 void | 3670 void |
3599 defkeyword (Lisp_Object *location, const char *name) | 3671 defkeyword (Lisp_Object *location, const Ascbyte *name) |
3600 { | 3672 { |
3601 defsymbol (location, name); | 3673 defsymbol (location, name); |
3602 Fset (*location, *location); | 3674 Fset (*location, *location); |
3603 } | 3675 } |
3604 | 3676 |
3605 void | 3677 void |
3606 defkeyword_massage_name (Lisp_Object *location, const char *name) | 3678 defkeyword_massage_name (Lisp_Object *location, const Ascbyte *name) |
3607 { | 3679 { |
3608 char temp[500]; | 3680 char temp[500]; |
3609 int len = strlen (name); | 3681 int len = strlen (name); |
3610 | 3682 |
3611 assert (len < (int) sizeof (temp)); | 3683 assert (len < (int) sizeof (temp)); |
3694 if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload))) \ | 3766 if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload))) \ |
3695 signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \ | 3767 signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \ |
3696 \ | 3768 \ |
3697 newsubr = xnew (Lisp_Subr); \ | 3769 newsubr = xnew (Lisp_Subr); \ |
3698 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ | 3770 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ |
3699 subr->doc = (const char *)newsubr; \ | 3771 subr->doc = (const CIbyte *)newsubr; \ |
3700 subr = newsubr; \ | 3772 subr = newsubr; \ |
3701 } \ | 3773 } \ |
3702 } while (0) | 3774 } while (0) |
3703 #else /* NEW_GC */ | 3775 #else /* NEW_GC */ |
3704 /* | 3776 /* |
3781 LOADHIST_ATTACH (sym); | 3853 LOADHIST_ATTACH (sym); |
3782 #endif | 3854 #endif |
3783 } | 3855 } |
3784 | 3856 |
3785 static void | 3857 static void |
3786 deferror_1 (Lisp_Object *symbol, const char *name, const char *messuhhj, | 3858 deferror_1 (Lisp_Object *symbol, const Ascbyte *name, const Ascbyte *messuhhj, |
3787 Lisp_Object inherits_from, int massage_p) | 3859 Lisp_Object inherits_from, int massage_p) |
3788 { | 3860 { |
3789 Lisp_Object conds; | 3861 Lisp_Object conds; |
3790 if (massage_p) | 3862 if (massage_p) |
3791 defsymbol_massage_name (symbol, name); | 3863 defsymbol_massage_name (symbol, name); |
3796 conds = Fget (inherits_from, Qerror_conditions, Qnil); | 3868 conds = Fget (inherits_from, Qerror_conditions, Qnil); |
3797 Fput (*symbol, Qerror_conditions, Fcons (*symbol, conds)); | 3869 Fput (*symbol, Qerror_conditions, Fcons (*symbol, conds)); |
3798 /* NOT build_msg_string (). This function is called at load time | 3870 /* NOT build_msg_string (). This function is called at load time |
3799 and the string needs to get translated at run time. (This happens | 3871 and the string needs to get translated at run time. (This happens |
3800 in the function (display-error) in cmdloop.el.) */ | 3872 in the function (display-error) in cmdloop.el.) */ |
3801 Fput (*symbol, Qerror_message, build_msg_string (messuhhj)); | 3873 Fput (*symbol, Qerror_message, build_defer_string (messuhhj)); |
3802 } | 3874 } |
3803 | 3875 |
3804 void | 3876 void |
3805 deferror (Lisp_Object *symbol, const char *name, const char *messuhhj, | 3877 deferror (Lisp_Object *symbol, const Ascbyte *name, const Ascbyte *messuhhj, |
3806 Lisp_Object inherits_from) | 3878 Lisp_Object inherits_from) |
3807 { | 3879 { |
3808 deferror_1 (symbol, name, messuhhj, inherits_from, 0); | 3880 deferror_1 (symbol, name, messuhhj, inherits_from, 0); |
3809 } | 3881 } |
3810 | 3882 |
3811 void | 3883 void |
3812 deferror_massage_name (Lisp_Object *symbol, const char *name, | 3884 deferror_massage_name (Lisp_Object *symbol, const Ascbyte *name, |
3813 const char *messuhhj, Lisp_Object inherits_from) | 3885 const Ascbyte *messuhhj, Lisp_Object inherits_from) |
3814 { | 3886 { |
3815 deferror_1 (symbol, name, messuhhj, inherits_from, 1); | 3887 deferror_1 (symbol, name, messuhhj, inherits_from, 1); |
3816 } | 3888 } |
3817 | 3889 |
3818 void | 3890 void |
3819 deferror_massage_name_and_message (Lisp_Object *symbol, const char *name, | 3891 deferror_massage_name_and_message (Lisp_Object *symbol, const Ascbyte *name, |
3820 Lisp_Object inherits_from) | 3892 Lisp_Object inherits_from) |
3821 { | 3893 { |
3822 char temp[500]; | 3894 char temp[500]; |
3823 int i; | 3895 int i; |
3824 int len = strlen (name) - 1; | 3896 int len = strlen (name) - 1; |
3891 DEFSUBR (Ffboundp); | 3963 DEFSUBR (Ffboundp); |
3892 DEFSUBR (Ffset); | 3964 DEFSUBR (Ffset); |
3893 DEFSUBR (Fdefine_function); | 3965 DEFSUBR (Fdefine_function); |
3894 Ffset (intern ("defalias"), intern ("define-function")); | 3966 Ffset (intern ("defalias"), intern ("define-function")); |
3895 DEFSUBR (Fsubr_name); | 3967 DEFSUBR (Fsubr_name); |
3896 DEFSUBR (Fspecial_form_p); | 3968 DEFSUBR (Fspecial_operator_p); |
3897 DEFSUBR (Fsetplist); | 3969 DEFSUBR (Fsetplist); |
3898 DEFSUBR (Fsymbol_value_in_buffer); | 3970 DEFSUBR (Fsymbol_value_in_buffer); |
3899 DEFSUBR (Fsymbol_value_in_console); | 3971 DEFSUBR (Fsymbol_value_in_console); |
3900 DEFSUBR (Fbuilt_in_variable_type); | 3972 DEFSUBR (Fbuilt_in_variable_type); |
3901 DEFSUBR (Fsymbol_value); | 3973 DEFSUBR (Fsymbol_value); |
3918 DEFSUBR (Fdontusethis_set_symbol_value_handler); | 3990 DEFSUBR (Fdontusethis_set_symbol_value_handler); |
3919 } | 3991 } |
3920 | 3992 |
3921 /* Create and initialize a Lisp variable whose value is forwarded to C data */ | 3993 /* Create and initialize a Lisp variable whose value is forwarded to C data */ |
3922 void | 3994 void |
3923 defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic) | 3995 defvar_magic (const Ascbyte *symbol_name, |
3996 const struct symbol_value_forward *magic) | |
3924 { | 3997 { |
3925 Lisp_Object sym; | 3998 Lisp_Object sym; |
3926 | 3999 |
3927 #ifdef HAVE_SHLIB | 4000 #ifdef HAVE_SHLIB |
3928 /* | 4001 /* |
3930 * we are adding variables from a dynamically loaded module. That means | 4003 * we are adding variables from a dynamically loaded module. That means |
3931 * we can't use purespace. Take that into account. | 4004 * we can't use purespace. Take that into account. |
3932 */ | 4005 */ |
3933 if (initialized) | 4006 if (initialized) |
3934 { | 4007 { |
3935 sym = Fintern (build_string (symbol_name), Qnil); | 4008 sym = Fintern (build_ascstring (symbol_name), Qnil); |
3936 LOADHIST_ATTACH (sym); | 4009 LOADHIST_ATTACH (sym); |
3937 } | 4010 } |
3938 else | 4011 else |
3939 #endif | 4012 #endif |
3940 sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name, | 4013 sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name, |