Simple Virtual Machine A simple but flexible virtual machine

Loading...
Searching...
No Matches
Functions
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.
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.
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.
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.
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.
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.
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.
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.
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.

## 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | left | The left operand of the equality.
  [in] | right | The right operand of the equality.

Returns
  TRUE if left and right contains the same string, FALSE otherwise.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | left | The left operand of the equality.
  [in] | buffer | The buffer, right operand of the equality.
  [in] | size | The buffer size.

Returns
  TRUE if left and right contains the same string, FALSE otherwise.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | left | The left operand of the equality.
  [in] | right | The right operand of the equality.

Returns
  TRUE if left and right contains the same string, FALSE otherwise.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | first | The start of the new string.
  [in] | second | 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__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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | first | The start of the new string.
  [in] | second | The end of the new string.
  [in] | size | The 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | first | The start of the new string.
  [in] | second | 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_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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | buffer | The start of the buffer.
  [in] | size | The 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | size | The 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | string | A 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)

See also
  SVM variables