Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Starting and Stopping Epsilon
         Session Files
         File Associations and DDE
         Sending Files to a Prior Session
         MS-Windows Integration Features
      Running Other Programs
         The Concurrent Process
         Compiling From Epsilon
         DOS Concurrent Process
      Repeating Commands
         Repeating a Single Command
         Keyboard Macros
      . . .

Previous   Up    Next
Running Other Programs  Commands by Topic   Compiling From Epsilon


Epsilon User's Manual and Reference > Commands by Topic > Running Other Programs >

The Concurrent Process

Epsilon can also run a program in a special way that allows you to interact with the program in a buffer and continue editing while the program runs. It can help in preparing command lines, by letting you edit things you previously typed, and it automatically saves what each program types, so you can examine it later. If a program takes a long time to produce a result, you can continue to edit files while it works. We call a program run in this way a concurrent process.

The start-process command, bound to Ctrl-X Ctrl-M, begins a concurrent process. Without a numeric argument, it starts a shell command processor which will run until you exit it (by going to the end of the buffer and typing "exit"). With a numeric argument, it prompts you for the name of a program, instructs the shell to execute just that one command, then terminates the concurrent process.

Epsilon maintains a command history for the concurrent process buffer. You can use Alt-P and Alt-N to retrieve the text of previous commands. With a numeric prefix argument, these keys show a menu of all previous commands. You can select one to repeat.

In a concurrent process buffer, you can use the <Tab> key to perform completion on file names and command names as you're typing them. If no more completion is possible, it displays all the matches in the echo area, if they fit. If not, press <Tab> again to see them listed in the buffer.

The command uses different rules for the first word on the command line, searching for a command along the PATH in a manner appropriate to the operating system. (It won't know about any commands that may be built into the current shell command processor, though.)

As described in the previous section, you can change the name of the shell command processor Epsilon calls, and specify what command line switches Epsilon should pass to it, by setting configuration variables. Some different configuration variable names override those variables, but only when Epsilon starts a subprocess concurrently. For example, you might run a command processor that you have to start with a special flag when Epsilon runs it concurrently. The INTERCONCURSHELLFLAGS and CMDCONCURSHELLFLAGS variables override INTERSHELLFLAGS and CMDSHELLFLAGS, respectively. The EPSCONCURCOMSPEC variable overrides EPSCOMSPEC.

For example, the 4DOS command processor replacement for DOS needs a special flag //Lineinput=yes whenever you run it concurrently. Set these configuration variables (see Configuration Variables) to use Epsilon with 4DOS:

EPSCOMSPEC=c:\4dos\4dos.com
CMDCONCURSHELLFLAGS=//Lineinput=yes /c
INTERCONCURSHELLFLAGS=//Lineinput=yes

The Hamilton C Shell for OS/2 uses slightly different flags than the standard command processor CMD.EXE. Set these configuration variables to use Epsilon with the C Shell:

EPSCOMSPEC=c:\csh\bin\csh.exe
INTERSHELLFLAGS=-i
CMDSHELLFLAGS=-c

Note that you must type a <Space> character after the -c flag for the Hamilton C Shell to work correctly.

A version of the Bash shell for Windows NT systems requires these settings:

EPSCOMSPEC=c:\cygwin\bin\bash.exe
INTERSHELLFLAGS=--login --noediting -i
CMDSHELLFLAGS=--login --noediting -c "%%"

These are configuration variables, so they would go in the environment for Unix or OS/2 versions of Epsilon, or in the system registry or lugeps.ini file for Windows versions. See Configuration Variables.

When a concurrent process starts, Epsilon creates a buffer named "process". In this buffer, you can see what the process types and respond to the process's requests for input. If a buffer named "process" already exists, perhaps from running a process previously, Epsilon goes to its end. Provide a numeric argument to the start-process command and it will create an additional process buffer (in those environments where Epsilon supports multiple process buffers).

If you set the variable clear-process-buffer nonzero, the commands start-process, push, and make (described below) will each begin by emptying the process buffer. The variable normally has a value of 0. See the variable start-process-in-buffer-directory to control which directory the new process starts in.

A program running concurrently behaves as it does when run directly from outside Epsilon except when it prints things on the screen or reads characters from the keyboard. When the program prints characters, Epsilon inserts these in the process buffer. When the program waits for a line of input, Epsilon will suspend the process until it can read a line of input from the process buffer, at which time Epsilon will restart the process and give it the line of input. You can type lines of input before the program requests them, and Epsilon will feed the input to the process as it requests each line. Under DOS, Epsilon will also satisfy requests from the concurrent process for single-character input.

In detail, Epsilon remembers a particular spot in the process buffer where all input and output takes place. This spot, called the type point, determines what characters from the buffer a program will read when it does input, and where the characters a program types will appear. Epsilon inserts in the buffer, just before the type point, each character a program types. When a process requests a line of input, Epsilon waits until a newline appears in the buffer after the type point, then gives the line to the program, then moves the type point past these characters. (Epsilon for DOS also distinguishes a request by a program to read a single character. In that case, Epsilon will pause the concurrent process until you have inserted a character after the type point, give that character to the concurrent process, then advance the type point past that character.)

You may insert characters into the process buffer in any way you please, typing them directly or using the yank command to retrieve program input from somewhere else. You can move about in the process buffer, edit other files, or do anything else at any time, regardless of whether the program has asked the system for keyboard input.

To generate an end-of-file condition for DOS or Windows programs reading from the standard input, insert a ^Z character by typing Ctrl-Q Ctrl-Z on a line by itself, at the end of the buffer.

Some programs will not work when running concurrently. Programs that do cursor positioning or graphics will not work well, since such things do not correspond to a stream of characters coming from the program to insert into a buffer. They may even interfere with what Epsilon displays. We provide the concurrent process facility primarily to let you run programs like compilers, linkers, assemblers, filters, etc.

At this writing, there are some limitations on the types of programs you can run under Epsilon for Windows 95/98/ME. Specifically, 32-bit Win32 console mode programs running concurrently under Epsilon for Windows 95/98 cannot receive console input. Read the release notes to see if the current version of Epsilon still has this restriction. These restrictions don't apply under NT or the following Windows versions.

If you run Epsilon under Windows 95/98/ME, you may find it necessary to increase the environment space available to a subprocess. To do this, locate the file conagent.pif in the directory containing Epsilon's executable (typically c:\Program Files\Epsilon\bin). (Explorer may be set to hide the file's .pif extension.) Display its properties, and on the Memory tab enter a value in bytes for the Initial Environment setting.

In some versions, Epsilon will let you run only one other program at a time. In others, you may rename the process buffer using the rename-buffer command, and start a different, independent concurrent process. If you exit Epsilon while running a concurrent process, Epsilon kills that process, except in the DOS version. Epsilon for DOS will not permit you to exit until you've stopped the concurrent process (normally by typing the "exit" command at the end of the process buffer, or via the exit-process command).

The exit-process command types "exit" to a running concurrent process. If the concurrent process is running a standard command processor, it should then exit. Under DOS, Epsilon's exit command asks if you want to run exit-process when you try to exit with a running process. Also see the process-warn-on-exit variable.

In the Windows and Unix versions of Epsilon, the kill-process command disconnects Epsilon from a concurrent process, and forces it to exit. It operates on the current buffer's process, if any, or on the buffer named "process" if the current buffer has no process.

The stop-process command, normally on Ctrl-C Ctrl-C, makes a program running concurrently believe you typed Control-Break (or, for Unix, sends an interrupt signal). It operates on the current buffer's process, if any, or on the buffer named "process" if the current buffer has no process.

Under DOS, the push command on Ctrl-X Ctrl-E (which always runs a command non-concurrently) calls exit-process if a concurrent process is running, so it can run a process non-concurrently.

Standard bindings:

  Ctrl-X Ctrl-M  start-process
 Ctrl-C Ctrl-C  stop-process
 Process mode only: Alt-<Backspace>  process-backward-kill-word
 Process mode only: <Tab>  process-complete
 Process mode only: C-Y  process-yank
 Process mode only: Alt-n  process-next-cmd
 Process mode only: Alt-p  process-previous-cmd
   kill-process
   exit-process
 



Previous   Up    Next
Running Other Programs  Commands by Topic   Compiling From Epsilon


Lugaru Copyright (C) 1984, 2020 by Lugaru Software Ltd. All rights reserved.