aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorKaroly Lorentey2006-07-14 05:56:32 +0000
committerKaroly Lorentey2006-07-14 05:56:32 +0000
commit99715bbc447eb633e45ffa23b87284771ce3ac74 (patch)
tree3a8a53dfe3dbdd9f8e36965e9f043eae522d3c0e /src/eval.c
parent556b89447234f15d1784a23dadbfe429464463a8 (diff)
parent763bb2d43615bc3ae816422f965d76d5e1ae4bdd (diff)
downloademacs-99715bbc447eb633e45ffa23b87284771ce3ac74.tar.gz
emacs-99715bbc447eb633e45ffa23b87284771ce3ac74.zip
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-331 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-332 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-333 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-334 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-335 Add note about "link" button-class to etc/TODO * emacs@sv.gnu.org/emacs--devo--0--patch-336 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-337 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-338 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-339 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-340 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-341 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-342 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-343 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-344 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-345 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-346 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-347 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-348 Update for ERC 5.1.3. * emacs@sv.gnu.org/emacs--devo--0--patch-349 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-350 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/gnus--rel--5.10--patch-111 Update from CVS: texi/gnus.texi (Summary Buffer Lines): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-112 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-113 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-114 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-572
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c83
1 files changed, 47 insertions, 36 deletions
diff --git a/src/eval.c b/src/eval.c
index 5f8d266ec7b..a07ab32e76b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -749,8 +749,7 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */)
749 749
750DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0, 750DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0,
751 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE. 751 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE.
752Setting the value of NEW-ALIAS will subsequently set the value of BASE-VARIABLE, 752Aliased variables always have the same value; setting one sets the other.
753 and getting the value of NEW-ALIAS will return the value BASE-VARIABLE has.
754Third arg DOCSTRING, if non-nil, is documentation for NEW-ALIAS. If it is 753Third arg DOCSTRING, if non-nil, is documentation for NEW-ALIAS. If it is
755 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE, 754 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE,
756 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is 755 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is
@@ -1290,16 +1289,14 @@ Both TAG and VALUE are evalled. */)
1290{ 1289{
1291 register struct catchtag *c; 1290 register struct catchtag *c;
1292 1291
1293 while (1) 1292 if (!NILP (tag))
1294 { 1293 for (c = catchlist; c; c = c->next)
1295 if (!NILP (tag)) 1294 {
1296 for (c = catchlist; c; c = c->next) 1295 if (EQ (c->tag, tag))
1297 { 1296 unwind_to_catch (c, value);
1298 if (EQ (c->tag, tag)) 1297 }
1299 unwind_to_catch (c, value); 1298 Fsignal (Qno_catch, list2 (tag, value));
1300 } 1299 abort ();
1301 tag = Fsignal (Qno_catch, Fcons (tag, Fcons (value, Qnil)));
1302 }
1303} 1300}
1304 1301
1305 1302
@@ -2167,7 +2164,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2167 /* At this point, only original_fun and original_args 2164 /* At this point, only original_fun and original_args
2168 have values that will be used below */ 2165 have values that will be used below */
2169 retry: 2166 retry:
2170 fun = Findirect_function (original_fun, Qnil); 2167
2168 /* Optimize for no indirection. */
2169 fun = original_fun;
2170 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2171 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2172 fun = indirect_function (fun);
2171 2173
2172 if (SUBRP (fun)) 2174 if (SUBRP (fun))
2173 { 2175 {
@@ -2183,7 +2185,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2183 2185
2184 if (XINT (numargs) < XSUBR (fun)->min_args || 2186 if (XINT (numargs) < XSUBR (fun)->min_args ||
2185 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) 2187 (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs)))
2186 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (numargs, Qnil))); 2188 Fsignal (Qwrong_number_of_arguments, list2 (original_fun, numargs));
2187 2189
2188 if (XSUBR (fun)->max_args == UNEVALLED) 2190 if (XSUBR (fun)->max_args == UNEVALLED)
2189 { 2191 {
@@ -2286,11 +2288,13 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2286 val = apply_lambda (fun, original_args, 1); 2288 val = apply_lambda (fun, original_args, 1);
2287 else 2289 else
2288 { 2290 {
2291 if (EQ (fun, Qunbound))
2292 Fsignal (Qvoid_function, Fcons (original_fun, Qnil));
2289 if (!CONSP (fun)) 2293 if (!CONSP (fun))
2290 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2294 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2291 funcar = Fcar (fun); 2295 funcar = Fcar (fun);
2292 if (!SYMBOLP (funcar)) 2296 if (!SYMBOLP (funcar))
2293 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2297 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2294 if (EQ (funcar, Qautoload)) 2298 if (EQ (funcar, Qautoload))
2295 { 2299 {
2296 do_autoload (fun, original_fun); 2300 do_autoload (fun, original_fun);
@@ -2301,7 +2305,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2301 else if (EQ (funcar, Qlambda)) 2305 else if (EQ (funcar, Qlambda))
2302 val = apply_lambda (fun, original_args, 1); 2306 val = apply_lambda (fun, original_args, 1);
2303 else 2307 else
2304 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2308 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2305 } 2309 }
2306 done: 2310 done:
2307 CHECK_CONS_LIST (); 2311 CHECK_CONS_LIST ();
@@ -2346,7 +2350,10 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2346 2350
2347 numargs += nargs - 2; 2351 numargs += nargs - 2;
2348 2352
2349 fun = indirect_function (fun); 2353 /* Optimize for no indirection. */
2354 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2355 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2356 fun = indirect_function (fun);
2350 if (EQ (fun, Qunbound)) 2357 if (EQ (fun, Qunbound))
2351 { 2358 {
2352 /* Let funcall get the error */ 2359 /* Let funcall get the error */
@@ -2825,7 +2832,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2825 int nargs; 2832 int nargs;
2826 Lisp_Object *args; 2833 Lisp_Object *args;
2827{ 2834{
2828 Lisp_Object fun; 2835 Lisp_Object fun, original_fun;
2829 Lisp_Object funcar; 2836 Lisp_Object funcar;
2830 int numargs = nargs - 1; 2837 int numargs = nargs - 1;
2831 Lisp_Object lisp_numargs; 2838 Lisp_Object lisp_numargs;
@@ -2862,11 +2869,15 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2862 2869
2863 CHECK_CONS_LIST (); 2870 CHECK_CONS_LIST ();
2864 2871
2872 original_fun = args[0];
2873
2865 retry: 2874 retry:
2866 2875
2867 fun = args[0]; 2876 /* Optimize for no indirection. */
2868 2877 fun = original_fun;
2869 fun = Findirect_function (fun, Qnil); 2878 if (SYMBOLP (fun) && !EQ (fun, Qunbound)
2879 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2880 fun = indirect_function (fun);
2870 2881
2871 if (SUBRP (fun)) 2882 if (SUBRP (fun))
2872 { 2883 {
@@ -2874,11 +2885,11 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2874 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) 2885 || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs))
2875 { 2886 {
2876 XSETFASTINT (lisp_numargs, numargs); 2887 XSETFASTINT (lisp_numargs, numargs);
2877 return Fsignal (Qwrong_number_of_arguments, Fcons (fun, Fcons (lisp_numargs, Qnil))); 2888 Fsignal (Qwrong_number_of_arguments, list2 (original_fun, lisp_numargs));
2878 } 2889 }
2879 2890
2880 if (XSUBR (fun)->max_args == UNEVALLED) 2891 if (XSUBR (fun)->max_args == UNEVALLED)
2881 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2892 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2882 2893
2883 if (XSUBR (fun)->max_args == MANY) 2894 if (XSUBR (fun)->max_args == MANY)
2884 { 2895 {
@@ -2950,21 +2961,23 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2950 val = funcall_lambda (fun, numargs, args + 1); 2961 val = funcall_lambda (fun, numargs, args + 1);
2951 else 2962 else
2952 { 2963 {
2964 if (EQ (fun, Qunbound))
2965 Fsignal (Qvoid_function, Fcons (original_fun, Qnil));
2953 if (!CONSP (fun)) 2966 if (!CONSP (fun))
2954 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2967 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2955 funcar = Fcar (fun); 2968 funcar = Fcar (fun);
2956 if (!SYMBOLP (funcar)) 2969 if (!SYMBOLP (funcar))
2957 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2970 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2958 if (EQ (funcar, Qlambda)) 2971 if (EQ (funcar, Qlambda))
2959 val = funcall_lambda (fun, numargs, args + 1); 2972 val = funcall_lambda (fun, numargs, args + 1);
2960 else if (EQ (funcar, Qautoload)) 2973 else if (EQ (funcar, Qautoload))
2961 { 2974 {
2962 do_autoload (fun, args[0]); 2975 do_autoload (fun, original_fun);
2963 CHECK_CONS_LIST (); 2976 CHECK_CONS_LIST ();
2964 goto retry; 2977 goto retry;
2965 } 2978 }
2966 else 2979 else
2967 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 2980 Fsignal (Qinvalid_function, Fcons (original_fun, Qnil));
2968 } 2981 }
2969 done: 2982 done:
2970 CHECK_CONS_LIST (); 2983 CHECK_CONS_LIST ();
@@ -3040,7 +3053,7 @@ funcall_lambda (fun, nargs, arg_vector)
3040 if (CONSP (syms_left)) 3053 if (CONSP (syms_left))
3041 syms_left = XCAR (syms_left); 3054 syms_left = XCAR (syms_left);
3042 else 3055 else
3043 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3056 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
3044 } 3057 }
3045 else if (COMPILEDP (fun)) 3058 else if (COMPILEDP (fun))
3046 syms_left = AREF (fun, COMPILED_ARGLIST); 3059 syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3053,8 +3066,8 @@ funcall_lambda (fun, nargs, arg_vector)
3053 QUIT; 3066 QUIT;
3054 3067
3055 next = XCAR (syms_left); 3068 next = XCAR (syms_left);
3056 while (!SYMBOLP (next)) 3069 if (!SYMBOLP (next))
3057 next = Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3070 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
3058 3071
3059 if (EQ (next, Qand_rest)) 3072 if (EQ (next, Qand_rest))
3060 rest = 1; 3073 rest = 1;
@@ -3068,17 +3081,15 @@ funcall_lambda (fun, nargs, arg_vector)
3068 else if (i < nargs) 3081 else if (i < nargs)
3069 specbind (next, arg_vector[i++]); 3082 specbind (next, arg_vector[i++]);
3070 else if (!optional) 3083 else if (!optional)
3071 return Fsignal (Qwrong_number_of_arguments, 3084 Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs)));
3072 Fcons (fun, Fcons (make_number (nargs), Qnil)));
3073 else 3085 else
3074 specbind (next, Qnil); 3086 specbind (next, Qnil);
3075 } 3087 }
3076 3088
3077 if (!NILP (syms_left)) 3089 if (!NILP (syms_left))
3078 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 3090 Fsignal (Qinvalid_function, Fcons (fun, Qnil));
3079 else if (i < nargs) 3091 else if (i < nargs)
3080 return Fsignal (Qwrong_number_of_arguments, 3092 Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs)));
3081 Fcons (fun, Fcons (make_number (nargs), Qnil)));
3082 3093
3083 if (CONSP (fun)) 3094 if (CONSP (fun))
3084 val = Fprogn (XCDR (XCDR (fun))); 3095 val = Fprogn (XCDR (XCDR (fun)));