aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/gendispatch.lua1
-rw-r--r--scripts/geneval.lua12
-rw-r--r--src/nvim/api/buffer.c28
-rw-r--r--src/nvim/api/ui.c7
-rw-r--r--src/nvim/api/vim.c4
-rw-r--r--src/nvim/func_attr.h1
6 files changed, 35 insertions, 18 deletions
diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua
index 9178996a56..68d4d44e2d 100644
--- a/scripts/gendispatch.lua
+++ b/scripts/gendispatch.lua
@@ -37,6 +37,7 @@ c_proto = Ct(
Cg(Cc(false), 'async') *
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
+ (fill * Cg((P('FUNC_API_NOEVAL') * Cc(true)), 'noeval') ^ -1) *
fill * P(';')
)
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
diff --git a/scripts/geneval.lua b/scripts/geneval.lua
index 75a8bdfab3..a6171f0993 100644
--- a/scripts/geneval.lua
+++ b/scripts/geneval.lua
@@ -25,11 +25,13 @@ local gperfpipe = io.open(funcsfname .. '.gperf', 'wb')
local funcs = require('eval').funcs
local metadata = mpack.unpack(io.open(arg[3], 'rb'):read("*all"))
for i,fun in ipairs(metadata) do
- funcs['api_'..fun.name] = {
- args=#fun.parameters,
- func='api_wrapper',
- data='&handle_'..fun.name,
- }
+ if not fun.noeval then
+ funcs['api_'..fun.name] = {
+ args=#fun.parameters,
+ func='api_wrapper',
+ data='&handle_'..fun.name,
+ }
+ end
end
local funcsdata = io.open(funcs_file, 'w')
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 029b645d3a..89fb7feaa9 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -56,6 +56,7 @@ Integer buffer_line_count(Buffer buffer, Error *err)
/// @param[out] err Details of an error that may have occurred
/// @return The line string
String buffer_get_line(Buffer buffer, Integer index, Error *err)
+ FUNC_API_NOEVAL
{
String rv = { .size = 0 };
@@ -84,6 +85,7 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
/// @param line The new line.
/// @param[out] err Details of an error that may have occurred
void buffer_set_line(Buffer buffer, Integer index, String line, Error *err)
+ FUNC_API_NOEVAL
{
Object l = STRING_OBJ(line);
Array array = { .items = &l, .size = 1 };
@@ -102,6 +104,7 @@ void buffer_set_line(Buffer buffer, Integer index, String line, Error *err)
/// @param index The line index
/// @param[out] err Details of an error that may have occurred
void buffer_del_line(Buffer buffer, Integer index, Error *err)
+ FUNC_API_NOEVAL
{
Array array = ARRAY_DICT_INIT;
index = convert_index(index);
@@ -122,11 +125,12 @@ void buffer_del_line(Buffer buffer, Integer index, Error *err)
/// @param[out] err Details of an error that may have occurred
/// @return An array of lines
ArrayOf(String) buffer_get_line_slice(Buffer buffer,
- Integer start,
- Integer end,
- Boolean include_start,
- Boolean include_end,
- Error *err)
+ Integer start,
+ Integer end,
+ Boolean include_start,
+ Boolean include_end,
+ Error *err)
+ FUNC_API_NOEVAL
{
start = convert_index(start) + !include_start;
end = convert_index(end) + include_end;
@@ -229,12 +233,13 @@ end:
// array will simply delete the line range)
/// @param[out] err Details of an error that may have occurred
void buffer_set_line_slice(Buffer buffer,
- Integer start,
- Integer end,
- Boolean include_start,
- Boolean include_end,
- ArrayOf(String) replacement,
- Error *err)
+ Integer start,
+ Integer end,
+ Boolean include_start,
+ Boolean include_end,
+ ArrayOf(String) replacement,
+ Error *err)
+ FUNC_API_NOEVAL
{
start = convert_index(start) + !include_start;
end = convert_index(end) + include_end;
@@ -590,6 +595,7 @@ void buffer_insert(Buffer buffer,
Integer lnum,
ArrayOf(String) lines,
Error *err)
+ FUNC_API_NOEVAL
{
// "lnum" will be the index of the line after inserting,
// no matter if it is negative or not
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 2b131443d3..5426ccc8aa 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -48,6 +48,7 @@ void remote_ui_disconnect(uint64_t channel_id)
void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
Dictionary options, Error *err)
+ FUNC_API_NOEVAL
{
if (pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(err, Exception, _("UI already attached for channel"));
@@ -117,6 +118,7 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height,
}
void nvim_ui_detach(uint64_t channel_id, Error *err)
+ FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(err, Exception, _("UI is not attached for channel"));
@@ -133,6 +135,7 @@ void ui_detach(uint64_t channel_id, Error *err)
void nvim_ui_try_resize(uint64_t channel_id, Integer width,
Integer height, Error *err)
+ FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(err, Exception, _("UI is not attached for channel"));
@@ -159,7 +162,9 @@ void ui_try_resize(uint64_t channel_id, Integer width,
}
void nvim_ui_set_option(uint64_t channel_id, String name,
- Object value, Error *error) {
+ Object value, Error *error)
+ FUNC_API_NOEVAL
+{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(error, Exception, _("UI is not attached for channel"));
return;
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index d4d2b72429..aa86e61e29 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -583,6 +583,7 @@ void vim_set_current_tabpage(Tabpage tabpage, Error *err)
/// @param channel_id The channel id (passed automatically by the dispatcher)
/// @param event The event type string
void vim_subscribe(uint64_t channel_id, String event)
+ FUNC_API_NOEVAL
{
size_t length = (event.size < METHOD_MAXLEN ? event.size : METHOD_MAXLEN);
char e[METHOD_MAXLEN + 1];
@@ -596,6 +597,7 @@ void vim_subscribe(uint64_t channel_id, String event)
/// @param channel_id The channel id (passed automatically by the dispatcher)
/// @param event The event type string
void vim_unsubscribe(uint64_t channel_id, String event)
+ FUNC_API_NOEVAL
{
size_t length = (event.size < METHOD_MAXLEN ?
event.size :
@@ -624,7 +626,7 @@ Dictionary vim_get_color_map(void)
Array vim_get_api_info(uint64_t channel_id)
- FUNC_API_ASYNC
+ FUNC_API_ASYNC FUNC_API_NOEVAL
{
Array rv = ARRAY_DICT_INIT;
diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h
index ea017ab0c8..d98fe5b22b 100644
--- a/src/nvim/func_attr.h
+++ b/src/nvim/func_attr.h
@@ -185,6 +185,7 @@
#ifdef DEFINE_FUNC_ATTRIBUTES
# define FUNC_API_ASYNC
# define FUNC_API_NOEXPORT
+# define FUNC_API_NOEVAL
# define FUNC_ATTR_MALLOC REAL_FATTR_MALLOC
# define FUNC_ATTR_ALLOC_SIZE(x) REAL_FATTR_ALLOC_SIZE(x)
# define FUNC_ATTR_ALLOC_SIZE_PROD(x, y) REAL_FATTR_ALLOC_SIZE_PROD(x, y)