Allow 'browse-url-emacs' to fetch URL in the selected window
[emacs.git] / src / emacs-module.h.in
blob8e0b42abd7ba5ce9fe71c7d867759a8e19a33d1e
1 /* emacs-module.h - GNU Emacs module API.
3 Copyright (C) 2015-2018 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
23 #include <stdint.h>
24 #include <stddef.h>
26 #ifndef __cplusplus
27 #include <stdbool.h>
28 #endif
30 #if defined __cplusplus && __cplusplus >= 201103L
31 # define EMACS_NOEXCEPT noexcept
32 #else
33 # define EMACS_NOEXCEPT
34 #endif
36 #ifdef __has_attribute
37 #if __has_attribute(__nonnull__)
38 # define EMACS_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
39 #endif
40 #endif
41 #ifndef EMACS_ATTRIBUTE_NONNULL
42 # define EMACS_ATTRIBUTE_NONNULL(...)
43 #endif
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
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). */
59 struct emacs_runtime
61 /* Structure size (for version checking). */
62 ptrdiff_t size;
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
86 struct emacs_env_25
88 @module_env_snippet_25@
91 struct emacs_env_26
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)
100 EMACS_NOEXCEPT
101 EMACS_ATTRIBUTE_NONNULL(1);
103 #ifdef __cplusplus
105 #endif
107 #endif /* EMACS_MODULE_H */