1 /* emacs-module.h - GNU Emacs module API.
3 Copyright (C) 2015-2017 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or (at
10 your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
20 #ifndef EMACS_MODULE_H
21 #define EMACS_MODULE_H
30 #if defined __cplusplus && __cplusplus >= 201103L
31 # define EMACS_NOEXCEPT noexcept
33 # define EMACS_NOEXCEPT
36 #ifdef __has_attribute
37 #if __has_attribute(__nonnull__)
38 # define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
41 #ifndef EMACS_ATTRIBUTE_NONNULL
42 # define EMACS_ATTRIBUTE_NONNULL(...)
49 /* Current environment. */
50 typedef struct emacs_env_26 emacs_env
;
52 /* Opaque pointer representing an Emacs Lisp value.
53 BEWARE: Do not assume NULL is a valid value! */
54 typedef struct emacs_value_tag
*emacs_value
;
56 enum { emacs_variadic_function
= -2 };
58 /* Struct passed to a module init function (emacs_module_init). */
61 /* Structure size (for version checking). */
64 /* Private data; users should not touch this. */
65 struct emacs_runtime_private
*private_members
;
67 /* Return an environment pointer. */
68 emacs_env
*(*get_environment
) (struct emacs_runtime
*ert
)
69 EMACS_ATTRIBUTE_NONNULL(1);
73 /* Possible Emacs function call outcomes. */
74 enum emacs_funcall_exit
76 /* Function has returned normally. */
77 emacs_funcall_exit_return
= 0,
79 /* Function has signaled an error using `signal'. */
80 emacs_funcall_exit_signal
= 1,
82 /* Function has exit using `throw'. */
83 emacs_funcall_exit_throw
= 2
88 @module_env_snippet_25@
93 @module_env_snippet_25@
95 @module_env_snippet_26@
98 /* Every module should define a function as follows. */
99 extern int emacs_module_init (struct emacs_runtime
*ert
)
101 EMACS_ATTRIBUTE_NONNULL(1);
107 #endif /* EMACS_MODULE_H */