Simple Virtual Machine
A simple but flexible virtual machine
SVM labels in code

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. More...
 
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. More...
 
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. More...
 
SVM_FUNCTION SVM_Value_Stringsvm_code_label_list (const void *svm, const SVM_Code code)
 This function returns all labels defined in a SVM code. More...
 
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. More...
 
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. More...
 
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. More...
 

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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]labelThe label to solve.
Note
Symbols can also be targets of local calls.
Returns
The local address corresponding to the label.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption 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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]labelThe label to solve.
Note
Symbols can also be targets of local calls.
Returns
The local address corresponding to the label.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption 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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]labelThe label to solve.
Note
Symbols can also be targets of local calls.
Returns
The local address corresponding to the label.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption 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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]labelThe label to check.
Returns
TRUE if the label is eligible to a local call in the SVM code, FALSE otherwise.
Exceptions
FAILUREinterruption 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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]labelThe label to check.
Returns
TRUE if the label is eligible to a local call in the SVM code, FALSE otherwise.
Exceptions
FAILUREinterruption 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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]labelThe label to check.
Returns
TRUE if the label is eligible to a local call in the SVM code, FALSE otherwise.
Exceptions
FAILUREinterruption 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]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe 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
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
See also
svm_code_symbol_list