diff options
| author | Tom Tromey | 2012-12-17 07:56:22 -0700 |
|---|---|---|
| committer | Tom Tromey | 2012-12-17 07:56:22 -0700 |
| commit | 3d6eced1ae51ffd0a782130e7c334052277e2724 (patch) | |
| tree | 5d1d2ad7cd3374f922886c4a72062511a035c168 /src/data.c | |
| parent | bf69f522a9e135f9aa483cedd53e71e915f2bf75 (diff) | |
| parent | 7c3d167f48d6262ee4e5512aa50a07ee96bc1509 (diff) | |
| download | emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.tar.gz emacs-3d6eced1ae51ffd0a782130e7c334052277e2724.zip | |
merge from trunk
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 224 |
1 files changed, 84 insertions, 140 deletions
diff --git a/src/data.c b/src/data.c index a93cd169bf5..540c91bd4a5 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -19,9 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <signal.h> | ||
| 23 | #include <stdio.h> | 22 | #include <stdio.h> |
| 24 | #include <setjmp.h> | ||
| 25 | 23 | ||
| 26 | #include <intprops.h> | 24 | #include <intprops.h> |
| 27 | 25 | ||
| @@ -36,19 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 36 | #include "font.h" | 34 | #include "font.h" |
| 37 | #include "keymap.h" | 35 | #include "keymap.h" |
| 38 | 36 | ||
| 39 | #include <float.h> | ||
| 40 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ | ||
| 41 | #ifndef IEEE_FLOATING_POINT | ||
| 42 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | ||
| 43 | && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) | ||
| 44 | #define IEEE_FLOATING_POINT 1 | ||
| 45 | #else | ||
| 46 | #define IEEE_FLOATING_POINT 0 | ||
| 47 | #endif | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #include <math.h> | ||
| 51 | |||
| 52 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; | 37 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; |
| 53 | static Lisp_Object Qsubr; | 38 | static Lisp_Object Qsubr; |
| 54 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; | 39 | Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; |
| @@ -77,8 +62,8 @@ Lisp_Object Qchar_table_p, Qvector_or_char_table_p; | |||
| 77 | Lisp_Object Qcdr; | 62 | Lisp_Object Qcdr; |
| 78 | static Lisp_Object Qad_advice_info, Qad_activate_internal; | 63 | static Lisp_Object Qad_advice_info, Qad_activate_internal; |
| 79 | 64 | ||
| 80 | Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error; | 65 | static Lisp_Object Qdomain_error, Qsingularity_error, Qunderflow_error; |
| 81 | Lisp_Object Qoverflow_error, Qunderflow_error; | 66 | Lisp_Object Qrange_error, Qoverflow_error; |
| 82 | 67 | ||
| 83 | Lisp_Object Qfloatp; | 68 | Lisp_Object Qfloatp; |
| 84 | Lisp_Object Qnumberp, Qnumber_or_marker_p; | 69 | Lisp_Object Qnumberp, Qnumber_or_marker_p; |
| @@ -97,6 +82,7 @@ static Lisp_Object Qdefun; | |||
| 97 | Lisp_Object Qthread, Qmutex, Qcondition_variable; | 82 | Lisp_Object Qthread, Qmutex, Qcondition_variable; |
| 98 | 83 | ||
| 99 | Lisp_Object Qinteractive_form; | 84 | Lisp_Object Qinteractive_form; |
| 85 | static Lisp_Object Qdefalias_fset_function; | ||
| 100 | 86 | ||
| 101 | static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); | 87 | static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *); |
| 102 | 88 | ||
| @@ -109,7 +95,7 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) | |||
| 109 | to try and do that by checking the tagbits, but nowadays all | 95 | to try and do that by checking the tagbits, but nowadays all |
| 110 | tagbits are potentially valid. */ | 96 | tagbits are potentially valid. */ |
| 111 | /* if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit) | 97 | /* if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit) |
| 112 | * abort (); */ | 98 | * emacs_abort (); */ |
| 113 | 99 | ||
| 114 | xsignal2 (Qwrong_type_argument, predicate, value); | 100 | xsignal2 (Qwrong_type_argument, predicate, value); |
| 115 | } | 101 | } |
| @@ -183,7 +169,7 @@ for example, (type-of 1) returns `integer'. */) | |||
| 183 | case Lisp_Misc_Float: | 169 | case Lisp_Misc_Float: |
| 184 | return Qfloat; | 170 | return Qfloat; |
| 185 | } | 171 | } |
| 186 | abort (); | 172 | emacs_abort (); |
| 187 | 173 | ||
| 188 | case Lisp_Vectorlike: | 174 | case Lisp_Vectorlike: |
| 189 | if (WINDOW_CONFIGURATIONP (object)) | 175 | if (WINDOW_CONFIGURATIONP (object)) |
| @@ -224,7 +210,7 @@ for example, (type-of 1) returns `integer'. */) | |||
| 224 | return Qfloat; | 210 | return Qfloat; |
| 225 | 211 | ||
| 226 | default: | 212 | default: |
| 227 | abort (); | 213 | emacs_abort (); |
| 228 | } | 214 | } |
| 229 | } | 215 | } |
| 230 | 216 | ||
| @@ -496,7 +482,7 @@ DEFUN ("condition-variable-p", Fcondition_variable_p, Scondition_variable_p, | |||
| 496 | return Qnil; | 482 | return Qnil; |
| 497 | } | 483 | } |
| 498 | 484 | ||
| 499 | /* Extract and set components of lists */ | 485 | /* Extract and set components of lists. */ |
| 500 | 486 | ||
| 501 | DEFUN ("car", Fcar, Scar, 1, 1, 0, | 487 | DEFUN ("car", Fcar, Scar, 1, 1, 0, |
| 502 | doc: /* Return the car of LIST. If arg is nil, return nil. | 488 | doc: /* Return the car of LIST. If arg is nil, return nil. |
| @@ -557,7 +543,9 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0, | |||
| 557 | /* Extract and set components of symbols. */ | 543 | /* Extract and set components of symbols. */ |
| 558 | 544 | ||
| 559 | DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, | 545 | DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, |
| 560 | doc: /* Return t if SYMBOL's value is not void. */) | 546 | doc: /* Return t if SYMBOL's value is not void. |
| 547 | Note that if `lexical-binding' is in effect, this refers to the | ||
| 548 | global value outside of any lexical scope. */) | ||
| 561 | (register Lisp_Object symbol) | 549 | (register Lisp_Object symbol) |
| 562 | { | 550 | { |
| 563 | Lisp_Object valcontents; | 551 | Lisp_Object valcontents; |
| @@ -588,18 +576,19 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, | |||
| 588 | /* In set_internal, we un-forward vars when their value is | 576 | /* In set_internal, we un-forward vars when their value is |
| 589 | set to Qunbound. */ | 577 | set to Qunbound. */ |
| 590 | return Qt; | 578 | return Qt; |
| 591 | default: abort (); | 579 | default: emacs_abort (); |
| 592 | } | 580 | } |
| 593 | 581 | ||
| 594 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); | 582 | return (EQ (valcontents, Qunbound) ? Qnil : Qt); |
| 595 | } | 583 | } |
| 596 | 584 | ||
| 585 | /* FIXME: Make it an alias for function-symbol! */ | ||
| 597 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, | 586 | DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, |
| 598 | doc: /* Return t if SYMBOL's function definition is not void. */) | 587 | doc: /* Return t if SYMBOL's function definition is not void. */) |
| 599 | (register Lisp_Object symbol) | 588 | (register Lisp_Object symbol) |
| 600 | { | 589 | { |
| 601 | CHECK_SYMBOL (symbol); | 590 | CHECK_SYMBOL (symbol); |
| 602 | return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt; | 591 | return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt; |
| 603 | } | 592 | } |
| 604 | 593 | ||
| 605 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, | 594 | DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, |
| @@ -615,14 +604,14 @@ Return SYMBOL. */) | |||
| 615 | } | 604 | } |
| 616 | 605 | ||
| 617 | DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, | 606 | DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, |
| 618 | doc: /* Make SYMBOL's function definition be void. | 607 | doc: /* Make SYMBOL's function definition be nil. |
| 619 | Return SYMBOL. */) | 608 | Return SYMBOL. */) |
| 620 | (register Lisp_Object symbol) | 609 | (register Lisp_Object symbol) |
| 621 | { | 610 | { |
| 622 | CHECK_SYMBOL (symbol); | 611 | CHECK_SYMBOL (symbol); |
| 623 | if (NILP (symbol) || EQ (symbol, Qt)) | 612 | if (NILP (symbol) || EQ (symbol, Qt)) |
| 624 | xsignal1 (Qsetting_constant, symbol); | 613 | xsignal1 (Qsetting_constant, symbol); |
| 625 | set_symbol_function (symbol, Qunbound); | 614 | set_symbol_function (symbol, Qnil); |
| 626 | return symbol; | 615 | return symbol; |
| 627 | } | 616 | } |
| 628 | 617 | ||
| @@ -631,9 +620,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, | |||
| 631 | (register Lisp_Object symbol) | 620 | (register Lisp_Object symbol) |
| 632 | { | 621 | { |
| 633 | CHECK_SYMBOL (symbol); | 622 | CHECK_SYMBOL (symbol); |
| 634 | if (!EQ (XSYMBOL (symbol)->function, Qunbound)) | ||
| 635 | return XSYMBOL (symbol)->function; | 623 | return XSYMBOL (symbol)->function; |
| 636 | xsignal1 (Qvoid_function, symbol); | ||
| 637 | } | 624 | } |
| 638 | 625 | ||
| 639 | DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, | 626 | DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, |
| @@ -660,27 +647,18 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |||
| 660 | (register Lisp_Object symbol, Lisp_Object definition) | 647 | (register Lisp_Object symbol, Lisp_Object definition) |
| 661 | { | 648 | { |
| 662 | register Lisp_Object function; | 649 | register Lisp_Object function; |
| 663 | |||
| 664 | CHECK_SYMBOL (symbol); | 650 | CHECK_SYMBOL (symbol); |
| 665 | if (NILP (symbol) || EQ (symbol, Qt)) | ||
| 666 | xsignal1 (Qsetting_constant, symbol); | ||
| 667 | 651 | ||
| 668 | function = XSYMBOL (symbol)->function; | 652 | function = XSYMBOL (symbol)->function; |
| 669 | 653 | ||
| 670 | if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) | 654 | if (!NILP (Vautoload_queue) && !NILP (function)) |
| 671 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); | 655 | Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); |
| 672 | 656 | ||
| 673 | if (CONSP (function) && EQ (XCAR (function), Qautoload)) | 657 | if (AUTOLOADP (function)) |
| 674 | Fput (symbol, Qautoload, XCDR (function)); | 658 | Fput (symbol, Qautoload, XCDR (function)); |
| 675 | 659 | ||
| 676 | set_symbol_function (symbol, definition); | 660 | set_symbol_function (symbol, definition); |
| 677 | /* Handle automatic advice activation. */ | 661 | |
| 678 | if (CONSP (XSYMBOL (symbol)->plist) | ||
| 679 | && !NILP (Fget (symbol, Qad_advice_info))) | ||
| 680 | { | ||
| 681 | call2 (Qad_activate_internal, symbol, Qnil); | ||
| 682 | definition = XSYMBOL (symbol)->function; | ||
| 683 | } | ||
| 684 | return definition; | 662 | return definition; |
| 685 | } | 663 | } |
| 686 | 664 | ||
| @@ -694,15 +672,32 @@ The return value is undefined. */) | |||
| 694 | (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) | 672 | (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) |
| 695 | { | 673 | { |
| 696 | CHECK_SYMBOL (symbol); | 674 | CHECK_SYMBOL (symbol); |
| 697 | if (CONSP (XSYMBOL (symbol)->function) | ||
| 698 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) | ||
| 699 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | ||
| 700 | if (!NILP (Vpurify_flag) | 675 | if (!NILP (Vpurify_flag) |
| 701 | /* If `definition' is a keymap, immutable (and copying) is wrong. */ | 676 | /* If `definition' is a keymap, immutable (and copying) is wrong. */ |
| 702 | && !KEYMAPP (definition)) | 677 | && !KEYMAPP (definition)) |
| 703 | definition = Fpurecopy (definition); | 678 | definition = Fpurecopy (definition); |
| 704 | definition = Ffset (symbol, definition); | 679 | |
| 705 | LOADHIST_ATTACH (Fcons (Qdefun, symbol)); | 680 | { |
| 681 | bool autoload = AUTOLOADP (definition); | ||
| 682 | if (NILP (Vpurify_flag) || !autoload) | ||
| 683 | { /* Only add autoload entries after dumping, because the ones before are | ||
| 684 | not useful and else we get loads of them from the loaddefs.el. */ | ||
| 685 | |||
| 686 | if (AUTOLOADP (XSYMBOL (symbol)->function)) | ||
| 687 | /* Remember that the function was already an autoload. */ | ||
| 688 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | ||
| 689 | LOADHIST_ATTACH (Fcons (autoload ? Qautoload : Qdefun, symbol)); | ||
| 690 | } | ||
| 691 | } | ||
| 692 | |||
| 693 | { /* Handle automatic advice activation. */ | ||
| 694 | Lisp_Object hook = Fget (symbol, Qdefalias_fset_function); | ||
| 695 | if (!NILP (hook)) | ||
| 696 | call2 (hook, symbol, definition); | ||
| 697 | else | ||
| 698 | Ffset (symbol, definition); | ||
| 699 | } | ||
| 700 | |||
| 706 | if (!NILP (docstring)) | 701 | if (!NILP (docstring)) |
| 707 | Fput (symbol, Qfunction_documentation, docstring); | 702 | Fput (symbol, Qfunction_documentation, docstring); |
| 708 | /* We used to return `definition', but now that `defun' and `defmacro' expand | 703 | /* We used to return `definition', but now that `defun' and `defmacro' expand |
| @@ -732,12 +727,10 @@ function with `&rest' args, or `unevalled' for a special form. */) | |||
| 732 | CHECK_SUBR (subr); | 727 | CHECK_SUBR (subr); |
| 733 | minargs = XSUBR (subr)->min_args; | 728 | minargs = XSUBR (subr)->min_args; |
| 734 | maxargs = XSUBR (subr)->max_args; | 729 | maxargs = XSUBR (subr)->max_args; |
| 735 | if (maxargs == MANY) | 730 | return Fcons (make_number (minargs), |
| 736 | return Fcons (make_number (minargs), Qmany); | 731 | maxargs == MANY ? Qmany |
| 737 | else if (maxargs == UNEVALLED) | 732 | : maxargs == UNEVALLED ? Qunevalled |
| 738 | return Fcons (make_number (minargs), Qunevalled); | 733 | : make_number (maxargs)); |
| 739 | else | ||
| 740 | return Fcons (make_number (minargs), make_number (maxargs)); | ||
| 741 | } | 734 | } |
| 742 | 735 | ||
| 743 | DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, | 736 | DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0, |
| @@ -759,11 +752,11 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 759 | { | 752 | { |
| 760 | Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ | 753 | Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ |
| 761 | 754 | ||
| 762 | if (NILP (fun) || EQ (fun, Qunbound)) | 755 | if (NILP (fun)) |
| 763 | return Qnil; | 756 | return Qnil; |
| 764 | 757 | ||
| 765 | /* Use an `interactive-form' property if present, analogous to the | 758 | /* Use an `interactive-form' property if present, analogous to the |
| 766 | function-documentation property. */ | 759 | function-documentation property. */ |
| 767 | fun = cmd; | 760 | fun = cmd; |
| 768 | while (SYMBOLP (fun)) | 761 | while (SYMBOLP (fun)) |
| 769 | { | 762 | { |
| @@ -787,6 +780,8 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 787 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) | 780 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) |
| 788 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); | 781 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); |
| 789 | } | 782 | } |
| 783 | else if (AUTOLOADP (fun)) | ||
| 784 | return Finteractive_form (Fautoload_do_load (fun, cmd, Qnil)); | ||
| 790 | else if (CONSP (fun)) | 785 | else if (CONSP (fun)) |
| 791 | { | 786 | { |
| 792 | Lisp_Object funcar = XCAR (fun); | 787 | Lisp_Object funcar = XCAR (fun); |
| @@ -794,14 +789,6 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 794 | return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); | 789 | return Fassq (Qinteractive, Fcdr (Fcdr (XCDR (fun)))); |
| 795 | else if (EQ (funcar, Qlambda)) | 790 | else if (EQ (funcar, Qlambda)) |
| 796 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); | 791 | return Fassq (Qinteractive, Fcdr (XCDR (fun))); |
| 797 | else if (EQ (funcar, Qautoload)) | ||
| 798 | { | ||
| 799 | struct gcpro gcpro1; | ||
| 800 | GCPRO1 (cmd); | ||
| 801 | Fautoload_do_load (fun, cmd, Qnil); | ||
| 802 | UNGCPRO; | ||
| 803 | return Finteractive_form (cmd); | ||
| 804 | } | ||
| 805 | } | 792 | } |
| 806 | return Qnil; | 793 | return Qnil; |
| 807 | } | 794 | } |
| @@ -901,7 +888,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents) | |||
| 901 | don't think anything will break. --lorentey */ | 888 | don't think anything will break. --lorentey */ |
| 902 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset | 889 | return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset |
| 903 | + (char *)FRAME_KBOARD (SELECTED_FRAME ())); | 890 | + (char *)FRAME_KBOARD (SELECTED_FRAME ())); |
| 904 | default: abort (); | 891 | default: emacs_abort (); |
| 905 | } | 892 | } |
| 906 | } | 893 | } |
| 907 | 894 | ||
| @@ -987,12 +974,14 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva | |||
| 987 | break; | 974 | break; |
| 988 | 975 | ||
| 989 | default: | 976 | default: |
| 990 | abort (); /* goto def; */ | 977 | emacs_abort (); /* goto def; */ |
| 991 | } | 978 | } |
| 992 | } | 979 | } |
| 993 | 980 | ||
| 994 | /* Set up SYMBOL to refer to its global binding. | 981 | /* Set up SYMBOL to refer to its global binding. This makes it safe |
| 995 | This makes it safe to alter the status of other bindings. */ | 982 | to alter the status of other bindings. BEWARE: this may be called |
| 983 | during the mark phase of GC, where we assume that Lisp_Object slots | ||
| 984 | of BLV are marked after this function has changed them. */ | ||
| 996 | 985 | ||
| 997 | void | 986 | void |
| 998 | swap_in_global_binding (struct Lisp_Symbol *symbol) | 987 | swap_in_global_binding (struct Lisp_Symbol *symbol) |
| @@ -1051,7 +1040,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_ | |||
| 1051 | else | 1040 | else |
| 1052 | { | 1041 | { |
| 1053 | tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist)); | 1042 | tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist)); |
| 1054 | XSETBUFFER (blv->where, current_buffer); | 1043 | set_blv_where (blv, Fcurrent_buffer ()); |
| 1055 | } | 1044 | } |
| 1056 | } | 1045 | } |
| 1057 | if (!(blv->found = !NILP (tem1))) | 1046 | if (!(blv->found = !NILP (tem1))) |
| @@ -1092,12 +1081,14 @@ find_symbol_value (Lisp_Object symbol) | |||
| 1092 | /* FALLTHROUGH */ | 1081 | /* FALLTHROUGH */ |
| 1093 | case SYMBOL_FORWARDED: | 1082 | case SYMBOL_FORWARDED: |
| 1094 | return do_symval_forwarding (SYMBOL_FWD (sym)); | 1083 | return do_symval_forwarding (SYMBOL_FWD (sym)); |
| 1095 | default: abort (); | 1084 | default: emacs_abort (); |
| 1096 | } | 1085 | } |
| 1097 | } | 1086 | } |
| 1098 | 1087 | ||
| 1099 | DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, | 1088 | DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, |
| 1100 | doc: /* Return SYMBOL's value. Error if that is void. */) | 1089 | doc: /* Return SYMBOL's value. Error if that is void. |
| 1090 | Note that if `lexical-binding' is in effect, this returns the | ||
| 1091 | global value outside of any lexical scope. */) | ||
| 1101 | (Lisp_Object symbol) | 1092 | (Lisp_Object symbol) |
| 1102 | { | 1093 | { |
| 1103 | Lisp_Object val; | 1094 | Lisp_Object val; |
| @@ -1205,7 +1196,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, | |||
| 1205 | the default binding is loaded, the loaded binding may be the | 1196 | the default binding is loaded, the loaded binding may be the |
| 1206 | wrong one. */ | 1197 | wrong one. */ |
| 1207 | if (!EQ (blv->where, where) | 1198 | if (!EQ (blv->where, where) |
| 1208 | /* Also unload a global binding (if the var is local_if_set). */ | 1199 | /* Also unload a global binding (if the var is local_if_set). */ |
| 1209 | || (EQ (blv->valcell, blv->defcell))) | 1200 | || (EQ (blv->valcell, blv->defcell))) |
| 1210 | { | 1201 | { |
| 1211 | /* The currently loaded binding is not necessarily valid. | 1202 | /* The currently loaded binding is not necessarily valid. |
| @@ -1302,7 +1293,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, | |||
| 1302 | store_symval_forwarding (/* sym, */ innercontents, newval, buf); | 1293 | store_symval_forwarding (/* sym, */ innercontents, newval, buf); |
| 1303 | break; | 1294 | break; |
| 1304 | } | 1295 | } |
| 1305 | default: abort (); | 1296 | default: emacs_abort (); |
| 1306 | } | 1297 | } |
| 1307 | return; | 1298 | return; |
| 1308 | } | 1299 | } |
| @@ -1353,7 +1344,7 @@ default_value (Lisp_Object symbol) | |||
| 1353 | /* For other variables, get the current value. */ | 1344 | /* For other variables, get the current value. */ |
| 1354 | return do_symval_forwarding (valcontents); | 1345 | return do_symval_forwarding (valcontents); |
| 1355 | } | 1346 | } |
| 1356 | default: abort (); | 1347 | default: emacs_abort (); |
| 1357 | } | 1348 | } |
| 1358 | } | 1349 | } |
| 1359 | 1350 | ||
| @@ -1451,7 +1442,7 @@ for this variable. */) | |||
| 1451 | else | 1442 | else |
| 1452 | return Fset (symbol, value); | 1443 | return Fset (symbol, value); |
| 1453 | } | 1444 | } |
| 1454 | default: abort (); | 1445 | default: emacs_abort (); |
| 1455 | } | 1446 | } |
| 1456 | } | 1447 | } |
| 1457 | 1448 | ||
| @@ -1575,7 +1566,7 @@ The function `default-value' gets the default value and `set-default' sets it. | |||
| 1575 | else if (BUFFER_OBJFWDP (valcontents.fwd)) | 1566 | else if (BUFFER_OBJFWDP (valcontents.fwd)) |
| 1576 | return variable; | 1567 | return variable; |
| 1577 | break; | 1568 | break; |
| 1578 | default: abort (); | 1569 | default: emacs_abort (); |
| 1579 | } | 1570 | } |
| 1580 | 1571 | ||
| 1581 | if (sym->constant) | 1572 | if (sym->constant) |
| @@ -1648,7 +1639,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) | |||
| 1648 | error ("Symbol %s may not be buffer-local", | 1639 | error ("Symbol %s may not be buffer-local", |
| 1649 | SDATA (SYMBOL_NAME (variable))); | 1640 | SDATA (SYMBOL_NAME (variable))); |
| 1650 | break; | 1641 | break; |
| 1651 | default: abort (); | 1642 | default: emacs_abort (); |
| 1652 | } | 1643 | } |
| 1653 | 1644 | ||
| 1654 | if (sym->constant) | 1645 | if (sym->constant) |
| @@ -1755,7 +1746,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) | |||
| 1755 | if (blv->frame_local) | 1746 | if (blv->frame_local) |
| 1756 | return variable; | 1747 | return variable; |
| 1757 | break; | 1748 | break; |
| 1758 | default: abort (); | 1749 | default: emacs_abort (); |
| 1759 | } | 1750 | } |
| 1760 | 1751 | ||
| 1761 | /* Get rid of this buffer's alist element, if any. */ | 1752 | /* Get rid of this buffer's alist element, if any. */ |
| @@ -1837,7 +1828,7 @@ frame-local bindings). */) | |||
| 1837 | error ("Symbol %s may not be frame-local", | 1828 | error ("Symbol %s may not be frame-local", |
| 1838 | SDATA (SYMBOL_NAME (variable))); | 1829 | SDATA (SYMBOL_NAME (variable))); |
| 1839 | break; | 1830 | break; |
| 1840 | default: abort (); | 1831 | default: emacs_abort (); |
| 1841 | } | 1832 | } |
| 1842 | 1833 | ||
| 1843 | if (sym->constant) | 1834 | if (sym->constant) |
| @@ -1914,18 +1905,18 @@ BUFFER defaults to the current buffer. */) | |||
| 1914 | } | 1905 | } |
| 1915 | return Qnil; | 1906 | return Qnil; |
| 1916 | } | 1907 | } |
| 1917 | default: abort (); | 1908 | default: emacs_abort (); |
| 1918 | } | 1909 | } |
| 1919 | } | 1910 | } |
| 1920 | 1911 | ||
| 1921 | DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p, | 1912 | DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p, |
| 1922 | 1, 2, 0, | 1913 | 1, 2, 0, |
| 1923 | doc: /* Non-nil if VARIABLE will be local in buffer BUFFER when set there. | 1914 | doc: /* Non-nil if VARIABLE is local in buffer BUFFER when set there. |
| 1924 | More precisely, this means that setting the variable \(with `set' or`setq'), | 1915 | BUFFER defaults to the current buffer. |
| 1925 | while it does not have a `let'-style binding that was made in BUFFER, | 1916 | |
| 1926 | will produce a buffer local binding. See Info node | 1917 | More precisely, return non-nil if either VARIABLE already has a local |
| 1927 | `(elisp)Creating Buffer-Local'. | 1918 | value in BUFFER, or if VARIABLE is automatically buffer-local (see |
| 1928 | BUFFER defaults to the current buffer. */) | 1919 | `make-variable-buffer-local'). */) |
| 1929 | (register Lisp_Object variable, Lisp_Object buffer) | 1920 | (register Lisp_Object variable, Lisp_Object buffer) |
| 1930 | { | 1921 | { |
| 1931 | struct Lisp_Symbol *sym; | 1922 | struct Lisp_Symbol *sym; |
| @@ -1949,7 +1940,7 @@ BUFFER defaults to the current buffer. */) | |||
| 1949 | case SYMBOL_FORWARDED: | 1940 | case SYMBOL_FORWARDED: |
| 1950 | /* All BUFFER_OBJFWD slots become local if they are set. */ | 1941 | /* All BUFFER_OBJFWD slots become local if they are set. */ |
| 1951 | return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil); | 1942 | return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil); |
| 1952 | default: abort (); | 1943 | default: emacs_abort (); |
| 1953 | } | 1944 | } |
| 1954 | } | 1945 | } |
| 1955 | 1946 | ||
| @@ -1993,7 +1984,7 @@ If the current binding is global (the default), the value is nil. */) | |||
| 1993 | return SYMBOL_BLV (sym)->where; | 1984 | return SYMBOL_BLV (sym)->where; |
| 1994 | else | 1985 | else |
| 1995 | return Qnil; | 1986 | return Qnil; |
| 1996 | default: abort (); | 1987 | default: emacs_abort (); |
| 1997 | } | 1988 | } |
| 1998 | } | 1989 | } |
| 1999 | 1990 | ||
| @@ -2057,10 +2048,10 @@ indirect_function (register Lisp_Object object) | |||
| 2057 | 2048 | ||
| 2058 | for (;;) | 2049 | for (;;) |
| 2059 | { | 2050 | { |
| 2060 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 2051 | if (!SYMBOLP (hare) || NILP (hare)) |
| 2061 | break; | 2052 | break; |
| 2062 | hare = XSYMBOL (hare)->function; | 2053 | hare = XSYMBOL (hare)->function; |
| 2063 | if (!SYMBOLP (hare) || EQ (hare, Qunbound)) | 2054 | if (!SYMBOLP (hare) || NILP (hare)) |
| 2064 | break; | 2055 | break; |
| 2065 | hare = XSYMBOL (hare)->function; | 2056 | hare = XSYMBOL (hare)->function; |
| 2066 | 2057 | ||
| @@ -2087,10 +2078,10 @@ function chain of symbols. */) | |||
| 2087 | 2078 | ||
| 2088 | /* Optimize for no indirection. */ | 2079 | /* Optimize for no indirection. */ |
| 2089 | result = object; | 2080 | result = object; |
| 2090 | if (SYMBOLP (result) && !EQ (result, Qunbound) | 2081 | if (SYMBOLP (result) && !NILP (result) |
| 2091 | && (result = XSYMBOL (result)->function, SYMBOLP (result))) | 2082 | && (result = XSYMBOL (result)->function, SYMBOLP (result))) |
| 2092 | result = indirect_function (result); | 2083 | result = indirect_function (result); |
| 2093 | if (!EQ (result, Qunbound)) | 2084 | if (!NILP (result)) |
| 2094 | return result; | 2085 | return result; |
| 2095 | 2086 | ||
| 2096 | if (NILP (noerror)) | 2087 | if (NILP (noerror)) |
| @@ -2309,7 +2300,7 @@ arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) | |||
| 2309 | return Qnil; | 2300 | return Qnil; |
| 2310 | 2301 | ||
| 2311 | default: | 2302 | default: |
| 2312 | abort (); | 2303 | emacs_abort (); |
| 2313 | } | 2304 | } |
| 2314 | } | 2305 | } |
| 2315 | 2306 | ||
| @@ -2745,10 +2736,10 @@ usage: (* &rest NUMBERS-OR-MARKERS) */) | |||
| 2745 | return arith_driver (Amult, nargs, args); | 2736 | return arith_driver (Amult, nargs, args); |
| 2746 | } | 2737 | } |
| 2747 | 2738 | ||
| 2748 | DEFUN ("/", Fquo, Squo, 2, MANY, 0, | 2739 | DEFUN ("/", Fquo, Squo, 1, MANY, 0, |
| 2749 | doc: /* Return first argument divided by all the remaining arguments. | 2740 | doc: /* Return first argument divided by all the remaining arguments. |
| 2750 | The arguments must be numbers or markers. | 2741 | The arguments must be numbers or markers. |
| 2751 | usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */) | 2742 | usage: (/ DIVIDEND &rest DIVISORS) */) |
| 2752 | (ptrdiff_t nargs, Lisp_Object *args) | 2743 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2753 | { | 2744 | { |
| 2754 | ptrdiff_t argnum; | 2745 | ptrdiff_t argnum; |
| @@ -2775,28 +2766,6 @@ Both must be integers or markers. */) | |||
| 2775 | return val; | 2766 | return val; |
| 2776 | } | 2767 | } |
| 2777 | 2768 | ||
| 2778 | #ifndef HAVE_FMOD | ||
| 2779 | double | ||
| 2780 | fmod (double f1, double f2) | ||
| 2781 | { | ||
| 2782 | double r = f1; | ||
| 2783 | |||
| 2784 | if (f2 < 0.0) | ||
| 2785 | f2 = -f2; | ||
| 2786 | |||
| 2787 | /* If the magnitude of the result exceeds that of the divisor, or | ||
| 2788 | the sign of the result does not agree with that of the dividend, | ||
| 2789 | iterate with the reduced value. This does not yield a | ||
| 2790 | particularly accurate result, but at least it will be in the | ||
| 2791 | range promised by fmod. */ | ||
| 2792 | do | ||
| 2793 | r -= f2 * floor (r / f2); | ||
| 2794 | while (f2 <= (r < 0 ? -r : r) || ((r < 0) != (f1 < 0) && ! isnan (r))); | ||
| 2795 | |||
| 2796 | return r; | ||
| 2797 | } | ||
| 2798 | #endif /* ! HAVE_FMOD */ | ||
| 2799 | |||
| 2800 | DEFUN ("mod", Fmod, Smod, 2, 2, 0, | 2769 | DEFUN ("mod", Fmod, Smod, 2, 2, 0, |
| 2801 | doc: /* Return X modulo Y. | 2770 | doc: /* Return X modulo Y. |
| 2802 | The result falls between zero (inclusive) and Y (exclusive). | 2771 | The result falls between zero (inclusive) and Y (exclusive). |
| @@ -3138,6 +3107,7 @@ syms_of_data (void) | |||
| 3138 | DEFSYM (Qfont_object, "font-object"); | 3107 | DEFSYM (Qfont_object, "font-object"); |
| 3139 | 3108 | ||
| 3140 | DEFSYM (Qinteractive_form, "interactive-form"); | 3109 | DEFSYM (Qinteractive_form, "interactive-form"); |
| 3110 | DEFSYM (Qdefalias_fset_function, "defalias-fset-function"); | ||
| 3141 | 3111 | ||
| 3142 | defsubr (&Sindirect_variable); | 3112 | defsubr (&Sindirect_variable); |
| 3143 | defsubr (&Sinteractive_form); | 3113 | defsubr (&Sinteractive_form); |
| @@ -3249,29 +3219,3 @@ syms_of_data (void) | |||
| 3249 | Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); | 3219 | Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); |
| 3250 | XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; | 3220 | XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; |
| 3251 | } | 3221 | } |
| 3252 | |||
| 3253 | #ifndef FORWARD_SIGNAL_TO_MAIN_THREAD | ||
| 3254 | _Noreturn | ||
| 3255 | #endif | ||
| 3256 | static void | ||
| 3257 | arith_error (int signo) | ||
| 3258 | { | ||
| 3259 | sigsetmask (SIGEMPTYMASK); | ||
| 3260 | |||
| 3261 | SIGNAL_THREAD_CHECK (signo); | ||
| 3262 | xsignal0 (Qarith_error); | ||
| 3263 | } | ||
| 3264 | |||
| 3265 | void | ||
| 3266 | init_data (void) | ||
| 3267 | { | ||
| 3268 | /* Don't do this if just dumping out. | ||
| 3269 | We don't want to call `signal' in this case | ||
| 3270 | so that we don't have trouble with dumping | ||
| 3271 | signal-delivering routines in an inconsistent state. */ | ||
| 3272 | #ifndef CANNOT_DUMP | ||
| 3273 | if (!initialized) | ||
| 3274 | return; | ||
| 3275 | #endif /* CANNOT_DUMP */ | ||
| 3276 | signal (SIGFPE, arith_error); | ||
| 3277 | } | ||