Simple Virtual Machine A simple but flexible virtual machine

Loading...
Searching...
No Matches
Modules | Functions
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.
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.
SVM_FUNCTION SVM_String | svm_code_print (const void *svm, const SVM_Code code)
| This function renders a textual representation of a SVM code.

## 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:

- Create fully independant libraries,
- Create local code contextes to split application in components with identified entry points,
- Introduce genericity in code execution by importing code as text,
- Use of code generators.

## 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code from wich the name has to be extracted.

Returns
  The code name.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The code from wich the name has to be extracted.

Returns
  The code source.

Exceptions

  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | code | The 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

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