diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-12 11:24:01 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-12 13:50:07 -0300 |
commit | 545acf2024ea2653ae6937d570a37aa0340caa5e (patch) | |
tree | 7440aa48e60919082e235ea0ff1a550ba1904d5c /src/nvim/api/buffer.c | |
parent | cd2e46c0785d40b9ea15f6d722a3fad54c007b9b (diff) | |
download | rneovim-545acf2024ea2653ae6937d570a37aa0340caa5e.tar.gz rneovim-545acf2024ea2653ae6937d570a37aa0340caa5e.tar.bz2 rneovim-545acf2024ea2653ae6937d570a37aa0340caa5e.zip |
api metadata: Allow typed container information in api functions
Adapt gendeclarations.lua/msgpack-gen.lua to allow the `ArrayOf(...)` and
`DictionaryOf(...)` types in function headers. These are simple macros that
expand to Array and Dictionary respectively, but the information is kept in the
metadata object, which is useful for building clients in statically typed
languages.
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 383e13fd92..8355bfe868 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -95,12 +95,12 @@ void buffer_del_line(Buffer buffer, Integer index, Error *err) /// @param include_end True if the slice includes the `end` parameter /// @param[out] err Details of an error that may have occurred /// @return An array of lines -Array buffer_get_slice(Buffer buffer, - Integer start, - Integer end, - Boolean include_start, - Boolean include_end, - Error *err) +ArrayOf(String) buffer_get_slice(Buffer buffer, + Integer start, + Integer end, + Boolean include_start, + Boolean include_end, + Error *err) { Array rv = ARRAY_DICT_INIT; buf_T *buf = find_buffer_by_handle(buffer, err); @@ -161,7 +161,7 @@ void buffer_set_slice(Buffer buffer, Integer end, Boolean include_start, Boolean include_end, - Array replacement, + ArrayOf(String) replacement, Error *err) { buf_T *buf = find_buffer_by_handle(buffer, err); @@ -436,7 +436,10 @@ Boolean buffer_is_valid(Buffer buffer) /// to the end of the buffer. /// @param lines An array of lines /// @param[out] err Details of an error that may have occurred -void buffer_insert(Buffer buffer, Integer lnum, Array lines, Error *err) +void buffer_insert(Buffer buffer, + Integer lnum, + ArrayOf(String) lines, + Error *err) { buffer_set_slice(buffer, lnum, lnum, false, true, lines, err); } @@ -447,7 +450,7 @@ void buffer_insert(Buffer buffer, Integer lnum, Array lines, Error *err) /// @param name The mark's name /// @param[out] err Details of an error that may have occurred /// @return The (row, col) tuple -Array buffer_get_mark(Buffer buffer, String name, Error *err) +ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err) { Array rv = ARRAY_DICT_INIT; buf_T *buf = find_buffer_by_handle(buffer, err); |