Commit Graph

1948 Commits

Author SHA1 Message Date
Paul Sokolovsky
f54bcbf099 py, unix: Make "mpconfig.h" be first included, as other headers depend on it.
Specifically, nlr.h does.
2014-05-02 17:48:40 +03:00
Paul Sokolovsky
e0954d426f objtype: Work around stupid strict aliasing check. 2014-05-02 17:48:40 +03:00
Damien George
ba742ed639 Add shell script to automatically build stmhal/ for all pyboards. 2014-05-02 13:49:44 +00:00
Paul Sokolovsky
e276753b45 tests: Add testcases for catching user Exception subclasses. 2014-05-02 02:31:30 +03:00
Paul Sokolovsky
91e556af23 objexcept: Support tracebacks for user Exception subclasses. 2014-05-02 02:31:30 +03:00
Paul Sokolovsky
0a7e01ae3c objtype: Rename mp_obj_class_t -> mp_obj_instance_t and move to local header.
TODO: Rename methods.
2014-05-02 02:14:38 +03:00
Paul Sokolovsky
d8351ca8a0 objtype: .print() Exception instances in adhoc way.
This is ugly, just as expected.
2014-05-02 02:00:47 +03:00
Damien George
f2021ffe0f Merge pull request #542 from dhylands/fix-pin
Fix pin initialization when a mode argument is provided
2014-05-01 23:26:28 +01:00
Damien George
20c23c31be Merge pull request #536 from lurch/patch-1
Add flashboard target to the stmhal Makefile to run dfu-util
2014-05-01 23:25:57 +01:00
Paul Sokolovsky
28dfbc2ba2 Merge pull request #544 from lurch/fix-minmax
Fix the builtin min() and max() functions (and add tests).
2014-05-01 23:42:18 +03:00
Paul Sokolovsky
7917b731f6 objfun: More debug logging. 2014-05-01 23:22:11 +03:00
Paul Sokolovsky
5ba58f4a1a objgenerator: Fix check for too few args passed to gen function. 2014-05-01 23:22:11 +03:00
Paul Sokolovsky
c3103b55c1 objgenerator: .print(): Output real underlying function name. 2014-05-01 23:22:11 +03:00
Andrew Scheller
37067666ee Fix the builtin min() and max() functions (and add tests).
Fixes #539
2014-05-01 21:21:43 +01:00
Dave Hylands
e911cfdb22 Fix pin initialization when a mode argument is provided 2014-05-01 12:15:37 -07:00
Andrew Scheller
ed9d8d6354 Add flashboard target to the stmhal Makefile to run dfu-util
Which allows you to run "make -C stmhal flashboard" from the top-level directory.
Also ties in nicely with my configurable BUILD directory from #506
2014-05-01 02:51:29 +01:00
Paul Sokolovsky
1f85d6255d py: Add tentative scheme for error messages configuration. 2014-05-01 01:50:35 +03:00
Paul Sokolovsky
68551a8428 objfun: Add function name accessor and .print slot method. 2014-05-01 01:50:35 +03:00
Damien George
dddf5bd330 Merge branch 'master' of github.com:micropython/micropython 2014-04-30 23:34:25 +01:00
Damien George
f4b7e9bd2e stmhal, docs: Small changes to URL links; adds list of files if none given.
This documentation is now available at micropython.org/doc/
2014-04-30 23:33:30 +01:00
Damien George
37977b7b27 Merge pull request #528 from pfalcon/native-subclass1
Initial support for subclassing native types
2014-04-30 21:02:50 +01:00
Damien George
4ae52d454c stmhal: Reinstate CC3000 driver from old stm/ port.
It's not enabled by default because it doesn't fully work.  It can
connect to an AP, get an IP address and do a host-lookup, but not yet do
send or recv on a socket.
2014-04-30 20:47:50 +01:00
Damien George
cab23051d9 stmhal: Make LED.intensity return the same value it was set to.
Also give proper error message when trying to construct a non-existent
LED.

Addresses issue #530.
2014-04-30 19:23:21 +01:00
Paul Sokolovsky
22d0598818 objfun: Factor out function to report positional args mismatch. 2014-04-30 05:37:28 +03:00
Paul Sokolovsky
e908591baa py: Abstract no-return attribute for functions a bit. 2014-04-30 05:35:18 +03:00
Paul Sokolovsky
b1ce37d32e py: If setjmp NLR implementation is forced, omit native versions. 2014-04-30 04:19:20 +03:00
Paul Sokolovsky
851c856585 nlr.h: As we treat all warnings as errors, can't use #warning.
And this is not good.
2014-04-30 04:14:31 +03:00
Paul Sokolovsky
c963310123 tests: Add test for calling inherited native method on subclass. 2014-04-30 02:17:45 +03:00
Paul Sokolovsky
7f0419c0e5 objtype: Support calling normal methods inherited from native base class.
Biggest part of this support is refactoring mp_obj_class_lookup() to return
standard "bound member" pair (mp_obj_t[2]). Actual support of inherited
native methods is 3 lines then. Some inherited features may be not supported
yet (e.g. native class methods, native properties, etc., etc.). There may
be opportunities for further optimization too.
2014-04-30 02:14:30 +03:00
Damien George
da9f27103d stmhal: Oops, typo. 2014-04-29 23:00:48 +01:00
Damien George
8d09640b22 stmhal: Add documentation in comments, and script to generate HTML.
Decided to write own script to pull documentation from comments in C code.
Style for writing auto generated documentation is: start line with ///
and then use standard markdown to write the comment.  Keywords
recognised by the scraper begin with backslash.  See code for examples.

Running: python gendoc.py modpyb.c accel.c adc.c dac.c extint.c i2c.c
led.c pin.c rng.c servo.c spi.c uart.c usrsw.c, will generate a HTML
structure in gendoc-out/.

gendoc.py is crude but functional.  Needed something quick, and this was
it.
2014-04-29 22:55:34 +01:00
Paul Sokolovsky
5a12137c3e tests: Add test for accessing attribute of inherited native type. 2014-04-29 20:31:13 +03:00
Paul Sokolovsky
443857de98 objtype: Add support for looking up non-method attrs in native base class. 2014-04-29 20:31:13 +03:00
Paul Sokolovsky
4f46c441ef tests: Add basic tests for subclassing native types and using special methods.
Even of these, some features do not yet work as expected.
2014-04-29 20:31:13 +03:00
Paul Sokolovsky
6ead0d2fbc objtype: Implement basic framework for subclassing native types.
This implements checking of base types, allocation and basic initialization,
and optimized support for special method lookups. Other features are not yet
supported.
2014-04-29 20:31:13 +03:00
Damien George
186e463a9e py: Fix bug in map lookup of interned string vs non-interned.
Had choice of either interning or forcing full equality comparison, and
chose latter.  See comments in mp_map_lookup.

Addresses issue #523.
2014-04-28 12:11:57 +01:00
Damien George
185f9c1c46 py: Fix lexerunix, where not all data may be read from a file.
Addresses issue #526.
2014-04-28 11:43:28 +01:00
Damien George
0c8fcb9c49 py: Remove silly comment about interning keywords.
Of course, keywords are turned into lexer tokens in the lexer, so will
never need to be interned (unless you do something like x="def").

As it is now, the following on pyboard makes no new qstrs:

    import pyb
    pyb.info()
2014-04-28 09:56:31 +01:00
Paul Sokolovsky
a224067846 py: Clear allocated, but unused memory in containers.
Also, clear up freed slots in containers.

As a follow up to 32bef315be.
2014-04-28 00:33:21 +03:00
Paul Sokolovsky
7ce6a8fe46 objlist: We no longer need to assert on mem alloc results.
They either succeed or raise exception.
2014-04-28 00:33:21 +03:00
Paul Sokolovsky
48bf6b3bd0 objlist: Use static small int constructor. 2014-04-28 00:33:21 +03:00
Damien George
708c073250 py: Add '*' qstr for 'import *'; use blank qstr for comprehension arg. 2014-04-27 19:23:46 +01:00
Damien George
968bf34c4c py: Remove unnecessary LOAD_CONST_ID bytecode.
It's the same as LOAD_CONST_STR.
2014-04-27 19:12:05 +01:00
Damien George
db12891918 py: Eliminate 'op' variable in VM dispatch loop.
Remembering the last op is rarely needed, and when it is, can simply use
*save_ip.
2014-04-27 18:19:06 +01:00
Damien George
9d181f62dc py: Save some ROM by shortening compiler error messages.
Messages are still explanatory, while taking a little less ROM.
2014-04-27 16:55:27 +01:00
Damien George
2c0842b3c5 py: Change the way function arguments are compiled.
New way uses slightly less ROM and RAM, should be slightly faster, and,
most importantly, allows to catch the error "non-keyword arg following
keyword arg".

Addresses issue #466.
2014-04-27 16:46:51 +01:00
Damien George
2827d62e8b py: Implement keyword-only args.
Implements 'def f(*, a)' and 'def f(*a, b)', but not default
keyword-only args, eg 'def f(*, a=1)'.

Partially addresses issue #524.
2014-04-27 15:50:52 +01:00
Damien George
36cbd0db7e Merge branch 'master' of github.com:micropython/micropython 2014-04-26 22:24:45 +01:00
Damien George
32bef315be py, gc: Only zero out the extra bytes at the end of the heap chunk.
This is a small optimisation to zero out only the additional bytes that
the caller did not ask for.
2014-04-26 22:23:42 +01:00
Paul Sokolovsky
27f5bdd6d4 py: "read" & "write" are so common that make them core.
Few other strings move to core, but make depend on "io" module.
2014-04-26 21:15:56 +03:00