p7 is the main command-line utility to interact with CASIO calculators
and related files. Historically, it is the first utility made within
the P7 project, and was originally used to
interact with storage memories using Protocol 7. It now integrates many
more features, including managing main memories, screen streaming and copying
and flashing the firmware.
The P7 Query Language (P7QL)¶
p7 uses a given language inherited from the original command-line
interface; it is made for using it as its primary support, but can also
be passed by scripts, i.e. files containing P7QL-structured commands.
P7QL’s logic is command-oriented. Each command is made of words, where each word is encoded in Unicode. There are three types of words:
magic words: words indicative of a given structure, which are matched against what is expected in this description, casefolded, and decomposed using NFKD with ASCII equivalent (“ÄnD” is resolved as “and”).
variable words: words containing a value which the meaning depends on the placement.
option words: words that can be placed instead of a magic word, which may have a meaning for the current command, not depending on its placement with magic and variable words.
The P7QL syntax is able to tell with exactitude, depending on the words previously given in a script, whether a magic or variable word is expected next.
The P7QL uses a stateful abstract machine, where a state is composed of the following elements:
devices: a collection of links with calculators on various mediums, such as USB or serial, and various protocols, e.g. protocol 7 or CAS100, each having a specific state.
main memories: a collection of main memories, each containing zero, one or more main memory files, which can be virtual or related to a device.
a selected main memory: a primary main memory which is used for some commands.
a selected device: a primary link which is used for some commands.
This state can be altered through command prefixes. To alter device-related variables in the state, the following prefixes can be used:
- on usb [bus *number*] [address *number*] [as *device_name*]
Creates a USB link which matches bus number and/or address number on the bus if given, using the protocol detected with the USB descriptor, and selects it.
- on serial *device_path* [using settings *settings*] [using protocol *protocol*] [as *device_name*]
Creates a serial link on the device which path is given, using the given settings (or the default settings), using the given protocol (or the default protocol), and selects it.
For both commands, in case