Damien George
69661f3343
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
5 years ago
Yonatan Goldschmidt
df5c3bd976
py/unicode: Add unichar_isalnum().
5 years ago
Damien George
7c85c7c210
py/unicode: Fix check for valid utf8 being stricter about contn chars.
6 years ago
Damien George
19aee9438a
py/unicode: Clean up utf8 funcs and provide non-utf8 inline versions.
This patch provides inline versions of the utf8 helper functions for the
case when unicode is disabled (MICROPY_PY_BUILTINS_STR_UNICODE set to 0).
This saves code size.
The unichar_charlen function is also renamed to utf8_charlen to match the
other utf8 helper functions, and the signature of this function is adjusted
for consistency (const char* -> const byte*, mp_uint_t -> size_t).
7 years ago
tll
68c28174d0
py/objstr: Add check for valid UTF-8 when making a str from bytes.
This patch adds a function utf8_check() to check for a valid UTF-8 encoded
string, and calls it when constructing a str from raw bytes. The feature
is selectable at compile time via MICROPY_PY_BUILTINS_STR_UNICODE_CHECK and
is enabled if unicode is enabled. It costs about 110 bytes on Thumb-2, 150
bytes on Xtensa and 170 bytes on x86-64.
7 years ago
Alexander Steffen
55f33240f3
all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
7 years ago
Damien George
afc5063539
py/unicode: Comment-out unused function unichar_isprint.
8 years ago
Alex March
69d9e7d27d
py/repl: Check for an identifier char after the keyword.
- As described in the #1850 .
- Add cmdline tests.
9 years ago
Dave Hylands
afaa66b657
py: Minor improvement to unichar_isxdigit
This drops the size of unicode_isxdigit from 0x1e + 0x02 filler to
0x14 bytes (so net code reduction of 12 bytes) and will make
unicode_is_xdigit perform slightly faster.
10 years ago
Dave Hylands
3ad94d6072
extmod: Add ubinascii.unhexlify
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
10 years ago
Damien George
4dea922610
py: Adjust some spaces in code style/format, purely for consistency.
10 years ago
Damien George
51dfcb4bb7
py: Move to guarded includes, everywhere in py/ core.
Addresses issue #1022 .
10 years ago
Damien George
5318cc028a
py: Tidy up a few function declarations.
10 years ago
Damien George
40f3c02682
Rename machine_(u)int_t to mp_(u)int_t.
See discussion in issue #50 .
11 years ago
Paul Sokolovsky
9e215fa4c2
py: Make unichar_charlen() accept/return machine_uint_t.
11 years ago
Damien George
e04a44e2f6
py: Small comments, name changes, use of machine_int_t.
11 years ago
Paul Sokolovsky
1044c3dfe6
unicode: Make get_char()/next_char()/charlen() be 8-bit compatible.
Based on config define.
11 years ago
Paul Sokolovsky
46d31e9ca9
unicode: Add utf8_ptr_to_index().
Useful when we have pointer to char inside string, but need to return char
index. (E.g. str.find()).
11 years ago
Chris Angelico
c88987c1af
py: Implement basic unicode functions.
11 years ago
Paul Sokolovsky
59c675a64c
py: Include mpconfig.h before all other includes.
It defines types used by all other headers.
Fixes #691 .
11 years ago
Paul Sokolovsky
b0bb458810
unicode: String API is const byte*.
We still have that char vs byte dichotomy, but majority of string operations
now use byte.
11 years ago
Damien George
c59af52e84
py: Rename some unichar functions for consistency.
11 years ago
Paul Sokolovsky
6913521911
objstr: Implement .lower() and .upper().
11 years ago
Damien George
04b9147e15
Add license header to (almost) all files.
Blanket wide to all .c and .h files. Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.
Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
11 years ago
Damien George
175cecfa87
py: Make form-feed character a space (following C isspace).
Eg, in CPython stdlib, email/header.py has a form-feed character.
11 years ago
Paul Sokolovsky
520e2f58a5
Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.
11 years ago
Paul Sokolovsky
0b7184dcb8
Implement octal and hex escapes in strings.
11 years ago
ian-v
5fd8fd2c16
Revert MP_BOOL, etc. and use <stdbool.h> instead
11 years ago
ian-v
7a16fadbf8
Co-exist with C++ (issue #85 )
11 years ago
Damien George
8cc96a35e5
Put unicode functions in unicode.c, and tidy their names.
11 years ago
Damien
429d71943d
Initial commit.
11 years ago