Numworks Epsilon  1.4.1
Graphing Calculator Operating System
objlist.c File Reference
#include <string.h>
#include <assert.h>
#include "py/objlist.h"
#include "py/runtime.h"
#include "py/stackctrl.h"

Go to the source code of this file.

Classes

struct  _mp_obj_list_it_t
 

Macros

#define LIST_MIN_ALLOC   4
 

Typedefs

typedef struct _mp_obj_list_it_t mp_obj_list_it_t
 

Functions

STATIC mp_obj_t mp_obj_new_list_iterator (mp_obj_t list, size_t cur, mp_obj_iter_buf_t *iter_buf)
 
STATIC mp_obj_list_tlist_new (size_t n)
 
STATIC mp_obj_t list_extend (mp_obj_t self_in, mp_obj_t arg_in)
 
STATIC mp_obj_t list_pop (size_t n_args, const mp_obj_t *args)
 
STATIC void list_print (const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind)
 
STATIC mp_obj_t list_extend_from_iter (mp_obj_t list, mp_obj_t iterable)
 
STATIC mp_obj_t list_make_new (const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args)
 
STATIC mp_obj_t list_unary_op (mp_unary_op_t op, mp_obj_t self_in)
 
STATIC mp_obj_t list_binary_op (mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs)
 
STATIC mp_obj_t list_subscr (mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
 
STATIC mp_obj_t list_getiter (mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf)
 
mp_obj_t mp_obj_list_append (mp_obj_t self_in, mp_obj_t arg)
 
STATIC void mp_quicksort (mp_obj_t *head, mp_obj_t *tail, mp_obj_t key_fn, mp_obj_t binop_less_result)
 
mp_obj_t mp_obj_list_sort (size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
 
STATIC mp_obj_t list_clear (mp_obj_t self_in)
 
STATIC mp_obj_t list_copy (mp_obj_t self_in)
 
STATIC mp_obj_t list_count (mp_obj_t self_in, mp_obj_t value)
 
STATIC mp_obj_t list_index (size_t n_args, const mp_obj_t *args)
 
STATIC mp_obj_t list_insert (mp_obj_t self_in, mp_obj_t idx, mp_obj_t obj)
 
mp_obj_t mp_obj_list_remove (mp_obj_t self_in, mp_obj_t value)
 
STATIC mp_obj_t list_reverse (mp_obj_t self_in)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (list_append_obj, mp_obj_list_append)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (list_extend_obj, list_extend)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (list_clear_obj, list_clear)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (list_copy_obj, list_copy)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (list_count_obj, list_count)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (list_index_obj, 2, 4, list_index)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_3 (list_insert_obj, list_insert)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (list_pop_obj, 1, 2, list_pop)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (list_remove_obj, mp_obj_list_remove)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (list_reverse_obj, list_reverse)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_KW (list_sort_obj, 1, mp_obj_list_sort)
 
STATIC MP_DEFINE_CONST_DICT (list_locals_dict, list_locals_dict_table)
 
void mp_obj_list_init (mp_obj_list_t *o, size_t n)
 
mp_obj_t mp_obj_new_list (size_t n, mp_obj_t *items)
 
void mp_obj_list_get (mp_obj_t self_in, size_t *len, mp_obj_t **items)
 
void mp_obj_list_set_len (mp_obj_t self_in, size_t len)
 
void mp_obj_list_store (mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
 
STATIC mp_obj_t list_it_iternext (mp_obj_t self_in)
 

Variables

STATIC const mp_rom_map_elem_t list_locals_dict_table []
 
const mp_obj_type_t mp_type_list
 

Macro Definition Documentation

◆ LIST_MIN_ALLOC

#define LIST_MIN_ALLOC   4

Definition at line 40 of file objlist.c.

Typedef Documentation

◆ mp_obj_list_it_t

Function Documentation

◆ list_binary_op()

STATIC mp_obj_t list_binary_op ( mp_binary_op_t  op,
mp_obj_t  lhs,
mp_obj_t  rhs 
)

Definition at line 103 of file objlist.c.

◆ list_clear()

STATIC mp_obj_t list_clear ( mp_obj_t  self_in)

Definition at line 340 of file objlist.c.

◆ list_copy()

STATIC mp_obj_t list_copy ( mp_obj_t  self_in)

Definition at line 350 of file objlist.c.

◆ list_count()

STATIC mp_obj_t list_count ( mp_obj_t  self_in,
mp_obj_t  value 
)

Definition at line 356 of file objlist.c.

◆ list_extend()

STATIC mp_obj_t list_extend ( mp_obj_t  self_in,
mp_obj_t  arg_in 
)

Definition at line 246 of file objlist.c.

◆ list_extend_from_iter()

STATIC mp_obj_t list_extend_from_iter ( mp_obj_t  list,
mp_obj_t  iterable 
)

Definition at line 60 of file objlist.c.

◆ list_getiter()

STATIC mp_obj_t list_getiter ( mp_obj_t  o_in,
mp_obj_iter_buf_t iter_buf 
)

Definition at line 230 of file objlist.c.

◆ list_index()

STATIC mp_obj_t list_index ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 362 of file objlist.c.

◆ list_insert()

STATIC mp_obj_t list_insert ( mp_obj_t  self_in,
mp_obj_t  idx,
mp_obj_t  obj 
)

Definition at line 368 of file objlist.c.

◆ list_it_iternext()

STATIC mp_obj_t list_it_iternext ( mp_obj_t  self_in)

Definition at line 509 of file objlist.c.

◆ list_make_new()

STATIC mp_obj_t list_make_new ( const mp_obj_type_t type_in,
size_t  n_args,
size_t  n_kw,
const mp_obj_t args 
)

Definition at line 69 of file objlist.c.

◆ list_new()

STATIC mp_obj_list_t * list_new ( size_t  n)

Definition at line 464 of file objlist.c.

◆ list_pop()

STATIC mp_obj_t list_pop ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 267 of file objlist.c.

◆ list_print()

STATIC void list_print ( const mp_print_t print,
mp_obj_t  o_in,
mp_print_kind_t  kind 
)

Definition at line 45 of file objlist.c.

◆ list_reverse()

STATIC mp_obj_t list_reverse ( mp_obj_t  self_in)

Definition at line 402 of file objlist.c.

◆ list_subscr()

STATIC mp_obj_t list_subscr ( mp_obj_t  self_in,
mp_obj_t  index,
mp_obj_t  value 
)

Definition at line 153 of file objlist.c.

◆ list_unary_op()

STATIC mp_obj_t list_unary_op ( mp_unary_op_t  op,
mp_obj_t  self_in 
)

Definition at line 88 of file objlist.c.

◆ MP_DEFINE_CONST_DICT()

STATIC MP_DEFINE_CONST_DICT ( list_locals_dict  ,
list_locals_dict_table   
)

◆ MP_DEFINE_CONST_FUN_OBJ_1() [1/3]

STATIC MP_DEFINE_CONST_FUN_OBJ_1 ( list_clear_obj  ,
list_clear   
)

◆ MP_DEFINE_CONST_FUN_OBJ_1() [2/3]

STATIC MP_DEFINE_CONST_FUN_OBJ_1 ( list_copy_obj  ,
list_copy   
)

◆ MP_DEFINE_CONST_FUN_OBJ_1() [3/3]

STATIC MP_DEFINE_CONST_FUN_OBJ_1 ( list_reverse_obj  ,
list_reverse   
)

◆ MP_DEFINE_CONST_FUN_OBJ_2() [1/4]

STATIC MP_DEFINE_CONST_FUN_OBJ_2 ( list_append_obj  ,
mp_obj_list_append   
)

◆ MP_DEFINE_CONST_FUN_OBJ_2() [2/4]

STATIC MP_DEFINE_CONST_FUN_OBJ_2 ( list_extend_obj  ,
list_extend   
)

◆ MP_DEFINE_CONST_FUN_OBJ_2() [3/4]

STATIC MP_DEFINE_CONST_FUN_OBJ_2 ( list_count_obj  ,
list_count   
)

◆ MP_DEFINE_CONST_FUN_OBJ_2() [4/4]

STATIC MP_DEFINE_CONST_FUN_OBJ_2 ( list_remove_obj  ,
mp_obj_list_remove   
)

◆ MP_DEFINE_CONST_FUN_OBJ_3()

STATIC MP_DEFINE_CONST_FUN_OBJ_3 ( list_insert_obj  ,
list_insert   
)

◆ MP_DEFINE_CONST_FUN_OBJ_KW()

STATIC MP_DEFINE_CONST_FUN_OBJ_KW ( list_sort_obj  ,
,
mp_obj_list_sort   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [1/2]

STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( list_index_obj  ,
,
,
list_index   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN() [2/2]

STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( list_pop_obj  ,
,
,
list_pop   
)

◆ mp_obj_list_append()

mp_obj_t mp_obj_list_append ( mp_obj_t  self_in,
mp_obj_t  arg 
)

Definition at line 234 of file objlist.c.

◆ mp_obj_list_get()

void mp_obj_list_get ( mp_obj_t  self_in,
size_t len,
mp_obj_t **  items 
)

Definition at line 480 of file objlist.c.

◆ mp_obj_list_init()

void mp_obj_list_init ( mp_obj_list_t o,
size_t  n 
)

Definition at line 456 of file objlist.c.

◆ mp_obj_list_remove()

mp_obj_t mp_obj_list_remove ( mp_obj_t  self_in,
mp_obj_t  value 
)

Definition at line 393 of file objlist.c.

◆ mp_obj_list_set_len()

void mp_obj_list_set_len ( mp_obj_t  self_in,
size_t  len 
)

Definition at line 486 of file objlist.c.

◆ mp_obj_list_sort()

mp_obj_t mp_obj_list_sort ( size_t  n_args,
const mp_obj_t pos_args,
mp_map_t kw_args 
)

Definition at line 315 of file objlist.c.

◆ mp_obj_list_store()

void mp_obj_list_store ( mp_obj_t  self_in,
mp_obj_t  index,
mp_obj_t  value 
)

Definition at line 493 of file objlist.c.

◆ mp_obj_new_list()

mp_obj_t mp_obj_new_list ( size_t  n,
mp_obj_t items 
)

Definition at line 470 of file objlist.c.

◆ mp_obj_new_list_iterator()

mp_obj_t mp_obj_new_list_iterator ( mp_obj_t  list,
size_t  cur,
mp_obj_iter_buf_t iter_buf 
)

Definition at line 521 of file objlist.c.

◆ mp_quicksort()

STATIC void mp_quicksort ( mp_obj_t head,
mp_obj_t tail,
mp_obj_t  key_fn,
mp_obj_t  binop_less_result 
)

Definition at line 286 of file objlist.c.

Variable Documentation

◆ list_locals_dict_table

STATIC const mp_rom_map_elem_t list_locals_dict_table[]
Initial value:
= {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&list_append_obj) },
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&list_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_copy), MP_ROM_PTR(&list_copy_obj) },
{ MP_ROM_QSTR(MP_QSTR_count), MP_ROM_PTR(&list_count_obj) },
{ MP_ROM_QSTR(MP_QSTR_extend), MP_ROM_PTR(&list_extend_obj) },
{ MP_ROM_QSTR(MP_QSTR_index), MP_ROM_PTR(&list_index_obj) },
{ MP_ROM_QSTR(MP_QSTR_insert), MP_ROM_PTR(&list_insert_obj) },
{ MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&list_pop_obj) },
{ MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&list_remove_obj) },
{ MP_ROM_QSTR(MP_QSTR_reverse), MP_ROM_PTR(&list_reverse_obj) },
{ MP_ROM_QSTR(MP_QSTR_sort), MP_ROM_PTR(&list_sort_obj) },
}
#define MP_ROM_QSTR(q)
Definition: obj.h:241
#define MP_ROM_PTR(p)
Definition: obj.h:242

Definition at line 428 of file objlist.c.

◆ mp_type_list

const mp_obj_type_t mp_type_list
Initial value:
= {
.name = MP_QSTR_list,
.print = list_print,
.make_new = list_make_new,
.unary_op = list_unary_op,
.binary_op = list_binary_op,
.subscr = list_subscr,
.getiter = list_getiter,
.locals_dict = (mp_obj_dict_t*)&list_locals_dict,
}
STATIC mp_obj_t list_unary_op(mp_unary_op_t op, mp_obj_t self_in)
Definition: objlist.c:88
STATIC void list_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind)
Definition: objlist.c:45
STATIC mp_obj_t list_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf)
Definition: objlist.c:230
const mp_obj_type_t mp_type_type
Definition: objtype.c:969
STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
Definition: objlist.c:153
STATIC mp_obj_t list_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args)
Definition: objlist.c:69
qstr name
Definition: obj.h:478
STATIC mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs)
Definition: objlist.c:103

Definition at line 444 of file objlist.c.