summaryrefslogtreecommitdiff
path: root/unix/main.c
AgeCommit message (Collapse)Author
2015-03-21unix: Bump stack limit and adjust for 64-bitness.Paul Sokolovsky
Without that, "import http.client" failed due to max recursion.
2015-03-13unix: Support readline history saving to file, improves interactive usage.Paul Sokolovsky
2015-02-07py: Protect mp_parse and mp_compile with nlr push/pop block.Damien George
To enable parsing constants more efficiently, mp_parse should be allowed to raise an exception, and mp_compile can already raise a MemoryError. So these functions need to be protected by an nlr push/pop block. This patch adds that feature in all places. This allows to simplify how mp_parse and mp_compile are called: they now raise an exception if they have an error and so explicit checking is not needed anymore.
2015-01-20py, unix, stmhal: Allow to compile with -Wshadow.Damien George
See issue #699.
2015-01-16unix: Add target to build "minimal" uPy interpreter.Damien George
2015-01-16py, unix: Allow to compile with -Wsign-compare.Damien George
See issue #699.
2015-01-12py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George
2015-01-07py: Put all global state together in state structures.Damien George
This patch consolidates all global variables in py/ core into one place, in a global structure. Root pointers are all located together to make GC tracing easier and more efficient.
2015-01-01unix: Prefix includes with py/; remove need for -I../py.Damien George
2014-12-29py: Add include guards to mpconfig,misc,qstr,obj,runtime,parsehelper.Damien George
2014-12-19unix/windows: Make sure that process exit code is portable 8-bit value.Paul Sokolovsky
This fixes FORCED_EXIT internal flag leaking into Windows exit code.
2014-12-10py: Make functions static where appropriate.Damien George
2014-12-08modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky
The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
2014-12-05py: Optimise lexer by exposing lexer type.Damien George
mp_lexer_t type is exposed, mp_token_t type is removed, and simple lexer functions (like checking current token kind) are now inlined. This saves 784 bytes ROM on 32-bit unix, 348 bytes on stmhal, and 460 bytes on bare-arm. It also saves a tiny bit of RAM since mp_lexer_t is a bit smaller. Also will run a bit more efficiently.
2014-12-01modmicropython: Move mem_info() and qstr_info() functions from unix port.Paul Sokolovsky
TODO: Merge useful functionality from modpyb too.
2014-11-05unix: Allow -X heapsize number take 'w' specifier for word size adjustment.Paul Sokolovsky
The specifier should go after the number, before size suffix like 'k' or 'm'. E.g.: "-X heapsize=100wk" will use 100K heap on 32-bit system and 200K - on 64-bit.
2014-10-26unix: Make -v dump memory info at exit.Paul Sokolovsky
Also, move bytecode dumps to -v -v, because they're too verbose for just -v.
2014-10-26unix: Implement -m option (execute module from stdlib).Paul Sokolovsky
Support for packages as argument not implemented, but otherwise error and exit handling should be correct. This for example will allow to do: pip-micropython install micropython-test.pystone micropython -m test.pystone
2014-10-26unix/windows: Disable sigaction on windows port.Damien George
2014-10-25py: Add mp_pending_exception global variable, for VM soft interrupt.Damien George
This allows to implement KeyboardInterrupt on unix, and a much safer ctrl-C in stmhal port. First ctrl-C is a soft one, with hope that VM will notice it; second ctrl-C is a hard one that kills anything (for both unix and stmhal). One needs to check for a pending exception in the VM only for jump opcodes. Others can't produce an infinite loop (infinite recursion is caught by stack check).
2014-10-25unix: Allow -X heapsize= option take numbers with K & M suffixes.Paul Sokolovsky
For kilobytes and megabytes respectively.
2014-10-24py: Improve memory usage debugging; better GC AT dumping.Damien George
In unix port, mem_info(1) now prints pretty GC alloc table.
2014-10-17unix: Make -c option parse input script as a file, as per CPython.Damien George
Addresses issue #915.
2014-10-09unix: Rename "microsocket" module to "usocket".Paul Sokolovsky
Per new conventions, we'd like to consistently use "u*" naming conventions for modules which don't offer complete CPython compatibility, while offer subset or similar API.
2014-10-05unix: Detect and print compile error.Damien George
2014-10-03py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.Damien George
This should pretty much resolve issue #50.
2014-10-01unix: Do a proper clean-up on sys.exit/SystemExit.Damien George
Addresses issue #859.
2014-09-25py: For malloc and vstr functions, use size_t exclusively for int type.Damien George
It seems most sensible to use size_t for measuring "number of bytes" in malloc and vstr functions (since that's what size_t is for). We don't use mp_uint_t because malloc and vstr are not Micro Python specific.
2014-09-15py: Move definition of mp_sys_exit to core.Damien George
sys.exit always raises SystemExit so doesn't need a special implementation for each port. If C exit() is really needed, use the standard os._exit function. Also initialise mp_sys_path and mp_sys_argv in teensy port.
2014-08-30py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Make tuple and list use mp_int_t/mp_uint_t.Damien George
Part of code cleanup, to resolve issue #50.
2014-08-24py: Fix bug where GC collected native/viper/asm function data.Damien George
Because (for Thumb) a function pointer has the LSB set, pointers to dynamic functions in RAM (eg native, viper or asm functions) were not being traced by the GC. This patch is a comprehensive fix for this. Addresses issue #820.
2014-08-16py: Put SystemExit in builtin namespace.Damien George
Also fix unix port so that SystemExit with no arg exits with value 0.
2014-08-04Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.Damien George
qstr_init is always called exactly before mp_init, so makes sense to just have mp_init call it. Similarly with mp_init_emergency_exception_buf. Doing this makes the ports simpler and less error prone (ie they can no longer forget to call these).
2014-07-29Merge pull request #738 from dhylands/except-argsDamien George
Add support for storing args during an exception raised by an irq.
2014-07-28py: Implement __file__ attribute for modules.Paul Sokolovsky
2014-07-25Add support for storing args during an exception raised by an irq.Dave Hylands
The user code should call micropython.alloc_emergency_exception_buf(size) where size is the size of the buffer used to print the argument passed to the exception. With the test code from #732, and a call to micropython.alloc_emergenncy_exception_buf(100) the following error is now printed: ```python >>> import heartbeat_irq Uncaught exception in Timer(4) interrupt handler Traceback (most recent call last): File "0://heartbeat_irq.py", line 14, in heartbeat_cb NameError: name 'led' is not defined ```
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-07-01stackctrl: Add "mp_" prefix.Paul Sokolovsky
2014-06-29windows: Sync mpconfigport.h with the unix' versionstijn
- rearrange/add definitions that were not there so it's easier to compare both - use MICROPY_PY_SYS_PLATFORM in main.c since it's available anyway - define EWOULDBLOCK, it is missing from ingw32
2014-06-27py: Move stack_ctrl_init() to mp_init().Paul Sokolovsky
As stack checking is enabled by default, ports which don't call stack_ctrl_init() are broken now (report RuntimeError on startup). Save them trouble and just init stack control framework in interpreter init.
2014-06-27py: Add portable framework to query/check C stack usage.Paul Sokolovsky
Such mechanism is important to get stable Python functioning, because Python function calling is handled with C stack. The idea is to sprinkle STACK_CHECK() calls in places where there can be C recursion. TODO: Add more STACK_CHECK()'s.
2014-06-24unix: Dump default heap size in usage message.Paul Sokolovsky
2014-06-22unix: uClibc doesn't like NULL as a buffer arg to realpath().Paul Sokolovsky
So, allocate one explicitly.
2014-06-05unix: Fix path seperator used depending on OSstijn
';' is the standard seperator used for paths in environment variables on Windows
2014-06-03py: Instead of having "debug on" var, have "optimization level" var.Paul Sokolovsky
This allows to have multiple "optimization" levels (CPython has two (-OO removes docstrings), we can have more).
2014-06-03unix: Properly print script filename in case of error.Paul Sokolovsky
2014-05-31unix: 64-bit cleanness.Paul Sokolovsky
2014-05-31unix: Add poorman's stack usage info to mem_info() dump.Paul Sokolovsky
2014-05-24Add SystemExit exception and use it in unix/ and stmhal/ ports.Damien George
Addresses issue #598.