summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJuan Biondi <juanernestobiondi@gmail.com>2019-03-27 19:55:23 +0100
committerGitHub <noreply@github.com>2019-03-27 19:55:23 +0100
commitf6892ce3ff71b3f142d7a3f50e7137907708e0e7 (patch)
treedd9beeb504d2601772b7dc39d4e54c0f1b3c50bd /lib
parent948cc03031d6e13f2212758b596f9e152684d3c5 (diff)
parent94822ee2088960e6f68c9d4f05606cdb47c9ba5c (diff)
Merge pull request #4 from adafruit/master
Get latest changes to translate
Diffstat (limited to 'lib')
-rw-r--r--lib/libm_dbl/pow.c12
-rw-r--r--lib/oofatfs/ffconf.h2
m---------lib/tinyusb0
-rwxr-xr-xlib/utils/pyexec.c3
-rw-r--r--lib/utils/sys_stdio_mphal.c20
5 files changed, 27 insertions, 10 deletions
diff --git a/lib/libm_dbl/pow.c b/lib/libm_dbl/pow.c
index 3ddc1b6ff..4aef8a5b3 100644
--- a/lib/libm_dbl/pow.c
+++ b/lib/libm_dbl/pow.c
@@ -125,13 +125,13 @@ double pow(double x, double y)
else if (iy >= 0x3ff00000) {
k = (iy>>20) - 0x3ff; /* exponent */
if (k > 20) {
- uint32_t j = ly>>(52-k);
- if ((j<<(52-k)) == ly)
- yisint = 2 - (j&1);
+ uint32_t j2 = ly>>(52-k);
+ if ((j2<<(52-k)) == ly)
+ yisint = 2 - (j2&1);
} else if (ly == 0) {
- uint32_t j = iy>>(20-k);
- if ((j<<(20-k)) == iy)
- yisint = 2 - (j&1);
+ uint32_t j2 = iy>>(20-k);
+ if ((j2<<(20-k)) == (uint32_t)iy)
+ yisint = 2 - (j2&1);
}
}
}
diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h
index 315101f0e..214311b4c 100644
--- a/lib/oofatfs/ffconf.h
+++ b/lib/oofatfs/ffconf.h
@@ -74,7 +74,7 @@
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
-#define _USE_FASTSEEK 0
+#define _USE_FASTSEEK 1
/* This option switches fast seek function. (0:Disable or 1:Enable) */
diff --git a/lib/tinyusb b/lib/tinyusb
-Subproject 3bb53273cd3770328f55ba317af3df0cce4333c
+Subproject 547cc045fa1d8862e7e00c1d7b4a0026531d009
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index e637fe544..e8a1983b0 100755
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -89,6 +89,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
+ if (input_kind == MP_PARSE_FILE_INPUT) {
+ mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
+ }
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.
diff --git a/lib/utils/sys_stdio_mphal.c b/lib/utils/sys_stdio_mphal.c
index fc8a74e7d..266783f37 100644
--- a/lib/utils/sys_stdio_mphal.c
+++ b/lib/utils/sys_stdio_mphal.c
@@ -53,12 +53,12 @@ STATIC const sys_stdio_obj_t stdio_buffer_obj;
#endif
void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
- sys_stdio_obj_t *self = self_in;
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<io.FileIO %d>", self->fd);
}
STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
- sys_stdio_obj_t *self = self_in;
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->fd == STDIO_FD_IN) {
for (uint i = 0; i < size; i++) {
int c = mp_hal_stdin_rx_chr();
@@ -75,7 +75,7 @@ STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *er
}
STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
- sys_stdio_obj_t *self = self_in;
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->fd == STDIO_FD_OUT || self->fd == STDIO_FD_ERR) {
mp_hal_stdout_tx_strn_cooked(buf, size);
return size;
@@ -85,6 +85,19 @@ STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
}
}
+STATIC mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ (void) self;
+
+ // For now, pretend we actually flush the stdio stream.
+ if (request == MP_STREAM_FLUSH) {
+ return 0;
+ } else {
+ *errcode = MP_EINVAL;
+ return MP_STREAM_ERROR;
+ }
+}
+
STATIC mp_obj_t stdio_obj___exit__(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
@@ -112,6 +125,7 @@ STATIC MP_DEFINE_CONST_DICT(stdio_locals_dict, stdio_locals_dict_table);
STATIC const mp_stream_p_t stdio_obj_stream_p = {
.read = stdio_read,
.write = stdio_write,
+ .ioctl = stdio_ioctl,
.is_text = true,
};