Merge PR #1603 'Small refactoring and dependencies update'

This commit is contained in:
Thiago de Arruda 2014-12-03 10:35:25 -03:00
commit cb86eca91f
5 changed files with 30 additions and 36 deletions

View File

@ -918,7 +918,7 @@ void ex_diffpatch(exarg_T *eap)
#endif // ifdef UNIX
// Avoid ShellCmdPost stuff
block_autocmds();
(void)call_shell(buf, kShellOptFilter | kShellOptCooked, NULL);
(void)call_shell(buf, kShellOptFilter, NULL);
unblock_autocmds();
}

View File

@ -1097,7 +1097,7 @@ do_filter (
*/
if (call_shell(
cmd_buf,
kShellOptFilter | kShellOptCooked | shell_flags,
kShellOptFilter | shell_flags,
NULL
)) {
redraw_later_clear();
@ -1253,7 +1253,7 @@ do_shell (
if (!swapping_screen())
windgoto(msg_row, msg_col);
cursor_on();
(void)call_shell(cmd, kShellOptCooked | flags, NULL);
(void)call_shell(cmd, flags, NULL);
did_check_timestamps = FALSE;
need_check_timestamps = TRUE;

View File

@ -5,14 +5,13 @@
// Flags for mch_call_shell() second argument
typedef enum {
kShellOptFilter = 1, ///< filtering text
kShellOptExpand = 2, ///< expanding wildcards
kShellOptCooked = 4, ///< set term to cooked mode
kShellOptDoOut = 8, ///< redirecting output
kShellOptSilent = 16, ///< don't print error returned by command
kShellOptRead = 32, ///< read lines and insert into buffer
kShellOptWrite = 64, ///< write lines from buffer
kShellOptHideMess = 128, ///< previously a global variable from os_unix.c
kShellOptFilter = 1, ///< filtering text
kShellOptExpand = 2, ///< expanding wildcards
kShellOptDoOut = 4, ///< redirecting output
kShellOptSilent = 8, ///< don't print error returned by command
kShellOptRead = 16, ///< read lines and insert into buffer
kShellOptWrite = 32, ///< write lines from buffer
kShellOptHideMess = 64, ///< previously a global variable from os_unix.c
} ShellOpts;
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -54,7 +54,22 @@ void os_delay(uint64_t milliseconds, bool ignoreinput)
/// @param microseconds Number of microseconds to sleep
void os_microdelay(uint64_t microseconds)
{
microdelay(microseconds);
uint64_t elapsed = 0;
uint64_t ns = microseconds * 1000; // convert to nanoseconds
uint64_t base = uv_hrtime();
uv_mutex_lock(&delay_mutex);
while (elapsed < ns) {
if (uv_cond_timedwait(&delay_cond, &delay_mutex, ns - elapsed)
== UV_ETIMEDOUT)
break;
uint64_t now = uv_hrtime();
elapsed += now - base;
base = now;
}
uv_mutex_unlock(&delay_mutex);
}
/// Portable version of POSIX localtime_r()
@ -88,23 +103,3 @@ struct tm *os_get_localtime(struct tm *result) FUNC_ATTR_NONNULL_ALL
time_t rawtime = time(NULL);
return os_localtime_r(&rawtime, result);
}
static void microdelay(uint64_t microseconds)
{
uint64_t elapsed = 0;
uint64_t ns = microseconds * 1000; // convert to nanoseconds
uint64_t base = uv_hrtime();
uv_mutex_lock(&delay_mutex);
while (elapsed < ns) {
if (uv_cond_timedwait(&delay_cond, &delay_mutex, ns - elapsed)
== UV_ETIMEDOUT)
break;
uint64_t now = uv_hrtime();
elapsed += now - base;
base = now;
}
uv_mutex_unlock(&delay_mutex);
}

View File

@ -70,9 +70,9 @@ set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/0587afbb5fe8c
set(LUAROCKS_SHA1 61a894fd5d61987bf7e7f9c3e0c5de16ba4b68c4)
set(LUAROCKS_MD5 0f53f42909fbcd2c88be303e8f970516)
set(LIBUNIBILIUM_URL https://github.com/neovim/unibilium/archive/neovim.tar.gz)
set(LIBUNIBILIUM_SHA1 5d3d4913dd267b14f81fc665e0fa20661d3cb817)
set(LIBUNIBILIUM_MD5 0657a906164529f1e0f60aba3b876f23)
set(LIBUNIBILIUM_URL https://github.com/mauke/unibilium/archive/v1.1.1.tar.gz)
set(LIBUNIBILIUM_SHA1 582cbac75989d70e70953fa826cb5457cbfacc10)
set(LIBUNIBILIUM_MD5 c6ff790d31c2fb9e2dbe6c40004d6fc3)
set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/neovim.tar.gz)
set(LIBTERMKEY_SHA1 a309038a2297fe4905f03a8807723a9aa07c272a)
@ -281,7 +281,7 @@ if(USE_BUNDLED_LUAROCKS)
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client
COMMAND ${DEPS_BIN_DIR}/luarocks
ARGS build https://raw.githubusercontent.com/neovim/lua-client/0aefb79d8f60fd180594f376d20144414e1f37a4/nvim-client-0.0.1-3.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR}
ARGS build https://raw.githubusercontent.com/neovim/lua-client/8c40a2fdad5cc407ed5781909965ac87db0aefb0/nvim-client-0.0.1-5.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR}
DEPENDS lpeg libuv)
add_custom_target(nvim-client
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client)