[comp.sys.mac.programmer] How read by line from serial port

a_dent@vaxa.uwa.oz (02/13/90)

In article <6142.25d0059a@pbs.uucp> pcrable@pbs.uucp ( VAX WIZZ) writes:
>>    In article <AZnWC8e00WB5IMBW8u@andrew.cmu.edu>, rf1m+@andrew.cmu.edu (Richard Vernon Ford) writes...
>>    -How do you use FSRead in newline mode?  .....
>Along the same lines (hopefully), can you read from the serial port in 
>newline mode ?

I hope I don't get in trouble for saying this, but..

Sometime this year (possibly May) there should be an article in Computer
Language on "Programming Macintosh Communications" (or whatever variant of
title they come up with).

The article covers a few different approaches and environments.  One of the
main points is a set of routines which cover line-oriented transfers from
the serial port.  I wrote routines to implement block-buffer transfers and
then do things like "getLineFromBuffer".  These routines are sufficiently 
fast that a Mac can almost transfer directly to disk, at 9600 bps.  

Using serial port buffers, you can just toggle buffers and then process the
buffer directly.  Using FSRead, you are double-handling to the extent of
reading from the buffer into your variables.  The Mac incurs a lot of overhead
because it has to keep track of what you've read from the buffer, whilst
receiving data into that same buffer.  I conceptualize this as some sort of
"ring-buffer" but if someone who knows how it's done could speak up I'd be
interested.

(If you want to guarantee the publishing of this article, or twist his
arm for an early copy, try contacting Dave Taylor (Mac editor) at:
taylor@limbo.intuitive.com)

Andy Dent
a_dent@vaxa.uwa.oz.au