Simple Virtual Machine A simple but flexible virtual machine

Functions
SVM string values
SVM 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | string | The string value to extract from.

Returns
  The contained string.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | string | The raw string to initiate the string value.

Returns
  The string value.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | string | The buffer to initiate the string value.
  [in] | size | The 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

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | string | The raw string to initiate the string value.

Returns
  The string value.

Exceptions

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

Returns
  A non initialised string value.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in,out] | value | The string value to update.
  [in] | string | The new string value.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the value parameter does not contain a string.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in,out] | value | The string value to update.
  [in] | string | The new string buffer value.
  [in] | size | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the value parameter does not contain a string.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in,out] | value | The string value to update.
  [in] | string | The new string value.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the value parameter does not contain a string.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | value | The value to be diagnosed.

Returns
  TRUE if the value contains a string, FALSE otherwise.

Exceptions

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