manual:chapter6:libdata:cmd_binputb

This is an old revision of the document!



Synopsis


Store bytes into binary data object

Stack Diagram


Input Stack Output Stack
Ddest Numoffset Numsrc Numbytes Dnew
Ddest Numoffset Ssrc Numbytes Dnew
Ddest Numoffset Lsrc Numbytes Dnew
Level 4 Level 3 Level 2 Level 1 Level 1

Legend

Type Command
Parallel list processing Group 7
Affected by flags None

Description


The BINPUTB stores a specified number of bytes into a binary data container, starting from an offset position; it's not possible to write data exceeding the container's size.

The source of data can be:

  • a scalar: the number is converted to an unsigned binary integer, divided into bytes and the specified number of bytes is written in the container, in little endian byte order;
  • a string: the string is converted to a stream of UTF8 codepoints whose lowest 8 bits are written in little endian byte order into the container;
  • a list of scalars: each number is converted to an unsigned binary integer and its lowest 8 bits are written in the container.

If the size of the source data is less than the specified number of bytes the writing operation terminates silently without error.

Compatibility


This command is new in newRPL and does not exist in userRPL.

Usage


4:              BINDATA 1 A4gACz
3:                             0
2:                    #11223344h
1:                             4
……………………………………………………………………………………
BINPUTB

where level 4 stores a binary data container of size 4, will result in

1:              BINDATA 1 ESIzR4
……………………………………………………………………………………

a data container whose content is { #44h #33h #22h #11h }.

Related Commands


Arbitrary data containers 9 NEW

Command Short Description
MKBINDATA Create binary data container object NEW
BINPUTB Store bytes into binary data object NEW
BINGETB Extract binary data as list of bytes NEW
BINPUTW Store 32-bit words into binary data object NEW
BINGETW Extract data from a binary data object as a list of 32-bit words NEW
BINPUTOBJ Store an entire object into a binary data container NEW
BINGETOBJ Extract an entire object from a binary data container NEW
BINMOVB Copy binary data block into a binary data object NEW
BINMOVW Copy 32-bit words between binary data objects NEW
  • manual/chapter6/libdata/cmd_binputb.1572479565.txt.gz
  • Last modified: 2019/10/30 16:52
  • by jojo1973