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
9fc7933f
Commit
9fc7933f
authored
Oct 23, 2013
by
Damien
Browse files
Add py_get_qstr.
parent
e9f1e50b
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/runtime.c
View file @
9fc7933f
...
...
@@ -514,7 +514,7 @@ py_obj_t py_builtin___build_class__(py_obj_t o_class_fun, py_obj_t o_class_name)
}
py_obj_t
py_builtin_range
(
py_obj_t
o_arg
)
{
return
py_obj_new_range
(
0
,
rt
_get_int
(
o_arg
),
1
);
return
py_obj_new_range
(
0
,
py
_get_int
(
o_arg
),
1
);
}
#ifdef WRITE_NATIVE
...
...
@@ -845,7 +845,7 @@ int rt_is_true(py_obj_t arg) {
}
}
int
rt
_get_int
(
py_obj_t
arg
)
{
int
py
_get_int
(
py_obj_t
arg
)
{
if
(
arg
==
py_const_false
)
{
return
0
;
}
else
if
(
arg
==
py_const_true
)
{
...
...
@@ -858,6 +858,15 @@ int rt_get_int(py_obj_t arg) {
}
}
qstr
py_get_qstr
(
py_obj_t
arg
)
{
if
(
IS_O
(
arg
,
O_STR
))
{
return
((
py_obj_base_t
*
)
arg
)
->
u_str
;
}
else
{
assert
(
0
);
return
0
;
}
}
py_obj_t
rt_load_const_str
(
qstr
qstr
)
{
DEBUG_OP_printf
(
"load '%s'
\n
"
,
qstr_str
(
qstr
));
return
py_obj_new_str
(
qstr
);
...
...
py/runtime.h
View file @
9fc7933f
...
...
@@ -97,7 +97,8 @@ void rt_assign_native_code(int unique_code_id, py_fun_t f, uint len, int n_args)
void
rt_assign_inline_asm_code
(
int
unique_code_id
,
py_fun_t
f
,
uint
len
,
int
n_args
);
void
py_obj_print
(
py_obj_t
o
);
int
rt_is_true
(
py_obj_t
arg
);
int
rt_get_int
(
py_obj_t
arg
);
int
py_get_int
(
py_obj_t
arg
);
qstr
py_get_qstr
(
py_obj_t
arg
);
py_obj_t
rt_load_const_str
(
qstr
qstr
);
py_obj_t
rt_load_name
(
qstr
qstr
);
py_obj_t
rt_load_global
(
qstr
qstr
);
...
...
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