Mercurial > emacs
comparison src/callint.c @ 9145:dda75a4dbbfb
(quotify_arg, Fcall_interactively, Fprefix_numeric_value): Use type test
macros.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 27 Sep 1994 03:27:31 +0000 |
parents | 7dacd83e0fe0 |
children | 27aad4f82051 |
comparison
equal
deleted
inserted
replaced
9144:0e29f6a4fe7c | 9145:dda75a4dbbfb |
---|---|
112 If EXP is not constant, return (quote EXP). */ | 112 If EXP is not constant, return (quote EXP). */ |
113 Lisp_Object | 113 Lisp_Object |
114 quotify_arg (exp) | 114 quotify_arg (exp) |
115 register Lisp_Object exp; | 115 register Lisp_Object exp; |
116 { | 116 { |
117 if (XTYPE (exp) != Lisp_Int && XTYPE (exp) != Lisp_String | 117 if (!INTEGERP (exp) && !STRINGP (exp) |
118 && !NILP (exp) && !EQ (exp, Qt)) | 118 && !NILP (exp) && !EQ (exp, Qt)) |
119 return Fcons (Qquote, Fcons (exp, Qnil)); | 119 return Fcons (Qquote, Fcons (exp, Qnil)); |
120 | 120 |
121 return exp; | 121 return exp; |
122 } | 122 } |
198 /* Save this now, since use of minibuffer will clobber it. */ | 198 /* Save this now, since use of minibuffer will clobber it. */ |
199 prefix_arg = Vcurrent_prefix_arg; | 199 prefix_arg = Vcurrent_prefix_arg; |
200 | 200 |
201 retry: | 201 retry: |
202 | 202 |
203 if (XTYPE (function) == Lisp_Symbol) | 203 if (SYMBOLP (function)) |
204 enable = Fget (function, Qenable_recursive_minibuffers); | 204 enable = Fget (function, Qenable_recursive_minibuffers); |
205 | 205 |
206 fun = indirect_function (function); | 206 fun = indirect_function (function); |
207 | 207 |
208 specs = Qnil; | 208 specs = Qnil; |
210 | 210 |
211 /* Decode the kind of function. Either handle it and return, | 211 /* Decode the kind of function. Either handle it and return, |
212 or go to `lose' if not interactive, or go to `retry' | 212 or go to `lose' if not interactive, or go to `retry' |
213 to specify a different function, or set either STRING or SPECS. */ | 213 to specify a different function, or set either STRING or SPECS. */ |
214 | 214 |
215 if (XTYPE (fun) == Lisp_Subr) | 215 if (SUBRP (fun)) |
216 { | 216 { |
217 string = (unsigned char *) XSUBR (fun)->prompt; | 217 string = (unsigned char *) XSUBR (fun)->prompt; |
218 if (!string) | 218 if (!string) |
219 { | 219 { |
220 lose: | 220 lose: |
223 } | 223 } |
224 if ((EMACS_INT) string == 1) | 224 if ((EMACS_INT) string == 1) |
225 /* Let SPECS (which is nil) be used as the args. */ | 225 /* Let SPECS (which is nil) be used as the args. */ |
226 string = 0; | 226 string = 0; |
227 } | 227 } |
228 else if (XTYPE (fun) == Lisp_Compiled) | 228 else if (COMPILEDP (fun)) |
229 { | 229 { |
230 if (XVECTOR (fun)->size <= COMPILED_INTERACTIVE) | 230 if (XVECTOR (fun)->size <= COMPILED_INTERACTIVE) |
231 goto lose; | 231 goto lose; |
232 specs = XVECTOR (fun)->contents[COMPILED_INTERACTIVE]; | 232 specs = XVECTOR (fun)->contents[COMPILED_INTERACTIVE]; |
233 } | 233 } |
251 return ml_apply (fun, Qinteractive); | 251 return ml_apply (fun, Qinteractive); |
252 else | 252 else |
253 goto lose; | 253 goto lose; |
254 | 254 |
255 /* If either specs or string is set to a string, use it. */ | 255 /* If either specs or string is set to a string, use it. */ |
256 if (XTYPE (specs) == Lisp_String) | 256 if (STRINGP (specs)) |
257 { | 257 { |
258 /* Make a copy of string so that if a GC relocates specs, | 258 /* Make a copy of string so that if a GC relocates specs, |
259 `string' will still be valid. */ | 259 `string' will still be valid. */ |
260 string = (unsigned char *) alloca (XSTRING (specs)->size + 1); | 260 string = (unsigned char *) alloca (XSTRING (specs)->size + 1); |
261 bcopy (XSTRING (specs)->data, string, XSTRING (specs)->size + 1); | 261 bcopy (XSTRING (specs)->data, string, XSTRING (specs)->size + 1); |
327 { | 327 { |
328 Lisp_Object event; | 328 Lisp_Object event; |
329 | 329 |
330 event = XVECTOR (this_command_keys)->contents[next_event]; | 330 event = XVECTOR (this_command_keys)->contents[next_event]; |
331 if (EVENT_HAS_PARAMETERS (event) | 331 if (EVENT_HAS_PARAMETERS (event) |
332 && XTYPE (event = XCONS (event)->cdr) == Lisp_Cons | 332 && (event = XCONS (event)->car, CONSP (event)) |
333 && XTYPE (event = XCONS (event)->car) == Lisp_Cons | 333 && (event = XCONS (event)->car, CONSP (event)) |
334 && XTYPE (event = XCONS (event)->car) == Lisp_Window) | 334 && (event = XCONS (event)->car), WINDOWP (event)) |
335 { | 335 { |
336 if (MINI_WINDOW_P (XWINDOW (event)) | 336 if (MINI_WINDOW_P (XWINDOW (event)) |
337 && ! (minibuf_level > 0 && EQ (event, minibuf_window))) | 337 && ! (minibuf_level > 0 && EQ (event, minibuf_window))) |
338 error ("Attempt to select inactive minibuffer window"); | 338 error ("Attempt to select inactive minibuffer window"); |
339 Fselect_window (event); | 339 Fselect_window (event); |
462 break; | 462 break; |
463 | 463 |
464 case 'e': /* The invoking event. */ | 464 case 'e': /* The invoking event. */ |
465 if (next_event >= this_command_key_count) | 465 if (next_event >= this_command_key_count) |
466 error ("%s must be bound to an event with parameters", | 466 error ("%s must be bound to an event with parameters", |
467 (XTYPE (function) == Lisp_Symbol | 467 (SYMBOLP (function) |
468 ? (char *) XSYMBOL (function)->name->data | 468 ? (char *) XSYMBOL (function)->name->data |
469 : "command")); | 469 : "command")); |
470 args[i] = XVECTOR (this_command_keys)->contents[next_event++]; | 470 args[i] = XVECTOR (this_command_keys)->contents[next_event++]; |
471 varies[i] = -1; | 471 varies[i] = -1; |
472 | 472 |
552 } | 552 } |
553 | 553 |
554 if (varies[i] == 0) | 554 if (varies[i] == 0) |
555 arg_from_tty = 1; | 555 arg_from_tty = 1; |
556 | 556 |
557 if (NILP (visargs[i]) && XTYPE (args[i]) == Lisp_String) | 557 if (NILP (visargs[i]) && STRINGP (args[i])) |
558 visargs[i] = args[i]; | 558 visargs[i] = args[i]; |
559 | 559 |
560 tem = (unsigned char *) index (tem, '\n'); | 560 tem = (unsigned char *) index (tem, '\n'); |
561 if (tem) tem++; | 561 if (tem) tem++; |
562 else tem = (unsigned char *) ""; | 562 else tem = (unsigned char *) ""; |
607 XFASTINT (val) = 1; | 607 XFASTINT (val) = 1; |
608 else if (EQ (raw, Qminus)) | 608 else if (EQ (raw, Qminus)) |
609 XSETINT (val, -1); | 609 XSETINT (val, -1); |
610 else if (CONSP (raw)) | 610 else if (CONSP (raw)) |
611 XSETINT (val, XINT (XCONS (raw)->car)); | 611 XSETINT (val, XINT (XCONS (raw)->car)); |
612 else if (XTYPE (raw) == Lisp_Int) | 612 else if (INTEGERP (raw)) |
613 val = raw; | 613 val = raw; |
614 else | 614 else |
615 XFASTINT (val) = 1; | 615 XFASTINT (val) = 1; |
616 | 616 |
617 return val; | 617 return val; |