diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/natmod/btree/btree_c.c | 6 | ||||
| -rw-r--r-- | examples/natmod/deflate/deflate.c | 4 | ||||
| -rw-r--r-- | examples/natmod/features0/features0.c | 6 | ||||
| -rw-r--r-- | examples/natmod/features1/features1.c | 18 | ||||
| -rw-r--r-- | examples/natmod/features2/main.c | 14 | ||||
| -rw-r--r-- | examples/natmod/features3/features3.c | 12 | ||||
| -rw-r--r-- | examples/natmod/features4/features4.c | 10 | ||||
| -rw-r--r-- | examples/natmod/framebuf/framebuf.c | 2 | ||||
| -rw-r--r-- | examples/natmod/re/re.c | 4 | ||||
| -rw-r--r-- | examples/usercmodule/cexample/examplemodule.c | 18 | ||||
| -rw-r--r-- | examples/usercmodule/cppexample/examplemodule.c | 6 | ||||
| -rw-r--r-- | examples/usercmodule/subpackage/modexamplepackage.c | 28 |
12 files changed, 64 insertions, 64 deletions
diff --git a/examples/natmod/btree/btree_c.c b/examples/natmod/btree/btree_c.c index c897f2e9a..3c60e41b2 100644 --- a/examples/natmod/btree/btree_c.c +++ b/examples/natmod/btree/btree_c.c @@ -100,9 +100,9 @@ mp_getiter_iternext_custom_t btree_getiter_iternext; #include "extmod/modbtree.c" mp_map_elem_t btree_locals_dict_table[8]; -STATIC MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table); +static MP_DEFINE_CONST_DICT(btree_locals_dict, btree_locals_dict_table); -STATIC mp_obj_t btree_open(size_t n_args, const mp_obj_t *args) { +static mp_obj_t btree_open(size_t n_args, const mp_obj_t *args) { // Make sure we got a stream object mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL); @@ -118,7 +118,7 @@ STATIC mp_obj_t btree_open(size_t n_args, const mp_obj_t *args) { return MP_OBJ_FROM_PTR(btree_new(db, args[0])); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_open_obj, 5, 5, btree_open); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(btree_open_obj, 5, 5, btree_open); mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { MP_DYNRUNTIME_INIT_ENTRY diff --git a/examples/natmod/deflate/deflate.c b/examples/natmod/deflate/deflate.c index fa475bd06..9de7e101a 100644 --- a/examples/natmod/deflate/deflate.c +++ b/examples/natmod/deflate/deflate.c @@ -29,7 +29,7 @@ mp_obj_t mp_stream_close(mp_obj_t stream) { MP_DEFINE_CONST_FUN_OBJ_1(mp_stream_close_obj, mp_stream_close); // Re-implemented from py/stream.c, not yet available in dynruntime.h. -STATIC mp_obj_t mp_stream___exit__(size_t n_args, const mp_obj_t *args) { +static mp_obj_t mp_stream___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; return mp_stream_close(args[0]); } @@ -42,7 +42,7 @@ mp_obj_t mp_identity(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(mp_identity_obj, mp_identity); mp_map_elem_t deflateio_locals_dict_table[7]; -STATIC MP_DEFINE_CONST_DICT(deflateio_locals_dict, deflateio_locals_dict_table); +static MP_DEFINE_CONST_DICT(deflateio_locals_dict, deflateio_locals_dict_table); mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { MP_DYNRUNTIME_INIT_ENTRY diff --git a/examples/natmod/features0/features0.c b/examples/natmod/features0/features0.c index 1b1867a3b..c3d31afb7 100644 --- a/examples/natmod/features0/features0.c +++ b/examples/natmod/features0/features0.c @@ -8,7 +8,7 @@ #include "py/dynruntime.h" // Helper function to compute factorial -STATIC mp_int_t factorial_helper(mp_int_t x) { +static mp_int_t factorial_helper(mp_int_t x) { if (x == 0) { return 1; } @@ -16,7 +16,7 @@ STATIC mp_int_t factorial_helper(mp_int_t x) { } // This is the function which will be called from Python, as factorial(x) -STATIC mp_obj_t factorial(mp_obj_t x_obj) { +static mp_obj_t factorial(mp_obj_t x_obj) { // Extract the integer from the MicroPython input object mp_int_t x = mp_obj_get_int(x_obj); // Calculate the factorial @@ -25,7 +25,7 @@ STATIC mp_obj_t factorial(mp_obj_t x_obj) { return mp_obj_new_int(result); } // Define a Python reference to the function above -STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial); +static MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial); // This is the entry point and is called when the module is imported mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { diff --git a/examples/natmod/features1/features1.c b/examples/natmod/features1/features1.c index d2494b213..92b96dbb1 100644 --- a/examples/natmod/features1/features1.c +++ b/examples/natmod/features1/features1.c @@ -25,15 +25,15 @@ uint16_t *const table_ptr16a[] = { &data16[0], &data16[1], &data16[2], &data16[3 const uint16_t *const table_ptr16b[] = { &table16[0], &table16[1] }; // A simple function that adds its 2 arguments (must be integers) -STATIC mp_obj_t add(mp_obj_t x_in, mp_obj_t y_in) { +static mp_obj_t add(mp_obj_t x_in, mp_obj_t y_in) { mp_int_t x = mp_obj_get_int(x_in); mp_int_t y = mp_obj_get_int(y_in); return mp_obj_new_int(x + y); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add); +static MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add); // A local helper function (not exposed to Python) -STATIC mp_int_t fibonacci_helper(mp_int_t x) { +static mp_int_t fibonacci_helper(mp_int_t x) { if (x < MP_ARRAY_SIZE(table8)) { return table8[x]; } else { @@ -42,17 +42,17 @@ STATIC mp_int_t fibonacci_helper(mp_int_t x) { } // A function which computes Fibonacci numbers -STATIC mp_obj_t fibonacci(mp_obj_t x_in) { +static mp_obj_t fibonacci(mp_obj_t x_in) { mp_int_t x = mp_obj_get_int(x_in); if (x < 0) { mp_raise_ValueError(MP_ERROR_TEXT("can't compute negative Fibonacci number")); } return mp_obj_new_int(fibonacci_helper(x)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci); +static MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci); // A function that accesses the BSS data -STATIC mp_obj_t access(size_t n_args, const mp_obj_t *args) { +static mp_obj_t access(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { // Create a list holding all items from data16 mp_obj_list_t *lst = MP_OBJ_TO_PTR(mp_obj_new_list(MP_ARRAY_SIZE(data16), NULL)); @@ -71,17 +71,17 @@ STATIC mp_obj_t access(size_t n_args, const mp_obj_t *args) { return mp_const_none; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(access_obj, 0, 2, access); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(access_obj, 0, 2, access); // A function that allocates memory and creates a bytearray -STATIC mp_obj_t make_array(void) { +static mp_obj_t make_array(void) { uint16_t *ptr = m_new(uint16_t, MP_ARRAY_SIZE(table_ptr16b)); for (int i = 0; i < MP_ARRAY_SIZE(table_ptr16b); ++i) { ptr[i] = *table_ptr16b[i]; } return mp_obj_new_bytearray_by_ref(sizeof(uint16_t) * MP_ARRAY_SIZE(table_ptr16b), ptr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(make_array_obj, make_array); +static MP_DEFINE_CONST_FUN_OBJ_0(make_array_obj, make_array); // This is the entry point and is called when the module is imported mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { diff --git a/examples/natmod/features2/main.c b/examples/natmod/features2/main.c index 1a39700dc..22961aa49 100644 --- a/examples/natmod/features2/main.c +++ b/examples/natmod/features2/main.c @@ -22,29 +22,29 @@ // A function that uses the default float type configured for the current target // This default can be overridden by specifying MICROPY_FLOAT_IMPL at the make level -STATIC mp_obj_t add(mp_obj_t x, mp_obj_t y) { +static mp_obj_t add(mp_obj_t x, mp_obj_t y) { return mp_obj_new_float(mp_obj_get_float(x) + mp_obj_get_float(y)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add); +static MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add); // A function that explicitly uses single precision floats -STATIC mp_obj_t add_f(mp_obj_t x, mp_obj_t y) { +static mp_obj_t add_f(mp_obj_t x, mp_obj_t y) { return mp_obj_new_float_from_f(mp_obj_get_float_to_f(x) + mp_obj_get_float_to_f(y)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_f_obj, add_f); +static MP_DEFINE_CONST_FUN_OBJ_2(add_f_obj, add_f); #if USE_DOUBLE // A function that explicitly uses double precision floats -STATIC mp_obj_t add_d(mp_obj_t x, mp_obj_t y) { +static mp_obj_t add_d(mp_obj_t x, mp_obj_t y) { return mp_obj_new_float_from_d(mp_obj_get_float_to_d(x) + mp_obj_get_float_to_d(y)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_d_obj, add_d); +static MP_DEFINE_CONST_FUN_OBJ_2(add_d_obj, add_d); #endif // A function that computes the product of floats in an array. // This function uses the most general C argument interface, which is more difficult // to use but has access to the globals dict of the module via self->globals. -STATIC mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { +static mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { // Check number of arguments is valid mp_arg_check_num(n_args, n_kw, 1, 1, false); diff --git a/examples/natmod/features3/features3.c b/examples/natmod/features3/features3.c index 20efd67cd..1d3bc51e6 100644 --- a/examples/natmod/features3/features3.c +++ b/examples/natmod/features3/features3.c @@ -8,7 +8,7 @@ #include "py/dynruntime.h" // A function that returns a tuple of object types. -STATIC mp_obj_t get_types(void) { +static mp_obj_t get_types(void) { return mp_obj_new_tuple(9, ((mp_obj_t []) { MP_OBJ_FROM_PTR(&mp_type_type), MP_OBJ_FROM_PTR(&mp_type_NoneType), @@ -21,10 +21,10 @@ STATIC mp_obj_t get_types(void) { MP_OBJ_FROM_PTR(&mp_type_dict), })); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_types_obj, get_types); +static MP_DEFINE_CONST_FUN_OBJ_0(get_types_obj, get_types); // A function that returns a tuple of constant objects. -STATIC mp_obj_t get_const_objects(void) { +static mp_obj_t get_const_objects(void) { return mp_obj_new_tuple(5, ((mp_obj_t []) { mp_const_none, mp_const_false, @@ -33,17 +33,17 @@ STATIC mp_obj_t get_const_objects(void) { mp_const_empty_tuple, })); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_const_objects_obj, get_const_objects); +static MP_DEFINE_CONST_FUN_OBJ_0(get_const_objects_obj, get_const_objects); // A function that creates a dictionary from the given arguments. -STATIC mp_obj_t make_dict(size_t n_args, const mp_obj_t *args) { +static mp_obj_t make_dict(size_t n_args, const mp_obj_t *args) { mp_obj_t dict = mp_obj_new_dict(n_args / 2); for (; n_args >= 2; n_args -= 2, args += 2) { mp_obj_dict_store(dict, args[0], args[1]); } return dict; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(make_dict_obj, 0, MP_OBJ_FUN_ARGS_MAX, make_dict); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(make_dict_obj, 0, MP_OBJ_FUN_ARGS_MAX, make_dict); // This is the entry point and is called when the module is imported. mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { diff --git a/examples/natmod/features4/features4.c b/examples/natmod/features4/features4.c index 336f4ecf6..a52e9e456 100644 --- a/examples/natmod/features4/features4.c +++ b/examples/natmod/features4/features4.c @@ -24,7 +24,7 @@ typedef struct { // Essentially Factorial.__new__ (but also kind of __init__). // Takes a single argument (the number to find the factorial of) -STATIC mp_obj_t factorial_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) { +static mp_obj_t factorial_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args_in) { mp_arg_check_num(n_args, n_kw, 1, 1, false); mp_obj_factorial_t *o = mp_obj_malloc(mp_obj_factorial_t, type); @@ -33,7 +33,7 @@ STATIC mp_obj_t factorial_make_new(const mp_obj_type_t *type, size_t n_args, siz return MP_OBJ_FROM_PTR(o); } -STATIC mp_int_t factorial_helper(mp_int_t x) { +static mp_int_t factorial_helper(mp_int_t x) { if (x == 0) { return 1; } @@ -41,16 +41,16 @@ STATIC mp_int_t factorial_helper(mp_int_t x) { } // Implements Factorial.calculate() -STATIC mp_obj_t factorial_calculate(mp_obj_t self_in) { +static mp_obj_t factorial_calculate(mp_obj_t self_in) { mp_obj_factorial_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(factorial_helper(self->n)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_calculate_obj, factorial_calculate); +static MP_DEFINE_CONST_FUN_OBJ_1(factorial_calculate_obj, factorial_calculate); // Locals dict for the Factorial type (will have a single method, calculate, // added in mpy_init). mp_map_elem_t factorial_locals_dict_table[1]; -STATIC MP_DEFINE_CONST_DICT(factorial_locals_dict, factorial_locals_dict_table); +static MP_DEFINE_CONST_DICT(factorial_locals_dict, factorial_locals_dict_table); // This is the entry point and is called when the module is imported mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { diff --git a/examples/natmod/framebuf/framebuf.c b/examples/natmod/framebuf/framebuf.c index badc7ab46..e8f99b3b2 100644 --- a/examples/natmod/framebuf/framebuf.c +++ b/examples/natmod/framebuf/framebuf.c @@ -13,7 +13,7 @@ mp_obj_full_type_t mp_type_framebuf; #include "extmod/modframebuf.c" mp_map_elem_t framebuf_locals_dict_table[11]; -STATIC MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table); +static MP_DEFINE_CONST_DICT(framebuf_locals_dict, framebuf_locals_dict_table); mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { MP_DYNRUNTIME_INIT_ENTRY diff --git a/examples/natmod/re/re.c b/examples/natmod/re/re.c index df89ea835..7ae72a578 100644 --- a/examples/natmod/re/re.c +++ b/examples/natmod/re/re.c @@ -38,10 +38,10 @@ mp_obj_full_type_t re_type; #include "extmod/modre.c" mp_map_elem_t match_locals_dict_table[5]; -STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table); +static MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table); mp_map_elem_t re_locals_dict_table[3]; -STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table); +static MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table); mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { MP_DYNRUNTIME_INIT_ENTRY diff --git a/examples/usercmodule/cexample/examplemodule.c b/examples/usercmodule/cexample/examplemodule.c index 9416613ba..2988fbd56 100644 --- a/examples/usercmodule/cexample/examplemodule.c +++ b/examples/usercmodule/cexample/examplemodule.c @@ -5,7 +5,7 @@ #include "py/mphal.h" // This is the function which will be called from Python as cexample.add_ints(a, b). -STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { +static mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { // Extract the ints from the micropython input objects. int a = mp_obj_get_int(a_obj); int b = mp_obj_get_int(b_obj); @@ -14,7 +14,7 @@ STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { return mp_obj_new_int(a + b); } // Define a Python reference to the function above. -STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints); +static MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints); // This structure represents Timer instance objects. typedef struct _example_Timer_obj_t { @@ -28,7 +28,7 @@ typedef struct _example_Timer_obj_t { // This is the Timer.time() method. After creating a Timer object, this // can be called to get the time elapsed since creating the Timer. -STATIC mp_obj_t example_Timer_time(mp_obj_t self_in) { +static mp_obj_t example_Timer_time(mp_obj_t self_in) { // The first argument is self. It is cast to the *example_Timer_obj_t // type so we can read its attributes. example_Timer_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -37,11 +37,11 @@ STATIC mp_obj_t example_Timer_time(mp_obj_t self_in) { mp_uint_t elapsed = mp_hal_ticks_ms() - self->start_time; return mp_obj_new_int_from_uint(elapsed); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(example_Timer_time_obj, example_Timer_time); +static MP_DEFINE_CONST_FUN_OBJ_1(example_Timer_time_obj, example_Timer_time); // This represents Timer.__new__ and Timer.__init__, which is called when // the user instantiates a Timer object. -STATIC mp_obj_t example_Timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { +static mp_obj_t example_Timer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // Allocates the new object and sets the type. example_Timer_obj_t *self = mp_obj_malloc(example_Timer_obj_t, type); @@ -54,10 +54,10 @@ STATIC mp_obj_t example_Timer_make_new(const mp_obj_type_t *type, size_t n_args, // This collects all methods and other static class attributes of the Timer. // The table structure is similar to the module table, as detailed below. -STATIC const mp_rom_map_elem_t example_Timer_locals_dict_table[] = { +static const mp_rom_map_elem_t example_Timer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&example_Timer_time_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(example_Timer_locals_dict, example_Timer_locals_dict_table); +static MP_DEFINE_CONST_DICT(example_Timer_locals_dict, example_Timer_locals_dict_table); // This defines the type(Timer) object. MP_DEFINE_CONST_OBJ_TYPE( @@ -73,12 +73,12 @@ MP_DEFINE_CONST_OBJ_TYPE( // and the MicroPython object reference. // All identifiers and strings are written as MP_QSTR_xxx and will be // optimized to word-sized integers by the build system (interned strings). -STATIC const mp_rom_map_elem_t example_module_globals_table[] = { +static const mp_rom_map_elem_t example_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample) }, { MP_ROM_QSTR(MP_QSTR_add_ints), MP_ROM_PTR(&example_add_ints_obj) }, { MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&example_type_Timer) }, }; -STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table); +static MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table); // Define module object. const mp_obj_module_t example_user_cmodule = { diff --git a/examples/usercmodule/cppexample/examplemodule.c b/examples/usercmodule/cppexample/examplemodule.c index 96a1a7443..5d4637b89 100644 --- a/examples/usercmodule/cppexample/examplemodule.c +++ b/examples/usercmodule/cppexample/examplemodule.c @@ -2,18 +2,18 @@ // Define a Python reference to the function we'll make available. // See example.cpp for the definition. -STATIC MP_DEFINE_CONST_FUN_OBJ_2(cppfunc_obj, cppfunc); +static MP_DEFINE_CONST_FUN_OBJ_2(cppfunc_obj, cppfunc); // Define all attributes of the module. // Table entries are key/value pairs of the attribute name (a string) // and the MicroPython object reference. // All identifiers and strings are written as MP_QSTR_xxx and will be // optimized to word-sized integers by the build system (interned strings). -STATIC const mp_rom_map_elem_t cppexample_module_globals_table[] = { +static const mp_rom_map_elem_t cppexample_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cppexample) }, { MP_ROM_QSTR(MP_QSTR_cppfunc), MP_ROM_PTR(&cppfunc_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(cppexample_module_globals, cppexample_module_globals_table); +static MP_DEFINE_CONST_DICT(cppexample_module_globals, cppexample_module_globals_table); // Define module object. const mp_obj_module_t cppexample_user_cmodule = { diff --git a/examples/usercmodule/subpackage/modexamplepackage.c b/examples/usercmodule/subpackage/modexamplepackage.c index 70e1e4005..d68d05283 100644 --- a/examples/usercmodule/subpackage/modexamplepackage.c +++ b/examples/usercmodule/subpackage/modexamplepackage.c @@ -2,18 +2,18 @@ #include "py/runtime.h" // Define example_package.foo.bar.f() -STATIC mp_obj_t example_package_foo_bar_f(void) { +static mp_obj_t example_package_foo_bar_f(void) { mp_printf(&mp_plat_print, "example_package.foo.bar.f\n"); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_bar_f_obj, example_package_foo_bar_f); +static MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_bar_f_obj, example_package_foo_bar_f); // Define all attributes of the second-level sub-package (example_package.foo.bar). -STATIC const mp_rom_map_elem_t example_package_foo_bar_globals_table[] = { +static const mp_rom_map_elem_t example_package_foo_bar_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example_package_dot_foo_dot_bar) }, { MP_ROM_QSTR(MP_QSTR_f), MP_ROM_PTR(&example_package_foo_bar_f_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(example_package_foo_bar_globals, example_package_foo_bar_globals_table); +static MP_DEFINE_CONST_DICT(example_package_foo_bar_globals, example_package_foo_bar_globals_table); // Define example_package.foo.bar module object. const mp_obj_module_t example_package_foo_bar_user_cmodule = { @@ -22,19 +22,19 @@ const mp_obj_module_t example_package_foo_bar_user_cmodule = { }; // Define example_package.foo.f() -STATIC mp_obj_t example_package_foo_f(void) { +static mp_obj_t example_package_foo_f(void) { mp_printf(&mp_plat_print, "example_package.foo.f\n"); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_f_obj, example_package_foo_f); +static MP_DEFINE_CONST_FUN_OBJ_0(example_package_foo_f_obj, example_package_foo_f); // Define all attributes of the first-level sub-package (example_package.foo). -STATIC const mp_rom_map_elem_t example_package_foo_globals_table[] = { +static const mp_rom_map_elem_t example_package_foo_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example_package_dot_foo) }, { MP_ROM_QSTR(MP_QSTR_bar), MP_ROM_PTR(&example_package_foo_bar_user_cmodule) }, { MP_ROM_QSTR(MP_QSTR_f), MP_ROM_PTR(&example_package_foo_f_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(example_package_foo_globals, example_package_foo_globals_table); +static MP_DEFINE_CONST_DICT(example_package_foo_globals, example_package_foo_globals_table); // Define example_package.foo module object. const mp_obj_module_t example_package_foo_user_cmodule = { @@ -43,13 +43,13 @@ const mp_obj_module_t example_package_foo_user_cmodule = { }; // Define example_package.f() -STATIC mp_obj_t example_package_f(void) { +static mp_obj_t example_package_f(void) { mp_printf(&mp_plat_print, "example_package.f\n"); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package_f_obj, example_package_f); +static MP_DEFINE_CONST_FUN_OBJ_0(example_package_f_obj, example_package_f); -STATIC mp_obj_t example_package___init__(void) { +static mp_obj_t example_package___init__(void) { if (!MP_STATE_VM(example_package_initialised)) { // __init__ for builtins is called each time the module is imported, // so ensure that initialisation only happens once. @@ -58,20 +58,20 @@ STATIC mp_obj_t example_package___init__(void) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(example_package___init___obj, example_package___init__); +static MP_DEFINE_CONST_FUN_OBJ_0(example_package___init___obj, example_package___init__); // The "initialised" state is stored on mp_state so that it is cleared on soft // reset. MP_REGISTER_ROOT_POINTER(int example_package_initialised); // Define all attributes of the top-level package (example_package). -STATIC const mp_rom_map_elem_t example_package_globals_table[] = { +static const mp_rom_map_elem_t example_package_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_example_package) }, { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&example_package___init___obj) }, { MP_ROM_QSTR(MP_QSTR_foo), MP_ROM_PTR(&example_package_foo_user_cmodule) }, { MP_ROM_QSTR(MP_QSTR_f), MP_ROM_PTR(&example_package_f_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(example_package_globals, example_package_globals_table); +static MP_DEFINE_CONST_DICT(example_package_globals, example_package_globals_table); // Define module object. const mp_obj_module_t example_package_user_cmodule = { |
