From d8081d6fa946f5017ff07d781b9ba437de8a0595 Mon Sep 17 00:00:00 2001 From: xomachine Date: Thu, 24 Sep 2020 20:53:14 +0300 Subject: [PATCH] Fixes a type in the word response --- lua/vis.lua | 4 ++-- vis-lua.c | 22 +++++++++++----------- vis-lua.h | 2 +- vis-subprocess.c | 14 +++++++------- vis-subprocess.h | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lua/vis.lua b/lua/vis.lua index 149ee9012..13238a253 100644 --- a/lua/vis.lua +++ b/lua/vis.lua @@ -152,7 +152,7 @@ local events = { WIN_OPEN = "Event::WIN_OPEN", -- see @{win_open} WIN_STATUS = "Event::WIN_STATUS", -- see @{win_status} TERM_CSI = "Event::TERM_CSI", -- see @{term_csi} - PROCESS_RESPONCE = "Event::PROCESS_RESPONCE", -- see @{process_responce} + PROCESS_RESPONSE = "Event::PROCESS_RESPONSE", -- see @{process_response} } events.file_close = function(...) events.emit(events.FILE_CLOSE, ...) end @@ -168,7 +168,7 @@ events.win_highlight = function(...) events.emit(events.WIN_HIGHLIGHT, ...) end events.win_open = function(...) events.emit(events.WIN_OPEN, ...) end events.win_status = function(...) events.emit(events.WIN_STATUS, ...) end events.term_csi = function(...) events.emit(events.TERM_CSI, ...) end -events.process_responce = function(...) events.emit(events.PROCESS_RESPONCE, ...) end +events.process_response = function(...) events.emit(events.PROCESS_RESPONSE, ...) end local handlers = {} diff --git a/vis-lua.c b/vis-lua.c index f1c25b812..c6762d957 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -170,8 +170,8 @@ void vis_lua_win_close(Vis *vis, Win *win) { } void vis_lua_win_highlight(Vis *vis, Win *win) { } void vis_lua_win_status(Vis *vis, Win *win) { window_status_update(vis, win); } void vis_lua_term_csi(Vis *vis, const long *csi) { } -void vis_lua_process_responce(Vis *vis, const char *name, - char *buffer, size_t len, ResponceType rtype) { } +void vis_lua_process_response(Vis *vis, const char *name, + char *buffer, size_t len, ResponseType rtype) { } #else @@ -1385,12 +1385,12 @@ static int close_subprocess(lua_State *L) { /*** * Open new process and return its input handler. * When the process will quit or will output anything to stdout or stderr, - * the @{process_responce} event will be fired. + * the @{process_response} event will be fired. * * The editor core won't be blocked while the external process is running. * * @function communicate - * @tparam string name the name of subprocess (to distinguish processes in the @{process_responce} event) + * @tparam string name the name of subprocess (to distinguish processes in the @{process_response} event) * @tparam string command the command to execute * @return the file handle to write data to the process, in case of error the return values are equivalent to @{io.open} error values. */ @@ -3180,18 +3180,18 @@ void vis_lua_term_csi(Vis *vis, const long *csi) { } /*** - * The responce received from the process started via @{Vis:communicate}. - * @function process_responce + * The response received from the process started via @{Vis:communicate}. + * @function process_response * @tparam string name the name of process given to @{Vis:communicate} - * @tparam string responce_type can be "STDOUT" or "STDERR" if new output was received in corresponding channel, "SIGNAL" if the process was terminated by a signal or "EXIT" when the process terminated normally - * @tparam string|int buffer the available content sent by process; it becomes the exit code number if responce\_type is "EXIT", or the signal number if responce\_type is "SIGNAL" + * @tparam string response_type can be "STDOUT" or "STDERR" if new output was received in corresponding channel, "SIGNAL" if the process was terminated by a signal or "EXIT" when the process terminated normally + * @tparam string|int buffer the available content sent by process; it becomes the exit code number if response\_type is "EXIT", or the signal number if response\_type is "SIGNAL" */ -void vis_lua_process_responce(Vis *vis, const char *name, - char *buffer, size_t len, ResponceType rtype) { +void vis_lua_process_response(Vis *vis, const char *name, + char *buffer, size_t len, ResponseType rtype) { lua_State *L = vis->lua; if (!L) return; - vis_lua_event_get(L, "process_responce"); + vis_lua_event_get(L, "process_response"); if (lua_isfunction(L, -1)) { lua_pushstring(L, name); if (rtype == EXIT || rtype == SIGNAL) diff --git a/vis-lua.h b/vis-lua.h index 3ad5ce701..914f59050 100644 --- a/vis-lua.h +++ b/vis-lua.h @@ -39,6 +39,6 @@ void vis_lua_win_close(Vis*, Win*); void vis_lua_win_highlight(Vis*, Win*); void vis_lua_win_status(Vis*, Win*); void vis_lua_term_csi(Vis*, const long *); -void vis_lua_process_responce(Vis *, const char *, char *, size_t, ResponceType); +void vis_lua_process_response(Vis *, const char *, char *, size_t, ResponseType); #endif diff --git a/vis-subprocess.c b/vis-subprocess.c index 46ed8bb59..292b7cfcd 100644 --- a/vis-subprocess.c +++ b/vis-subprocess.c @@ -43,9 +43,9 @@ Process *vis_process_communicate(Vis *vis, const char *name, * returns the subprocess information structure, containing file descriptors * of the process. * Also stores the subprocess information to the internal pool to track - * its status and responces. + * its status and responses. * `name` - the string than should contain an unique name of the subprocess. - * This name will be passed to the PROCESS_RESPONCE event handler + * This name will be passed to the PROCESS_RESPONSE event handler * to distinguish running subprocesses. * `invalidator` - a pointer to the pointer which shows that the subprocess * is invalid when set to NULL. When subprocess dies, it is being set to NULL. @@ -134,14 +134,14 @@ int vis_process_before_tick(fd_set *readfds) { return maxfd; } -void read_and_fire(Vis* vis, int fd, const char *name, ResponceType rtype) { +void read_and_fire(Vis* vis, int fd, const char *name, ResponseType rtype) { /* Reads data from the given subprocess file descriptor `fd` and fires - * the PROCESS_RESPONCE event in Lua with given subprocess `name`, + * the PROCESS_RESPONSE event in Lua with given subprocess `name`, * `rtype` and the read data as arguments. */ static char buffer[MAXBUFFER]; size_t obtained = read(fd, &buffer, MAXBUFFER-1); if (obtained > 0) - vis_lua_process_responce(vis, name, buffer, obtained, rtype); + vis_lua_process_response(vis, name, buffer, obtained, rtype); } void vis_process_tick(Vis *vis, fd_set *readfds) { @@ -168,9 +168,9 @@ void vis_process_tick(Vis *vis, fd_set *readfds) { waitpid(current->pid, &status, 0); just_destroy: if (WIFSIGNALED(status)) - vis_lua_process_responce(vis, current->name, NULL, WTERMSIG(status), SIGNAL); + vis_lua_process_response(vis, current->name, NULL, WTERMSIG(status), SIGNAL); else - vis_lua_process_responce(vis, current->name, NULL, WEXITSTATUS(status), EXIT); + vis_lua_process_response(vis, current->name, NULL, WEXITSTATUS(status), EXIT); destroy(pointer); } } diff --git a/vis-subprocess.h b/vis-subprocess.h index 426aabd16..ae25e2121 100644 --- a/vis-subprocess.h +++ b/vis-subprocess.h @@ -14,7 +14,7 @@ struct Process { }; typedef struct Process Process; -typedef enum { STDOUT, STDERR, SIGNAL, EXIT } ResponceType; +typedef enum { STDOUT, STDERR, SIGNAL, EXIT } ResponseType; Process *vis_process_communicate(Vis *, const char *command, const char *name, void **invalidator);