C H A P T E R 2 3
Using the Endpoint Interface
slot in the input spec. The
slot is a frame containing two slots,
, which allow you to perform two different kinds of processing.
slot allows you to identify one or more characters or bytes in the
input stream to be replaced by zero or one characters. You may, for instance,
replace null characters (
) with spaces (
). Note that if your input data
form is set to
, you are encouraged to use this slot. Otherwise, null
characters embedded in your string may prematurely terminate that string.
(Remember, NewtonScript strings are null-terminated.)
slot contains an array of one or more frames. Each frame must
slot, identifying the single-byte character or byte to be replaced, and a
slot, identifying the single-byte character or byte to be used instead. The
slot can also be
, meaning that the original byte is to be removed
completely from the input stream.
Note that the system executes byte-by-byte comparisons and
swaps between the bytes in the input stream and the replacements
slot. To facilitate this process, the values in the
slots are converted to a byte format to speed the
comparison and swap. Internally, single characters are converted
to single bytes using the translation table specified in the endpoint
slot. Numbers are converted to single bytes. If a
number has significant digits beyond the high-order byte, they
will be dropped during the comparison and swap.
You can also specify the
slot in the
frame. Set this slot to
to specify that the high-order bit of every incoming byte be stripped ("zeroed
out"). This is a convenient feature if you plan to communicate over links
(particularly private European carriers) that spuriously set the high-order bit.
Specifying Receive Options
You can also set communication tool options associated with the receive request.
To do this, specify an option frame or an array of option frames in the
slot in the input spec. The options are set when the input spec is posted by the
method. The processed options are returned in the options
parameter passed to the
Note that the options are used only once. If your
method is called,
for example, and it returns expecting the input spec to remain active, the options
are not reposted. To explicitly reset the options in this example, you must call