rebol/rebol — pull request #223 by kealist (2014-06-11 03:33:50+00:00)
Title: FEAT: Initial serial port implementation for POSIX and WIN32

Serial Implementation
=================
This pull request includes two commits:

* The first commit is Carl's serial code implementation from the ReCode conference.

* The second commit contains the extensions that I have made to it which include:
-Win32 Implementation
-Ability to properly open and close more than one serial port (With the REBREQ Union change)
-Made a few changes to match style of the rest of repository as far as I can tell

Notes
--------
- For non-posix or win32 systems this will not compile. I was advised not to add a bunch of ifdefs in lieu of creating stub files for the dev-serial.c when we come across them. I do not have the ability to test other systems
- I have tested extensively on Linux & Win32 without any issues. Need someone to test on OS X

Usage
---------
```Rebol
serial-port: open serial://ttyS1/19200
```
Then, read/write binary. Keep in mind it's buffered only by the OS itself, so for long reads, you'll want to do the buffering yourself:

```rebol
response: make binary! 1000
while [not empty? buf: read serial-port][
append response buf
wait .2
]
```