diff options
| author | Philipp Stephani | 2020-01-05 16:05:14 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2020-01-05 16:07:28 +0100 |
| commit | fc92c2d8942cf466aa6dbc422f2e798801b18408 (patch) | |
| tree | ddf5bc386ba474733db39de3d23f76c8563ebd4b /src/emacs-module.c | |
| parent | 9d38564cdde8cbe9d4c08a7ffef7f25e9692814a (diff) | |
| download | emacs-fc92c2d8942cf466aa6dbc422f2e798801b18408.tar.gz emacs-fc92c2d8942cf466aa6dbc422f2e798801b18408.zip | |
Also print function data when printing module functions.
This is especially useful in cases where modules only use a single
entry point and use the data to dispatch to the actual function. Such
a design is common for languages such as Go and C++.
* src/emacs-module.c (module_function_data): New function.
* src/print.c (print_vectorlike): Use it to print module function data
if not NULL.
(print_object): Adapt size of buffer.
* test/data/emacs-module/mod-test.c (emacs_module_init): Pass some
non-NULL data to ‘mod-test-sum’.
(Fmod_test_sum): Check that correct data is passed through.
* test/src/emacs-module-tests.el (mod-test-sum-test)
(module-function-object): Adapt unit tests.
Diffstat (limited to 'src/emacs-module.c')
| -rw-r--r-- | src/emacs-module.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 3855a33f254..f40ca931fa9 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -1098,6 +1098,12 @@ module_function_address (const struct Lisp_Module_Function *function) | |||
| 1098 | return (module_funcptr) function->subr; | 1098 | return (module_funcptr) function->subr; |
| 1099 | } | 1099 | } |
| 1100 | 1100 | ||
| 1101 | void * | ||
| 1102 | module_function_data (const struct Lisp_Module_Function *function) | ||
| 1103 | { | ||
| 1104 | return function->data; | ||
| 1105 | } | ||
| 1106 | |||
| 1101 | 1107 | ||
| 1102 | /* Helper functions. */ | 1108 | /* Helper functions. */ |
| 1103 | 1109 | ||