Path: utzoo!attcan!uunet!cadnetix.COM!cadnetix!pem From: pem@cadnetix.COM (Paul Meyer) Newsgroups: comp.sys.mac.programmer Subject: Checking Serial drivers for pending chars Message-ID: <10346@cadnetix.COM> Date: 20 Nov 89 23:09:18 GMT Sender: news@cadnetix.COM Reply-To: pem@cadnetix.COM (Paul Meyer) Organization: Cadnetix Corp., Boulder, CO Lines: 42 [] 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