Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)

94 Chapter4
Using FDEVICECONTROL
Examples
Examples
The examples that follow illustrate using FDEVICECONTROL to
perform a number of control operations on asynchronous devicefiles.
The first example demonstrates how FDEVICECONTROL is used to
set transparent editing mode at a terminal. A similar example, using
FCONTROL for the same purpose, is included in Chapter 3, “Common
Device Control Functions.” These two examples allow you to contrast
the use of the two intrinsics.
The remaining examples, illustrated by the following figures,
demonstrate the use of FDEVICECONTROL to perform functions that
are not available through any other intrinsic.
Setting Transparent Editing Mode
In Figure 4-1 transparent editing mode is enabled at a terminal
through the FDEVICECONTROL intrinsic. Transparent editing mode
is also referred to as unedited mode. The parameters of the call specify
how the control action is to take place.
A file number, obtained through a previous call to FOPEN or
HPFOPEN issued against the device to be controlled, is contained in
the port parameter. (The file open call is not shown in the example.)
The controlcode is set to 192, indicating that this is a device control
operation.
The parm1 value is set to 15, which is the control directive used to set
transparent editing mode. The parm2 value is 2, specifying that only
Write access is needed. This means that a value will be passed in the
buffer parameter, but the previous value will not be returned.
When you use FCONTROL to enable transparent editing, you specify
new subsystem break and EOR characters through one of the
parameters of the call. You must also specify these characters when you
enable transparent mode through FDEVICECONTROL. You pass the
value corresponding to the characters you want to use through the
buffer parameter. Any character not otherwise defined as a special
character in transparent mode can be used.
The example shown here uses the Pascal/iX ord function to set the
subsystem break and EOR characters through a variable called value.
The high order bit of value contains a slash (/), which will be the new
subsystem break character, and the low order bit contains an asterisk
(*), which will be the new end-of-record character. This variable value is
passed through the buffer parameter.