aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/api/private/helpers.c2
-rw-r--r--src/nvim/api/vim.c17
-rw-r--r--src/nvim/eval.c1
-rw-r--r--src/nvim/ex_cmds2.c1
-rw-r--r--src/nvim/ops.c1
-rw-r--r--src/nvim/os/event.c3
-rw-r--r--src/nvim/os/provider.c152
-rw-r--r--src/nvim/os/provider.h11
8 files changed, 0 insertions, 188 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index a7b48f3b7e..750b151d10 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -7,7 +7,6 @@
#include "nvim/api/private/helpers.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/handle.h"
-#include "nvim/os/provider.h"
#include "nvim/ascii.h"
#include "nvim/vim.h"
#include "nvim/buffer.h"
@@ -548,7 +547,6 @@ Dictionary api_metadata(void)
msgpack_rpc_init_function_metadata(&metadata);
init_error_type_metadata(&metadata);
init_type_metadata(&metadata);
- provider_init_feature_metadata(&metadata);
}
return copy_object(DICTIONARY_OBJ(metadata)).data.dictionary;
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index b6bac1588a..addcbf62e9 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -11,7 +11,6 @@
#include "nvim/api/private/defs.h"
#include "nvim/api/buffer.h"
#include "nvim/msgpack_rpc/channel.h"
-#include "nvim/os/provider.h"
#include "nvim/vim.h"
#include "nvim/buffer.h"
#include "nvim/window.h"
@@ -538,22 +537,6 @@ void vim_unsubscribe(uint64_t channel_id, String event)
channel_unsubscribe(channel_id, e);
}
-/// Registers the channel as the provider for `feature`. This fails if
-/// a provider for `feature` is already provided by another channel.
-///
-/// @param channel_id The channel id
-/// @param feature The feature name
-/// @param[out] err Details of an error that may have occurred
-void vim_register_provider(uint64_t channel_id, String feature, Error *err)
-{
- char buf[METHOD_MAXLEN];
- xstrlcpy(buf, feature.data, sizeof(buf));
-
- if (!provider_register(buf, channel_id)) {
- api_set_error(err, Validation, _("Feature doesn't exist"));
- }
-}
-
Array vim_get_api_info(uint64_t channel_id)
{
Array rv = ARRAY_DICT_INIT;
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 2106c36345..498795dc38 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -89,7 +89,6 @@
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/os/dl.h"
-#include "nvim/os/provider.h"
#include "nvim/os/event.h"
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index ee06130cf7..96410897df 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -55,7 +55,6 @@
#include "nvim/os/os.h"
#include "nvim/os/shell.h"
#include "nvim/os/fs_defs.h"
-#include "nvim/os/provider.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/private/defs.h"
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 2933eec415..5ef605bb3b 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -48,7 +48,6 @@
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/window.h"
-#include "nvim/os/provider.h"
#include "nvim/api/private/helpers.h"
/*
diff --git a/src/nvim/os/event.c b/src/nvim/os/event.c
index 5a5da5cd63..1477072f4f 100644
--- a/src/nvim/os/event.c
+++ b/src/nvim/os/event.c
@@ -11,7 +11,6 @@
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/msgpack_rpc/helpers.h"
-#include "nvim/os/provider.h"
#include "nvim/os/signal.h"
#include "nvim/os/rstream.h"
#include "nvim/os/wstream.h"
@@ -62,8 +61,6 @@ void event_init(void)
// finish mspgack-rpc initialization
channel_init();
server_init();
- // Providers
- provider_init();
}
void event_teardown(void)
diff --git a/src/nvim/os/provider.c b/src/nvim/os/provider.c
deleted file mode 100644
index 414c8841fa..0000000000
--- a/src/nvim/os/provider.c
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <stdint.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <assert.h>
-
-#include "nvim/os/provider.h"
-#include "nvim/memory.h"
-#include "nvim/api/vim.h"
-#include "nvim/api/private/helpers.h"
-#include "nvim/api/private/defs.h"
-#include "nvim/msgpack_rpc/channel.h"
-#include "nvim/os/shell.h"
-#include "nvim/os/os.h"
-#include "nvim/log.h"
-#include "nvim/map.h"
-#include "nvim/message.h"
-
-#define FEATURE_COUNT (sizeof(features) / sizeof(features[0]))
-
-#define FEATURE(feature_name, ...) { \
- .name = feature_name, \
- .channel_id = 0, \
- .methods = (char *[]){__VA_ARGS__, NULL} \
-}
-
-typedef struct {
- char *name, **methods;
- size_t name_length;
- uint64_t channel_id;
-} Feature;
-
-static Feature features[] = {
- FEATURE("python",
- "python_execute",
- "python_execute_file",
- "python_do_range",
- "python_eval"),
-
- FEATURE("clipboard",
- "clipboard_get",
- "clipboard_set")
-};
-
-static PMap(cstr_t) *registered_providers = NULL;
-
-#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "os/provider.c.generated.h"
-#endif
-
-
-void provider_init(void)
-{
- registered_providers = pmap_new(cstr_t)();
-}
-
-bool provider_has_feature(char *name)
-{
- Feature *f = find_feature(name);
- return f != NULL && channel_exists(f->channel_id);
-}
-
-bool provider_register(char *name, uint64_t channel_id)
-{
- Feature *f = find_feature(name);
-
- if (!f) {
- return false;
- }
-
- if (f->channel_id && channel_exists(f->channel_id)) {
- ILOG("Feature \"%s\" is already provided by another channel"
- "(will be replaced)", name);
- }
-
- DLOG("Registering provider for \"%s\"", name);
- f->channel_id = channel_id;
-
- // Associate all method names with the feature struct
- size_t i;
- char *method;
- for (method = f->methods[i = 0]; method; method = f->methods[++i]) {
- pmap_put(cstr_t)(registered_providers, method, f);
- DLOG("Channel \"%" PRIu64 "\" will be sent requests for \"%s\"",
- channel_id,
- method);
- }
-
- ILOG("Registered channel %" PRIu64 " as the provider for the \"%s\" feature",
- channel_id,
- name);
-
- return true;
-}
-
-Object provider_call(char *method, Array args)
-{
- Feature *f = pmap_get(cstr_t)(registered_providers, method);
-
- if (!f || !channel_exists(f->channel_id)) {
- char buf[256];
- snprintf(buf,
- sizeof(buf),
- "Provider for method \"%s\" is not available",
- method);
- vim_report_error(cstr_as_string(buf));
- api_free_array(args);
- return NIL;
- }
-
- Error err = ERROR_INIT;
- Object result = NIL = channel_send_call(f->channel_id, method, args, &err);
-
- if (err.set) {
- vim_report_error(cstr_as_string(err.msg));
- api_free_object(result);
- return NIL;
- }
-
- return result;
-}
-
-void provider_init_feature_metadata(Dictionary *metadata)
-{
- Dictionary md = ARRAY_DICT_INIT;
-
- for (size_t i = 0; i < FEATURE_COUNT; i++) {
- Array methods = ARRAY_DICT_INIT;
- Feature *f = &features[i];
-
- size_t j;
- char *method;
- for (method = f->methods[j = 0]; method; method = f->methods[++j]) {
- ADD(methods, STRING_OBJ(cstr_to_string(method)));
- }
-
- PUT(md, f->name, ARRAY_OBJ(methods));
- }
-
- PUT(*metadata, "features", DICTIONARY_OBJ(md));
-}
-
-static Feature * find_feature(char *name)
-{
- for (size_t i = 0; i < FEATURE_COUNT; i++) {
- Feature *f = &features[i];
- if (!STRICMP(name, f->name)) {
- return f;
- }
- }
-
- return NULL;
-}
diff --git a/src/nvim/os/provider.h b/src/nvim/os/provider.h
deleted file mode 100644
index c6f12e02dd..0000000000
--- a/src/nvim/os/provider.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NVIM_OS_PROVIDER_H
-#define NVIM_OS_PROVIDER_H
-
-#include "nvim/api/private/defs.h"
-
-#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "os/provider.h.generated.h"
-#endif
-
-#endif // NVIM_OS_PROVIDER_H
-