comparison src/lisp.h @ 5280:59a6419f7504

Use GET_DEFUN_LISP_OBJECT() in PARSE_KEYWORDS(), fix former under NEW_GC. 2010-09-20 Aidan Kehoe <kehoea@parhasard.net> * lisp.h (GET_DEFUN_LISP_OBJECT): Make the NEW_GC version of this work, remove a needless and unhelpful semicolon. (GET_DEFUN_LISP_OBJECT): Remove a needless semicolon from the non-NEW_GC version of this. (PARSE_KEYWORDS): Fix the indentation for the DEBUG_XEMACS version of this macro. (PARSE_KEYWORDS): Use GET_DEFUN_LISP_OBJECT() for both the NEW_GC and non-NEW_GC versions of this macro, when working out the function's min args.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 20 Sep 2010 23:22:50 +0100
parents d0bc331e433f
children c096d8051f89 308d34e9f07d
comparison
equal deleted inserted replaced
5279:d0bc331e433f 5280:59a6419f7504
3402 (lisp_fn_t) Fname \ 3402 (lisp_fn_t) Fname \
3403 }; \ 3403 }; \
3404 static struct Lisp_Subr *S##Fname; \ 3404 static struct Lisp_Subr *S##Fname; \
3405 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) 3405 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist)
3406 #define GET_DEFUN_LISP_OBJECT(Fname) \ 3406 #define GET_DEFUN_LISP_OBJECT(Fname) \
3407 wrap_subr (S##Fname); 3407 wrap_subr (&MC_ALLOC_S##Fname)
3408 #else /* not NEW_GC */ 3408 #else /* not NEW_GC */
3409 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \ 3409 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist) \
3410 Lisp_Object Fname (EXFUN_##max_args); \ 3410 Lisp_Object Fname (EXFUN_##max_args); \
3411 static struct Lisp_Subr S##Fname = \ 3411 static struct Lisp_Subr S##Fname = \
3412 { \ 3412 { \
3442 lname, \ 3442 lname, \
3443 (lisp_fn_t) Fname \ 3443 (lisp_fn_t) Fname \
3444 }; \ 3444 }; \
3445 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist) 3445 DOESNT_RETURN_TYPE (Lisp_Object) Fname (DEFUN_##max_args arglist)
3446 #define GET_DEFUN_LISP_OBJECT(Fname) \ 3446 #define GET_DEFUN_LISP_OBJECT(Fname) \
3447 wrap_subr (&S##Fname); 3447 wrap_subr (&S##Fname)
3448 #endif /* not NEW_GC */ 3448 #endif /* not NEW_GC */
3449 3449
3450 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a 3450 /* Heavy ANSI C preprocessor hackery to get DEFUN to declare a
3451 prototype that matches max_args, and add the obligatory 3451 prototype that matches max_args, and add the obligatory
3452 `Lisp_Object' type declaration to the formal C arguments. */ 3452 `Lisp_Object' type declaration to the formal C arguments. */
3542 another function without changing FUNCTION; that would lead to an 3542 another function without changing FUNCTION; that would lead to an
3543 incorrect determination of KEYWORDS_OFFSET. */ 3543 incorrect determination of KEYWORDS_OFFSET. */
3544 3544
3545 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \ 3545 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \
3546 keyword_defaults) \ 3546 keyword_defaults) \
3547 PARSE_KEYWORDS_8 (intern_massaging_name (1 + #function), \ 3547 PARSE_KEYWORDS_8 (intern_massaging_name (1 + #function), nargs, args, \
3548 nargs, args, \ 3548 keyword_count, keywords, keyword_defaults, \
3549 keyword_count, keywords, \ 3549 /* Can't XSUBR (Fsymbol_function (...))->min_args, \
3550 keyword_defaults, \ 3550 the function may be advised. */ \
3551 /* Can't XSUBR (Fsymbol_function (...))->min_args, \ 3551 XINT (Ffunction_min_args \
3552 the function may be advised. */ \ 3552 (intern_massaging_name (1 + #function))), \
3553 XINT (Ffunction_min_args \ 3553 0); \
3554 (intern_massaging_name (1 + #function))), \ 3554 assert (0 == strcmp (__func__, #function))
3555 0); \
3556 assert (0 == strcmp (__func__, #function))
3557 #else /* defined (DEBUG_XEMACS) && ... */ 3555 #else /* defined (DEBUG_XEMACS) && ... */
3558 #ifdef NEW_GC
3559 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \ 3556 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \
3560 keyword_defaults) \ 3557 keyword_defaults) \
3561 PARSE_KEYWORDS_8 (intern (S##function->name), nargs, args, \ 3558 PARSE_KEYWORDS_8 (intern (subr_name (XSUBR \
3562 keyword_count, keywords, \ 3559 (GET_DEFUN_LISP_OBJECT (function)))), \
3563 keyword_defaults, S##function->min_args, 0) 3560 nargs, args, keyword_count, keywords, \
3564 #else /* NEW_GC */ 3561 keyword_defaults, \
3565 #define PARSE_KEYWORDS(function, nargs, args, keyword_count, keywords, \ 3562 XSUBR (GET_DEFUN_LISP_OBJECT (function))->min_args, \
3566 keyword_defaults) \ 3563 0)
3567 PARSE_KEYWORDS_8 (intern (S##function.name), nargs, args, \
3568 keyword_count, keywords, \
3569 keyword_defaults, S##function.min_args, 0)
3570 #endif /* NEW_GC */
3571 #endif /* defined (DEBUG_XEMACS) && defined (__STDC_VERSION__) ... */ 3564 #endif /* defined (DEBUG_XEMACS) && defined (__STDC_VERSION__) ... */
3572 3565
3573 /* PARSE_KEYWORDS_8 is a more fine-grained version of PARSE_KEYWORDS. The 3566 /* PARSE_KEYWORDS_8 is a more fine-grained version of PARSE_KEYWORDS. The
3574 differences are as follows: 3567 differences are as follows:
3575 3568