HP 3000 Manuals

SWitch Assist Tool (SWAT) [ Switch Programming User's Guide ] MPE/iX 5.0 Documentation


Switch Programming User's Guide

SWitch Assist Tool (SWAT) 

The SWitch Assist Tool (SWAT) is an interactive utility that produces the
Switch stub source code you can use to make mixed-mode procedure calls in
the NM--> CM direction.  SWAT prompts you for information regarding the
called other-mode procedure and its parameters.  In response, SWAT builds
source code containing the data structures and logic required to use
Switch.

Figure 2.1 illustrates a situation that requires invocation of Switch:

[]
Figure 2.1. Mixed-mode Procedure Call Procedure Z represents an entity that is not supplied in the Native Mode environment. The SWAT utility can help you handle such unresolved references. Tools like SWAT enable you to improve performance of migrated applications with a minimum of effort and concern about the architectural differences. You can use SWAT prior to installation to prepare the source code for Switch stubs ahead of time, as well as after the MPE XL-based system is up and running. Who Uses SWAT? If you develop applications and subsystems for the HP 3000, then you may be interested in migrating existing applications to MPE XL-based systems. Migrating an application entirely to Native Mode is the preferred approach. However, due to considerations such as the size of the application, the availability of shared procedures, and the language of implementation (SPL, in particular), you may have no choice but to mix modes of execution. The most efficient means for accomplishing this task is to migrate those applications in a phased approach. That requires the mixing of Compatibility Mode and Native Mode code. Switch provides the ability to make mixed-mode procedure calls. SWAT helps you use Switch to run portions of an application in Compatibility Mode and portions in Native Mode. You will be particularly interested in using SWAT if you have high-level applications that call user-written SPL routines or if your applications call SPL routines for which the source code is not available. Because these two types of routines cannot run in Native Mode, they must either be rewritten entirely or execute in Compatibility Mode. Once you have decided which procedures or modules of your application are to remain in Compatibility Mode, you can use SWAT to generate the necessary Switch stubs to make the switching transparent. Features The features of the Switch Assist Tool include the following: * SWAT's user interface is interactive, flexible, and easy-to-use. * SWAT generates standardized Switch stub source code in the HP Pascal/XL programming language. * SWAT facilitates user modification by keeping the source file output in a text file. * SWAT fully supports most programming options, within the limitations of Switch and MPE XL. * SWAT automatically appends the appropriate compiler commands to the generated source code. * SWAT is available upon installation of MPE XL-based systems. * SWAT standardizes management of the interface between Compatibility Mode and Native Mode. * SWAT generates the source code required for most possible types of mixed-mode procedure calls in the NM--> CM direction. Benefits SWAT's primary benefit is the programmer support it provides by alleviating much of the complexity faced in making mixed-mode procedure calls. It also increases the quality of Switch stub source code by generating standardized source code. To code a working Switch stub manually, you need the following: * Knowledge of the stack architecture of MPE V/E-based systems and the register assignments of 900 Series machines * Familiarity with two system programming languages (SPL and HP Pascal/XL) * Details of the calling sequences, parameter types, and return values of the target procedures * Familiarity with the complexities of the Switch intrinsics * Access to the library management of both CM and NM environments * Knowledge of how to handle condition codes and status words that are returned when mixed-mode procedure calls are made By helping you meet these concerns, SWAT helps to make the migration process as smooth and easy as possible. Furthermore, because much of the information and data structures required by Switch are repetitive in nature and must be duplicated for each parameter passed through Switch, SWAT eliminates much of the tedium otherwise associated with manually coding Switch stubs. In summary, SWAT serves to increase your productivity and reduce the time required to migrate applications to a Series 900 machine. SWAT benefits those who are migrating application programs and subsystems to MPE XL-based systems in the following ways: * SWAT incorporates into the logic of the tool the systems and programming knowledge required to produce Switch stub code. * SWAT eliminates many of the repetitious aspects of stub coding. * SWAT helps assure the correct execution of mixed-mode procedure calls by generating standardized Switch stub source code as its output. * For those who prefer to code Switch stubs manually, or in some instances must do so, SWAT provides examples of good coding practices and can act as a template for advanced stubs. Switch Stub Operation Figure 2.2 demonstrates how Switch stubs and the Switch subsystem fit into the overall flow of program execution:
[]
Figure 2.2. Switch Scenario The Switch stub acts as an interceptor/intermediary that calls the Switch subsystem and passes it the parameters of the called procedure and any other information required by Switch. Switch itself calls the other-mode procedure.


MPE/iX 5.0 Documentation