aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emacs-module.h.in106
-rw-r--r--src/module-env-25.h (renamed from src/emacs-module.h)102
-rw-r--r--src/module-env-26.h3
3 files changed, 109 insertions, 102 deletions
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
new file mode 100644
index 00000000000..339234fdb51
--- /dev/null
+++ b/src/emacs-module.h.in
@@ -0,0 +1,106 @@
1/* emacs-module.h - GNU Emacs module API.
2
3Copyright (C) 2015-2017 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or (at
10your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef EMACS_MODULE_H
21#define EMACS_MODULE_H
22
23#include <stdint.h>
24#include <stddef.h>
25
26#ifndef __cplusplus
27#include <stdbool.h>
28#endif
29
30#if defined __cplusplus && __cplusplus >= 201103L
31# define EMACS_NOEXCEPT noexcept
32#else
33# define EMACS_NOEXCEPT
34#endif
35
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
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/* Current environment. */
50typedef struct emacs_env_26 emacs_env;
51
52/* Opaque pointer representing an Emacs Lisp value.
53 BEWARE: Do not assume NULL is a valid value! */
54typedef struct emacs_value_tag *emacs_value;
55
56enum { emacs_variadic_function = -2 };
57
58/* Struct passed to a module init function (emacs_module_init). */
59struct emacs_runtime
60{
61 /* Structure size (for version checking). */
62 ptrdiff_t size;
63
64 /* Private data; users should not touch this. */
65 struct emacs_runtime_private *private_members;
66
67 /* Return an environment pointer. */
68 emacs_env *(*get_environment) (struct emacs_runtime *ert)
69 EMACS_ATTRIBUTE_NONNULL(1);
70};
71
72
73/* Possible Emacs function call outcomes. */
74enum emacs_funcall_exit
75{
76 /* Function has returned normally. */
77 emacs_funcall_exit_return = 0,
78
79 /* Function has signaled an error using `signal'. */
80 emacs_funcall_exit_signal = 1,
81
82 /* Function has exit using `throw'. */
83 emacs_funcall_exit_throw = 2,
84};
85
86struct emacs_env_25
87{
88@module_env_snippet_25@
89};
90
91struct emacs_env_26
92{
93@module_env_snippet_25@
94
95@module_env_snippet_26@
96};
97
98/* Every module should define a function as follows. */
99extern int emacs_module_init (struct emacs_runtime *ert)
100 EMACS_ATTRIBUTE_NONNULL(1);
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif /* EMACS_MODULE_H */
diff --git a/src/emacs-module.h b/src/module-env-25.h
index f545a27b5fd..17e67004b24 100644
--- a/src/emacs-module.h
+++ b/src/module-env-25.h
@@ -1,90 +1,3 @@
1/* emacs-module.h - GNU Emacs module API.
2
3Copyright (C) 2015-2017 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or (at
10your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef EMACS_MODULE_H
21#define EMACS_MODULE_H
22
23#include <stdint.h>
24#include <stddef.h>
25
26#ifndef __cplusplus
27#include <stdbool.h>
28#endif
29
30#if defined __cplusplus && __cplusplus >= 201103L
31# define EMACS_NOEXCEPT noexcept
32#else
33# define EMACS_NOEXCEPT
34#endif
35
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
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/* Current environment. */
50typedef struct emacs_env_25 emacs_env;
51
52/* Opaque pointer representing an Emacs Lisp value.
53 BEWARE: Do not assume NULL is a valid value! */
54typedef struct emacs_value_tag *emacs_value;
55
56enum { emacs_variadic_function = -2 };
57
58/* Struct passed to a module init function (emacs_module_init). */
59struct emacs_runtime
60{
61 /* Structure size (for version checking). */
62 ptrdiff_t size;
63
64 /* Private data; users should not touch this. */
65 struct emacs_runtime_private *private_members;
66
67 /* Return an environment pointer. */
68 emacs_env *(*get_environment) (struct emacs_runtime *ert)
69 EMACS_ATTRIBUTE_NONNULL(1);
70};
71
72
73/* Possible Emacs function call outcomes. */
74enum emacs_funcall_exit
75{
76 /* Function has returned normally. */
77 emacs_funcall_exit_return = 0,
78
79 /* Function has signaled an error using `signal'. */
80 emacs_funcall_exit_signal = 1,
81
82 /* Function has exit using `throw'. */
83 emacs_funcall_exit_throw = 2,
84};
85
86struct emacs_env_25
87{
88 /* Structure size (for version checking). */ 1 /* Structure size (for version checking). */
89 ptrdiff_t size; 2 ptrdiff_t size;
90 3
@@ -225,18 +138,3 @@ struct emacs_env_25
225 138
226 ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vec) 139 ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vec)
227 EMACS_ATTRIBUTE_NONNULL(1); 140 EMACS_ATTRIBUTE_NONNULL(1);
228
229 /* Returns whether a quit is pending. */
230 bool (*should_quit) (emacs_env *env)
231 EMACS_ATTRIBUTE_NONNULL(1);
232};
233
234/* Every module should define a function as follows. */
235extern int emacs_module_init (struct emacs_runtime *ert)
236 EMACS_ATTRIBUTE_NONNULL(1);
237
238#ifdef __cplusplus
239}
240#endif
241
242#endif /* EMACS_MODULE_H */
diff --git a/src/module-env-26.h b/src/module-env-26.h
new file mode 100644
index 00000000000..1ab12d45c84
--- /dev/null
+++ b/src/module-env-26.h
@@ -0,0 +1,3 @@
1 /* Returns whether a quit is pending. */
2 bool (*should_quit) (emacs_env *env)
3 EMACS_ATTRIBUTE_NONNULL(1);