Damien George
7c9c667633
py: Implement iterator support for object that has __getitem__.
Addresses Issue #203 .
11 years ago
Paul Sokolovsky
91fb1c9b13
Add basic implementation of bytes type, piggybacking on str.
This reuses as much str implementation as possible, from this we
can make them more separate as needed.
11 years ago
Damien George
1e708fed18
py: Implement bool unary op; tidy up unary op dispatch.
11 years ago
Paul Sokolovsky
1eacefe5bc
Implement simplest case of str.startswith().
11 years ago
Damien George
5fa93b6755
Second stage of qstr revamp: uPy str object can be qstr or not.
11 years ago
Damien George
55baff4c9b
Revamp qstrs: they now include length and hash.
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
11 years ago
Paul Sokolovsky
4c316552c1
Implement str.split(None).
Note that splitting by explicit string is not implemented so far.
11 years ago
Paul Sokolovsky
7380a83780
str: Implement proper string (instead of byte string) indexing.
Also, support negative indexes.
11 years ago
Paul Sokolovsky
545591a696
Implement string multiplication.
11 years ago
Paul Sokolovsky
8965a5eb1e
objstr: More support for MP_OBJ_QSTR.
11 years ago
Paul Sokolovsky
bb33cc66fb
Properly print MP_OBJ_QSTR objects.
11 years ago
Damien George
a11ceca807
Change int to uint for n_args in function with variable arguments.
11 years ago
Paul Sokolovsky
f2b796e7c7
str.format: Don't assume that '}' immediately follows '{', skip insides.
That at least makes stuff like "{:x}".format(1) to produce not completely
broken output.
11 years ago
Paul Sokolovsky
76d982ef34
type->print(): Distinguish str() and repr() variety by passing extra param.
11 years ago
Damien George
f62d33aa1d
Consolidate rt_make_function_[0123] to rt_make_function_n.
11 years ago
Damien George
2300537c79
Cleanup built-ins, and fix some compiler warnings/errors.
11 years ago
Dave Hylands
c8effff937
Added public domain implementations of strchr and strstr.
11 years ago
John R. Lenton
e820491f7a
Implement a basic str.find; fixes #67
11 years ago
John R. Lenton
c1bef21920
Implemented support for `in` and `not in` operators.
11 years ago
Damien George
2d45429122
Use memcpy instead of strncpy; add usart.status to stm.
11 years ago
xbe
7b0f39f318
Implement str.strip
11 years ago
John R. Lenton
9c83ec0eda
Merge remote-tracking branch 'upstream/master' into dict_feats
11 years ago
John R. Lenton
3391e19068
A bit of stylistic cleanup (chose the wrong side during conflict resolution).
11 years ago
John R. Lenton
c06763a020
This implements a better (more python-conformant) list.sort.
It's not really about that, though; it's about me figuring out a sane
way forward for keyword-argument functions (and function
metadata). But it's useful as is, and shouldn't break any existing
code, so here you have it; I'm going to park it in my mind for a bit
while sorting out the rest of the dict branch.
11 years ago
ian-v
a5a01df81d
Make list and str method tables static
11 years ago
ian-v
7a16fadbf8
Co-exist with C++ (issue #85 )
11 years ago
Paul Sokolovsky
860ffb0a43
Convert many object types structs to use C99 tagged initializer syntax.
11 years ago
xyb
8cfc9f07b9
Implements str iterator
11 years ago
Damien George
71c5181a8d
Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
11 years ago
Damien George
eb7bfcb286
Split qstr into pools, and put initial pool in ROM.
Qstr's are now split into a linked-list of qstr pools. This has 2
benefits: the first pool can be in ROM (huge benefit, since we no longer
use RAM for the core qstrs), and subsequent pools use m_new for the next
pool instead of m_renew (thus avoiding a huge single table for all the
qstrs).
Still would be better to use a hash table, but this scheme takes us part
of the way (eventually convert the pools to hash tables).
Also fixed bug with import.
Also improved the way the module code is referenced (not magic number 1
anymore).
11 years ago
Paul Sokolovsky
6ee1e383d6
str slice: Trim slice indexes to be in range.
11 years ago
Damien George
c8d1384fc0
Fix int -> machine_int_t; add print to slice test.
11 years ago
Paul Sokolovsky
f8b9d3c41a
str: Throw TypeError for invalid index type and clean up comments.
11 years ago
Paul Sokolovsky
e606cb6561
slice: Allow building with MICROPY_ENABLE_SLICE=0.
11 years ago
Paul Sokolovsky
decad08ef5
str: Handle non-positive slice indexes.
11 years ago
Paul Sokolovsky
31ba60f836
str: Initial implementation of string slicing.
Only step=1 and non-negative indexes are supported so far.
11 years ago
Damien George
fe8fb9165c
py: remove depedence on strcat and stpcpy.
This fixes Issue #29 , and means the core is no longer dependent on
string functions, except strlen.
11 years ago
Damien
732407f1bf
Change memory allocation API to require size for free and realloc.
11 years ago
Damien
d99b05282d
Change object representation from 1 big union to individual structs.
A big change. Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object). This scheme follows CPython. Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.
Also change name prefix, from py_ to mp_ (mp for Micro Python).
11 years ago