Next: Command Files, Previous: Evaluation, Up: Commanding poke [Contents][Index]
There are two kinds of commands in poke: the dot-commands, which are written in C and have their own conventions for handling sub-commands and passing arguments and flags, and normal commands, which are written in Poke.
Dot-commands are so called because their names start with the dot
character (.
). They can feature subcommands. Example:
(poke) .vm disassemble mapper int[] @ 0#B (poke) .vm disassemble writer int[] @ 0#B
When there is no ambiguity, the command name and the subcommands can be shortened to prefixes. The commands above can also be written as:
(poke) .vm dis m int[] @ 0#B (poke) .vm dis w int[] @ 0#B
Some commands also get flags, which are one-letter indicators that can
be appended to the command name (including subcommands) after a slash
character (/
). For example, the .vm
disassembler
commands accept a n
flag to indicate we want a native
disassemble. We can pass it as follows:
(poke) .vm disassemble mapper/n int[] @ 0#B (poke) .vm disassemble writer/n int[] @ 0#B
If a dot-command accepts more than one argument, they are separated
using comma characters (,
). Spaces are generally ignored.
Regular poke commands are written in Poke and use different conventions. The name of commands follow the same rules as normal Poke identifiers, and do not start with a dot character.
An example is the dump
command:
(poke) dump 76543210 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789ABCDEF 00000000: 7f45 4c46 0201 0100 0000 0000 0000 0000 .ELF............ 00000010: 0100 f700 0100 0000 0000 0000 0000 0000 ................ 00000020: 0000 0000 0000 0000 8001 0000 0000 0000 ................ 00000030: 0000 0000 4000 0000 0000 4000 0800 0700 ....@.....@..... 00000040: 1800 0000 0000 0000 0000 0000 0000 0000 ................ 00000050: 7900 0000 0000 0000 b701 0000 9a02 0000 y............... 00000060: 7b10 0000 0000 0000 1800 0000 0000 0000 {............... 00000070: 0000 0000 0000 0000 7900 0000 0000 0000 ........y.......
After the name of the command, arguments can be specified by name, like this:
(poke) dump :from 0#B :size 8#B (poke) dump :from 0#B :size 8#B 76543210 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789ABCDEF 00000000: 7f45 4c46 0201 0100 .ELF....
The dump
command is discussed in greater detail
below (see dump).
The order of arguments is irrelevant in principle:
(poke) dump :from 0#B :size 8#B :ascii 0 :ruler 0 00000000: 7f45 4c46 0201 0100 (poke) dump :ruler 0 :from 0#B :size 8#B :ascii 0 00000000: 7f45 4c46 0201 0100
However, beware side effects while computing the values you pass as the arguments! The expressions themselves are evaluated from left to right.
Which arguments are accepted, and their kind, depend on the specific command.
Note that the idea is to restrict the number of dot-commands to the absolutely minimum. Most of the command-like functionality provided in poke shall be implemented as regular commands.
Next: Command Files, Previous: Evaluation, Up: Commanding poke [Contents][Index]