Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
7aca1cae
Commit
7aca1cae
authored
May 11, 2014
by
Paul Sokolovsky
Browse files
py: Start making good use of mp_const_obj_t.
parent
3f8d34ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/obj.c
View file @
7aca1cae
...
...
@@ -36,18 +36,18 @@
#include
"runtime0.h"
#include
"runtime.h"
mp_obj_type_t
*
mp_obj_get_type
(
mp_obj_t
o_in
)
{
mp_obj_type_t
*
mp_obj_get_type
(
mp_
const_
obj_t
o_in
)
{
if
(
MP_OBJ_IS_SMALL_INT
(
o_in
))
{
return
(
mp_obj_t
)
&
mp_type_int
;
}
else
if
(
MP_OBJ_IS_QSTR
(
o_in
))
{
return
(
mp_obj_t
)
&
mp_type_str
;
}
else
{
mp_obj_base_t
*
o
=
o_in
;
const
mp_obj_base_t
*
o
=
o_in
;
return
(
mp_obj_t
)
o
->
type
;
}
}
const
char
*
mp_obj_get_type_str
(
mp_obj_t
o_in
)
{
const
char
*
mp_obj_get_type_str
(
mp_
const_
obj_t
o_in
)
{
return
qstr_str
(
mp_obj_get_type
(
o_in
)
->
name
);
}
...
...
py/obj.h
View file @
7aca1cae
...
...
@@ -398,8 +398,8 @@ mp_obj_t mp_obj_new_bound_meth(mp_obj_t meth, mp_obj_t self);
mp_obj_t
mp_obj_new_getitem_iter
(
mp_obj_t
*
args
);
mp_obj_t
mp_obj_new_module
(
qstr
module_name
);
mp_obj_type_t
*
mp_obj_get_type
(
mp_obj_t
o_in
);
const
char
*
mp_obj_get_type_str
(
mp_obj_t
o_in
);
mp_obj_type_t
*
mp_obj_get_type
(
mp_
const_
obj_t
o_in
);
const
char
*
mp_obj_get_type_str
(
mp_
const_
obj_t
o_in
);
bool
mp_obj_is_subclass_fast
(
mp_const_obj_t
object
,
mp_const_obj_t
classinfo
);
// arguments should be type objects
void
mp_obj_print_helper
(
void
(
*
print
)(
void
*
env
,
const
char
*
fmt
,
...),
void
*
env
,
mp_obj_t
o_in
,
mp_print_kind_t
kind
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment