Mercurial > emacs
comparison src/eval.c @ 109351:c8a969d13eda
merge trunk
| author | Kenichi Handa <handa@etlken> |
|---|---|
| date | Fri, 09 Jul 2010 15:55:27 +0900 |
| parents | 8cfee7d2955f |
| children | 3200fb11db9d |
comparison
equal
deleted
inserted
replaced
| 109350:c11d07f3d731 | 109351:c8a969d13eda |
|---|---|
| 294 DEFUN ("or", For, Sor, 0, UNEVALLED, 0, | 294 DEFUN ("or", For, Sor, 0, UNEVALLED, 0, |
| 295 doc: /* Eval args until one of them yields non-nil, then return that value. | 295 doc: /* Eval args until one of them yields non-nil, then return that value. |
| 296 The remaining args are not evalled at all. | 296 The remaining args are not evalled at all. |
| 297 If all args return nil, return nil. | 297 If all args return nil, return nil. |
| 298 usage: (or CONDITIONS...) */) | 298 usage: (or CONDITIONS...) */) |
| 299 (args) | 299 (Lisp_Object args) |
| 300 Lisp_Object args; | |
| 301 { | 300 { |
| 302 register Lisp_Object val = Qnil; | 301 register Lisp_Object val = Qnil; |
| 303 struct gcpro gcpro1; | 302 struct gcpro gcpro1; |
| 304 | 303 |
| 305 GCPRO1 (args); | 304 GCPRO1 (args); |
| 319 DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0, | 318 DEFUN ("and", Fand, Sand, 0, UNEVALLED, 0, |
| 320 doc: /* Eval args until one of them yields nil, then return nil. | 319 doc: /* Eval args until one of them yields nil, then return nil. |
| 321 The remaining args are not evalled at all. | 320 The remaining args are not evalled at all. |
| 322 If no arg yields nil, return the last arg's value. | 321 If no arg yields nil, return the last arg's value. |
| 323 usage: (and CONDITIONS...) */) | 322 usage: (and CONDITIONS...) */) |
| 324 (args) | 323 (Lisp_Object args) |
| 325 Lisp_Object args; | |
| 326 { | 324 { |
| 327 register Lisp_Object val = Qt; | 325 register Lisp_Object val = Qt; |
| 328 struct gcpro gcpro1; | 326 struct gcpro gcpro1; |
| 329 | 327 |
| 330 GCPRO1 (args); | 328 GCPRO1 (args); |
| 345 doc: /* If COND yields non-nil, do THEN, else do ELSE... | 343 doc: /* If COND yields non-nil, do THEN, else do ELSE... |
| 346 Returns the value of THEN or the value of the last of the ELSE's. | 344 Returns the value of THEN or the value of the last of the ELSE's. |
| 347 THEN must be one expression, but ELSE... can be zero or more expressions. | 345 THEN must be one expression, but ELSE... can be zero or more expressions. |
| 348 If COND yields nil, and there are no ELSE's, the value is nil. | 346 If COND yields nil, and there are no ELSE's, the value is nil. |
| 349 usage: (if COND THEN ELSE...) */) | 347 usage: (if COND THEN ELSE...) */) |
| 350 (args) | 348 (Lisp_Object args) |
| 351 Lisp_Object args; | |
| 352 { | 349 { |
| 353 register Lisp_Object cond; | 350 register Lisp_Object cond; |
| 354 struct gcpro gcpro1; | 351 struct gcpro gcpro1; |
| 355 | 352 |
| 356 GCPRO1 (args); | 353 GCPRO1 (args); |
| 370 value is the value of the cond-form. | 367 value is the value of the cond-form. |
| 371 If no clause succeeds, cond returns nil. | 368 If no clause succeeds, cond returns nil. |
| 372 If a clause has one element, as in (CONDITION), | 369 If a clause has one element, as in (CONDITION), |
| 373 CONDITION's value if non-nil is returned from the cond-form. | 370 CONDITION's value if non-nil is returned from the cond-form. |
| 374 usage: (cond CLAUSES...) */) | 371 usage: (cond CLAUSES...) */) |
| 375 (args) | 372 (Lisp_Object args) |
| 376 Lisp_Object args; | |
| 377 { | 373 { |
| 378 register Lisp_Object clause, val; | 374 register Lisp_Object clause, val; |
| 379 struct gcpro gcpro1; | 375 struct gcpro gcpro1; |
| 380 | 376 |
| 381 val = Qnil; | 377 val = Qnil; |
| 398 } | 394 } |
| 399 | 395 |
| 400 DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, | 396 DEFUN ("progn", Fprogn, Sprogn, 0, UNEVALLED, 0, |
| 401 doc: /* Eval BODY forms sequentially and return value of last one. | 397 doc: /* Eval BODY forms sequentially and return value of last one. |
| 402 usage: (progn BODY...) */) | 398 usage: (progn BODY...) */) |
| 403 (args) | 399 (Lisp_Object args) |
| 404 Lisp_Object args; | |
| 405 { | 400 { |
| 406 register Lisp_Object val = Qnil; | 401 register Lisp_Object val = Qnil; |
| 407 struct gcpro gcpro1; | 402 struct gcpro gcpro1; |
| 408 | 403 |
| 409 GCPRO1 (args); | 404 GCPRO1 (args); |
| 421 DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0, | 416 DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0, |
| 422 doc: /* Eval FIRST and BODY sequentially; return value from FIRST. | 417 doc: /* Eval FIRST and BODY sequentially; return value from FIRST. |
| 423 The value of FIRST is saved during the evaluation of the remaining args, | 418 The value of FIRST is saved during the evaluation of the remaining args, |
| 424 whose values are discarded. | 419 whose values are discarded. |
| 425 usage: (prog1 FIRST BODY...) */) | 420 usage: (prog1 FIRST BODY...) */) |
| 426 (args) | 421 (Lisp_Object args) |
| 427 Lisp_Object args; | |
| 428 { | 422 { |
| 429 Lisp_Object val; | 423 Lisp_Object val; |
| 430 register Lisp_Object args_left; | 424 register Lisp_Object args_left; |
| 431 struct gcpro gcpro1, gcpro2; | 425 struct gcpro gcpro1, gcpro2; |
| 432 register int argnum = 0; | 426 register int argnum = 0; |
| 455 DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0, | 449 DEFUN ("prog2", Fprog2, Sprog2, 2, UNEVALLED, 0, |
| 456 doc: /* Eval FORM1, FORM2 and BODY sequentially; return value from FORM2. | 450 doc: /* Eval FORM1, FORM2 and BODY sequentially; return value from FORM2. |
| 457 The value of FORM2 is saved during the evaluation of the | 451 The value of FORM2 is saved during the evaluation of the |
| 458 remaining args, whose values are discarded. | 452 remaining args, whose values are discarded. |
| 459 usage: (prog2 FORM1 FORM2 BODY...) */) | 453 usage: (prog2 FORM1 FORM2 BODY...) */) |
| 460 (args) | 454 (Lisp_Object args) |
| 461 Lisp_Object args; | |
| 462 { | 455 { |
| 463 Lisp_Object val; | 456 Lisp_Object val; |
| 464 register Lisp_Object args_left; | 457 register Lisp_Object args_left; |
| 465 struct gcpro gcpro1, gcpro2; | 458 struct gcpro gcpro1, gcpro2; |
| 466 register int argnum = -1; | 459 register int argnum = -1; |
| 495 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. | 488 Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. |
| 496 The second VAL is not computed until after the first SYM is set, and so on; | 489 The second VAL is not computed until after the first SYM is set, and so on; |
| 497 each VAL can use the new value of variables set earlier in the `setq'. | 490 each VAL can use the new value of variables set earlier in the `setq'. |
| 498 The return value of the `setq' form is the value of the last VAL. | 491 The return value of the `setq' form is the value of the last VAL. |
| 499 usage: (setq [SYM VAL]...) */) | 492 usage: (setq [SYM VAL]...) */) |
| 500 (args) | 493 (Lisp_Object args) |
| 501 Lisp_Object args; | |
| 502 { | 494 { |
| 503 register Lisp_Object args_left; | 495 register Lisp_Object args_left; |
| 504 register Lisp_Object val, sym; | 496 register Lisp_Object val, sym; |
| 505 struct gcpro gcpro1; | 497 struct gcpro gcpro1; |
| 506 | 498 |
| 524 } | 516 } |
| 525 | 517 |
| 526 DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0, | 518 DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0, |
| 527 doc: /* Return the argument, without evaluating it. `(quote x)' yields `x'. | 519 doc: /* Return the argument, without evaluating it. `(quote x)' yields `x'. |
| 528 usage: (quote ARG) */) | 520 usage: (quote ARG) */) |
| 529 (args) | 521 (Lisp_Object args) |
| 530 Lisp_Object args; | |
| 531 { | 522 { |
| 532 if (!NILP (Fcdr (args))) | 523 if (!NILP (Fcdr (args))) |
| 533 xsignal2 (Qwrong_number_of_arguments, Qquote, Flength (args)); | 524 xsignal2 (Qwrong_number_of_arguments, Qquote, Flength (args)); |
| 534 return Fcar (args); | 525 return Fcar (args); |
| 535 } | 526 } |
| 537 DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0, | 528 DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0, |
| 538 doc: /* Like `quote', but preferred for objects which are functions. | 529 doc: /* Like `quote', but preferred for objects which are functions. |
| 539 In byte compilation, `function' causes its argument to be compiled. | 530 In byte compilation, `function' causes its argument to be compiled. |
| 540 `quote' cannot do that. | 531 `quote' cannot do that. |
| 541 usage: (function ARG) */) | 532 usage: (function ARG) */) |
| 542 (args) | 533 (Lisp_Object args) |
| 543 Lisp_Object args; | |
| 544 { | 534 { |
| 545 if (!NILP (Fcdr (args))) | 535 if (!NILP (Fcdr (args))) |
| 546 xsignal2 (Qwrong_number_of_arguments, Qfunction, Flength (args)); | 536 xsignal2 (Qwrong_number_of_arguments, Qfunction, Flength (args)); |
| 547 return Fcar (args); | 537 return Fcar (args); |
| 548 } | 538 } |
| 563 | 553 |
| 564 To test whether your function was called with `call-interactively', | 554 To test whether your function was called with `call-interactively', |
| 565 either (i) add an extra optional argument and give it an `interactive' | 555 either (i) add an extra optional argument and give it an `interactive' |
| 566 spec that specifies non-nil unconditionally (such as \"p\"); or (ii) | 556 spec that specifies non-nil unconditionally (such as \"p\"); or (ii) |
| 567 use `called-interactively-p'. */) | 557 use `called-interactively-p'. */) |
| 568 () | 558 (void) |
| 569 { | 559 { |
| 570 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil; | 560 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil; |
| 571 } | 561 } |
| 572 | 562 |
| 573 | 563 |
| 589 This function is meant for implementing advice and other | 579 This function is meant for implementing advice and other |
| 590 function-modifying features. Instead of using this, it is sometimes | 580 function-modifying features. Instead of using this, it is sometimes |
| 591 cleaner to give your function an extra optional argument whose | 581 cleaner to give your function an extra optional argument whose |
| 592 `interactive' spec specifies non-nil unconditionally (\"p\" is a good | 582 `interactive' spec specifies non-nil unconditionally (\"p\" is a good |
| 593 way to do this), or via (not (or executing-kbd-macro noninteractive)). */) | 583 way to do this), or via (not (or executing-kbd-macro noninteractive)). */) |
| 594 (kind) | 584 (Lisp_Object kind) |
| 595 Lisp_Object kind; | |
| 596 { | 585 { |
| 597 return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) | 586 return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) |
| 598 && interactive_p (1)) ? Qt : Qnil; | 587 && interactive_p (1)) ? Qt : Qnil; |
| 599 } | 588 } |
| 600 | 589 |
| 651 DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0, | 640 DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0, |
| 652 doc: /* Define NAME as a function. | 641 doc: /* Define NAME as a function. |
| 653 The definition is (lambda ARGLIST [DOCSTRING] BODY...). | 642 The definition is (lambda ARGLIST [DOCSTRING] BODY...). |
| 654 See also the function `interactive'. | 643 See also the function `interactive'. |
| 655 usage: (defun NAME ARGLIST [DOCSTRING] BODY...) */) | 644 usage: (defun NAME ARGLIST [DOCSTRING] BODY...) */) |
| 656 (args) | 645 (Lisp_Object args) |
| 657 Lisp_Object args; | |
| 658 { | 646 { |
| 659 register Lisp_Object fn_name; | 647 register Lisp_Object fn_name; |
| 660 register Lisp_Object defn; | 648 register Lisp_Object defn; |
| 661 | 649 |
| 662 fn_name = Fcar (args); | 650 fn_name = Fcar (args); |
| 695 | 683 |
| 696 (doc-string ELT) | 684 (doc-string ELT) |
| 697 Set NAME's `doc-string-elt' property to ELT. | 685 Set NAME's `doc-string-elt' property to ELT. |
| 698 | 686 |
| 699 usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) | 687 usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) |
| 700 (args) | 688 (Lisp_Object args) |
| 701 Lisp_Object args; | |
| 702 { | 689 { |
| 703 register Lisp_Object fn_name; | 690 register Lisp_Object fn_name; |
| 704 register Lisp_Object defn; | 691 register Lisp_Object defn; |
| 705 Lisp_Object lambda_list, doc, tail; | 692 Lisp_Object lambda_list, doc, tail; |
| 706 | 693 |
| 754 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE, | 741 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE, |
| 755 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is | 742 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is |
| 756 itself an alias. If NEW-ALIAS is bound, and BASE-VARIABLE is not, | 743 itself an alias. If NEW-ALIAS is bound, and BASE-VARIABLE is not, |
| 757 then the value of BASE-VARIABLE is set to that of NEW-ALIAS. | 744 then the value of BASE-VARIABLE is set to that of NEW-ALIAS. |
| 758 The return value is BASE-VARIABLE. */) | 745 The return value is BASE-VARIABLE. */) |
| 759 (new_alias, base_variable, docstring) | 746 (Lisp_Object new_alias, Lisp_Object base_variable, Lisp_Object docstring) |
| 760 Lisp_Object new_alias, base_variable, docstring; | |
| 761 { | 747 { |
| 762 struct Lisp_Symbol *sym; | 748 struct Lisp_Symbol *sym; |
| 763 | 749 |
| 764 CHECK_SYMBOL (new_alias); | 750 CHECK_SYMBOL (new_alias); |
| 765 CHECK_SYMBOL (base_variable); | 751 CHECK_SYMBOL (base_variable); |
| 826 load a file defining variables, with this form or with `defconst' or | 812 load a file defining variables, with this form or with `defconst' or |
| 827 `defcustom', you should always load that file _outside_ any bindings | 813 `defcustom', you should always load that file _outside_ any bindings |
| 828 for these variables. \(`defconst' and `defcustom' behave similarly in | 814 for these variables. \(`defconst' and `defcustom' behave similarly in |
| 829 this respect.) | 815 this respect.) |
| 830 usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 816 usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) |
| 831 (args) | 817 (Lisp_Object args) |
| 832 Lisp_Object args; | |
| 833 { | 818 { |
| 834 register Lisp_Object sym, tem, tail; | 819 register Lisp_Object sym, tem, tail; |
| 835 | 820 |
| 836 sym = Fcar (args); | 821 sym = Fcar (args); |
| 837 tail = Fcdr (args); | 822 tail = Fcdr (args); |
| 899 | 884 |
| 900 If SYMBOL has a local binding, then this form sets the local binding's | 885 If SYMBOL has a local binding, then this form sets the local binding's |
| 901 value. However, you should normally not make local bindings for | 886 value. However, you should normally not make local bindings for |
| 902 variables defined with this form. | 887 variables defined with this form. |
| 903 usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | 888 usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) |
| 904 (args) | 889 (Lisp_Object args) |
| 905 Lisp_Object args; | |
| 906 { | 890 { |
| 907 register Lisp_Object sym, tem; | 891 register Lisp_Object sym, tem; |
| 908 | 892 |
| 909 sym = Fcar (args); | 893 sym = Fcar (args); |
| 910 if (!NILP (Fcdr (Fcdr (Fcdr (args))))) | 894 if (!NILP (Fcdr (Fcdr (Fcdr (args))))) |
| 948 \(2) it is customizable (its property list contains a non-nil value | 932 \(2) it is customizable (its property list contains a non-nil value |
| 949 of `standard-value' or `custom-autoload'), or | 933 of `standard-value' or `custom-autoload'), or |
| 950 \(3) it is an alias for another user variable. | 934 \(3) it is an alias for another user variable. |
| 951 Return nil if VARIABLE is an alias and there is a loop in the | 935 Return nil if VARIABLE is an alias and there is a loop in the |
| 952 chain of symbols. */) | 936 chain of symbols. */) |
| 953 (variable) | 937 (Lisp_Object variable) |
| 954 Lisp_Object variable; | |
| 955 { | 938 { |
| 956 Lisp_Object documentation; | 939 Lisp_Object documentation; |
| 957 | 940 |
| 958 if (!SYMBOLP (variable)) | 941 if (!SYMBOLP (variable)) |
| 959 return Qnil; | 942 return Qnil; |
| 996 The value of the last form in BODY is returned. | 979 The value of the last form in BODY is returned. |
| 997 Each element of VARLIST is a symbol (which is bound to nil) | 980 Each element of VARLIST is a symbol (which is bound to nil) |
| 998 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). | 981 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). |
| 999 Each VALUEFORM can refer to the symbols already bound by this VARLIST. | 982 Each VALUEFORM can refer to the symbols already bound by this VARLIST. |
| 1000 usage: (let* VARLIST BODY...) */) | 983 usage: (let* VARLIST BODY...) */) |
| 1001 (args) | 984 (Lisp_Object args) |
| 1002 Lisp_Object args; | |
| 1003 { | 985 { |
| 1004 Lisp_Object varlist, val, elt; | 986 Lisp_Object varlist, val, elt; |
| 1005 int count = SPECPDL_INDEX (); | 987 int count = SPECPDL_INDEX (); |
| 1006 struct gcpro gcpro1, gcpro2, gcpro3; | 988 struct gcpro gcpro1, gcpro2, gcpro3; |
| 1007 | 989 |
| 1033 The value of the last form in BODY is returned. | 1015 The value of the last form in BODY is returned. |
| 1034 Each element of VARLIST is a symbol (which is bound to nil) | 1016 Each element of VARLIST is a symbol (which is bound to nil) |
| 1035 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). | 1017 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). |
| 1036 All the VALUEFORMs are evalled before any symbols are bound. | 1018 All the VALUEFORMs are evalled before any symbols are bound. |
| 1037 usage: (let VARLIST BODY...) */) | 1019 usage: (let VARLIST BODY...) */) |
| 1038 (args) | 1020 (Lisp_Object args) |
| 1039 Lisp_Object args; | |
| 1040 { | 1021 { |
| 1041 Lisp_Object *temps, tem; | 1022 Lisp_Object *temps, tem; |
| 1042 register Lisp_Object elt, varlist; | 1023 register Lisp_Object elt, varlist; |
| 1043 int count = SPECPDL_INDEX (); | 1024 int count = SPECPDL_INDEX (); |
| 1044 register int argnum; | 1025 register int argnum; |
| 1087 DEFUN ("while", Fwhile, Swhile, 1, UNEVALLED, 0, | 1068 DEFUN ("while", Fwhile, Swhile, 1, UNEVALLED, 0, |
| 1088 doc: /* If TEST yields non-nil, eval BODY... and repeat. | 1069 doc: /* If TEST yields non-nil, eval BODY... and repeat. |
| 1089 The order of execution is thus TEST, BODY, TEST, BODY and so on | 1070 The order of execution is thus TEST, BODY, TEST, BODY and so on |
| 1090 until TEST returns nil. | 1071 until TEST returns nil. |
| 1091 usage: (while TEST BODY...) */) | 1072 usage: (while TEST BODY...) */) |
| 1092 (args) | 1073 (Lisp_Object args) |
| 1093 Lisp_Object args; | |
| 1094 { | 1074 { |
| 1095 Lisp_Object test, body; | 1075 Lisp_Object test, body; |
| 1096 struct gcpro gcpro1, gcpro2; | 1076 struct gcpro gcpro1, gcpro2; |
| 1097 | 1077 |
| 1098 GCPRO2 (test, body); | 1078 GCPRO2 (test, body); |
| 1115 Otherwise, the macro is expanded and the expansion is considered | 1095 Otherwise, the macro is expanded and the expansion is considered |
| 1116 in place of FORM. When a non-macro-call results, it is returned. | 1096 in place of FORM. When a non-macro-call results, it is returned. |
| 1117 | 1097 |
| 1118 The second optional arg ENVIRONMENT specifies an environment of macro | 1098 The second optional arg ENVIRONMENT specifies an environment of macro |
| 1119 definitions to shadow the loaded ones for use in file byte-compilation. */) | 1099 definitions to shadow the loaded ones for use in file byte-compilation. */) |
| 1120 (form, environment) | 1100 (Lisp_Object form, Lisp_Object environment) |
| 1121 Lisp_Object form; | |
| 1122 Lisp_Object environment; | |
| 1123 { | 1101 { |
| 1124 /* With cleanups from Hallvard Furuseth. */ | 1102 /* With cleanups from Hallvard Furuseth. */ |
| 1125 register Lisp_Object expander, sym, def, tem; | 1103 register Lisp_Object expander, sym, def, tem; |
| 1126 | 1104 |
| 1127 while (1) | 1105 while (1) |
| 1195 Then the BODY is executed. | 1173 Then the BODY is executed. |
| 1196 Within BODY, a call to `throw' with the same TAG exits BODY and this `catch'. | 1174 Within BODY, a call to `throw' with the same TAG exits BODY and this `catch'. |
| 1197 If no throw happens, `catch' returns the value of the last BODY form. | 1175 If no throw happens, `catch' returns the value of the last BODY form. |
| 1198 If a throw happens, it specifies the value to return from `catch'. | 1176 If a throw happens, it specifies the value to return from `catch'. |
| 1199 usage: (catch TAG BODY...) */) | 1177 usage: (catch TAG BODY...) */) |
| 1200 (args) | 1178 (Lisp_Object args) |
| 1201 Lisp_Object args; | |
| 1202 { | 1179 { |
| 1203 register Lisp_Object tag; | 1180 register Lisp_Object tag; |
| 1204 struct gcpro gcpro1; | 1181 struct gcpro gcpro1; |
| 1205 | 1182 |
| 1206 GCPRO1 (args); | 1183 GCPRO1 (args); |
| 1309 } | 1286 } |
| 1310 | 1287 |
| 1311 DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, | 1288 DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0, |
| 1312 doc: /* Throw to the catch for TAG and return VALUE from it. | 1289 doc: /* Throw to the catch for TAG and return VALUE from it. |
| 1313 Both TAG and VALUE are evalled. */) | 1290 Both TAG and VALUE are evalled. */) |
| 1314 (tag, value) | 1291 (register Lisp_Object tag, Lisp_Object value) |
| 1315 register Lisp_Object tag, value; | |
| 1316 { | 1292 { |
| 1317 register struct catchtag *c; | 1293 register struct catchtag *c; |
| 1318 | 1294 |
| 1319 if (!NILP (tag)) | 1295 if (!NILP (tag)) |
| 1320 for (c = catchlist; c; c = c->next) | 1296 for (c = catchlist; c; c = c->next) |
| 1330 doc: /* Do BODYFORM, protecting with UNWINDFORMS. | 1306 doc: /* Do BODYFORM, protecting with UNWINDFORMS. |
| 1331 If BODYFORM completes normally, its value is returned | 1307 If BODYFORM completes normally, its value is returned |
| 1332 after executing the UNWINDFORMS. | 1308 after executing the UNWINDFORMS. |
| 1333 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. | 1309 If BODYFORM exits nonlocally, the UNWINDFORMS are executed anyway. |
| 1334 usage: (unwind-protect BODYFORM UNWINDFORMS...) */) | 1310 usage: (unwind-protect BODYFORM UNWINDFORMS...) */) |
| 1335 (args) | 1311 (Lisp_Object args) |
| 1336 Lisp_Object args; | |
| 1337 { | 1312 { |
| 1338 Lisp_Object val; | 1313 Lisp_Object val; |
| 1339 int count = SPECPDL_INDEX (); | 1314 int count = SPECPDL_INDEX (); |
| 1340 | 1315 |
| 1341 record_unwind_protect (Fprogn, Fcdr (args)); | 1316 record_unwind_protect (Fprogn, Fcdr (args)); |
| 1371 Then the value of the last BODY form is returned from the `condition-case' | 1346 Then the value of the last BODY form is returned from the `condition-case' |
| 1372 expression. | 1347 expression. |
| 1373 | 1348 |
| 1374 See also the function `signal' for more info. | 1349 See also the function `signal' for more info. |
| 1375 usage: (condition-case VAR BODYFORM &rest HANDLERS) */) | 1350 usage: (condition-case VAR BODYFORM &rest HANDLERS) */) |
| 1376 (args) | 1351 (Lisp_Object args) |
| 1377 Lisp_Object args; | |
| 1378 { | 1352 { |
| 1379 register Lisp_Object bodyform, handlers; | 1353 register Lisp_Object bodyform, handlers; |
| 1380 volatile Lisp_Object var; | 1354 volatile Lisp_Object var; |
| 1381 | 1355 |
| 1382 var = Fcar (args); | 1356 var = Fcar (args); |
| 1659 DATA should be a list. Its elements are printed as part of the error message. | 1633 DATA should be a list. Its elements are printed as part of the error message. |
| 1660 See Info anchor `(elisp)Definition of signal' for some details on how this | 1634 See Info anchor `(elisp)Definition of signal' for some details on how this |
| 1661 error message is constructed. | 1635 error message is constructed. |
| 1662 If the signal is handled, DATA is made available to the handler. | 1636 If the signal is handled, DATA is made available to the handler. |
| 1663 See also the function `condition-case'. */) | 1637 See also the function `condition-case'. */) |
| 1664 (error_symbol, data) | 1638 (Lisp_Object error_symbol, Lisp_Object data) |
| 1665 Lisp_Object error_symbol, data; | |
| 1666 { | 1639 { |
| 1667 /* When memory is full, ERROR-SYMBOL is nil, | 1640 /* When memory is full, ERROR-SYMBOL is nil, |
| 1668 and DATA is (REAL-ERROR-SYMBOL . REAL-DATA). | 1641 and DATA is (REAL-ERROR-SYMBOL . REAL-DATA). |
| 1669 That is a special case--don't do this in other situations. */ | 1642 That is a special case--don't do this in other situations. */ |
| 1670 register struct handler *allhandlers = handlerlist; | 1643 register struct handler *allhandlers = handlerlist; |
| 2083 | 2056 |
| 2084 Also, a symbol satisfies `commandp' if its function definition does so. | 2057 Also, a symbol satisfies `commandp' if its function definition does so. |
| 2085 | 2058 |
| 2086 If the optional argument FOR-CALL-INTERACTIVELY is non-nil, | 2059 If the optional argument FOR-CALL-INTERACTIVELY is non-nil, |
| 2087 then strings and vectors are not accepted. */) | 2060 then strings and vectors are not accepted. */) |
| 2088 (function, for_call_interactively) | 2061 (Lisp_Object function, Lisp_Object for_call_interactively) |
| 2089 Lisp_Object function, for_call_interactively; | |
| 2090 { | 2062 { |
| 2091 register Lisp_Object fun; | 2063 register Lisp_Object fun; |
| 2092 register Lisp_Object funcar; | 2064 register Lisp_Object funcar; |
| 2093 Lisp_Object if_prop = Qnil; | 2065 Lisp_Object if_prop = Qnil; |
| 2094 | 2066 |
| 2148 `macro' or t says FUNCTION is really a macro. | 2120 `macro' or t says FUNCTION is really a macro. |
| 2149 Third through fifth args give info about the real definition. | 2121 Third through fifth args give info about the real definition. |
| 2150 They default to nil. | 2122 They default to nil. |
| 2151 If FUNCTION is already defined other than as an autoload, | 2123 If FUNCTION is already defined other than as an autoload, |
| 2152 this does nothing and returns nil. */) | 2124 this does nothing and returns nil. */) |
| 2153 (function, file, docstring, interactive, type) | 2125 (Lisp_Object function, Lisp_Object file, Lisp_Object docstring, Lisp_Object interactive, Lisp_Object type) |
| 2154 Lisp_Object function, file, docstring, interactive, type; | |
| 2155 { | 2126 { |
| 2156 CHECK_SYMBOL (function); | 2127 CHECK_SYMBOL (function); |
| 2157 CHECK_STRING (file); | 2128 CHECK_STRING (file); |
| 2158 | 2129 |
| 2159 /* If function is defined and not as an autoload, don't override */ | 2130 /* If function is defined and not as an autoload, don't override */ |
| 2250 } | 2221 } |
| 2251 | 2222 |
| 2252 | 2223 |
| 2253 DEFUN ("eval", Feval, Seval, 1, 1, 0, | 2224 DEFUN ("eval", Feval, Seval, 1, 1, 0, |
| 2254 doc: /* Evaluate FORM and return its value. */) | 2225 doc: /* Evaluate FORM and return its value. */) |
| 2255 (form) | 2226 (Lisp_Object form) |
| 2256 Lisp_Object form; | |
| 2257 { | 2227 { |
| 2258 Lisp_Object fun, val, original_fun, original_args; | 2228 Lisp_Object fun, val, original_fun, original_args; |
| 2259 Lisp_Object funcar; | 2229 Lisp_Object funcar; |
| 2260 struct backtrace backtrace; | 2230 struct backtrace backtrace; |
| 2261 struct gcpro gcpro1, gcpro2, gcpro3; | 2231 struct gcpro gcpro1, gcpro2, gcpro3; |
| 2461 DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, | 2431 DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, |
| 2462 doc: /* Call FUNCTION with our remaining args, using our last arg as list of args. | 2432 doc: /* Call FUNCTION with our remaining args, using our last arg as list of args. |
| 2463 Then return the value FUNCTION returns. | 2433 Then return the value FUNCTION returns. |
| 2464 Thus, (apply '+ 1 2 '(3 4)) returns 10. | 2434 Thus, (apply '+ 1 2 '(3 4)) returns 10. |
| 2465 usage: (apply FUNCTION &rest ARGUMENTS) */) | 2435 usage: (apply FUNCTION &rest ARGUMENTS) */) |
| 2466 (nargs, args) | 2436 (int nargs, Lisp_Object *args) |
| 2467 int nargs; | |
| 2468 Lisp_Object *args; | |
| 2469 { | 2437 { |
| 2470 register int i, numargs; | 2438 register int i, numargs; |
| 2471 register Lisp_Object spread_arg; | 2439 register Lisp_Object spread_arg; |
| 2472 register Lisp_Object *funcall_args; | 2440 register Lisp_Object *funcall_args; |
| 2473 Lisp_Object fun; | 2441 Lisp_Object fun; |
| 2562 hook; they should use `run-mode-hooks' instead. | 2530 hook; they should use `run-mode-hooks' instead. |
| 2563 | 2531 |
| 2564 Do not use `make-local-variable' to make a hook variable buffer-local. | 2532 Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2565 Instead, use `add-hook' and specify t for the LOCAL argument. | 2533 Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2566 usage: (run-hooks &rest HOOKS) */) | 2534 usage: (run-hooks &rest HOOKS) */) |
| 2567 (nargs, args) | 2535 (int nargs, Lisp_Object *args) |
| 2568 int nargs; | |
| 2569 Lisp_Object *args; | |
| 2570 { | 2536 { |
| 2571 Lisp_Object hook[1]; | 2537 Lisp_Object hook[1]; |
| 2572 register int i; | 2538 register int i; |
| 2573 | 2539 |
| 2574 for (i = 0; i < nargs; i++) | 2540 for (i = 0; i < nargs; i++) |
| 2593 as that may change. | 2559 as that may change. |
| 2594 | 2560 |
| 2595 Do not use `make-local-variable' to make a hook variable buffer-local. | 2561 Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2596 Instead, use `add-hook' and specify t for the LOCAL argument. | 2562 Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2597 usage: (run-hook-with-args HOOK &rest ARGS) */) | 2563 usage: (run-hook-with-args HOOK &rest ARGS) */) |
| 2598 (nargs, args) | 2564 (int nargs, Lisp_Object *args) |
| 2599 int nargs; | |
| 2600 Lisp_Object *args; | |
| 2601 { | 2565 { |
| 2602 return run_hook_with_args (nargs, args, to_completion); | 2566 return run_hook_with_args (nargs, args, to_completion); |
| 2603 } | 2567 } |
| 2604 | 2568 |
| 2605 DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, | 2569 DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, |
| 2615 However, if they all return nil, we return nil. | 2579 However, if they all return nil, we return nil. |
| 2616 | 2580 |
| 2617 Do not use `make-local-variable' to make a hook variable buffer-local. | 2581 Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2618 Instead, use `add-hook' and specify t for the LOCAL argument. | 2582 Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2619 usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) | 2583 usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) |
| 2620 (nargs, args) | 2584 (int nargs, Lisp_Object *args) |
| 2621 int nargs; | |
| 2622 Lisp_Object *args; | |
| 2623 { | 2585 { |
| 2624 return run_hook_with_args (nargs, args, until_success); | 2586 return run_hook_with_args (nargs, args, until_success); |
| 2625 } | 2587 } |
| 2626 | 2588 |
| 2627 DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, | 2589 DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, |
| 2636 Then we return nil. However, if they all return non-nil, we return non-nil. | 2598 Then we return nil. However, if they all return non-nil, we return non-nil. |
| 2637 | 2599 |
| 2638 Do not use `make-local-variable' to make a hook variable buffer-local. | 2600 Do not use `make-local-variable' to make a hook variable buffer-local. |
| 2639 Instead, use `add-hook' and specify t for the LOCAL argument. | 2601 Instead, use `add-hook' and specify t for the LOCAL argument. |
| 2640 usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) | 2602 usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) |
| 2641 (nargs, args) | 2603 (int nargs, Lisp_Object *args) |
| 2642 int nargs; | |
| 2643 Lisp_Object *args; | |
| 2644 { | 2604 { |
| 2645 return run_hook_with_args (nargs, args, until_failure); | 2605 return run_hook_with_args (nargs, args, until_failure); |
| 2646 } | 2606 } |
| 2647 | 2607 |
| 2648 /* ARGS[0] should be a hook symbol. | 2608 /* ARGS[0] should be a hook symbol. |
| 2944 DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, | 2904 DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, |
| 2945 doc: /* Call first argument as a function, passing remaining arguments to it. | 2905 doc: /* Call first argument as a function, passing remaining arguments to it. |
| 2946 Return the value that function returns. | 2906 Return the value that function returns. |
| 2947 Thus, (funcall 'cons 'x 'y) returns (x . y). | 2907 Thus, (funcall 'cons 'x 'y) returns (x . y). |
| 2948 usage: (funcall FUNCTION &rest ARGUMENTS) */) | 2908 usage: (funcall FUNCTION &rest ARGUMENTS) */) |
| 2949 (nargs, args) | 2909 (int nargs, Lisp_Object *args) |
| 2950 int nargs; | |
| 2951 Lisp_Object *args; | |
| 2952 { | 2910 { |
| 2953 Lisp_Object fun, original_fun; | 2911 Lisp_Object fun, original_fun; |
| 2954 Lisp_Object funcar; | 2912 Lisp_Object funcar; |
| 2955 int numargs = nargs - 1; | 2913 int numargs = nargs - 1; |
| 2956 Lisp_Object lisp_numargs; | 2914 Lisp_Object lisp_numargs; |
| 3221 } | 3179 } |
| 3222 | 3180 |
| 3223 DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, | 3181 DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, |
| 3224 1, 1, 0, | 3182 1, 1, 0, |
| 3225 doc: /* If byte-compiled OBJECT is lazy-loaded, fetch it now. */) | 3183 doc: /* If byte-compiled OBJECT is lazy-loaded, fetch it now. */) |
| 3226 (object) | 3184 (Lisp_Object object) |
| 3227 Lisp_Object object; | |
| 3228 { | 3185 { |
| 3229 Lisp_Object tem; | 3186 Lisp_Object tem; |
| 3230 | 3187 |
| 3231 if (COMPILEDP (object) && CONSP (AREF (object, COMPILED_BYTECODE))) | 3188 if (COMPILEDP (object) && CONSP (AREF (object, COMPILED_BYTECODE))) |
| 3232 { | 3189 { |
| 3454 } | 3411 } |
| 3455 | 3412 |
| 3456 DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0, | 3413 DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0, |
| 3457 doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG. | 3414 doc: /* Set the debug-on-exit flag of eval frame LEVEL levels down to FLAG. |
| 3458 The debugger is entered when that frame exits, if the flag is non-nil. */) | 3415 The debugger is entered when that frame exits, if the flag is non-nil. */) |
| 3459 (level, flag) | 3416 (Lisp_Object level, Lisp_Object flag) |
| 3460 Lisp_Object level, flag; | |
| 3461 { | 3417 { |
| 3462 register struct backtrace *backlist = backtrace_list; | 3418 register struct backtrace *backlist = backtrace_list; |
| 3463 register int i; | 3419 register int i; |
| 3464 | 3420 |
| 3465 CHECK_NUMBER (level); | 3421 CHECK_NUMBER (level); |
| 3476 } | 3432 } |
| 3477 | 3433 |
| 3478 DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "", | 3434 DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "", |
| 3479 doc: /* Print a trace of Lisp function calls currently active. | 3435 doc: /* Print a trace of Lisp function calls currently active. |
| 3480 Output stream used is value of `standard-output'. */) | 3436 Output stream used is value of `standard-output'. */) |
| 3481 () | 3437 (void) |
| 3482 { | 3438 { |
| 3483 register struct backtrace *backlist = backtrace_list; | 3439 register struct backtrace *backlist = backtrace_list; |
| 3484 register int i; | 3440 register int i; |
| 3485 Lisp_Object tail; | 3441 Lisp_Object tail; |
| 3486 Lisp_Object tem; | 3442 Lisp_Object tem; |
| 3541 the value is (t FUNCTION ARG-VALUES...). | 3497 the value is (t FUNCTION ARG-VALUES...). |
| 3542 A &rest arg is represented as the tail of the list ARG-VALUES. | 3498 A &rest arg is represented as the tail of the list ARG-VALUES. |
| 3543 FUNCTION is whatever was supplied as car of evaluated list, | 3499 FUNCTION is whatever was supplied as car of evaluated list, |
| 3544 or a lambda expression for macro calls. | 3500 or a lambda expression for macro calls. |
| 3545 If NFRAMES is more than the number of frames, the value is nil. */) | 3501 If NFRAMES is more than the number of frames, the value is nil. */) |
| 3546 (nframes) | 3502 (Lisp_Object nframes) |
| 3547 Lisp_Object nframes; | |
| 3548 { | 3503 { |
| 3549 register struct backtrace *backlist = backtrace_list; | 3504 register struct backtrace *backlist = backtrace_list; |
| 3550 register int i; | 3505 register int i; |
| 3551 Lisp_Object tem; | 3506 Lisp_Object tem; |
| 3552 | 3507 |
