comparison src/eval.c @ 5084:6afe991b8135

Add a PARSE_KEYWORDS macro, use it in #'make-hash-table. lisp/ChangeLog addition: 2010-03-01 Aidan Kehoe <kehoea@parhasard.net> * cl-seq.el (cl-parsing-keywords): * cl-macs.el (cl-do-arglist): Use the new invalid-keyword-argument error here. src/ChangeLog addition: 2010-03-01 Aidan Kehoe <kehoea@parhasard.net> * lisp.h (PARSE_KEYWORDS): New macro, for parsing keyword arguments from C subrs. * elhash.c (Fmake_hash_table): Use it. * general-slots.h (Q_allow_other_keys): Add this symbol. * eval.c (non_nil_allow_other_keys_p): (invalid_keyword_argument): New functions, called from the keyword argument parsing code. * data.c (init_errors_once_early): Add the new invalid-keyword-argument error here.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 01 Mar 2010 21:05:33 +0000
parents 6f2158fa75ed
children 47bcef7b0b44
comparison
equal deleted inserted replaced
5083:88f955fa5a7f 5084:6afe991b8135
415 #endif 415 #endif
416 416
417 static int warning_will_be_discarded (Lisp_Object level); 417 static int warning_will_be_discarded (Lisp_Object level);
418 static Lisp_Object maybe_get_trapping_problems_backtrace (void); 418 static Lisp_Object maybe_get_trapping_problems_backtrace (void);
419 419
420
421
422 /* When parsing keyword arguments; is some element of NARGS
423 :allow-other-keys, and is that element followed by a non-nil Lisp
424 object? */
425
426 Boolint
427 non_nil_allow_other_keys_p (Elemcount offset, int nargs, Lisp_Object *args)
428 {
429 Lisp_Object key, value;
430 while (offset + 1 < nargs)
431 {
432 key = args[offset++];
433 value = args[offset++];
434 if (EQ (key, Q_allow_other_keys))
435 {
436 /* The ANSI Common Lisp standard says the first value for a given
437 keyword overrides. */
438 return !NILP (value);
439 }
440 }
441 return 0;
442 }
420 443
421 /************************************************************************/ 444 /************************************************************************/
422 /* The subr object type */ 445 /* The subr object type */
423 /************************************************************************/ 446 /************************************************************************/
424 447
3048 { 3071 {
3049 maybe_signal_error (Qinvalid_argument, reason, frob, class_, errb); 3072 maybe_signal_error (Qinvalid_argument, reason, frob, class_, errb);
3050 } 3073 }
3051 3074
3052 DOESNT_RETURN 3075 DOESNT_RETURN
3076 invalid_keyword_argument (Lisp_Object function, Lisp_Object keyword)
3077 {
3078 signal_error_1 (Qinvalid_keyword_argument, list2 (function, keyword));
3079 }
3080
3081 DOESNT_RETURN
3053 invalid_constant (const Ascbyte *reason, Lisp_Object frob) 3082 invalid_constant (const Ascbyte *reason, Lisp_Object frob)
3054 { 3083 {
3055 signal_error (Qinvalid_constant, reason, frob); 3084 signal_error (Qinvalid_constant, reason, frob);
3056 } 3085 }
3057 3086