6.17.5.3   Committing the Procedure Interface

Replace selected program lines  
If this option is enabled, the selected program lines are replaced by an appropriate call to the newly created procedure see figure 6.52 for an illustration. Otherwise, the original program lines are kept and no procedure call is added. In any case, the selected program lines are copied to the body of the new procedure.

Adapt program (existing procedures only)  
This setting is not relevant for new procedures, but useful when modifying the interface of existing procedures. When enabled, all program lines calling the procedure in question will be adapted according to the interface changes.

For example, if you decide that a certain parameter is no longer necessary, the corresponding expressions or variable names will be removed from all procedure calls in the program when you close the dialog and apply the changes. If this is an input parameter, the program will continue to run without further modifications. If it is an output parameter, subsequent program lines relying on the value of that parameter will have to be adjusted manually.

As another example, if a new parameter has become necessary, a variable of the same name will be added to all procedure calls. If this is an input parameter, the corresponding variable will most likely not be initialized at the time of the procedure call and has to be assigned to manually. If it is an output parameter, the program will continue to run without further modifications.

Leaving this feature enabled is highly recommended to keep the program consistent.

OK  
Activating the button OK at the bottom of the dialog either creates a new procedure or commits the changes made in the procedure interface, depending on whether the interface dialog was invoked to create a new procedure or to modify an existing procedure. In the latter case not only the interface itself might be changed but also the procedure's program body and variable lists, as new variables might have been added or existing variables might have been removed or renamed.

If you change the interface of an external procedure, be aware of the fact that other programs containing it do not update the procedure calls. When loading these programs, the procedure calls are disabled. If the changes were applied to a procedure that is called from inside a protected external procedure, that procedure call is not even updated in the current program.

Cancel  
This button dismisses the dialog. Any changes to the interface or the documentation of the edited procedure are lost (with the exception of the editing status, see section “Protected Procedures”).

Apply  
Applies the changes in the dialog (just like pressing OK) without closing it.

Help  
Displays the documentation of the selected procedure. If the documentation is empty, the button will be grayed out.

The newly defined procedure is now available for selection in the operator window. The variables that were used to determine the procedure interface parameters are now being offered as input parameters for the procedure call.

Please note that a return call has been added at the end of the procedure body. If you create a procedure from scratch, the newly created procedure body will contain only the return operator initially.

Figure 6.52: Resulting new procedure.