-
- GCPRO1 (form);
- maybe_gc ();
- UNGCPRO;
-
- scm_dynwind_begin (0);
- scm_dynwind_unwind_handler (set_lisp_eval_depth,
- (void *) lisp_eval_depth,
- SCM_F_WIND_EXPLICITLY);
-
- if (++lisp_eval_depth > max_lisp_eval_depth)
- {
- if (max_lisp_eval_depth < 100)
- max_lisp_eval_depth = 100;
- if (lisp_eval_depth > max_lisp_eval_depth)
- error ("Lisp nesting exceeds `max-lisp-eval-depth'");
- }
-
- original_fun = XCAR (form);
- original_args = XCDR (form);
-
- /* This also protects them from gc. */
- record_in_backtrace (original_fun, &original_args, UNEVALLED);
-
- if (debug_on_next_call)
- do_debug_on_call (Qt);
-
- /* At this point, only original_fun and original_args
- have values that will be used below. */
- retry:
-
- /* Optimize for no indirection. */
- fun = original_fun;
- if (!SYMBOLP (fun))
- fun = Ffunction (Fcons (fun, Qnil));
- else if (!NILP (fun) && (fun = SYMBOL_FUNCTION (fun), SYMBOLP (fun)))
- fun = indirect_function (fun);
-
- if (COMPILEDP (fun))
- val = apply_lambda (fun, original_args);
- else
- val = scm_call_1 (eval_fn, form);
-
- if (backtrace_debug_on_exit (specpdl_ptr - 1))
- val = call_debugger (list2 (Qexit, val));
- scm_dynwind_end ();
-
- return val;