summaryrefslogtreecommitdiff
path: root/examples/natmod
diff options
context:
space:
mode:
Diffstat (limited to 'examples/natmod')
-rw-r--r--examples/natmod/btree/btree_c.c6
-rw-r--r--examples/natmod/deflate/deflate.c4
-rw-r--r--examples/natmod/features0/features0.c6
-rw-r--r--examples/natmod/features1/features1.c18
-rw-r--r--examples/natmod/features2/main.c14
-rw-r--r--examples/natmod/features3/features3.c12
-rw-r--r--examples/natmod/features4/features4.c10
-rw-r--r--examples/natmod/framebuf/framebuf.c2
-rw-r--r--examples/natmod/re/re.c4
9 files changed, 38 insertions, 38 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