mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-26 23:20:29 -08:00
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.
This commit is contained in:
parent
4c90369d77
commit
d2e1bac478
4 changed files with 45 additions and 29 deletions
|
|
@ -337,8 +337,10 @@ string is passed through `substitute-command-keys'. */)
|
|||
fun = XCDR (fun);
|
||||
if (SUBRP (fun))
|
||||
doc = make_fixnum (XSUBR (fun)->doc);
|
||||
#ifdef HAVE_MODULES
|
||||
else if (MODULE_FUNCTIONP (fun))
|
||||
doc = XMODULE_FUNCTION (fun)->documentation;
|
||||
doc = module_function_documentation (XMODULE_FUNCTION (fun));
|
||||
#endif
|
||||
else if (COMPILEDP (fun))
|
||||
{
|
||||
if (PVSIZE (fun) <= COMPILED_DOC_STRING)
|
||||
|
|
|
|||
|
|
@ -471,6 +471,30 @@ module_non_local_exit_throw (emacs_env *env, emacs_value tag, emacs_value value)
|
|||
value_to_lisp (value));
|
||||
}
|
||||
|
||||
/* Function prototype for the module Lisp functions. */
|
||||
typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t,
|
||||
emacs_value [], void *);
|
||||
|
||||
/* Module function. */
|
||||
|
||||
/* A function environment is an auxiliary structure returned by
|
||||
`module_make_function' to store information about a module
|
||||
function. It is stored in a pseudovector. Its members correspond
|
||||
to the arguments given to `module_make_function'. */
|
||||
|
||||
struct Lisp_Module_Function
|
||||
{
|
||||
union vectorlike_header header;
|
||||
|
||||
/* Fields traced by GC; these must come first. */
|
||||
Lisp_Object documentation;
|
||||
|
||||
/* Fields ignored by GC. */
|
||||
ptrdiff_t min_arity, max_arity;
|
||||
emacs_subr subr;
|
||||
void *data;
|
||||
} GCALIGNED_STRUCT;
|
||||
|
||||
static struct Lisp_Module_Function *
|
||||
allocate_module_function (void)
|
||||
{
|
||||
|
|
@ -901,6 +925,18 @@ module_function_arity (const struct Lisp_Module_Function *const function)
|
|||
maxargs == MANY ? Qmany : make_fixnum (maxargs));
|
||||
}
|
||||
|
||||
Lisp_Object
|
||||
module_function_documentation (const struct Lisp_Module_Function *function)
|
||||
{
|
||||
return function->documentation;
|
||||
}
|
||||
|
||||
void *
|
||||
module_function_address (const struct Lisp_Module_Function *function)
|
||||
{
|
||||
return function->subr;
|
||||
}
|
||||
|
||||
|
||||
/* Helper functions. */
|
||||
|
||||
|
|
|
|||
30
src/lisp.h
30
src/lisp.h
|
|
@ -4151,32 +4151,8 @@ extern void *unexec_realloc (void *, size_t);
|
|||
extern void unexec_free (void *);
|
||||
#endif
|
||||
|
||||
#define EMACS_MODULE_GMP
|
||||
#include "emacs-module.h"
|
||||
|
||||
/* Function prototype for the module Lisp functions. */
|
||||
typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t,
|
||||
emacs_value [], void *);
|
||||
|
||||
/* Module function. */
|
||||
|
||||
/* A function environment is an auxiliary structure returned by
|
||||
`module_make_function' to store information about a module
|
||||
function. It is stored in a pseudovector. Its members correspond
|
||||
to the arguments given to `module_make_function'. */
|
||||
|
||||
struct Lisp_Module_Function
|
||||
{
|
||||
union vectorlike_header header;
|
||||
|
||||
/* Fields traced by GC; these must come first. */
|
||||
Lisp_Object documentation;
|
||||
|
||||
/* Fields ignored by GC. */
|
||||
ptrdiff_t min_arity, max_arity;
|
||||
emacs_subr subr;
|
||||
void *data;
|
||||
} GCALIGNED_STRUCT;
|
||||
/* The definition of Lisp_Module_Function depends on emacs-module.h,
|
||||
so we don't define it here. It's defined in emacs-module.c. */
|
||||
|
||||
INLINE bool
|
||||
MODULE_FUNCTIONP (Lisp_Object o)
|
||||
|
|
@ -4198,6 +4174,8 @@ extern Lisp_Object make_user_ptr (void (*finalizer) (void *), void *p);
|
|||
/* Defined in emacs-module.c. */
|
||||
extern Lisp_Object funcall_module (Lisp_Object, ptrdiff_t, Lisp_Object *);
|
||||
extern Lisp_Object module_function_arity (const struct Lisp_Module_Function *);
|
||||
extern Lisp_Object module_function_documentation (const struct Lisp_Module_Function *);
|
||||
extern void *module_function_address (const struct Lisp_Module_Function *);
|
||||
extern void mark_modules (void);
|
||||
extern void init_module_assertions (bool);
|
||||
extern void syms_of_module (void);
|
||||
|
|
|
|||
|
|
@ -1787,8 +1787,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
|
|||
case PVEC_MODULE_FUNCTION:
|
||||
{
|
||||
print_c_string ("#<module function ", printcharfun);
|
||||
void *ptr = XMODULE_FUNCTION (obj)->subr;
|
||||
const char *file = NULL;
|
||||
void *ptr = module_function_address (XMODULE_FUNCTION (obj));
|
||||
const char *file = NULL;
|
||||
const char *symbol = NULL;
|
||||
dynlib_addr (ptr, &file, &symbol);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue