Mercurial > hg > xemacs-beta
comparison src/eval.c @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 3d3049ae1304 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
65 #define AV_6(av) AV_5(av), av[5] | 65 #define AV_6(av) AV_5(av), av[5] |
66 #define AV_7(av) AV_6(av), av[6] | 66 #define AV_7(av) AV_6(av), av[6] |
67 #define AV_8(av) AV_7(av), av[7] | 67 #define AV_8(av) AV_7(av), av[7] |
68 | 68 |
69 #define PRIMITIVE_FUNCALL_1(fn, av, ac) \ | 69 #define PRIMITIVE_FUNCALL_1(fn, av, ac) \ |
70 (((Lisp_Object (*)(EXFUN_##ac)) (fn)) (AV_##ac (av))) | 70 (((Lisp_Object (*)(EXFUN_##ac)) (fn)) (AV_##ac (av))) |
71 | 71 |
72 /* If subrs take more than 8 arguments, more cases need to be added | 72 /* If subrs take more than 8 arguments, more cases need to be added |
73 to this switch. (But wait - don't do it - if you really need | 73 to this switch. (But wait - don't do it - if you really need |
74 a SUBR with more than 8 arguments, use max_args == MANY. | 74 a SUBR with more than 8 arguments, use max_args == MANY. |
75 See the DEFUN macro in lisp.h) */ | 75 See the DEFUN macro in lisp.h) */ |
725 Lisp_Object body = Flist (nargs-1, args+1); | 725 Lisp_Object body = Flist (nargs-1, args+1); |
726 return Fcons (Qif, Fcons (cond, Fcons (Qnil, body))); | 726 return Fcons (Qif, Fcons (cond, Fcons (Qnil, body))); |
727 } | 727 } |
728 | 728 |
729 DEFUN ("cond", Fcond, 0, UNEVALLED, 0, /* | 729 DEFUN ("cond", Fcond, 0, UNEVALLED, 0, /* |
730 (cond CLAUSES...): try each clause until one succeeds. | 730 \(cond CLAUSES...): try each clause until one succeeds. |
731 Each clause looks like (CONDITION BODY...). CONDITION is evaluated | 731 Each clause looks like (CONDITION BODY...). CONDITION is evaluated |
732 and, if the value is non-nil, this clause succeeds: | 732 and, if the value is non-nil, this clause succeeds: |
733 then the expressions in BODY are evaluated and the last one's | 733 then the expressions in BODY are evaluated and the last one's |
734 value is the value of the cond-form. | 734 value is the value of the cond-form. |
735 If no clause succeeds, cond returns nil. | 735 If no clause succeeds, cond returns nil. |
1469 back to the place that established the catch (in this case, | 1469 back to the place that established the catch (in this case, |
1470 condition_case_1). See below for more info. | 1470 condition_case_1). See below for more info. |
1471 */ | 1471 */ |
1472 | 1472 |
1473 DEFUN ("throw", Fthrow, 2, 2, 0, /* | 1473 DEFUN ("throw", Fthrow, 2, 2, 0, /* |
1474 \(throw TAG VALUE): throw to the catch for TAG and return VALUE from it. | 1474 Throw to the catch for TAG and return VALUE from it. |
1475 Both TAG and VALUE are evalled. | 1475 Both TAG and VALUE are evalled. |
1476 */ | 1476 */ |
1477 (tag, val)) | 1477 (tag, value)) |
1478 { | 1478 { |
1479 throw_or_bomb_out (tag, val, 0, Qnil, Qnil); /* Doesn't return */ | 1479 throw_or_bomb_out (tag, value, 0, Qnil, Qnil); /* Doesn't return */ |
1480 return Qnil; | 1480 return Qnil; |
1481 } | 1481 } |
1482 | 1482 |
1483 DEFUN ("unwind-protect", Funwind_protect, 1, UNEVALLED, 0, /* | 1483 DEFUN ("unwind-protect", Funwind_protect, 1, UNEVALLED, 0, /* |
1484 Do BODYFORM, protecting with UNWINDFORMS. | 1484 Do BODYFORM, protecting with UNWINDFORMS. |
2930 CMD must be an object that satisfies the `commandp' predicate. | 2930 CMD must be an object that satisfies the `commandp' predicate. |
2931 Optional second arg RECORD-FLAG is as in `call-interactively'. | 2931 Optional second arg RECORD-FLAG is as in `call-interactively'. |
2932 The argument KEYS specifies the value to use instead of (this-command-keys) | 2932 The argument KEYS specifies the value to use instead of (this-command-keys) |
2933 when reading the arguments. | 2933 when reading the arguments. |
2934 */ | 2934 */ |
2935 (cmd, record, keys)) | 2935 (cmd, record_flag, keys)) |
2936 { | 2936 { |
2937 /* This function can GC */ | 2937 /* This function can GC */ |
2938 Lisp_Object prefixarg; | 2938 Lisp_Object prefixarg; |
2939 Lisp_Object final = cmd; | 2939 Lisp_Object final = cmd; |
2940 struct backtrace backtrace; | 2940 struct backtrace backtrace; |
2965 backtrace.evalargs = 0; | 2965 backtrace.evalargs = 0; |
2966 backtrace.pdlcount = specpdl_depth(); | 2966 backtrace.pdlcount = specpdl_depth(); |
2967 backtrace.debug_on_exit = 0; | 2967 backtrace.debug_on_exit = 0; |
2968 PUSH_BACKTRACE (backtrace); | 2968 PUSH_BACKTRACE (backtrace); |
2969 | 2969 |
2970 final = Fcall_interactively (cmd, record, keys); | 2970 final = Fcall_interactively (cmd, record_flag, keys); |
2971 | 2971 |
2972 POP_BACKTRACE (backtrace); | 2972 POP_BACKTRACE (backtrace); |
2973 return final; | 2973 return final; |
2974 } | 2974 } |
2975 else if (STRINGP (final) || VECTORP (final)) | 2975 else if (STRINGP (final) || VECTORP (final)) |
3064 /************************************************************************/ | 3064 /************************************************************************/ |
3065 /* Autoloading */ | 3065 /* Autoloading */ |
3066 /************************************************************************/ | 3066 /************************************************************************/ |
3067 | 3067 |
3068 DEFUN ("autoload", Fautoload, 2, 5, 0, /* | 3068 DEFUN ("autoload", Fautoload, 2, 5, 0, /* |
3069 Define FUNCTION to autoload from FILE. | 3069 Define FUNCTION to autoload from FILENAME. |
3070 FUNCTION is a symbol; FILE is a file name string to pass to `load'. | 3070 FUNCTION is a symbol; FILENAME is a file name string to pass to `load'. |
3071 Third arg DOCSTRING is documentation for the function. | 3071 The remaining optional arguments provide additional info about the |
3072 Fourth arg INTERACTIVE if non-nil says function can be called interactively. | 3072 real definition. |
3073 Fifth arg TYPE indicates the type of the object: | 3073 DOCSTRING is documentation for FUNCTION. |
3074 INTERACTIVE, if non-nil, says FUNCTION can be called interactively. | |
3075 TYPE indicates the type of the object: | |
3074 nil or omitted says FUNCTION is a function, | 3076 nil or omitted says FUNCTION is a function, |
3075 `keymap' says FUNCTION is really a keymap, and | 3077 `keymap' says FUNCTION is really a keymap, and |
3076 `macro' or t says FUNCTION is really a macro. | 3078 `macro' or t says FUNCTION is really a macro. |
3077 Third through fifth args give info about the real definition. | 3079 If FUNCTION already has a non-void function definition that is not an |
3078 They default to nil. | 3080 autoload object, this function does nothing and returns nil. |
3079 If FUNCTION is already defined other than as an autoload, | |
3080 this does nothing and returns nil. | |
3081 */ | 3081 */ |
3082 (function, file, docstring, interactive, type)) | 3082 (function, filename, docstring, interactive, type)) |
3083 { | 3083 { |
3084 /* This function can GC */ | 3084 /* This function can GC */ |
3085 CHECK_SYMBOL (function); | 3085 CHECK_SYMBOL (function); |
3086 CHECK_STRING (file); | 3086 CHECK_STRING (filename); |
3087 | 3087 |
3088 /* If function is defined and not as an autoload, don't override */ | 3088 /* If function is defined and not as an autoload, don't override */ |
3089 { | 3089 { |
3090 Lisp_Object f = XSYMBOL (function)->function; | 3090 Lisp_Object f = XSYMBOL (function)->function; |
3091 if (!UNBOUNDP (f) && !(CONSP (f) && EQ (XCAR (f), Qautoload))) | 3091 if (!UNBOUNDP (f) && !(CONSP (f) && EQ (XCAR (f), Qautoload))) |
3093 } | 3093 } |
3094 | 3094 |
3095 if (purify_flag) | 3095 if (purify_flag) |
3096 { | 3096 { |
3097 /* Attempt to avoid consing identical (string=) pure strings. */ | 3097 /* Attempt to avoid consing identical (string=) pure strings. */ |
3098 file = Fsymbol_name (Fintern (file, Qnil)); | 3098 filename = Fsymbol_name (Fintern (filename, Qnil)); |
3099 } | 3099 } |
3100 | 3100 |
3101 return Ffset (function, Fcons (Qautoload, list4 (file, | 3101 return Ffset (function, Fcons (Qautoload, list4 (filename, |
3102 docstring, | 3102 docstring, |
3103 interactive, | 3103 interactive, |
3104 type))); | 3104 type))); |
3105 } | 3105 } |
3106 | 3106 |
3895 value, that value may be a function or a list of functions to be | 3895 value, that value may be a function or a list of functions to be |
3896 called to run the hook. If the value is a function, it is called with | 3896 called to run the hook. If the value is a function, it is called with |
3897 the given arguments and its return value is returned. If it is a list | 3897 the given arguments and its return value is returned. If it is a list |
3898 of functions, those functions are called, in order, | 3898 of functions, those functions are called, in order, |
3899 with the given arguments ARGS. | 3899 with the given arguments ARGS. |
3900 It is best not to depend on the value return by `run-hook-with-args', | 3900 It is best not to depend on the value returned by `run-hook-with-args', |
3901 as that may change. | 3901 as that may change. |
3902 | 3902 |
3903 To make a hook variable buffer-local, use `make-local-hook', | 3903 To make a hook variable buffer-local, use `make-local-hook', |
3904 not `make-local-variable'. | 3904 not `make-local-variable'. |
3905 */ | 3905 */ |
5101 } | 5101 } |
5102 | 5102 |
5103 DEFUN ("backtrace", Fbacktrace, 0, 2, "", /* | 5103 DEFUN ("backtrace", Fbacktrace, 0, 2, "", /* |
5104 Print a trace of Lisp function calls currently active. | 5104 Print a trace of Lisp function calls currently active. |
5105 Optional arg STREAM specifies the output stream to send the backtrace to, | 5105 Optional arg STREAM specifies the output stream to send the backtrace to, |
5106 and defaults to the value of `standard-output'. Optional second arg | 5106 and defaults to the value of `standard-output'. |
5107 DETAILED means show places where currently active variable bindings, | 5107 Optional second arg DETAILED non-nil means show places where currently |
5108 catches, condition-cases, and unwind-protects were made as well as | 5108 active variable bindings, catches, condition-cases, and |
5109 function calls. | 5109 unwind-protects, as well as function calls, were made. |
5110 */ | 5110 */ |
5111 (stream, detailed)) | 5111 (stream, detailed)) |
5112 { | 5112 { |
5113 /* This function can GC */ | 5113 /* This function can GC */ |
5114 struct backtrace *backlist = backtrace_list; | 5114 struct backtrace *backlist = backtrace_list; |
5229 Vinhibit_quit = oiq; | 5229 Vinhibit_quit = oiq; |
5230 return Qnil; | 5230 return Qnil; |
5231 } | 5231 } |
5232 | 5232 |
5233 | 5233 |
5234 DEFUN ("backtrace-frame", Fbacktrace_frame, 1, 1, "", /* | 5234 DEFUN ("backtrace-frame", Fbacktrace_frame, 1, 1, 0, /* |
5235 Return the function and arguments N frames up from current execution point. | 5235 Return the function and arguments NFRAMES up from current execution point. |
5236 If that frame has not evaluated the arguments yet (or is a special form), | 5236 If that frame has not evaluated the arguments yet (or is a special form), |
5237 the value is (nil FUNCTION ARG-FORMS...). | 5237 the value is (nil FUNCTION ARG-FORMS...). |
5238 If that frame has evaluated its arguments and called its function already, | 5238 If that frame has evaluated its arguments and called its function already, |
5239 the value is (t FUNCTION ARG-VALUES...). | 5239 the value is (t FUNCTION ARG-VALUES...). |
5240 A &rest arg is represented as the tail of the list ARG-VALUES. | 5240 A &rest arg is represented as the tail of the list ARG-VALUES. |
5241 FUNCTION is whatever was supplied as car of evaluated list, | 5241 FUNCTION is whatever was supplied as car of evaluated list, |
5242 or a lambda expression for macro calls. | 5242 or a lambda expression for macro calls. |
5243 If N is more than the number of frames, the value is nil. | 5243 If NFRAMES is more than the number of frames, the value is nil. |
5244 */ | 5244 */ |
5245 (nframes)) | 5245 (nframes)) |
5246 { | 5246 { |
5247 REGISTER struct backtrace *backlist = backtrace_list; | 5247 REGISTER struct backtrace *backlist = backtrace_list; |
5248 REGISTER int i; | 5248 REGISTER int i; |