2013-12-21 13:17:45 -05:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "nlr.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "mpconfig.h"
|
2014-01-21 16:40:13 -05:00
|
|
|
#include "qstr.h"
|
2013-12-21 13:17:45 -05:00
|
|
|
#include "obj.h"
|
2014-01-27 18:15:32 -05:00
|
|
|
#include "runtime0.h"
|
2013-12-21 13:17:45 -05:00
|
|
|
|
|
|
|
typedef struct _mp_obj_none_t {
|
|
|
|
mp_obj_base_t base;
|
|
|
|
} mp_obj_none_t;
|
|
|
|
|
2014-02-12 11:15:40 -05:00
|
|
|
STATIC void none_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
|
2013-12-21 13:17:45 -05:00
|
|
|
print(env, "None");
|
|
|
|
}
|
|
|
|
|
2014-02-12 11:15:40 -05:00
|
|
|
STATIC mp_obj_t none_unary_op(int op, mp_obj_t o_in) {
|
2014-01-27 18:15:32 -05:00
|
|
|
switch (op) {
|
2014-03-30 08:35:08 -04:00
|
|
|
case MP_UNARY_OP_BOOL: return mp_const_false;
|
2014-04-17 18:19:36 -04:00
|
|
|
default: return MP_OBJ_NOT_SUPPORTED;
|
2014-01-27 18:15:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-29 09:15:08 -04:00
|
|
|
const mp_obj_type_t mp_type_NoneType = {
|
2014-02-15 11:10:44 -05:00
|
|
|
{ &mp_type_type },
|
2014-02-15 06:34:50 -05:00
|
|
|
.name = MP_QSTR_NoneType,
|
2014-01-05 15:34:09 -05:00
|
|
|
.print = none_print,
|
2014-01-27 18:15:32 -05:00
|
|
|
.unary_op = none_unary_op,
|
2013-12-21 13:17:45 -05:00
|
|
|
};
|
|
|
|
|
2014-03-29 09:15:08 -04:00
|
|
|
const mp_obj_none_t mp_const_none_obj = {{&mp_type_NoneType}};
|