Commit Graph

124 Commits

Author SHA1 Message Date
John R. Lenton ba3f87c947 Merge remote-tracking branch 'upstream/master' into list_reverse 2014-01-05 22:29:03 +00:00
John R. Lenton d52a0318ce Merge remote-tracking branch 'upstream/master' into list_remove 2014-01-05 22:27:11 +00:00
John R. Lenton 8428b8f3c9 Merge remote-tracking branch 'upstream/master' into list_insert 2014-01-05 22:11:01 +00:00
John R. Lenton c553162ebc Fix off-by-one in non-default values of index's 2nd and 3rd arguments. 2014-01-05 21:57:27 +00:00
Paul Sokolovsky 860ffb0a43 Convert many object types structs to use C99 tagged initializer syntax. 2014-01-05 22:34:09 +02:00
Damien George f0691f4ed5 Fix qstr in objlist.c; add more tests for list.index.
list.index fails on an edge case.
2014-01-05 13:44:06 +00:00
John R. Lenton 7e73a8fd09 Merge remote-tracking branch 'upstream/master' into list_index 2014-01-05 01:57:54 +00: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 4d4bc9533e Merge pull request #70 from chipaca/list_count
Implements list.count. Fixes isue #55.
2014-01-04 10:09:40 -08: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
John R. Lenton 6e1e98f864 Implements list.reverse; fixes issue #66 2014-01-04 02:10:29 +00:00
John R. Lenton 49fb6e53b3 Implements list.remove (in terms of list.index and list.pop).
Fixes issue #63.
2014-01-04 01:56:53 +00:00
John R. Lenton 45a8744617 Implements list.insert. Fixes issue #61. 2014-01-04 01:15:01 +00:00
John R. Lenton 5d4a821339 Implements list.index. Fixes issue #57. 2014-01-04 00:26:30 +00:00
John R. Lenton e241e8c169 Implemented list.count 2014-01-03 23:57:28 +00:00
John R. Lenton 26c211648b Implemented list.copy. Fixes issue #54. 2014-01-03 23:42:17 +00:00
John R. Lenton 069ded9514 Added list.clear. Fixes issue #53. 2014-01-03 23:22:53 +00:00
John R. Lenton 25f417c08c Worked on list.pop:
* Fixes issue #51
* Adds a specific error message for when you try to pop an empty list.
* Releases some memory if the list has shurnk a lot.
2014-01-03 22:53:18 +00:00
John R. Lenton 9bc56d933f Changed to use memcpy. 2014-01-03 10:13:38 +00:00
John R. Lenton aeb16c36b0 Add a bit of whitespace. 2014-01-03 02:36:35 +00:00
John R. Lenton 81ad89c46e untabified 2014-01-03 02:32:40 +00:00
John R. Lenton 4cb80582c4 Add list addition (fixes: #39) 2014-01-03 02:27:08 +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