Commit Graph

1318 Commits

Author SHA1 Message Date
Thiago de Arruda
f180f6fdeb getchar: fix infinite loop due to pending events
The `inchar` function could enter an infinite loop if there are events pending
to be processed when an interrupt is received.
2014-07-17 11:37:41 -03:00
Thiago de Arruda
83cad98d5d api: make buffer_{get,set}_slice automatically assume include_end
This is for compatibility with python-vim interface: When passing an end index
with a value higher than the last index, assume the `include_end` flag
2014-07-17 11:37:41 -03:00
Thiago de Arruda
fba1d3b50f provider: Add support for clipboard registers.
This reimplements the '+'/'*' clipboard registers(both are aliases to the same
register, no dedicated storage for the X11 selection) on top of the provider
infrastructure.

This adds two new 'unnamedclip' option, has the same effect of setting
'clipboard' to 'unnamed/unnamedplus' in vim

The 'clipboard' option was not reused because all values(except 'unnamedplus')
seem to be useless for Neovim, and the code to parse the option was relatively
big. The option remains for vim compatibility but it's silently ignored.
2014-07-17 11:37:41 -03:00
Thiago de Arruda
486c8e37c1 provider: Add support for python commands/functions
This uses the provider/scripting infrastructure to reintroduce python support
through the msgpack-rpc API.

A new 'initpython' option was added, and it must be set to a command that will
bootstrap the python provider the first time it's needed.
2014-07-17 11:37:41 -03:00
Thiago de Arruda
8a091e7f5c provider: Add support functions for calling external interpreters
This uses the provider module infrastructure to implement common code for
vimscript commands/functions that need to communicate with external
interpreters, eg: pydo, rubydo, pyfile, rubyfile, etc.
2014-07-17 11:37:41 -03:00
Thiago de Arruda
887d32e546 provider: New module used to expose extension points for core services
Introducing the concept of providers: co-processes that talk with the editor
through the remote API and provide implementation for one or more core
services.

The `provider_register` function and it's API wrapper can be used by channels
that want to self-register as a service provider.

Some old builtin vim features will be re-implemented as providers. The
`provider_has_feature` function is used to check if a provider
implementing a certain feature is available(It will be called by the `has`
vimscript function to check for features in a vim-compatible way)

This implements the provider module without exposing any extension points, which
will be done in future commits.
2014-07-17 11:37:08 -03:00
Thiago de Arruda
0b2b1da0e8 channel: Bugfixes and refactor
- All functions that require a channel id will fail when the channel was
  disabled
- Rewrite `call_stack_unwind` as `call_set_error`. It will now disable the
  channel and set error on all frames. The stack will be unwinded automatically
  while the involved functions exit.
- Remove `disable_channel` function. If channels are disabled, they will be
  closed as soon as possible
2014-07-17 11:30:01 -03:00
Thiago de Arruda
bce4c365bc job: No longer free the job data. It's now done by the exit callback 2014-07-17 11:30:01 -03:00
Thiago de Arruda
c19b8404a7 channel: Implement channel_exists function 2014-07-17 11:30:01 -03:00
Thiago de Arruda
21d44ab115 channel: Refactor channel_from_job to return the channel id 2014-07-17 11:30:01 -03:00
Thiago de Arruda
f17668234a api: Refactor write_msg to use separate out/err buffers 2014-07-17 11:30:01 -03:00
Thiago de Arruda
0e20afe37e wstream: Pass WBuffer refcount as a constructor parameter
This is required to handle broadcasting when the first write fails.

Ref: 11916b6b59 (commitcomment-6792287)
2014-07-17 11:30:01 -03:00
Thiago de Arruda
5d9c73ce70 wstream: document default value for 'maxmem' 2014-07-17 11:30:01 -03:00
Thiago de Arruda
b92630c2ff Merge pull request #964 '[RFC] Fix #963' 2014-07-17 11:23:36 -03:00
Pavel Platto
974408f2de Fix #963.
Problem: Bug was introduced because `os_open` returns `-errno` in case
of an error instead of just `-1` which was returned by `mch_open`.
Solution: Check return value with `< 0` instead of `== -1`.
2014-07-17 11:23:29 -03:00
John Szakmeister
e057676a89 Merge #928 'Move po gen to cmake'
This includes the necessary fixes to sv.po to make the build work again.
2014-07-17 07:17:35 -04:00
John Szakmeister
92558ee3a4 Fix some newline issues in the sv translation. 2014-07-17 07:16:53 -04:00
John Szakmeister
531ded7865 Move po generation from Make to CMake.
Fixes #902: localization build: `install`, `uninstall`, `prefixcheck
targets.  All the language-related bits will now build under CMake.
Changes include:

  * Moving all non-generated sources into the NEOVIM_SOURCES variable
    to aid in generating the .pot file.
  * Moving a couple generated sources from NEOVIM_SOURCES and into
    NEOVIM_GENERATED_SOURCES.
  * Added NEOVIM_HEADERS to the executable and the library for folks who
    are using something other than Ninja or makefiles (that way the
    headers will show up in the IDE files).
  * Now uses gettext's `--update` switch to update the .po files, rather
    than doing a fragile `mv` dance that could leave you with a broken
    working tree if you press CTRL-C at the right time.
  * Creates `update-po-${LANG}` targets for updating individual
    languages, just like the original Makefile.
  * Also adds the `update-po` target for updating all the languages.
  * Ported the `check-${LANG}` style targets.  They're
    `check-po-${LANG}` under CMake.
  * Handles all the one-off instances that were in the original
    Makefile.  Fixed up ko.UTF-8.po to include the "Original
    translation" line like other .po files to make the generation of the
    "Generate from ..." comments consistent.  Updated ko.po with the new
    text.
2014-07-17 07:16:53 -04:00
John Szakmeister
1f3fb5ffea Customize the log file for the check targets based on the input file.
The idea being that it's better to segregate feedback, just in case
someone is working on several translations.  Now the check log will
appear in `./build/src/nvim/po/check-${LANG}.log`.
2014-07-17 07:16:53 -04:00
John Szakmeister
c261b351ed Revert "Merge #928 'Move po gen to cmake'"
This reverts commit 53fba180c3, reversing
changes made to a3b3db8256.
2014-07-17 06:10:38 -04:00
John Szakmeister
53fba180c3 Merge #928 'Move po gen to cmake' 2014-07-17 05:47:36 -04:00
John Szakmeister
0edb95fa0c Customize the log file for the check targets based on the input file.
The idea being that it's better to segregate feedback, just in case
someone is working on several translations.  Now the check log will
appear in `./build/src/nvim/po/check-${LANG}.log`.
2014-07-17 05:47:32 -04:00
John Szakmeister
67533e0948 Move po generation from Make to CMake.
Fixes #902: localization build: `install`, `uninstall`, `prefixcheck
targets.  All the language-related bits will now build under CMake.
Changes include:

  * Moving all non-generated sources into the NEOVIM_SOURCES variable
    to aid in generating the .pot file.
  * Moving a couple generated sources from NEOVIM_SOURCES and into
    NEOVIM_GENERATED_SOURCES.
  * Added NEOVIM_HEADERS to the executable and the library for folks who
    are using something other than Ninja or makefiles (that way the
    headers will show up in the IDE files).
  * Now uses gettext's `--update` switch to update the .po files, rather
    than doing a fragile `mv` dance that could leave you with a broken
    working tree if you press CTRL-C at the right time.
  * Creates `update-po-${LANG}` targets for updating individual
    languages, just like the original Makefile.
  * Also adds the `update-po` target for updating all the languages.
  * Ported the `check-${LANG}` style targets.  They're
    `check-po-${LANG}` under CMake.
  * Handles all the one-off instances that were in the original
    Makefile.  Fixed up ko.UTF-8.po to include the "Original
    translation" line like other .po files to make the generation of the
    "Generate from ..." comments consistent.  Updated ko.po with the new
    text.
2014-07-17 05:47:32 -04:00
John Szakmeister
a3b3db8256 Merge #956 'travis.sh: move symbolizer definition into common area' 2014-07-17 05:30:33 -04:00
John Szakmeister
1172e25fad travis.sh: move symbolizer definition into common area 2014-07-17 05:30:20 -04:00
Justin M. Keyes
0897277af8 Merge pull request #941 from aktau/improve-luajit-ffi-preproc
refactor includes + improve testing infrastructure
2014-07-16 17:07:58 -04:00
Nicolas Hillegeer
7c6079f6f0 vim: include used definitions in headers
This is not an exhaustive commit, it merely ameliorates the situations a
bit. There are quite a few header files that don't include all the types
they use in their function/struct/... definitions. This throws of the
testing infrastructure (but is not such a problem for the main binary that
has the "tumbleweed of includes"-phenomenon).
2014-07-16 19:07:45 +02:00
Nicolas Hillegeer
06ca70b191 test/fs: move tests of path_full_dir_name to path
Move tests of path_full_dir_name to path_spec. It is only defined in path.h.
Not sure why this works most of the time (I can only trigger a failure when
running under lldb).

It's a more logical place to have the test as well.
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
c376cf46bf test/helpers: add 'vim_init' helper
- Initializes some global variables.
- Necessary for the buffer tests in PR #904.
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
32ddfec84f memory.h: don't include vim.h in header files
Also include stdint.h in khash.h. It was transitively included by vim.h via
memory.h before. khash.h accidentally relied on that.
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
1710fa4337 vim: move vim_acl_T to types.h
Also include "types.h" in os_unix.h because it declares functions that
return vim_acl_T.
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
109c70dc60 test/preprocess: always declare EXTERN
Unit tests never need to declare globals, only access them. In the main code
base this is handled by including "vim.h". If a file wants to declare
globals (in the case of neovim that's only main.c), it #define's EXTERN and
includes "vim.h". Otherwise, a file just includes "vim.h" (that's the
majority case). Since we want to be able to run unit tests without including
"vim.h", we predefine "EXTERN" to mean extern. That way, we don't have to
include "vim.h".
2014-07-16 19:05:35 +02:00
Nicolas Hillegeer
0564f781ab vim: move disptick_T from vim.h to syntax_defs.h
Make vim.h smaller, bit by bit.
2014-07-16 19:05:34 +02:00
Nicolas Hillegeer
e288ddaee7 vim: move linenr_T and colnr_T to pos.h
Try to cut down vim.h's size. It's keeping us from testing more things.
2014-07-16 19:05:34 +02:00
Nicolas Hillegeer
fb72f1ee37 vim: move long_u from vim.h to types.h
Seems to make no difference to the main binary, but it helps the tests a bit
further along.
2014-07-16 19:05:34 +02:00
Nicolas Hillegeer
08fad0f8f6 hashtab.h: don't include vim.h
Including vim.h in another header filer is asking for trouble. Test code
that includes separate header files (e.g.: cimport './src/nvim/buffer.h'),
has a really bad time with this. This is just one piece of the puzzle
though.
2014-07-16 19:05:34 +02:00
Justin M. Keyes
90a206d332 doc: add clang analysis badge to README.md 2014-07-16 12:53:38 -04:00
Justin M. Keyes
0412c17a65 Merge pull request #839 from aktau/platform-abstract-time-fn
viml: impl profiling on top of uv_hrtime()
2014-07-16 12:46:07 -04:00
Nicolas Hillegeer
6d0f9417ec profiling: add tests
Some functions are missing:

- profile_self
- profile_get_wait
- profile_set_wait
- profile_sub_wait
2014-07-16 17:12:35 +02:00
Nicolas Hillegeer
9386f5d41e profiling: move static to function scope
It wasn't used anywhere else, our coding guidelines mandate the tightest
scope possible.
2014-07-16 17:12:35 +02:00
Nicolas Hillegeer
db7cd61f62 profiling: implement on top of os_hrtime()
Should be better than gettimeofday() since libuv uses higher resolution
clocks on most UNIX platforms. Libuv also tries to use monotonic clocks,
kernel bugs notwithstanding, which is another win over gettimeofday().

Necessary for Windows, which doesn't have gettimeofday(). In vanilla vim,
Windows uses QueryPerformanceCounter, which is the correct primitive for
this sort of things, but that was removed when slimming up the codebase.
Libuv uses QueryPerformanceCounter to implement uv_hrtime() on Windows so
the behaviour of vim profiling on Windows should now be the same.

The behaviour on Linux should be different (better) though, libuv uses more
accurate primitives than gettimeofday().

Other misc. changes:
- Added function attributes where relevant (const, pure, ...)
- Convert functions to receive scalars: Now that proftime_T is always a
  (uint64_t) scalar (and not a struct), it's clearer to convert the
  functions to receive it as such instead of a pointer to a scalar.
- Extract profiling funcs to profile.c: make everything clearer and reduces
  the size of the "catch-all" ex_cmds2.c
- Add profile.{c,h} to clint and -Wconv:
  - Don't use sprintf, use snprintf
  - Don't use long, use int16_t/int32_t/...
2014-07-16 17:12:34 +02:00
Nicolas Hillegeer
f172b19f43 os: implement os_hrtime
Just an alias to uv_hrtime. Provides a high-resolution timer.
2014-07-16 17:12:34 +02:00
Nicolas Hillegeer
095b4479c0 assert: add STATIC_ASSERT macro
Can be quite handy, attempt to provide fallbacks for compilers that don't
support _Static_assert (which is technically a C11 feature). Suppress
warnings as best we can (Clang and GCC warn that we're using a C11 feature
while in C99 mode).

Needs to be tested for MSVC still.
2014-07-16 17:12:34 +02:00
John Szakmeister
e1075ffff9 Merge #947 'Remove Clang 3.4 installation in travis.sh.' 2014-07-16 06:01:15 -04:00
Florian Walch
5433694db3 travis.sh: Simplify clang/asan build.
* Clang 3.4 now default on Travis CI.
* Introduce config variable to download & use different clang version.
2014-07-16 06:01:02 -04:00
Florian Walch
2cae6919dc travis.sh: Use dependencies from neovim/deps. 2014-07-16 06:01:02 -04:00
Florian Walch
58e85fca02 travis.sh: Fix mixed tabs/whitespace formatting. 2014-07-16 06:01:02 -04:00
Nicolas Hillegeer
25f3cedfe6 Merge #813 'Add platform checks to replace config.h.in hardcoded values' 2014-07-15 10:44:31 +02:00
Rui Abreu Ferreira
99e60f6242 Clean up DEBUG check in config.h.in 2014-07-15 10:43:21 +02:00
Rui Abreu Ferreira
feffc65270 Add cmake platform checks
- Defined CMake checks for all headers in config.h.in
- Removed headers checks that are not used anymore:
  sgtty.h sys/statfs.h libintl.h poll.h
- Added UNIX check
- Add some fatal checks
  + Check for setenv() and fail if it does not exist
    since our os layer just assumes it does
  + lstat is required by os_unix.c
  + sys/wait.h is required in UNIX
- Removed entries for functions that are not being used: getcwd,
  getrlimit, getwd, nanosleep, sigaltstack, getwd, sigstack, fseeko
- Replaced nearly all defines in config.h.in for functions with
  compile time checks
- Add check for symbol FD_CLOEXEC
- Add check for langinfo CODESET
- HAVE_ICONV_H and HAVE_ICONV hold the expected checks but Neovim uses
  USE_ICONV define to actually decide whether to enable it
- Removed checks that are no longer needed
  + USEMEMMOVE
  + _FILE_OFFSET_BITS
  + HAVE_ST_BLKSIZE
  + dlfcn.h
2014-07-15 10:43:21 +02:00