summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-10-18 11:06:20 +1100
committerDamien George <damien.p.george@gmail.com>2016-10-21 16:26:01 +1100
commit4ebdb1f2b217410cdc1cee0e0c0da8fceb7627f2 (patch)
treed6188cf8f6579ffa66b8370032b8184a901a5312 /py/obj.h
parent5d0735b93a52ff7f2f41dd27f3a22ca847f6b49b (diff)
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.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/py/obj.h b/py/obj.h
index 72d79ce14..e4fa19ac9 100644
--- a/py/obj.h
+++ b/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 {