Commit Graph

8677 Commits

Author SHA1 Message Date
Paul Sokolovsky
0914371faf file.readline(): Use mp_obj_str_get_data() and fix off-by-one error on EOF. 2014-01-22 19:17:58 +02:00
mux
630d8ff89f Remove Underscore from Macro Names 2014-01-22 18:11:48 +02:00
mux
28b23f09a4 Add Generic Feature Macros to mpconfigport
* Add some generic feature macros to mpconfigport
* Move pin and port definitions from usrsw.c to mpconfigport
2014-01-22 17:42:06 +02:00
Damien George
5fa93b6755 Second stage of qstr revamp: uPy str object can be qstr or not. 2014-01-22 14:35:10 +00:00
Damien George
8ae1c1beac Merge branch 'fix-stm-discovery' of github.com:dhylands/micropython into dhylands-fix-stm-discovery
Conflicts:
	stm/main.c
2014-01-22 11:56:24 +00:00
Dave Hylands
72a31162e9 Fix support for STM32F4DISCOVERY 2014-01-21 18:08:39 -08:00
Damien George
e6a4ab4be1 py: Remove implicit conversion of float to int in mp_obj_get_int().
Addresses Issue #199.
2014-01-22 00:21:47 +00:00
Damien George
2843b8e3a7 Merge branch 'master' of github.com:micropython/micropython 2014-01-21 23:49:44 +00:00
Damien George
600ae734cf py: Implement break and continue byte codes, and add tests.
Also fixes a bug in the for-in-range optimiser.

I hope to remove break and continue byte codes in the future and just
use jump (if possible).
2014-01-21 23:48:04 +00:00
Damien George
79dc37f00a Merge pull request #204 from dhylands/master
Fix malformed makeqstrdata generated file when using python 2.7
2014-01-21 15:35:40 -08:00
Dave Hylands
7a996b1f65 Fix malformed generated file when using python 2.7 2014-01-21 15:28:27 -08:00
Damien George
2c30256382 stm: Clean up main.c; disable libgcc by default.
f2d and d2f functions from libgcc does not work correctly, most likely
due to the ABI being incorrect.  libgcc disabled for now.
2014-01-21 23:28:03 +00:00
Damien George
d51cfd155c stm: Put HSE_VALUE and other defines in mpconfigport.h.
mpconfigport.h is now included by stm32f4xx.h so that all STM files have
access to these defines.
2014-01-21 22:32:51 +00:00
Damien George
eb380d7261 stm: Put TARGET in mpconfigport.h; support PYBv4. 2014-01-21 22:20:50 +00:00
Damien George
8517bce6b1 Merge pull request #202 from iabdalkader/master
Remove hardcoded PLL_M value
2014-01-21 14:05:49 -08:00
Paul Sokolovsky
d30e019459 Add bytearray basic tests. 2014-01-21 23:59:50 +02:00
Paul Sokolovsky
09ce05996a array: Implement iterator. 2014-01-21 23:59:50 +02:00
Paul Sokolovsky
33996685df Add len() support for arrays. 2014-01-21 23:59:50 +02:00
Damien George
12eaccacda Merge branch 'master' of github.com:micropython/micropython
Conflicts:
	py/objstr.c
	py/py.mk
	py/stream.c
	unix/main.c
	unix/socket.c
2014-01-21 21:54:15 +00:00
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
2014-01-21 21:40:13 +00:00
mux
4578ced209 Add OSC_VALUE to Makefile
* Add the option to pass OSC frequency on command line.
2014-01-21 15:57:01 +02:00
mux
e9c01dea32 Remove hardcoded PLL_M value 2014-01-21 14:43:13 +02:00
Paul Sokolovsky
7280f79088 run-tests: Allow to run tests selectively via command line. 2014-01-21 05:02:58 +02:00
Paul Sokolovsky
4c316552c1 Implement str.split(None).
Note that splitting by explicit string is not implemented so far.
2014-01-21 05:01:21 +02:00
Paul Sokolovsky
7380a83780 str: Implement proper string (instead of byte string) indexing.
Also, support negative indexes.
2014-01-21 02:25:59 +02:00
Paul Sokolovsky
545591a696 Implement string multiplication. 2014-01-21 00:39:12 +02:00
Paul Sokolovsky
439542f70c sequence.c: Start to refactor sequence operations for reuse among types. 2014-01-21 00:39:12 +02:00
Paul Sokolovsky
51ee44a718 unix file: Refactor and add sys.stdout/stdin/stderr. 2014-01-20 23:50:55 +02:00
Paul Sokolovsky
8965a5eb1e objstr: More support for MP_OBJ_QSTR. 2014-01-20 23:34:17 +02:00
Paul Sokolovsky
e6da0df6d1 mp_obj_get_type_str(): Handle MP_OBJ_QSTR. 2014-01-20 23:01:06 +02:00
Paul Sokolovsky
d991da7263 socket-client, socket-server examples now run on both Micro- and C-Python. 2014-01-20 20:37:01 +02:00
Paul Sokolovsky
a80ff04fe7 Add dummy bytes() constructor.
Currently, MicroPython strings are mix between CPython byte and unicode
strings. So, conversion is null so far. This dummy implementation is
intended for compatibility with CPython (so, same code can run on both).
2014-01-20 20:37:01 +02:00
Paul Sokolovsky
f0cfb8cb45 Don't preimport socket module. 2014-01-20 20:37:01 +02:00
Paul Sokolovsky
fc35aa6828 unix socket: Add send() and recv() methods.
CPython _socket actually have only those and doesn't provide stream
interface (higher-level CPython "socket" what adds this).

+516 bytes x86.
2014-01-20 20:37:01 +02:00
Paul Sokolovsky
ff3bdea49d stream_read(): Shrink memory block to actual read size. 2014-01-20 20:37:01 +02:00
Paul Sokolovsky
decd597273 unix io.FileIO: Add iteration support.
A file cannot be iterated concurrently, so we make io.FileIO its own
iterator.
2014-01-20 18:42:08 +02:00
Paul Sokolovsky
d54bef7692 stream: Add generic unbuffered iternext method.
Uses stream_unbuffered_readline underline.
2014-01-20 18:42:08 +02:00
Paul Sokolovsky
dff3f896d7 mp_identity(): Add generic identity function.
Useful as getiter method for objects which are their own iterators, etc.
2014-01-20 18:42:08 +02:00
Paul Sokolovsky
3754c4a040 mp_obj_get_qstr(): Handle MP_OBJ_QSTR. 2014-01-20 18:23:38 +02:00
Damien George
91d457a277 py: Put micropython module init code in builtinmp.c. 2014-01-20 10:30:24 +00:00
Damien George
589233622c Merge pull request #198 from pfalcon/expose-memstat
Expose memory stats functions via "micropython" module.
2014-01-20 02:01:50 -08:00
Paul Sokolovsky
440cc3f028 Expose memory stats functions via "micropython" module.
These are micropython.mem_total(), .mem_current(), .mem_peak(). These are 3
individual functions with simple scalar return value to make sure that
calls to these functions themselves have minimal (hopefully zero) impact on
memory allocation.
2014-01-20 02:20:40 +02:00
Damien George
164774c1c1 Merge branch 'master' of github.com:micropython/micropython 2014-01-20 00:03:03 +00:00
Damien George
7d08935458 Rename unix binary to 'micropython'. 2014-01-20 00:02:39 +00:00
Paul Sokolovsky
159c0f75da Don't implicitly import "sys" module. 2014-01-20 01:57:20 +02:00
Paul Sokolovsky
fe2690da0a unix: Implement sys.argv. 2014-01-20 01:00:28 +02:00
Paul Sokolovsky
f477bfbc75 Pre-create sys module. 2014-01-20 01:00:28 +02:00
Paul Sokolovsky
bb33cc66fb Properly print MP_OBJ_QSTR objects. 2014-01-20 01:00:28 +02:00
Damien George
2c7a1b2ad1 Merge pull request #197 from pfalcon/mod-singletons
Implement modules as singletons Python semantics.
2014-01-19 14:52:07 -08:00
Paul Sokolovsky
d720ab5236 Implement modules as singletons Python semantics.
In Python, importing module several times returns same underlying module
object. This also fixes import statement handling for builtin modules.

There're still issues:
1. CPython exposes set of loaded modules as sys.modules, we may want to
do that either.
2. Builtin modules are implicitly imported, which is not really correct.
We should separate registering a (builtin) module and importing a module.
CPython keeps builtin module names in sys.builtin_module_names .
2014-01-20 00:38:39 +02:00