Commit Graph

538 Commits

Author SHA1 Message Date
Paul Sokolovsky
af19cbd201 gc: Make debug output configurable, revamp test function.
Test function needs to be called by something else. Test heap size reduced so
its dump fits on a screenful of a typical terminal.
2014-02-11 02:31:28 +02:00
Paul Sokolovsky
4e836fb4ea mp_obj_equal(): Instead of assert(), throw NotImplementedError.
With a nice traceback, helps debugging much better.
2014-02-11 02:28:36 +02:00
Paul Sokolovsky
0a25aba046 Typo fix in comment. 2014-02-11 02:28:36 +02:00
Damien George
b0b7518dd1 Merge pull request #270 from pfalcon/down-with-calloc
Get rid of calloc().
2014-02-10 22:00:36 +00:00
Damien George
e8d2c3cf6c Merge pull request #267 from pfalcon/func-ret-ann
Clean up handling of function return type annotation.
2014-02-10 21:59:11 +00:00
Damien George
d46ca25757 Fix some int casting that failed on 64 bit architecture. 2014-02-10 21:46:47 +00:00
Damien George
8c2b333aff Merge branch 'master' of github.com:micropython/micropython 2014-02-10 21:41:14 +00:00
Paul Sokolovsky
58ff93bc7c Get rid of calloc().
If there's malloc and memset, then there's no need for calloc, especially if
we need to implement it ourselves.
2014-02-10 18:40:00 +02:00
Paul Sokolovsky
ac0134d427 Factor out mp_seq_count_obj() and implement tuple.count(). 2014-02-10 07:13:32 +02:00
Paul Sokolovsky
624eff6a8a Implement tuple.index(). 2014-02-10 07:13:32 +02:00
Paul Sokolovsky
0cd1dc06e6 Factor out mp_seq_index_obj() function to implement .index() on sequences. 2014-02-10 07:13:32 +02:00
Paul Sokolovsky
2f0b026a44 Clean up handling of function return type annotation. 2014-02-10 02:04:26 +02:00
Paul Sokolovsky
76f06de96d Add NotImplementedError. 2014-02-09 13:17:36 +02:00
Paul Sokolovsky
f7c2410e65 Implement tuple multiplication. 2014-02-08 23:19:48 +02:00
Paul Sokolovsky
ee4aaf7cdd Implement tuple addition. 2014-02-08 23:17:51 +02:00
Paul Sokolovsky
e827e98a6f Implement tuple comparison. 2014-02-08 22:56:36 +02:00
Paul Sokolovsky
1a996c48ac Refactor list comparison code to mp_seq_cmp_objs(). 2014-02-08 22:56:36 +02:00
Paul Sokolovsky
557c9d5264 unix microsocket: Add dummy makefile() method.
Unlike CPython socket, microsocket object already implements stream protocol
(read/write methods), so makefile() just returns object itself. TODO: this
doesn't take care of arguments CPython's makefile() may accept.
2014-02-08 22:00:20 +02:00
Damien George
7d0bfbedd2 py: Add some qstrs to the global table. 2014-02-08 19:01:47 +00:00
Damien George
0a587b85fb py: Pass keyword args to native functions by using the stack.
Passing keyword arguments to a native function now no longer requires
heap memory.  The kw_args map is created on the stack using the args
array as the table.
2014-02-08 18:53:41 +00:00
Damien George
9a58d760c3 py: Allow mp_map_t to be initialised by a fixed-size, const table.
This allows keyword maps to be created directly from stack data.
2014-02-08 18:47:46 +00:00
Damien George
698ec21e46 Make mp_obj_str_get_data return char* instead of byte*.
Can't decide which is better for string type, char or byte pointer.
Changing to char removes a few casts.  Really need to do proper unicode.
2014-02-08 18:17:23 +00:00
Damien George
aea532ece1 py: Put builtins into ROM table.
Linear table at the moment, to eventually be replaced with a hash table
generated by a preprocessor.

Dynamic table is retained so that builtins can be overridden.
2014-02-06 22:57:51 +00:00
Damien George
354d15a964 Implement fixed buffer vstrs; use them for import path. 2014-02-06 21:11:19 +00:00
Damien George
64131f3215 Add staticmethod and classmethod to builtin namespace. 2014-02-06 20:31:44 +00:00
Damien George
ddaf6c112c py: More output in showbc. 2014-02-06 20:31:32 +00:00
Damien George
bbcd49a496 py: Fix compile of class with keyword arguments in bases. 2014-02-06 20:30:16 +00:00
Damien George
e09ffa1400 Search paths properly on import and execute __init__.py if it exists. 2014-02-05 23:57:48 +00:00
Damien George
cdcb4906d4 Merge pull request #262 from pfalcon/sys-path
Implement sys.path support
2014-02-05 21:27:05 +00:00
Damien George
b8ec17c2d1 py: Fix bug with dual initialisation of RT_UNARY_OP_NOT.
Fixes Issue #261.
2014-02-05 00:57:31 +00:00
Damien George
35e2a4e6bb py: Add built-in super. 2014-02-05 00:51:47 +00:00
Paul Sokolovsky
9110896063 Remove older import helpers, no longer used. 2014-02-05 02:03:23 +02:00
Paul Sokolovsky
e11b17c25f Implement support for sys.path when loading modules.
sys.path is not initialized by rt_init(), that's left for platform-specific
startup code. (For example, bare metal port may have some hardcoded defaults,
and let user change sys.path directly; while port for OS with environment
feature can take path from environment). If it's not explicitly initialized,
modules will be imported only from a current directory.
2014-02-05 01:40:41 +02:00
Paul Sokolovsky
6e6b888e31 Add generic MIN()/MAX() functions. 2014-02-05 01:40:40 +02:00
Paul Sokolovsky
e5a15cb7a5 mp_obj_new_list(n, items): Copy items only if not-NULL.
Similar to mp_obj_new_tuple().
2014-02-04 19:36:00 +02:00
Paul Sokolovsky
0c59db1973 Use qstr id to create sys module. 2014-02-04 19:36:00 +02:00
Paul Sokolovsky
7cd54d79db Add ImportError. 2014-02-04 03:33:55 +02:00
Paul Sokolovsky
1d938c9503 Expose __import__() function. 2014-02-04 00:47:06 +02:00
Damien George
ca4767984b py: Implement builtin exec. 2014-02-03 22:44:10 +00:00
Damien George
4acb2452b3 py: Add very basic implementation of dir() builtin.
Only works on modules and class instances.
2014-02-02 22:07:44 +00:00
Paul Sokolovsky
0473e2790b Fix thinko with how bitfields were added to mp_obj_fun_native_t.
Structure is back to expected 16 bytes.
2014-02-02 17:58:44 +02:00
Damien George
93d004f4b0 Merge branch 'xbe-master' 2014-02-02 13:38:41 +00:00
Damien George
330cf6d04a Change id to return signed integer. 2014-02-02 13:38:21 +00:00
Damien George
09e1f43200 Merge branch 'master' of github.com:micropython/micropython 2014-02-02 13:13:29 +00:00
Damien George
cd82e02e84 py: Partially fix native emitter to work with latest runtime.
Native emitter has been broken since stack order has changed from
reverse to standard.  This fix gets it partially working.
2014-02-02 13:11:48 +00:00
Paul Sokolovsky
ea2509d92c Fix assert() usage. 2014-02-02 08:58:16 +02:00
Paul Sokolovsky
87e85b7dc7 Implement str/bytes rich comparisons. 2014-02-02 08:58:16 +02:00
xbe
0ebf8534ab Implement and add tests for the id() builtin function. 2014-02-01 19:00:41 -08:00
Paul Sokolovsky
9ed5435061 Implement slicing for tuples. 2014-02-02 03:42:07 +02:00
Paul Sokolovsky
13cfabd1b2 Implement slicing for lists. 2014-02-02 03:32:55 +02:00