[comp.sys.next] Interfacing stdin and stdout to a Text Window

martin@icsl.ucla.edu (Kenneth Martin/) (10/24/90)

I hope this isn't too stupid a question to ask from a novice but here goes.

I'm trying to port a logic and timing simulator I wrote for a hobby.  If
ever successful, it'll probably become public domain (again, for what it's
worth).  The original interface was designed to use a vt100 terminal. It
set up the terminal to have two windows, one a write only
window for the simulation results, and the other an interactive window.

The user's input from the interactive window went through stdin, getc(),
lex and then into yacc for parsing the commands.
In my initial port I'd like not to change things too much (this might come
later).  In particular, I'd like to keep the command like interface while
adding an optional mouse driven interface.  This would give the user the
option which to use, and would mean I wouldn't have to rewrite the
documentation or code as much.

Thus, my needs are:

1) I'd like to set up a Text Window similar to a terminal interface for
interactive IO. The method that reads characters, would put them into a
buffer so my program could retrieve them ideally using getc(), and unputc().
It would also be nice if my program could continue to use printf and
fprintf statements with the output somehow being caught.

2) I'm also not too sure how to set up the overall structure.  My MainApp
will probably interface with the window, but do I need my original program
running concurrently, or do I need to replace the subroutines in lex to
call the window interfacing methods and add methods for printing that
would replace fprintf statements?

3) In summary, I'm trying to be sacreligious and emmulate a terminal 
interface using a window interface so I can leave the main body of the
progam unchanged for now.

I know this is too much too ask, but if anyone could direct me to a similar
example (or even an example that uses the Text Window like a terminal
interface) I'd appreciate it.

Sincerely, Ken Martin: martin@icsl.ucla.edu