aboutsummaryrefslogtreecommitdiffstats
path: root/src/emacs-module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emacs-module.c')
-rw-r--r--src/emacs-module.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 41ce9ef03e4..b6a12386267 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -471,6 +471,30 @@ module_non_local_exit_throw (emacs_env *env, emacs_value tag, emacs_value value)
471 value_to_lisp (value)); 471 value_to_lisp (value));
472} 472}
473 473
474/* Function prototype for the module Lisp functions. */
475typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t,
476 emacs_value [], void *);
477
478/* Module function. */
479
480/* A function environment is an auxiliary structure returned by
481 `module_make_function' to store information about a module
482 function. It is stored in a pseudovector. Its members correspond
483 to the arguments given to `module_make_function'. */
484
485struct Lisp_Module_Function
486{
487 union vectorlike_header header;
488
489 /* Fields traced by GC; these must come first. */
490 Lisp_Object documentation;
491
492 /* Fields ignored by GC. */
493 ptrdiff_t min_arity, max_arity;
494 emacs_subr subr;
495 void *data;
496} GCALIGNED_STRUCT;
497
474static struct Lisp_Module_Function * 498static struct Lisp_Module_Function *
475allocate_module_function (void) 499allocate_module_function (void)
476{ 500{
@@ -901,6 +925,18 @@ module_function_arity (const struct Lisp_Module_Function *const function)
901 maxargs == MANY ? Qmany : make_fixnum (maxargs)); 925 maxargs == MANY ? Qmany : make_fixnum (maxargs));
902} 926}
903 927
928Lisp_Object
929module_function_documentation (const struct Lisp_Module_Function *function)
930{
931 return function->documentation;
932}
933
934void *
935module_function_address (const struct Lisp_Module_Function *function)
936{
937 return function->subr;
938}
939
904 940
905/* Helper functions. */ 941/* Helper functions. */
906 942