Simple Virtual Machine A simple but flexible virtual machine

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

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

## Functions
SVM_FUNCTION SVM_Boolean | svm_code_symbol_has_address (const void *svm, const SVM_Code code, const SVM_Value_String label)
| This function checks whether a SVM code defines a symbol given as a string value.
SVM_FUNCTION SVM_Boolean | svm_code_symbol_has_address__string (const void *svm, const SVM_Code code, const SVM_String label)
| This function checks whether a SVM code defines a symbol given as a SVM_String.
SVM_FUNCTION SVM_Boolean | svm_code_symbol_has_address__raw (const void *svm, const SVM_Code code, const char *label)
| This function checks whether a SVM code defines a symbol given as a C nul-terminated string.
SVM_FUNCTION SVM_Value_String * | svm_code_symbol_list (const void *svm, const SVM_Code code)
| This function returns all symbols defined in a SVM code.
SVM_FUNCTION SVM_Value_Symbol | svm_code_symbol_get_address (const void *svm, const SVM_Code code, const SVM_Value_String label)
| This function solves a symbol in a SVM code given as a string value.
SVM_FUNCTION SVM_Value_Symbol | svm_code_symbol_get_address__string (const void *svm, const SVM_Code code, const SVM_String label)
| This function solves a symbol in a SVM code given as a SVM_String.
SVM_FUNCTION SVM_Value_Symbol | svm_code_symbol_get_address__raw (const void *svm, const SVM_Code code, const char *label)
| This function solves a symbol in a SVM code given as a C nul-terminated string.

## Detailed Description

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

## Function Documentation

## ◆ svm_code_symbol_get_address()

SVM_FUNCTION SVM_Value_Symbol svm_code_symbol_get_address | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const SVM_Value_String | label
| ) |  |

This function solves a symbol 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.

Returns
  The symbol value containing the global 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 global jump in the code.

## ◆ svm_code_symbol_get_address__raw()

SVM_FUNCTION SVM_Value_Symbol svm_code_symbol_get_address__raw | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const char * | label
| ) |  |

This function solves a symbol 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.

Returns
  The symbol value containing the global 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 global jump in the code.

## ◆ svm_code_symbol_get_address__string()

SVM_FUNCTION SVM_Value_Symbol svm_code_symbol_get_address__string | ( | const void * | svm,
|  | const SVM_Code | code,
|  | const SVM_String | label
| ) |  |

This function solves a symbol 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.

Returns
  The symbol value containing the global 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 global jump in the code.

## ◆ svm_code_symbol_has_address()

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

This function checks whether a SVM code defines a symbol 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.

Returns
  TRUE if the symbol is eligible to a global 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_symbol_has_address__raw()

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

This function checks whether a SVM code defines a symbol 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.

Returns
  TRUE if the symbol is eligible to a global 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_symbol_has_address__string()

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

This function checks whether a SVM code defines a symbol 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.

Returns
  TRUE if the symbol is eligible to a global 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_symbol_list()

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

This function returns all symbols 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 symbols of a SVM code. Labels are not returned by this function.

Returns
  A NULL terminated array of string values containing the symbol 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.

Usage example:

SVM_Value_String *label = svm_code_symbol_list(svm,code);
for( ; !label ; ++label) // we don't need to keep label on the first label
{
SVM_Value_Symbol symbol = svm_code_symbol_get_address(svm,code,*label);
// ...
}
SVM_Value_String
SVM_TYPE typedef const void * SVM_Value_String
This type is used to represent a string the SVM can store in one of its memories.
Definition svm.h:549
SVM_Value_Symbol
SVM_TYPE typedef const void * SVM_Value_Symbol
This type is used to represent a symbol the SVM can store in one of its memories.
Definition svm.h:593
svm_code_symbol_get_address
SVM_FUNCTION SVM_Value_Symbol svm_code_symbol_get_address(const void *svm, const SVM_Code code, const SVM_Value_String label)
This function solves a symbol in a SVM code given as a string value.
svm_code_symbol_list
SVM_FUNCTION SVM_Value_String * svm_code_symbol_list(const void *svm, const SVM_Code code)
This function returns all symbols defined in a SVM code.

Exceptions

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

See also
  svm_code_label_list