Commit Graph

370 Commits

Author SHA1 Message Date
John R. Lenton
e820491f7a Implement a basic str.find; fixes #67 2014-01-12 21:53:52 +00:00
John R. Lenton
c1bef21920 Implemented support for in and not in operators. 2014-01-11 12:39:33 +00:00
Damien George
2d45429122 Use memcpy instead of strncpy; add usart.status to stm. 2014-01-09 22:04:45 +00:00
xbe
7b0f39f318 Implement str.strip 2014-01-08 14:23:45 -08:00
Damien George
97209d38e1 Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ian-v-cplusplus
Conflicts:
	py/objcomplex.c
2014-01-07 15:58:30 +00:00
ian-v
a5a01df81d Make list and str method tables static 2014-01-06 14:14:11 -08:00
ian-v
7a16fadbf8 Co-exist with C++ (issue #85) 2014-01-06 09:52:29 -08:00
Paul Sokolovsky
860ffb0a43 Convert many object types structs to use C99 tagged initializer syntax. 2014-01-05 22:34:09 +02:00
xyb
8cfc9f07b9 Implements str iterator 2014-01-05 18:47:51 +08:00
Damien George
71c5181a8d Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
2014-01-04 20:21:15 +00:00
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).
2014-01-04 15:57:35 +00:00
Paul Sokolovsky
6ee1e383d6 str slice: Trim slice indexes to be in range. 2014-01-04 03:55:37 +02:00
Damien George
c8d1384fc0 Fix int -> machine_int_t; add print to slice test. 2014-01-04 01:06:10 +00:00
Paul Sokolovsky
f8b9d3c41a str: Throw TypeError for invalid index type and clean up comments. 2014-01-04 02:35:49 +02:00
Paul Sokolovsky
e606cb6561 slice: Allow building with MICROPY_ENABLE_SLICE=0. 2014-01-04 02:35:49 +02:00
Paul Sokolovsky
decad08ef5 str: Handle non-positive slice indexes. 2014-01-04 02:35:48 +02:00
Paul Sokolovsky
31ba60f836 str: Initial implementation of string slicing.
Only step=1 and non-negative indexes are supported so far.
2014-01-04 02:35:48 +02:00
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.
2014-01-02 16:36:09 +00:00
Damien
732407f1bf Change memory allocation API to require size for free and realloc. 2013-12-29 19:33:23 +00:00
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).
2013-12-21 18:17:45 +00:00