summaryrefslogtreecommitdiff
path: root/unix/main.c
AgeCommit message (Collapse)Author
2014-05-13Merge pull request #600 from stinos/unix-exitcodeDamien George
unix: Use standard return codes for main
2014-05-12unix: Implement -O option to turn off __debug__ flag.Damien George
2014-05-12py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).Damien George
2014-05-11unix: Use standard return codes for mainstijn
As in the CPython manual: "Unix programs generally use 2 for command line syntax errors and 1 for all other kind of errors"
2014-05-10modsys, unix: Add sys.exit(), should be implemented by a port.Paul Sokolovsky
2014-05-07Add input command for unixDave Hylands
2014-05-06modgc: Add new module for GC-related functionality.Paul Sokolovsky
2014-05-05py, unix: Add -v option, print bytecode dump if used.Paul Sokolovsky
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.
2014-05-04unix: Remove test class and code.Damien George
2014-05-03Add license header to (almost) all files.Damien George
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/.
2014-05-03Don't print git hash as well as git tag in banner.v1.0Damien George
2014-05-03Merge branch 'master' of github.com:micropython/micropythonDamien George
2014-05-03py: Print tag/version/git describe in uPy banner.Damien George
2014-05-03mingw: Add implementation of realpath()stijn
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.
2014-05-02py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky
Specifically, nlr.h does.
2014-04-20unix windows: mingw32 doesn't have realpath(), use _fullpath() instead.Paul Sokolovsky
2014-04-20unix mem_info(): Dump GC info only if it's enabled.Paul Sokolovsky
2014-04-18unix modffi: Convert to static module structures.Paul Sokolovsky
2014-04-17unix modsocket: Convert to static module structures.Paul Sokolovsky
2014-04-17unix: Make mem_info() dump GC info too.Paul Sokolovsky
mem_info() is already pretty hacky, let it be more hacky.
2014-04-17unix modtime: Convert to static module structures.Paul Sokolovsky
2014-04-17build: Simplify build directory layout by putting all headers in genhdr.Damien George
Any generated headers go in $(BUILD)/genhdr/, and are #included as 'genhdr/xxx.h'.
2014-04-13py, unix: Convert sys module to static representation.Paul Sokolovsky
2014-04-10unix: Add option to only compile, and not execute code.Damien George
2014-04-08unix: Oops, remove nlr_jump test in main.Damien George
2014-04-08Add a check for NULL nlr_top in nlr_jump.Damien George
If no nlr_buf has been pushed, and an nlr_jump is called, then control is transferred to nlr_jump_fail (which should bail out with a fatal error).
2014-04-08Improve REPL detecting when input needs to continue.Damien George
Full CPython compatibility with this requires actually parsing the input so far collected, and if it fails parsing due to lack of tokens, then continue collecting input. It's not worth doing it this way. Not having compatibility at this level does not hurt the goals of Micro Python.
2014-04-08unix, windows: There's no "help" builtin.Paul Sokolovsky
2014-04-07Add uPy welcome message to UNIX and Windows ports; update Teensy port.Damien George
Partly addresses issue #154.
2014-04-06py: Add option to compiler to specify default code emitter.Damien George
Also add command line option to unix port to select emitter.
2014-04-04unix: Use STATIC modifier to enable code size analysis via map file.Paul Sokolovsky
2014-04-04unix: Routines related to terminal reading should use system malloc.Paul Sokolovsky
Otherwise we have mixup between system and GC alloc.
2014-04-04unix: Allocate more heap memory by default on 64 bit machines.Damien George
Pointers are 2x bigger on 64 bit machines, so we should allocate twice the memory to have a comparable heap size.
2014-04-02unix: Use argv[0] for command name in usage.Paul Sokolovsky
2014-04-02unix: Support #if-able impl-specific cmdline options.Paul Sokolovsky
For example, we still build w/o GC enabled, so cannot really set heap size.
2014-04-02unix: Properly recognize and report when script on cmdline not found.Paul Sokolovsky
Previosuly just silently exited.
2014-03-31py: Remove old "run time" functions that were 1 liners.Damien George
2014-03-30Merge map.h into obj.h.Damien George
Pretty much everyone needs to include map.h, since it's such an integral part of the Micro Python object implementation. Thus, the definitions are now in obj.h instead. map.h is removed.
2014-03-30Rename rt_* to mp_*.Damien George
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
2014-03-26Remove mp_obj_type_t.methods entry and use .locals_dict instead.Damien George
Originally, .methods was used for methods in a ROM class, and locals_dict for methods in a user-created class. That distinction is unnecessary, and we can use locals_dict for ROM classes now that we have ROMable maps. This removes an entry in the bloated mp_obj_type_t struct, saving a word for each ROM object and each RAM object. ROM objects that have a methods table (now a locals_dict) need an extra word in total (removed the methods pointer (1 word), no longer need the sentinel (2 words), but now need an mp_obj_dict_t wrapper (4 words)). But RAM objects save a word because they never used the methods entry. Overall the ROM usage is down by a few hundred bytes, and RAM usage is down 1 word per user-defined type/class. There is less code (no need to check 2 tables), and now consistent with the way ROM modules have their tables initialised. Efficiency is very close to equivaluent.
2014-03-26Change mp_method_t.name from const char * to qstr.Damien George
Addresses issue #377.
2014-03-16unix: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-03-08unix: Make usage info reflect actual usage of -X option.Damien George
2014-03-08Implement ROMable modules. Add math module.Damien George
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).
2014-03-04unix: Add to usage print-out telling about -X option.Damien George
2014-03-04unix: Allow to set heap size using "-X heapsize=N" option.Paul Sokolovsky
2014-02-16Make DEBUG_printf() a proper function, implementation is port-dependent.Paul Sokolovsky
In particular, unix outputs to stderr, to allow to run testsuite against micropython built with debug output (by redirecting stderr to /dev/null).
2014-02-15Implement proper exception type hierarchy.Damien George
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.
2014-02-15Change mp_obj_type_t.name from const char * to qstr.Damien George
Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
2014-02-14Allow ports to define statically builtin functions.Paul Sokolovsky
Convert unix open() to such.