python-on-a-chip online compiler
list.c File Reference
List Object Type. More...
Go to the source code of this file.
Functions | |
PmReturn_t | list_append (pPmObj_t plist, pPmObj_t pobj) |
Appends the given obj to the end of the given list. | |
PmReturn_t | list_getItem (pPmObj_t plist, int16_t index, pPmObj_t *r_pobj) |
Gets the object in the list at the index. | |
PmReturn_t | list_insert (pPmObj_t plist, int16_t index, pPmObj_t pobj) |
Inserts the object into the list at the desired index. | |
PmReturn_t | list_new (pPmObj_t *r_pobj) |
Allocates a new List object. | |
PmReturn_t | list_copy (pPmObj_t pobj, pPmObj_t *r_pobj) |
Makes a copy of the given list. | |
PmReturn_t | list_replicate (pPmObj_t psrclist, int16_t n, pPmObj_t *r_pnewlist) |
Creates a new list with the contents of psrclist copied pint number of times. | |
PmReturn_t | list_setItem (pPmObj_t plist, int16_t index, pPmObj_t pobj) |
Sets the item in the list at the index. | |
PmReturn_t | list_remove (pPmObj_t plist, pPmObj_t item) |
Removes a given object from the list. | |
PmReturn_t | list_index (pPmObj_t plist, pPmObj_t pitem, uint16_t *r_index) |
Finds the first index of the item that matches pitem. | |
PmReturn_t | list_delItem (pPmObj_t plist, int16_t index) |
Removes the item at the given index. | |
PmReturn_t | list_print (pPmObj_t plist) |
Prints out a list. | |
PmReturn_t | list_clear (pPmObj_t plist) |
Removes all items from the list and zeroes the length. |
Detailed Description
List Object Type.
List object type operations.
Definition in file list.c.
Function Documentation
PmReturn_t list_append | ( | pPmObj_t | plist, |
pPmObj_t | pobj | ||
) |
PmReturn_t list_clear | ( | pPmObj_t | plist ) |
PmReturn_t list_copy | ( | pPmObj_t | pobj, |
pPmObj_t * | r_pobj | ||
) |
PmReturn_t list_delItem | ( | pPmObj_t | plist, |
int16_t | index | ||
) |
PmReturn_t list_getItem | ( | pPmObj_t | plist, |
int16_t | index, | ||
pPmObj_t * | r_pobj | ||
) |
PmReturn_t list_index | ( | pPmObj_t | plist, |
pPmObj_t | pitem, | ||
uint16_t * | r_index | ||
) |
PmReturn_t list_insert | ( | pPmObj_t | plist, |
int16_t | index, | ||
pPmObj_t | pobj | ||
) |
PmReturn_t list_new | ( | pPmObj_t * | r_pobj ) |
Allocates a new List object.
If there is not enough memory to allocate the List, the return status will indicate an OutOfMemoryError that must be passed up to the interpreter. Otherwise, a ptr to the list is returned by reference and the return status is OK.
- Parameters:
-
r_pobj Return; addr of ptr to obj
- Returns:
- Return status
PmReturn_t list_print | ( | pPmObj_t | pobj ) |
Prints out a list.
Uses obj_print() to print elements.
- Parameters:
-
pobj Object to print.
- Returns:
- Return status
PmReturn_t list_remove | ( | pPmObj_t | plist, |
pPmObj_t | item | ||
) |
PmReturn_t list_replicate | ( | pPmObj_t | psrclist, |
int16_t | n, | ||
pPmObj_t * | r_pnewlist | ||
) |
Creates a new list with the contents of psrclist copied pint number of times.
This implements the python code "[0,...] * N" where the list can be any list and N is an integer.
- Parameters:
-
psrclist The source list to replicate n The integer number of times to replicate it r_pnewlist Return; new list with its contents set.
- Returns:
- Return status
PmReturn_t list_setItem | ( | pPmObj_t | plist, |
int16_t | index, | ||
pPmObj_t | pobj | ||
) |
Generated on Tue Jul 12 2022 23:13:47 by 1.7.2