From 4f90848c0ac079f705f86e8d1e13195eaf41bbcd Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 28 Apr 2016 15:40:16 +0200 Subject: [PATCH] remove native moduleprotobuf --- extmod/modtrezorprotobuf/modtrezorprotobuf.c | 75 -------------------- extmod/modtrezorutils/modtrezorutils.c | 2 +- src/trezor/protobuf.py | 9 --- vendor/micropython | 2 +- 4 files changed, 2 insertions(+), 86 deletions(-) delete mode 100644 extmod/modtrezorprotobuf/modtrezorprotobuf.c delete mode 100644 src/trezor/protobuf.py diff --git a/extmod/modtrezorprotobuf/modtrezorprotobuf.c b/extmod/modtrezorprotobuf/modtrezorprotobuf.c deleted file mode 100644 index 69ba62e2a3..0000000000 --- a/extmod/modtrezorprotobuf/modtrezorprotobuf.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Pavol Rusnak, SatoshiLabs - * - * Licensed under Microsoft Reference Source License (Ms-RSL) - * see LICENSE.md file for details - */ - -#include -#include -#include - -#include "py/nlr.h" -#include "py/runtime.h" -#include "py/binary.h" - -#if MICROPY_PY_TREZORPROTOBUF - -// class Protobuf(object): -typedef struct _mp_obj_Protobuf_t { - mp_obj_base_t base; -} mp_obj_Protobuf_t; - -// def Protobuf.__init__(self) -STATIC mp_obj_t mod_TrezorProtobuf_Protobuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_arg_check_num(n_args, n_kw, 0, 0, false); - mp_obj_Protobuf_t *o = m_new_obj(mp_obj_Protobuf_t); - o->base.type = type; - return MP_OBJ_FROM_PTR(o); -} - -// def Protobuf.encode(self, message) -> bytes -STATIC mp_obj_t mod_TrezorProtobuf_Protobuf_encode(mp_obj_t self, mp_obj_t callback) { - // TODO - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorProtobuf_Protobuf_encode_obj, mod_TrezorProtobuf_Protobuf_encode); - -// def Protobuf.decode(self, data: bytes) -> object -STATIC mp_obj_t mod_TrezorProtobuf_Protobuf_decode(mp_obj_t self, mp_obj_t data) { - // TODO - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorProtobuf_Protobuf_decode_obj, mod_TrezorProtobuf_Protobuf_decode); - -// Protobuf stuff - -STATIC const mp_rom_map_elem_t mod_TrezorProtobuf_Protobuf_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_encode), MP_ROM_PTR(&mod_TrezorProtobuf_Protobuf_encode_obj) }, - { MP_ROM_QSTR(MP_QSTR_decode), MP_ROM_PTR(&mod_TrezorProtobuf_Protobuf_decode_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(mod_TrezorProtobuf_Protobuf_locals_dict, mod_TrezorProtobuf_Protobuf_locals_dict_table); - -STATIC const mp_obj_type_t mod_TrezorProtobuf_Protobuf_type = { - { &mp_type_type }, - .name = MP_QSTR_Protobuf, - .make_new = mod_TrezorProtobuf_Protobuf_make_new, - .locals_dict = (void*)&mod_TrezorProtobuf_Protobuf_locals_dict, -}; - -// module stuff - -STATIC const mp_rom_map_elem_t mp_module_TrezorProtobuf_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_TrezorProtobuf) }, - { MP_ROM_QSTR(MP_QSTR_Protobuf), MP_ROM_PTR(&mod_TrezorProtobuf_Protobuf_type) }, -}; - -STATIC MP_DEFINE_CONST_DICT(mp_module_TrezorProtobuf_globals, mp_module_TrezorProtobuf_globals_table); - -const mp_obj_module_t mp_module_TrezorProtobuf = { - .base = { &mp_type_module }, - .name = MP_QSTR_TrezorProtobuf, - .globals = (mp_obj_dict_t*)&mp_module_TrezorProtobuf_globals, -}; - -#endif // MICROPY_PY_TREZORPROTOBUF diff --git a/extmod/modtrezorutils/modtrezorutils.c b/extmod/modtrezorutils/modtrezorutils.c index 017cdca56a..938240a7d5 100644 --- a/extmod/modtrezorutils/modtrezorutils.c +++ b/extmod/modtrezorutils/modtrezorutils.c @@ -71,4 +71,4 @@ const mp_obj_module_t mp_module_TrezorUtils = { .globals = (mp_obj_dict_t*)&mp_module_TrezorUtils_globals, }; -#endif // MICROPY_PY_TREZORPROTOBUF +#endif // MICROPY_PY_TREZORUTILS diff --git a/src/trezor/protobuf.py b/src/trezor/protobuf.py deleted file mode 100644 index 74c8c6b83f..0000000000 --- a/src/trezor/protobuf.py +++ /dev/null @@ -1,9 +0,0 @@ -from TrezorProtobuf import Protobuf - -_protobuf = Protobuf() - -def encode(data): - return _protobuf.encode(data) - -def decode(data): - return _protobuf.decode(data) diff --git a/vendor/micropython b/vendor/micropython index a978999665..4e2fda01bf 160000 --- a/vendor/micropython +++ b/vendor/micropython @@ -1 +1 @@ -Subproject commit a97899966537f6220531c3e98f5a610a8148f29c +Subproject commit 4e2fda01bf6612823057886c98284ada320c8b22