HPGCC3 Documentation 3.0 R003

Hex string functions

Defines

#define sat3_hxssize(hxs)   sat3_strsize(hxs)
 Get the number of nibbles in a hex string.

Functions

SAT_OBJECT sat3_createhxs_int (SAT_OBJECT where, int value)
 Create a hex string object from a 32-bit integer.
int sat3_converthxs_int (SAT_OBJECT hxs)
 Extract an integer from a hex string.
SAT_OBJECT sat3_createhxs_llong (SAT_OBJECT where, LONGLONG value)
 Create a hex string object from a 64-bit integer.
LONGLONG sat3_converthxs_llong (SAT_OBJECT hxs)
 Extract a 64-bit integer from a hex string.
SAT_OBJECT sat3_createhxs_bytes (SAT_OBJECT where, char *data, int nbytes)
 Create a hex string object from a sequence of bytes.
BOOL sat3_converthxs_bytes (SAT_OBJECT hxs, char *data, int maxbytes)
 Extract a sequence of bytes from a hex string.

Detailed Description

This group includes all functions used to create/convert hex string objects.


Define Documentation

#define sat3_hxssize (   hxs)    sat3_strsize(hxs)

Get the number of nibbles in a hex string.

Parameters:
hxsHex string.
Returns:
Number of nibbles in the given hex string, or 0 if not a string.

Definition at line 2128 of file sat3.h.


Function Documentation

BOOL sat3_converthxs_bytes ( SAT_OBJECT  hxs,
char *  data,
int  maxbytes 
)

Extract a sequence of bytes from a hex string.

Useful to read arbitrary data from a calculator string.

Parameters:
hxsHex string to get bytes from.
dataPointer to a preallocateed buffer that is to receive the bytes.
maxbytesSize of the preallocated buffer.
Returns:
TRUE if successful, FALSE otherwise. If the size of the string is greater than the buffer size, only up to maxbytes will be extracted.
See also:
sat3_converthxs_int sat3_converthxs_llong sat3_hxssize Object creation and manipulation
int sat3_converthxs_int ( SAT_OBJECT  hxs)

Extract an integer from a hex string.

Reads the first 8 nibbles of a hex string as a 32-bit integer. If the hex string contains less than 8 nibbles, the number will be zero-padded in the upper nibbles (no sign extension).

Parameters:
hxsHex string.
Returns:
Number extracted from the hex string, or zero if the object is invalid.
See also:
sat3_converthxs_bytes sat3_converthxs_llong Object creation and manipulation
LONGLONG sat3_converthxs_llong ( SAT_OBJECT  hxs)

Extract a 64-bit integer from a hex string.

Reads the first 16 nibbles of a hex string as a 64-bit integer. If the hex string contains less than 16 nibbles, the number will be zero-padded in the upper nibbles (no sign extension).

Parameters:
hxsHex string.
Returns:
Number extracted from the hex string, or zero if the object is invalid.
See also:
sat3_converthxs_bytes sat3_converthxs_int Object creation and manipulation
SAT_OBJECT sat3_createhxs_bytes ( SAT_OBJECT  where,
char *  data,
int  nbytes 
)

Create a hex string object from a sequence of bytes.

Useful to include arbitrary data on a calculator hex string.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
dataPointer to the buffer containing the bytes to extract.
nbytesNumber of bytes to include on the hex string.
Returns:
SAT_OBJECT with the new hex string, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned or 0 if error.
See also:
sat3_createhxs_int sat3_createhxs_llong Object creation and manipulation
SAT_OBJECT sat3_createhxs_int ( SAT_OBJECT  where,
int  value 
)

Create a hex string object from a 32-bit integer.

Creates an 8-nibble hex string containing the integer.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valueNumber to insert into the hxs string.
Returns:
SAT_OBJECT with the new hexxx string, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned or 0 if error.
See also:
sat3_createhxs_llong sat3_createchxs_bytes Object creation and manipulation
SAT_OBJECT sat3_createhxs_llong ( SAT_OBJECT  where,
LONGLONG  value 
)

Create a hex string object from a 64-bit integer.

Creates an 16-nibble hex string containing the integer.

Parameters:
whereDefines where to allocate memory from. Can be one of the following constants: ALLOC_HEAP Allocates from the C-heap using malloc() ALLOC_TEMPOB Allocates memory from the TEMPOB calculator area or... it can be an element (SAT_OBJECT) within a composite object, (array, list or any other).
valueNumber to insert into the hxs string.
Returns:
SAT_OBJECT with the new hexxx string, or zero if it fails. When a SAT_OBJECT is given to the 'where' parameter, the same SAT_OBJECT is returned or 0 if error.
See also:
sat3_createhxs_int sat3_createchxs_bytes Object creation and manipulation