Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.VM.interfaces.BombillaStacks.nc

Interface: BombillaStacks

Interface that specifies the operations on operand and return stacks in Bombilla.

Components providing this interface:
tos.lib.VM.components.BStacks
tos.lib.VM.components.BStacksProxy

Components requiring this interface:
tos.lib.VM.components.BContextSynch
tos.lib.VM.contexts.RecvContextM
tos.lib.VM.opcodes.OPaddM
tos.lib.VM.opcodes.OPandM
tos.lib.VM.opcodes.OPbclearM
tos.lib.VM.opcodes.OPbfullM
tos.lib.VM.opcodes.OPbgetM
tos.lib.VM.opcodes.OPbheadM
tos.lib.VM.opcodes.OPbpush1M
tos.lib.VM.opcodes.OPbsizeM
tos.lib.VM.opcodes.OPbsortaM
tos.lib.VM.opcodes.OPbsortdM
tos.lib.VM.opcodes.OPbtailM
tos.lib.VM.opcodes.OPbyankM
tos.lib.VM.opcodes.OPcall2M
tos.lib.VM.opcodes.OPcastM
tos.lib.VM.opcodes.OPcopyM
tos.lib.VM.opcodes.OPcpullM
tos.lib.VM.opcodes.OPcpushM
tos.lib.VM.opcodes.OPdepthM
tos.lib.VM.opcodes.OPeqM
tos.lib.VM.opcodes.OPeqtypeM
tos.lib.VM.opcodes.OPgetmbM
tos.lib.VM.opcodes.OPgetmsM
tos.lib.VM.opcodes.OPgetsetvar4M
tos.lib.VM.opcodes.OPgtM
tos.lib.VM.opcodes.OPgteM
tos.lib.VM.opcodes.OPidM
tos.lib.VM.opcodes.OPinvM
tos.lib.VM.opcodes.OPjumps5M
tos.lib.VM.opcodes.OPlandM
tos.lib.VM.opcodes.OPlnotM
tos.lib.VM.opcodes.OPlorM
tos.lib.VM.opcodes.OPltM
tos.lib.VM.opcodes.OPlteM
tos.lib.VM.opcodes.OPmodM
tos.lib.VM.opcodes.OPnotM
tos.lib.VM.opcodes.OPorM
tos.lib.VM.opcodes.OPpopM
tos.lib.VM.opcodes.OPpunlockM
tos.lib.VM.opcodes.OPpunlockbM
tos.lib.VM.opcodes.OPpushc6M
tos.lib.VM.opcodes.OPputledM
tos.lib.VM.opcodes.OPrandM
tos.lib.VM.opcodes.OPretM
tos.lib.VM.opcodes.OPsendM
tos.lib.VM.opcodes.OPsendrM
tos.lib.VM.opcodes.OPsenseM
tos.lib.VM.opcodes.OPsetmbM
tos.lib.VM.opcodes.OPsetmsM
tos.lib.VM.opcodes.OPshiftlM
tos.lib.VM.opcodes.OPshiftrM
tos.lib.VM.opcodes.OPswapM
tos.lib.VM.opcodes.OPuartM
tos.lib.VM.opcodes.OPunlockM
tos.lib.VM.opcodes.OPunlockbM

Commands

Commands - Details

resetStacks

result_t resetStacks(BombillaContext *context)

Resets both stacks in a context; the operand stack and the return stack are both emptied.

Parameters:

context - The context whose stacks should be cleared.

Returns: SUCCESS if both stacks emptied, FAIL otherwise.

pushValue

result_t pushValue(BombillaContext *context, int16_t val)

Push a 16-bit signed value onto a context's operand stack.

Parameters:

context - The context to modify

val - The value to push

Returns: SUCCESS if the value was placed on the stack, FAIL otherwise (e.g. stack overflow).

pushReading

result_t pushReading(BombillaContext *context, uint8_t type, int16_t val)

Push a 16-bit signed sensor reading onto a context's operand stack.

Parameters:

context - The context to modify

type - The sensor reading type (one of BOMB_DATA_*)

val - The value to push

Returns: SUCCESS if the value was placed on the stack, FAIL otherwise (e.g. stack overflow).

pushBuffer

result_t pushBuffer(BombillaContext *context, BombillaDataBuffer *buf)

Push a Bombilla data buffer onto a context's operand stack.

Parameters:

context - The context to modify

buf - The buffer to push

Returns: SUCCESS if the value was placed on the stack, FAIL otherwise (e.g. stack overflow).

pushOperand

result_t pushOperand(BombillaContext *context, BombillaStackVariable *var)

Push a generic operand onto a context's operand stack. This is useful when the type of the operand is irrelevant or unknown (e.g. pushing a variable that was popped).

Parameters:

context - The context to modify

var - The variable to push.

Returns: SUCCESS if the value was placed on the stack, FAIL otherwise (e.g. stack overflow).

popOperand

BombillaStackVariable popOperand(BombillaContext *context)

Pop an operand off of a context's operand stack. If the stack is empty, a variable of type BOMB_TYPE_INVALID is returned.

Parameters:

context - The context to pop from.

Returns: The variable popped. If the operand stack is empty when called, a variable of type BOMB_TYPE_INVALID is returned.

pushReturnAddr

result_t pushReturnAddr(BombillaContext *context)

Push a return address onto the context's return stack. The return address is the current PC and capsule of the context.
Returns: SUCCESS indicates the address was pushed, FAIL indicates it was not (e.g. return stack overflow).

popReturnAddr

result_t popReturnAddr(BombillaContext *context)

Pop a return address from the context's return stack and restore the context's execution state accordingly (can change the PC and current capsule).
Returns: SUCCESS indicates the address was restored, FAIL indicates it was not (e.g. return stack underflow, invalid address).

getOpStackDepth

uint8_t getOpStackDepth(BombillaContext *context)

Gets the depth of the operand stack of a context.
Returns: The depth.

getReturnStackDepth

uint8_t getReturnStackDepth(BombillaContext *context)

Gets the depth of the return address stack of a context.
Returns: The depth.