Paul Sokolovsky
027594e1a7
Typo fixes in comments.
11 years ago
xbe
480c15afb5
Implement str.replace and add tests for it.
11 years ago
Damien George
3f759b71c6
py: Add MICROPY_ENABLE_FLOAT around a float specific piece of code.
11 years ago
Damien George
39631bc312
Fix Makefiles: -O3 option was not being applied; mkdir for STM.
11 years ago
Paul Sokolovsky
382e8eeea2
vm: Add basic implementation of END_FINALLY opcode.
Allows to have nested try blocks with except filters.
TODO: Don't add END_FINALLY's exception re-raise points to traceback.
11 years ago
Damien George
09a0c64bce
py: Improve __bool__ and __len__ dispatch; add slots for them.
11 years ago
Paul Sokolovsky
c1d9bbc345
Implement __bool__ and __len__ via unary_op virtual method for all types.
__bool__() and __len__() are just the same as __neg__() or __invert__(),
and require efficient dispatching implementation (not requiring search/lookup).
type->unary_op() is just the right choice for this short of adding
standalone virtual method(s) to already big mp_obj_type_t structure.
11 years ago
Paul Sokolovsky
cdd2c62e07
realloc(): Log original memory ptr too.
To alloc complete memory alloc flow tracing.
11 years ago
Damien George
62ad189a65
py: Add compile option to enable/disable source line numbers.
11 years ago
Damien George
2d15c1216d
stm: Add optional memory debugging output.
11 years ago
Damien George
d0691ccaec
py: Simplify fastn in VM; reduce size of unique code struct.
We still have FAST_[0,1,2] byte codes, but they now just access the
fastn array (before they had special local variables). It's now
simpler, a bit faster, and uses a bit less stack space (on STM at least,
which is most important).
The only reason now to keep FAST_[0,1,2] byte codes is for compressed
byte code size.
11 years ago
Damien George
08d075592f
py: Fix bug with LOAD_METHOD; fix int->machine_int_t for small int.
LOAD_METHOD bug was: emitbc did not correctly calculate the amount of
stack usage for a LOAD_METHOD operation.
small int bug was: int was being used to pass small ints, when it should
have been machine_int_t.
11 years ago
Damien George
1ba1facaaa
py: Msg in exception is no longer interned.
11 years ago
Damien George
4d5b28cd08
Add qstr_info() function and bindings for unix port.
11 years ago
Damien George
e4b6a079b3
py: Implement 'not' in compiler, and improve rt_is_true.
11 years ago
Paul Sokolovsky
7f11c794a5
mp_obj_new_bytearray_by_ref(): Allow to create array by reference.
This is special feature for FFI.
11 years ago
Markus Siemens
242856cfbf
Fixed problems with nlx86.S on Linux
Fixed '#ifdef's so Linux would compile again and added
.scl and .type for Windows.
11 years ago
Markus Siemens
19ccc6bdc7
Added Windows port (see #233 )
11 years ago
Paul Sokolovsky
1801421f6d
bytearray: Print objects properly.
11 years ago
Paul Sokolovsky
0b7e29c025
Factor out quoted string print function for reuse (mp_str_print_quoted()).
11 years ago
Paul Sokolovsky
7e652af242
array: CPython prints empty arrays inconsistently (only typecode, no []).
11 years ago
Paul Sokolovsky
0dd0467a97
Don't pre-import array module.
11 years ago
Paul Sokolovsky
11973b48b5
array.array: Allow to create empty arrays.
11 years ago
Damien George
4e8dc8c41b
py: Add unary op not for NoneType, bool, tuple, list, dict; fix for int.
11 years ago
Paul Sokolovsky
9b00dad7bb
long int: Implement more operations.
11 years ago
mux
00a4da93e8
Fix implicit double conversion warning
11 years ago
Paul Sokolovsky
ddf1aa9223
list.pop(): Don't allow ->alloc drop to zero, which causes unexpected behavior.
11 years ago
Paul Sokolovsky
14d28be344
gen.send(): Throw StopIteration. Also, explicitly shutdown finished gen.
Otherwise, some generator statements still may be spuriously executed on
subsequent calls to next()/send().
11 years ago
Paul Sokolovsky
bf38e2a03a
Implement send() method for generators.
11 years ago
Paul Sokolovsky
9d95a2b21d
Functions of fixed number of args are special-cased only for 3 or less args.
11 years ago
Paul Sokolovsky
2ca84aa01e
Add MP_OBJ_IS_INT(), for symmetry with MP_OBJ_IS_STR().
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
b829b5caec
Implement mp_parse_node_free; print properly repr(string).
11 years ago
Damien George
28eb57786d
py: Optimise generated code for working out line numbers.
11 years ago
Damien George
2259e62c37
Remove obsoleted comment.
11 years ago
Damien George
7c9c667633
py: Implement iterator support for object that has __getitem__.
Addresses Issue #203 .
11 years ago
Paul Sokolovsky
aee2ba70de
Add parse_node_free_struct() and use it to free parse tree after compilation.
TODO: Check lexer/parse/compile error path for leaks too.
11 years ago
Paul Sokolovsky
c1d200ef74
rt_deinit(): Finalize some maps.
11 years ago
Paul Sokolovsky
9a24a0465f
Add mp_map_deinit() & mp_map_free() to finalize maps.
mp_map_deinit() finalizes static map, mp_map_free() - dynamic.
11 years ago
Damien George
0004a84ec0
Revert "Move gc_collect to py/gc.c"
This reverts commit a215b09c0d
.
11 years ago
Damien George
41d02b654e
py: Improve freeing of emitters in mp_compile.
There can be multiple emitters allocated during compile (eg byte code
and native).
11 years ago
Damien George
1976baeeb7
Retain file order of qstr definitions.
Want common qstrs to be first in the list so they have the lowest ids,
so that in the byte code they take up the least room.
11 years ago
Paul Sokolovsky
91fb1c9b13
Add basic implementation of bytes type, piggybacking on str.
This reuses as much str implementation as possible, from this we
can make them more separate as needed.
11 years ago
mux
a215b09c0d
Move gc_collect to py/gc.c
* Move gc_collect from main to py/gc.c
* Define GC's memory boundaries in linker script
* Issue #220
11 years ago
Dave Hylands
c89c681a9f
Rework makefiles. Add proper dependency checking.
11 years ago
Paul Sokolovsky
f46d87a30d
Add support for freeing code emitter objects at the end of compilation.
11 years ago
Paul Sokolovsky
39763c6cb0
lexerstr: Free mp_lexer_str_buf_t structure itself.
11 years ago
Paul Sokolovsky
ab5d08280b
Allow qstr's with non-ident chars, construct good identifier for them.
Also, add qstr's for string appearing in unix REPL loop, gross effect
being less allocations for each command run.
11 years ago
Paul Sokolovsky
fd31358505
mp_compile(): Properly free module_scope and all nested scopes.
11 years ago
Paul Sokolovsky
624ed5d563
mp_lexer_free(): Free lex->indent_level array.
11 years ago