py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.
In order to have more fine-grained control over how builtin functions are constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific, with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW. These names now match the MP_DEFINE_CONST_FUN_OBJ macros.
This commit is contained in:
parent
5d0735b93a
commit
4ebdb1f2b2
@ -61,7 +61,6 @@ typedef long mp_off_t;
|
||||
#define MP_PLAT_PRINT_STRN(str, len) (void)0
|
||||
|
||||
// extra built in names to add to the global namespace
|
||||
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
||||
|
||||
|
@ -30,6 +30,6 @@
|
||||
void rng_init0 (void);
|
||||
uint32_t rng_get (void);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_rng_get_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_rng_get_obj);
|
||||
|
||||
#endif // __RANDOM_H
|
||||
|
@ -1,3 +1,3 @@
|
||||
#include "py/obj.h"
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(dht_readinto_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(dht_readinto_obj);
|
||||
|
@ -13,7 +13,7 @@ extern const mp_obj_type_t pyb_spi_type;
|
||||
extern const mp_obj_type_t pyb_hspi_type;
|
||||
extern const mp_obj_type_t machine_spi_type;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_info_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
|
||||
|
||||
typedef struct _pyb_pin_obj_t {
|
||||
mp_obj_base_t base;
|
||||
|
@ -57,6 +57,6 @@ typedef struct _fs_user_mount_t {
|
||||
fs_user_mount_t *fatfs_mount_mkfs(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args, bool mkfs);
|
||||
mp_obj_t fatfs_umount(mp_obj_t bdev_or_path_in);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(fsuser_mount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(fsuser_umount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(fsuser_mkfs_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(fsuser_mount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(fsuser_umount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(fsuser_mkfs_obj);
|
||||
|
@ -32,6 +32,6 @@
|
||||
|
||||
mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_time_pulse_us_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_time_pulse_us_obj);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
|
||||
|
@ -47,9 +47,9 @@ typedef struct _mp_machine_soft_spi_obj_t {
|
||||
|
||||
void mp_machine_soft_spi_transfer(mp_obj_base_t *self, size_t len, const uint8_t *src, uint8_t *dest);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_machine_spi_read_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_machine_spi_readinto_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_machine_spi_write_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_machine_spi_write_readinto_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_spi_read_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_machine_spi_readinto_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_machine_spi_write_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_3(mp_machine_spi_write_readinto_obj);
|
||||
|
||||
#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_SPI_H
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <stddef.h>
|
||||
#include "py/runtime.h"
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_uos_dupterm_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj);
|
||||
|
||||
#if MICROPY_PY_OS_DUPTERM
|
||||
void mp_uos_dupterm_tx_strn(const char *str, size_t len);
|
||||
|
@ -33,10 +33,10 @@ extern mp_obj_t mod_binascii_a2b_base64(mp_obj_t data);
|
||||
extern mp_obj_t mod_binascii_b2a_base64(mp_obj_t data);
|
||||
extern mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_binascii_hexlify_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_binascii_unhexlify_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_binascii_a2b_base64_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_binascii_b2a_base64_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_binascii_crc32_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_hexlify_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mod_binascii_unhexlify_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mod_binascii_a2b_base64_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mod_binascii_b2a_base64_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_crc32_obj);
|
||||
|
||||
#endif /* MICROPY_EXTMOD_MODUBINASCII */
|
||||
|
@ -27,10 +27,10 @@
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_sleep_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_sleep_ms_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_sleep_us_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_ticks_ms_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_ticks_us_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_ticks_cpu_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_utime_ticks_diff_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_sleep_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_sleep_ms_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_utime_sleep_us_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_ms_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_us_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_cpu_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj);
|
||||
|
@ -27,6 +27,6 @@
|
||||
extern const byte fresult_to_errno_table[20];
|
||||
|
||||
mp_obj_t fatfs_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_open_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
|
||||
|
||||
mp_obj_t fat_vfs_listdir(const char *path, bool is_str_type);
|
||||
|
@ -49,6 +49,6 @@ void pyexec_event_repl_init(void);
|
||||
int pyexec_event_repl_process_char(int c);
|
||||
extern uint8_t pyexec_repl_active;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(pyb_set_repl_info_obj);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
|
||||
|
@ -70,7 +70,6 @@ typedef long mp_off_t;
|
||||
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
||||
|
||||
// extra built in names to add to the global namespace
|
||||
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
||||
|
||||
|
@ -88,7 +88,6 @@ typedef int mp_off_t;
|
||||
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
||||
|
||||
// extra builtin names to add to the global namespace
|
||||
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
||||
|
||||
|
96
py/builtin.h
96
py/builtin.h
@ -32,56 +32,55 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args);
|
||||
mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs);
|
||||
mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin___repl_print___obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_abs_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_all_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_any_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_bin_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_callable_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_compile_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_chr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_dir_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_divmod_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_eval_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_exec_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_execfile_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_getattr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_setattr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_globals_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_hasattr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_hash_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_hex_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_id_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_isinstance_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_issubclass_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_iter_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_len_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_list_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_locals_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_max_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_min_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_next_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_oct_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_ord_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_pow_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_print_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_repr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_round_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_sorted_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_sum_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR(mp_builtin___build_class___obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin___import___obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin___repl_print___obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_abs_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_all_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_any_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_bin_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_callable_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_chr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_dir_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_divmod_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_eval_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_execfile_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_getattr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_3(mp_builtin_setattr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(mp_builtin_globals_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_hasattr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_hash_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_hex_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_id_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_isinstance_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_builtin_issubclass_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_iter_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_len_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(mp_builtin_locals_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_max_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_min_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_next_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_oct_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_ord_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_pow_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_print_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_builtin_repr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_round_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_sorted_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_sum_obj);
|
||||
// Defined by a port, but declared here for simplicity
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_help_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_input_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_open_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_input_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_namedtuple_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_namedtuple_obj);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_op_contains_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_op_getitem_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_op_setitem_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_op_delitem_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_op_contains_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_op_getitem_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_3(mp_op_setitem_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_op_delitem_obj);
|
||||
|
||||
extern const mp_obj_module_t mp_module___main__;
|
||||
extern const mp_obj_module_t mp_module_builtins;
|
||||
@ -116,7 +115,4 @@ extern const mp_obj_module_t mp_module_webrepl;
|
||||
extern const mp_obj_module_t mp_module_framebuf;
|
||||
extern const mp_obj_module_t mp_module_btree;
|
||||
|
||||
// extmod functions
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_mount_obj);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_BUILTIN_H__
|
||||
|
10
py/obj.h
10
py/obj.h
@ -270,7 +270,13 @@ static inline bool mp_obj_is_integer(mp_const_obj_t o) { return MP_OBJ_IS_INT(o)
|
||||
// These macros are used to declare and define constant function objects
|
||||
// You can put "static" in front of the definitions to make them local
|
||||
|
||||
#define MP_DECLARE_CONST_FUN_OBJ(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_0(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_1(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_2(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_3(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_VAR(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
#define MP_DECLARE_CONST_FUN_OBJ_KW(obj_name) extern const mp_obj_fun_builtin_t obj_name
|
||||
|
||||
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) \
|
||||
const mp_obj_fun_builtin_t obj_name = \
|
||||
@ -760,7 +766,7 @@ qstr mp_obj_fun_get_name(mp_const_obj_t fun);
|
||||
qstr mp_obj_code_get_name(const byte *code_info);
|
||||
|
||||
mp_obj_t mp_identity(mp_obj_t self);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_identity_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_identity_obj);
|
||||
|
||||
// module
|
||||
typedef struct _mp_obj_module_t {
|
||||
|
54
py/objstr.h
54
py/objstr.h
@ -74,32 +74,32 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s
|
||||
mp_obj_t index, bool is_slice);
|
||||
const byte *find_subbytes(const byte *haystack, mp_uint_t hlen, const byte *needle, mp_uint_t nlen, mp_int_t direction);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_encode_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_find_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_rfind_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_index_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_rindex_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_join_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_split_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_splitlines_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_rsplit_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_startswith_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_endswith_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_strip_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_lstrip_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_rstrip_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_format_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_replace_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_count_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_partition_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_rpartition_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_center_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_lower_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_upper_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_isspace_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_isalpha_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_isdigit_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_isupper_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(str_islower_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_rfind_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_index_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_rindex_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(str_join_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_split_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(str_splitlines_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_rsplit_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_startswith_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_endswith_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_strip_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_lstrip_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_rstrip_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(str_format_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_replace_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(str_count_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(str_partition_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(str_rpartition_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(str_center_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_lower_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_upper_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_isspace_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_isalpha_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_isdigit_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_isupper_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(str_islower_obj);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJSTR_H__
|
||||
|
24
py/stream.h
24
py/stream.h
@ -48,18 +48,18 @@ struct mp_stream_seek_t {
|
||||
int whence;
|
||||
};
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_read_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_read1_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_readinto_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_readall_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_unbuffered_readline_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_unbuffered_readlines_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_write_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_write1_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_seek_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_tell_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_flush_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_stream_ioctl_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read1_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_readinto_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_stream_readall_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_unbuffered_readline_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_stream_unbuffered_readlines_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_write_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(mp_stream_write1_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_seek_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_stream_tell_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(mp_stream_flush_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_ioctl_obj);
|
||||
|
||||
// these are for mp_get_stream_raise and can be or'd together
|
||||
#define MP_STREAM_OP_READ (1)
|
||||
|
@ -53,7 +53,6 @@ typedef long mp_off_t;
|
||||
#define MP_PLAT_PRINT_STRN(str, len) write(1, str, len)
|
||||
|
||||
// extra built in names to add to the global namespace
|
||||
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
|
||||
|
||||
|
@ -70,10 +70,10 @@ static inline void restore_irq_pri(uint32_t basepri) {
|
||||
|
||||
#endif
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_wfi_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_disable_irq_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_enable_irq_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_irq_stats_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(pyb_wfi_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(pyb_disable_irq_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_enable_irq_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(pyb_irq_stats_obj);
|
||||
|
||||
// IRQ priority definitions.
|
||||
//
|
||||
|
@ -33,12 +33,12 @@
|
||||
|
||||
void machine_init(void);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_info_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_unique_id_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_reset_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_bootloader_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_freq_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_sleep_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(machine_deepsleep_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_unique_id_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_reset_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_bootloader_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_sleep_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_deepsleep_obj);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
|
||||
|
@ -126,7 +126,7 @@ STATIC mp_obj_t pyb_elapsed_micros(mp_obj_t start) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(pyb_main_obj); // defined in main.c
|
||||
|
||||
STATIC const mp_map_elem_t pyb_module_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pyb) },
|
||||
|
@ -86,7 +86,7 @@ extern const mp_obj_type_t pin_cpu_pins_obj_type;
|
||||
extern const mp_obj_dict_t pin_cpu_pins_locals_dict;
|
||||
extern const mp_obj_dict_t pin_board_pins_locals_dict;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pin_init_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(pin_init_obj);
|
||||
|
||||
void pin_init0(void);
|
||||
uint32_t pin_get_mode(const pin_obj_t *pin);
|
||||
|
@ -33,8 +33,8 @@ extern const mp_obj_module_t mp_module_usocket;
|
||||
|
||||
// additional helper functions exported by the modules
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(time_sleep_ms_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(time_sleep_us_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_ms_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_us_obj);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_os_sync_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mod_os_dupterm_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(mod_os_sync_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_dupterm_obj);
|
||||
|
@ -27,4 +27,4 @@
|
||||
void rng_init0(void);
|
||||
uint32_t rng_get(void);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_rng_get_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(pyb_rng_get_obj);
|
||||
|
@ -29,5 +29,5 @@ void servo_timer_irq_callback(void);
|
||||
|
||||
extern const mp_obj_type_t pyb_servo_type;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_servo_set_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_pwm_set_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
|
||||
|
@ -53,9 +53,9 @@ extern const struct _mp_obj_tuple_t pyb_usb_hid_mouse_obj;
|
||||
extern const struct _mp_obj_tuple_t pyb_usb_hid_keyboard_obj;
|
||||
extern const mp_obj_type_t pyb_usb_vcp_type;
|
||||
extern const mp_obj_type_t pyb_usb_hid_type;
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_usb_mode_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_have_cdc_obj); // deprecated
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_hid_send_report_obj); // deprecated
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(pyb_usb_mode_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(pyb_have_cdc_obj); // deprecated
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(pyb_hid_send_report_obj); // deprecated
|
||||
|
||||
void pyb_usb_init0(void);
|
||||
bool pyb_usb_dev_init(uint16_t vid, uint16_t pid, usb_device_mode_t mode, USBD_HID_ModeInfoTypeDef *hid_info);
|
||||
|
@ -272,9 +272,9 @@ STATIC mp_obj_t pyb_hid_send_report(mp_obj_t arg) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_hid_send_report_obj, pyb_hid_send_report);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_source_dir_obj); // defined in main.c
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_usb_mode_obj); // defined in main.c
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(pyb_source_dir_obj); // defined in main.c
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(pyb_main_obj); // defined in main.c
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(pyb_usb_mode_obj); // defined in main.c
|
||||
|
||||
STATIC const mp_map_elem_t pyb_module_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pyb) },
|
||||
|
@ -2,6 +2,6 @@ void servo_init(void);
|
||||
|
||||
extern const mp_obj_type_t pyb_servo_type;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_servo_set_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_pwm_set_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
|
||||
|
||||
|
@ -461,7 +461,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
||||
|
||||
#if defined(MICROPY_UNIX_COVERAGE)
|
||||
{
|
||||
MP_DECLARE_CONST_FUN_OBJ(extra_coverage_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(extra_coverage_obj);
|
||||
mp_store_global(QSTR_FROM_STR_STATIC("extra_coverage"), MP_OBJ_FROM_PTR(&extra_coverage_obj));
|
||||
}
|
||||
#endif
|
||||
|
@ -43,9 +43,9 @@
|
||||
// Can't include this, as FATFS structure definition is required,
|
||||
// and FatFs header defining it conflicts with POSIX.
|
||||
//#include "extmod/fsusermount.h"
|
||||
MP_DECLARE_CONST_FUN_OBJ(fsuser_mount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(fsuser_umount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(fsuser_mkfs_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(fsuser_mount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_1(fsuser_umount_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_KW(fsuser_mkfs_obj);
|
||||
extern const mp_obj_type_t mp_fat_vfs_type;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
Loading…
Reference in New Issue
Block a user