Andrew Scheller
902d9552c5
Replace some Makefile commands with variables in py/mkenv.mk
11 years ago
Damien George
ecf5b77123
py: This time, real proper overflow checking of small int power.
Previous overflow test was inadequate.
11 years ago
Dave Hylands
bf7d690e36
Add the git version to the banner
11 years ago
Paul Sokolovsky
98a627dc03
py: Add "io" module.
So far just includes "open" function, which should be supplied by a port.
TODO: Make the module #ifdef'ed.
11 years ago
Dave Hylands
baf6f14deb
Enhance str.format support
This adds support for almost everything (the comma isn't currently
supported).
The "unspecified" type with floats also doesn't behave exactly like
python.
Tested under unix with float and double
Spot tested on stmhal
11 years ago
Damien George
2326d52d20
py: Factor out code from runtime.c to emitglue.c.
11 years ago
Damien George
caac542b23
Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files. All modules
are now named mod*.[ch].
11 years ago
Damien George
3ec0a1a32d
py: Add 'object' object.
11 years ago
Rachel Dowdall
cde8631f15
Fixed modulo operator on ints and mp ints to agree with python. Added intdivmod.c and tests/basics/modulo.py.
11 years ago
Damien George
8bfec2b538
Rename formatfloat file; remove MICROPY_ENABLE_FLOAT from mpconfigport.h.
MICROPY_ENABLE_FLOAT is automatically set in mpconfig.h if MICROPY_FLOAT_IMPL
is set to a non-zero value.
11 years ago
Dave Hylands
ca5a241e48
Add proper floating point printing support.
11 years ago
Damien George
0c36da0b59
Implement ROMable modules. Add math module.
mp_module_obj_t can now be put in ROM.
Configuration of float type is now similar to longint: can now choose
none, float or double as the implementation.
math module has basic math functions. For STM port, these are not yet
implemented (they are just stub functions).
11 years ago
Paul Sokolovsky
d08fd68664
Add basic collections.namedtuple implementation.
11 years ago
Damien George
06201ff3d6
py: Implement bit-shift and not operations for mpz.
Implement not, shl and shr in mpz library. Add function to create mpzs
on the stack, used for memory efficiency when rhs is a small int.
Factor out code to parse base-prefix of number into a dedicated function.
11 years ago
Damien George
438c88dd2f
Add arbitrary precision integer support.
Some functionality is still missing (eg and, or, bit shift), and some
things are buggy (eg subtract).
11 years ago
Damien George
2077397118
py: Put number parsing code together in parsenum.c.
11 years ago
Damien George
c5966128c7
Implement proper exception type hierarchy.
Each built-in exception is now a type, with base type BaseException.
C exceptions are created by passing a pointer to the exception type to
make an instance of. When raising an exception from the VM, an
instance is created automatically if an exception type is raised (as
opposed to an exception instance).
Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.
Handling of parse error changed to match new exceptions.
mp_const_type renamed to mp_type_type for consistency.
11 years ago
Paul Sokolovsky
8bc3516389
ffi: Implement ffivar.get()/set() methods.
Done by introducing another factored out helper API in binary.c. This API
can be reused also by array and struct modules.
11 years ago
Damien George
ca4767984b
py: Implement builtin exec.
11 years ago
Damien George
39631bc312
Fix Makefiles: -O3 option was not being applied; mkdir for STM.
11 years ago
Dave Hylands
1a3b0d5fed
Fixed dependency problem for qstrdefs.generated.h
The problem manifests itself in make 4.0
I also fixed the LINK message when linking the final executable for unix and unix-cpy.
11 years ago
Damien George
7c9c667633
py: Implement iterator support for object that has __getitem__.
Addresses Issue #203 .
11 years ago
Dave Hylands
c89c681a9f
Rework makefiles. Add proper dependency checking.
11 years ago
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
11 years ago
Paul Sokolovsky
439542f70c
sequence.c: Start to refactor sequence operations for reuse among types.
11 years ago
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.
11 years ago
Paul Sokolovsky
427905cedd
Add skeleton implementation of array.array and bytearray.
So far, only storage, initialization, repr() and buffer protocol is
implemented - alredy suitable for passing binary data around.
11 years ago
Paul Sokolovsky
966879cf59
Add long int implementation using C long long type, enable for unix port.
11 years ago
Damien George
d02c6d8962
Implement eval.
11 years ago
John R. Lenton
fca456bc3c
added filter()
11 years ago
John R. Lenton
39b174e00a
Added map
11 years ago
John R. Lenton
9daa78943e
added enumerate()
11 years ago
xyb
c178ea471e
Implemented int(str) in UNIX
11 years ago
John R. Lenton
07205ec323
added zip()
11 years ago
Damien George
062478e66d
Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr.
Creating of classes (types) and instances is much more like CPython now.
You can use "type('name', (), {...})" to create classes.
11 years ago
Dave Hylands
4646801181
Make build output quieter.
Use make V=1e make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
This should fix issue #117
11 years ago
Paul Sokolovsky
e98cf40c34
Add generic implementations of Python read()/write methods for streams.
These can be used for any object which implements stream protocol
(mp_stream_p_t).
11 years ago
Damien George
9193f89296
Move lexerstr to main py directory (everyone uses it).
11 years ago
John R. Lenton
9c83ec0eda
Merge remote-tracking branch 'upstream/master' into dict_feats
11 years ago
Damien George
136f67523b
Factor and simplify Makefile's and mpconfig.
11 years ago
Damien George
71c5181a8d
Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
11 years ago
Paul Sokolovsky
d674bd5989
Convert USE_READLINE config option to be consistent with others.
11 years ago
Damien George
e67ed5d285
Improve configurability for native x64/thumb emitter.
With MICROPY_EMIT_X64 and MICROPY_EMIT_THUMB disabled, the respective
emitters and assemblers will not be included in the code. This can
significantly reduce binary size for unix version.
11 years ago
Paul Sokolovsky
1c6de11f77
Add basic implementation of slice object.
So far, only start and stop integer indexes are supported. Step is
not supported, as well as objects of arbitrary types.
11 years ago
Paul Sokolovsky
b372bfca21
Rename default config file to mpconfig.h, and port's to mpconfigport.h.
mpconfig.h will automatically pull mpconfigport.h.
11 years ago
Damien George
66028ab6dc
Basic implementation of import.
import works for simple cases. Still work to do on finding the right
script, and setting globals/locals correctly when running an imported
function.
11 years ago
Damien George
2870862601
Add module object, to be used eventually for import.
11 years ago
Damien George
210a02e105
unix: revert Makefile to not use -ltermcap.
termcap is not needed on Linux. Need to work out how to automatically
configure the Makefile...
11 years ago
Edd Barrett
0d02eb178a
Fix undefined termcap symbols on OpenBSD.
E.g.:
/usr/lib/libreadline.so.4.0: undefined reference to `tgetnum'
/usr/lib/libreadline.so.4.0: undefined reference to `tgoto'
/usr/lib/libreadline.so.4.0: undefined reference to `tgetflag'
/usr/lib/libreadline.so.4.0: undefined reference to `tputs'
/usr/lib/libreadline.so.4.0: undefined reference to `tgetent'
/usr/lib/libreadline.so.4.0: undefined reference to `tgetstr'
Tested on linux too, works.
11 years ago
Paul Sokolovsky
fa027672da
Make GNU Readline usage optional (USE_READLINE define). Still enabled.
Readline is GPL, so linking with it casts the binary GPL.
11 years ago