Commit Graph

1336 Commits

Author SHA1 Message Date
Nicolas Hillegeer
6cbda2cbf6 viml: re-add sha256() function
Was removed in #699 but actually doesn't have anything to do with security.
2014-07-21 19:29:29 +02:00
Justin M. Keyes
845d1bfa90 Merge #965 'Make os_get_localtime() portable + fix bug on win' 2014-07-20 18:27:49 -04:00
Nicolas Hillegeer
636ddd075c os/time: fix os_localtime_r on win + add func_attr
- it makes no sense for these functions to take NULL pointers
- if `localtime()` on Windows returns a NULL pointer, the old code would try
  to dereference it.
2014-07-20 18:27:45 -04:00
Nicolas Hillegeer
6610b002ef os/time: make os_get_localtime more portable
gettimeofday() doesn't exist on Windows, as reported by @equalsraf. It seems
a call to time() would be sufficient here, as only the seconds since the
UNIX epoch are needed.
2014-07-20 18:27:45 -04:00
Nicolas Hillegeer
8d44e36b1a os/time: include time.h in os/time.h
Include what you use, also in the positive direction.
2014-07-20 18:27:45 -04:00
Justin M. Keyes
a9d679b1d7 Merge #962 'Implement startuptime functions on top of profiling functions' 2014-07-20 18:12:45 -04:00
Nicolas Hillegeer
2fcfee39ce startuptime: print vim -> nvim 2014-07-20 16:59:58 -04:00
Nicolas Hillegeer
fb15cbbaea startuptime: always enable startuptime
Removes the STARTUPTIME define.
2014-07-20 16:59:57 -04:00
Nicolas Hillegeer
ab1eec10a1 globals.h: decouple vim.h and globals.h
Allow globals.h to be included without including vim.h. Another small piece
of the puzzle of dismantling vim.h.

Moving some extra `#define`'s to globals.h is no better than having them in
vim.h. We should, in a later PR, move them to the file where they belong or
to a separate `constants.h` or something.
2014-07-20 16:59:57 -04:00
Nicolas Hillegeer
d19712f233 garray: add necessary includes
The upcoming decoupling of vim.h and globals.h needs this to compile.
2014-07-20 16:59:57 -04:00
Nicolas Hillegeer
47815fc6f4 startuptime: implement on top of profiling fns
Reuse the profiling functions to implement the startuptime functions.
Decreases our dependency on `gettimeofday()` and thus gets us a little bit
closer to a clean port to Windows.
2014-07-20 16:59:57 -04:00
Nicolas Hillegeer
a001510382 startuptime: move code to profile.{c,h} + doc
It's a better place to put it. Also slightly documented and reformatted, but
not changed.
2014-07-20 16:59:57 -04:00
Wesley Wiser
c7eb8c5cd7 coverity/62610: Remove dead code from setfname() 2014-07-20 04:49:38 -04:00
Nicolas Hillegeer
1b932cbfec types: typedef long_u as uintptr_t #961
As discussed here: https://github.com/neovim/neovim/pull/941/files#r15026398
2014-07-20 04:47:17 -04:00
Thiago de Arruda
953d61cbf8 Merge PR #895 'Core service providers...' 2014-07-17 12:06:31 -03:00
Thiago de Arruda
4dc642aa62 api tests: set 'initpython' in BeforeEachTest
This is required to run some tests of the python client
2014-07-17 11:37:42 -03:00
Thiago de Arruda
2e4ea29d2c events: Refactor how event deferral is handled
- Remove all *_set_defer methods and the 'defer' flag from rstream/jobs
- Added {signal,rstream,job}_event_source functions. Each return a pointer that
  represent the event source for the object in question(For signals, a static
  pointer is returned)
- Added a 'source' field to the Event struct, which is set to the appropriate
  value by the code that created the event.
- Added a 'sources' parameter to `event_poll`. It should point to a
  NULL-terminated array of event sources that will be used to decide which
  events should be processed immediately
- Added a 'source_override' parameter to `rstream_new`. This was required to use
  jobs as event sources of RStream instances(When "focusing" on a job, for
  example).
- Extracted `process_from` static function from `event_process`.
- Remove 'defer' parameter from `event_process`, which now operates only on
  deferred events.
- Refactor `channel_send_call` to use the new lock mechanism

What changed in a single sentence: Code that calls `event_poll` have to specify
which event sources should NOT be deferred. This change was necessary for a
number of reasons:

- To fix a bug where due to race conditions, a client request
  could end in the deferred queue in the middle of a `channel_send_call`
  invocation, resulting in a deadlock since the client process would never
  receive a response, and channel_send_call would never return because
  the client would still be waiting for the response.
- To handle "event locking" correctly in recursive `channel_send_call`
  invocations when the frames are waiting for responses from different
  clients. Not much of an issue now since there's only a python client, but
  could break things later.
- To simplify the process of implementing synchronous functions that depend on
  asynchronous events.
2014-07-17 11:37:42 -03:00
Thiago de Arruda
cf30837951 api/events/msgpack: Insert log statements to improve debugging
Also changed the default log level to INFO so developers won't end up with big
log files without asking explicitly(DLOG statements were placed in really "hot"
code)
2014-07-17 11:37:41 -03:00
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