Paul Sokolovsky
21c51f0bde
ffi: Fix mp_obj_str_get_data() return type.
11 years ago
Paul Sokolovsky
1e19b24ea0
io.File, socket types: Add fileno() method.
Implementation is duplicated, but tolerate this for now, because there's
no clear idea how to de-dup it.
11 years ago
Paul Sokolovsky
9945f33886
Rename "rawsocket" module to "microsocket".
It's no longer intended to provide just "raw" socket interface, may include
some convenience methods for compatibility with CPython socket - but anyway
just minimal set required to deal with socket client and servers, not wider
network functionality.
11 years ago
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.
11 years ago
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.
11 years ago
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.
11 years ago
Damien George
23177088d2
stm: Mount SD card on 1:/ if present.
If SD card is present on (soft) reset then it's mounted on 1:/ and files
can be openned using, eg, open('1:/test.txt', 'r'), or 'w' for writing.
11 years ago
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.
11 years ago
Damien George
354d15a964
Implement fixed buffer vstrs; use them for import path.
11 years ago
Damien George
64131f3215
Add staticmethod and classmethod to builtin namespace.
11 years ago
Damien George
ddaf6c112c
py: More output in showbc.
11 years ago
Damien George
bbcd49a496
py: Fix compile of class with keyword arguments in bases.
11 years ago
Damien George
4a081b1001
Add mp_import_stat to unix-cpy port.
11 years ago
Paul Sokolovsky
9fce77c993
Add more finally + break/continue testcases.
11 years ago
Paul Sokolovsky
3c95ba7e4e
Add additional testcase for finally/return.
11 years ago
Damien George
e09ffa1400
Search paths properly on import and execute __init__.py if it exists.
11 years ago
Damien George
cdcb4906d4
Merge pull request #262 from pfalcon/sys-path
Implement sys.path support
11 years ago
Damien George
b8ec17c2d1
py: Fix bug with dual initialisation of RT_UNARY_OP_NOT.
Fixes Issue #261 .
11 years ago
Damien George
35e2a4e6bb
py: Add built-in super.
11 years ago
Paul Sokolovsky
9110896063
Remove older import helpers, no longer used.
11 years ago
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.
11 years ago
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.
11 years ago
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.
11 years ago
Paul Sokolovsky
6e6b888e31
Add generic MIN()/MAX() functions.
11 years ago
Damien George
e0723497b3
Merge pull request #259 from dhylands/netduino
Initial support for Netduino
11 years ago
Paul Sokolovsky
e5a15cb7a5
mp_obj_new_list(n, items): Copy items only if not-NULL.
Similar to mp_obj_new_tuple().
11 years ago
Paul Sokolovsky
0c59db1973
Use qstr id to create sys module.
11 years ago
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.
11 years ago
Paul Sokolovsky
7cd54d79db
Add ImportError.
11 years ago
Paul Sokolovsky
00c0b8a989
Fix unstable case in builtin_id.py test.
11 years ago
Paul Sokolovsky
1d938c9503
Expose __import__() function.
11 years ago
Damien George
ca4767984b
py: Implement builtin exec.
11 years ago
Damien George
4acb2452b3
py: Add very basic implementation of dir() builtin.
Only works on modules and class instances.
11 years ago
Paul Sokolovsky
0473e2790b
Fix thinko with how bitfields were added to mp_obj_fun_native_t.
Structure is back to expected 16 bytes.
11 years ago
Damien George
93d004f4b0
Merge branch 'xbe-master'
11 years ago
Damien George
330cf6d04a
Change id to return signed integer.
11 years ago
Damien George
09e1f43200
Merge branch 'master' of github.com:micropython/micropython
11 years ago
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.
11 years ago
Paul Sokolovsky
ea2509d92c
Fix assert() usage.
11 years ago
Paul Sokolovsky
6964422cf4
unix time.clock(): Actually return float value.
11 years ago
Paul Sokolovsky
87e85b7dc7
Implement str/bytes rich comparisons.
11 years ago
xbe
0ebf8534ab
Implement and add tests for the id() builtin function.
11 years ago
Paul Sokolovsky
9ed5435061
Implement slicing for tuples.
11 years ago
Paul Sokolovsky
13cfabd1b2
Implement slicing for lists.
11 years ago
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.
11 years ago
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).
11 years ago
Paul Sokolovsky
513e6567b1
Add testcase for sequence unpacking.
11 years ago
Paul Sokolovsky
edbdf71f5c
rt_unpack_sequence(): Support generic iterables.
11 years ago
Damien George
48697f1dd2
Tidy up some comments.
11 years ago
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.
11 years ago