Declarative section
The Declarative section has these specific definitions:
- Driver definition
- Device definition
- Phrase definition
Driver definition
The structure of a driver definition is:
define driver name_of_driver;
version: "version-string";
end driver;
The define driver
clause specifies some
overall properties of the PDL program not particularly related to its device-driver
functionality
version-string
is user-supplied to
identify the iteration of the driver. It is printed with name
, an identifier, in the system log when the driver is opened by the
system.
Device definition
The structure of a device definition is:
define device;
type: device-type;
attribute...
attribute...
...
end device
The define device
clause declares the
device’s characteristics that the driver uses. The programmable driver supports TCP
drivers structured as clients and servers and asynchronous line drivers.
The device-type
is required, and is one
of:
-
async
-
tcp-client
-
tcp-server
-
decnet-client
-
decnet-server
The attributes
values depend on the
device-type
choice.
Phrase definition
Phrases are the basic mechanisms that define the communication elements over the device. They define the nouns and verbs that make up a protocol language. Phrases structure read and write operations, and define how to separate the protocol’s control characters from the data part of a message.
A phrase is the unit of I/O transfer at the PDL level. Phrase instances are usually composed of many characters, which are units of transfer at the UNIX device level. The characters are composed of several bits, usually 8, which are the units of transfer at the physical level.
The basic structure of a phrase definition is:
define phrase name;
phrase-parts
end phrase;
A phrase represents a way to interpret input, and a framework from which to generate output. A phrase is a hierarchical construction of phrase parts made up of literal text or character classes.
Despite this hierarchical syntactic structure, phrases are interpreted as a linear arrangement of characters and fields. This linear arrangement corresponds to the linear byte-stream that is presented by the UNIX-level device.
A type of composing mechanism is the field. This is the interior node in the hierarchial phrase structure. This acts as a component when writing the phrase, but not when reading the phrase.
For example:
# <soh><header><fs><msg data><etx>
define phrase simple-msg;
<soh>
field header = variable-array(not(<fs>));
<fs>;
field data = variable-array(not(<etx>));
<etx>;
end phrase;