Simple Virtual Machine
A simple but flexible virtual machine
SVM strings

This module contains API functions to handle SVM strings. More...

Functions

SVM_FUNCTION SVM_String svm_string_new (const void *svm, const char *buffer, const SVM_Size size)
 This function creates an instance of a SVM_String from a memory buffer. More...
 
SVM_FUNCTION SVM_String svm_string_new__raw (const void *svm, const char *string)
 This function creates an instance of a SVM_String from a C string. More...
 
SVM_FUNCTION SVM_String svm_string_new__buffer (const void *svm, const SVM_Size size)
 This function creates an instance of a SVM_String uninitialised. More...
 
SVM_FUNCTION SVM_String svm_string_join (const void *svm, const SVM_String first, const SVM_String second)
 This function creates an instance of a SVM_String from two SVM_String. More...
 
SVM_FUNCTION SVM_String svm_string_join__raw (const void *svm, const SVM_String first, const char *second)
 This function creates an instance of a SVM_String from a SVM_String and a C nul terminated string. More...
 
SVM_FUNCTION SVM_String svm_string_join__buffer (const void *svm, const SVM_String first, const char *second, const SVM_Size size)
 This function creates an instance of a SVM_String from a SVM_String and a memory buffer. More...
 
SVM_FUNCTION SVM_Boolean svm_string_is_equal (const void *svm, const SVM_String left, const SVM_String right)
 This function compares two SVM_String. More...
 
SVM_FUNCTION SVM_Boolean svm_string_is_equal__raw (const void *svm, const SVM_String left, const char *right)
 This function compares a SVM_String to a C string. More...
 
SVM_FUNCTION SVM_Boolean svm_string_is_equal__buffer (const void *svm, const SVM_String left, const char *buffer, const SVM_Size size)
 This function compares a SVM_String to a C buffer. More...
 

Detailed Description

This module contains API functions to handle SVM strings.

Strings are structures used to exchange memory buffers between the virtual machine and the plugin callback functions.

They can be managed by the virtual machine when created using API functions, but can also be manually managed by the plugin code.

Function Documentation

◆ svm_string_is_equal()

SVM_FUNCTION SVM_Boolean svm_string_is_equal ( const void *  svm,
const SVM_String  left,
const SVM_String  right 
)

This function compares two SVM_String.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]leftThe left operand of the equality.
[in]rightThe right operand of the equality.
Returns
TRUE if left and right contains the same string, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_string_is_equal__buffer()

SVM_FUNCTION SVM_Boolean svm_string_is_equal__buffer ( const void *  svm,
const SVM_String  left,
const char *  buffer,
const SVM_Size  size 
)

This function compares a SVM_String to a C buffer.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]leftThe left operand of the equality.
[in]bufferThe buffer, right operand of the equality.
[in]sizeThe buffer size.
Returns
TRUE if left and right contains the same string, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_string_is_equal__raw()

SVM_FUNCTION SVM_Boolean svm_string_is_equal__raw ( const void *  svm,
const SVM_String  left,
const char *  right 
)

This function compares a SVM_String to a C string.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]leftThe left operand of the equality.
[in]rightThe right operand of the equality.
Returns
TRUE if left and right contains the same string, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_string_join()

SVM_FUNCTION SVM_String svm_string_join ( const void *  svm,
const SVM_String  first,
const SVM_String  second 
)

This function creates an instance of a SVM_String from two SVM_String.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]firstThe start of the new string.
[in]secondThe end of the new string.
Returns
The joined SVM_String. Its buffer is managed by the SVM like variables.
See also
SVM variables

◆ svm_string_join__buffer()

SVM_FUNCTION SVM_String svm_string_join__buffer ( const void *  svm,
const SVM_String  first,
const char *  second,
const SVM_Size  size 
)

This function creates an instance of a SVM_String from a SVM_String and a memory buffer.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]firstThe start of the new string.
[in]secondThe end of the new string.
[in]sizeThe size of the end of the new string.
Returns
The joined SVM_String. Its buffer is managed by the SVM like variables.
See also
SVM variables

◆ svm_string_join__raw()

SVM_FUNCTION SVM_String svm_string_join__raw ( const void *  svm,
const SVM_String  first,
const char *  second 
)

This function creates an instance of a SVM_String from a SVM_String and a C nul terminated string.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]firstThe start of the new string.
[in]secondThe end of the new string.
Returns
The joined SVM_String. Its buffer is managed by the SVM like variables.
See also
SVM variables

◆ svm_string_new()

SVM_FUNCTION SVM_String svm_string_new ( const void *  svm,
const char *  buffer,
const SVM_Size  size 
)

This function creates an instance of a SVM_String from a memory buffer.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]bufferThe start of the buffer.
[in]sizeThe size of the buffer.
Returns
The corresponding SVM_String. Its buffer is managed by the SVM like variables.
See also
SVM variables

◆ svm_string_new__buffer()

SVM_FUNCTION SVM_String svm_string_new__buffer ( const void *  svm,
const SVM_Size  size 
)

This function creates an instance of a SVM_String uninitialised.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]sizeThe size of the created string.
Returns
The corresponding SVM_String. Its buffer is managed by the SVM like variables.
See also
SVM variables

◆ svm_string_new__raw()

SVM_FUNCTION SVM_String svm_string_new__raw ( const void *  svm,
const char *  string 
)

This function creates an instance of a SVM_String from a C string.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]stringA C-nul-terminated string to initiate the string.
Returns
The corresponding SVM_String. Its buffer is managed by the SVM like variables.
Note
This function adds an extra nul character at the end of the buffer, not counted in the size of the created string.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
See also
SVM variables