> I am writing a program which will use Yacc & Lex to get the user's
>input. But while waiting for the user's input, I want the program to poll
>the message queue at the same time. If there is a message, it will be
>displayed on the screen. How to do that ? Seems that I cannot do
>anything while waiting for user's input ( yyparse() ) ...
yyparse calls yylex to get tokens, and yylex calls `input' to get
characters. You can define your own `input 'routine, and yylex will
call this routine instead. Your input routine call poll the message
queue and display the response before it returns control to yylex.
I think that `input' is a macro, so the way to do this is to include
#undef input
in the header part of the .l file; then yylex will call your `input'
function instead of using the macro.
--
The night is pleasing to us because, like memory, it erases idle details.