SUTTON@BRANDEIS.BITNET (03/11/88)
As far I know, there is no way to access the DCL interpreter of the process which activated an image, so you're going to have to spawn a subprocess. Also, I know of no way to get the command tables to be passed to the child process. What you do with a subprocess after it is spawned may be the answer to your question. If what you want is to completely spawn into a subprocess, do some stuff, go back to the parent and have the option of going back to the child, you just need to save the process id when you spawn from the parent so that you can LIB$ATTACH back to the child when you want. You'll have to do your SET COMMANDs in the child to make the command definition tables match the parent's. You should remember to kill any created subprocesses before the program exits. If what you want to do is just pass commands to the child process, you can spawn a subprocess with mailboxes for input and output. You deposit commands in the input mailbox and collect the results from the output mailbox. There's a trick to doing this that I don't know, however. I tried doing this once when I was trying to extend EDT with an XLATE routine. The problem I had was that the spawned subprocess terminated as soon as it saw the end-of-file in the input mailbox (a natural thing to do, it would do the same with a file). I know that there's some way of preventing the subprocess from seeing the end-of-file because TPU includes routines which create subprocesses and allow you to pass commands to them (the output is captured in a mailbox and then transferred to an editing buffer). Anyway, you could have the first command passed to the subprocess do your SET COMMANDs. So this leaves me with two questions: (1) Is there any way of transferring the DCL tables to the subprocess? I've played around with the command "decompiler", VERB, that someone posted recently, so there must be a way of transferring that information to a subprocess. (2) How do you prevent a subprocess from seeing the end-of-file in a mailbox? One could do some pretty neat things with this knowledge: use SMG$ to create input and output windows in a DCL environment, have "pop-up" subprocesses from applications with a single keystroke... If anyone could shed some light on these questions, I would greatly appreciate it. SUTTON@BRANDEIS.BITNET