blob: 877e61fe5cc9818578a84167a8bc52f4b872d115 [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",
Paul Sokolovsky860ffb02014-01-05 22:34:09 +020020 .print = none_print,
21 .methods = {{NULL, NULL},},
Damiend99b0522013-12-21 18:17:45 +000022};
23
24static const mp_obj_none_t none_obj = {{&none_type}};
25const mp_obj_t mp_const_none = (mp_obj_t)&none_obj;
26
27// the stop-iteration object just needs to be something unique
28// it's not the StopIteration exception
29static const mp_obj_none_t stop_it_obj = {{&none_type}};
30const mp_obj_t mp_const_stop_iteration = (mp_obj_t)&stop_it_obj;