diff options
| author | Stephen Berman | 2013-06-14 22:07:55 +0200 |
|---|---|---|
| committer | Stephen Berman | 2013-06-14 22:07:55 +0200 |
| commit | bd358779861f265a7acff31ead40172735af693e (patch) | |
| tree | 345217a9889dbd29b09bdc80a94265c17719d41f /src/data.c | |
| parent | 2a97b47f0878cbda86cb6ba0e7e744924810b70e (diff) | |
| parent | f7394b12358ae453a0c8b85fc307afc1b740010d (diff) | |
| download | emacs-bd358779861f265a7acff31ead40172735af693e.tar.gz emacs-bd358779861f265a7acff31ead40172735af693e.zip | |
Merge from trunk.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 216 |
1 files changed, 74 insertions, 142 deletions
diff --git a/src/data.c b/src/data.c index d894ac71a65..9f756de014a 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter. | 1 | /* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter. |
| 2 | Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2012 | 2 | Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2013 Free Software |
| 3 | Free Software Foundation, Inc. | 3 | Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <setjmp.h> | ||
| 24 | 23 | ||
| 25 | #include <intprops.h> | 24 | #include <intprops.h> |
| 26 | 25 | ||
| @@ -35,14 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | #include "font.h" | 34 | #include "font.h" |
| 36 | #include "keymap.h" | 35 | #include "keymap.h" |
| 37 | 36 | ||
| 38 | #include <float.h> | ||
| 39 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | ||
| 40 | && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) | ||
| 41 | #define IEEE_FLOATING_POINT 1 | ||
| 42 | #else | ||
| 43 | #define IEEE_FLOATING_POINT 0 | ||
| 44 | #endif | ||
| 45 | |||
| 46 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; | 37 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; |
| 47 | static Lisp_Object Qsubr; | 38 | static Lisp_Object Qsubr; |
| 48 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; | 39 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; |
| @@ -90,6 +81,7 @@ Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; | |||
| 90 | static Lisp_Object Qdefun; | 81 | static Lisp_Object Qdefun; |
| 91 | 82 | ||
| 92 | Lisp_Object Qinteractive_form; | 83 | Lisp_Object Qinteractive_form; |
| 84 | static Lisp_Object Qdefalias_fset_function; | ||
| 93 | 85 | ||
| 94 | static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); | 86 | static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); |
| 95 | 87 | ||
| @@ -108,9 +100,9 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) | |||
| 108 | } | 100 | } |
| 109 | 101 | ||
| 110 | void | 102 | void |
| 111 | pure_write_error (void) | 103 | pure_write_error (Lisp_Object obj) |
| 112 | { | 104 | { |
| 113 | error ("Attempt to modify read-only object"); | 105 | xsignal2 (Qerror, build_string ("Attempt to modify read-only object"), obj); |
| 114 | } | 106 | } |
| 115 | 107 | ||
| 116 | void | 108 | void |
| @@ -453,7 +445,7 @@ DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0, | |||
| 453 | } | 445 | } |
| 454 | 446 | ||
| 455 | 447 | ||
| 456 | /* Extract and set components of lists */ | 448 | /* Extract and set components of lists. */ |
| 457 | 449 | ||
| 458 | DEFUN ("car", Fcar, Scar, 1, 1, 0, | 450 | DEFUN ("car", Fcar, Scar, 1, 1, 0, |
| 459 | doc: /* Return the car of LIST. If arg is nil, return nil. | 451 | doc: /* Return the car of LIST. If arg is nil, return nil. |
| @@ -514,7 +506,9 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0, | |||
| 514 | /* Extract and set components of symbols. */ | 506 | /* Extract and set components of symbols. */ |
| 515 | 507 | ||
| 516 | DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, | 508 | DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, |
| 517 | doc: /* Return t if SYMBOL's value is not void. */) | 509 | doc: /* Return t if SYMBOL's value is not void. |
| 510 | Note that if `lexical-binding' is in effect, this refers to the | ||
| 511 | global value outside of any lexical scope. */) | ||
| 518 | (register Lisp_Object symbol) | 512 | (register Lisp_Object symbol) |
| 519 | { | 513 | { |
| 520 | Lisp_Object valcontents; | 514 | Lisp_Object valcontents; |
| @@ -551,12 +545,13 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, | |||
| 551 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); | 545 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); |
| 552 | } | 546 | } |
| 553 | 547 | ||
| 548 | /* FIXME: Make it an alias for function-symbol! */ | ||
| 554 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, | 549 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, |
| 555 | doc: /* Return t if SYMBOL's function definition is not void. */) | 550 | doc: /* Return t if SYMBOL's function definition is not void. */) |
| 556 | (register Lisp_Object symbol) | 551 | (register Lisp_Object symbol) |
| 557 | { | 552 | { |
| 558 | CHECK_SYMBOL (symbol); | 553 | CHECK_SYMBOL (symbol); |
| 559 | return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt; | 554 | return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt; |
| 560 | } | 555 | } |
| 561 | 556 | ||
| 562 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, | 557 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, |
| @@ -572,14 +567,14 @@ Return SYMBOL. */) | |||
| 572 | } | 567 | } |
| 573 | 568 | ||
| 574 | DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, | 569 | DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, |
| 575 | doc: /* Make SYMBOL's function definition be void. | 570 | doc: /* Make SYMBOL's function definition be nil. |
| 576 | Return SYMBOL. */) | 571 | Return SYMBOL. */) |
| 577 | (register Lisp_Object symbol) | 572 | (register Lisp_Object symbol) |
| 578 | { | 573 | { |
| 579 | CHECK_SYMBOL (symbol); | 574 | CHECK_SYMBOL (symbol); |
| 580 | if (NILP (symbol) || EQ (symbol, Qt)) | 575 | if (NILP (symbol) || EQ (symbol, Qt)) |
| 581 | xsignal1 (Qsetting_constant, symbol); | 576 | xsignal1 (Qsetting_constant, symbol); |
| 582 | set_symbol_function (symbol, Qunbound); | 577 | set_symbol_function (symbol, Qnil); |
| 583 | return symbol; | 578 | return symbol; |
| 584 | } | 579 | } |
| 585 | 580 | ||
| @@ -588,9 +583,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, | |||
| 588 | (register Lisp_Object symbol) | 583 | (register Lisp_Object symbol) |
| 589 | { | 584 | { |
| 590 | CHECK_SYMBOL (symbol); | 585 | CHECK_SYMBOL (symbol); |
| 591 | if (!EQ (XSYMBOL (symbol)->function, Qunbound)) | 586 | return XSYMBOL (symbol)->function; |
| 592 | return XSYMBOL (symbol)->function; | ||
| 593 | xsignal1 (Qvoid_function, symbol); | ||
| 594 | } | 587 | } |
| 595 | 588 | ||
| 596 | DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, | 589 | DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, |
| @@ -617,27 +610,18 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |||
| 617 | (register Lisp_Object symbol, Lisp_Object definition) | 610 | (register Lisp_Object symbol, Lisp_Object definition) |
| 618 | { | 611 | { |
| 619 | register Lisp_Object function; | 612 | register Lisp_Object function; |
| 620 | |||
| 621 | CHECK_SYMBOL (symbol); | 613 | CHECK_SYMBOL (symbol); |
| 622 | if (NILP (symbol) || EQ (symbol, Qt)) | ||
| 623 | xsignal1 (Qsetting_constant, symbol); | ||
| 624 | 614 | ||
| 625 | function = XSYMBOL (symbol)->function; | 615 | function = XSYMBOL (symbol)->function; |
| 626 | 616 | ||
| 627 | if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) | 617 | if (!NILP (Vautoload_queue) && !NILP (function)) |
| 628 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); | 618 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); |
| 629 | 619 | ||
| 630 | if (CONSP (function) && EQ (XCAR (function), Qautoload)) | 620 | if (AUTOLOADP (function)) |
| 631 | Fput (symbol, Qautoload, XCDR (function)); | 621 | Fput (symbol, Qautoload, XCDR (function)); |
| 632 | 622 | ||
| 633 | set_symbol_function (symbol, definition); | 623 | set_symbol_function (symbol, definition); |
| 634 | /* Handle automatic advice activation. */ | 624 | |
| 635 | if (CONSP (XSYMBOL (symbol)->plist) | ||
| 636 | && !NILP (Fget (symbol, Qad_advice_info))) | ||
| 637 | { | ||
| 638 | call2 (Qad_activate_internal, symbol, Qnil); | ||
| 639 | definition = XSYMBOL (symbol)->function; | ||
| 640 | } | ||
| 641 | return definition; | 625 | return definition; |
| 642 | } | 626 | } |
| 643 | 627 | ||
| @@ -651,15 +635,32 @@ The return value is undefined. */) | |||
| 651 | (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) | 635 | (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) |
| 652 | { | 636 | { |
| 653 | CHECK_SYMBOL (symbol); | 637 | CHECK_SYMBOL (symbol); |
| 654 | if (CONSP (XSYMBOL (symbol)->function) | ||
| 655 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) | ||
| 656 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | ||
| 657 | if (!NILP (Vpurify_flag) | 638 | if (!NILP (Vpurify_flag) |
| 658 | /* If `definition' is a keymap, immutable (and copying) is wrong. */ | 639 | /* If `definition' is a keymap, immutable (and copying) is wrong. */ |
| 659 | && !KEYMAPP (definition)) | 640 | && !KEYMAPP (definition)) |
| 660 | definition = Fpurecopy (definition); | 641 | definition = Fpurecopy (definition); |
| 661 | definition = Ffset (symbol, definition); | 642 | |
| 662 | LOADHIST_ATTACH (Fcons (Qdefun, symbol)); | 643 | { |
| 644 | bool autoload = AUTOLOADP (definition); | ||
| 645 | if (NILP (Vpurify_flag) || !autoload) | ||
| 646 | { /* Only add autoload entries after dumping, because the ones before are | ||
| 647 | not useful and else we get loads of them from the loaddefs.el. */ | ||
| 648 | |||
| 649 | if (AUTOLOADP (XSYMBOL (symbol)->function)) | ||
| 650 | /* Remember that the function was already an autoload. */ | ||
| 651 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | ||
| 652 | LOADHIST_ATTACH (Fcons (autoload ? Qautoload : Qdefun, symbol)); | ||
| 653 | } | ||
| 654 | } | ||
| 655 | |||
| 656 | { /* Handle automatic advice activation. */ | ||
| 657 | Lisp_Object hook = Fget (symbol, Qdefalias_fset_function); | ||
| 658 | if (!NILP (hook)) | ||
| 659 | call2 (hook, symbol, definition); | ||
| 660 | else | ||
| 661 | Ffset (symbol, definition); | ||
| 662 | } | ||
| 663 | |||
| 663 | if (!NILP (docstring)) | 664 | if (!NILP (docstring)) |
| 664 | Fput (symbol, Qfunction_documentation, docstring); | 665 | Fput (symbol, Qfunction_documentation, docstring); |
| 665 | /* We used to return `definition', but now that `defun' and `defmacro' expand | 666 | /* We used to return `definition', but now that `defun' and `defmacro' expand |
| @@ -689,12 +690,10 @@ function with `&rest' args, or `unevalled' for a special form. */) | |||
| 689 | CHECK_SUBR (subr); | 690 | CHECK_SUBR (subr); |
| 690 | minargs = XSUBR (subr)->min_args; | 691 | minargs = XSUBR (subr)->min_args; |
| 691 | maxargs = XSUBR (subr)->max_args; | 692 | maxargs = XSUBR (subr)->max_args; |
| 692 | if (maxargs == MANY) | 693 | return Fcons (make_number (minargs), |
| 693 | return Fcons (make_number (minargs), Qmany); | 694 | maxargs == MANY ? Qmany |
| 694 | else if (maxargs == UNEVALLED) | 695 | : maxargs == UNEVALLED ? Qunevalled |
| 695 | return Fcons (make_number (minargs), Qunevalled); | 696 | : make_number (maxargs)); |
| 696 | else | ||
| 697 | return Fcons (make_number (minargs), make_number (maxargs)); | ||
| 698 | } | 697 | } |
| 699 | 698 | ||
| 700 | DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, | 699 | DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, |
| @@ -716,11 +715,11 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 716 | { | 715 | { |
| 717 | Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ | 716 | Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ |
| 718 | 717 | ||
| 719 | if (NILP (fun) || EQ (fun, Qunbound)) | 718 | if (NILP (fun)) |
| 720 | return Qnil; | 719 | return Qnil; |
| 721 | 720 | ||
| 722 | /* Use an `interactive-form' property if present, analogous to the | 721 | /* Use an `interactive-form' property if present, analogous to the |
| 723 | function-documentation property. */ | 722 | function-documentation property. */ |
| 724 | fun = cmd; | 723 | fun = cmd; |
| 725 | while (SYMBOLP (fun)) | 724 | while (SYMBOLP (fun)) |
| 726 | { | 725 | { |
| @@ -744,6 +743,8 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 744 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) | 743 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) |
| 745 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); | 744 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); |
| 746 | } | 745 | } |
| 746 | else if (AUTOLOADP (fun)) | ||
| 747 | return Finteractive_form (Fautoload_do_load (fun, cmd, Qnil)); | ||
| 747 | else if (CONSP (fun)) | 748 | else if (CONSP (fun)) |
| 748 | { | 749 | { |
| 749 | Lisp_Object funcar = XCAR (fun); | 750 | Lisp_Object funcar = XCAR (fun); |
| @@ -751,14 +752,6 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 751 | return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); | 752 | return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); |
| 752 | else if (EQ (funcar, Qlambda)) | 753 | else if (EQ (funcar, Qlambda)) |
| 753 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); | 754 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); |
| 754 | else if (EQ (funcar, Qautoload)) | ||
| 755 | { | ||
| 756 | struct gcpro gcpro1; | ||
| 757 | GCPRO1 (cmd); | ||
| 758 | Fautoload_do_load (fun, cmd, Qnil); | ||
| 759 | UNGCPRO; | ||
| 760 | return Finteractive_form (cmd); | ||
| 761 | } | ||
| 762 | } | 755 | } |
| 763 | return Qnil; | 756 | return Qnil; |
| 764 | } | 757 | } |
| @@ -921,13 +914,11 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva | |||
| 921 | case Lisp_Fwd_Buffer_Obj: | 914 | case Lisp_Fwd_Buffer_Obj: |
| 922 | { | 915 | { |
| 923 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 916 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 924 | Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; | 917 | Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate; |
| 925 | 918 | ||
| 926 | if (!(NILP (type) || NILP (newval) | 919 | if (!NILP (predicate) && !NILP (newval) |
| 927 | || (XINT (type) == Lisp_Int0 | 920 | && NILP (call1 (predicate, newval))) |
| 928 | ? INTEGERP (newval) | 921 | wrong_type_argument (predicate, newval); |
| 929 | : XTYPE (newval) == XINT (type)))) | ||
| 930 | buffer_slot_type_mismatch (newval, XINT (type)); | ||
| 931 | 922 | ||
| 932 | if (buf == NULL) | 923 | if (buf == NULL) |
| 933 | buf = current_buffer; | 924 | buf = current_buffer; |
| @@ -1056,7 +1047,9 @@ find_symbol_value (Lisp_Object symbol) | |||
| 1056 | } | 1047 | } |
| 1057 | 1048 | ||
| 1058 | DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, | 1049 | DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, |
| 1059 | doc: /* Return SYMBOL's value. Error if that is void. */) | 1050 | doc: /* Return SYMBOL's value. Error if that is void. |
| 1051 | Note that if `lexical-binding' is in effect, this returns the | ||
| 1052 | global value outside of any lexical scope. */) | ||
| 1060 | (Lisp_Object symbol) | 1053 | (Lisp_Object symbol) |
| 1061 | { | 1054 | { |
| 1062 | Lisp_Object val; | 1055 | Lisp_Object val; |
| @@ -1076,40 +1069,6 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, | |||
| 1076 | return newval; | 1069 | return newval; |
| 1077 | } | 1070 | } |
| 1078 | 1071 | ||
| 1079 | /* Return true if SYMBOL currently has a let-binding | ||
| 1080 | which was made in the buffer that is now current. */ | ||
| 1081 | |||
| 1082 | static bool | ||
| 1083 | let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) | ||
| 1084 | { | ||
| 1085 | struct specbinding *p; | ||
| 1086 | |||
| 1087 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 1088 | if ((--p)->func == NULL | ||
| 1089 | && CONSP (p->symbol)) | ||
| 1090 | { | ||
| 1091 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); | ||
| 1092 | eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); | ||
| 1093 | if (symbol == let_bound_symbol | ||
| 1094 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | ||
| 1095 | return 1; | ||
| 1096 | } | ||
| 1097 | |||
| 1098 | return 0; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | static bool | ||
| 1102 | let_shadows_global_binding_p (Lisp_Object symbol) | ||
| 1103 | { | ||
| 1104 | struct specbinding *p; | ||
| 1105 | |||
| 1106 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 1107 | if ((--p)->func == NULL && EQ (p->symbol, symbol)) | ||
| 1108 | return 1; | ||
| 1109 | |||
| 1110 | return 0; | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | /* Store the value NEWVAL into SYMBOL. | 1072 | /* Store the value NEWVAL into SYMBOL. |
| 1114 | If buffer/frame-locality is an issue, WHERE specifies which context to use. | 1073 | If buffer/frame-locality is an issue, WHERE specifies which context to use. |
| 1115 | (nil stands for the current buffer/frame). | 1074 | (nil stands for the current buffer/frame). |
| @@ -1164,7 +1123,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, | |||
| 1164 | the default binding is loaded, the loaded binding may be the | 1123 | the default binding is loaded, the loaded binding may be the |
| 1165 | wrong one. */ | 1124 | wrong one. */ |
| 1166 | if (!EQ (blv->where, where) | 1125 | if (!EQ (blv->where, where) |
| 1167 | /* Also unload a global binding (if the var is local_if_set). */ | 1126 | /* Also unload a global binding (if the var is local_if_set). */ |
| 1168 | || (EQ (blv->valcell, blv->defcell))) | 1127 | || (EQ (blv->valcell, blv->defcell))) |
| 1169 | { | 1128 | { |
| 1170 | /* The currently loaded binding is not necessarily valid. | 1129 | /* The currently loaded binding is not necessarily valid. |
| @@ -1848,17 +1807,18 @@ BUFFER defaults to the current buffer. */) | |||
| 1848 | XSETBUFFER (tmp, buf); | 1807 | XSETBUFFER (tmp, buf); |
| 1849 | XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ | 1808 | XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ |
| 1850 | 1809 | ||
| 1851 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) | 1810 | if (EQ (blv->where, tmp)) /* The binding is already loaded. */ |
| 1852 | { | 1811 | return blv_found (blv) ? Qt : Qnil; |
| 1853 | elt = XCAR (tail); | 1812 | else |
| 1854 | if (EQ (variable, XCAR (elt))) | 1813 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) |
| 1855 | { | 1814 | { |
| 1856 | eassert (!blv->frame_local); | 1815 | elt = XCAR (tail); |
| 1857 | eassert (blv_found (blv) || !EQ (blv->where, tmp)); | 1816 | if (EQ (variable, XCAR (elt))) |
| 1858 | return Qt; | 1817 | { |
| 1859 | } | 1818 | eassert (!blv->frame_local); |
| 1860 | } | 1819 | return Qt; |
| 1861 | eassert (!blv_found (blv) || !EQ (blv->where, tmp)); | 1820 | } |
| 1821 | } | ||
| 1862 | return Qnil; | 1822 | return Qnil; |
| 1863 | } | 1823 | } |
| 1864 | case SYMBOL_FORWARDED: | 1824 | case SYMBOL_FORWARDED: |
| @@ -2016,10 +1976,10 @@ indirect_function (register Lisp_Object object) | |||
| 2016 | 1976 | ||
| 2017 | for (;;) | 1977 | for (;;) |
| 2018 | { | 1978 | { |
| 2019 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 1979 | if (!SYMBOLP (hare) || NILP (hare)) |
| 2020 | break; | 1980 | break; |
| 2021 | hare = XSYMBOL (hare)->function; | 1981 | hare = XSYMBOL (hare)->function; |
| 2022 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 1982 | if (!SYMBOLP (hare) || NILP (hare)) |
| 2023 | break; | 1983 | break; |
| 2024 | hare = XSYMBOL (hare)->function; | 1984 | hare = XSYMBOL (hare)->function; |
| 2025 | 1985 | ||
| @@ -2046,10 +2006,10 @@ function chain of symbols. */) | |||
| 2046 | 2006 | ||
| 2047 | /* Optimize for no indirection. */ | 2007 | /* Optimize for no indirection. */ |
| 2048 | result = object; | 2008 | result = object; |
| 2049 | if (SYMBOLP (result) && !EQ (result, Qunbound) | 2009 | if (SYMBOLP (result) && !NILP (result) |
| 2050 | && (result = XSYMBOL (result)->function, SYMBOLP (result))) | 2010 | && (result = XSYMBOL (result)->function, SYMBOLP (result))) |
| 2051 | result = indirect_function (result); | 2011 | result = indirect_function (result); |
| 2052 | if (!EQ (result, Qunbound)) | 2012 | if (!NILP (result)) |
| 2053 | return result; | 2013 | return result; |
| 2054 | 2014 | ||
| 2055 | if (NILP (noerror)) | 2015 | if (NILP (noerror)) |
| @@ -2704,10 +2664,10 @@ usage: (* &rest NUMBERS-OR-MARKERS) */) | |||
| 2704 | return arith_driver (Amult, nargs, args); | 2664 | return arith_driver (Amult, nargs, args); |
| 2705 | } | 2665 | } |
| 2706 | 2666 | ||
| 2707 | DEFUN ("/", Fquo, Squo, 2, MANY, 0, | 2667 | DEFUN ("/", Fquo, Squo, 1, MANY, 0, |
| 2708 | doc: /* Return first argument divided by all the remaining arguments. | 2668 | doc: /* Return first argument divided by all the remaining arguments. |
| 2709 | The arguments must be numbers or markers. | 2669 | The arguments must be numbers or markers. |
| 2710 | usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) | 2670 | usage: (/ DIVIDEND &rest DIVISORS) */) |
| 2711 | (ptrdiff_t nargs, Lisp_Object *args) | 2671 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2712 | { | 2672 | { |
| 2713 | ptrdiff_t argnum; | 2673 | ptrdiff_t argnum; |
| @@ -3072,6 +3032,7 @@ syms_of_data (void) | |||
| 3072 | DEFSYM (Qfont_object, "font-object"); | 3032 | DEFSYM (Qfont_object, "font-object"); |
| 3073 | 3033 | ||
| 3074 | DEFSYM (Qinteractive_form, "interactive-form"); | 3034 | DEFSYM (Qinteractive_form, "interactive-form"); |
| 3035 | DEFSYM (Qdefalias_fset_function, "defalias-fset-function"); | ||
| 3075 | 3036 | ||
| 3076 | defsubr (&Sindirect_variable); | 3037 | defsubr (&Sindirect_variable); |
| 3077 | defsubr (&Sinteractive_form); | 3038 | defsubr (&Sinteractive_form); |
| @@ -3180,32 +3141,3 @@ syms_of_data (void) | |||
| 3180 | Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); | 3141 | Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); |
| 3181 | XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; | 3142 | XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; |
| 3182 | } | 3143 | } |
| 3183 | |||
| 3184 | static _Noreturn void | ||
| 3185 | handle_arith_signal (int sig) | ||
| 3186 | { | ||
| 3187 | pthread_sigmask (SIG_SETMASK, &empty_mask, 0); | ||
| 3188 | xsignal0 (Qarith_error); | ||
| 3189 | } | ||
| 3190 | |||
| 3191 | static void | ||
| 3192 | deliver_arith_signal (int sig) | ||
| 3193 | { | ||
| 3194 | handle_on_main_thread (sig, handle_arith_signal); | ||
| 3195 | } | ||
| 3196 | |||
| 3197 | void | ||
| 3198 | init_data (void) | ||
| 3199 | { | ||
| 3200 | struct sigaction action; | ||
| 3201 | /* Don't do this if just dumping out. | ||
| 3202 | We don't want to call `signal' in this case | ||
| 3203 | so that we don't have trouble with dumping | ||
| 3204 | signal-delivering routines in an inconsistent state. */ | ||
| 3205 | #ifndef CANNOT_DUMP | ||
| 3206 | if (!initialized) | ||
| 3207 | return; | ||
| 3208 | #endif /* CANNOT_DUMP */ | ||
| 3209 | emacs_sigaction_init (&action, deliver_arith_signal); | ||
| 3210 | sigaction (SIGFPE, &action, 0); | ||
| 3211 | } | ||