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.
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.
job: Refactor job_write to receive WBuffer instances.

This was done to give more control over memory management to job_write callers.
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.
events: Refactor event_poll to use stack-allocated timer handles
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.
build: Fix error in dispatch generator for functions with channel_id
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.
api: Change type of event data to `Object` from `typval_T`
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
api: Add helper macros for dealing with API type casts
wstream: simplify wstream_write interface