summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
Commit message (Collapse)AuthorAge
* 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.
* py: Add portable framework to query/check C stack usage.Paul Sokolovsky2014-06-27
| | | | | | | | 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.
* unix: Dump default heap size in usage message.Paul Sokolovsky2014-06-24
|
* unix: uClibc doesn't like NULL as a buffer arg to realpath().Paul Sokolovsky2014-06-22
| | | | So, allocate one explicitly.
* unix: Fix path seperator used depending on OSstijn2014-06-05
| | | | ';' is the standard seperator used for paths in environment variables on Windows
* py: Instead of having "debug on" var, have "optimization level" var.Paul Sokolovsky2014-06-03
| | | | | This allows to have multiple "optimization" levels (CPython has two (-OO removes docstrings), we can have more).
* unix: Properly print script filename in case of error.Paul Sokolovsky2014-06-03
|
* unix: 64-bit cleanness.Paul Sokolovsky2014-05-31
|
* unix: Add poorman's stack usage info to mem_info() dump.Paul Sokolovsky2014-05-31
|
* Add SystemExit exception and use it in unix/ and stmhal/ ports.Damien George2014-05-24
| | | | Addresses issue #598.
* Merge pull request #600 from stinos/unix-exitcodeDamien George2014-05-13
|\ | | | | unix: Use standard return codes for main
| * unix: Use standard return codes for mainstijn2014-05-11
| | | | | | | | | | As in the CPython manual: "Unix programs generally use 2 for command line syntax errors and 1 for all other kind of errors"
* | unix: Implement -O option to turn off __debug__ flag.Damien George2014-05-12
| |
* | py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).Damien George2014-05-12
|/
* modsys, unix: Add sys.exit(), should be implemented by a port.Paul Sokolovsky2014-05-10
|
* Add input command for unixDave Hylands2014-05-07
|
* modgc: Add new module for GC-related functionality.Paul Sokolovsky2014-05-06
|
* py, unix: Add -v option, print bytecode dump if used.Paul Sokolovsky2014-05-05
| | | | | | | | | | This will work if MICROPY_DEBUG_PRINTERS is defined, which is only for unix/windows ports. This makes it convenient to user uPy normally, but easily get bytecode dump on the spot if needed, without constant recompiles back and forth. TODO: Add more useful debug output, adjust verbosity level on which specifically bytecode dump happens.
* unix: Remove test class and code.Damien George2014-05-04
|
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
* Don't print git hash as well as git tag in banner.v1.0Damien George2014-05-03
|
* Merge branch 'master' of github.com:micropython/micropythonDamien George2014-05-03
|\
| * mingw: Add implementation of realpath()stijn2014-05-03
| | | | | | | | | | | | | | | | | | The mingw port used _fullpath() until now, but the behaviour is not exactly the same as realpath()'s on unix; major difference being that it doesn't return an error for non-existing files, which would bypass main's error checking and bail out without any error message. Also realpath() will return forward slashes only since main() relies on that.
* | py: Print tag/version/git describe in uPy banner.Damien George2014-05-03
|/
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.