diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs-module.c | 6 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/print.c | 18 |
3 files changed, 23 insertions, 2 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 | ||
diff --git a/src/lisp.h b/src/lisp.h index 9be7bfec5c0..e1bbb53ad49 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4245,6 +4245,7 @@ extern Lisp_Object module_function_documentation | |||
| 4245 | (struct Lisp_Module_Function const *); | 4245 | (struct Lisp_Module_Function const *); |
| 4246 | extern module_funcptr module_function_address | 4246 | extern module_funcptr module_function_address |
| 4247 | (struct Lisp_Module_Function const *); | 4247 | (struct Lisp_Module_Function const *); |
| 4248 | extern void *module_function_data (const struct Lisp_Module_Function *); | ||
| 4248 | extern void module_finalize_function (const struct Lisp_Module_Function *); | 4249 | extern void module_finalize_function (const struct Lisp_Module_Function *); |
| 4249 | extern void mark_modules (void); | 4250 | extern void mark_modules (void); |
| 4250 | extern void init_module_assertions (bool); | 4251 | extern void init_module_assertions (bool); |
diff --git a/src/print.c b/src/print.c index 425b0dc4ee3..b373aaf6551 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1796,7 +1796,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, | |||
| 1796 | case PVEC_MODULE_FUNCTION: | 1796 | case PVEC_MODULE_FUNCTION: |
| 1797 | { | 1797 | { |
| 1798 | print_c_string ("#<module function ", printcharfun); | 1798 | print_c_string ("#<module function ", printcharfun); |
| 1799 | module_funcptr ptr = module_function_address (XMODULE_FUNCTION (obj)); | 1799 | const struct Lisp_Module_Function *function = XMODULE_FUNCTION (obj); |
| 1800 | module_funcptr ptr = module_function_address (function); | ||
| 1800 | char const *file; | 1801 | char const *file; |
| 1801 | char const *symbol; | 1802 | char const *symbol; |
| 1802 | dynlib_addr (ptr, &file, &symbol); | 1803 | dynlib_addr (ptr, &file, &symbol); |
| @@ -1815,6 +1816,19 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, | |||
| 1815 | else | 1816 | else |
| 1816 | print_c_string (symbol, printcharfun); | 1817 | print_c_string (symbol, printcharfun); |
| 1817 | 1818 | ||
| 1819 | void *data = module_function_data (function); | ||
| 1820 | if (data != NULL) | ||
| 1821 | { | ||
| 1822 | uintptr_t ui = (uintptr_t) data; | ||
| 1823 | |||
| 1824 | /* In theory this assignment could lose info on pre-C99 | ||
| 1825 | hosts, but in practice it doesn't. */ | ||
| 1826 | uintmax_t up = ui; | ||
| 1827 | |||
| 1828 | int len = sprintf (buf, " with data 0x%"PRIxMAX, up); | ||
| 1829 | strout (buf, len, len, printcharfun); | ||
| 1830 | } | ||
| 1831 | |||
| 1818 | if (file != NULL) | 1832 | if (file != NULL) |
| 1819 | { | 1833 | { |
| 1820 | print_c_string (" from ", printcharfun); | 1834 | print_c_string (" from ", printcharfun); |
| @@ -1838,7 +1852,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1838 | { | 1852 | { |
| 1839 | char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT), | 1853 | char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT), |
| 1840 | max (sizeof " . #" + INT_STRLEN_BOUND (intmax_t), | 1854 | max (sizeof " . #" + INT_STRLEN_BOUND (intmax_t), |
| 1841 | max ((sizeof "at 0x" | 1855 | max ((sizeof " with data 0x" |
| 1842 | + (sizeof (uintmax_t) * CHAR_BIT + 4 - 1) / 4), | 1856 | + (sizeof (uintmax_t) * CHAR_BIT + 4 - 1) / 4), |
| 1843 | 40)))]; | 1857 | 40)))]; |
| 1844 | current_thread->stack_top = buf; | 1858 | current_thread->stack_top = buf; |