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
630d85120f
unix: Be sure to add current/base dir of a script to sys.path.
...
This mirrors CPython behavior and makes possible to run scripts which
import other modules not from script's directory.
2014-02-05 01:53:44 +02:00
Paul Sokolovsky
625d08a93e
unix: Initialize sys.path from MICROPYPATH environment variable.
...
If it's not available, "~/.micropython/lib:/usr/lib/micropython" is used
as a fallback.
2014-02-05 01:40:41 +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
Damien George
e0723497b3
Merge pull request #259 from dhylands/netduino
...
Initial support for Netduino
2014-02-04 14:11:32 -08: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
Dave Hylands
1570a96cad
Initial support for Netduino
...
This also fixes up the IRQ for the PYBOARD4 USERSW
although I was unable to test that functionality.
2014-02-03 23:26:05 -08:00
Paul Sokolovsky
7cd54d79db
Add ImportError.
2014-02-04 03:33:55 +02:00
Paul Sokolovsky
00c0b8a989
Fix unstable case in builtin_id.py test.
2014-02-04 00:50:22 +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
6964422cf4
unix time.clock(): Actually return float value.
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
Paul Sokolovsky
7364af2d8c
Factor out m_seq_get_fast_slice_indexes() fucntions as sequence helper.
...
Takes slice object and sequence length and computes subsequence indexes
for case of slice step=1.
2014-02-02 02:38:22 +02:00
Paul Sokolovsky
a9459bc723
unix: Add basic time module (with time() and clock() functions).
...
Both return int so far (single-precision float doesn't have enough
bits to represent int32 precisely).
2014-02-02 01:34:11 +02:00
Paul Sokolovsky
513e6567b1
Add testcase for sequence unpacking.
2014-02-02 01:34:11 +02:00
Paul Sokolovsky
edbdf71f5c
rt_unpack_sequence(): Support generic iterables.
2014-02-02 01:34:11 +02:00
Damien George
48697f1dd2
Tidy up some comments.
2014-02-01 23:32:29 +00:00
Damien George
9aa2a527b5
py: Tidy up BINARY_OPs; negation done by special NOT bytecode.
...
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
2014-02-01 23:04:09 +00:00
Damien George
7e5fb24e3b
py: Reduce code size of compiler by a bit.
2014-02-01 22:18:47 +00:00
Damien George
e24b563796
py: Fix emitcpy so continue is compatible with CPython.
2014-02-01 21:56:25 +00:00
Damien George
cbddb279bb
py: Implement break/continue from an exception with finally.
...
Still todo: break/continue from within the finally block itself.
2014-02-01 20:08:18 +00:00
Damien George
a908202d60
unix: libffi include path now found using pkg-config.
...
Hopefully this works for other people as well :)
2014-02-01 18:48:19 +00:00
Damien George
6fcaea6ca8
Merge pull request #254 from pfalcon/config-modules
...
Add mpconfigport.mk file to configure which modules to include into build
2014-02-01 10:44:17 -08:00
Damien George
fb083ea986
py: mp_execute_byte_code has 2 arg arrays, for more efficient default params.
2014-02-01 18:29:40 +00:00
Paul Sokolovsky
ed1239fce6
Add mpconfigport.mk file to configure which modules to include into build.
...
Proof of concept, controls "ffi" module as one which requires external
dependencies.
2014-02-01 20:09:45 +02:00
Damien George
87413a4d0c
Merge branch 'fun-defargs' of github.com:pfalcon/micropython into pfalcon-fun-defargs
2014-02-01 17:51:47 +00:00
Damien George
382b3d00ed
Merge pull request #251 from pfalcon/return_unwind
...
Add exception stack unwind support for RETURN_VALUE.
2014-02-01 09:10:47 -08:00
Damien George
d71cd86dc1
Merge branch 'iabdalkader-master'
...
Conflicts:
stm/usb.c
stm/usb.h
2014-02-01 16:17:06 +00:00
Damien George
01156d510c
stm: Add support for ctrl-C to interrupt running Python.
...
Using PendSV interrupt at lowest priority, code can now raise an
exception during an interrupt by calling pendsv_nlr_jump. The exception
will be raised when all interrupts are finished. This is used to trap
ctrl-C from the USB VCP to break out of running Python code.
2014-02-01 16:04:34 +00:00
mux
565fdccfd2
Add usb_vcp_connected prototype to usb.h
2014-02-01 15:49:16 +02:00
Paul Sokolovsky
90750029df
Implement default function arguments (for Python functions).
...
TODO: Decide if we really need separate bytecode for creating functions
with default arguments - we would need same for closures, then there're
keywords arguments too. Having all combinations is a small exponential
explosion, likely we need just 2 cases - simplest (no defaults, no kw),
and full - defaults & kw.
2014-02-01 15:38:22 +02:00
Paul Sokolovsky
6472dea146
Add exception stack unwind support for RETURN_VALUE.
...
This properly implements return from try/finally block(s).
TODO: Consider if we need to do any value stack unwinding for RETURN_VALUE
case. Intuitively, this is "success" return, so value stack should be in
good shape, and unwinding shouldn't be required.
2014-02-01 15:23:03 +02:00
mux
b2269b610e
Detect VCP line state.
...
* Detect VCP line state, based on SET_CONTROL_LINE_STATE request
2014-02-01 13:28:29 +02:00
Damien George
532f2c30f6
Merge pull request #246 from pfalcon/exc_stack_entry
...
vm: Introduce structure for exception stack entry, record entry type.
2014-01-31 15:51:20 -08:00
Damien George
8b56beb1a1
py: Simplified rt_call_function_n_kw.
2014-01-31 23:49:49 +00:00