Liblouis User's and Programmer's Manual
2.11 Swap Opcodes ¶
The swap opcodes are needed to tell the context
opcode (see context
), the
correct
opcode (see correct
) and multipass opcodes which dot patterns to swap
for which characters. There are three, swapcd
, swapdd
and swapcc
. The first swaps dot patterns for characters. The
second swaps dot patterns for dot patterns and the third swaps
characters for characters. The first is used in the context
opcode and the second is used in the multipass opcodes.
All the swap opcodes have a name so they can be referred to from the
context
, correct
and multipass opcodes. The name operand
must contain only letters (a-z and A-Z). The letters may be upper or
lower-case but the case matters.
Dot patterns are separated by commas and may contain more than one cell.
swapcd name characters dots, dots, dots, ...
See above paragraph for explanation. For example:
swapcd dropped 0123456789 356,2,23,...
swapdd name dots, dots, dots ... dotpattern1, dotpattern2, dotpattern3, ...
The
swapdd
opcode defines substitutions for the multipass opcodes. In the second operand the dot patterns must be single cells, but in the third operand multi-cell dot patterns are allowed. This is because multi-cell patterns in the second operand would lead to ambiguities.swapcc name characters characters
The
swapcc
opcode swaps characters in its second operand for characters in the corresponding places in its third operand. It is intended for use withcorrect
opcodes and can solve problems such as formatting phone numbers.