mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-27 07:41:28 -08:00
Implement 'func-arity'
* src/eval.c (Ffunc_arity, lambda_arity): New functions. * src/bytecode.c (get_byte_code_arity): New function. * src/lisp.h (get_byte_code_arity): Add prototype. * doc/lispref/functions.texi (What Is a Function): Document 'func-arity'. * etc/NEWS: Mention 'func-arity'. * test/src/fns-tests.el (fns-tests-func-arity): New test set.
This commit is contained in:
parent
368b9bb45f
commit
6f3243db55
6 changed files with 182 additions and 6 deletions
|
|
@ -1987,6 +1987,24 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
|
|||
return result;
|
||||
}
|
||||
|
||||
/* `args_template' has the same meaning as in exec_byte_code() above. */
|
||||
Lisp_Object
|
||||
get_byte_code_arity (Lisp_Object args_template)
|
||||
{
|
||||
if (INTEGERP (args_template))
|
||||
{
|
||||
ptrdiff_t at = XINT (args_template);
|
||||
bool rest = (at & 128) != 0;
|
||||
int mandatory = at & 127;
|
||||
ptrdiff_t nonrest = at >> 8;
|
||||
|
||||
return Fcons (make_number (mandatory),
|
||||
rest ? Qmany : make_number (nonrest));
|
||||
}
|
||||
else
|
||||
error ("Unknown args template!");
|
||||
}
|
||||
|
||||
void
|
||||
syms_of_bytecode (void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue