Simple Virtual Machine
A simple but flexible virtual machine
SVM codes

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

Modules

 SVM codes getters
 This module contains API functions to create SVM codes.
 
 SVM labels in code
 This module contains API functions to handle labels in SVM code.
 
 SVM symbols in code
 This module contains API functions to handle symbols in SVM code.
 
 SVM code instructions
 This module contains API functions to handle SVM code instructions.
 

Functions

SVM_FUNCTION SVM_String svm_code_get_name (const void *svm, const SVM_Code code)
 This function extracts the code name from the SVM code. More...
 
SVM_FUNCTION SVM_String svm_code_get_source (const void *svm, const SVM_Code code)
 This function extracts the code source from the SVM code. More...
 
SVM_FUNCTION SVM_String svm_code_print (const void *svm, const SVM_Code code)
 This function renders a textual representation of a SVM code. More...
 

Detailed Description

This module contains API functions to handle SVM codes.

SVM code are objects containing execution directives for processors, written by the virtual machine users.

This concept allows usage of different consistent modules having a dedicated scope to:

Function Documentation

◆ svm_code_get_name()

SVM_FUNCTION SVM_String svm_code_get_name ( const void *  svm,
const SVM_Code  code 
)

This function extracts the code name from the SVM code.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code from wich the name has to be extracted.
Returns
The code name.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_code_get_source()

SVM_FUNCTION SVM_String svm_code_get_source ( const void *  svm,
const SVM_Code  code 
)

This function extracts the code source from the SVM code.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code from wich the name has to be extracted.
Returns
The code source.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_code_print()

SVM_FUNCTION SVM_String svm_code_print ( const void *  svm,
const SVM_Code  code 
)

This function renders a textual representation of a SVM code.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to render as string.
Note
The resulting string is not guaranteed to be compilable again. In particular, it contains a one line header that should be removed prior to any compilation attempt.
Returns
The string representation of a SVM code.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)