pty_process: split into plat-specific files (#3976)

This commit is contained in:
Rui Abreu Ferreira 2016-06-05 01:02:56 +01:00 committed by Justin M. Keyes
parent 02e6914a93
commit 6ed9d47a6e
7 changed files with 52 additions and 12 deletions

View File

@ -78,6 +78,9 @@ foreach(sfile ${NEOVIM_SOURCES})
if(${f} MATCHES "^(regexp_nfa.c)$")
list(APPEND to_remove ${sfile})
endif()
if(WIN32 AND ${f} MATCHES "^(pty_process_unix.c)$")
list(APPEND to_remove ${sfile})
endif()
endforeach()
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})

View File

@ -77,7 +77,7 @@
#include "nvim/eval/decode.h"
#include "nvim/os/os.h"
#include "nvim/event/libuv_process.h"
#include "nvim/event/pty_process.h"
#include "nvim/os/pty_process.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/time.h"

View File

@ -9,7 +9,7 @@
#include "nvim/event/wstream.h"
#include "nvim/event/process.h"
#include "nvim/event/libuv_process.h"
#include "nvim/event/pty_process.h"
#include "nvim/os/pty_process.h"
#include "nvim/globals.h"
#include "nvim/log.h"

View File

@ -0,0 +1,9 @@
#ifndef NVIM_OS_PTY_PROCESS_H
#define NVIM_OS_PTY_PROCESS_H
#ifdef WIN32
# include "nvim/os/pty_process_win.h"
#else
# include "nvim/os/pty_process_unix.h"
#endif
#endif // NVIM_OS_PTY_PROCESS_H

View File

@ -26,11 +26,11 @@
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/process.h"
#include "nvim/event/pty_process.h"
#include "nvim/os/pty_process_unix.h"
#include "nvim/log.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/pty_process.c.generated.h"
# include "os/pty_process_unix.c.generated.h"
#endif
bool pty_process_spawn(PtyProcess *ptyproc)
@ -86,8 +86,7 @@ error:
return false;
}
void pty_process_resize(PtyProcess *ptyproc, uint16_t width,
uint16_t height)
void pty_process_resize(PtyProcess *ptyproc, uint16_t width, uint16_t height)
FUNC_ATTR_NONNULL_ALL
{
ptyproc->winsize = (struct winsize){ height, width, 0, 0 };

View File

@ -1,5 +1,5 @@
#ifndef NVIM_EVENT_PTY_PROCESS_H
#define NVIM_EVENT_PTY_PROCESS_H
#ifndef NVIM_OS_PTY_PROCESS_UNIX_H
#define NVIM_OS_PTY_PROCESS_UNIX_H
#include <sys/ioctl.h>
@ -25,6 +25,7 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data)
}
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/pty_process.h.generated.h"
# include "os/pty_process_unix.h.generated.h"
#endif
#endif // NVIM_EVENT_PTY_PROCESS_H
#endif // NVIM_OS_PTY_PROCESS_UNIX_H

View File

@ -0,0 +1,28 @@
#ifndef NVIM_OS_PTY_PROCESS_WIN_H
#define NVIM_OS_PTY_PROCESS_WIN_H
#include "nvim/event/libuv_process.h"
typedef struct pty_process {
Process process;
char *term_name;
uint16_t width, height;
} PtyProcess;
#define pty_process_spawn(job) libuv_process_spawn((LibuvProcess *)job)
#define pty_process_close(job) libuv_process_close((LibuvProcess *)job)
#define pty_process_close_master(job) libuv_process_close((LibuvProcess *)job)
#define pty_process_resize(job, width, height)
#define pty_process_teardown(loop)
static inline PtyProcess pty_process_init(Loop *loop, void *data)
{
PtyProcess rv;
rv.process = process_init(loop, kProcessTypePty, data);
rv.term_name = NULL;
rv.width = 80;
rv.height = 24;
return rv;
}
#endif // NVIM_OS_PTY_PROCESS_WIN_H