Simple Virtual Machine
A simple but flexible virtual machine
SVM code instructions

This module contains API functions to handle SVM code instructions. More...

Functions

SVM_FUNCTION SVM_Size svm_code_get_size (const void *svm, const SVM_Code code)
 This function returns the number of instructions of a given SVM code. More...
 
SVM_FUNCTION SVM_String svm_code_instruction_get_text (const void *svm, const SVM_Code code, const SVM_Address address)
 This function returns the text of the instruction at a given address of a given SVM code. More...
 
SVM_FUNCTION SVM_Boolean svm_code_instruction_is_system (const void *svm, const SVM_Code code, const SVM_Address address)
 This function returns whether the instruction at a given address of a given SVM code has the system flag. More...
 
SVM_FUNCTION SVM_Boolean svm_code_instruction_is_waiting (const void *svm, const SVM_Code code, const SVM_Address address)
 This function returns whether the instruction at a given address of a given SVM code has the waiting flag. More...
 
SVM_FUNCTION SVM_String svm_code_instruction_get_location (const void *svm, const SVM_Code code, const SVM_Address address)
 This function returns the text of the location of the instruction at a given address of a given SVM code. More...
 

Detailed Description

This module contains API functions to handle SVM code instructions.

Function Documentation

◆ svm_code_get_size()

SVM_FUNCTION SVM_Size svm_code_get_size ( const void *  svm,
const SVM_Code  code 
)

This function returns the number of instructions of a given SVM code.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.

Valid addresses for this code are from 0 to the number returned by this function minus one.

Returns
The number of instructions of the SVM code.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_code_instruction_get_location()

SVM_FUNCTION SVM_String svm_code_instruction_get_location ( const void *  svm,
const SVM_Code  code,
const SVM_Address  address 
)

This function returns the text of the location of the instruction at a given address of a given SVM code.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]addressThe address of the instruction.
Returns
A SVM_String with the text of the location in the code text of the instruction.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the address is outside the address range of the SVM code.

◆ svm_code_instruction_get_text()

SVM_FUNCTION SVM_String svm_code_instruction_get_text ( const void *  svm,
const SVM_Code  code,
const SVM_Address  address 
)

This function returns the text of the instruction at a given address of a given SVM code.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]addressThe address of the instruction.
Returns
A SVM_String with the text of the instruction.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the address is outside the address range of the SVM code.

◆ svm_code_instruction_is_system()

SVM_FUNCTION SVM_Boolean svm_code_instruction_is_system ( const void *  svm,
const SVM_Code  code,
const SVM_Address  address 
)

This function returns whether the instruction at a given address of a given SVM code has the system flag.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]addressThe address of the instruction.
Returns
TRUE when the instruction is system, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the address is outside the address range of the SVM code.

◆ svm_code_instruction_is_waiting()

SVM_FUNCTION SVM_Boolean svm_code_instruction_is_waiting ( const void *  svm,
const SVM_Code  code,
const SVM_Address  address 
)

This function returns whether the instruction at a given address of a given SVM code has the waiting flag.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]codeThe code to be diagnosed.
[in]addressThe address of the instruction.
Returns
TRUE when the instruction is waiting, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the address is outside the address range of the SVM code.