summaryrefslogtreecommitdiffstatshomepage
path: root/py/builtin.c
Commit message (Collapse)AuthorAge
* py: Add builtin round function.Damien George2014-10-31
| | | | Addresses issue #934.
* py: Fix smallint modulo with negative arguments.Damien George2014-10-22
| | | | Addresses issue #927.
* py: Convert [u]int to mp_[u]int_t where appropriate.Damien George2014-10-03
| | | | Addressing issue #50.
* py: Fix build error when float disabled; add test for divmod.Damien George2014-09-13
|
* py: Implement divmod, % and proper // for floating point.Damien George2014-09-13
| | | | Tested and working on unix and pyboard.
* py: Rename mp_builtin_id to mp_obj_id and make it public.Damien George2014-09-07
|
* 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: Change all uint to mp_uint_t in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Consolidate min/max functions into one, and add key= argument.Damien George2014-08-24
| | | | Addresses issue #811.
* py: Implement builtin reversed() function.Damien George2014-08-12
| | | | | | | | reversed function now implemented, and works for tuple, list, str, bytes and user objects with __len__ and __getitem__. Renamed mp_builtin_len to mp_obj_len to make it publically available (eg for reversed).
* py: Make a function static; replace NULL with MP_OBJ_NULL.Damien George2014-08-12
|
* py: Improve handling of long-int overflow.Damien George2014-07-31
| | | | | | | | | | This removes mpz_as_int, since that was a terrible function (it implemented saturating conversion). Use mpz_as_int_checked and mpz_as_uint_checked. These now work correctly (they previously had wrong overflow checking, eg print(chr(10000000000000)) on 32-bit machine would incorrectly convert this large number to a small int).
* py: Make id() return small int for the most common address space mapping.Paul Sokolovsky2014-07-28
| | | | | | | | | | | Many OSes/CPUs have affinity to put "user" data into lower half of address space. Take advantage of that and remap such addresses into full small int range (including negative part). If address is from upper half, long int will be used. Previously, small int was returned for lower quarter of address space, and upper quarter. For 2 middle quarters, long int was used, which is clearly worse schedule than the above.
* py: Make print() accept "file" argument, and actually print to stream.Paul Sokolovsky2014-07-19
| | | | | And not system printf(), like it was before. For this, move pfenv_printf() from stmhal port to py/.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Make unichar_charlen() accept/return machine_uint_t.Paul Sokolovsky2014-06-28
|
* py: Small comments, name changes, use of machine_int_t.Damien George2014-06-28
|
* builtin: Restore bytestr compatibility.Paul Sokolovsky2014-06-27
|
* builtin: ord, chr: Unicode support.Chris Angelico2014-06-27
|
* py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.Paul Sokolovsky2014-06-20
| | | | | One thing is wanting to do 1 / 2 and get something else but 0, and quite another - doing rocket science ;-).
* Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot2014-06-19
|
* py: Make sure getattr() works with non-interned strings (by interning them).Paul Sokolovsky2014-06-08
|
* Change comments (mainly URLs) to no longer specifically say Python 3.3Chris Angelico2014-06-06
|
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* Change const byte* to const char* where sensible.Damien George2014-05-25
| | | | | This removes need for some casts (at least, more than it adds need for new casts!).
* py: Add basic implementation of hasattr() function.Paul Sokolovsky2014-05-11
|
* 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/.
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* Fix the builtin min() and max() functions (and add tests).Andrew Scheller2014-05-01
| | | | Fixes #539
* Add ARRAY_SIZE macro, and use it where possible.Damien George2014-04-26
|
* py: Add MP_OBJ_STOP_ITERATION and make good use of it.Damien George2014-04-17
| | | | | Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL. This helps a lot in debugging and understanding of function API.
* py: Make built-in 'range' a class.Damien George2014-04-17
| | | | Addresses issue #487.
* py: Add builtin functions bin and oct, and some tests for them.Damien George2014-04-15
|
* py: Fix builtin hex to print prefix.Damien George2014-04-15
| | | | I was too hasty. Still a one-liner though.
* py: Add hex builtin function.Damien George2014-04-15
| | | | A one-liner, added especially for @pfalcon :)
* py: Revert mp_load_attr() to its previous state (not supporting default val).Paul Sokolovsky2014-04-06
| | | | | | | | Based on the discussion in #433. mp_load_attr() is critical-path function, so any extra check will slowdown any script. As supporting default val required only for getattr() builtin, move correspending implementation there (still as a separate function due to concerns of maintainability of such almost-duplicated code instances).
* py: Optimize locals()/globals() implementation.Paul Sokolovsky2014-04-06
|
* py: Implement globals() and locals() builtins.Paul Sokolovsky2014-04-06
|
* py: Make globals and locals proper dictionary objects.Damien George2014-04-05
| | | | | | | | | | | Finishes addressing issue #424. In the end this was a very neat refactor that now makes things a lot more consistent across the py code base. It allowed some simplifications in certain places, now that everything is a dict object. Also converted builtins tables to dictionaries. This will be useful when we need to turn builtins into a proper module.
* py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George2014-04-05
| | | | | | Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
* py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George2014-04-05
| | | | | | This does not affect code size or performance when debugging turned off. To address issue #420.
* py: Support 3-arg getattr() builtin (with default value).Paul Sokolovsky2014-04-05
|
* py: Remove mp_obj_less (use mp_binary_op(MP_BINARY_OP_LESS..) instead).Damien George2014-04-04
|
* py: Move to Python 3.4.0 compatibility.Damien George2014-04-02
| | | | | | | | | | | | | Very little has changed. In Python 3.4 they removed the opcode STORE_LOCALS, but in Micro Python we only ever used this for CPython compatibility, so it was a trivial thing to remove. It also allowed to clean up some dead code (eg the 0xdeadbeef in class construction), and now class builders use 1 less stack word. Python 3.4.0 introduced the LOAD_CLASSDEREF opcode, which I have not yet understood. Still, all tests (apart from bytecode test) still pass. Bytecode tests needs some more attention, but they are not that important anymore.
* py: Add support for sep and end keywords in print.Damien George2014-04-02
|
* py: Remove old "run time" functions that were 1 liners.Damien George2014-03-31
|
* Merge map.h into obj.h.Damien George2014-03-30
| | | | | | 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.
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | 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.
* py: Rename old const type objects to mp_type_* for consistency.Damien George2014-03-29
|
* Merge branch 'master' of github.com:micropython/micropythonDamien George2014-03-26
|\