Numworks Epsilon  1.4.1
Graphing Calculator Operating System
objgenerator.c File Reference
#include <stdlib.h>
#include <assert.h>
#include "py/runtime.h"
#include "py/bc.h"
#include "py/objgenerator.h"
#include "py/objfun.h"

Go to the source code of this file.

Classes

struct  _mp_obj_gen_wrap_t
 
struct  _mp_obj_gen_instance_t
 

Typedefs

typedef struct _mp_obj_gen_wrap_t mp_obj_gen_wrap_t
 
typedef struct _mp_obj_gen_instance_t mp_obj_gen_instance_t
 

Functions

STATIC mp_obj_t gen_wrap_call (mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args)
 
mp_obj_t mp_obj_new_gen_wrap (mp_obj_t fun)
 
STATIC void gen_instance_print (const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind)
 
mp_vm_return_kind_t mp_obj_gen_resume (mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, mp_obj_t *ret_val)
 
STATIC mp_obj_t gen_resume_and_raise (mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value)
 
STATIC mp_obj_t gen_instance_iternext (mp_obj_t self_in)
 
STATIC mp_obj_t gen_instance_send (mp_obj_t self_in, mp_obj_t send_value)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (gen_instance_send_obj, gen_instance_send)
 
STATIC mp_obj_t gen_instance_close (mp_obj_t self_in)
 
STATIC mp_obj_t gen_instance_throw (size_t n_args, const mp_obj_t *args)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (gen_instance_throw_obj, 2, 4, gen_instance_throw)
 
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (gen_instance_close_obj, gen_instance_close)
 
STATIC MP_DEFINE_CONST_DICT (gen_instance_locals_dict, gen_instance_locals_dict_table)
 

Variables

const mp_obj_type_t mp_type_gen_wrap
 
STATIC const mp_rom_map_elem_t gen_instance_locals_dict_table []
 
const mp_obj_type_t mp_type_gen_instance
 

Typedef Documentation

◆ mp_obj_gen_instance_t

◆ mp_obj_gen_wrap_t

Function Documentation

◆ gen_instance_close()

STATIC mp_obj_t gen_instance_close ( mp_obj_t  self_in)

Definition at line 202 of file objgenerator.c.

◆ gen_instance_iternext()

STATIC mp_obj_t gen_instance_iternext ( mp_obj_t  self_in)

Definition at line 173 of file objgenerator.c.

◆ gen_instance_print()

STATIC void gen_instance_print ( const mp_print_t print,
mp_obj_t  self_in,
mp_print_kind_t  kind 
)

Definition at line 88 of file objgenerator.c.

◆ gen_instance_send()

STATIC mp_obj_t gen_instance_send ( mp_obj_t  self_in,
mp_obj_t  send_value 
)

Definition at line 177 of file objgenerator.c.

◆ gen_instance_throw()

STATIC mp_obj_t gen_instance_throw ( size_t  n_args,
const mp_obj_t args 
)

Definition at line 189 of file objgenerator.c.

◆ gen_resume_and_raise()

STATIC mp_obj_t gen_resume_and_raise ( mp_obj_t  self_in,
mp_obj_t  send_value,
mp_obj_t  throw_value 
)

Definition at line 144 of file objgenerator.c.

◆ gen_wrap_call()

STATIC mp_obj_t gen_wrap_call ( mp_obj_t  self_in,
size_t  n_args,
size_t  n_kw,
const mp_obj_t args 
)

Definition at line 50 of file objgenerator.c.

◆ MP_DEFINE_CONST_DICT()

STATIC MP_DEFINE_CONST_DICT ( gen_instance_locals_dict  ,
gen_instance_locals_dict_table   
)

◆ MP_DEFINE_CONST_FUN_OBJ_1()

STATIC MP_DEFINE_CONST_FUN_OBJ_1 ( gen_instance_close_obj  ,
gen_instance_close   
)

◆ MP_DEFINE_CONST_FUN_OBJ_2()

STATIC MP_DEFINE_CONST_FUN_OBJ_2 ( gen_instance_send_obj  ,
gen_instance_send   
)

◆ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN()

STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN ( gen_instance_throw_obj  ,
,
,
gen_instance_throw   
)

◆ mp_obj_gen_resume()

mp_vm_return_kind_t mp_obj_gen_resume ( mp_obj_t  self_in,
mp_obj_t  send_value,
mp_obj_t  throw_value,
mp_obj_t ret_val 
)

Definition at line 94 of file objgenerator.c.

◆ mp_obj_new_gen_wrap()

mp_obj_t mp_obj_new_gen_wrap ( mp_obj_t  fun)

Definition at line 78 of file objgenerator.c.

Variable Documentation

◆ gen_instance_locals_dict_table

STATIC const mp_rom_map_elem_t gen_instance_locals_dict_table[]
Initial value:
= {
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&gen_instance_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&gen_instance_send_obj) },
{ MP_ROM_QSTR(MP_QSTR_throw), MP_ROM_PTR(&gen_instance_throw_obj) },
}
#define MP_ROM_QSTR(q)
Definition: obj.h:241
#define MP_ROM_PTR(p)
Definition: obj.h:242

Definition at line 225 of file objgenerator.c.

◆ mp_type_gen_instance

const mp_obj_type_t mp_type_gen_instance
Initial value:
= {
.name = MP_QSTR_generator,
.unary_op = mp_generic_unary_op,
.getiter = mp_identity_getiter,
.iternext = gen_instance_iternext,
.locals_dict = (mp_obj_dict_t*)&gen_instance_locals_dict,
}
mp_obj_t mp_generic_unary_op(mp_unary_op_t op, mp_obj_t o_in)
Definition: obj.c:530
STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in)
Definition: objgenerator.c:173
STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind)
Definition: objgenerator.c:88
const mp_obj_type_t mp_type_type
Definition: objtype.c:969
mp_obj_t mp_identity_getiter(mp_obj_t self, mp_obj_iter_buf_t *iter_buf)
Definition: obj.c:507
qstr name
Definition: obj.h:478

Definition at line 233 of file objgenerator.c.

◆ mp_type_gen_wrap

const mp_obj_type_t mp_type_gen_wrap
Initial value:
= {
.name = MP_QSTR_generator,
.call = gen_wrap_call,
.unary_op = mp_generic_unary_op,
}
mp_obj_t mp_generic_unary_op(mp_unary_op_t op, mp_obj_t o_in)
Definition: obj.c:530
STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args)
Definition: objgenerator.c:50
const mp_obj_type_t mp_type_type
Definition: objtype.c:969
qstr name
Definition: obj.h:478

Definition at line 71 of file objgenerator.c.