Skip to main content

Module transfer

Module transfer 

Source
Expand description

What rides on the calculators’ Kermit transfers (wiki: protocols/hp-object-format), for hosts that talk to the ROM’s server: the binary transfer file (HPHP48-x / HPHP49-x header and packed nibbles) decoded to an Object and encoded from one, the text of programs, algebraics, units and commands filled in from the ASCII transfer of the same object, and RPL source text for objects sent as a host command. No I/O and no protocol: the Kermit exchange is the host’s.

Structs§

StackReply
The stack text the ROM’s Kermit server returns for a host command (C), already translated from the HP character set.

Enums§

Family
The calculator family a binary transfer file names.

Constants§

HEADER_LEN
Length of the binary transfer header (HPHP48-x).

Functions§

ascii_body
The text of an ASCII transfer after its %%HP: T(t)A(a)F(f); header line, or all of it when it has none.
binary_header
The header of a binary file sent to family. Its ROM letter (X) is not checked by the calculators.
decode_file
Decode a binary transfer file (HPHP48-x / HPHP49-x header).
encode_file
The binary transfer file for obj (header and packed nibbles, exactly as long as the object), or None for objects that only travel as text (programs, algebraics, units, arrays, commands other than XLIB names).
fill_sources
Fill the text of programs, algebraics, units, commands and unknown objects in obj from text, the ASCII transfer of the same object (the %%HP: header is skipped). Walks the text in step with the decoded tree; if they disagree, nested texts stay unset and a top-level program, algebraic or unknown object gets the whole text.
is_binary_file
Whether data starts with a binary transfer header (HPHP48- or HPHP49- and a printable ROM letter).
is_plain_name
Whether name is a plain global name that, quoted as 'name', cannot close its quotes: 1 to 127 characters, not starting with a digit or a point, without whitespace, control characters, RPL delimiters, operators or a backslash (a host command reads A\GS as AΣ, a transfer as the bytes), all in the HP character set.
pack
Nibbles packed two per byte, low nibble first; an odd count ends with a 0 nibble.
parse_stack
Parse the stack display of a host command: an optional first line Error: X, then Empty Stack or the levels from the highest down, each starting with N:; any other line continues the level before it. Never fails: text before the first level is ignored.
to_source
RPL source that compiles to obj, or None when it has none (a string holding ", a local name, a character, an unknown object).
unpack
Bytes as nibbles, low nibble first (the transfer file’s packing).