diff options
| author | Philipp Stephani | 2019-04-24 23:12:35 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2019-04-24 23:12:35 +0200 |
| commit | d2e1bac47816fa1f48482faeebf7fa562a5b0e40 (patch) | |
| tree | 85eda43e37e3df0b74a2d82cf313c28bbfefa27c /src/emacs-module.c | |
| parent | 4c90369d77d3db1cbd37df7857e4706176fd7ba2 (diff) | |
| download | emacs-d2e1bac47816fa1f48482faeebf7fa562a5b0e40.tar.gz emacs-d2e1bac47816fa1f48482faeebf7fa562a5b0e40.zip | |
Move definition of Lisp_Module_Function to emacs-module.c.
* src/lisp.h: Remove include of emacs-module.h. Remove definition
of Lisp_Module_Function structure.
* src/emacs-module.c (module_function_documentation)
(module_function_address): New accessor functions for module function
fields.
(emacs_subr, struct Lisp_Module_Function): Move from lisp.h.
* src/print.c (print_vectorlike):
* src/doc.c (Fdocumentation): Use the new accessor functions.
Diffstat (limited to 'src/emacs-module.c')
| -rw-r--r-- | src/emacs-module.c | 36 |
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. */ | ||
| 475 | typedef 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 | |||
| 485 | struct 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 | |||
| 474 | static struct Lisp_Module_Function * | 498 | static struct Lisp_Module_Function * |
| 475 | allocate_module_function (void) | 499 | allocate_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 | ||
| 928 | Lisp_Object | ||
| 929 | module_function_documentation (const struct Lisp_Module_Function *function) | ||
| 930 | { | ||
| 931 | return function->documentation; | ||
| 932 | } | ||
| 933 | |||
| 934 | void * | ||
| 935 | module_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 | ||