Libraries
Bstring Source Code
 previous   up   next 

Types
bstring
Type for byte strings.

bstring

const type: bstring

Type for byte strings.


Operator Summary
bstring
(attr bstring) . value
Default value of bstring (bstring("")).
bstring
(attr bstring) parse (in string: stri)
Convert a string to a bstring value.
char
(in bstring: bstri) [ (in integer: index) ]
Get a character, identified by an index, from a bstring.
boolean
(in bstring: bstri1) = (in bstring: bstri2)
Check if two bstrings are equal.
boolean
(in bstring: bstri1) <> (in bstring: bstri2)
Check if two bstrings are not equal.

Function Summary
string
str (in bstring: bstri)
Convert a bstring value to a string.
string
literal (in bstring: bstri)
Convert a bstring value to a bstring literal.
string
string (in bstring: bstri)
Convert a bstring value to a string.
bstring
bstring (in string: stri)
Convert a string to a bstring value.
integer
length (in bstring: bstri)
Determine the length of a bstring.
integer
compare (in bstring: bstri1, in bstring: bstri2)
Compare two bstrings.
integer
hashCode (in bstring: bstri)
Compute the hash value of a bstring.
void
for (inout char: forVar) range (in bstring: bstri) do (in proc: statements) end for
For-loop which loops over the characters of a bstring.
bigInteger
bStriBe2BigInt (in bstring: bstri, in boolean: isSigned)
Convert a bstring (interpreted as big-endian) to a bigInteger.
bigInteger
bStriLe2BigInt (in bstring: bstri, in boolean: isSigned)
Convert a bstring (interpreted as little-endian) to a bigInteger.
bstring
bStriBe (in bigInteger: number, in boolean: isSigned)
Convert a bigInteger into a big-endian bstring.
bstring
bStriLe (in bigInteger: number, in boolean: isSigned)
Convert a bigInteger into a little-endian bstring.

Operator Detail

. value

const bstring: (attr bstring) . value

Default value of bstring (bstring("")).


parse

const func bstring: (attr bstring) parse (in string: stri)

Convert a string to a bstring value.

Returns:
the bstring result of the conversion.
Raises:
RANGE_ERROR - If characters beyond '\255;' are present.
MEMORY_ERROR - Not enough memory to represent the result.

[

const func char: (in bstring: bstri) [ (in integer: index) ]

Get a character, identified by an index, from a bstring. The first character has the index 1.

Returns:
the character specified with the index.
Raises:
INDEX_ERROR - If the index is less than 1 or greater than the length of the bstring.

=

const func boolean: (in bstring: bstri1) = (in bstring: bstri2)

Check if two bstrings are equal.

Returns:
TRUE if both bstrings are equal, FALSE otherwise.

<>

const func boolean: (in bstring: bstri1) <> (in bstring: bstri2)

Check if two bstrings are not equal.

Returns:
FALSE if both bstrings are equal, TRUE otherwise.

Function Detail

str

const func string: str (in bstring: bstri)

Convert a bstring value to a string.

Returns:
the string result of the conversion.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

literal

const func string: literal (in bstring: bstri)

Convert a bstring value to a bstring literal.

Returns:
the bstring literal.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

string

const func string: string (in bstring: bstri)

Convert a bstring value to a string.

Returns:
the string result of the conversion.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

bstring

const func bstring: bstring (in string: stri)

Convert a string to a bstring value.

Returns:
the bstring result of the conversion.
Raises:
RANGE_ERROR - If characters beyond '\255;' are present.
MEMORY_ERROR - Not enough memory to represent the result.

length

const func integer: length (in bstring: bstri)

Determine the length of a bstring.

Returns:
the length of the bstring.

compare

const func integer: compare (in bstring: bstri1, in bstring: bstri2)

Compare two bstrings.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in bstring: bstri)

Compute the hash value of a bstring.

Returns:
the hash value.

for

const proc: for (inout char: forVar) range (in bstring: bstri) do (in proc: statements) end for

For-loop which loops over the characters of a bstring.


bStriBe2BigInt

const func bigInteger: bStriBe2BigInt (in bstring: bstri, in boolean: isSigned)

Convert a bstring (interpreted as big-endian) to a bigInteger.

Parameters:
bstri - Bstring to be converted. The bytes are interpreted as binary big-endian representation with a base of 256.
isSigned - Defines if bstri is interpreted as signed value. If isSigned is TRUE the twos-complement representation is used. In this case the result is negative if the most significant byte (the first byte) has an ordinal >= 128.
Returns:
a bigInteger created from the big-endian bytes.

bStriLe2BigInt

const func bigInteger: bStriLe2BigInt (in bstring: bstri, in boolean: isSigned)

Convert a bstring (interpreted as little-endian) to a bigInteger.

Parameters:
bstri - Bstring to be converted. The bytes are interpreted as binary little-endian representation with a base of 256.
isSigned - Defines if bstri is interpreted as signed value. If isSigned is TRUE the twos-complement representation is used. In this case the result is negative if the most significant byte (the last byte) has an ordinal >= 128.
Returns:
a bigInteger created from the little-endian bytes.

bStriBe

const func bstring: bStriBe (in bigInteger: number, in boolean: isSigned)

Convert a bigInteger into a big-endian bstring. The result uses binary representation with a base of 256.

Parameters:
number - BigInteger number to be converted.
isSigned - Determines the signedness of the result. If isSigned is TRUE the result is encoded with the twos-complement representation. In this case a negative number is converted to a result where the most significant byte (the first byte) has an ordinal >= 128.
Returns:
a bstring with the big-endian representation.
Raises:
RANGE_ERROR - If number is negative and isSigned is FALSE.
MEMORY_ERROR - Not enough memory to represent the result.

bStriLe

const func bstring: bStriLe (in bigInteger: number, in boolean: isSigned)

Convert a bigInteger into a little-endian bstring. The result uses binary representation with a base of 256.

Parameters:
number - BigInteger number to be converted.
isSigned - Determines the signedness of the result. If isSigned is TRUE the result is encoded with the twos-complement representation. In this case a negative number is converted to a result where the most significant byte (the last byte) has an ordinal >= 128.
Returns:
a bstring with the little-endian representation.
Raises:
RANGE_ERROR - If number is negative and isSigned is FALSE.
MEMORY_ERROR - Not enough memory to represent the result.


 previous   up   next