summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-23 00:01:10 +0100
committerDamien <damien.p.george@gmail.com>2013-10-23 00:01:10 +0100
commit9fc7933ff2a807f93a734bafe8944bb862074495 (patch)
tree66d0a0ac1d3c75e34c405df3f08d260eb7f2093e /py/runtime.c
parente9f1e50be49edc6d01ff006e0a1f5291672ec808 (diff)
downloadmicropython-9fc7933ff2a807f93a734bafe8944bb862074495.tar.gz
micropython-9fc7933ff2a807f93a734bafe8944bb862074495.zip
Add py_get_qstr.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c
index ce71025a8c..41d696a2e3 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -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);