garyb@ogcvax.UUCP (03/20/87)
I am attempting to build a bridge between BSD4.2 Ingres and an interactive T (cousin to Scheme and descendant of Lisp) environment. The T implementation has a reasonable interface to C procedure and function calls, so communicating with the non-T world is fairly painless. The T<->Ingres bridge that I have in mind is simple. Send an Ingres command from T to Ingres. Then receive some kind of information indicating the disposition of the command. The only commands that will be sent are those which side-effect the Ingres database or the Unix file system: application data indirects through Unix files in both directions. As far as I can tell, Ingres offers two ways to access database information: interactively through the Ingres monitor and (relatively) statically through embedded commands in C programs (EQUEL). Neither method directly addresses my needs. If I could wish a solution into existence I would have in my possession two C programs: one to spawn an Ingres process and the other to communicate with the created Ingres process using QUEL. Wishful thinking aside, it has been suggested that pseudo tty's are the way to go: just set up a pty with Ingres on the other end, and then read from and write to the appropriate file descriptor. I used this formula, but the reads and writes hang until they're interrupted (by me), resulting in no apparent effect. I looked through Emacs pseudo-channel code (pchan.c) that generates pty's and processes, but I couldn't penetrate its mysteries. I would be willing (half-seriously) to peruse Ingres source if I knew where to look. Question 1: Has anyone succeeded in talking to Ingres (4.2!) through a pty? If so, do you have any words of advice or even references to 4.2 source code that might be a good study. Another suggestion was to use pipes to set up two-way communication with Ingres. I haven't tried this approach yet. Though the pipe mechanism is less of a black box to me, the Ingres black box still looms rather large. Question 2: Same as #1, except with regard to pipes. Any helpful comments will be greatly appreciated. If anyone is interested, I will e-mail any useful findings. Thanks.