pem@cadnetix.COM (Paul Meyer) (11/21/89)
[] I'm writing a "door" for Red Ryder Host, and am trying to implement the RRH "hot menus" feature. The idea is that while a menu is printing out a keystroke (a command from the menu) will interrupt the printout and immediately do the command. (This can save a lot of time on slow connections.) I'm not using the CommToolbox (yet), because I'm not sure how well I can interface it to RRH which doesn't use it either. (I'm also as leery of the configuration by script options as some of the other posters have been.) The easiest thing would be to check if there is pending stuff in the serial driver's buffer. A couple of calls in IM looked like they *might* give this info, but both looked more likely not to (please pardon any misremembered call names; I don't have my IM at work): SerGetBufSize? returns the size of the serial buffer. I suspect this is the size it was allocated (default or by the set-buffer call), not the amount in use or amount left. SerGetStatus has bits for pending reads and writes, but I suspect this is for whether any incomplete asynchronous calls are running. Failing a simple way to do this, my next thought would be to always have a 1-byte asynchronous call going, and use the completion routine to add the incoming characters to the buffer I keep locally-generated keystrokes in. The problem is that a technote says that major switches will not happen while File Manager asynchronous calls are pending; PBRead is a File Manager call, not a Device Manager one. It would be unacceptable to have a BBS- related application not backgroundable. I also looked for a PBRead call that would return with an error if no characters were available; this didn't seem to be there either. I know this can be done; if nothing else, RRH does it. (I hope SW didn't write his own serial driver!) Could somebody tell me a way to do this, or even a DTS-blessed way? Thanks in advance, etc. Paul Meyer pem@cadnetix.COM Daisy/Cadnetix Inc. (DAZIX) {uunet,boulder}!cadnetix!pem 5775 Flatirons Pkwy. GEnie P.MEYER CI$ 73627,1274 Boulder, CO 80301 (303)444-8075x277
rfl@oddjob.uchicago.edu (Bob Loewenstein) (11/22/89)
SerGetBuf is the call you want. It tells how many characters have come into the buffer since the last read.
tim@hoptoad.uucp (Tim Maroney) (11/22/89)
In article <10346@cadnetix.COM> pem@cadnetix.COM (Paul Meyer) writes: > The easiest thing would be to check if there is pending stuff in >the serial driver's buffer. A couple of calls in IM looked like they *might* >give this info, but both looked more likely not to (please pardon any >misremembered call names; I don't have my IM at work): > SerGetBufSize? returns the size of the serial buffer. I suspect this >is the size it was allocated (default or by the set-buffer call), not the >amount in use or amount left. No, SerGetBuf returns the number of bytes in the buffer of the input driver whose reference number you pass it, meaning the number of bytes waiting to be read. I suppose the IM language is a little vague, but I've done this, and it tells you how many characters have been received by the driver and not yet read by the application (or whoever is calling the driver). -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com FROM THE FOOL FILE: "Yet another piece of evidence that it's a Communist society which is being presented as good, but which we probably would not want to live in." -- Ken Arromdee on rec.arts.startrek, on the Federation's Red Menace