Commit Graph

1162 Commits

Author SHA1 Message Date
Justin M. Keyes
b17d9691a2 Add LICENSE. fix #878. PR #883
- change to Apache 2.0
- include Vim license in LICENSE
- upate README
2014-06-26 18:54:33 -04:00
Thiago de Arruda
9f1b9726fb Merge pull request #872 'Add support for client-side RPC' 2014-06-24 13:47:36 -03:00
Thiago de Arruda
296da85198 channel/msgpack_rpc: Refactor API dispatching
This is how API dispatching worked before this commit:

- The generated `msgpack_rpc_dispatch` function receives a the `msgpack_packer`
  argument.
- The response is incrementally built while validating/calling the API.
- Return values/errors are also packed into the `msgpack_packer` while the
  final response is being calculated.

Now the `msgpack_packer` argument is no longer provided, and the
`msgpack_rpc_dispatch` function returns `Object`/`Error` values to
`msgpack_rpc_call`, which will use those values to build the response in a
single pass.

This was done because the new `channel_send_call` function created the
possibility of having recursive API invocations, and this wasn't possible when
sharing a single `msgpack_sbuffer` across call frames(it was shared implicitly
through the `msgpack_packer` instance).

Since we only start to build the response when the necessary information has
been computed, it's now safe to share a single `msgpack_sbuffer` instance
across all channels and API invocations.

Some other changes also had to be performed:

- Handling of the metadata discover was moved to `msgpack_rpc_call`
- Expose more types as subtypes of `Object`, this was required to forward the
  return value from `msgpack_rpc_dispatch` to `msgpack_rpc_call`
- Added more helper macros for casting API types to `Object`
  any
2014-06-24 13:02:24 -03:00
Thiago de Arruda
bc0380038e channel/msgpack_rpc: Refactor to better split functions across modules
Move validation/conversion functions and to msgpack_rpc_helpers to separate
those from the functions that are used from the channel module
2014-06-24 13:02:24 -03:00
Thiago de Arruda
ea7a389ec7 channel: Implement the 'channel_send_call' function
This function is used to send RPC calls to clients. In contrast to
`channel_send_event`, this function will block until the client sends a
response(But it will continue processing requests from that client).

The RPC call stack has a maximum depth of 20.
2014-06-24 13:02:24 -03:00
Thiago de Arruda
09605cec03 channel/msgpack_rpc: Refactor msgpack_rpc_notification/serialize_event
- Generalize some argument names(event type -> event name,
                                 event data -> event arg)
- Rename serialize_event to serialize_message
- Rename msgpack_rpc_notification to msgpack_rpc_message
- Extract the message type out of msgpack_rpc_message
- Add 'id' parameter to msgpack_rpc_message/serialize_message to create messages
  that are not notifications
2014-06-24 13:02:24 -03:00
Thiago de Arruda
c0b0bd07fd channel: Extract function for sending errors that are not responses 2014-06-24 13:02:24 -03:00
Thiago de Arruda
c8297e462a channel: Extract 'channel_write' function 2014-06-24 13:02:24 -03:00
Thiago de Arruda
0dea2682dc job: Add a maxmem parameter to job_start
The value is forwarded to it's own WStream instance
2014-06-24 13:02:24 -03:00
Thiago de Arruda
c722e22ee6 wstream: Make wstream_write consider the return value from uv_write 2014-06-24 13:02:23 -03:00
Thiago de Arruda
30fc6a4fd1 wstream: Use a default value of 10mb for maxmem when 0 is passed 2014-06-24 13:02:23 -03:00
Thiago de Arruda
11916b6b59 wstream: Refactor buffer memory management
- Extract code to release WBuffer instances into `release_wbuffer`
- Fix memory leak when wstream_write returns false
2014-06-24 13:02:23 -03:00
Thiago de Arruda
0fd46ae8f0 job: Fix vimscript wrapper by returning when an invalid id is passed 2014-06-24 13:02:23 -03:00
Thiago de Arruda
ef4c5ccb21 event: Decouple user input checks from event_poll
This was done to generalize the usage of `event_poll`, which will now return
`true` only if a event has been processed/deferred before the timeout(if not
-1).

To do that, the `input_ready` calls have been extracted to the input.c
module(the `event_poll` call has been surrounded by `input_ready` calls,
resulting in the same behavior).

The `input_start`/`input_stop` calls still present in `event_poll` are
temporary: When the API becomes the only way to read user input, it will no
longer be necessary to start/stop the input stream.
2014-06-24 13:02:23 -03:00
Thiago de Arruda
b00a37544c event: Bail out of event_poll when any event is processed
The loop condition was set to only exit when user input is processed, but we
must exit on any event to properly notify `event_poll` callers
2014-06-24 13:02:23 -03:00
Justin M. Keyes
e1264412f8 update style guide URL 2014-06-23 17:44:12 -04:00
Pavel Platto
7a67828630 Use generated declarations in cursor.h #849 2014-06-20 02:44:11 -04:00
oni-link
90385163d5 coverity/15010: Remove dead code. #829
In win_close_othertab: Code can never be reached because of a
logical contradiction (CWE-561).
Pointer tp cannot be NULL at this point, so conditional operator ? can
be replaced with its second expression.
2014-06-20 02:41:14 -04:00
oni-link
4ccf1125ff vim-patch:7.4.303 #818
Problem:    When using double-width characters the text displayed on the
            command line is sometimes truncated.
Solution:   Reset the string lenght. (Nobuhiro Takasaki)

https://code.google.com/p/vim/source/detail?r=463ef551e9f62b63ac3f85f1f297b668b14bcd09
2014-06-20 02:38:29 -04:00
oni-link
c388737957 vim-patch:7.4.302 #817
Problem:    Signs placed with 'foldcolumn' set don't show up after filler
            lines.
Solution:   Take filler lines into account. (Olaf Dabrunz)

https://code.google.com/p/vim/source/detail?r=df141c80ea3a1ffcbf82d05c1314675231fcfa75
2014-06-20 02:34:39 -04:00
oni-link
02d935729f vim-patch:7.4.301 #816
Problem:    Still a scrolling problem when loading a session file.
Solution:   Fix off-by-one mistake. (Nobuhiro Takasaki)

https://code.google.com/p/vim/source/detail?r=8cb42aa3c4957a543e5dffe307475dbab969612f
2014-06-20 02:31:21 -04:00
oni-link
937c78fe2e vim-patch:7.4.298 #815
Problem:    Can't have a funcref start with "t:".
Solution:   Add "t" to the list of accepted names. (Yukihiro Nakadaira)

https://code.google.com/p/vim/source/detail?r=156f891d520e93eab5d3ce02784660fb13a3b0d3
2014-06-20 02:28:51 -04:00
Justin M. Keyes
59fc9e3aec Merge #824 'Doxygen neovim.org theme' 2014-06-19 17:20:21 -04:00
Stefan Hoffmann
f02a725e22 update customdoxygen.css for doxygen 1.8.7
some icon images in the html are replaced with css.
2014-06-19 11:53:57 +02:00
Stefan Hoffmann
c0a6c04f08 update theme to match neovim.org 2014-06-19 11:53:57 +02:00
Stefan Hoffmann
e26220d342 add default doxygen 1.8.6 theme files 2014-06-19 11:53:57 +02:00
Stefan Hoffmann
e9577eeaeb move documentation output to build/doxygen 2014-06-19 11:53:57 +02:00
Will Stamper
3141c02c02 coverity/68215: removed failed variable + dead code from f_readfile #860 2014-06-18 23:57:05 -04:00
Nikolay Orlyuk
ec72b7adc7 spatch to drop check after alloc/lalloc/xmalloc #690 2014-06-18 19:21:01 -04:00
John Szakmeister
f870982634 Merge pull request #845 'Testdir and top-level Makefile improvements' 2014-06-18 16:21:45 -04:00
ZyX
1302702586 Make indentation consistent: use 2-space indent always 2014-06-18 16:21:12 -04:00
ZyX
2653cebcd7 Use MAKEOVERRIDES to pass SCRIPTS/TESTNUM arguments for make test 2014-06-18 16:21:12 -04:00
ZyX
24a08b32ab test1.in is not a test and it must be run always
test1.in generates files like small.vim, tiny.vim, mbyte.vim, mzscheme.vim,
lua.vim which are then used by other tests. So it must be run always.
2014-06-18 16:21:11 -04:00
ZyX
b0641510b6 Avoid ever creating .deps directory
Thanks to @jszakmeister this uses make own features.
2014-06-18 16:21:11 -04:00
Thiago de Arruda
090870ca04 Merge PR #853 2014-06-18 12:16:53 -03:00
Thiago de Arruda
a7d027c8ab api: Add helper macros for dealing with API type casts 2014-06-18 11:36:08 -03:00
Thiago de Arruda
caf2fb8480 api: Enable usage of Arrays and Dictionaries as [k]vectors
- Rename a/n/m to items/size/capactity in kvec.h
- Add capactity field to Arrays/Dictionaries
2014-06-18 11:36:08 -03:00
Thiago de Arruda
20fda27cda api: Change type of event data to Object from typval_T 2014-06-18 11:36:07 -03:00
Thiago de Arruda
5aca2a6cd8 api: Rename find_{buffer,window,tabpage}
They were renamed to find_{buffer,window,tabpage}_by_handle to avoid conflicts
with existing functions of the same name.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
72907c34f4 build: increase timeout for run-api-tests.exp 2014-06-18 11:36:07 -03:00
Thiago de Arruda
796ea333d4 build: Fix error in dispatch generator for functions with channel_id 2014-06-18 11:36:07 -03:00
Thiago de Arruda
0621a6eaa5 events: Refactor how events are queued for processing
To make it possible reuse `event_poll` recursively and in other blocking
function calls, this changes how deferred/immediate events are processed:

- There are two queues in event.c, one for immediate events and another for
  deferred events. The queue used when pushing/processing events is determined
  with boolean arguments passed to `event_push`/`event_process` respectively.
- Events pushed to the immediate queue are processed inside `event_poll` but
  after the `uv_run` call. This is required because libuv event loop does not
  support recursion, and processing events may result in other `event_poll`
  calls.
- Events pushed to the deferred queue are processed later by calling
  `event_process(true)`. This is required to "trick" vim into treating all
  asynchronous events as special keypresses, which is the least obtrusive
  way of introducing asynchronicity into the editor.
- RStream instances will now forward the `defer` flag to the `event_push` call.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
05bf7808e0 events: Refactor event_poll to use stack-allocated timer handles 2014-06-18 11:36:07 -03:00
Thiago de Arruda
4cb5ce3c52 channel: Make channel_{un}subscribe abort the program for invalid ids
These functions will never be called directly by the user so bugs are the only
reason for passing invalid channel ids. Instead of returning silently we abort
to improve bug detection.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
abc423983d job: Refactor job_write to receive WBuffer instances.
This was done to give more control over memory management to job_write callers.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
287967a2c0 job: Add defer flag and setter method
This is has the same effect as the RStream 'defer' flag, but also works for the
job's exit event.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
71d9899f3c job: Refactor to use pointers instead of ids
'job_start' returns the id as an out paramter, and the 'job_find' function is
now used by eval.c to translate job ids into pointers.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
05fd154ede rstream: Implement the rstream_set_defer function
This function will be used to temporarily change the `defer` flag on rstream
instances.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
1843f0c2c6 rstream: Rename RStream async flag to defer
The name `async` was not appropriate to describe the behavior enabled by the
flag.
2014-06-18 11:36:07 -03:00
Thiago de Arruda
ac5fb407e4 wstream: Refactor wstream_new_buffer/wstream_write
- Removed 'copy' parameter from `wstream_new_buffer`. Callers simply pass a
  copy of the buffer if required.
- Added a callback parameter, which is used to notify callers when the data is
  successfully written. The callback is also used to free the buffer(if
  required) and is compatible with `free` from the standard library.
2014-06-18 11:36:04 -03:00