python-on-a-chip online compiler

Dependencies:   mbed TSI

Embed: (wiki syntax)

« Back to documentation index

interp.h File Reference

interp.h File Reference

VM Interpreter. More...

Go to the source code of this file.

Typedefs

typedef enum PmCompare_e PmCompare_t
 COMPARE_OP enum.
typedef enum PmBcode_e PmBcode_t
 Byte code enumeration.

Enumerations

enum  PmCompare_e {
  COMP_LT = 0, COMP_LE, COMP_EQ, COMP_NE,
  COMP_GT, COMP_GE, COMP_IN, COMP_NOT_IN,
  COMP_IS, COMP_IS_NOT, COMP_EXN_MATCH
}
 

COMPARE_OP enum.

More...
enum  PmBcode_e
 

Byte code enumeration.

More...

Functions

PmReturn_t interpret (const uint8_t returnOnNoThreads)
 Interprets the available threads.
PmReturn_t interp_reschedule (void)
 Selects a thread to run and changes the VM internal variables to let the switch-loop execute the chosen one in the next iteration.
PmReturn_t interp_addThread (pPmFunc_t pfunc)
 Creates a thread object and adds it to the queue of threads to be executed while interpret() is running.
void interp_setRescheduleFlag (uint8_t boolean)
 Sets the reschedule flag.

Detailed Description

VM Interpreter.

VM interpreter header.

Definition in file interp.h.


Typedef Documentation

typedef enum PmBcode_e PmBcode_t

Byte code enumeration.

typedef enum PmCompare_e PmCompare_t

COMPARE_OP enum.

Used by the COMPARE_OP bytecode to determine which type of compare to perform. Must match those defined in Python.


Enumeration Type Documentation

enum PmBcode_e

Byte code enumeration.

Definition at line 87 of file interp.h.

COMPARE_OP enum.

Used by the COMPARE_OP bytecode to determine which type of compare to perform. Must match those defined in Python.

Enumerator:
COMP_LT 

less than

COMP_LE 

less than or equal

COMP_EQ 

equal

COMP_NE 

not equal

COMP_GT 

greater than

COMP_GE 

greater than or equal

COMP_IN 

is in

COMP_NOT_IN 

is not in

COMP_IS 

is

COMP_IS_NOT 

is not

COMP_EXN_MATCH 

do exceptions match

Definition at line 69 of file interp.h.


Function Documentation

PmReturn_t interp_addThread ( pPmFunc_t  pfunc )

Creates a thread object and adds it to the queue of threads to be executed while interpret() is running.

The given obj may be a function, module, or class. Creates a frame for the given function.

Parameters:
pfuncPtr to function to be executed as a thread.
Returns:
Return status

Definition at line 2314 of file interp.c.

PmReturn_t interp_reschedule ( void   )

Selects a thread to run and changes the VM internal variables to let the switch-loop execute the chosen one in the next iteration.

For the moment the algorithm is primitive and will change the thread each time it is called in a round-robin fashion.

Definition at line 2282 of file interp.c.

void interp_setRescheduleFlag ( uint8_t  boolean )

Sets the reschedule flag.

Parameters:
booleanReschedule on next occasion if boolean is true; clear the flag otherwise.

Definition at line 2343 of file interp.c.

PmReturn_t interpret ( const uint8_t  returnOnNoThreads )

Interprets the available threads.

Does not return.

Parameters:
returnOnNoThreadsLoop forever if 0, exit with status if no more threads left.
Returns:
Return status if called with returnOnNoThreads != 0, will not return otherwise.

Definition at line 25 of file interp.c.