Merge branch 'main' of github.com:AdamCummick/circuitpython into add_p1am_200
This commit is contained in:
commit
1d9a0c083e
@ -6,15 +6,15 @@ msgstr ""
|
|||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
||||||
"PO-Revision-Date: 2023-11-16 15:03+0000\n"
|
"PO-Revision-Date: 2023-11-28 06:04+0000\n"
|
||||||
"Last-Translator: Dan Halbert <halbert@halwitz.org>\n"
|
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: pt_BR\n"
|
"Language: pt_BR\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
||||||
"X-Generator: Weblate 5.2\n"
|
"X-Generator: Weblate 5.3-dev\n"
|
||||||
|
|
||||||
#: main.c
|
#: main.c
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -1615,7 +1615,7 @@ msgstr "Ok"
|
|||||||
#: ports/raspberrypi/common-hal/audiobusio/PDMIn.c
|
#: ports/raspberrypi/common-hal/audiobusio/PDMIn.c
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Only 8 or 16 bit mono with %dx oversampling supported."
|
msgid "Only 8 or 16 bit mono with %dx oversampling supported."
|
||||||
msgstr ""
|
msgstr "Somente mono de 8 ou 16 bits com %dx de sobreamostragem são suportados."
|
||||||
|
|
||||||
#: ports/espressif/common-hal/wifi/__init__.c
|
#: ports/espressif/common-hal/wifi/__init__.c
|
||||||
#: ports/raspberrypi/common-hal/wifi/__init__.c
|
#: ports/raspberrypi/common-hal/wifi/__init__.c
|
||||||
|
@ -137,30 +137,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_callable_obj, mp_builtin_callable);
|
|||||||
STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
|
STATIC mp_obj_t mp_builtin_chr(mp_obj_t o_in) {
|
||||||
#if MICROPY_PY_BUILTINS_STR_UNICODE
|
#if MICROPY_PY_BUILTINS_STR_UNICODE
|
||||||
mp_uint_t c = mp_obj_get_int(o_in);
|
mp_uint_t c = mp_obj_get_int(o_in);
|
||||||
uint8_t str[4];
|
if (c >= 0x110000) {
|
||||||
int len = 0;
|
|
||||||
if (c < 0x80) {
|
|
||||||
*str = c;
|
|
||||||
len = 1;
|
|
||||||
} else if (c < 0x800) {
|
|
||||||
str[0] = (c >> 6) | 0xC0;
|
|
||||||
str[1] = (c & 0x3F) | 0x80;
|
|
||||||
len = 2;
|
|
||||||
} else if (c < 0x10000) {
|
|
||||||
str[0] = (c >> 12) | 0xE0;
|
|
||||||
str[1] = ((c >> 6) & 0x3F) | 0x80;
|
|
||||||
str[2] = (c & 0x3F) | 0x80;
|
|
||||||
len = 3;
|
|
||||||
} else if (c < 0x110000) {
|
|
||||||
str[0] = (c >> 18) | 0xF0;
|
|
||||||
str[1] = ((c >> 12) & 0x3F) | 0x80;
|
|
||||||
str[2] = ((c >> 6) & 0x3F) | 0x80;
|
|
||||||
str[3] = (c & 0x3F) | 0x80;
|
|
||||||
len = 4;
|
|
||||||
} else {
|
|
||||||
mp_raise_ValueError(MP_ERROR_TEXT("chr() arg not in range(0x110000)"));
|
mp_raise_ValueError(MP_ERROR_TEXT("chr() arg not in range(0x110000)"));
|
||||||
}
|
}
|
||||||
return mp_obj_new_str_via_qstr((char *)str, len);
|
VSTR_FIXED(buf, 4);
|
||||||
|
vstr_add_char(&buf, c);
|
||||||
|
return mp_obj_new_str_via_qstr(buf.buf, buf.len);
|
||||||
#else
|
#else
|
||||||
mp_int_t ord = mp_obj_get_int(o_in);
|
mp_int_t ord = mp_obj_get_int(o_in);
|
||||||
if (0 <= ord && ord <= 0xff) {
|
if (0 <= ord && ord <= 0xff) {
|
||||||
|
@ -57,37 +57,23 @@ STATIC void get_word(int n, const mchar_t **pos, const mchar_t **end) {
|
|||||||
*end = *pos + len;
|
*end = *pos + len;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC int put_utf8(char *buf, int u) {
|
STATIC void put_utf8(vstr_t *vstr, int u) {
|
||||||
if (u >= translation_offstart) {
|
if (u >= translation_offstart) {
|
||||||
u += translation_offset;
|
u += translation_offset;
|
||||||
}
|
}
|
||||||
if (u <= 0x7f) {
|
if (word_start <= u && u <= word_end) {
|
||||||
*buf = u;
|
|
||||||
return 1;
|
|
||||||
} else if (word_start <= u && u <= word_end) {
|
|
||||||
uint n = (u - word_start);
|
uint n = (u - word_start);
|
||||||
const mchar_t *pos, *end;
|
const mchar_t *pos, *end;
|
||||||
get_word(n, &pos, &end);
|
get_word(n, &pos, &end);
|
||||||
int ret = 0;
|
|
||||||
// note that at present, entries in the words table are
|
// note that at present, entries in the words table are
|
||||||
// guaranteed not to represent words themselves, so this adds
|
// guaranteed not to represent words themselves, so this adds
|
||||||
// at most 1 level of recursive call
|
// at most 1 level of recursive call
|
||||||
for (; pos < end; pos++) {
|
for (; pos < end; pos++) {
|
||||||
int len = put_utf8(buf, *pos);
|
put_utf8(vstr, *pos);
|
||||||
buf += len;
|
|
||||||
ret += len;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return;
|
||||||
} else if (u <= 0x07ff) {
|
|
||||||
*buf++ = 0b11000000 | (u >> 6);
|
|
||||||
*buf = 0b10000000 | (u & 0b00111111);
|
|
||||||
return 2;
|
|
||||||
} else { // u <= 0xffff
|
|
||||||
*buf++ = 0b11100000 | (u >> 12);
|
|
||||||
*buf++ = 0b10000000 | ((u >> 6) & 0b00111111);
|
|
||||||
*buf = 0b10000000 | (u & 0b00111111);
|
|
||||||
return 3;
|
|
||||||
}
|
}
|
||||||
|
vstr_add_char(vstr, u);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t decompress_length(mp_rom_error_text_t compressed) {
|
uint16_t decompress_length(mp_rom_error_text_t compressed) {
|
||||||
@ -123,15 +109,15 @@ static int get_nbits(bitstream_state_t *st, int n) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *decompress(mp_rom_error_text_t compressed, char *decompressed) {
|
static void decompress_vstr(mp_rom_error_text_t compressed, vstr_t *decompressed) {
|
||||||
bitstream_state_t b = {
|
bitstream_state_t b = {
|
||||||
.ptr = &(compressed->data) + (compress_max_length_bits >> 3),
|
.ptr = &(compressed->data) + (compress_max_length_bits >> 3),
|
||||||
.bit = 1 << (7 - ((compress_max_length_bits) & 0x7)),
|
.bit = 1 << (7 - ((compress_max_length_bits) & 0x7)),
|
||||||
};
|
};
|
||||||
uint16_t length = decompress_length(compressed);
|
|
||||||
|
|
||||||
|
size_t alloc = decompressed->alloc - 1;
|
||||||
// Stop one early because the last byte is always NULL.
|
// Stop one early because the last byte is always NULL.
|
||||||
for (uint16_t i = 0; i < length - 1;) {
|
for (; decompressed->len < alloc;) {
|
||||||
uint32_t bits = 0;
|
uint32_t bits = 0;
|
||||||
uint8_t bit_length = 0;
|
uint8_t bit_length = 0;
|
||||||
uint32_t max_code = lengths[0];
|
uint32_t max_code = lengths[0];
|
||||||
@ -148,16 +134,19 @@ char *decompress(mp_rom_error_text_t compressed, char *decompressed) {
|
|||||||
int v = values[searched_length + bits - max_code];
|
int v = values[searched_length + bits - max_code];
|
||||||
if (v == 1) {
|
if (v == 1) {
|
||||||
qstr q = get_nbits(&b, translation_qstr_bits) + 1; // honestly no idea why "+1"...
|
qstr q = get_nbits(&b, translation_qstr_bits) + 1; // honestly no idea why "+1"...
|
||||||
for (const char *qc = qstr_str(q); *qc;) {
|
vstr_add_str(decompressed, qstr_str(q));
|
||||||
decompressed[i++] = *qc++;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
i += put_utf8(decompressed + i, v);
|
put_utf8(decompressed, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
decompressed[length - 1] = '\0';
|
|
||||||
return decompressed;
|
char *decompress(mp_rom_error_text_t compressed, char *decompressed) {
|
||||||
|
vstr_t vstr;
|
||||||
|
vstr_init_fixed_buf(&vstr, decompress_length(compressed), decompressed);
|
||||||
|
decompress_vstr(compressed, &vstr);
|
||||||
|
return vstr_null_terminated_str(&vstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CIRCUITPY_TRANSLATE_OBJECT == 1
|
#if CIRCUITPY_TRANSLATE_OBJECT == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user