comparison src/eval.c @ 4962:e813cf16c015

merge
author Ben Wing <ben@xemacs.org>
date Mon, 01 Feb 2010 05:29:05 -0600
parents 19a72041c5ed 755ae5b97edb
children cbe181529c34
comparison
equal deleted inserted replaced
4961:b90f8cf474e0 4962:e813cf16c015
425 static void 425 static void
426 print_subr (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag)) 426 print_subr (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag))
427 { 427 {
428 Lisp_Subr *subr = XSUBR (obj); 428 Lisp_Subr *subr = XSUBR (obj);
429 const Ascbyte *header = 429 const Ascbyte *header =
430 (subr->max_args == UNEVALLED) ? "#<special-form " : "#<subr "; 430 (subr->max_args == UNEVALLED) ? "#<special-operator " : "#<subr ";
431 const Ascbyte *name = subr_name (subr); 431 const Ascbyte *name = subr_name (subr);
432 const Ascbyte *trailer = subr->prompt ? " (interactive)>" : ">"; 432 const Ascbyte *trailer = subr->prompt ? " (interactive)>" : ">";
433 433
434 if (print_readably) 434 if (print_readably)
435 printing_unreadable_object ("%s%s%s", header, name, trailer); 435 printing_unreadable_object ("%s%s%s", header, name, trailer);
821 821
822 /************************************************************************/ 822 /************************************************************************/
823 /* The basic special forms */ 823 /* The basic special forms */
824 /************************************************************************/ 824 /************************************************************************/
825 825
826 /* Except for Fprogn(), the basic special forms below are only called 826 /* Except for Fprogn(), the basic special operators below are only called
827 from interpreted code. The byte compiler turns them into bytecodes. */ 827 from interpreted code. The byte compiler turns them into bytecodes. */
828 828
829 DEFUN ("or", For, 0, UNEVALLED, 0, /* 829 DEFUN ("or", For, 0, UNEVALLED, 0, /*
830 Eval ARGS until one of them yields non-nil, then return that value. 830 Eval ARGS until one of them yields non-nil, then return that value.
831 The remaining ARGS are not evalled at all. 831 The remaining ARGS are not evalled at all.
3300 byte-compiled functions, we'll accept it for now. */ 3300 byte-compiled functions, we'll accept it for now. */
3301 if (EQ (*btp->function, Qbyte_code)) 3301 if (EQ (*btp->function, Qbyte_code))
3302 btp = btp->next; 3302 btp = btp->next;
3303 3303
3304 /* If this isn't a byte-compiled function, then we may now be 3304 /* If this isn't a byte-compiled function, then we may now be
3305 looking at several frames for special forms. Skip past them. */ 3305 looking at several frames for special operators. Skip past them. */
3306 while (btp && 3306 while (btp &&
3307 btp->nargs == UNEVALLED) 3307 btp->nargs == UNEVALLED)
3308 btp = btp->next; 3308 btp = btp->next;
3309 3309
3310 #else 3310 #else
4058 { 4058 {
4059 PROFILE_ENTER_FUNCTION (); 4059 PROFILE_ENTER_FUNCTION ();
4060 val = SUBR_FUNCTION (subr, MANY) (fun_nargs, fun_args); 4060 val = SUBR_FUNCTION (subr, MANY) (fun_nargs, fun_args);
4061 PROFILE_EXIT_FUNCTION (); 4061 PROFILE_EXIT_FUNCTION ();
4062 } 4062 }
4063 else if (max_args == UNEVALLED) /* Can't funcall a special form */ 4063 else if (max_args == UNEVALLED) /* Can't funcall a special operator */
4064 { 4064 {
4065 /* Ugh, ugh, ugh. */ 4065 /* Ugh, ugh, ugh. */
4066 if (EQ (fun, XSYMBOL_FUNCTION (Qthrow))) 4066 if (EQ (fun, XSYMBOL_FUNCTION (Qthrow)))
4067 { 4067 {
4068 args[0] = Qobsolete_throw; 4068 args[0] = Qobsolete_throw;
4241 } 4241 }
4242 4242
4243 DEFUN ("function-min-args", Ffunction_min_args, 1, 1, 0, /* 4243 DEFUN ("function-min-args", Ffunction_min_args, 1, 1, 0, /*
4244 Return the minimum number of arguments a function may be called with. 4244 Return the minimum number of arguments a function may be called with.
4245 The function may be any form that can be passed to `funcall', 4245 The function may be any form that can be passed to `funcall',
4246 any special form, or any macro. 4246 any special operator, or any macro.
4247 4247
4248 To check if a function can be called with a specified number of 4248 To check if a function can be called with a specified number of
4249 arguments, use `function-allows-args'. 4249 arguments, use `function-allows-args'.
4250 */ 4250 */
4251 (function)) 4251 (function))
4254 } 4254 }
4255 4255
4256 DEFUN ("function-max-args", Ffunction_max_args, 1, 1, 0, /* 4256 DEFUN ("function-max-args", Ffunction_max_args, 1, 1, 0, /*
4257 Return the maximum number of arguments a function may be called with. 4257 Return the maximum number of arguments a function may be called with.
4258 The function may be any form that can be passed to `funcall', 4258 The function may be any form that can be passed to `funcall',
4259 any special form, or any macro. 4259 any special operator, or any macro.
4260 If the function takes an arbitrary number of arguments or is 4260 If the function takes an arbitrary number of arguments or is
4261 a built-in special form, nil is returned. 4261 a built-in special operator, nil is returned.
4262 4262
4263 To check if a function can be called with a specified number of 4263 To check if a function can be called with a specified number of
4264 arguments, use `function-allows-args'. 4264 arguments, use `function-allows-args'.
4265 */ 4265 */
4266 (function)) 4266 (function))
4413 /* Multiple values. 4413 /* Multiple values.
4414 4414
4415 A multiple value object is returned by #'values if: 4415 A multiple value object is returned by #'values if:
4416 4416
4417 -- The number of arguments to #'values is not one, and: 4417 -- The number of arguments to #'values is not one, and:
4418 -- Some special form in the call stack is prepared to handle more than 4418 -- Some special operator in the call stack is prepared to handle more than
4419 one multiple value. 4419 one multiple value.
4420 4420
4421 The return value of #'values-list is analogous to that of #'values. 4421 The return value of #'values-list is analogous to that of #'values.
4422 4422
4423 Henry Baker, in https://eprints.kfupm.edu.sa/31898/1/31898.pdf ("CONS 4423 Henry Baker, in https://eprints.kfupm.edu.sa/31898/1/31898.pdf ("CONS
4428 something not true for us. As far as I can tell, it also ignores the 4428 something not true for us. As far as I can tell, it also ignores the
4429 contexts where multiple-values need to be thrown, or maybe it thinks such 4429 contexts where multiple-values need to be thrown, or maybe it thinks such
4430 objects should be converted to heap allocation at that point. 4430 objects should be converted to heap allocation at that point.
4431 4431
4432 The specific multiple values saved and returned depend on how many 4432 The specific multiple values saved and returned depend on how many
4433 multiple-values special forms in the stack are interested in; for 4433 multiple-values special operators in the stack are interested in; for
4434 example, if #'multiple-value-call is somewhere in the call stack, all 4434 example, if #'multiple-value-call is somewhere in the call stack, all
4435 values passed to #'values will be saved and returned. If an expansion of 4435 values passed to #'values will be saved and returned. If an expansion of
4436 #'multiple-value-setq with 10 SYMS is the only part of the call stack 4436 #'multiple-value-setq with 10 SYMS is the only part of the call stack
4437 interested in multiple values, then a maximum of ten multiple values will 4437 interested in multiple values, then a maximum of ten multiple values will
4438 be saved and returned. 4438 be saved and returned.
7156 } 7156 }
7157 7157
7158 7158
7159 DEFUN ("backtrace-frame", Fbacktrace_frame, 1, 1, 0, /* 7159 DEFUN ("backtrace-frame", Fbacktrace_frame, 1, 1, 0, /*
7160 Return the function and arguments NFRAMES up from current execution point. 7160 Return the function and arguments NFRAMES up from current execution point.
7161 If that frame has not evaluated the arguments yet (or is a special form), 7161 If that frame has not evaluated the arguments yet (or involves a special
7162 the value is (nil FUNCTION ARG-FORMS...). 7162 operator), the value is (nil FUNCTION ARG-FORMS...).
7163 If that frame has evaluated its arguments and called its function already, 7163 If that frame has evaluated its arguments and called its function already,
7164 the value is (t FUNCTION ARG-VALUES...). 7164 the value is (t FUNCTION ARG-VALUES...).
7165 A &rest arg is represented as the tail of the list ARG-VALUES. 7165 A &rest arg is represented as the tail of the list ARG-VALUES.
7166 FUNCTION is whatever was supplied as car of evaluated list, 7166 FUNCTION is whatever was supplied as car of evaluated list,
7167 or a lambda expression for macro calls. 7167 or a lambda expression for macro calls.
7525 7525
7526 DEFVAR_CONST_INT ("multiple-values-limit", &Vmultiple_values_limit /* 7526 DEFVAR_CONST_INT ("multiple-values-limit", &Vmultiple_values_limit /*
7527 The exclusive upper bound on the number of multiple values. 7527 The exclusive upper bound on the number of multiple values.
7528 7528
7529 This applies to `values', `values-list', `multiple-value-bind' and related 7529 This applies to `values', `values-list', `multiple-value-bind' and related
7530 macros and special forms. 7530 macros and special operators.
7531 */); 7531 */);
7532 Vmultiple_values_limit = EMACS_INT_MAX > INT_MAX ? INT_MAX : EMACS_INT_MAX; 7532 Vmultiple_values_limit = EMACS_INT_MAX > INT_MAX ? INT_MAX : EMACS_INT_MAX;
7533 7533
7534 staticpro (&Vcatch_everything_tag); 7534 staticpro (&Vcatch_everything_tag);
7535 Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0); 7535 Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0);