Commit Graph

14136 Commits

Author SHA1 Message Date
Paul Sokolovsky
dcac88095b Add empty "micropython" module to allow more seamless CPython portability.
Implicit "micropython" module contains (at least) codegeneration decorators.
Make it explicit, so an app could have "import micropython". On MicroPython,
that will be no-op. On CPython, that will give a chance to have a module
with placeholder decorators.
2014-01-16 19:29:11 +02:00
Paul Sokolovsky
c8742a06ca Add dummy micropython module to enable mandel.py run with CPython. 2014-01-16 19:29:11 +02:00
Paul Sokolovsky
d0db3d3e45 conwaylife.py: Give people chance to enjoy the show.
Delay between frames; run more generations.
2014-01-16 19:29:11 +02:00
Paul Sokolovsky
2aefde06b7 CPython pyb.py placeholder: Implement delay(). 2014-01-16 19:29:11 +02:00
Paul Sokolovsky
a671f891dd Make file.read() and file.read(-1) call out to file.readall().
Per Python3 io module semantics.
2014-01-16 12:58:36 +02:00
Paul Sokolovsky
323c09e881 Do not assume that vstr buf is the same after it was extended. 2014-01-16 12:58:18 +02:00
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.
2014-01-16 03:46:01 +02:00
Damien George
b99d9ea258 Add errno=0 before call. 2014-01-15 23:08:33 +00:00
Damien George
613eb25545 stm: Fix print methods with new kind argument. 2014-01-15 23:02:53 +00:00
Damien George
5573f9f150 Merge branch 'str2int' of github.com:xyb/micropython into xyb-str2int
Conflicts:
	py/objint.c
	unix-cpy/Makefile
	unix/Makefile
2014-01-15 22:58:39 +00:00
Damien George
4899ff9470 Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-repr
Conflicts:
	tests/basics/tests/exception1.py
2014-01-15 22:39:03 +00:00
Damien George
7a9d0c4540 Merge branch 'builtins' of github.com:chipaca/micropython into chipaca-builtins
Added some checks for number of arguments.

Conflicts:
	py/mpqstrraw.h
2014-01-15 22:27:16 +00:00
Damien George
11507f4074 Merge branch 'master' of github.com:dpgeorge/micropython 2014-01-15 22:14:18 +00:00
Damien George
d02c6d8962 Implement eval. 2014-01-15 22:14:03 +00:00
Paul Sokolovsky
9953ca432b Add unbuffered readline() implementation for Raw I/O files. 2014-01-15 23:43:25 +02:00
Damien George
e2fb2baaa4 Implement repr. 2014-01-15 21:40:48 +00:00
Damien George
9528cd66d7 Convert parse errors to exceptions.
Parser no longer prints an error, but instead returns an exception ID
and message.
2014-01-15 21:23:31 +00:00
xyb
3e4ed25138 add more tests and remove debug code 2014-01-15 20:37:17 +08:00
xyb
3270fb4be6 int() test passed 2014-01-15 19:58:11 +08:00
John R. Lenton
fca456bc3c added filter() 2014-01-15 01:37:08 +00:00
John R. Lenton
39b174e00a Added map 2014-01-15 01:10:09 +00:00
Paul Sokolovsky
36c4499d36 Implement str() and repr() builtin functions. 2014-01-15 02:15:47 +02:00
Paul Sokolovsky
76d982ef34 type->print(): Distinguish str() and repr() variety by passing extra param. 2014-01-15 02:15:38 +02:00
John R. Lenton
ff8007c7d6 Merge remote-tracking branch 'upstream/master' into builtins 2014-01-14 23:58:05 +00:00
Damien George
24224d7c72 Make GitHub logo/image a JPEG so it's smaller. 2014-01-14 23:55:53 +00:00
John R. Lenton
9daa78943e added enumerate() 2014-01-14 23:55:01 +00:00
Damien George
c6920d31e2 Merge pull request #170 from chipaca/master
made DEBUG control CFLAGS in Makefiles other than stm as well.
2014-01-14 15:54:31 -08:00
Damien George
0367ad6214 stm: Include libgcc for __aeabi_d2f and __aeabi_f2d functions.
Thanks to Dave Hylands for this.
2014-01-14 23:48:11 +00:00
Damien George
36b35c041b Merge pull request #163 from Metallicow/README-branch
Add combined image to GitHub front page README.md
2014-01-14 15:51:23 -08:00
Damien George
a04a33fee7 Merge pull request #175 from iabdalkader/master
Add missing ADC driver
2014-01-14 15:41:05 -08:00
Damien George
11cc694aa0 Merge pull request #173 from pfalcon/file-readall
Generic implementation if stream readall() method, immediately reused in unix io.FileIO implementation
2014-01-14 15:35:50 -08:00
Damien George
39eab8de96 Merge pull request #161 from pfalcon/exc-more-pythonic
Move towards Python-compliant interface of exceptions
2014-01-14 15:27:59 -08:00
Damien George
66a5bf681d Merge pull request #142 from chipaca/containment
Implemented support for `in` and `not in` operators.
2014-01-14 15:23:09 -08:00
Damien George
0f59203e37 Tidy up. 2014-01-14 23:18:35 +00:00
Damien George
6c2401e935 Merge pull request #165 from chipaca/builtins
added zip()
2014-01-14 15:13:40 -08:00
Paul Sokolovsky
8bc96471f0 Implement "is" and "is not" operators.
So far, don't work for strings as expected.
2014-01-15 00:32:09 +02:00
Paul Sokolovsky
ddf2178d83 Refactor exception objects to have better impl of Python-side interface.
This implements internal args tuple of arguments, while still keeping
object useful for reporting C-side errors.

Further elaboration is needed.
2014-01-15 00:03:23 +02:00
Paul Sokolovsky
8eec8bcad9 Add objtuple.h to allow embedding of tuples inside other objects.
This is useful because tuple is closest analog of C static array.
2014-01-14 23:59:18 +02:00
mux
8c10240722 Add ADC support for internal TEMP/VBAT/VREF
* Add ADC support for reading internal temperature sensor.
* Add ADC support for reading internal VREF/VBAT monitor.
2014-01-14 22:32:53 +02:00
mux
3591285091 Implement initial ADC support
* Add simple ADC driver, with support for ADC1 and all channels.
* Export MicroPython ADC object with read_channel function.
* Add stm32f4xx_adc.c and adc.c to Makefile.
2014-01-14 19:57:51 +02:00
mux
b4e374f138 Add missing ADC driver
* Add missing ADC driver from STM32F4xx_StdPeriph_Lib_V1.3.0
2014-01-14 19:51:15 +02:00
xyb
82e61bdc24 support int(str, basbase) 2014-01-14 22:43:18 +08:00
xyb
c178ea471e Implemented int(str) in UNIX 2014-01-14 21:39:05 +08:00
John R. Lenton
93451002f0 Merge remote-tracking branch 'upstream/master' into builtins
Conflicts:
	py/builtin.c
	py/builtin.h
	py/runtime.c
2014-01-13 23:14:35 +00:00
John R. Lenton
f5a0a7d2b3 Merge remote-tracking branch 'upstream/master' into containment 2014-01-13 23:09:04 +00:00
John R. Lenton
10d2f72860 Merge remote-tracking branch 'upstream/master' 2014-01-13 22:55:51 +00:00
Paul Sokolovsky
5225450b9f Add generic impl of stream .readall() method. Use one for unix io.FileIO. 2014-01-13 23:31:06 +02:00
Paul Sokolovsky
5d2499c638 Add "buffer management" and "shrink" API calls to vstr.
vstr is initially intended to deal with arbitrary-length strings. By
providing a bit lower-level API calls, it will be also useful to deal
with arbitrary-length I/O buffers (the difference from strings is that
buffers are filled from "outside", via I/O).

Another issue, especially aggravated by I/O buffer use, is alloc size
vs actual size length. If allocated 1Mb for buffer, but actually
read 1 byte, we don't want to keep rest of 1Mb be locked by this I/O
result, but rather return it to heap ASAP ("shrink" buffer before passing
it to qstr_from_str_take()).
2014-01-13 23:31:06 +02:00
Paul Sokolovsky
ca318bba0d mp_obj_equal(): Compare small and long ints properly.
By dispatching to long int methods.
2014-01-13 22:41:16 +02:00
Paul Sokolovsky
76a90f2f60 Move mp_obj_int_t definition to objint.h, to reuse in long int impls. 2014-01-13 22:36:49 +02:00