summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-07 15:58:30 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-07 15:58:30 +0000
commit97209d38e17a0f3cb2a2d3f03d726fd322b4808f (patch)
tree514cc35179713b4128ec6218829d769d87d7fe70 /unix/main.c
parentd49420e74c721bb6c61925a6c9a2addbaeed3382 (diff)
parenta5a01df81d01705b9f04264cc46fbb1bc32641b3 (diff)
downloadmicropython-97209d38e17a0f3cb2a2d3f03d726fd322b4808f.tar.gz
micropython-97209d38e17a0f3cb2a2d3f03d726fd322b4808f.zip
Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ian-v-cplusplus
Conflicts: py/objcomplex.c
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/unix/main.c b/unix/main.c
index f7277b960c..920aed3444 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -154,7 +154,7 @@ static void do_str(const char *str) {
typedef struct _test_obj_t {
mp_obj_base_t base;
- bool value;
+ int value;
} test_obj_t;
static void test_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) {
@@ -176,15 +176,17 @@ static mp_obj_t test_set(mp_obj_t self_in, mp_obj_t arg) {
static MP_DEFINE_CONST_FUN_OBJ_1(test_get_obj, test_get);
static MP_DEFINE_CONST_FUN_OBJ_2(test_set_obj, test_set);
+static const mp_method_t test_methods[] = {
+ { "get", &test_get_obj },
+ { "set", &test_set_obj },
+ { NULL, NULL },
+};
+
static const mp_obj_type_t test_type = {
{ &mp_const_type },
"Test",
.print = test_print,
- .methods = {
- { "get", &test_get_obj },
- { "set", &test_set_obj },
- { NULL, NULL },
- }
+ .methods = test_methods,
};
mp_obj_t test_obj_new(int value) {