Mercurial > hg > xemacs-beta
comparison src/eval.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | 8d2a9b52c682 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
401 | 401 |
402 static Lisp_Object | 402 static Lisp_Object |
403 do_debug_on_exit (Lisp_Object val) | 403 do_debug_on_exit (Lisp_Object val) |
404 { | 404 { |
405 /* This is falsified by call_debugger */ | 405 /* This is falsified by call_debugger */ |
406 int old_debug_on_next_call = debug_on_next_call; | |
407 Lisp_Object v = call_debugger (list2 (Qexit, val)); | 406 Lisp_Object v = call_debugger (list2 (Qexit, val)); |
408 debug_on_next_call = old_debug_on_next_call; | 407 |
409 return ((!UNBOUNDP (v)) ? v : val); | 408 return ((!UNBOUNDP (v)) ? v : val); |
410 } | 409 } |
411 | 410 |
412 /* Called when debug-on-call behavior is called for. Enter the debugger | 411 /* Called when debug-on-call behavior is called for. Enter the debugger |
413 with the appropriate args for this. VAL is either t for a call | 412 with the appropriate args for this. VAL is either t for a call |
585 | 584 |
586 /* NOTE!!! Every function that can call EVAL must protect its args | 585 /* NOTE!!! Every function that can call EVAL must protect its args |
587 and temporaries from garbage collection while it needs them. | 586 and temporaries from garbage collection while it needs them. |
588 The definition of `For' shows what you have to do. */ | 587 The definition of `For' shows what you have to do. */ |
589 | 588 |
590 DEFUN ("or", For, Sor, 0, UNEVALLED, 0 /* | 589 DEFUN ("or", For, 0, UNEVALLED, 0, /* |
591 Eval args until one of them yields non-nil, then return that value. | 590 Eval args until one of them yields non-nil, then return that value. |
592 The remaining args are not evalled at all. | 591 The remaining args are not evalled at all. |
593 If all args return nil, return nil. | 592 If all args return nil, return nil. |
594 */ ) | 593 */ |
595 (args) | 594 (args)) |
596 Lisp_Object args; | |
597 { | 595 { |
598 /* This function can GC */ | 596 /* This function can GC */ |
599 REGISTER Lisp_Object val; | 597 REGISTER Lisp_Object val; |
600 Lisp_Object args_left; | 598 Lisp_Object args_left; |
601 struct gcpro gcpro1; | 599 struct gcpro gcpro1; |
617 | 615 |
618 UNGCPRO; | 616 UNGCPRO; |
619 return val; | 617 return val; |
620 } | 618 } |
621 | 619 |
622 DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0 /* | 620 DEFUN ("and", Fand, 0, UNEVALLED, 0, /* |
623 Eval args until one of them yields nil, then return nil. | 621 Eval args until one of them yields nil, then return nil. |
624 The remaining args are not evalled at all. | 622 The remaining args are not evalled at all. |
625 If no arg yields nil, return the last arg's value. | 623 If no arg yields nil, return the last arg's value. |
626 */ ) | 624 */ |
627 (args) | 625 (args)) |
628 Lisp_Object args; | |
629 { | 626 { |
630 /* This function can GC */ | 627 /* This function can GC */ |
631 REGISTER Lisp_Object val; | 628 REGISTER Lisp_Object val; |
632 Lisp_Object args_left; | 629 Lisp_Object args_left; |
633 struct gcpro gcpro1; | 630 struct gcpro gcpro1; |
649 | 646 |
650 UNGCPRO; | 647 UNGCPRO; |
651 return val; | 648 return val; |
652 } | 649 } |
653 | 650 |
654 DEFUN ("if", Fif, Sif, 2, UNEVALLED, 0 /* | 651 DEFUN ("if", Fif, 2, UNEVALLED, 0, /* |
655 (if COND THEN ELSE...): if COND yields non-nil, do THEN, else do ELSE... | 652 (if COND THEN ELSE...): if COND yields non-nil, do THEN, else do ELSE... |
656 Returns the value of THEN or the value of the last of the ELSE's. | 653 Returns the value of THEN or the value of the last of the ELSE's. |
657 THEN must be one expression, but ELSE... can be zero or more expressions. | 654 THEN must be one expression, but ELSE... can be zero or more expressions. |
658 If COND yields nil, and there are no ELSE's, the value is nil. | 655 If COND yields nil, and there are no ELSE's, the value is nil. |
659 */ ) | 656 */ |
660 (args) | 657 (args)) |
661 Lisp_Object args; | |
662 { | 658 { |
663 /* This function can GC */ | 659 /* This function can GC */ |
664 Lisp_Object cond; | 660 Lisp_Object cond; |
665 struct gcpro gcpro1; | 661 struct gcpro gcpro1; |
666 | 662 |
671 if (!NILP (cond)) | 667 if (!NILP (cond)) |
672 return Feval (Fcar (Fcdr (args))); | 668 return Feval (Fcar (Fcdr (args))); |
673 return Fprogn (Fcdr (Fcdr (args))); | 669 return Fprogn (Fcdr (Fcdr (args))); |
674 } | 670 } |
675 | 671 |
676 DEFUN ("cond", Fcond, Scond, 0, UNEVALLED, 0 /* | 672 DEFUN ("cond", Fcond, 0, UNEVALLED, 0, /* |
677 (cond CLAUSES...): try each clause until one succeeds. | 673 (cond CLAUSES...): try each clause until one succeeds. |
678 Each clause looks like (CONDITION BODY...). CONDITION is evaluated | 674 Each clause looks like (CONDITION BODY...). CONDITION is evaluated |
679 and, if the value is non-nil, this clause succeeds: | 675 and, if the value is non-nil, this clause succeeds: |
680 then the expressions in BODY are evaluated and the last one's | 676 then the expressions in BODY are evaluated and the last one's |
681 value is the value of the cond-form. | 677 value is the value of the cond-form. |
682 If no clause succeeds, cond returns nil. | 678 If no clause succeeds, cond returns nil. |
683 If a clause has one element, as in (CONDITION), | 679 If a clause has one element, as in (CONDITION), |
684 CONDITION's value if non-nil is returned from the cond-form. | 680 CONDITION's value if non-nil is returned from the cond-form. |
685 */ ) | 681 */ |
686 (args) | 682 (args)) |
687 Lisp_Object args; | |
688 { | 683 { |
689 /* This function can GC */ | 684 /* This function can GC */ |
690 REGISTER Lisp_Object clause, val; | 685 REGISTER Lisp_Object clause, val; |
691 struct gcpro gcpro1; | 686 struct gcpro gcpro1; |
692 | 687 |
707 UNGCPRO; | 702 UNGCPRO; |
708 | 703 |
709 return val; | 704 return val; |
710 } | 705 } |
711 | 706 |
712 DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0 /* | 707 DEFUN ("progn", Fprogn, 0, UNEVALLED, 0, /* |
713 (progn BODY...): eval BODY forms sequentially and return value of last one. | 708 (progn BODY...): eval BODY forms sequentially and return value of last one. |
714 */ ) | 709 */ |
715 (args) | 710 (args)) |
716 Lisp_Object args; | |
717 { | 711 { |
718 /* This function can GC */ | 712 /* This function can GC */ |
719 REGISTER Lisp_Object val; | 713 REGISTER Lisp_Object val; |
720 Lisp_Object args_left; | 714 Lisp_Object args_left; |
721 struct gcpro gcpro1; | 715 struct gcpro gcpro1; |
750 | 744 |
751 UNGCPRO; | 745 UNGCPRO; |
752 return val; | 746 return val; |
753 } | 747 } |
754 | 748 |
755 DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0 /* | 749 DEFUN ("prog1", Fprog1, 1, UNEVALLED, 0, /* |
756 (prog1 FIRST BODY...): eval FIRST and BODY sequentially; value from FIRST. | 750 (prog1 FIRST BODY...): eval FIRST and BODY sequentially; value from FIRST. |
757 The value of FIRST is saved during the evaluation of the remaining args, | 751 The value of FIRST is saved during the evaluation of the remaining args, |
758 whose values are discarded. | 752 whose values are discarded. |
759 */ ) | 753 */ |
760 (args) | 754 (args)) |
761 Lisp_Object args; | |
762 { | 755 { |
763 /* This function can GC */ | 756 /* This function can GC */ |
764 Lisp_Object val; | 757 Lisp_Object val; |
765 REGISTER Lisp_Object args_left; | 758 REGISTER Lisp_Object args_left; |
766 struct gcpro gcpro1, gcpro2; | 759 struct gcpro gcpro1, gcpro2; |
785 | 778 |
786 UNGCPRO; | 779 UNGCPRO; |
787 return val; | 780 return val; |
788 } | 781 } |
789 | 782 |
790 DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0 /* | 783 DEFUN ("prog2", Fprog2, 2, UNEVALLED, 0, /* |
791 (prog2 X Y BODY...): eval X, Y and BODY sequentially; value from Y. | 784 (prog2 X Y BODY...): eval X, Y and BODY sequentially; value from Y. |
792 The value of Y is saved during the evaluation of the remaining args, | 785 The value of Y is saved during the evaluation of the remaining args, |
793 whose values are discarded. | 786 whose values are discarded. |
794 */ ) | 787 */ |
795 (args) | 788 (args)) |
796 Lisp_Object args; | |
797 { | 789 { |
798 /* This function can GC */ | 790 /* This function can GC */ |
799 Lisp_Object val; | 791 Lisp_Object val; |
800 REGISTER Lisp_Object args_left; | 792 REGISTER Lisp_Object args_left; |
801 struct gcpro gcpro1, gcpro2; | 793 struct gcpro gcpro1, gcpro2; |
822 | 814 |
823 UNGCPRO; | 815 UNGCPRO; |
824 return val; | 816 return val; |
825 } | 817 } |
826 | 818 |
827 DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0 /* | 819 DEFUN ("let*", FletX, 1, UNEVALLED, 0, /* |
828 (let* VARLIST BODY...): bind variables according to VARLIST then eval BODY. | 820 (let* VARLIST BODY...): bind variables according to VARLIST then eval BODY. |
829 The value of the last form in BODY is returned. | 821 The value of the last form in BODY is returned. |
830 Each element of VARLIST is a symbol (which is bound to nil) | 822 Each element of VARLIST is a symbol (which is bound to nil) |
831 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). | 823 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). |
832 Each VALUEFORM can refer to the symbols already bound by this VARLIST. | 824 Each VALUEFORM can refer to the symbols already bound by this VARLIST. |
833 */ ) | 825 */ |
834 (args) | 826 (args)) |
835 Lisp_Object args; | |
836 { | 827 { |
837 /* This function can GC */ | 828 /* This function can GC */ |
838 Lisp_Object varlist, val, elt; | 829 Lisp_Object varlist, val, elt; |
839 int speccount = specpdl_depth_counter; | 830 int speccount = specpdl_depth_counter; |
840 struct gcpro gcpro1, gcpro2, gcpro3; | 831 struct gcpro gcpro1, gcpro2, gcpro3; |
861 UNGCPRO; | 852 UNGCPRO; |
862 val = Fprogn (Fcdr (args)); | 853 val = Fprogn (Fcdr (args)); |
863 return unbind_to (speccount, val); | 854 return unbind_to (speccount, val); |
864 } | 855 } |
865 | 856 |
866 DEFUN ("let", Flet, Slet, 1, UNEVALLED, 0 /* | 857 DEFUN ("let", Flet, 1, UNEVALLED, 0, /* |
867 (let VARLIST BODY...): bind variables according to VARLIST then eval BODY. | 858 (let VARLIST BODY...): bind variables according to VARLIST then eval BODY. |
868 The value of the last form in BODY is returned. | 859 The value of the last form in BODY is returned. |
869 Each element of VARLIST is a symbol (which is bound to nil) | 860 Each element of VARLIST is a symbol (which is bound to nil) |
870 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). | 861 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). |
871 All the VALUEFORMs are evalled before any symbols are bound. | 862 All the VALUEFORMs are evalled before any symbols are bound. |
872 */ ) | 863 */ |
873 (args) | 864 (args)) |
874 Lisp_Object args; | |
875 { | 865 { |
876 /* This function can GC */ | 866 /* This function can GC */ |
877 Lisp_Object *temps, tem; | 867 Lisp_Object *temps, tem; |
878 REGISTER Lisp_Object elt, varlist; | 868 REGISTER Lisp_Object elt, varlist; |
879 int speccount = specpdl_depth_counter; | 869 int speccount = specpdl_depth_counter; |
919 | 909 |
920 elt = Fprogn (Fcdr (args)); | 910 elt = Fprogn (Fcdr (args)); |
921 return unbind_to (speccount, elt); | 911 return unbind_to (speccount, elt); |
922 } | 912 } |
923 | 913 |
924 DEFUN ("while", Fwhile, Swhile, 1, UNEVALLED, 0 /* | 914 DEFUN ("while", Fwhile, 1, UNEVALLED, 0, /* |
925 (while TEST BODY...): if TEST yields non-nil, eval BODY... and repeat. | 915 (while TEST BODY...): if TEST yields non-nil, eval BODY... and repeat. |
926 The order of execution is thus TEST, BODY, TEST, BODY and so on | 916 The order of execution is thus TEST, BODY, TEST, BODY and so on |
927 until TEST returns nil. | 917 until TEST returns nil. |
928 */ ) | 918 */ |
929 (args) | 919 (args)) |
930 Lisp_Object args; | |
931 { | 920 { |
932 /* This function can GC */ | 921 /* This function can GC */ |
933 Lisp_Object test, body, tem; | 922 Lisp_Object test, body, tem; |
934 struct gcpro gcpro1, gcpro2; | 923 struct gcpro gcpro1, gcpro2; |
935 | 924 |
952 return Qnil; | 941 return Qnil; |
953 } | 942 } |
954 | 943 |
955 Lisp_Object Qsetq; | 944 Lisp_Object Qsetq; |
956 | 945 |
957 DEFUN ("setq", Fsetq, Ssetq, 0, UNEVALLED, 0 /* | 946 DEFUN ("setq", Fsetq, 0, UNEVALLED, 0, /* |
958 (setq SYM VAL SYM VAL ...): set each SYM to the value of its VAL. | 947 (setq SYM VAL SYM VAL ...): set each SYM to the value of its VAL. |
959 The symbols SYM are variables; they are literal (not evaluated). | 948 The symbols SYM are variables; they are literal (not evaluated). |
960 The values VAL are expressions; they are evaluated. | 949 The values VAL are expressions; they are evaluated. |
961 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. | 950 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. |
962 The second VAL is not computed until after the first SYM is set, and so on; | 951 The second VAL is not computed until after the first SYM is set, and so on; |
963 each VAL can use the new value of variables set earlier in the `setq'. | 952 each VAL can use the new value of variables set earlier in the `setq'. |
964 The return value of the `setq' form is the value of the last VAL. | 953 The return value of the `setq' form is the value of the last VAL. |
965 */ ) | 954 */ |
966 (args) | 955 (args)) |
967 Lisp_Object args; | |
968 { | 956 { |
969 /* This function can GC */ | 957 /* This function can GC */ |
970 REGISTER Lisp_Object args_left; | 958 REGISTER Lisp_Object args_left; |
971 REGISTER Lisp_Object val, sym; | 959 REGISTER Lisp_Object val, sym; |
972 struct gcpro gcpro1; | 960 struct gcpro gcpro1; |
992 | 980 |
993 UNGCPRO; | 981 UNGCPRO; |
994 return val; | 982 return val; |
995 } | 983 } |
996 | 984 |
997 DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0 /* | 985 DEFUN ("quote", Fquote, 1, UNEVALLED, 0, /* |
998 Return the argument, without evaluating it. `(quote x)' yields `x'. | 986 Return the argument, without evaluating it. `(quote x)' yields `x'. |
999 */ ) | 987 */ |
1000 (args) | 988 (args)) |
1001 Lisp_Object args; | |
1002 { | 989 { |
1003 return Fcar (args); | 990 return Fcar (args); |
1004 } | 991 } |
1005 | 992 |
1006 DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0 /* | 993 DEFUN ("function", Ffunction, 1, UNEVALLED, 0, /* |
1007 Like `quote', but preferred for objects which are functions. | 994 Like `quote', but preferred for objects which are functions. |
1008 In byte compilation, `function' causes its argument to be compiled. | 995 In byte compilation, `function' causes its argument to be compiled. |
1009 `quote' cannot do that. | 996 `quote' cannot do that. |
1010 */ ) | 997 */ |
1011 (args) | 998 (args)) |
1012 Lisp_Object args; | |
1013 { | 999 { |
1014 return Fcar (args); | 1000 return Fcar (args); |
1015 } | 1001 } |
1016 | 1002 |
1017 | 1003 |
1018 /**********************************************************************/ | 1004 /**********************************************************************/ |
1019 /* Defining functions/variables */ | 1005 /* Defining functions/variables */ |
1020 /**********************************************************************/ | 1006 /**********************************************************************/ |
1021 | 1007 |
1022 DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0 /* | 1008 DEFUN ("defun", Fdefun, 2, UNEVALLED, 0, /* |
1023 (defun NAME ARGLIST [DOCSTRING] BODY...): define NAME as a function. | 1009 (defun NAME ARGLIST [DOCSTRING] BODY...): define NAME as a function. |
1024 The definition is (lambda ARGLIST [DOCSTRING] BODY...). | 1010 The definition is (lambda ARGLIST [DOCSTRING] BODY...). |
1025 See also the function `interactive'. | 1011 See also the function `interactive'. |
1026 */ ) | 1012 */ |
1027 (args) | 1013 (args)) |
1028 Lisp_Object args; | |
1029 { | 1014 { |
1030 /* This function can GC */ | 1015 /* This function can GC */ |
1031 Lisp_Object fn_name; | 1016 Lisp_Object fn_name; |
1032 Lisp_Object defn; | 1017 Lisp_Object defn; |
1033 | 1018 |
1038 Ffset (fn_name, defn); | 1023 Ffset (fn_name, defn); |
1039 LOADHIST_ATTACH (fn_name); | 1024 LOADHIST_ATTACH (fn_name); |
1040 return fn_name; | 1025 return fn_name; |
1041 } | 1026 } |
1042 | 1027 |
1043 DEFUN ("defmacro", Fdefmacro, Sdefmacro, 2, UNEVALLED, 0 /* | 1028 DEFUN ("defmacro", Fdefmacro, 2, UNEVALLED, 0, /* |
1044 (defmacro NAME ARGLIST [DOCSTRING] BODY...): define NAME as a macro. | 1029 (defmacro NAME ARGLIST [DOCSTRING] BODY...): define NAME as a macro. |
1045 The definition is (macro lambda ARGLIST [DOCSTRING] BODY...). | 1030 The definition is (macro lambda ARGLIST [DOCSTRING] BODY...). |
1046 When the macro is called, as in (NAME ARGS...), | 1031 When the macro is called, as in (NAME ARGS...), |
1047 the function (lambda ARGLIST BODY...) is applied to | 1032 the function (lambda ARGLIST BODY...) is applied to |
1048 the list ARGS... as it appears in the expression, | 1033 the list ARGS... as it appears in the expression, |
1049 and the result should be a form to be evaluated instead of the original. | 1034 and the result should be a form to be evaluated instead of the original. |
1050 */ ) | 1035 */ |
1051 (args) | 1036 (args)) |
1052 Lisp_Object args; | |
1053 { | 1037 { |
1054 /* This function can GC */ | 1038 /* This function can GC */ |
1055 Lisp_Object fn_name; | 1039 Lisp_Object fn_name; |
1056 Lisp_Object defn; | 1040 Lisp_Object defn; |
1057 | 1041 |
1062 Ffset (fn_name, defn); | 1046 Ffset (fn_name, defn); |
1063 LOADHIST_ATTACH (fn_name); | 1047 LOADHIST_ATTACH (fn_name); |
1064 return fn_name; | 1048 return fn_name; |
1065 } | 1049 } |
1066 | 1050 |
1067 DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0 /* | 1051 DEFUN ("defvar", Fdefvar, 1, UNEVALLED, 0, /* |
1068 (defvar SYMBOL INITVALUE DOCSTRING): define SYMBOL as a variable. | 1052 (defvar SYMBOL INITVALUE DOCSTRING): define SYMBOL as a variable. |
1069 You are not required to define a variable in order to use it, | 1053 You are not required to define a variable in order to use it, |
1070 but the definition can supply documentation and an initial value | 1054 but the definition can supply documentation and an initial value |
1071 in a way that tags can recognize. | 1055 in a way that tags can recognize. |
1072 | 1056 |
1080 If DOCSTRING starts with *, this variable is identified as a user option. | 1064 If DOCSTRING starts with *, this variable is identified as a user option. |
1081 This means that M-x set-variable and M-x edit-options recognize it. | 1065 This means that M-x set-variable and M-x edit-options recognize it. |
1082 If INITVALUE is missing, SYMBOL's value is not set. | 1066 If INITVALUE is missing, SYMBOL's value is not set. |
1083 | 1067 |
1084 In lisp-interaction-mode defvar is treated as defconst. | 1068 In lisp-interaction-mode defvar is treated as defconst. |
1085 */ ) | 1069 */ |
1086 (args) | 1070 (args)) |
1087 Lisp_Object args; | |
1088 { | 1071 { |
1089 /* This function can GC */ | 1072 /* This function can GC */ |
1090 REGISTER Lisp_Object sym, tem, tail; | 1073 REGISTER Lisp_Object sym, tem, tail; |
1091 | 1074 |
1092 sym = Fcar (args); | 1075 sym = Fcar (args); |
1122 | 1105 |
1123 LOADHIST_ATTACH (sym); | 1106 LOADHIST_ATTACH (sym); |
1124 return sym; | 1107 return sym; |
1125 } | 1108 } |
1126 | 1109 |
1127 DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0 /* | 1110 DEFUN ("defconst", Fdefconst, 2, UNEVALLED, 0, /* |
1128 (defconst SYMBOL INITVALUE DOCSTRING): define SYMBOL as a constant | 1111 (defconst SYMBOL INITVALUE DOCSTRING): define SYMBOL as a constant |
1129 variable. | 1112 variable. |
1130 The intent is that programs do not change this value, but users may. | 1113 The intent is that programs do not change this value, but users may. |
1131 Always sets the value of SYMBOL to the result of evalling INITVALUE. | 1114 Always sets the value of SYMBOL to the result of evalling INITVALUE. |
1132 If SYMBOL is buffer-local, its default value is what is set; | 1115 If SYMBOL is buffer-local, its default value is what is set; |
1138 Note: do not use `defconst' for user options in libraries that are not | 1121 Note: do not use `defconst' for user options in libraries that are not |
1139 normally loaded, since it is useful for users to be able to specify | 1122 normally loaded, since it is useful for users to be able to specify |
1140 their own values for such variables before loading the library. | 1123 their own values for such variables before loading the library. |
1141 Since `defconst' unconditionally assigns the variable, | 1124 Since `defconst' unconditionally assigns the variable, |
1142 it would override the user's choice. | 1125 it would override the user's choice. |
1143 */ ) | 1126 */ |
1144 (args) | 1127 (args)) |
1145 Lisp_Object args; | |
1146 { | 1128 { |
1147 /* This function can GC */ | 1129 /* This function can GC */ |
1148 REGISTER Lisp_Object sym, tem; | 1130 REGISTER Lisp_Object sym, tem; |
1149 | 1131 |
1150 sym = Fcar (args); | 1132 sym = Fcar (args); |
1174 | 1156 |
1175 LOADHIST_ATTACH (sym); | 1157 LOADHIST_ATTACH (sym); |
1176 return sym; | 1158 return sym; |
1177 } | 1159 } |
1178 | 1160 |
1179 DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0 /* | 1161 DEFUN ("user-variable-p", Fuser_variable_p, 1, 1, 0, /* |
1180 Return t if VARIABLE is intended to be set and modified by users. | 1162 Return t if VARIABLE is intended to be set and modified by users. |
1181 \(The alternative is a variable used internally in a Lisp program.) | 1163 \(The alternative is a variable used internally in a Lisp program.) |
1182 Determined by whether the first character of the documentation | 1164 Determined by whether the first character of the documentation |
1183 for the variable is `*'. | 1165 for the variable is `*'. |
1184 */ ) | 1166 */ |
1185 (variable) | 1167 (variable)) |
1186 Lisp_Object variable; | |
1187 { | 1168 { |
1188 Lisp_Object documentation; | 1169 Lisp_Object documentation; |
1189 | 1170 |
1190 documentation = Fget (variable, Qvariable_documentation, Qnil); | 1171 documentation = Fget (variable, Qvariable_documentation, Qnil); |
1191 if (INTP (documentation) && XINT (documentation) < 0) | 1172 if (INTP (documentation) && XINT (documentation) < 0) |
1200 && XINT (XCDR (documentation)) < 0) | 1181 && XINT (XCDR (documentation)) < 0) |
1201 return Qt; | 1182 return Qt; |
1202 return Qnil; | 1183 return Qnil; |
1203 } | 1184 } |
1204 | 1185 |
1205 DEFUN ("macroexpand-internal", Fmacroexpand_internal, Smacroexpand_internal, | 1186 DEFUN ("macroexpand-internal", Fmacroexpand_internal, 1, 2, 0, /* |
1206 1, 2, 0 /* | |
1207 Return result of expanding macros at top level of FORM. | 1187 Return result of expanding macros at top level of FORM. |
1208 If FORM is not a macro call, it is returned unchanged. | 1188 If FORM is not a macro call, it is returned unchanged. |
1209 Otherwise, the macro is expanded and the expansion is considered | 1189 Otherwise, the macro is expanded and the expansion is considered |
1210 in place of FORM. When a non-macro-call results, it is returned. | 1190 in place of FORM. When a non-macro-call results, it is returned. |
1211 | 1191 |
1212 The second optional arg ENVIRONMENT species an environment of macro | 1192 The second optional arg ENVIRONMENT species an environment of macro |
1213 definitions to shadow the loaded ones for use in file byte-compilation. | 1193 definitions to shadow the loaded ones for use in file byte-compilation. |
1214 */ ) | 1194 */ |
1215 (form, env) | 1195 (form, env)) |
1216 Lisp_Object form; | |
1217 Lisp_Object env; | |
1218 { | 1196 { |
1219 /* This function can GC */ | 1197 /* This function can GC */ |
1220 /* With cleanups from Hallvard Furuseth. */ | 1198 /* With cleanups from Hallvard Furuseth. */ |
1221 REGISTER Lisp_Object expander, sym, def, tem; | 1199 REGISTER Lisp_Object expander, sym, def, tem; |
1222 | 1200 |
1285 | 1263 |
1286 /**********************************************************************/ | 1264 /**********************************************************************/ |
1287 /* Non-local exits */ | 1265 /* Non-local exits */ |
1288 /**********************************************************************/ | 1266 /**********************************************************************/ |
1289 | 1267 |
1290 DEFUN ("catch", Fcatch, Scatch, 1, UNEVALLED, 0 /* | 1268 DEFUN ("catch", Fcatch, 1, UNEVALLED, 0, /* |
1291 (catch TAG BODY...): eval BODY allowing nonlocal exits using `throw'. | 1269 (catch TAG BODY...): eval BODY allowing nonlocal exits using `throw'. |
1292 TAG is evalled to get the tag to use. Then the BODY is executed. | 1270 TAG is evalled to get the tag to use. Then the BODY is executed. |
1293 Within BODY, (throw TAG) with same tag exits BODY and exits this `catch'. | 1271 Within BODY, (throw TAG) with same tag exits BODY and exits this `catch'. |
1294 If no throw happens, `catch' returns the value of the last BODY form. | 1272 If no throw happens, `catch' returns the value of the last BODY form. |
1295 If a throw happens, it specifies the value to return from `catch'. | 1273 If a throw happens, it specifies the value to return from `catch'. |
1296 */ ) | 1274 */ |
1297 (args) | 1275 (args)) |
1298 Lisp_Object args; | |
1299 { | 1276 { |
1300 /* This function can GC */ | 1277 /* This function can GC */ |
1301 Lisp_Object tag; | 1278 Lisp_Object tag; |
1302 struct gcpro gcpro1; | 1279 struct gcpro gcpro1; |
1303 | 1280 |
1485 that is EQ() to TAG. When it finds it, it will longjmp() | 1462 that is EQ() to TAG. When it finds it, it will longjmp() |
1486 back to the place that established the catch (in this case, | 1463 back to the place that established the catch (in this case, |
1487 condition_case_1). See below for more info. | 1464 condition_case_1). See below for more info. |
1488 */ | 1465 */ |
1489 | 1466 |
1490 DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0 /* | 1467 DEFUN ("throw", Fthrow, 2, 2, 0, /* |
1491 (throw TAG VALUE): throw to the catch for TAG and return VALUE from it. | 1468 (throw TAG VALUE): throw to the catch for TAG and return VALUE from it. |
1492 Both TAG and VALUE are evalled. | 1469 Both TAG and VALUE are evalled. |
1493 */ ) | 1470 */ |
1494 (tag, val) | 1471 (tag, val)) |
1495 Lisp_Object tag, val; | |
1496 { | 1472 { |
1497 throw_or_bomb_out (tag, val, 0, Qnil, Qnil); /* Doesn't return */ | 1473 throw_or_bomb_out (tag, val, 0, Qnil, Qnil); /* Doesn't return */ |
1498 return Qnil; | 1474 return Qnil; |
1499 } | 1475 } |
1500 | 1476 |
1501 DEFUN ("unwind-protect", Funwind_protect, Sunwind_protect, 1, UNEVALLED, 0 /* | 1477 DEFUN ("unwind-protect", Funwind_protect, 1, UNEVALLED, 0, /* |
1502 Do BODYFORM, protecting with UNWINDFORMS. | 1478 Do BODYFORM, protecting with UNWINDFORMS. |
1503 Usage looks like (unwind-protect BODYFORM UNWINDFORMS...). | 1479 Usage looks like (unwind-protect BODYFORM UNWINDFORMS...). |
1504 If BODYFORM completes normally, its value is returned | 1480 If BODYFORM completes normally, its value is returned |
1505 after executing the UNWINDFORMS. | 1481 after executing the UNWINDFORMS. |
1506 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. | 1482 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. |
1507 */ ) | 1483 */ |
1508 (args) | 1484 (args)) |
1509 Lisp_Object args; | |
1510 { | 1485 { |
1511 /* This function can GC */ | 1486 /* This function can GC */ |
1512 Lisp_Object val; | 1487 Lisp_Object val; |
1513 int speccount = specpdl_depth_counter; | 1488 int speccount = specpdl_depth_counter; |
1514 | 1489 |
1736 Feval, bodyform, | 1711 Feval, bodyform, |
1737 run_condition_case_handlers, | 1712 run_condition_case_handlers, |
1738 var); | 1713 var); |
1739 } | 1714 } |
1740 | 1715 |
1741 DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0 /* | 1716 DEFUN ("condition-case", Fcondition_case, 2, UNEVALLED, 0, /* |
1742 Regain control when an error is signalled. | 1717 Regain control when an error is signalled. |
1743 Usage looks like (condition-case VAR BODYFORM HANDLERS...). | 1718 Usage looks like (condition-case VAR BODYFORM HANDLERS...). |
1744 executes BODYFORM and returns its value if no error happens. | 1719 executes BODYFORM and returns its value if no error happens. |
1745 Each element of HANDLERS looks like (CONDITION-NAME BODY...) | 1720 Each element of HANDLERS looks like (CONDITION-NAME BODY...) |
1746 where the BODY is made of Lisp expressions. | 1721 where the BODY is made of Lisp expressions. |
1769 within the handler will not result in an infinite loop. | 1744 within the handler will not result in an infinite loop. |
1770 | 1745 |
1771 If you want to establish an error handler that is called with the | 1746 If you want to establish an error handler that is called with the |
1772 Lisp stack, bindings, etc. as they were when `signal' was called, | 1747 Lisp stack, bindings, etc. as they were when `signal' was called, |
1773 rather than when the handler was set, use `call-with-condition-handler'. | 1748 rather than when the handler was set, use `call-with-condition-handler'. |
1774 */ ) | 1749 */ |
1775 (args) | 1750 (args)) |
1776 Lisp_Object args; | |
1777 { | 1751 { |
1778 /* This function can GC */ | 1752 /* This function can GC */ |
1779 return Fcondition_case_3 (Fcar (Fcdr (args)), | 1753 return Fcondition_case_3 (Fcar (Fcdr (args)), |
1780 Fcar (args), | 1754 Fcar (args), |
1781 Fcdr (Fcdr (args))); | 1755 Fcdr (Fcdr (args))); |
1782 } | 1756 } |
1783 | 1757 |
1784 DEFUN ("call-with-condition-handler", | 1758 DEFUN ("call-with-condition-handler", Fcall_with_condition_handler, 2, MANY, 0, /* |
1785 Fcall_with_condition_handler, | |
1786 Scall_with_condition_handler, 2, MANY, 0 /* | |
1787 Regain control when an error is signalled, without popping the stack. | 1759 Regain control when an error is signalled, without popping the stack. |
1788 Usage looks like (call-with-condition-handler HANDLER FUNCTION &rest ARGS). | 1760 Usage looks like (call-with-condition-handler HANDLER FUNCTION &rest ARGS). |
1789 This function is similar to `condition-case', but the handler is invoked | 1761 This function is similar to `condition-case', but the handler is invoked |
1790 with the same environment (Lisp stack, bindings, catches, condition-cases) | 1762 with the same environment (Lisp stack, bindings, catches, condition-cases) |
1791 that was current when `signal' was called, rather than when the handler | 1763 that was current when `signal' was called, rather than when the handler |
1796 `signal' is called (this differs from `condition-case', which allows | 1768 `signal' is called (this differs from `condition-case', which allows |
1797 you to specify which errors are trapped). If the handler function | 1769 you to specify which errors are trapped). If the handler function |
1798 returns, `signal' continues as if the handler were never invoked. | 1770 returns, `signal' continues as if the handler were never invoked. |
1799 (It continues to look for handlers established earlier than this one, | 1771 (It continues to look for handlers established earlier than this one, |
1800 and invokes the standard error-handler if none is found.) | 1772 and invokes the standard error-handler if none is found.) |
1801 */ ) | 1773 */ |
1802 (nargs, args) /* Note! Args side-effected! */ | 1774 (int nargs, Lisp_Object *args)) /* Note! Args side-effected! */ |
1803 int nargs; | |
1804 Lisp_Object *args; | |
1805 { | 1775 { |
1806 /* This function can GC */ | 1776 /* This function can GC */ |
1807 int speccount = specpdl_depth_counter; | 1777 int speccount = specpdl_depth_counter; |
1808 Lisp_Object tem; | 1778 Lisp_Object tem; |
1809 | 1779 |
2036 | 2006 |
2037 /* The simplest external error function: it would be called | 2007 /* The simplest external error function: it would be called |
2038 signal_continuable_error() in the terminology below, but it's | 2008 signal_continuable_error() in the terminology below, but it's |
2039 Lisp-callable. */ | 2009 Lisp-callable. */ |
2040 | 2010 |
2041 DEFUN ("signal", Fsignal, Ssignal, 2, 2, 0 /* | 2011 DEFUN ("signal", Fsignal, 2, 2, 0, /* |
2042 Signal a continuable error. Args are ERROR-SYMBOL, and associated DATA. | 2012 Signal a continuable error. Args are ERROR-SYMBOL, and associated DATA. |
2043 An error symbol is a symbol defined using `define-error'. | 2013 An error symbol is a symbol defined using `define-error'. |
2044 DATA should be a list. Its elements are printed as part of the error message. | 2014 DATA should be a list. Its elements are printed as part of the error message. |
2045 If the signal is handled, DATA is made available to the handler. | 2015 If the signal is handled, DATA is made available to the handler. |
2046 See also the function `signal-error', and the functions to handle errors: | 2016 See also the function `signal-error', and the functions to handle errors: |
2047 `condition-case' and `call-with-condition-handler'. | 2017 `condition-case' and `call-with-condition-handler'. |
2048 | 2018 |
2049 Note that this function can return, if the debugger is invoked and the | 2019 Note that this function can return, if the debugger is invoked and the |
2050 user invokes the "return from signal" option. | 2020 user invokes the "return from signal" option. |
2051 */ ) | 2021 */ |
2052 (error_symbol, data) | 2022 (error_symbol, data)) |
2053 Lisp_Object error_symbol, data; | |
2054 { | 2023 { |
2055 /* Fsignal() is one of these functions that's called all the time | 2024 /* Fsignal() is one of these functions that's called all the time |
2056 with newly-created Lisp objects. We allow this; but we must GC- | 2025 with newly-created Lisp objects. We allow this; but we must GC- |
2057 protect the objects because all sorts of weird stuff could | 2026 protect the objects because all sorts of weird stuff could |
2058 happen. */ | 2027 happen. */ |
2508 | 2477 |
2509 /**********************************************************************/ | 2478 /**********************************************************************/ |
2510 /* User commands */ | 2479 /* User commands */ |
2511 /**********************************************************************/ | 2480 /**********************************************************************/ |
2512 | 2481 |
2513 DEFUN ("commandp", Fcommandp, Scommandp, 1, 1, 0 /* | 2482 DEFUN ("commandp", Fcommandp, 1, 1, 0, /* |
2514 T if FUNCTION makes provisions for interactive calling. | 2483 T if FUNCTION makes provisions for interactive calling. |
2515 This means it contains a description for how to read arguments to give it. | 2484 This means it contains a description for how to read arguments to give it. |
2516 The value is nil for an invalid function or a symbol with no function | 2485 The value is nil for an invalid function or a symbol with no function |
2517 definition. | 2486 definition. |
2518 | 2487 |
2525 -- compiled-function objects with a non-nil `compiled-function-interactive' | 2494 -- compiled-function objects with a non-nil `compiled-function-interactive' |
2526 value | 2495 value |
2527 -- subrs (built-in functions) that are interactively callable | 2496 -- subrs (built-in functions) that are interactively callable |
2528 | 2497 |
2529 Also, a symbol satisfies `commandp' if its function definition does so. | 2498 Also, a symbol satisfies `commandp' if its function definition does so. |
2530 */ ) | 2499 */ |
2531 (function) | 2500 (function)) |
2532 Lisp_Object function; | |
2533 { | 2501 { |
2534 REGISTER Lisp_Object fun; | 2502 REGISTER Lisp_Object fun; |
2535 REGISTER Lisp_Object funcar; | 2503 REGISTER Lisp_Object funcar; |
2536 | 2504 |
2537 fun = function; | 2505 fun = function; |
2575 return Fcar (Fcdr (Fcdr (Fcdr (fun)))); | 2543 return Fcar (Fcdr (Fcdr (Fcdr (fun)))); |
2576 else | 2544 else |
2577 return Qnil; | 2545 return Qnil; |
2578 } | 2546 } |
2579 | 2547 |
2580 DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 3, 0 /* | 2548 DEFUN ("command-execute", Fcommand_execute, 1, 3, 0, /* |
2581 Execute CMD as an editor command. | 2549 Execute CMD as an editor command. |
2582 CMD must be an object that satisfies the `commandp' predicate. | 2550 CMD must be an object that satisfies the `commandp' predicate. |
2583 Optional second arg RECORD-FLAG is as in `call-interactively'. | 2551 Optional second arg RECORD-FLAG is as in `call-interactively'. |
2584 The argument KEYS specifies the value to use instead of (this-command-keys) | 2552 The argument KEYS specifies the value to use instead of (this-command-keys) |
2585 when reading the arguments. | 2553 when reading the arguments. |
2586 */ ) | 2554 */ |
2587 (cmd, record, keys) | 2555 (cmd, record, keys)) |
2588 Lisp_Object cmd, record, keys; | |
2589 { | 2556 { |
2590 /* This function can GC */ | 2557 /* This function can GC */ |
2591 Lisp_Object prefixarg; | 2558 Lisp_Object prefixarg; |
2592 Lisp_Object final = cmd; | 2559 Lisp_Object final = cmd; |
2593 struct backtrace backtrace; | 2560 struct backtrace backtrace; |
2642 : list2 (cmd, final)))); | 2609 : list2 (cmd, final)))); |
2643 return Qnil; | 2610 return Qnil; |
2644 } | 2611 } |
2645 } | 2612 } |
2646 | 2613 |
2647 DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0 /* | 2614 DEFUN ("interactive-p", Finteractive_p, 0, 0, 0, /* |
2648 Return t if function in which this appears was called interactively. | 2615 Return t if function in which this appears was called interactively. |
2649 This means that the function was called with call-interactively (which | 2616 This means that the function was called with call-interactively (which |
2650 includes being called as the binding of a key) | 2617 includes being called as the binding of a key) |
2651 and input is currently coming from the keyboard (not in keyboard macro). | 2618 and input is currently coming from the keyboard (not in keyboard macro). |
2652 */ ) | 2619 */ |
2653 () | 2620 ()) |
2654 { | 2621 { |
2655 REGISTER struct backtrace *btp; | 2622 REGISTER struct backtrace *btp; |
2656 REGISTER Lisp_Object fun; | 2623 REGISTER Lisp_Object fun; |
2657 | 2624 |
2658 if (!INTERACTIVE) | 2625 if (!INTERACTIVE) |
2720 | 2687 |
2721 /**********************************************************************/ | 2688 /**********************************************************************/ |
2722 /* Autoloading */ | 2689 /* Autoloading */ |
2723 /**********************************************************************/ | 2690 /**********************************************************************/ |
2724 | 2691 |
2725 DEFUN ("autoload", Fautoload, Sautoload, 2, 5, 0 /* | 2692 DEFUN ("autoload", Fautoload, 2, 5, 0, /* |
2726 Define FUNCTION to autoload from FILE. | 2693 Define FUNCTION to autoload from FILE. |
2727 FUNCTION is a symbol; FILE is a file name string to pass to `load'. | 2694 FUNCTION is a symbol; FILE is a file name string to pass to `load'. |
2728 Third arg DOCSTRING is documentation for the function. | 2695 Third arg DOCSTRING is documentation for the function. |
2729 Fourth arg INTERACTIVE if non-nil says function can be called interactively. | 2696 Fourth arg INTERACTIVE if non-nil says function can be called interactively. |
2730 Fifth arg TYPE indicates the type of the object: | 2697 Fifth arg TYPE indicates the type of the object: |
2733 `macro' or t says FUNCTION is really a macro. | 2700 `macro' or t says FUNCTION is really a macro. |
2734 Third through fifth args give info about the real definition. | 2701 Third through fifth args give info about the real definition. |
2735 They default to nil. | 2702 They default to nil. |
2736 If FUNCTION is already defined other than as an autoload, | 2703 If FUNCTION is already defined other than as an autoload, |
2737 this does nothing and returns nil. | 2704 this does nothing and returns nil. |
2738 */ ) | 2705 */ |
2739 (function, file, docstring, interactive, type) | 2706 (function, file, docstring, interactive, type)) |
2740 Lisp_Object function, file, docstring, interactive, type; | |
2741 { | 2707 { |
2742 /* This function can GC */ | 2708 /* This function can GC */ |
2743 CHECK_SYMBOL (function); | 2709 CHECK_SYMBOL (function); |
2744 CHECK_STRING (file); | 2710 CHECK_STRING (file); |
2745 | 2711 |
2863 in_warnings = 0; | 2829 in_warnings = 0; |
2864 return Qnil; | 2830 return Qnil; |
2865 } | 2831 } |
2866 | 2832 |
2867 | 2833 |
2868 DEFUN ("eval", Feval, Seval, 1, 1, 0 /* | 2834 DEFUN ("eval", Feval, 1, 1, 0, /* |
2869 Evaluate FORM and return its value. | 2835 Evaluate FORM and return its value. |
2870 */ ) | 2836 */ |
2871 (form) | 2837 (form)) |
2872 Lisp_Object form; | |
2873 { | 2838 { |
2874 /* This function can GC */ | 2839 /* This function can GC */ |
2875 Lisp_Object fun, val, original_fun, original_args; | 2840 Lisp_Object fun, val, original_fun, original_args; |
2876 int nargs; | 2841 int nargs; |
2877 struct backtrace backtrace; | 2842 struct backtrace backtrace; |
3241 val = do_debug_on_exit (val); | 3206 val = do_debug_on_exit (val); |
3242 backtrace_list = backtrace.next; | 3207 backtrace_list = backtrace.next; |
3243 return val; | 3208 return val; |
3244 } | 3209 } |
3245 | 3210 |
3246 DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0 /* | 3211 DEFUN ("funcall", Ffuncall, 1, MANY, 0, /* |
3247 Call first argument as a function, passing remaining arguments to it. | 3212 Call first argument as a function, passing remaining arguments to it. |
3248 Thus, (funcall 'cons 'x 'y) returns (x . y). | 3213 Thus, (funcall 'cons 'x 'y) returns (x . y). |
3249 */ ) | 3214 */ |
3250 (nargs, args) | 3215 (int nargs, Lisp_Object *args)) |
3251 int nargs; | |
3252 Lisp_Object *args; | |
3253 { | 3216 { |
3254 return funcall_recording_as (args[0], nargs, args); | 3217 return funcall_recording_as (args[0], nargs, args); |
3255 } | 3218 } |
3256 | 3219 |
3257 DEFUN ("function-min-args", Ffunction_min_args, Sfunction_min_args, | 3220 DEFUN ("function-min-args", Ffunction_min_args, 1, 1, 0, /* |
3258 1, 1, 0 /* | |
3259 Return the number of arguments a function may be called with. The | 3221 Return the number of arguments a function may be called with. The |
3260 function may be any form that can be passed to `funcall', any special | 3222 function may be any form that can be passed to `funcall', any special |
3261 form, or any macro. | 3223 form, or any macro. |
3262 */ ) | 3224 */ |
3263 (function) | 3225 (function)) |
3264 Lisp_Object function; | |
3265 { | 3226 { |
3266 Lisp_Object orig_function = function; | 3227 Lisp_Object orig_function = function; |
3267 Lisp_Object arglist; | 3228 Lisp_Object arglist; |
3268 int argcount; | 3229 int argcount; |
3269 | 3230 |
3316 } | 3277 } |
3317 | 3278 |
3318 return make_int (argcount); | 3279 return make_int (argcount); |
3319 } | 3280 } |
3320 | 3281 |
3321 DEFUN ("function-max-args", Ffunction_max_args, Sfunction_max_args, | 3282 DEFUN ("function-max-args", Ffunction_max_args, 1, 1, 0, /* |
3322 1, 1, 0 /* | |
3323 Return the number of arguments a function may be called with. If the | 3283 Return the number of arguments a function may be called with. If the |
3324 function takes an arbitrary number of arguments or is a built-in | 3284 function takes an arbitrary number of arguments or is a built-in |
3325 special form, nil is returned. The function may be any form that can | 3285 special form, nil is returned. The function may be any form that can |
3326 be passed to `funcall', any special form, or any macro. | 3286 be passed to `funcall', any special form, or any macro. |
3327 */ ) | 3287 */ |
3328 (function) | 3288 (function)) |
3329 Lisp_Object function; | |
3330 { | 3289 { |
3331 Lisp_Object orig_function = function; | 3290 Lisp_Object orig_function = function; |
3332 Lisp_Object arglist; | 3291 Lisp_Object arglist; |
3333 int argcount; | 3292 int argcount; |
3334 | 3293 |
3386 | 3345 |
3387 return make_int (argcount); | 3346 return make_int (argcount); |
3388 } | 3347 } |
3389 | 3348 |
3390 | 3349 |
3391 DEFUN ("apply", Fapply, Sapply, 2, MANY, 0 /* | 3350 DEFUN ("apply", Fapply, 2, MANY, 0, /* |
3392 Call FUNCTION with our remaining args, using our last arg as list of args. | 3351 Call FUNCTION with our remaining args, using our last arg as list of args. |
3393 Thus, (apply '+ 1 2 '(3 4)) returns 10. | 3352 Thus, (apply '+ 1 2 '(3 4)) returns 10. |
3394 */ ) | 3353 */ |
3395 (nargs, args) | 3354 (int nargs, Lisp_Object *args)) |
3396 int nargs; | |
3397 Lisp_Object *args; | |
3398 { | 3355 { |
3399 /* This function can GC */ | 3356 /* This function can GC */ |
3400 Lisp_Object fun = args[0]; | 3357 Lisp_Object fun = args[0]; |
3401 Lisp_Object spread_arg = args [nargs - 1]; | 3358 Lisp_Object spread_arg = args [nargs - 1]; |
3402 int numargs; | 3359 int numargs; |
3636 make_int (b->maxdepth)); | 3593 make_int (b->maxdepth)); |
3637 } | 3594 } |
3638 return unbind_to (speccount, val); | 3595 return unbind_to (speccount, val); |
3639 } | 3596 } |
3640 | 3597 |
3641 DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, | 3598 DEFUN ("fetch-bytecode", Ffetch_bytecode, 1, 1, 0, /* |
3642 1, 1, 0 /* | |
3643 If byte-compiled OBJECT is lazy-loaded, fetch it now. | 3599 If byte-compiled OBJECT is lazy-loaded, fetch it now. |
3644 */ ) | 3600 */ |
3645 (object) | 3601 (object)) |
3646 Lisp_Object object; | |
3647 { | 3602 { |
3648 Lisp_Object tem; | 3603 Lisp_Object tem; |
3649 | 3604 |
3650 if (COMPILED_FUNCTIONP (object) | 3605 if (COMPILED_FUNCTIONP (object) |
3651 && CONSP (XCOMPILED_FUNCTION (object)->bytecodes)) | 3606 && CONSP (XCOMPILED_FUNCTION (object)->bytecodes)) |
3664 | 3619 |
3665 /**********************************************************************/ | 3620 /**********************************************************************/ |
3666 /* Run hook variables in various ways. */ | 3621 /* Run hook variables in various ways. */ |
3667 /**********************************************************************/ | 3622 /**********************************************************************/ |
3668 | 3623 |
3669 DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 1, MANY, 0 /* | 3624 DEFUN ("run-hooks", Frun_hooks, 1, MANY, 0, /* |
3670 Run each hook in HOOKS. Major mode functions use this. | 3625 Run each hook in HOOKS. Major mode functions use this. |
3671 Each argument should be a symbol, a hook variable. | 3626 Each argument should be a symbol, a hook variable. |
3672 These symbols are processed in the order specified. | 3627 These symbols are processed in the order specified. |
3673 If a hook symbol has a non-nil value, that value may be a function | 3628 If a hook symbol has a non-nil value, that value may be a function |
3674 or a list of functions to be called to run the hook. | 3629 or a list of functions to be called to run the hook. |
3675 If the value is a function, it is called with no arguments. | 3630 If the value is a function, it is called with no arguments. |
3676 If it is a list, the elements are called, in order, with no arguments. | 3631 If it is a list, the elements are called, in order, with no arguments. |
3677 | 3632 |
3678 To make a hook variable buffer-local, use `make-local-hook', | 3633 To make a hook variable buffer-local, use `make-local-hook', |
3679 not `make-local-variable'. | 3634 not `make-local-variable'. |
3680 */ ) | 3635 */ |
3681 (nargs, args) | 3636 (int nargs, Lisp_Object *args)) |
3682 int nargs; | |
3683 Lisp_Object *args; | |
3684 { | 3637 { |
3685 Lisp_Object hook[1]; | 3638 Lisp_Object hook[1]; |
3686 REGISTER int i; | 3639 REGISTER int i; |
3687 | 3640 |
3688 for (i = 0; i < nargs; i++) | 3641 for (i = 0; i < nargs; i++) |
3692 } | 3645 } |
3693 | 3646 |
3694 return Qnil; | 3647 return Qnil; |
3695 } | 3648 } |
3696 | 3649 |
3697 DEFUN ("run-hook-with-args", | 3650 DEFUN ("run-hook-with-args", Frun_hook_with_args, 1, MANY, 0, /* |
3698 Frun_hook_with_args, Srun_hook_with_args, 1, MANY, 0 /* | |
3699 Run HOOK with the specified arguments ARGS. | 3651 Run HOOK with the specified arguments ARGS. |
3700 HOOK should be a symbol, a hook variable. If HOOK has a non-nil | 3652 HOOK should be a symbol, a hook variable. If HOOK has a non-nil |
3701 value, that value may be a function or a list of functions to be | 3653 value, that value may be a function or a list of functions to be |
3702 called to run the hook. If the value is a function, it is called with | 3654 called to run the hook. If the value is a function, it is called with |
3703 the given arguments and its return value is returned. If it is a list | 3655 the given arguments and its return value is returned. If it is a list |
3706 It is best not to depend on the value return by `run-hook-with-args', | 3658 It is best not to depend on the value return by `run-hook-with-args', |
3707 as that may change. | 3659 as that may change. |
3708 | 3660 |
3709 To make a hook variable buffer-local, use `make-local-hook', | 3661 To make a hook variable buffer-local, use `make-local-hook', |
3710 not `make-local-variable'. | 3662 not `make-local-variable'. |
3711 */ ) | 3663 */ |
3712 (nargs, args) | 3664 (int nargs, Lisp_Object *args)) |
3713 int nargs; | |
3714 Lisp_Object *args; | |
3715 { | 3665 { |
3716 return run_hook_with_args (nargs, args, RUN_HOOKS_TO_COMPLETION); | 3666 return run_hook_with_args (nargs, args, RUN_HOOKS_TO_COMPLETION); |
3717 } | 3667 } |
3718 | 3668 |
3719 DEFUN ("run-hook-with-args-until-success", | 3669 DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, 1, MANY, 0, /* |
3720 Frun_hook_with_args_until_success, Srun_hook_with_args_until_success, | |
3721 1, MANY, 0 /* | |
3722 Run HOOK with the specified arguments ARGS. | 3670 Run HOOK with the specified arguments ARGS. |
3723 HOOK should be a symbol, a hook variable. Its value should | 3671 HOOK should be a symbol, a hook variable. Its value should |
3724 be a list of functions. We call those functions, one by one, | 3672 be a list of functions. We call those functions, one by one, |
3725 passing arguments ARGS to each of them, until one of them | 3673 passing arguments ARGS to each of them, until one of them |
3726 returns a non-nil value. Then we return that value. | 3674 returns a non-nil value. Then we return that value. |
3727 If all the functions return nil, we return nil. | 3675 If all the functions return nil, we return nil. |
3728 | 3676 |
3729 To make a hook variable buffer-local, use `make-local-hook', | 3677 To make a hook variable buffer-local, use `make-local-hook', |
3730 not `make-local-variable'. | 3678 not `make-local-variable'. |
3731 */ ) | 3679 */ |
3732 (nargs, args) | 3680 (int nargs, Lisp_Object *args)) |
3733 int nargs; | |
3734 Lisp_Object *args; | |
3735 { | 3681 { |
3736 return run_hook_with_args (nargs, args, RUN_HOOKS_UNTIL_SUCCESS); | 3682 return run_hook_with_args (nargs, args, RUN_HOOKS_UNTIL_SUCCESS); |
3737 } | 3683 } |
3738 | 3684 |
3739 DEFUN ("run-hook-with-args-until-failure", | 3685 DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, 1, MANY, 0, /* |
3740 Frun_hook_with_args_until_failure, Srun_hook_with_args_until_failure, | |
3741 1, MANY, 0 /* | |
3742 Run HOOK with the specified arguments ARGS. | 3686 Run HOOK with the specified arguments ARGS. |
3743 HOOK should be a symbol, a hook variable. Its value should | 3687 HOOK should be a symbol, a hook variable. Its value should |
3744 be a list of functions. We call those functions, one by one, | 3688 be a list of functions. We call those functions, one by one, |
3745 passing arguments ARGS to each of them, until one of them | 3689 passing arguments ARGS to each of them, until one of them |
3746 returns nil. Then we return nil. | 3690 returns nil. Then we return nil. |
3747 If all the functions return non-nil, we return non-nil. | 3691 If all the functions return non-nil, we return non-nil. |
3748 | 3692 |
3749 To make a hook variable buffer-local, use `make-local-hook', | 3693 To make a hook variable buffer-local, use `make-local-hook', |
3750 not `make-local-variable'. | 3694 not `make-local-variable'. |
3751 */ ) | 3695 */ |
3752 (nargs, args) | 3696 (int nargs, Lisp_Object *args)) |
3753 int nargs; | |
3754 Lisp_Object *args; | |
3755 { | 3697 { |
3756 return run_hook_with_args (nargs, args, RUN_HOOKS_UNTIL_FAILURE); | 3698 return run_hook_with_args (nargs, args, RUN_HOOKS_UNTIL_FAILURE); |
3757 } | 3699 } |
3758 | 3700 |
3759 /* ARGS[0] should be a hook symbol. | 3701 /* ARGS[0] should be a hook symbol. |
4872 | 4814 |
4873 /**********************************************************************/ | 4815 /**********************************************************************/ |
4874 /* Backtraces */ | 4816 /* Backtraces */ |
4875 /**********************************************************************/ | 4817 /**********************************************************************/ |
4876 | 4818 |
4877 DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0 /* | 4819 DEFUN ("backtrace-debug", Fbacktrace_debug, 2, 2, 0, /* |
4878 Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG. | 4820 Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG. |
4879 The debugger is entered when that frame exits, if the flag is non-nil. | 4821 The debugger is entered when that frame exits, if the flag is non-nil. |
4880 */ ) | 4822 */ |
4881 (level, flag) | 4823 (level, flag)) |
4882 Lisp_Object level, flag; | |
4883 { | 4824 { |
4884 REGISTER struct backtrace *backlist = backtrace_list; | 4825 REGISTER struct backtrace *backlist = backtrace_list; |
4885 REGISTER int i; | 4826 REGISTER int i; |
4886 | 4827 |
4887 CHECK_INT (level); | 4828 CHECK_INT (level); |
4921 } | 4862 } |
4922 } | 4863 } |
4923 if (printing_bindings) write_c_string (")\n", stream); | 4864 if (printing_bindings) write_c_string (")\n", stream); |
4924 } | 4865 } |
4925 | 4866 |
4926 DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 2, "" /* | 4867 DEFUN ("backtrace", Fbacktrace, 0, 2, "", /* |
4927 Print a trace of Lisp function calls currently active. | 4868 Print a trace of Lisp function calls currently active. |
4928 Option arg STREAM specifies the output stream to send the backtrace to, | 4869 Option arg STREAM specifies the output stream to send the backtrace to, |
4929 and defaults to the value of `standard-output'. Optional second arg | 4870 and defaults to the value of `standard-output'. Optional second arg |
4930 DETAILED means show places where currently active variable bindings, | 4871 DETAILED means show places where currently active variable bindings, |
4931 catches, condition-cases, and unwind-protects were made as well as | 4872 catches, condition-cases, and unwind-protects were made as well as |
4932 function calls. | 4873 function calls. |
4933 */ ) | 4874 */ |
4934 (stream, detailed) | 4875 (stream, detailed)) |
4935 Lisp_Object stream, detailed; | |
4936 { | 4876 { |
4937 struct backtrace *backlist = backtrace_list; | 4877 struct backtrace *backlist = backtrace_list; |
4938 struct catchtag *catches = catchlist; | 4878 struct catchtag *catches = catchlist; |
4939 int speccount = specpdl_depth_counter; | 4879 int speccount = specpdl_depth_counter; |
4940 | 4880 |
5048 Vinhibit_quit = oiq; | 4988 Vinhibit_quit = oiq; |
5049 return Qnil; | 4989 return Qnil; |
5050 } | 4990 } |
5051 | 4991 |
5052 | 4992 |
5053 DEFUN ("backtrace-frame", Fbacktrace_frame, Sbacktrace_frame, 1, 1, "" /* | 4993 DEFUN ("backtrace-frame", Fbacktrace_frame, 1, 1, "", /* |
5054 Return the function and arguments N frames up from current execution point. | 4994 Return the function and arguments N frames up from current execution point. |
5055 If that frame has not evaluated the arguments yet (or is a special form), | 4995 If that frame has not evaluated the arguments yet (or is a special form), |
5056 the value is (nil FUNCTION ARG-FORMS...). | 4996 the value is (nil FUNCTION ARG-FORMS...). |
5057 If that frame has evaluated its arguments and called its function already, | 4997 If that frame has evaluated its arguments and called its function already, |
5058 the value is (t FUNCTION ARG-VALUES...). | 4998 the value is (t FUNCTION ARG-VALUES...). |
5059 A &rest arg is represented as the tail of the list ARG-VALUES. | 4999 A &rest arg is represented as the tail of the list ARG-VALUES. |
5060 FUNCTION is whatever was supplied as car of evaluated list, | 5000 FUNCTION is whatever was supplied as car of evaluated list, |
5061 or a lambda expression for macro calls. | 5001 or a lambda expression for macro calls. |
5062 If N is more than the number of frames, the value is nil. | 5002 If N is more than the number of frames, the value is nil. |
5063 */ ) | 5003 */ |
5064 (nframes) | 5004 (nframes)) |
5065 Lisp_Object nframes; | |
5066 { | 5005 { |
5067 REGISTER struct backtrace *backlist = backtrace_list; | 5006 REGISTER struct backtrace *backlist = backtrace_list; |
5068 REGISTER int i; | 5007 REGISTER int i; |
5069 Lisp_Object tem; | 5008 Lisp_Object tem; |
5070 | 5009 |
5158 defsymbol (&Qprogn, "progn"); | 5097 defsymbol (&Qprogn, "progn"); |
5159 defsymbol (&Qvalues, "values"); | 5098 defsymbol (&Qvalues, "values"); |
5160 defsymbol (&Qdisplay_warning, "display-warning"); | 5099 defsymbol (&Qdisplay_warning, "display-warning"); |
5161 defsymbol (&Qrun_hooks, "run-hooks"); | 5100 defsymbol (&Qrun_hooks, "run-hooks"); |
5162 | 5101 |
5163 defsubr (&Sor); | 5102 DEFSUBR (For); |
5164 defsubr (&Sand); | 5103 DEFSUBR (Fand); |
5165 defsubr (&Sif); | 5104 DEFSUBR (Fif); |
5166 defsubr (&Scond); | 5105 DEFSUBR (Fcond); |
5167 defsubr (&Sprogn); | 5106 DEFSUBR (Fprogn); |
5168 defsubr (&Sprog1); | 5107 DEFSUBR (Fprog1); |
5169 defsubr (&Sprog2); | 5108 DEFSUBR (Fprog2); |
5170 defsubr (&Ssetq); | 5109 DEFSUBR (Fsetq); |
5171 defsubr (&Squote); | 5110 DEFSUBR (Fquote); |
5172 defsubr (&Sfunction); | 5111 DEFSUBR (Ffunction); |
5173 defsubr (&Sdefun); | 5112 DEFSUBR (Fdefun); |
5174 defsubr (&Sdefmacro); | 5113 DEFSUBR (Fdefmacro); |
5175 defsubr (&Sdefvar); | 5114 DEFSUBR (Fdefvar); |
5176 defsubr (&Sdefconst); | 5115 DEFSUBR (Fdefconst); |
5177 defsubr (&Suser_variable_p); | 5116 DEFSUBR (Fuser_variable_p); |
5178 defsubr (&Slet); | 5117 DEFSUBR (Flet); |
5179 defsubr (&SletX); | 5118 DEFSUBR (FletX); |
5180 defsubr (&Swhile); | 5119 DEFSUBR (Fwhile); |
5181 defsubr (&Smacroexpand_internal); | 5120 DEFSUBR (Fmacroexpand_internal); |
5182 defsubr (&Scatch); | 5121 DEFSUBR (Fcatch); |
5183 defsubr (&Sthrow); | 5122 DEFSUBR (Fthrow); |
5184 defsubr (&Sunwind_protect); | 5123 DEFSUBR (Funwind_protect); |
5185 defsubr (&Scondition_case); | 5124 DEFSUBR (Fcondition_case); |
5186 defsubr (&Scall_with_condition_handler); | 5125 DEFSUBR (Fcall_with_condition_handler); |
5187 defsubr (&Ssignal); | 5126 DEFSUBR (Fsignal); |
5188 defsubr (&Sinteractive_p); | 5127 DEFSUBR (Finteractive_p); |
5189 defsubr (&Scommandp); | 5128 DEFSUBR (Fcommandp); |
5190 defsubr (&Scommand_execute); | 5129 DEFSUBR (Fcommand_execute); |
5191 defsubr (&Sautoload); | 5130 DEFSUBR (Fautoload); |
5192 defsubr (&Seval); | 5131 DEFSUBR (Feval); |
5193 defsubr (&Sapply); | 5132 DEFSUBR (Fapply); |
5194 defsubr (&Sfuncall); | 5133 DEFSUBR (Ffuncall); |
5195 defsubr (&Sfunction_min_args); | 5134 DEFSUBR (Ffunction_min_args); |
5196 defsubr (&Sfunction_max_args); | 5135 DEFSUBR (Ffunction_max_args); |
5197 defsubr (&Srun_hooks); | 5136 DEFSUBR (Frun_hooks); |
5198 defsubr (&Srun_hook_with_args); | 5137 DEFSUBR (Frun_hook_with_args); |
5199 defsubr (&Srun_hook_with_args_until_success); | 5138 DEFSUBR (Frun_hook_with_args_until_success); |
5200 defsubr (&Srun_hook_with_args_until_failure); | 5139 DEFSUBR (Frun_hook_with_args_until_failure); |
5201 defsubr (&Sfetch_bytecode); | 5140 DEFSUBR (Ffetch_bytecode); |
5202 defsubr (&Sbacktrace_debug); | 5141 DEFSUBR (Fbacktrace_debug); |
5203 defsubr (&Sbacktrace); | 5142 DEFSUBR (Fbacktrace); |
5204 defsubr (&Sbacktrace_frame); | 5143 DEFSUBR (Fbacktrace_frame); |
5205 } | 5144 } |
5206 | 5145 |
5207 void | 5146 void |
5208 reinit_eval (void) | 5147 reinit_eval (void) |
5209 { | 5148 { |