lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On or about Fri, 20 Jun 2008, Matthew Paul Del Buono wrote: 
>Platform portability should not be a major issue. Since Windows 
>uses the simple ReadFile/WriteFile technique to work with serial 
>ports, as does most other OSes, a couple of #ifdefs or macros 
>should solve most of the problems....

Actually sending data is probably not the largest portability 
issue since that mostly amounts to learning the correct names 
for open, close, read and write. Although a program written to 
efficiently use Windows overlapped I/O requests would not be 
trivially ported to classic Unix where all I/O requests block 
the calling process.

The devil is in the details of port and driver configuration. 
Windows provides a rococo collection of capabilities for a basic 
RS-232 UART. If it thinks it the port might really be a modem, or 
if the port itself has a dedicated "provider", then things can 
get even more complex quite quickly. For a real fun read, track 
down the documentation on establishing a data call under the 
Windows Telephony API and try to make sense of it. Hand coding a 
send/expect module to dial the phone with classic Hayes AT 
commands (even after handling all the phone-line errors like no 
answer, wrong number, a FAX answered instead of a data modem, 
etc.) looks quite pleasant after that...

Incidentally, TAPI is way outside the scope of what I'm wrapping.

Ross Berteig                     
Cheshire Engineering Corp.