Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!bu.edu!inmet!stt From: stt@inmet.inmet.com Newsgroups: comp.lang.ada Subject: Re: Keyboard input Message-ID: <20600064@inmet> Date: 25 Sep 90 13:36:00 GMT References: <39@screamer.csee.usf.edu> Lines: 39 Nf-ID: #R:screamer.csee.usf.edu:39:inmet:20600064:000:1775 Nf-From: inmet.inmet.com!stt Sep 25 09:36:00 1990 Re: Single-character Terminal I/O, Portability, etc. This really has nothing to do with C vs. Ada. This is an O/S interface issue. If you are talking Unix, then there is a "standard" (almost) way of accomplishing "raw" I/O. If you are talking about` some other operating system, then it will certainly be different, if possible at all. If you are talking Posix, there are a number of options for "non-canonical" terminal processing, which provide essentially all of the capabilities you would want. There is now a proposed standard Ada binding to these capabilities (package POSIX_Terminal_Functions). As far as portability, you will have to survey the O/Ss of interest, come up with an interface which you can implement everywhere, and then implement it as appropriate. Ultimately, I suspect there will be some assembly language involved, either written by you or by the vendor, since neither C nor Ada compilers will normally generate direct O/S system calls. Of course, if you are using Unix, then a C library is provided which already has the necessary interfaces. Most compiler vendors on Unix provide a similar library for Ada. Ideally, they will begin to converge on the Posix proposed standard for providing these capabilities. In any language, if you refuse to ever go outside of the language to interface with the O/S or external subsystems, you may end up talking only with yourself. In any case, it usually only takes a few lines of Assembler or other language. You may not notice it in C since you don't have to announce your intentions with a "pragma Interface" to call an assembler routine, but you can rest assured that most C system-call libraries are implemented in assembler by someone. S. Tucker Taft Intermetrics, Inc. Cambridge, MA 02138