|GUI ScreenIO for Windows|
There are occasions where you need to encode data into the bits of a single byte, or extract a specific bit from a byte. These functions exist in some compilers and not others. We provide these functions for simplicity, and to assist in conversion from Legacy ScreenIO where these functions existed as SCR-BIBY and SCR-BYBI respectively. Argument structures are similar but not identical to the legacy functions.
This function takes an array of 1 character fields and treats each as if it were a "bit", and packs each group of 8 such "bits" into a single byte.
This function takes one or more Bytes and extracts each bit thereof into a separate 1 character field called a "bit.
In either Function, you must specify the NUMBER OF BITS. This will be the number of input bits for Bits-to-byte and the number of output bits for Bytes-to-bits. Failure to specify bits correctly may cause these functions to overlay adjacent working storage areas. Calling with bit-count = zero is a fatal error.
The Bit fields contain low-values when they are "off", and any other value when they are "on". Bits extracted will contain a character "X" for the on state and low-value for the off state.
The source field will not be changed.
These functions are not limited to a single byte, and will allow converting long strings of text into even longer strings of bit flags, and vise-versa.
This API will only run on the server.
Files available to copy to your system:
MOVE my-bit-flags TO BITOPS-UNPACKED-DATA
This field contains the number of bits that are involved. Note that you never specify the number of bytes, only bits. If you have 8 bits that you wish to pack into a single byte, you would specify 8 in this field. Similarly if you had two bytes that you wished to expand into 16 individual bit flags you specify 16.
This field contains the "bits". Each byte in the unpacked data represents one bit, and they are arranged in exactly the order they will fit into the byte, such that the first bit will fit into the high-order bit of the byte of packed data. (LEFT TO RIGHT)
This is an input field for Bits-to-bytes and an output field for Bytes-to-bits.
This field specifies the packed date, the bytes.
This is an Output field for Bits-to-Bytes, and an Input field for Bytes-to-Bits.
This argument is standard for all Calls to GSWINAPI. It is used to select the desired API or function, and to return the status of the operation.
Used to return the status of a call to GSWINAPI. A value of zero is a failure, any other value indicates success.
Plain-text error message that describes why the operation failed. The only failure reason is bit count of zero.
The number of these present varies depending on how many arguments are used by the desired function. These are not used, but must be present because this CALL requires seven arguments.
|© 2000-2019 Norcom, all rights reserved|