4.1 The shellEnv pattern

The shellEnv pattern from basicshell.bet is a subpattern of systemEnv from ~beta/basiclib/basicsystemenv.bet. As a consequence, distributed programs using shellEnv must have a structure corresponding to that of concurrent programs using systemEnv. This structure is sketched in figure 3, showing a template for a distributed BETA program not using X window libraries.

ORIGIN '~beta/distribution/shell';
--- program:descriptor ---
shellEnv
(# shellType:: (# ... #)
   ...
#)

Figure 3: Template shellEnv program not using GUI libraries.

As can be seen from figure 3, the program:descriptor SLOT must contain a specialization of shellEnv. The usage of the shellType virtual is described in the section on the shell pattern.

When writing distributed BETA programs, the program:descriptor SLOT in betaenv must contain a subpattern of shellEnv. This instance of shellEnv is futhermore the only one allowed.

The template in figure 3 has ORIGIN in the shell fragment since is not using GUI libraries. If the program were to use GUI libraries, it should have ORIGIN in the guienvshell fragment. There is no difference between shell.bet and guienvshell.bet concerning the abstractions offered. The only difference is the systemEnv implementation used. An alternative implementation is necessary to be able to combine systemEnv with the event driven GUI libraries using a central event loop. To be able to install a number of callback functions used for scheduling purposes, the GUI implementation of systemEnv needs a reference to the guienv instance used in the current program. This is handled by the setWindowEnv virtual as illustrated in figure 4.

ORIGIN '~beta/distribution/guienvshell';
INCLUDE '~beta/guienv/guienvenv';
--- program:descriptor ---
shellEnv
(# shellType:: (# ... #);
   setWindowEnv:: (# do myguienv[] -> theWindowEnv[] #);
   myguienv: guienv@(# ... #);
#)

Figure 4: Template distributed BETA program using GUI libraries.

The singular shellEnv instance in a distributed BETA process is returned by the getShellEnv pattern declared in basicshell.bet. Library fragments that should be usable in programs using Gguienv as well as programs not using guienv, must have origin in basicshell.bet.

The shellEnv pattern calls INNER when it has finished initialization. Initialization of shellEnv specializations may thus take place in the shellEnv INNER, or in the shellType INNER, to be described in section 4.3. Note that the distributed BETA program will not terminate until theShell.kill has been called, even if INNER shellEnv and INNER theShell terminates!

The following sections describe the different patterns and virtuals embedded in shellEnv.


Distributed Objects in BETA - Reference Manual
© 1993-2004 Mjølner Informatics
[Modified: Monday March 11th 2002 at 16:16]