* 1-char input with Ada tasks
@ 1991-04-03 17:58 Michael Feldman
1991-04-04 15:09 ` George C. Harrison, Norfolk State University
0 siblings, 1 reply; 3+ messages in thread
From: Michael Feldman @ 1991-04-03 17:58 UTC (permalink / raw)
Recently someone posted a nice portable (Unix-oriented) solution to
the problem of getting a single character from the keyboard in the
presence of tasks. As I recall, there was a brief C program interfaced
to Ada, and a task which polled for input. Can somebody re-post this?
Mike Feldman
---------------------------------------------------------------------------
Prof. Michael Feldman
Department of Electrical Engineering and Computer Science
The George Washington University
Washington, DC 20052 U.S.A.
phone 202-994-5253
fax 202-994-5296
email mfeldman@seas.gwu.edu
---------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 1-char input with Ada tasks
1991-04-03 17:58 1-char input with Ada tasks Michael Feldman
@ 1991-04-04 15:09 ` George C. Harrison, Norfolk State University
1991-04-05 18:18 ` Michael Feldman
0 siblings, 1 reply; 3+ messages in thread
From: George C. Harrison, Norfolk State University @ 1991-04-04 15:09 UTC (permalink / raw)
In article <2986@sparko.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes:
> Recently someone posted a nice portable (Unix-oriented) solution to
> the problem of getting a single character from the keyboard in the
> presence of tasks. As I recall, there was a brief C program interfaced
> to Ada, and a task which polled for input. Can somebody re-post this?
>
> Mike Feldman
> ---------------------------------------------------------------------------
> Prof. Michael Feldman
> Department of Electrical Engineering and Computer Science
> The George Washington University
> Washington, DC 20052 U.S.A.
>
> phone 202-994-5253
> fax 202-994-5296
> email mfeldman@seas.gwu.edu
> ---------------------------------------------------------------------------
This is not EXACTLY what you may want but...
From John Herro's ADA-TUTR:
-- UNIX.ADA Ver. 1.21 18-FEB-1989
-- Copyright 1988-1989 John J. Herro
-- Software Innovations Technology
-- 1083 Mandarin Drive NE, Palm Bay, FL 32905-4706 (407)951-0233
--
-- Compile this before compiling ADA_TUTR.ADA on a UNIX based system. You must
-- also compile ONECHAR.C with a C compiler before linking. See first page of
-- ADA_TUTR.ADA for more details.
--
package body CUSTOM_IO is
etc....
procedure GET(CHAR : out CHARACTER) is
function ONECHAR return CHARACTER;
pragma INTERFACE (C, ONECHAR);
begin
CHAR := ONECHAR;
end GET;
/*
Complements of Dave Hill of Salt Lake City...... for more see ADA-TUTR
by John Herro
*/
#include <stdio.h>
#include <termio.h>
char onechar()
{
static struct termio newsets, oldsets;
char c;
ioctl(fileno(stdin), TCGETA, &newsets);
ioctl(fileno(stdin), TCGETA, &oldsets); /* used by cooked */
newsets.c_cc[4] = '\001';
newsets.c_cc[5] = '\0';
newsets.c_lflag &= ~ (ICANON);
ioctl(fileno(stdin), TCSETAF, &newsets);
c = getchar();
ioctl(fileno(stdin), TCSETAF, &oldsets);
return (c);
}
-- George C. Harrison -----------------------
----- Professor of Computer Science -----------------------
----- Norfolk State University -----------------------
----- 2401 Corprew Avenue, Norfolk, Virginia 23504 -----------------------
----- INTERNET: g_harrison@vger.nsu.edu ---------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 1-char input with Ada tasks
1991-04-04 15:09 ` George C. Harrison, Norfolk State University
@ 1991-04-05 18:18 ` Michael Feldman
0 siblings, 0 replies; 3+ messages in thread
From: Michael Feldman @ 1991-04-05 18:18 UTC (permalink / raw)
In article <807.27fb097d@vger.nsu.edu> g_harrison@vger.nsu.edu (George C. Harrison, Norfolk State University) writes:
>
>This is not EXACTLY what you may want but...
>
>From John Herro's ADA-TUTR:
>
... code deleted
I have this. I thought I remembered seeing a tasking example built on top of
this, in which the input task polls for input so the entire Unix process
doesn't hang waiting for a keystroke. The AdaTutor example is fine, as far
as it goes, in a sequential program, but it ain't enough for a tasking
program...
Mike Feldman
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1991-04-05 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-04-03 17:58 1-char input with Ada tasks Michael Feldman
1991-04-04 15:09 ` George C. Harrison, Norfolk State University
1991-04-05 18:18 ` Michael Feldman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox