aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Love2000-05-26 10:21:30 +0000
committerDave Love2000-05-26 10:21:30 +0000
commit6f0e897ff65a8a44f06d94e81ddee8db4afe1676 (patch)
treec5d7118322f1ee7672dfdb6ee620935d2e73a7ac /src
parent80265cddc5ff197de452bfd88c79d5ead2c490ba (diff)
downloademacs-6f0e897ff65a8a44f06d94e81ddee8db4afe1676.tar.gz
emacs-6f0e897ff65a8a44f06d94e81ddee8db4afe1676.zip
(Qsubrp, Qmany, Qunevalled): New variables.
(Fsubr_arity): New function. (syms_of_data): Install them.
Diffstat (limited to 'src')
-rw-r--r--src/data.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c
index 8beb592daf1..f43d15f8e96 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
1/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter. 1/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985,86,88,93,94,95,97,98, 1999 Free Software Foundation, Inc. 2 Copyright (C) 1985,86,88,93,94,95,97,98,99,2000 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -90,6 +90,7 @@ static Lisp_Object Qfloat, Qwindow_configuration, Qwindow;
90Lisp_Object Qprocess; 90Lisp_Object Qprocess;
91static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector; 91static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
92static Lisp_Object Qchar_table, Qbool_vector, Qhash_table; 92static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
93static Lisp_Object Qsubrp, Qmany, Qunevalled;
93 94
94static Lisp_Object swap_in_symval_forwarding (); 95static Lisp_Object swap_in_symval_forwarding ();
95 96
@@ -709,6 +710,28 @@ DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
709 return newplist; 710 return newplist;
710} 711}
711 712
713DEFUN ("subr-arity", Fsubr_arity, Ssubr_arity, 1, 1, 0,
714 "Return minimum and maximum number of args allowed for SUBR.\n\
715SUBR must be a built-in function.\n\
716The returned value is a pair (MIN . MAX). MIN is the minimum number\n\
717of args. MAX is the maximum number or the symbol `many', for a\n\
718function with `&rest' args, or `unevalled' for a special form.")
719 (subr)
720 Lisp_Object subr;
721{
722 short minargs, maxargs;
723 if (!SUBRP (subr))
724 wrong_type_argument (Qsubrp, subr);
725 minargs = XSUBR (subr)->min_args;
726 maxargs = XSUBR (subr)->max_args;
727 if (maxargs == MANY)
728 return Fcons (make_number (minargs), Qmany);
729 else if (maxargs == UNEVALLED)
730 return Fcons (make_number (minargs), Qunevalled);
731 else
732 return Fcons (make_number (minargs), make_number (maxargs));
733}
734
712 735
713/* Getting and setting values of symbols */ 736/* Getting and setting values of symbols */
714 737
@@ -2597,6 +2620,10 @@ syms_of_data ()
2597 Qchar_table_p = intern ("char-table-p"); 2620 Qchar_table_p = intern ("char-table-p");
2598 Qvector_or_char_table_p = intern ("vector-or-char-table-p"); 2621 Qvector_or_char_table_p = intern ("vector-or-char-table-p");
2599 2622
2623 Qsubrp = intern ("subrp");
2624 Qunevalled = intern ("unevalled");
2625 Qmany = intern ("many");
2626
2600 Qcdr = intern ("cdr"); 2627 Qcdr = intern ("cdr");
2601 2628
2602 /* Handle automatic advice activation */ 2629 /* Handle automatic advice activation */
@@ -2786,6 +2813,9 @@ syms_of_data ()
2786 staticpro (&Qnumber_or_marker_p); 2813 staticpro (&Qnumber_or_marker_p);
2787 staticpro (&Qchar_table_p); 2814 staticpro (&Qchar_table_p);
2788 staticpro (&Qvector_or_char_table_p); 2815 staticpro (&Qvector_or_char_table_p);
2816 staticpro (&Qsubrp);
2817 staticpro (&Qmany);
2818 staticpro (&Qunevalled);
2789 2819
2790 staticpro (&Qboundp); 2820 staticpro (&Qboundp);
2791 staticpro (&Qfboundp); 2821 staticpro (&Qfboundp);
@@ -2916,6 +2946,7 @@ syms_of_data ()
2916 defsubr (&Sadd1); 2946 defsubr (&Sadd1);
2917 defsubr (&Ssub1); 2947 defsubr (&Ssub1);
2918 defsubr (&Slognot); 2948 defsubr (&Slognot);
2949 defsubr (&Ssubr_arity);
2919 2950
2920 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; 2951 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function;
2921} 2952}