summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
Commit message (Collapse)AuthorAge
* unix: Allow to cat a script into stdin from the command line.Damien George2015-06-04
| | | | See issue #1306.
* unix: Allow to override default sys.path value.Paul Sokolovsky2015-05-30
| | | | | | | Using MICROPY_PY_SYS_PATH_DEFAULT macro define. A usecase is building a distribution package, which should not have user home path by default in sys.path. In such case, MICROPY_PY_SYS_PATH_DEFAULT can be defined on make command-line (using CFLAGS_EXTRA).
* unix: Add option to use uPy readline, and enable by default.Damien George2015-05-27
| | | | | | This gets uPy readline working with unix port, with tab completion and history. GNU readline is still supported, configure using MICROPY_USE_READLINE variable.
* unix: Factor out stdio and ctrl-C code to unix_mphal.c file.Damien George2015-05-27
|
* unix: Print unhandled exception to stderr, like CPython does.Paul Sokolovsky2015-05-10
|
* unix: Make extra-coverage function callable from Python scripts.Damien George2015-05-08
| | | | | This allows the output of the extra-coverage tests to be checked using the normal run-tests script.
* unix: Add special function to improve coverage.Damien George2015-05-08
| | | | | | The function and corresponding command-line option are only enabled for the coverage build. They are used to exercise uPy features that can't be properly tested by Python scripts.
* py: Replace py-version.sh with makeversionhdr.py, written in Python.Damien George2015-04-28
| | | | Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
* unix: Bump stack limit and adjust for 64-bitness.Paul Sokolovsky2015-03-21
| | | | Without that, "import http.client" failed due to max recursion.
* unix: Support readline history saving to file, improves interactive usage.Paul Sokolovsky2015-03-13
|
* py: Protect mp_parse and mp_compile with nlr push/pop block.Damien George2015-02-07
| | | | | | | | | | 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.
* py, unix, stmhal: Allow to compile with -Wshadow.Damien George2015-01-20
| | | | See issue #699.
* unix: Add target to build "minimal" uPy interpreter.Damien George2015-01-16
|
* py, unix: Allow to compile with -Wsign-compare.Damien George2015-01-16
| | | | See issue #699.
* py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George2015-01-12
|
* py: Put all global state together in state structures.Damien George2015-01-07
| | | | | | 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.
* unix: Prefix includes with py/; remove need for -I../py.Damien George2015-01-01
|
* py: Add include guards to mpconfig,misc,qstr,obj,runtime,parsehelper.Damien George2014-12-29
|
* unix/windows: Make sure that process exit code is portable 8-bit value.Paul Sokolovsky2014-12-19
| | | | This fixes FORCED_EXIT internal flag leaking into Windows exit code.
* py: Make functions static where appropriate.Damien George2014-12-10
|
* modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky2014-12-08
| | | | | | | | | | | | 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.
* py: Optimise lexer by exposing lexer type.Damien George2014-12-05
| | | | | | | | | 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.
* modmicropython: Move mem_info() and qstr_info() functions from unix port.Paul Sokolovsky2014-12-01
| | | | TODO: Merge useful functionality from modpyb too.
* unix: Allow -X heapsize number take 'w' specifier for word size adjustment.Paul Sokolovsky2014-11-05
| | | | | | 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.
* unix: Make -v dump memory info at exit.Paul Sokolovsky2014-10-26
| | | | Also, move bytecode dumps to -v -v, because they're too verbose for just -v.
* unix: Implement -m option (execute module from stdlib).Paul Sokolovsky2014-10-26
| | | | | | | | 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
* unix/windows: Disable sigaction on windows port.Damien George2014-10-26
|
* py: Add mp_pending_exception global variable, for VM soft interrupt.Damien George2014-10-25
| | | | | | | | | | | 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).
* unix: Allow -X heapsize= option take numbers with K & M suffixes.Paul Sokolovsky2014-10-25
| | | | For kilobytes and megabytes respectively.
* py: Improve memory usage debugging; better GC AT dumping.Damien George2014-10-24
| | | | In unix port, mem_info(1) now prints pretty GC alloc table.
* unix: Make -c option parse input script as a file, as per CPython.Damien George2014-10-17
| | | | Addresses issue #915.
* unix: Rename "microsocket" module to "usocket".Paul Sokolovsky2014-10-09
| | | | | | 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.
* unix: Detect and print compile error.Damien George2014-10-05
|
* py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.Damien George2014-10-03
| | | | This should pretty much resolve issue #50.
* unix: Do a proper clean-up on sys.exit/SystemExit.Damien George2014-10-01
| | | | Addresses issue #859.
* py: For malloc and vstr functions, use size_t exclusively for int type.Damien George2014-09-25
| | | | | | 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.
* py: Move definition of mp_sys_exit to core.Damien George2014-09-15
| | | | | | | | 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.
* py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Make tuple and list use mp_int_t/mp_uint_t.Damien George2014-08-30
| | | | Part of code cleanup, to resolve issue #50.
* py: Fix bug where GC collected native/viper/asm function data.Damien George2014-08-24
| | | | | | | | 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.
* py: Put SystemExit in builtin namespace.Damien George2014-08-16
| | | | Also fix unix port so that SystemExit with no arg exits with value 0.
* Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.Damien George2014-08-04
| | | | | | | 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).
* Merge pull request #738 from dhylands/except-argsDamien George2014-07-29
|\ | | | | Add support for storing args during an exception raised by an irq.
| * Add support for storing args during an exception raised by an irq.Dave Hylands2014-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* | py: Implement __file__ attribute for modules.Paul Sokolovsky2014-07-28
|/
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* stackctrl: Add "mp_" prefix.Paul Sokolovsky2014-07-01
|
* windows: Sync mpconfigport.h with the unix' versionstijn2014-06-29
| | | | | | - 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
* py: Move stack_ctrl_init() to mp_init().Paul Sokolovsky2014-06-27
| | | | | | 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.