Simple Virtual Machine
A simple but flexible virtual machine
SVM string values

This module contains API functions to handle SVM string values. More...

Functions

SVM_FUNCTION SVM_Value_String svm_value_string_new (const void *svm, const SVM_String string)
 This function creates a string value the SVM can store in its memories from a SVM_String. More...
 
SVM_FUNCTION SVM_Value_String svm_value_string_new__raw (const void *svm, const char *string)
 This function creates a string value the SVM can store in its memories from a C nul-terminated string. More...
 
SVM_FUNCTION SVM_Value_String svm_value_string_new__buffer (const void *svm, const char *string, const SVM_Size size)
 This function creates a string value the SVM can store in its memories from a memory buffer. More...
 
SVM_FUNCTION SVM_Value_String svm_value_string_new_null (const void *svm)
 This function creates a string value the SVM can store in its memories without a value. More...
 
SVM_FUNCTION SVM_Boolean svm_value_type_is_string (const void *svm, const SVM_Value value)
 This function checks whether a value contains a string. More...
 
SVM_FUNCTION SVM_String svm_value_string_get (const void *svm, const SVM_Value_String string)
 This function extracts the SVM_String contained in a string value. More...
 
SVM_FUNCTION void svm_value_string_set (const void *svm, SVM_Value_String value, const SVM_String string)
 This function replaces the raw string contained in a string value from a SVM_String. More...
 
SVM_FUNCTION void svm_value_string_set__raw (const void *svm, SVM_Value_String value, const char *string)
 This function replaces the raw string contained in a string value from a C null-terminated string. More...
 
SVM_FUNCTION void svm_value_string_set__buffer (const void *svm, SVM_Value_String value, const char *string, const SVM_Size size)
 This function replaces the raw string contained in a string value from a buffer. More...
 

Detailed Description

This module contains API functions to handle SVM string values.

Function Documentation

◆ svm_value_string_get()

SVM_FUNCTION SVM_String svm_value_string_get ( const void *  svm,
const SVM_Value_String  string 
)

This function extracts the SVM_String contained in a string value.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]stringThe string value to extract from.
Returns
The contained string.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the string parameter does not contain a string.
See also
svm_value_type_is_string
svm_value_type_get

◆ svm_value_string_new()

SVM_FUNCTION SVM_Value_String svm_value_string_new ( const void *  svm,
const SVM_String  string 
)

This function creates a string value the SVM can store in its memories from a SVM_String.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]stringThe raw string to initiate the string value.
Returns
The string value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_value_string_new__buffer()

SVM_FUNCTION SVM_Value_String svm_value_string_new__buffer ( const void *  svm,
const char *  string,
const SVM_Size  size 
)

This function creates a string value the SVM can store in its memories from a memory buffer.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]stringThe buffer to initiate the string value.
[in]sizeThe buffer size.
Warning
The allocated buffer has to be large enough to contain at least size bytes, or it will result in an undefined behavior.
Returns
The string value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_value_string_new__raw()

SVM_FUNCTION SVM_Value_String svm_value_string_new__raw ( const void *  svm,
const char *  string 
)

This function creates a string value the SVM can store in its memories from a C nul-terminated string.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]stringThe raw string to initiate the string value.
Returns
The string value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_value_string_new_null()

SVM_FUNCTION SVM_Value_String svm_value_string_new_null ( const void *  svm)

This function creates a string value the SVM can store in its memories without a value.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
Returns
A non initialised string value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_value_string_set()

SVM_FUNCTION void svm_value_string_set ( const void *  svm,
SVM_Value_String  value,
const SVM_String  string 
)

This function replaces the raw string contained in a string value from a SVM_String.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in,out]valueThe string value to update.
[in]stringThe new string value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the value parameter does not contain a string.
FAILUREinterruption when the value is a constant.
See also
svm_value_type_is_string
svm_value_type_get

◆ svm_value_string_set__buffer()

SVM_FUNCTION void svm_value_string_set__buffer ( const void *  svm,
SVM_Value_String  value,
const char *  string,
const SVM_Size  size 
)

This function replaces the raw string contained in a string value from a buffer.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in,out]valueThe string value to update.
[in]stringThe new string buffer value.
[in]sizeThe size of the new string buffer.
Warning
The allocated buffer has to be large enough to contain at least size bytes, or it will result in an undefined behavior.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the value parameter does not contain a string.
FAILUREinterruption when the value is a constant.

◆ svm_value_string_set__raw()

SVM_FUNCTION void svm_value_string_set__raw ( const void *  svm,
SVM_Value_String  value,
const char *  string 
)

This function replaces the raw string contained in a string value from a C null-terminated string.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in,out]valueThe string value to update.
[in]stringThe new string value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the value parameter does not contain a string.
FAILUREinterruption when the value is a constant.

◆ svm_value_type_is_string()

SVM_FUNCTION SVM_Boolean svm_value_type_is_string ( const void *  svm,
const SVM_Value  value 
)

This function checks whether a value contains a string.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]valueThe value to be diagnosed.
Returns
TRUE if the value contains a string, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)