Handle coalesced messages from the port

The port returns a message prefaced with a 2 byte length header. When
the port is reading the stdin of the child process, it ignores the
length header because the child process may or may not have called
execvp(), i.e., the port treats the child processes as streams.

The child process may reply in 2 ways: as the response to a call
(initiated from the erlang side) or it may originate an event (for
example, trapping a signal). If these events occur at about the same
time, the child will issue 2 writes but the parent may read the data in
1 read.

(There may be multiple events returned or multiple events and a call but
 there shouldn't be multiple calls returned in a message because calls
 are synchronous).

Fix this by parsing the payload into terms. The first message matching
the type requested by the caller is returned. The other messages are
pushed back into the caller's mailbox.

Problems:

* the timeout is not absolute. Every time a message is received, it is
  parsed and matched against the message type. If the message is not a
  match, the process will block in receive with timeout.

* probably better handled by using an intermediary process. For example,
  having a gen_server control the port.