python-on-a-chip online compiler

Dependencies:   mbed TSI

Embed: (wiki syntax)

« Back to documentation index

tuple.c File Reference

tuple.c File Reference

Tuple Object Type. More...

Go to the source code of this file.

Functions

PmReturn_t tuple_loadFromImg (PmMemSpace_t memspace, uint8_t const **paddr, pPmObj_t *r_ptuple)
 Creates a Tuple by loading a tuple image from memory.
PmReturn_t tuple_new (uint16_t n, pPmObj_t *r_ptuple)
 Allocates space for a new Tuple.
PmReturn_t tuple_replicate (pPmObj_t ptup, int16_t n, pPmObj_t *r_ptuple)
 Replicates a tuple, n number of times to create a new tuple.
PmReturn_t tuple_getItem (pPmObj_t ptup, int16_t index, pPmObj_t *r_pobj)
 Gets the object in the tuple at the index.
PmReturn_t tuple_print (pPmObj_t ptup)
 Prints out a tuple.

Detailed Description

Tuple Object Type.

Tuple object type operations.

Definition in file tuple.c.


Function Documentation

PmReturn_t tuple_getItem ( pPmObj_t  ptup,
int16_t  index,
pPmObj_t r_pobj 
)

Gets the object in the tuple at the index.

Parameters:
ptupPtr to tuple obj
indexIndex into tuple
r_pobjReturn by reference; ptr to item
Returns:
Return status

Definition at line 140 of file tuple.c.

PmReturn_t tuple_loadFromImg ( PmMemSpace_t  memspace,
uint8_t const **  paddr,
pPmObj_t r_ptuple 
)

Creates a Tuple by loading a tuple image from memory.

Obtain space for tuple from the heap. Load all objs within the tuple img. Leave contents of paddr pointing one byte past end of last obj in tuple.

The tuple image has the following structure: -type: S8 - OBJ_TYPE_TUPLE -length U8 - N number of objects in the tuple. N objects follow in the stream.

Parameters:
memspaceMemory space.
paddrPtr to ptr to tuple in memspace
r_ptupleReturn by reference; new filled tuple
Returns:
Return status

Definition at line 29 of file tuple.c.

PmReturn_t tuple_new ( uint16_t  n,
pPmObj_t r_ptuple 
)

Allocates space for a new Tuple.

Returns a pointer to the tuple.

Parameters:
nthe number of elements the tuple will contain
r_ptupleReturn by ref, ptr to new tuple
Returns:
Return status

Definition at line 66 of file tuple.c.

PmReturn_t tuple_print ( pPmObj_t  pobj )

Prints out a tuple.

Uses obj_print() to print elements.

Parameters:
pobjObject to print.
Returns:
Return status

Definition at line 165 of file tuple.c.

PmReturn_t tuple_replicate ( pPmObj_t  ptup,
int16_t  n,
pPmObj_t r_ptuple 
)

Replicates a tuple, n number of times to create a new tuple.

Copies the pointers (not the objects).

Parameters:
ptupPtr to source tuple.
nNumber of times to replicate the tuple.
r_ptupleReturn arg; Ptr to new tuple.
Returns:
Return status

Definition at line 105 of file tuple.c.