Mercurial > emacs
comparison src/eval.c @ 5563:50ada322de3e
(Fcondition_case): Allow a list of condition names in a handler.
(find_handler_clause): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 11 Jan 1994 07:22:11 +0000 |
parents | b38b74fe1722 |
children | e2925466c923 |
comparison
equal
deleted
inserted
replaced
5562:2b3d2ea74ce1 | 5563:50ada322de3e |
---|---|
1011 | 1011 |
1012 for (val = handlers; ! NILP (val); val = Fcdr (val)) | 1012 for (val = handlers; ! NILP (val); val = Fcdr (val)) |
1013 { | 1013 { |
1014 Lisp_Object tem; | 1014 Lisp_Object tem; |
1015 tem = Fcar (val); | 1015 tem = Fcar (val); |
1016 if ((!NILP (tem)) && | 1016 if (! (NILP (tem) |
1017 (!CONSP (tem) || (XTYPE (XCONS (tem)->car) != Lisp_Symbol))) | 1017 || (CONSP (tem) |
1018 && (SYMBOLP (XCONS (tem)->car) | |
1019 || CONSP (XCONS (tem)->car))))) | |
1018 error ("Invalid condition handler", tem); | 1020 error ("Invalid condition handler", tem); |
1019 } | 1021 } |
1020 | 1022 |
1021 c.tag = Qnil; | 1023 c.tag = Qnil; |
1022 c.val = Qnil; | 1024 c.val = Qnil; |
1193 Lisp_Object handlers, conditions, sig, data; | 1195 Lisp_Object handlers, conditions, sig, data; |
1194 Lisp_Object *debugger_value_ptr; | 1196 Lisp_Object *debugger_value_ptr; |
1195 { | 1197 { |
1196 register Lisp_Object h; | 1198 register Lisp_Object h; |
1197 register Lisp_Object tem; | 1199 register Lisp_Object tem; |
1198 register Lisp_Object tem1; | |
1199 | 1200 |
1200 if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ | 1201 if (EQ (handlers, Qt)) /* t is used by handlers for all conditions, set up by C code. */ |
1201 return Qt; | 1202 return Qt; |
1202 if (EQ (handlers, Qerror)) /* error is used similarly, but means display a backtrace too */ | 1203 if (EQ (handlers, Qerror)) /* error is used similarly, but means display a backtrace too */ |
1203 { | 1204 { |
1218 } | 1219 } |
1219 return Qt; | 1220 return Qt; |
1220 } | 1221 } |
1221 for (h = handlers; CONSP (h); h = Fcdr (h)) | 1222 for (h = handlers; CONSP (h); h = Fcdr (h)) |
1222 { | 1223 { |
1223 tem1 = Fcar (h); | 1224 Lisp_Object handler, condit; |
1224 if (!CONSP (tem1)) | 1225 |
1226 handler = Fcar (h); | |
1227 if (!CONSP (handler)) | |
1225 continue; | 1228 continue; |
1226 tem = Fmemq (Fcar (tem1), conditions); | 1229 condit = Fcar (handler); |
1227 if (!NILP (tem)) | 1230 /* Handle a single condition name in handler HANDLER. */ |
1228 return tem1; | 1231 if (SYMBOLP (condit)) |
1232 { | |
1233 tem = Fmemq (Fcar (handler), conditions); | |
1234 if (!NILP (tem)) | |
1235 return handler; | |
1236 } | |
1237 /* Handle a list of condition names in handler HANDLER. */ | |
1238 else if (CONSP (condit)) | |
1239 { | |
1240 while (CONSP (condit)) | |
1241 { | |
1242 tem = Fmemq (Fcar (condit), conditions); | |
1243 if (!NILP (tem)) | |
1244 return handler; | |
1245 condit = XCONS (condit)->cdr; | |
1246 } | |
1247 } | |
1229 } | 1248 } |
1230 return Qnil; | 1249 return Qnil; |
1231 } | 1250 } |
1232 | 1251 |
1233 /* dump an error message; called like printf */ | 1252 /* dump an error message; called like printf */ |