summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py: Move call_function_*_protected() functions to py/ for reuse.Paul Sokolovsky2016-04-25
| | | | They almost certainly needed by any C code which calls Python callbacks.
* py/mkrules.mk: Remove obsolete rules for auto qstr generation.Damien George2016-04-22
|
* py/mkenv.mk: Remove -s and -S args from PYTHON variable.Damien George2016-04-21
| | | | | | Qstr auto-generation is now much faster so this optimisation for start-up time is no longer needed. And passing "-s -S" breaks some things, like stmhal's "make deploy".
* py: Fix bug passing a string as a keyword arg in a dict.Damien George2016-04-21
| | | | Addresses issue #1998.
* py: Divide "split" and "cat" phases of qstr extraction for better efficiency.Paul Sokolovsky2016-04-19
| | | | | | | | | E.g. for stmhal, accumulated preprocessed output may grow large due to bloated vendor headers, and then reprocessing tens of megabytes on each build make take couple of seconds on fast hardware (=> potentially dozens of seconds on slow hardware). So instead, split once after each change, and only cat repetitively (guaranteed to be fast, as there're thousands of lines involved at most).
* py/makeqstrdefs.py: Process only CPP line-numbering info.Paul Sokolovsky2016-04-19
| | | | Not stuff like "#pragma", etc.
* py/mkrules.mk: Fix Bashism.Paul Sokolovsky2016-04-19
|
* py/mkrules.mk: Cleanup command passed to shell.Paul Sokolovsky2016-04-19
|
* py/mkrules.mk: Try to detect and emulate make -B behavior for qstr extraction.Paul Sokolovsky2016-04-19
| | | | | | If make -B is run, the rule is run with $? empty. Extract fron all file in this case. But this gets fragile, really "make clean" should be used instead with such build complexity.
* py: Rework QSTR extraction to work in simple and obvious way.Paul Sokolovsky2016-04-19
| | | | | | | | | | | | When there're C files to be (re)compiled, they're all passed first to preprocessor. QSTR references are extracted from preprocessed output and split per original C file. Then all available qstr files (including those generated previously) are catenated together. Only if the resulting content has changed, the output file is written (causing almost global rebuild to pick up potentially renumbered qstr's). Otherwise, it's not updated to not cause spurious rebuilds. Related make rules are split to minimize amount of commands executed in the interim case (when some C files were updated, but no qstrs were changed).
* py/mkenv.mk: Optimize Python startup type during make process.Paul Sokolovsky2016-04-17
| | | | By skipping loading site.py, etc.
* py/frozenmod: Pass the source name of the frozen module to the lexer.Damien George2016-04-17
| | | | | This allows for better error messages, since the name of the file (sans .py) can now be printed when an exception occurs within a frozen script.
* py/mkrules.mk: Suppress line-no output from CPP for qstr auto-gen.Jan Čapek2016-04-16
|
* py/py.mk: Add makefile variable for qstr autogeneration control.Jan Čapek2016-04-16
| | | | | | | - any architecture may explicitely build with qstring make QSTR_AUTOGEN_DISABLE=1 autogeneration disabled and provide its own list of qstrings by the standard mechanisms (qstrdefsport.h).
* py/mkrules.mk: Add mpconfig[port].h dependency to qstr generating rule.Jan Čapek2016-04-16
|
* py: Add rules for automated extraction of qstrs from sources.Jan Čapek2016-04-16
| | | | | | | | | | | | | | | | | | | | | - add template rule that converts a specified source file into a qstring file - add special rule for generating a central header that contains all extracted/autogenerated strings - defined by QSTR_DEFS_COLLECTED variable. Each platform appends a list of sources that may contain qstrings into a new build variable: SRC_QSTR. Any autogenerated prerequisities are should be appened to SRC_QSTR_AUTO_DEPS variable. - remove most qstrings from py/qstrdefs, keep only qstrings that contain special characters - these cannot be easily detected in the sources without additional annotations - remove most manual qstrdefs, use qstrdef autogen for: py, cc3200, stmhal, teensy, unix, windows, pic16bit: - remove all micropython generic qstrdefs except for the special strings that contain special characters (e.g. /,+,<,> etc.) - remove all port specific qstrdefs except for special strings - append sources for qstr generation in platform makefiles (SRC_QSTR)
* py/makeqstrdefs: Add script to automate extraction of qstr from sources.Pavel Moravec2016-04-16
| | | | | | | | | | This script will search for patterns of the form Q(...) and generate a list of them. The original code by Pavel Moravec has been significantly simplified to remove the part that searched for C preprocessor directives (eg #if). This is because all source is now run through CPP before being fed into this script.
* py/map: Change hash-table allocation policy to be less aggressive.Damien George2016-04-15
| | | | | | | | | | Small hash tables (eg those used in user class instances that only have a few members) now only use the minimum amount of memory necessary to hold the key/value pairs. This can reduce performance for instances that have many members (because then there are many reallocations/rehashings of the table), but helps to conserve memory. See issue #1760.
* py: Declare help, input, open builtins in core.Paul Sokolovsky2016-04-15
| | | | These are *defined* per-port, but why redeclare them again and again.
* py/makeqstrdata: Add special case to handle \n qstr.Damien George2016-04-14
|
* py/makeqstrdata: Reinstate Python2 compatibility.Damien George2016-04-14
|
* py/makeqstrdata: Fix rendering of qstrs that have non-printable ASCII.Damien George2016-04-14
| | | | | The qstr data needs to be turned into a proper C string so non-ASCII chars must be properly escaped according to C rules.
* py: Simplify "and" action within parser by making ident-rules explicit.Damien George2016-04-14
| | | | | | | | | | Most grammar rules can optimise to the identity if they only have a single argument, saving a lot of RAM building the parse tree. Previous to this patch, whether a given grammar rule could be optimised was defined (mostly implicitly) by a complicated set of logic rules. With this patch the definition is always specified explicitly by using "and_ident" in the rule definition in the grammar. This simplifies the logic of the parser, making it a bit smaller and faster. RAM usage in unaffected.
* py/makeqstrdata: Add more names for escaped chars and esc non-printable.Damien George2016-04-13
| | | | | Non-printable characters are escaped as 0xXX, where XX are the hex digits of the character value.
* py: Add ability to have frozen persistent bytecode from .mpy files.Damien George2016-04-13
| | | | | | | The config variable MICROPY_MODULE_FROZEN is now made of two separate parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY. This allows to have none, either or both of frozen strings and frozen mpy files (aka frozen bytecode).
* py/makeqstrdata: Factor out some code to functions that can be reused.Damien George2016-04-13
|
* py/emitglue: Make mp_raw_code_t* arguments constant pointers.Damien George2016-04-13
|
* py/emitglue: Move typedef of mp_raw_code_t from .c to .h file.Damien George2016-04-13
| | | | It's needed by frozen bytecode.
* py: Fix constant folding and inline-asm to work with new async grammar.Damien George2016-04-13
|
* py: add async/await/async for/async with syntaxpohmelie2016-04-13
| | | | | | | | They are sugar for marking function as generator, "yield from" and pep492 python "semantically equivalents" respectively. @dpgeorge was the original author of this patch, but @pohmelie made changes to implement `async for` and `async with`.
* py/modbuiltins: __repl_print__: Add comment about setting "_" special var.Paul Sokolovsky2016-04-13
|
* extmod/machine_i2c: Implement I2C memory reading/writing.Damien George2016-04-12
|
* extmod: Add generic machine.I2C class, with bit-bang I2C.Damien George2016-04-12
| | | | Should work on any machine that provides the correct pin functions.
* extmod: Add initial framebuf module.Damien George2016-04-12
|
* py/stream: Move uPy func obj wrappers to below their respective funcs.Damien George2016-04-10
|
* py/stream: Simplify arg extraction logic for stream_ioctl.Damien George2016-04-10
| | | | | | | Saves 16 bytes of code. Also, use mp_obj_get_int_truncated to allow integers as big as a machine word to be passed as the value.
* py/stream: ioctl(): Properly support 2-arg form.Paul Sokolovsky2016-04-10
|
* py/stream: Fix signed comparison issue.Paul Sokolovsky2016-04-10
|
* py/stream: Add Python-level ioctl() method.Paul Sokolovsky2016-04-10
| | | | | | | Will call underlying C virtual methods of stream interface. This isn't intended to be added to every stream object (it's not in CPython), but is convenient way to expose extra operation on Python side without adding bunch of Python-level methods.
* py/stream.h: Add bigger inventory of stream ioctl's.Paul Sokolovsky2016-04-10
|
* py/objarray: Fix array.append so it doesn't extend if append fails.Damien George2016-04-07
| | | | Addresses issue #1965.
* py: Implement basic with support in native emitter.Damien George2016-04-07
|
* py: Combine continuous block of emit steps into with_cleanup emit call.Damien George2016-04-07
| | | | Because different emitters need to handle with-cleanup in different ways.
* py: Move stream-related declarations from obj.h to stream.h.Paul Sokolovsky2016-04-05
|
* py/obj.h: Add comment why mp_fun_kw_t takes non-const mp_map_t*.Paul Sokolovsky2016-04-04
| | | | | | mp_fun_kw_t takes mp_map_t* (and not const mp_map_t*) to ease passing this arg to mp_map_lookup(), which may modify its arg, depending on flags.
* py/map: Prevent map resize failure from destroying map.Stephen Kyle2016-04-01
|
* py/ringbuf.h: Add reusable ring buffer class.Paul Sokolovsky2016-03-30
| | | | | | Features inline get/put operations for the highest performance. Locking is not part of implementation, operation should be wrapped with locking externally as needed.
* py/parsenum: Use pow function to apply exponent to decimal number.Damien George2016-03-29
| | | | | | Pow is already a dependency when compiling with floats, so may as well use it here to reduce code size and speed up the conversion for most cases.
* py/formatfloat: Fix further cases of buffer overflow in formatting.Damien George2016-03-29
| | | | | Includes extensive test cases to catch hopefully all cases where buffer might overflow.
* py/formatfloat: Fix case of float format where leading digit was "10".Damien George2016-03-29
| | | | | | | | | | When taking the logarithm of the float to determine the exponent, there are some edge cases that finish the log loop too large. Eg for an input value of 1e32-epsilon, this is actually less than 1e32 from the log-loop table and finishes as 10.0e31 when it should be 1.0e32. It is thus rendered as :e32 (: comes after 9 in ascii). There was the same problem with numbers less than 1.