aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eval.c55
1 files changed, 4 insertions, 51 deletions
diff --git a/src/eval.c b/src/eval.c
index 1378e3cae60..a625d679e0f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -89,7 +89,6 @@ int gcpro_level;
89 89
90Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun; 90Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun;
91Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; 91Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag;
92Lisp_Object Qmocklisp_arguments, Vmocklisp_arguments, Qmocklisp;
93Lisp_Object Qand_rest, Qand_optional; 92Lisp_Object Qand_rest, Qand_optional;
94Lisp_Object Qdebug_on_error; 93Lisp_Object Qdebug_on_error;
95 94
@@ -191,8 +190,6 @@ Lisp_Object Vsignaling_function;
191int handling_signal; 190int handling_signal;
192 191
193static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*)); 192static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*));
194/* Apply a mocklisp function to unevaluated argument list. */
195extern Lisp_Object ml_apply P_ ((Lisp_Object, Lisp_Object));
196 193
197void 194void
198init_eval_once () 195init_eval_once ()
@@ -406,22 +403,10 @@ usage: (progn BODY ...) */)
406 (args) 403 (args)
407 Lisp_Object args; 404 Lisp_Object args;
408{ 405{
409 register Lisp_Object val, tem; 406 register Lisp_Object val;
410 Lisp_Object args_left; 407 Lisp_Object args_left;
411 struct gcpro gcpro1; 408 struct gcpro gcpro1;
412 409
413 /* In Mocklisp code, symbols at the front of the progn arglist
414 are to be bound to zero. */
415 if (!EQ (Vmocklisp_arguments, Qt))
416 {
417 val = make_number (0);
418 while (!NILP (args) && (tem = Fcar (args), SYMBOLP (tem)))
419 {
420 QUIT;
421 specbind (tem, val), args = Fcdr (args);
422 }
423 }
424
425 if (NILP(args)) 410 if (NILP(args))
426 return Qnil; 411 return Qnil;
427 412
@@ -925,15 +910,14 @@ usage: (while TEST BODY...) */)
925 (args) 910 (args)
926 Lisp_Object args; 911 Lisp_Object args;
927{ 912{
928 Lisp_Object test, body, tem; 913 Lisp_Object test, body;
929 struct gcpro gcpro1, gcpro2; 914 struct gcpro gcpro1, gcpro2;
930 915
931 GCPRO2 (test, body); 916 GCPRO2 (test, body);
932 917
933 test = Fcar (args); 918 test = Fcar (args);
934 body = Fcdr (args); 919 body = Fcdr (args);
935 while (tem = Feval (test), 920 while (!NILP (Feval (test)))
936 (!EQ (Vmocklisp_arguments, Qt) ? XINT (tem) : !NILP (tem)))
937 { 921 {
938 QUIT; 922 QUIT;
939 Fprogn (body); 923 Fprogn (body);
@@ -1795,8 +1779,6 @@ Also, a symbol satisfies `commandp' if its function definition does so. */)
1795 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 1779 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
1796 if (EQ (funcar, Qlambda)) 1780 if (EQ (funcar, Qlambda))
1797 return Fassq (Qinteractive, Fcdr (Fcdr (fun))); 1781 return Fassq (Qinteractive, Fcdr (Fcdr (fun)));
1798 if (EQ (funcar, Qmocklisp))
1799 return Qt; /* All mocklisp functions can be called interactively */
1800 if (EQ (funcar, Qautoload)) 1782 if (EQ (funcar, Qautoload))
1801 return Fcar (Fcdr (Fcdr (Fcdr (fun)))); 1783 return Fcar (Fcdr (Fcdr (Fcdr (fun))));
1802 else 1784 else
@@ -1942,16 +1924,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
1942 abort (); 1924 abort ();
1943 1925
1944 if (SYMBOLP (form)) 1926 if (SYMBOLP (form))
1945 { 1927 return Fsymbol_value (form);
1946 if (EQ (Vmocklisp_arguments, Qt))
1947 return Fsymbol_value (form);
1948 val = Fsymbol_value (form);
1949 if (NILP (val))
1950 XSETFASTINT (val, 0);
1951 else if (EQ (val, Qt))
1952 XSETFASTINT (val, 1);
1953 return val;
1954 }
1955 if (!CONSP (form)) 1928 if (!CONSP (form))
1956 return form; 1929 return form;
1957 1930
@@ -2119,19 +2092,10 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2119 val = Feval (apply1 (Fcdr (fun), original_args)); 2092 val = Feval (apply1 (Fcdr (fun), original_args));
2120 else if (EQ (funcar, Qlambda)) 2093 else if (EQ (funcar, Qlambda))
2121 val = apply_lambda (fun, original_args, 1); 2094 val = apply_lambda (fun, original_args, 1);
2122 else if (EQ (funcar, Qmocklisp))
2123 val = ml_apply (fun, original_args);
2124 else 2095 else
2125 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2096 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
2126 } 2097 }
2127 done: 2098 done:
2128 if (!EQ (Vmocklisp_arguments, Qt))
2129 {
2130 if (NILP (val))
2131 XSETFASTINT (val, 0);
2132 else if (EQ (val, Qt))
2133 XSETFASTINT (val, 1);
2134 }
2135 lisp_eval_depth--; 2099 lisp_eval_depth--;
2136 if (backtrace.debug_on_exit) 2100 if (backtrace.debug_on_exit)
2137 val = call_debugger (Fcons (Qexit, Fcons (val, Qnil))); 2101 val = call_debugger (Fcons (Qexit, Fcons (val, Qnil)));
@@ -2768,8 +2732,6 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2768 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2732 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
2769 if (EQ (funcar, Qlambda)) 2733 if (EQ (funcar, Qlambda))
2770 val = funcall_lambda (fun, numargs, args + 1); 2734 val = funcall_lambda (fun, numargs, args + 1);
2771 else if (EQ (funcar, Qmocklisp))
2772 val = ml_apply (fun, Flist (numargs, args + 1));
2773 else if (EQ (funcar, Qautoload)) 2735 else if (EQ (funcar, Qautoload))
2774 { 2736 {
2775 do_autoload (fun, args[0]); 2737 do_autoload (fun, args[0]);
@@ -2845,9 +2807,6 @@ funcall_lambda (fun, nargs, arg_vector)
2845 int count = specpdl_ptr - specpdl; 2807 int count = specpdl_ptr - specpdl;
2846 int i, optional, rest; 2808 int i, optional, rest;
2847 2809
2848 if (NILP (Vmocklisp_arguments))
2849 specbind (Qmocklisp_arguments, Qt); /* t means NOT mocklisp! */
2850
2851 if (CONSP (fun)) 2810 if (CONSP (fun))
2852 { 2811 {
2853 syms_left = XCDR (fun); 2812 syms_left = XCDR (fun);
@@ -3350,12 +3309,6 @@ It receives the same arguments that `signal' was given.
3350The Edebug package uses this to regain control. */); 3309The Edebug package uses this to regain control. */);
3351 Vsignal_hook_function = Qnil; 3310 Vsignal_hook_function = Qnil;
3352 3311
3353 Qmocklisp_arguments = intern ("mocklisp-arguments");
3354 staticpro (&Qmocklisp_arguments);
3355 DEFVAR_LISP ("mocklisp-arguments", &Vmocklisp_arguments,
3356 doc: /* While in a mocklisp function, the list of its unevaluated args. */);
3357 Vmocklisp_arguments = Qt;
3358
3359 DEFVAR_LISP ("debug-on-signal", &Vdebug_on_signal, 3312 DEFVAR_LISP ("debug-on-signal", &Vdebug_on_signal,
3360 doc: /* *Non-nil means call the debugger regardless of condition handlers. 3313 doc: /* *Non-nil means call the debugger regardless of condition handlers.
3361Note that `debug-on-error', `debug-on-quit' and friends 3314Note that `debug-on-error', `debug-on-quit' and friends