Simple Virtual Machine A simple but flexible virtual machine

Loading...
Searching...
No Matches
Functions
SVM labels in code
SVM codes

This module contains API functions to handle labels in SVM code. More...

## Functions
SVM_FUNCTION SVM_Boolean | svm_code_label_has_address (const void *svm, const SVM_Code code, const SVM_Value_String label)
| This function checks whether a SVM code defines a label given as a string value.
SVM_FUNCTION SVM_Boolean | svm_code_label_has_address__string (const void *svm, const SVM_Code code, const SVM_String label)
| This function checks whether a SVM code defines a label given as a SVM_String.
SVM_FUNCTION SVM_Boolean | svm_code_label_has_address__raw (const void *svm, const SVM_Code code, const char *label)
| This function checks whether a SVM code defines a label given as a C nul-terminated string.
SVM_FUNCTION SVM_Value_String * | svm_code_label_list (const void *svm, const SVM_Code code)
| This function returns all labels defined in a SVM code.
SVM_FUNCTION SVM_Address | svm_code_label_get_address (const void *svm, const SVM_Code code, const SVM_Value_String label)
| This function solves a label in a SVM code given as a string value.
SVM_FUNCTION SVM_Address | svm_code_label_get_address__string (const void *svm, const SVM_Code code, const SVM_String label)
| This function solves a label in a SVM code given as a SVM_String.
SVM_FUNCTION SVM_Address | svm_code_label_get_address__raw (const void *svm, const SVM_Code code, const char *label)
| This function solves a label in a SVM code given as a C nul-terminated string.

## Detailed Description

This module contains API functions to handle labels in SVM code.

## Function Documentation

## ◆ svm_code_label_get_address()

SVM_FUNCTION SVM_Address svm_code_label_get_address | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const SVM_Value_String | label
| ) |  |

This function solves a label in a SVM code given as a string value.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code to be diagnosed.
  [in] | label | The label to solve.

Note
  Symbols can also be targets of local calls.

Returns
  The local address corresponding to the label.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the label does not allow a local jump in the code.

## ◆ svm_code_label_get_address__raw()

SVM_FUNCTION SVM_Address svm_code_label_get_address__raw | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const char * | label
| ) |  |

This function solves a label in a SVM code given as a C nul-terminated string.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code to be diagnosed.
  [in] | label | The label to solve.

Note
  Symbols can also be targets of local calls.

Returns
  The local address corresponding to the label.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the label does not allow a local jump in the code.

## ◆ svm_code_label_get_address__string()

SVM_FUNCTION SVM_Address svm_code_label_get_address__string | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const SVM_String | label
| ) |  |

This function solves a label in a SVM code given as a SVM_String.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code to be diagnosed.
  [in] | label | The label to solve.

Note
  Symbols can also be targets of local calls.

Returns
  The local address corresponding to the label.

Exceptions

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the label does not allow a local jump in the code.

## ◆ svm_code_label_has_address()

SVM_FUNCTION SVM_Boolean svm_code_label_has_address | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const SVM_Value_String | label
| ) |  |

This function checks whether a SVM code defines a label given as a string value.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code to be diagnosed.
  [in] | label | The label to check.

Returns
  TRUE if the label is eligible to a local call in the SVM code, FALSE otherwise.

Exceptions

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

## ◆ svm_code_label_has_address__raw()

SVM_FUNCTION SVM_Boolean svm_code_label_has_address__raw | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const char * | label
| ) |  |

This function checks whether a SVM code defines a label given as a C nul-terminated string.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code to be diagnosed.
  [in] | label | The label to check.

Returns
  TRUE if the label is eligible to a local call in the SVM code, FALSE otherwise.

Exceptions

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

## ◆ svm_code_label_has_address__string()

SVM_FUNCTION SVM_Boolean svm_code_label_has_address__string | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const SVM_String | label
| ) |  |

This function checks whether a SVM code defines a label given as a SVM_String.

Parameters

  [in] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code to be diagnosed.
  [in] | label | The label to check.

Returns
  TRUE if the label is eligible to a local call in the SVM code, FALSE otherwise.

Exceptions

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

## ◆ svm_code_label_list()

SVM_FUNCTION SVM_Value_String * svm_code_label_list | ( | const void * | svm,
|  | const SVM_Code | code
| ) |  |

This function returns all labels defined in a SVM code.

Parameters

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

This function returns all labels of a SVM code. Symbols are not returned by this function.

Note
  The returned array is managed by the SVM and does not need to be freed/deleted.

Returns
  A NULL terminated array of string values containing the label names.

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.)

See also
  svm_code_symbol_list