I have gathered together the network_io patch as best I can.  The
author is Jim Bailey, not me - however Jim is currently roaming about
in the world and was unable to respond to my requests for permission
to distribute this code.  Jim did include the standard Vim license
comments in his files, and other members on the Slim-Vim list agree
that he would want his code in the main Vim tree.

Author : Jim Bailey
Purpose : Add functions to Vim that enable callbacks on file
descriptors.  This is particularly useful for scripts that wish to
listen to a socket and trigger some code to run when a socket gets
data.
When callbacks return true, they effectively send a flag up the stack,
where update_screen is called from getchar.c
Known bugs : Callback code can write text to buffers, when the
callback triggers screen_update, the syntax colouring can go the wrong
colour.  I used dmalloc to track memory, and there is some broken
memory in syntax.c - sorry I can't be more specific right now.
Potential issues :
- The update_screen call might be happening at the wrong place and
the wrong time.
 - The callback occurs deep in RealWaitForChar, and script code can
potentially call any exposed Vim function.  This might be a Bad Thing,
I'm not familiar enough with Vim internals to know.
- Callbacks MUST drain data from the file descriptor, otherwise there
will be a loop that hangs Vim, always calling the callback.
Patch specific bugs: (These are all my fault)
- I recorded the patch the wrong way around, it must be applied with
"patch -R ..."
 - I am not familiar with autoconf stuff, so this patch does not
integrate with the make system of Vim, somebody probably needs to add
it to config.in.  There were too many diffs in the various files that
I thought to check, and I didn't want to over patch them.

I think that's it.  I'd love to hear any feedback about this patch.
It would be fantastic if others found this useful.

Cheers
Brad

Attachment: network_io.patch.gz
Description: GNU Zip compressed data

Reply via email to