Rename rt_* to mp_*.
Mostly just a global search and replace. Except rt_is_true which
becomes mp_obj_is_true.
Still would like to tidy up some of the names, but this will do for now.
diff --git a/unix/ffi.c b/unix/ffi.c
index 9a4c035..71fb0b6 100644
--- a/unix/ffi.c
+++ b/unix/ffi.c
@@ -128,10 +128,10 @@
o->func = sym;
o->rettype = *rettype;
- mp_obj_t iterable = rt_getiter(args[3]);
+ mp_obj_t iterable = mp_getiter(args[3]);
mp_obj_t item;
int i = 0;
- while ((item = rt_iternext(iterable)) != MP_OBJ_NULL) {
+ while ((item = mp_iternext(iterable)) != MP_OBJ_NULL) {
o->params[i++] = get_ffi_type(item);
}
@@ -149,7 +149,7 @@
for (int i = 0; i < cif->nargs; i++) {
pyargs[i] = mp_obj_new_int(*(int*)args[i]);
}
- mp_obj_t res = rt_call_function_n_kw(func, cif->nargs, 0, pyargs);
+ mp_obj_t res = mp_call_function_n_kw(func, cif->nargs, 0, pyargs);
*(ffi_arg*)ret = mp_obj_int_get(res);
}
@@ -165,10 +165,10 @@
o->rettype = *rettype;
- mp_obj_t iterable = rt_getiter(paramtypes_in);
+ mp_obj_t iterable = mp_getiter(paramtypes_in);
mp_obj_t item;
int i = 0;
- while ((item = rt_iternext(iterable)) != MP_OBJ_NULL) {
+ while ((item = mp_iternext(iterable)) != MP_OBJ_NULL) {
o->params[i++] = get_ffi_type(item);
}
@@ -348,8 +348,8 @@
void ffi_init() {
mp_obj_t m = mp_obj_new_module(QSTR_FROM_STR_STATIC("ffi"));
- rt_store_attr(m, MP_QSTR_open, (mp_obj_t)&mod_ffi_open_obj);
- rt_store_attr(m, QSTR_FROM_STR_STATIC("callback"), (mp_obj_t)&mod_ffi_callback_obj);
+ mp_store_attr(m, MP_QSTR_open, (mp_obj_t)&mod_ffi_open_obj);
+ mp_store_attr(m, QSTR_FROM_STR_STATIC("callback"), (mp_obj_t)&mod_ffi_callback_obj);
// there would be as_bytes, but bytes currently is value, not reference type!
- rt_store_attr(m, QSTR_FROM_STR_STATIC("as_bytearray"), (mp_obj_t)&mod_ffi_as_bytearray_obj);
+ mp_store_attr(m, QSTR_FROM_STR_STATIC("as_bytearray"), (mp_obj_t)&mod_ffi_as_bytearray_obj);
}
diff --git a/unix/file.c b/unix/file.c
index f037b6f..948ec44 100644
--- a/unix/file.c
+++ b/unix/file.c
@@ -140,7 +140,7 @@
void file_init() {
mp_obj_t m_sys = mp_obj_new_module(MP_QSTR_sys);
- rt_store_attr(m_sys, MP_QSTR_stdin, fdfile_new(STDIN_FILENO));
- rt_store_attr(m_sys, MP_QSTR_stdout, fdfile_new(STDOUT_FILENO));
- rt_store_attr(m_sys, MP_QSTR_stderr, fdfile_new(STDERR_FILENO));
+ mp_store_attr(m_sys, MP_QSTR_stdin, fdfile_new(STDIN_FILENO));
+ mp_store_attr(m_sys, MP_QSTR_stdout, fdfile_new(STDOUT_FILENO));
+ mp_store_attr(m_sys, MP_QSTR_stderr, fdfile_new(STDERR_FILENO));
}
diff --git a/unix/main.c b/unix/main.c
index 6b25988..ffbdbb7 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -85,7 +85,7 @@
// execute it
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
- rt_call_function_0(module_fun);
+ mp_call_function_0(module_fun);
nlr_pop();
} else {
// uncaught exception
@@ -278,7 +278,7 @@
#endif
qstr_init();
- rt_init();
+ mp_init();
char *home = getenv("HOME");
char *path = getenv("MICROPYPATH");
@@ -292,9 +292,9 @@
p++;
}
}
- sys_path = mp_obj_new_list(path_num, NULL);
+ mp_sys_path = mp_obj_new_list(path_num, NULL);
mp_obj_t *path_items;
- mp_obj_list_get(sys_path, &path_num, &path_items);
+ mp_obj_list_get(mp_sys_path, &path_num, &path_items);
path_items[0] = MP_OBJ_NEW_QSTR(MP_QSTR_);
char *p = path;
for (int i = 1; i < path_num; i++) {
@@ -315,15 +315,15 @@
}
mp_obj_t m_sys = mp_obj_new_module(MP_QSTR_sys);
- rt_store_attr(m_sys, MP_QSTR_path, sys_path);
+ mp_store_attr(m_sys, MP_QSTR_path, mp_sys_path);
mp_obj_t py_argv = mp_obj_new_list(0, NULL);
- rt_store_attr(m_sys, MP_QSTR_argv, py_argv);
+ mp_store_attr(m_sys, MP_QSTR_argv, py_argv);
- rt_store_name(qstr_from_str("test"), test_obj_new(42));
- rt_store_name(qstr_from_str("mem_info"), rt_make_function_n(0, mem_info));
- rt_store_name(qstr_from_str("qstr_info"), rt_make_function_n(0, qstr_info));
+ mp_store_name(qstr_from_str("test"), test_obj_new(42));
+ mp_store_name(qstr_from_str("mem_info"), mp_make_function_n(0, mem_info));
+ mp_store_name(qstr_from_str("qstr_info"), mp_make_function_n(0, qstr_info));
#if MICROPY_ENABLE_GC
- rt_store_name(qstr_from_str("gc"), (mp_obj_t)&pyb_gc_obj);
+ mp_store_name(qstr_from_str("gc"), (mp_obj_t)&pyb_gc_obj);
#endif
file_init();
@@ -344,8 +344,8 @@
// test_obj.attr = 42
mp_obj_t test_class_type, test_class_instance;
test_class_type = mp_obj_new_type(QSTR_FROM_STR_STATIC("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
- rt_store_name(QSTR_FROM_STR_STATIC("test_obj"), test_class_instance = rt_call_function_0(test_class_type));
- rt_store_attr(test_class_instance, QSTR_FROM_STR_STATIC("attr"), mp_obj_new_int(42));
+ mp_store_name(QSTR_FROM_STR_STATIC("test_obj"), test_class_instance = mp_call_function_0(test_class_type));
+ mp_store_attr(test_class_instance, QSTR_FROM_STR_STATIC("attr"), mp_obj_new_int(42));
/*
printf("bytes:\n");
@@ -378,7 +378,7 @@
free(basedir);
}
for (int i = a; i < argc; i++) {
- rt_list_append(py_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
+ mp_list_append(py_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
}
do_file(argv[a]);
executed = true;
@@ -390,7 +390,7 @@
do_repl();
}
- rt_deinit();
+ mp_deinit();
//printf("total bytes = %d\n", m_get_total_bytes_allocated());
return 0;
diff --git a/unix/socket.c b/unix/socket.c
index 04c1d10..ee74ea0 100644
--- a/unix/socket.c
+++ b/unix/socket.c
@@ -314,7 +314,7 @@
}
assert(addr);
- mp_obj_t list = rt_build_list(0, NULL);
+ mp_obj_t list = mp_build_list(0, NULL);
for (; addr; addr = addr->ai_next) {
mp_obj_tuple_t *t = mp_obj_new_tuple(5, NULL);
t->items[0] = MP_OBJ_NEW_SMALL_INT((machine_int_t)addr->ai_family);
@@ -328,7 +328,7 @@
t->items[3] = mp_const_none;
}
t->items[4] = mp_obj_new_bytearray(addr->ai_addrlen, addr->ai_addr);
- rt_list_append(list, t);
+ mp_list_append(list, t);
}
return list;
}
@@ -366,15 +366,15 @@
void microsocket_init() {
mp_obj_t m = mp_obj_new_module(MP_QSTR_microsocket);
- rt_store_attr(m, MP_QSTR_socket, (mp_obj_t)µsocket_type);
+ mp_store_attr(m, MP_QSTR_socket, (mp_obj_t)µsocket_type);
#if MICROPY_SOCKET_EXTRA
- rt_store_attr(m, MP_QSTR_sockaddr_in, (mp_obj_t)&sockaddr_in_type);
- rt_store_attr(m, MP_QSTR_htons, (mp_obj_t)&mod_socket_htons_obj);
- rt_store_attr(m, MP_QSTR_inet_aton, (mp_obj_t)&mod_socket_inet_aton_obj);
- rt_store_attr(m, MP_QSTR_gethostbyname, (mp_obj_t)&mod_socket_gethostbyname_obj);
+ mp_store_attr(m, MP_QSTR_sockaddr_in, (mp_obj_t)&sockaddr_in_type);
+ mp_store_attr(m, MP_QSTR_htons, (mp_obj_t)&mod_socket_htons_obj);
+ mp_store_attr(m, MP_QSTR_inet_aton, (mp_obj_t)&mod_socket_inet_aton_obj);
+ mp_store_attr(m, MP_QSTR_gethostbyname, (mp_obj_t)&mod_socket_gethostbyname_obj);
#endif
- rt_store_attr(m, MP_QSTR_getaddrinfo, (mp_obj_t)&mod_socket_getaddrinfo_obj);
+ mp_store_attr(m, MP_QSTR_getaddrinfo, (mp_obj_t)&mod_socket_getaddrinfo_obj);
for (const struct sym_entry *p = constants; p->sym != NULL; p++) {
- rt_store_attr(m, QSTR_FROM_STR_STATIC(p->sym), MP_OBJ_NEW_SMALL_INT((machine_int_t)p->val));
+ mp_store_attr(m, QSTR_FROM_STR_STATIC(p->sym), MP_OBJ_NEW_SMALL_INT((machine_int_t)p->val));
}
}
diff --git a/unix/time.c b/unix/time.c
index 7d25b3d..fb52133 100644
--- a/unix/time.c
+++ b/unix/time.c
@@ -43,7 +43,7 @@
void time_init() {
mp_obj_t m = mp_obj_new_module(QSTR_FROM_STR_STATIC("time"));
- rt_store_attr(m, QSTR_FROM_STR_STATIC("time"), (mp_obj_t)&mod_time_time_obj);
- rt_store_attr(m, QSTR_FROM_STR_STATIC("clock"), (mp_obj_t)&mod_time_clock_obj);
- rt_store_attr(m, QSTR_FROM_STR_STATIC("sleep"), (mp_obj_t)&mod_time_sleep_obj);
+ mp_store_attr(m, QSTR_FROM_STR_STATIC("time"), (mp_obj_t)&mod_time_time_obj);
+ mp_store_attr(m, QSTR_FROM_STR_STATIC("clock"), (mp_obj_t)&mod_time_clock_obj);
+ mp_store_attr(m, QSTR_FROM_STR_STATIC("sleep"), (mp_obj_t)&mod_time_sleep_obj);
}