diff options
| author | Karoly Lorentey | 2006-07-29 09:59:12 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-07-29 09:59:12 +0000 |
| commit | 251bc578cc636223d618d06cf2a2bb7d07db9cce (patch) | |
| tree | 58e1c6b0a35bb4a77e6cb77876e4bc6a9d3f2ab2 /src/eval.c | |
| parent | 99715bbc447eb633e45ffa23b87284771ce3ac74 (diff) | |
| parent | 0ed0527cb02180a50f6744086ce3a487740c73e4 (diff) | |
| download | emacs-251bc578cc636223d618d06cf2a2bb7d07db9cce.tar.gz emacs-251bc578cc636223d618d06cf2a2bb7d07db9cce.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-351
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-352
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-353
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-354
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-355
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-356
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-357
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-358
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-359
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-360
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-361
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-362
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-363
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-364
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-365
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-366
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-367
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-368
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-369
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-370
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-115
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-116
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-117
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-118
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-119
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-120
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-573
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 126 |
1 files changed, 96 insertions, 30 deletions
diff --git a/src/eval.c b/src/eval.c index a07ab32e76b..0d7a6a31038 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -198,6 +198,7 @@ Lisp_Object Vmacro_declaration_function; | |||
| 198 | extern Lisp_Object Qrisky_local_variable; | 198 | extern Lisp_Object Qrisky_local_variable; |
| 199 | 199 | ||
| 200 | static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*)); | 200 | static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*)); |
| 201 | static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN; | ||
| 201 | 202 | ||
| 202 | void | 203 | void |
| 203 | init_eval_once () | 204 | init_eval_once () |
| @@ -983,9 +984,7 @@ usage: (let* VARLIST BODY...) */) | |||
| 983 | if (SYMBOLP (elt)) | 984 | if (SYMBOLP (elt)) |
| 984 | specbind (elt, Qnil); | 985 | specbind (elt, Qnil); |
| 985 | else if (! NILP (Fcdr (Fcdr (elt)))) | 986 | else if (! NILP (Fcdr (Fcdr (elt)))) |
| 986 | Fsignal (Qerror, | 987 | signal_error ("`let' bindings can have only one value-form", elt); |
| 987 | Fcons (build_string ("`let' bindings can have only one value-form"), | ||
| 988 | elt)); | ||
| 989 | else | 988 | else |
| 990 | { | 989 | { |
| 991 | val = Feval (Fcar (Fcdr (elt))); | 990 | val = Feval (Fcar (Fcdr (elt))); |
| @@ -1032,9 +1031,7 @@ usage: (let VARLIST BODY...) */) | |||
| 1032 | if (SYMBOLP (elt)) | 1031 | if (SYMBOLP (elt)) |
| 1033 | temps [argnum++] = Qnil; | 1032 | temps [argnum++] = Qnil; |
| 1034 | else if (! NILP (Fcdr (Fcdr (elt)))) | 1033 | else if (! NILP (Fcdr (Fcdr (elt)))) |
| 1035 | Fsignal (Qerror, | 1034 | signal_error ("`let' bindings can have only one value-form", elt); |
| 1036 | Fcons (build_string ("`let' bindings can have only one value-form"), | ||
| 1037 | elt)); | ||
| 1038 | else | 1035 | else |
| 1039 | temps [argnum++] = Feval (Fcar (Fcdr (elt))); | 1036 | temps [argnum++] = Feval (Fcar (Fcdr (elt))); |
| 1040 | gcpro2.nvars = argnum; | 1037 | gcpro2.nvars = argnum; |
| @@ -1295,8 +1292,7 @@ Both TAG and VALUE are evalled. */) | |||
| 1295 | if (EQ (c->tag, tag)) | 1292 | if (EQ (c->tag, tag)) |
| 1296 | unwind_to_catch (c, value); | 1293 | unwind_to_catch (c, value); |
| 1297 | } | 1294 | } |
| 1298 | Fsignal (Qno_catch, list2 (tag, value)); | 1295 | xsignal2 (Qno_catch, tag, value); |
| 1299 | abort (); | ||
| 1300 | } | 1296 | } |
| 1301 | 1297 | ||
| 1302 | 1298 | ||
| @@ -1704,6 +1700,78 @@ See also the function `condition-case'. */) | |||
| 1704 | fatal ("%s", SDATA (string), 0); | 1700 | fatal ("%s", SDATA (string), 0); |
| 1705 | } | 1701 | } |
| 1706 | 1702 | ||
| 1703 | /* Internal version of Fsignal that never returns. | ||
| 1704 | Used for anything but Qquit (which can return from Fsignal). */ | ||
| 1705 | |||
| 1706 | void | ||
| 1707 | xsignal (error_symbol, data) | ||
| 1708 | Lisp_Object error_symbol, data; | ||
| 1709 | { | ||
| 1710 | Fsignal (error_symbol, data); | ||
| 1711 | abort (); | ||
| 1712 | } | ||
| 1713 | |||
| 1714 | /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ | ||
| 1715 | |||
| 1716 | void | ||
| 1717 | xsignal0 (error_symbol) | ||
| 1718 | Lisp_Object error_symbol; | ||
| 1719 | { | ||
| 1720 | xsignal (error_symbol, Qnil); | ||
| 1721 | } | ||
| 1722 | |||
| 1723 | void | ||
| 1724 | xsignal1 (error_symbol, arg) | ||
| 1725 | Lisp_Object error_symbol, arg; | ||
| 1726 | { | ||
| 1727 | xsignal (error_symbol, list1 (arg)); | ||
| 1728 | } | ||
| 1729 | |||
| 1730 | void | ||
| 1731 | xsignal2 (error_symbol, arg1, arg2) | ||
| 1732 | Lisp_Object error_symbol, arg1, arg2; | ||
| 1733 | { | ||
| 1734 | xsignal (error_symbol, list2 (arg1, arg2)); | ||
| 1735 | } | ||
| 1736 | |||
| 1737 | void | ||
| 1738 | xsignal3 (error_symbol, arg1, arg2, arg3) | ||
| 1739 | Lisp_Object error_symbol, arg1, arg2, arg3; | ||
| 1740 | { | ||
| 1741 | xsignal (error_symbol, list3 (arg1, arg2, arg3)); | ||
| 1742 | } | ||
| 1743 | |||
| 1744 | /* Signal `error' with message S, and additional arg ARG. | ||
| 1745 | If ARG is not a genuine list, make it a one-element list. */ | ||
| 1746 | |||
| 1747 | void | ||
| 1748 | signal_error (s, arg) | ||
| 1749 | char *s; | ||
| 1750 | Lisp_Object arg; | ||
| 1751 | { | ||
| 1752 | Lisp_Object tortoise, hare; | ||
| 1753 | |||
| 1754 | hare = tortoise = arg; | ||
| 1755 | while (CONSP (hare)) | ||
| 1756 | { | ||
| 1757 | hare = XCDR (hare); | ||
| 1758 | if (!CONSP (hare)) | ||
| 1759 | break; | ||
| 1760 | |||
| 1761 | hare = XCDR (hare); | ||
| 1762 | tortoise = XCDR (tortoise); | ||
| 1763 | |||
| 1764 | if (EQ (hare, tortoise)) | ||
| 1765 | break; | ||
| 1766 | } | ||
| 1767 | |||
| 1768 | if (!NILP (hare)) | ||
| 1769 | arg = Fcons (arg, Qnil); /* Make it a list. */ | ||
| 1770 | |||
| 1771 | xsignal (Qerror, Fcons (build_string (s), arg)); | ||
| 1772 | } | ||
| 1773 | |||
| 1774 | |||
| 1707 | /* Return nonzero iff LIST is a non-nil atom or | 1775 | /* Return nonzero iff LIST is a non-nil atom or |
| 1708 | a list containing one of CONDITIONS. */ | 1776 | a list containing one of CONDITIONS. */ |
| 1709 | 1777 | ||
| @@ -1918,8 +1986,7 @@ error (m, a1, a2, a3) | |||
| 1918 | if (allocated) | 1986 | if (allocated) |
| 1919 | xfree (buffer); | 1987 | xfree (buffer); |
| 1920 | 1988 | ||
| 1921 | Fsignal (Qerror, Fcons (string, Qnil)); | 1989 | xsignal1 (Qerror, string); |
| 1922 | abort (); | ||
| 1923 | } | 1990 | } |
| 1924 | 1991 | ||
| 1925 | DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, | 1992 | DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, |
| @@ -2185,7 +2252,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2185 | 2252 | ||
| 2186 | if (XINT (numargs) < XSUBR (fun)->min_args || | 2253 | if (XINT (numargs) < XSUBR (fun)->min_args || |
| 2187 | (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) | 2254 | (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < XINT (numargs))) |
| 2188 | Fsignal (Qwrong_number_of_arguments, list2 (original_fun, numargs)); | 2255 | xsignal2 (Qwrong_number_of_arguments, original_fun, numargs); |
| 2189 | 2256 | ||
| 2190 | if (XSUBR (fun)->max_args == UNEVALLED) | 2257 | if (XSUBR (fun)->max_args == UNEVALLED) |
| 2191 | { | 2258 | { |
| @@ -2289,12 +2356,12 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2289 | else | 2356 | else |
| 2290 | { | 2357 | { |
| 2291 | if (EQ (fun, Qunbound)) | 2358 | if (EQ (fun, Qunbound)) |
| 2292 | Fsignal (Qvoid_function, Fcons (original_fun, Qnil)); | 2359 | xsignal1 (Qvoid_function, original_fun); |
| 2293 | if (!CONSP (fun)) | 2360 | if (!CONSP (fun)) |
| 2294 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 2361 | xsignal1 (Qinvalid_function, original_fun); |
| 2295 | funcar = Fcar (fun); | 2362 | funcar = XCAR (fun); |
| 2296 | if (!SYMBOLP (funcar)) | 2363 | if (!SYMBOLP (funcar)) |
| 2297 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 2364 | xsignal1 (Qinvalid_function, original_fun); |
| 2298 | if (EQ (funcar, Qautoload)) | 2365 | if (EQ (funcar, Qautoload)) |
| 2299 | { | 2366 | { |
| 2300 | do_autoload (fun, original_fun); | 2367 | do_autoload (fun, original_fun); |
| @@ -2305,7 +2372,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2305 | else if (EQ (funcar, Qlambda)) | 2372 | else if (EQ (funcar, Qlambda)) |
| 2306 | val = apply_lambda (fun, original_args, 1); | 2373 | val = apply_lambda (fun, original_args, 1); |
| 2307 | else | 2374 | else |
| 2308 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 2375 | xsignal1 (Qinvalid_function, original_fun); |
| 2309 | } | 2376 | } |
| 2310 | done: | 2377 | done: |
| 2311 | CHECK_CONS_LIST (); | 2378 | CHECK_CONS_LIST (); |
| @@ -2885,11 +2952,11 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2885 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) | 2952 | || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) |
| 2886 | { | 2953 | { |
| 2887 | XSETFASTINT (lisp_numargs, numargs); | 2954 | XSETFASTINT (lisp_numargs, numargs); |
| 2888 | Fsignal (Qwrong_number_of_arguments, list2 (original_fun, lisp_numargs)); | 2955 | xsignal2 (Qwrong_number_of_arguments, original_fun, lisp_numargs); |
| 2889 | } | 2956 | } |
| 2890 | 2957 | ||
| 2891 | if (XSUBR (fun)->max_args == UNEVALLED) | 2958 | if (XSUBR (fun)->max_args == UNEVALLED) |
| 2892 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 2959 | xsignal1 (Qinvalid_function, original_fun); |
| 2893 | 2960 | ||
| 2894 | if (XSUBR (fun)->max_args == MANY) | 2961 | if (XSUBR (fun)->max_args == MANY) |
| 2895 | { | 2962 | { |
| @@ -2962,12 +3029,12 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2962 | else | 3029 | else |
| 2963 | { | 3030 | { |
| 2964 | if (EQ (fun, Qunbound)) | 3031 | if (EQ (fun, Qunbound)) |
| 2965 | Fsignal (Qvoid_function, Fcons (original_fun, Qnil)); | 3032 | xsignal1 (Qvoid_function, original_fun); |
| 2966 | if (!CONSP (fun)) | 3033 | if (!CONSP (fun)) |
| 2967 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 3034 | xsignal1 (Qinvalid_function, original_fun); |
| 2968 | funcar = Fcar (fun); | 3035 | funcar = XCAR (fun); |
| 2969 | if (!SYMBOLP (funcar)) | 3036 | if (!SYMBOLP (funcar)) |
| 2970 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 3037 | xsignal1 (Qinvalid_function, original_fun); |
| 2971 | if (EQ (funcar, Qlambda)) | 3038 | if (EQ (funcar, Qlambda)) |
| 2972 | val = funcall_lambda (fun, numargs, args + 1); | 3039 | val = funcall_lambda (fun, numargs, args + 1); |
| 2973 | else if (EQ (funcar, Qautoload)) | 3040 | else if (EQ (funcar, Qautoload)) |
| @@ -2977,7 +3044,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2977 | goto retry; | 3044 | goto retry; |
| 2978 | } | 3045 | } |
| 2979 | else | 3046 | else |
| 2980 | Fsignal (Qinvalid_function, Fcons (original_fun, Qnil)); | 3047 | xsignal1 (Qinvalid_function, original_fun); |
| 2981 | } | 3048 | } |
| 2982 | done: | 3049 | done: |
| 2983 | CHECK_CONS_LIST (); | 3050 | CHECK_CONS_LIST (); |
| @@ -3053,7 +3120,7 @@ funcall_lambda (fun, nargs, arg_vector) | |||
| 3053 | if (CONSP (syms_left)) | 3120 | if (CONSP (syms_left)) |
| 3054 | syms_left = XCAR (syms_left); | 3121 | syms_left = XCAR (syms_left); |
| 3055 | else | 3122 | else |
| 3056 | Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | 3123 | xsignal1 (Qinvalid_function, fun); |
| 3057 | } | 3124 | } |
| 3058 | else if (COMPILEDP (fun)) | 3125 | else if (COMPILEDP (fun)) |
| 3059 | syms_left = AREF (fun, COMPILED_ARGLIST); | 3126 | syms_left = AREF (fun, COMPILED_ARGLIST); |
| @@ -3067,7 +3134,7 @@ funcall_lambda (fun, nargs, arg_vector) | |||
| 3067 | 3134 | ||
| 3068 | next = XCAR (syms_left); | 3135 | next = XCAR (syms_left); |
| 3069 | if (!SYMBOLP (next)) | 3136 | if (!SYMBOLP (next)) |
| 3070 | Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | 3137 | xsignal1 (Qinvalid_function, fun); |
| 3071 | 3138 | ||
| 3072 | if (EQ (next, Qand_rest)) | 3139 | if (EQ (next, Qand_rest)) |
| 3073 | rest = 1; | 3140 | rest = 1; |
| @@ -3081,15 +3148,15 @@ funcall_lambda (fun, nargs, arg_vector) | |||
| 3081 | else if (i < nargs) | 3148 | else if (i < nargs) |
| 3082 | specbind (next, arg_vector[i++]); | 3149 | specbind (next, arg_vector[i++]); |
| 3083 | else if (!optional) | 3150 | else if (!optional) |
| 3084 | Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs))); | 3151 | xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs)); |
| 3085 | else | 3152 | else |
| 3086 | specbind (next, Qnil); | 3153 | specbind (next, Qnil); |
| 3087 | } | 3154 | } |
| 3088 | 3155 | ||
| 3089 | if (!NILP (syms_left)) | 3156 | if (!NILP (syms_left)) |
| 3090 | Fsignal (Qinvalid_function, Fcons (fun, Qnil)); | 3157 | xsignal1 (Qinvalid_function, fun); |
| 3091 | else if (i < nargs) | 3158 | else if (i < nargs) |
| 3092 | Fsignal (Qwrong_number_of_arguments, list2 (fun, make_number (nargs))); | 3159 | xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs)); |
| 3093 | 3160 | ||
| 3094 | if (CONSP (fun)) | 3161 | if (CONSP (fun)) |
| 3095 | val = Fprogn (XCDR (XCDR (fun))); | 3162 | val = Fprogn (XCDR (XCDR (fun))); |
| @@ -3141,8 +3208,7 @@ grow_specpdl () | |||
| 3141 | if (max_specpdl_size < 400) | 3208 | if (max_specpdl_size < 400) |
| 3142 | max_specpdl_size = 400; | 3209 | max_specpdl_size = 400; |
| 3143 | if (specpdl_size >= max_specpdl_size) | 3210 | if (specpdl_size >= max_specpdl_size) |
| 3144 | Fsignal (Qerror, | 3211 | signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); |
| 3145 | Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil)); | ||
| 3146 | } | 3212 | } |
| 3147 | specpdl_size *= 2; | 3213 | specpdl_size *= 2; |
| 3148 | if (specpdl_size > max_specpdl_size) | 3214 | if (specpdl_size > max_specpdl_size) |