Simple Virtual Machine A simple but flexible virtual machine

Modules | Functions
SVM values

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

## Modules
| SVM integer values
| This module contains API functions to handle SVM integer values.
| SVM string values
| This module contains API functions to handle SVM string values.
| SVM boolean values
| This module contains API functions to handle SVM boolean values.
| SVM pointer values
| This module contains API functions to handle SVM pointer values.
| SVM library values
| This module contains API functions to handle SVM library values.
| SVM symbol values
| This module contains API functions to handle SVM symbol values.
| SVM plugin entry point values
| This module contains API functions to handle SVM plugin entry point values.
| SVM interruption values
| This module contains API functions to handle SVM interruption values.
| SVM plugin values
| This module contains API functions to handle SVM plugin values.
| SVM automatic values
| This module contains API functions to handle SVM automatic values.
| SVM values types
| This module contains API functions to handle SVM values types.
| SVM values state
| This module contains API functions to handle SVM values state.

## Functions
SVM_FUNCTION SVM_Comparison_Result | svm_value_compare (const void *svm, const SVM_Value left, const SVM_Value right)
| This function compares two values. More...
SVM_FUNCTION SVM_Boolean | svm_value_is_equal (const void *svm, const SVM_Value left, const SVM_Value right)
| This function checks whether two values are equal. More...
SVM_FUNCTION SVM_Value | svm_value_copy (const void *svm, const SVM_Value value)
| This function creates a copy from a value. More...
SVM_FUNCTION SVM_String | svm_value_print (const void *svm, const SVM_Value value)
| This function extracts a string representation of a value. More...
SVM_FUNCTION SVM_Value * | svm_value_array_new (const void *svm, SVM_Size size)
| This function creates an array of values. More...

## Detailed Description

This module contains API functions to handle SVM values.

Values are containers for data a memory can store.

Note
  In parameters, values are always passed by reference. Using a set API function on a value passed on a parameter containing a value read from a memory will change the value directly in the memory. This can be used to implement an "extra return parameter" or use a value in memory as a state between several plugin callback function calls.

Warning
  Changing a value written in memory will bypass all eventual memory synchronisation mecanisms. Use this feature with caution.

See also
  SVM memories
  SVM memory synchronisation

## Function Documentation

## ◆ svm_value_array_new()

SVM_FUNCTION SVM_Value * svm_value_array_new | ( | const void * | svm,
|  | SVM_Size | size
| ) |  |

This function creates an array of values.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | size | The size of the array.

Returns
  A pointer to a C array of SVM_Value. Every cell of the array has to be initialised by a value before being passed to an API function.

Note
  The returned array is a valid SVM variable: its scope can be changed if needed, and the pointer shall not be freed explicitely.

Exceptions

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

## ◆ svm_value_compare()

SVM_FUNCTION SVM_Comparison_Result svm_value_compare | ( | const void * | svm,
|  | const SVM_Value | left,
|  | const SVM_Value | right
| ) |  |

This function compares two values.

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
  The comparison status of the two values.

Exceptions

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

See also
  SVM_Comparison_Result

## ◆ svm_value_copy()

SVM_FUNCTION SVM_Value svm_value_copy | ( | const void * | svm,
|  | const SVM_Value | value
| ) |  |

This function creates a copy from a value.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | value | The value to be copied.

Note
  If a value can not be copied, a MEMORY interruption is raised.

Returns
  The non-constant copy of the value.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  MEMORY | interruption when the value can not be copied.

## ◆ svm_value_is_equal()

SVM_FUNCTION SVM_Boolean svm_value_is_equal | ( | const void * | svm,
|  | const SVM_Value | left,
|  | const SVM_Value | right
| ) |  |

This function checks whether two values are equal.

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 the two values have the same type and the same value, FALSE otherwise.

Exceptions

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

See also
  svm_value_compare

## ◆ svm_value_print()

SVM_FUNCTION SVM_String svm_value_print | ( | const void * | svm,
|  | const SVM_Value | value
| ) |  |

This function extracts a string representation of a value.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | value | The value to be rendered as string.

Note
  If a value can not correctly rendered, an ugly default rendering is returned instead.

Returns
  The string representation of the value.

Exceptions

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