blob: f7b665e9974ddaeaa4f80a6c70cee3f95dd9b8f3 [file] [log] [blame]
Damiend99b0522013-12-21 18:17:45 +00001#include <stdlib.h>
2#include <stdint.h>
3
4#include "nlr.h"
5#include "misc.h"
6#include "mpconfig.h"
7#include "obj.h"
8
9typedef struct _mp_obj_none_t {
10 mp_obj_base_t base;
11} mp_obj_none_t;
12
13void none_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) {
14 print(env, "None");
15}
16
17const mp_obj_type_t none_type = {
18 { &mp_const_type },
19 "NoneType",
20 none_print, // print
21 NULL, // call_n
22 NULL, // unary_op
23 NULL, // binary_op
24 NULL, // getiter
25 NULL, // iternext
26 {{NULL, NULL},}, // method list
27};
28
29static const mp_obj_none_t none_obj = {{&none_type}};
30const mp_obj_t mp_const_none = (mp_obj_t)&none_obj;
31
32// the stop-iteration object just needs to be something unique
33// it's not the StopIteration exception
34static const mp_obj_none_t stop_it_obj = {{&none_type}};
35const mp_obj_t mp_const_stop_iteration = (mp_obj_t)&stop_it_obj;