summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py/asmx64: Add helper macro for generating REX_[WRXB] bits from a reg64.Damien George2016-02-15
|
* extmod/vfs_fat_ffconf: Reusable FatFs module, move from stmhal/ffconf.Paul Sokolovsky2016-02-15
| | | | TODO: Probably merge into vfs_fat_diskio.
* extmod/vfs_fat_file: Reusable FatFs module, move from stmhal/file.Paul Sokolovsky2016-02-15
|
* extmod/vfs_fat_diskio: Reusable FatFs module, move from stmhal/diskio.Paul Sokolovsky2016-02-15
|
* py/mpstate.h: fs_user_mount is now standard, reusable uPy functionality.Paul Sokolovsky2016-02-15
|
* unix: Enable VfsFat support.Paul Sokolovsky2016-02-14
|
* py/obj.h: If not float support is enabled, define mp_obj_is_float(o) to false.Paul Sokolovsky2016-02-14
| | | | | We have so many configuration options, that finally having shortcuts like this is helpful and cuts on number of ifdef's.
* py/objarray: Implement "in" operator for bytearray.Paul Sokolovsky2016-02-14
|
* extmod/fsusermount: Expose umount as a public function.Damien George2016-02-10
|
* extmod/fsusermount: Change block protocol to support ioctl method.Damien George2016-02-10
| | | | | | | | | | | | | The new block protocol is: - readblocks(self, n, buf) - writeblocks(self, n, buf) - ioctl(self, cmd, arg) The new ioctl method handles the old sync and count methods, as well as a new "get sector size" method. The old protocol is still supported, and used if the device doesn't have the ioctl method.
* py/viper: Allow uint as index to load/store, and give better error msg.Damien George2016-02-09
|
* py/viper: Allow casting of Python integers to viper pointers.Damien George2016-02-09
| | | | | | | | | This allows you to pass a number (being an address) to a viper function that expects a pointer, and also allows casting of integers to pointers within viper functions. This was actually the original behaviour, but it regressed due to native type identifiers being promoted to 4 bits in width.
* py/mpz: Add commented-out mpz_pow3_inpl function, to compute (x**y)%z.Damien George2016-02-03
| | | | | | | This function computes (x**y)%z in an efficient way. For large arguments this operation is otherwise not computable by doing x**y and then %z. It's currently not used, but is added in case it's useful one day.
* py/mpz: Complete implementation of mpz_{and,or,xor} for negative args.Doug Currie2016-02-03
| | | | | | | | | | | | For these 3 bitwise operations there are now fast functions for positive-only arguments, and general functions for arbitrary sign arguments (the fast functions are the existing implementation). By default the fast functions are not used (to save space) and instead the general functions are used for all operations. Enable MICROPY_OPT_MPZ_BITWISE to use the fast functions for positive arguments.
* py: Extend native type-sig to use 4 bits, so uint is separate to ptr.Damien George2016-02-02
| | | | | | | Before this patch, the native types for uint and ptr/ptr8/ptr16/ptr32 all overlapped and it was possible to make a mistake in casting. Now, these types are all separate and any coding mistakes will be raised as runtime errors.
* py/objstr: Make mp_obj_str_format_helper static.Damien George2016-02-02
|
* py/objstr: For str.format, don't allocate on the heap for field name.Damien George2016-02-02
|
* py/objstr: For str.format, add nested/computed fields support.pohmelie2016-02-02
| | | | | | | Eg: '{:{}}'.format(123, '>20') @pohmelie was the original author of this patch, but @dpgeorge made significant changes to reduce code size and improve efficiency.
* py/vm: Fix popping of exception block in UNWIND_JUMP opcode.Damien George2016-02-01
| | | | Fixes issue #1812.
* py/mpprint: Fix sign extension when printf'ing %u, %x and %X.Damien George2016-02-01
|
* py/formatfloat: Add ability to format doubles with exponents > 99.Damien George2016-01-29
| | | | | | | | For single prec, exponents never get larger than about 37. For double prec, exponents can be larger than 99 and need 3 bytes to format. This patch makes the number of bytes needed configurable. Addresses issue #1772.
* py/runtime: mp_stack_ctrl_init() should be called immediately on startup.Paul Sokolovsky2016-01-29
| | | | | | | | | Calling it from mp_init() is too late for some ports (like Unix), and leads to incomplete stack frame being captured, with following GC issues. So, now each port should call mp_stack_ctrl_init() on its own, ASAP after startup, and taking special precautions so it really was called before stack variables get allocated (because if such variable with a pointer is missed, it may lead to over-collecting (typical symptom is segfaulting)).
* py/bc: Update opcode format table now that MP_BC_NOT opcode is gone.Damien George2016-01-28
| | | | | | MP_BC_NOT was removed and the "not" operation made a proper unary operator, and the opcode format table needs to be updated to reflect this change (but actually the change is only cosmetic).
* py/inlineasm: Add ability to specify return type of asm_thumb funcs.Damien George2016-01-27
| | | | | | | | | | Supported return types are: object, bool, int, uint. For example: @micropython.asm_thumb def foo(r0, r1) -> uint: add(r0, r0, r1)
* extmod/modurandom: Add some extra random functions.Damien George2016-01-26
| | | | | | | | | | | | | Functions added are: - randint - randrange - choice - random - uniform They are enabled with configuration variable MICROPY_PY_URANDOM_EXTRA_FUNCS, which is disabled by default. It is enabled for unix coverage build and stmhal.
* extmod/moduhashlib: Add support for SHA1 (based on axTLS).Paul Sokolovsky2016-01-24
| | | | | | | | | SHA1 is used in a number of protocols and algorithm originated 5 years ago or so, in other words, it's in "wide use", and only newer protocols use SHA2. The implementation depends on axTLS enabled. TODO: Make separate config option specifically for sha1().
* py/modmicropython: Add stack_use, heap_lock and heap_unlock functions.Damien George2016-01-24
| | | | | | | | | micropython.stack_use() returns an integer being the number of bytes used on the stack. micropython.heap_lock() and heap_unlock() can be used to prevent the memory manager from allocating anything on the heap. Calls to these are allowed to be nested.
* py/objgetitemiter: Typo fix in comment.Paul Sokolovsky2016-01-23
|
* py: Add ustruct.pack_into and unpack_fromDave Hylands2016-01-19
|
* extmod/modurandom: Add "urandom" module.Paul Sokolovsky2016-01-17
| | | | | | | | Seedable and reproducible pseudo-random number generator. Implemented functions are getrandbits(n) (n <= 32) and seed(). The algorithm used is Yasmarang by Ilya Levin: http://www.literatecode.com/yasmarang
* py/objproperty: Fix static struct to build with OBJ_REPR_D.Damien George2016-01-15
|
* builtin property: accept keyword argumentschrysn2016-01-14
| | | | | | | | | | this allows python code to use property(lambda:..., doc=...) idiom. named versions for the fget, fset and fdel arguments are left out in the interest of saving space; they are rarely used and easy to enable when actually needed. a test case is included.
* py: Use new code pattern for parsing kw args with mp_arg_parse_all.Damien George2016-01-13
| | | | Makes code easier to read and more maintainable.
* py/emitglue: Use mp_obj_is_float instead of MP_OBJ_IS_TYPE.Damien George2016-01-13
|
* py: unary_op enum type fix, and a cast to remove clang warningAntonin ENFRUN2016-01-12
|
* py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.Damien George2016-01-11
| | | | | | | | The first argument to the type.make_new method is naturally a uPy type, and all uses of this argument cast it directly to a pointer to a type structure. So it makes sense to just have it a pointer to a type from the very beginning (and a const pointer at that). This patch makes such a change, and removes all unnecessary casting to/from mp_obj_t.
* py: Change type signature of builtin funs that take variable or kw args.Damien George2016-01-11
| | | | | With this patch the n_args parameter is changed type from mp_uint_t to size_t.
* py: Change type of .make_new and .call args: mp_uint_t becomes size_t.Damien George2016-01-11
| | | | | | | This patch changes the type signature of .make_new and .call object method slots to use size_t for n_args and n_kw (was mp_uint_t. Makes code more efficient when mp_uint_t is larger than a machine word. Doesn't affect ports when size_t and mp_uint_t have the same size.
* py: Remove long-obsolete mp_method_t typedef.Damien George2016-01-10
|
* py/objint: Fix classification of float so it works for OBJ_REPR_D.Damien George2016-01-08
|
* py/mpz: Fix conversion of float to mpz so it works on big endian archs.Damien George2016-01-08
|
* py/runtime: Use appropriate printf fmt for malloc num_bytes.Damien George2016-01-08
|
* py/smallint: Allow to override MP_SMALL_INT_MIN et al.Damien George2016-01-08
| | | | | This allows a port to specify exactly how many bits are in a small int (eg for a uPy bytecode cross compiler).
* py/obj: For OBJ_REPR_D, use uint32_t cast when extracting qstr value.Damien George2016-01-08
|
* py/parse: Include unistd.h for ssize_t definition.Damien George2016-01-08
| | | | In some cases ssize_t is not defined by already included headers.
* py/emitglue: Add more feature flags to .mpy persistent bytecode output.Damien George2016-01-08
| | | | | Need to record in .mpy file whether unicode is enabled, and how many bits are in a small int.
* py/viper: Truncate viper integer args so they can be up to 32-bit.Damien George2016-01-07
|
* py/inlinethumb: Remove 30-bit restriction on movwt instruction.Damien George2016-01-07
| | | | movwt can now move a full 32-bit constant into a register.
* py/inlinethumb: Allow assembler to use big ints as args to instructions.Damien George2016-01-07
|
* py/parse: Improve constant folding to operate on small and big ints.Damien George2016-01-07
| | | | | | | | | | | | | | | Constant folding in the parser can now operate on big ints, whatever their representation. This is now possible because the parser can create parse nodes holding arbitrary objects. For the case of small ints the folding is still efficient in RAM because the folded small int is stored inplace in the parse node. Adds 48 bytes to code size on Thumb2 architecture. Helps reduce heap usage because more constants can be computed at compile time, leading to a smaller parse tree, and most importantly means that the constants don't have to be computed at runtime (perhaps more than once). Parser will now be a little slower when folding due to calls to runtime to do the arithmetic.