manual:chapter6:libdata:cmd_binputw

This is an old revision of the document!



Synopsis


Store 32-bit words into binary data object

Stack Diagram


Input Stack Output Stack
Ddest Numoffset Numsrc Numwords Dnew
Ddest Numoffset Ssrc Numwords Dnew
Ddest Numoffset Lsrc Numwords 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 BINPUTW command stores a specified number of 32 bits words 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 and divided into 32-bits words which are stored in the container, in little endian word order;
  • a string: the string is converted to a stream of UTF8 codepoints whose lower 32 bits are stored into the container;
  • a list of scalars: each number is converted to an unsigned binary integer and its lower 32 bits are written in the container.

If the size of the source data is less than the specified number of words remaining words will be set to #00000000h.

Compatibility


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

Usage


4:        BINDATA 2 AAAAAAAAAAAA
3:                             0
2:            #1122334455667788h
1:                             2
……………………………………………………………………………………
BINPUTW

will result in

1:        BINDATA 2 VWZ3iYESIzR4
……………………………………………………………………………………

a data container storing words { #55667788h #11223344h } in positions from 0 to 1.


4:        BINDATA 2 AAAAAAAAAAAA
3:                             0
2:                           "∞̅"
1:                             2
……………………………………………………………………………………
BINPUTW

(where character on level 2 is $\overline{\infty}$, obtained with LShold-0) will result in

1:        BINDATA 2 AAAiHqAAADBV
……………………………………………………………………………………

a data container storing words { #0000221Eh #00000305h } in positions from 0 to 1.


4:        BINDATA 2 AAAAAAAAAAAA
3:                             0
2: { #1122334455h #5544332211h }
1:                             2
……………………………………………………………………………………
BINPUTW

will result in

1:        BINDATA 2 IjNEVBRDMiE5
……………………………………………………………………………………

a data container storing words { #22334455h #44332211h } in positions from 0 to 1.

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_binputw.1572565439.txt.gz
  • Last modified: 2019/10/31 16:43
  • by jojo1973