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